platform/kernel/u-boot.git
2 years agomicroblaze: exception: fix return address for delay slot exceptions
Ovidiu Panait [Sun, 13 Feb 2022 08:09:22 +0000 (10:09 +0200)]
microblaze: exception: fix return address for delay slot exceptions

According to the MicroBlaze reference manual (xilinx2021.2/ug984/page-37):
"""
If an exception is caused by an instruction in a delay slot (that is,
ESR[DS]=1), the exception handler should return execution to
the address stored in BTR instead of the normal exception return
address stored in R17.
"""

Adjust the code to print the proper return address for delay slot
exceptions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Link: https://lore.kernel.org/r/20220213080925.1548411-4-ovidiu.panait@windriver.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2 years agomicroblaze: exception: fix delay slot exception handling
Ovidiu Panait [Sun, 13 Feb 2022 08:09:21 +0000 (10:09 +0200)]
microblaze: exception: fix delay slot exception handling

The switch statement in _hw_exception_handler() only covers the
rightmost 5 bits that encode the exception cause:
switch (state & 0x1f)
{
...
}

For this reason, the "0x1000" case will never be reached, because the 13th
bit was zeroed out. To fix this, move delay slot exception handling before
the switch statement (delay slot (DS) bit in Exception Status Register is
independent of the exception cause (EC)).

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Link: https://lore.kernel.org/r/20220213080925.1548411-3-ovidiu.panait@windriver.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2 years agomicroblaze: exception: migrate MICROBLAZE_V5 to Kconfig
Ovidiu Panait [Sun, 13 Feb 2022 08:09:20 +0000 (10:09 +0200)]
microblaze: exception: migrate MICROBLAZE_V5 to Kconfig

Also, rename it to XILINX_MICROBLAZE0_DELAY_SLOT_EXCEP, since it only
covers delay slot exception support.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Link: https://lore.kernel.org/r/20220213080925.1548411-2-ovidiu.panait@windriver.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2 years agomicroblaze: exception: move privileged instruction exception out of v5 ifdef
Ovidiu Panait [Sun, 13 Feb 2022 08:09:19 +0000 (10:09 +0200)]
microblaze: exception: move privileged instruction exception out of v5 ifdef

The privileged instruction exception seems to have been introduced in
microblaze v7.00 along with MMU support, so having it wrapped in
MICROBLAZE_v5 ifdefs seems incorrect. Move it out of the ifdef, since all
recent microblaze versions support it.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Link: https://lore.kernel.org/r/20220213080925.1548411-1-ovidiu.panait@windriver.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2 years agoxilinx: Remove GPIO_EXTRA_HEADER selection
Michal Simek [Fri, 4 Feb 2022 07:40:48 +0000 (08:40 +0100)]
xilinx: Remove GPIO_EXTRA_HEADER selection

Platform specific headers are empty that's why there is no need to include
them. That's why remove them for Zynq/ZynqMP and Versal.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/625b1be0b813e2b9a5323c0529f9c567bfe13e75.1643960446.git.michal.simek@xilinx.com
2 years agovideo: Add missing dependency for DM_GPIO
Michal Simek [Fri, 4 Feb 2022 07:36:54 +0000 (08:36 +0100)]
video: Add missing dependency for DM_GPIO

Seps driver also requires DM_GPIO to be enabled.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/da8c25c19e5c723ed16a2a6b8494dfb967328567.1643960212.git.michal.simek@xilinx.com
2 years agoscsi: ceva: Enable PHY and reset support
Michal Simek [Mon, 7 Feb 2022 09:36:33 +0000 (10:36 +0100)]
scsi: ceva: Enable PHY and reset support

Add phy and reset support for ceva sata IP. Phy and reset are optional
properties that's why detect if description is available. If not just
continue with operation.
This code was tested on Xilinx Kria SOM kv260-revA with sata connector
populated.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://lore.kernel.org/r/eb3adf649be866aab19fc70ecc0fc8921545b1ac.1644226590.git.michal.simek@xilinx.com
2 years agophy: zynqmp: Add support for sata and DP phy initialization
Michal Simek [Mon, 7 Feb 2022 09:36:32 +0000 (10:36 +0100)]
phy: zynqmp: Add support for sata and DP phy initialization

DP is untested but just c&p from Linux driver. Sata is tested on kv260-revA
board which has SATA connector populated.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/d231610160e76a2ad1b4a163e0e8db0ddc4733e2.1644226590.git.michal.simek@xilinx.com
2 years agoarm64: zynqmp: Add command for disabling loading other overlays
Michal Simek [Fri, 14 Jan 2022 12:25:38 +0000 (13:25 +0100)]
arm64: zynqmp: Add command for disabling loading other overlays

Add command "zynqmp pmufw node close" to disable permission to load
additional pmufw config overlays. This command will make sure that any
other sw will ask for changing permission.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/cfa5cc7909eb8deb23eb0f11c26954cbaddeb861.1642163135.git.michal.simek@xilinx.com
2 years agoxilinx: firmware: Introduce zynqmp_pmufw_node() for loading PMU fragments
Michal Simek [Fri, 14 Jan 2022 12:25:35 +0000 (13:25 +0100)]
xilinx: firmware: Introduce zynqmp_pmufw_node() for loading PMU fragments

Introduce zynqmp_pmufw_node() for loading PMU configuration fragment for
enabling IPs. Firmware driver has small overlay where NODE id is added and
config fragment is sent to PMUFW. There is a need to build PMUFW with
fragment support.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/636e8150bd4e2b1f988d59795772c685ceeec083.1642163135.git.michal.simek@xilinx.com
2 years agopower: zynqmp: Add power domain driver for ZynqMP
Michal Simek [Mon, 7 Feb 2022 09:27:37 +0000 (10:27 +0100)]
power: zynqmp: Add power domain driver for ZynqMP

Driver should be enabled by CONFIG_POWER_DOMAIN=y and
CONFIG_ZYNQMP_POWER_DOMAIN=y. Power domain driver doesn't have own DT node
but it uses zynqmp firmware DT node that's why there is a need to bind
driver when firmware node is found.

Driver itself is simple. It is sending pmufw config object overlay for
enabling access to device which is done in ...domain_request().
In ...domain_on() capabilities are passed and node is requested.
This should be bare minimum of required to get power domain driver working.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Link: https://lore.kernel.org/r/f4b9433b91c0b18c375b061c7a4e29d428f70547.1644226055.git.michal.simek@xilinx.com
2 years agotools/zynqmp_pm_cfg_obj_convert.py: fix build with Vivado 2021.x
Luca Ceresoli [Sat, 12 Feb 2022 12:51:21 +0000 (13:51 +0100)]
tools/zynqmp_pm_cfg_obj_convert.py: fix build with Vivado 2021.x

This tool fails with a pm_cfg_obj.c file generated by Vitis 2021.2. This is
because that version of Vitis added the PM_CONFIG_OBJECT_TYPE_BASE that was
not previously generated, thus the script does not implement it.

Reported-by: Neal Frager <nealf@xilinx.com>
[report: https://lists.buildroot.org/pipermail/buildroot/2022-February/636639.html]
Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Link: https://lore.kernel.org/r/20220212125121.3398547-1-luca@lucaceresoli.net
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2 years agoarm64: zynqmp: Remove SOM *u-boot.dtsi
Michal Simek [Wed, 19 Jan 2022 11:01:51 +0000 (12:01 +0100)]
arm64: zynqmp: Remove SOM *u-boot.dtsi

Disable mmc from u-boot.dtsi file because it was there only for kv260
board. With kr260 this is not needed because we will switch to full DT per
board with SD/EMMC there too.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/3440d9f94361b4800658f313a5785f43ee84ecf3.1642590109.git.michal.simek@xilinx.com
2 years agozynqmp: Use the same style for macro definitions
Michal Simek [Wed, 19 Jan 2022 11:03:23 +0000 (12:03 +0100)]
zynqmp: Use the same style for macro definitions

Use the same coding style for all macros.
 #define<space>NAME<tab/tabs>VALUE

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/3960de81a04acbaaa01936f743d3d6b3876fe4b7.1642590201.git.michal.simek@xilinx.com
2 years agospi: zynq_qspi: Add SPI memory operations to zynq qspi
T Karthik Reddy [Mon, 31 Jan 2022 05:22:40 +0000 (22:22 -0700)]
spi: zynq_qspi: Add SPI memory operations to zynq qspi

Spi memory operation interface is added to zynq qspi
driver to provide an high-level interface to execute
qspi controller specific memory operations by avoiding
spi_mem_exec_op() from spi-mem framework.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Link: https://lore.kernel.org/r/20220131052240.23403-5-ashok.reddy.soma@xilinx.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2 years agospi: zynq_qspi: Add a check for baudrate and set default if not in limits
Siva Durga Prasad Paladugu [Mon, 31 Jan 2022 05:22:39 +0000 (22:22 -0700)]
spi: zynq_qspi: Add a check for baudrate and set default if not in limits

Add a check afer baudrate calculation to see if the resultant value
falls within the range, else set it to default baudrate value.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Link: https://lore.kernel.org/r/20220131052240.23403-4-ashok.reddy.soma@xilinx.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2 years agospi: zynq_qspi: Read only one byte at a time from txbuf
Siva Durga Prasad Paladugu [Mon, 31 Jan 2022 05:22:38 +0000 (22:22 -0700)]
spi: zynq_qspi: Read only one byte at a time from txbuf

Read only one byte at a time from txbuf as txbuf may not be
aligned and accessing more than a byte at a time may cause
alignment issues. This fixes the issue of data abort exception
while writing to flash device.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Link: https://lore.kernel.org/r/20220131052240.23403-3-ashok.reddy.soma@xilinx.com
2 years agospi: zynq_qspi: Typecast rxbuf properly
Siva Durga Prasad Paladugu [Mon, 31 Jan 2022 05:22:37 +0000 (22:22 -0700)]
spi: zynq_qspi: Typecast rxbuf properly

This patch typecasts and accesses rx buf properly as
an unaligned rxbuf, typecasting with u16 and accessing
it causes data abort exception and this patch fixes it.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Link: https://lore.kernel.org/r/20220131052240.23403-2-ashok.reddy.soma@xilinx.com
2 years agoarm64: zynqmp: Print the secure boot status information
Jorge Ramirez-Ortiz [Wed, 13 Oct 2021 17:04:47 +0000 (19:04 +0200)]
arm64: zynqmp: Print the secure boot status information

Output the secure boot configuration to the console.

Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
Link: https://lore.kernel.org/r/20211013170447.10414-1-jorge@foundries.io
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2 years agonet: xilinx: fix the wrong dma base address issue
Greentime Hu [Thu, 20 Jan 2022 08:41:28 +0000 (16:41 +0800)]
net: xilinx: fix the wrong dma base address issue

If we just use fdtdec_get_addr_size_fixed to get "reg" it will use
64bit address cell to get the base address.

soc {
   #address-cells = <1>;
   #size-cells = <1>;
   compatible ="SiFive,FU500-soc", "fu500-soc", "sifive-soc", "simple-bus";
   ranges;
   L28: axidma@30010000 {
           #dma-cells = <1>;
           compatible = "xlnx,axi-dma-1.00.a";
           axistream-connected = <&L27>;
           axistream-control-connected = <&L27>;
           clocks = <&L1>;
           interrupt-parent = <&L6>;
           interrupts = <32 33>;
           reg = <0x30010000 0x4000>;

fdtdec_get_addr_size_fixed: reg: addr=3001000000004000

We should get the base address through its parent's address-cells and
size-cells settings. So we should use fdtdec_get_addr_size_auto_parent()
to get correct base address.

After applying this patch, we can get the correct base address of dma by
replacing fdtdec_get_addr_size_fixed() with
fdtdec_get_addr_size_auto_parent().

fdtdec_get_addr_size_auto_parent:
     na=1, ns=1, fdtdec_get_addr_size_fixed: reg: addr=30010000

Signed-off-by: Greentime Hu <greentime.hu@sifive.com>
Signed-off-by: Andy Chiu <andy.chiu@sifive.com>
Link: https://lore.kernel.org/r/20220120084128.1892101-1-andy.chiu@sifive.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2 years agoxilinx: common: change bootm_size to not go beyond ram_top
Ricardo Salveti [Thu, 20 Jan 2022 19:17:30 +0000 (16:17 -0300)]
xilinx: common: change bootm_size to not go beyond ram_top

The available ram can be limited by ram_top as that depends on the
reserved memory nodes provided by the device-tree (via
board_get_usable_ram_top), so make sure to respect ram_top when setting
up bootm_size to avoid overlapping reserved memory regions (e.g. memory
used by OP-TEE).

The same logic is available in env_get_bootm_size when bootm_size is
not defined by the default environment.

Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
Link: https://lore.kernel.org/r/20220120191730.2009270-1-ricardo@foundries.io
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2 years agoPrepare v2022.04-rc1
Tom Rini [Mon, 31 Jan 2022 22:57:32 +0000 (17:57 -0500)]
Prepare v2022.04-rc1

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agomkimage: fix segfault on MacOS arm64
Sergey V. Lobanov [Mon, 24 Jan 2022 23:29:44 +0000 (02:29 +0300)]
mkimage: fix segfault on MacOS arm64

mkimage segfaults due to the ASLR mechanism on MacOS arm64

It is required to use _dyld_get_image_vmaddr_slide()
to prevent segfault on MacOS arm64

This patch is based on the discussion
https://github.com/u-boot/u-boot/commit/3b142045e8a7f0ab17b6099e9226296af45967d0

Thanks to Jessica Clarke, Ronny Kotzschmar and ptpt52 github user

Reviewed-by: Jessica Clarke <jrtc27@jrtc27.com>
Signed-off-by: Sergey V. Lobanov <sergey@lobanov.in>
2 years agoMerge tag 'dm-pull-30jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Mon, 31 Jan 2022 14:26:54 +0000 (09:26 -0500)]
Merge tag 'dm-pull-30jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm

moveconfig fix
binman support for listing files with generated entries

2 years agoconfigs: Resync with savedefconfig
Tom Rini [Mon, 31 Jan 2022 14:18:49 +0000 (14:18 +0000)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agopylint: Adjust how the output is produced
Simon Glass [Sat, 29 Jan 2022 04:31:07 +0000 (21:31 -0700)]
pylint: Adjust how the output is produced

The current Makefile rule requires there to be a 'Module' line in the
pylint output, like this:

   ************* Module binman.fip_util

This line only appears if pylint has some comments about the module. We
cannot rely on it for naming.

Update the code to instead use the filename as the identifier for each
score, so rather than:

   multiplexed_log 7.49

we output:

   test_multiplexed_log.py 7.20

It is still easy to see which file the score relates to. In fact the new
naming is nicer since the full subdirectories are shown.

The avoids the problem where a module name is not produced, and the output
gets out of sync.

Regenerate pylint.base so we can start from the current baseline.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Mon, 31 Jan 2022 12:45:13 +0000 (07:45 -0500)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-marvell

- kirkwood: Add Pogoplug-V4 support (Tony)
- kirkwood: GoFlex Home : Use Marvell PHY driver (Tony)
- Another set of kwboot improvements (Pali)
- Minor misc stuff

2 years agoarm: kirkwood: GoFlex Home : Use Marvell uclass mvgbe and PHY driver for Ethernet
Tony Dinh [Wed, 26 Jan 2022 03:33:44 +0000 (19:33 -0800)]
arm: kirkwood: GoFlex Home : Use Marvell uclass mvgbe and PHY driver for Ethernet

The GoFlex Home board has the network chip Marvell 88E1116R.
Use uclass mvgbe and the compatible driver M88E1118R to bring up Ethernet.

- Currently, CONFIG_RESET_PHY_R symbol is used in
arch/arm/mach-kirkwood/include/mach/config.h for all Kirkwood
boards with mv8831116 PHY, with each board defines the function
reset_phy(). Undefine it for this board.
- Add board_eth_init() to use uclass mvgbe to bring up the network.
And remove ad-hoc code.
- Enable CONFIG_PHY_MARVELL to properly configure the network.
- Miscellaneous changes: use CONFIG_SYS_THUMB_BUILD to keep u-boot image
under 512K, use BIT macro, and cleanup comments.

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Set debug flag to 1
Pali Rohár [Tue, 25 Jan 2022 17:13:13 +0000 (18:13 +0100)]
tools: kwboot: Set debug flag to 1

This should enable BootROM output on UART.

(At least on A385 BootROM this is broken, BootROM ignores this debug
 flag and does not enable its output on UART if some valid image is
 available in SPI-NOR.)

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Fix usage of -D without -t
Pali Rohár [Tue, 25 Jan 2022 17:13:12 +0000 (18:13 +0100)]
tools: kwboot: Fix usage of -D without -t

When -D is specified then both bootmsg and debugmsg are not set, but
imgpath is set. Fix this check for valid and required parameters.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Handle EINTR in kwboot_tty_recv()
Pali Rohár [Tue, 25 Jan 2022 17:13:11 +0000 (18:13 +0100)]
tools: kwboot: Handle EINTR in kwboot_tty_recv()

The select() and read() syscalls may be interrupted. Handle EINTR and
retry them.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Handle EINTR in kwboot_write()
Pali Rohár [Tue, 25 Jan 2022 17:13:10 +0000 (18:13 +0100)]
tools: kwboot: Handle EINTR in kwboot_write()

The write() syscall may be interrupted. Handle EINTR and retry it.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Remove 2s delay before sending first xmodem packet
Pali Rohár [Tue, 25 Jan 2022 17:13:09 +0000 (18:13 +0100)]
tools: kwboot: Remove 2s delay before sending first xmodem packet

This delay is not needed anymore since kwboot already handles retrying
logic for incomplete xmodem packets and also forces BootROM to flush its
input queue. Removing it decreases total transfer time.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Force BootROM to flush input queue after boot pattern
Pali Rohár [Tue, 25 Jan 2022 17:13:08 +0000 (18:13 +0100)]
tools: kwboot: Force BootROM to flush input queue after boot pattern

Force the BootROM to flush its input queue after sending boot pattern.

This ensures that after function kwboot_bootmsg() finishes, BootROM is
able to start receiving xmodem packets without any specific delay or
setup.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Allow to use option -b without image path
Pali Rohár [Tue, 25 Jan 2022 17:13:07 +0000 (18:13 +0100)]
tools: kwboot: Allow to use option -b without image path

Allow option -b without image path parameter, to send boot pattern and
wait for response but not send any image. This allows to use kwboot just
for processing boot pattern and user can use any other xmodem tool for
transferring the image itself (e.g. sx). Useful for debugging purposes.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Show 'E' in progress output when error occurs
Pali Rohár [Tue, 25 Jan 2022 17:13:06 +0000 (18:13 +0100)]
tools: kwboot: Show 'E' in progress output when error occurs

When kwboot is unable to resend current xmodem packet, show an 'E' in the
progress output instead of a '+'. This allows to distinguish between the
state when kwboot is retrying sending the packet and when retry is not
possible.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Fix handling of repeated xmodem packets
Pali Rohár [Tue, 25 Jan 2022 17:13:05 +0000 (18:13 +0100)]
tools: kwboot: Fix handling of repeated xmodem packets

Unfortunately during some stages of xmodem transfer, A385 BootROM is not
able to handle repeated xmodem packets. So if an error occurs during that
stage, stop the transfer and return failure.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Do not change received character in kwboot_xm_recv_reply()
Pali Rohár [Tue, 25 Jan 2022 17:13:04 +0000 (18:13 +0100)]
tools: kwboot: Do not change received character in kwboot_xm_recv_reply()

Marvell BootROM expects retransmission of previous xmodem packet only in
the case when it sends NAK response to the host.

Do not change non-xmodem response (possibly UART transfer error) to NAK
in kwboot_xm_recv_reply() function. Allow caller to receive original
response from device.

Change argument 'nak_on_non_xm' to 'stop_on_non_xm'. Instead of changing
non-xmodem character to NAK, stop processing on invalid character and
return it.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Remove code for handling CAN byte
Pali Rohár [Tue, 25 Jan 2022 17:13:03 +0000 (18:13 +0100)]
tools: kwboot: Remove code for handling CAN byte

It is unknown why handling of CAN byte was added into kwboot tool as
Marvell BootROM does not support CAN byte. It never sends CAN byte to host
and if host sends CAN byte BootROM handles it as an unknown byte.

Remove code for handling and sending CAN bytes from the kwboot tool.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Improve retrying logic for incomplete xmodem packets
Pali Rohár [Tue, 25 Jan 2022 17:13:02 +0000 (18:13 +0100)]
tools: kwboot: Improve retrying logic for incomplete xmodem packets

Sometimes if the first byte of xmodem packet (SOH) is incorrectly
transmitted, BootROM sends NAK for every non-SOH received byte, which
makes BootROM and the host kwboot tool out of sync. BootROM automatically
re-synchronizes after 2s pause by dropping its input queue. So when
attempting retransmit for 9th time or later, ignore NAK reply from BootROM
and either wait for valid ACK or let kwboot timeout, which implies
re-synchronization.

This fixes retransmission of xmodem packets and allows kwboot to work also
without "Waiting ... and flushing tty" code which is at the beginning of
kwboot xmodem transfer.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Wait blk_rsp_timeo when flushing
Pali Rohár [Tue, 25 Jan 2022 17:13:01 +0000 (18:13 +0100)]
tools: kwboot: Wait blk_rsp_timeo when flushing

Use the blk_rsp_timeo variable when sleeping before flushing tty.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agotools: kwboot: Increase blk_rsp_timeo to 2s
Pali Rohár [Tue, 25 Jan 2022 17:13:00 +0000 (18:13 +0100)]
tools: kwboot: Increase blk_rsp_timeo to 2s

Fix xmodem retry mechanism if some bytes from xmodem packet were lost and
BootROM is still waiting for completing previous xmodem packet.

It is required to wait at least 1.312s on A385, otherwise BootROM does not
accept next xmodem packet if previous one was not completely transferred.

2s should be enough timeout cause that BootROM will drop incomplete xmodem
packet and expects new packet.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: kirkwood: Pogoplug V4 : Use Marvell network PHY driver
Tony Dinh [Tue, 25 Jan 2022 10:00:48 +0000 (02:00 -0800)]
arm: kirkwood: Pogoplug V4 : Use Marvell network PHY driver

The Pogoplug V4 board has the network chip Marvell 88E1116R. So to
properly configure the network, enable CONFIG_PHY_MARVELL to activate
the compatible driver M88E1118R.

- This patch depends on the series:
https://patchwork.ozlabs.org/project/uboot/patch/20220124061712.28316-2-mibodhi@gmail.com/

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
2 years agoarm: kirkwood: Pogoplug-V4 : Add board implementation files
Tony Dinh [Mon, 24 Jan 2022 06:17:12 +0000 (22:17 -0800)]
arm: kirkwood: Pogoplug-V4 : Add board implementation files

Add board header, defconfig, and implementation files for Pogoplug V4.

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
2 years agoarm: kirkwood: Pogoplug-V4 : Add Kconfig files
Tony Dinh [Mon, 24 Jan 2022 06:17:11 +0000 (22:17 -0800)]
arm: kirkwood: Pogoplug-V4 : Add Kconfig files

Add Kconfig files for Pogoplug V4 board

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
2 years agoarm: kirkwood: Pogoplug-V4 : Add DTS files
Tony Dinh [Mon, 24 Jan 2022 06:17:10 +0000 (22:17 -0800)]
arm: kirkwood: Pogoplug-V4 : Add DTS files

Add DTS files for Pogoplug V4 board

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Pali Rohár <pali@kernel.org>
2 years agoarm: mvebu: Espressobin: Fix URLs in comments
Pali Rohár [Fri, 21 Jan 2022 11:01:15 +0000 (12:01 +0100)]
arm: mvebu: Espressobin: Fix URLs in comments

Use versioned URLs for line numbers as branches are moving in the time and
use master branch for mv-ddr-marvell where is up-to-date code.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agobinman: Skip node generation for images read from files
Jan Kiszka [Fri, 28 Jan 2022 19:37:53 +0000 (20:37 +0100)]
binman: Skip node generation for images read from files

We can and should run the node generator only when creating a new image.
When we read it back, there is no need to generate nodes - they already
exits, and binman does not dive that deep into the image - and there is
no way to provide the required fdt-list. So store the mode in the image
object so that Entry_fit can simply skip generator nodes when reading
them from an fdtmap.

This unbreaks all read-backs of images that contain generator nodes in
their fdtmap. To confirm this, add a corresponding test case.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Add SPDX to dts file:
Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agomoveconfig: Fix code relying on now-stripped newline characters
Alper Nebi Yasak [Sat, 29 Jan 2022 15:22:08 +0000 (18:22 +0300)]
moveconfig: Fix code relying on now-stripped newline characters

Commit 37f815cad07d ("moveconfig: Use a function to read files") adds a
helper function that can read a file as lines, but strips the newline
characters. This change broke parts of moveconfig code that relied on
their existence, resulting in a few issues:

Configs that are defined as empty aren't removed from header files (e.g.
"#define CONFIG_REMAKE_ELF"). Make regex patterns use '\b' to match word
boundaries instead of '\W' (which matched the newlines) so these lines
still match and get removed.

All changes in defconfig are considered removed by savedefconfig even
if they weren't, and line continuations in the headers aren't recognized
and removed properly, because their checks explicitly look for a newline
character. Remove the character from both comparisons.

The printed diff of header files is wrongly formatted and raises an
IndexError if a blank line was removed. Let print() print the new lines,
and use size-independent ways to check strings to fix the diff output.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
2 years agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxi
Tom Rini [Sun, 30 Jan 2022 22:12:34 +0000 (17:12 -0500)]
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxi

a bit delayed, the first batch of the sunxi pull request for this cycle.
This is mostly collecting some patches that were lying around for a
while, plus some recent fixes. Nothing too exciting at this point, but
of course they should be merged nevertheless.
There is the much bigger F1C100s SoC support coming up, which I hope to
be able to send in the next few days, along with the removal of sunxi's
lowlevel_init usage.

Compile tested for all 159 sunxi boards, plus briefly tested on BananaPi
M1, OrangePi Zero, Pine64 and Pine-H64.

2 years agomkimage: sunxi_egon: Allow overriding the padding size
Samuel Holland [Wed, 13 Oct 2021 00:21:27 +0000 (19:21 -0500)]
mkimage: sunxi_egon: Allow overriding the padding size

Due to a bug in the H3 SoC, where the CPU 0 hotplug flag cannot be
written, resuming CPU 0 requires using the "Super Standby" code path in
the BROM instead of the hotplug path. This path requires jumping to an
eGON image in SRAM.

This resume image, whose single purpose is to jump back to the secure
monitor, only needs to contain a single instruction. Padding the image
to 8 KiB would be wasteful of SRAM. Hook up the -B (block size) option
so users can set the block/padding size.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agosunxi: Fix H616 DRAM read calibration for dual rank
Jernej Skrabec [Sat, 29 Jan 2022 15:58:43 +0000 (16:58 +0100)]
sunxi: Fix H616 DRAM read calibration for dual rank

Although it isn't known what bit 0 in PHY reg 8 does, it's obvious that
it has to be set before read calibration and cleared afterwards. This is
already done for first rank, but not for second (copy & paste error.)

Fix it.

Fixes: f4317dbd06b6 ("sunxi: Add H616 DRAM support")
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agosunxi: fix H616 DRAM ODT support
Jernej Skrabec [Sat, 29 Jan 2022 15:58:42 +0000 (16:58 +0100)]
sunxi: fix H616 DRAM ODT support

Kconfig symbol is missing CONFIG_ prefix, so compiler will always
skip ODT configuration.

Fix symbol name.

Fixes: f4317dbd06b6 ("sunxi: Add H616 DRAM support")
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agosunxi: Add option to prevent booting on power plug-in
Chris Morgan [Fri, 21 Jan 2022 13:37:32 +0000 (13:37 +0000)]
sunxi: Add option to prevent booting on power plug-in

For sunxi boards with the AXP209, AXP221, AXP809, and AXP818 PMICs
(plus possibly others, I only confirmed the datasheets for these),
it is sometimes desirable to not boot whenever the device is
plugged in. An example would be when using the NTC CHIP inside a
PocketCHIP.
This provides a configurable option to check if bit 0 of
register 0 of the PMIC says it was powered because of a power button
press (0) or a plug-in event (1). If the value is 1 and this option
is selected, the device shuts down shortly after printing a message
to console stating the reason why it's shutting down. Powering up the
board with the power button is not affected.

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
[Andre: reword to speak of boot, remove #ifdefs]
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agopmic: axp: define ALDO_IN startup bit
Andre Przywara [Fri, 21 Jan 2022 13:37:31 +0000 (13:37 +0000)]
pmic: axp: define ALDO_IN startup bit

Most AXP PMICs feature a "startup source" register, which keeps
information about how the PMIC started operation. Bit 0 in there means
it has been started by "plugging in the power cable".

Define a symbol in each PMIC's header file to be able to use that
register and bit later on.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agosunxi: gpio: Fix up pointer arithmetic
Andre Przywara [Sun, 30 Jan 2022 01:19:42 +0000 (01:19 +0000)]
sunxi: gpio: Fix up pointer arithmetic

The calls for flipping bits in the Allwinner pin controller registers
were using unnecessarily complex pointer arithmetic.

Improve readability by simplifying the expression.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agommc: sunxi: Use DM_GPIO flags to set pull-up
Samuel Holland [Thu, 21 Oct 2021 04:52:57 +0000 (23:52 -0500)]
mmc: sunxi: Use DM_GPIO flags to set pull-up

Now that the sunxi_gpio driver handles pull-up/down via the driver
model, pin configuration does not need a platform-specific function.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Tested-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agogpio: sunxi: Implement .set_flags
Samuel Holland [Thu, 21 Oct 2021 04:52:56 +0000 (23:52 -0500)]
gpio: sunxi: Implement .set_flags

This, along with gpio_flags_xlate(), allows the GPIO driver to handle
pull-up/down flags provided by consumer drivers or in the device tree.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agosunxi: gpio: Add per-bank drive and pull setters
Samuel Holland [Thu, 21 Oct 2021 04:52:55 +0000 (23:52 -0500)]
sunxi: gpio: Add per-bank drive and pull setters

The GPIO and pinctrl drivers need these setters for pin configuration.
Since they are DM drivers, they should not be using hardcoded base
addresses. Factor out variants of the setter functions which take a
pointer to the GPIO bank's MMIO registers.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agosunxi: gpio: Return void from setter functions
Samuel Holland [Thu, 21 Oct 2021 04:52:54 +0000 (23:52 -0500)]
sunxi: gpio: Return void from setter functions

The return values of these functions are always zero, and they are
never checked. Since they are not needed, remove them.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agosunxi: dram_sun4i/5i: use DRAM_MEMORY_TYPE_DDR3 instead of magic number 3
Giulio Benetti [Thu, 2 Dec 2021 23:57:54 +0000 (00:57 +0100)]
sunxi: dram_sun4i/5i: use DRAM_MEMORY_TYPE_DDR3 instead of magic number 3

Since DRAM_MEMORY_TYPE_DDR3 is defined let's use it instead of magic
number 3.

Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agoi2c: mvtwsi: Add compatible string for allwinner, sun4i-a10-i2c
Chris Morgan [Fri, 7 Jan 2022 17:52:54 +0000 (11:52 -0600)]
i2c: mvtwsi: Add compatible string for allwinner, sun4i-a10-i2c

This adds a compatible string for the Allwinner Sun4i-A10 I2C
controller. Without this, boards based on the R8 and A13 (at a
minimum) fail to boot.

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Acked-by: Akash Gajjar <gajjar04akash@gmail.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agosunxi: call fdt_fixup_ethernet again to set macaddr for more aliases
Icenowy Zheng [Sat, 11 Sep 2021 17:39:16 +0000 (19:39 +0200)]
sunxi: call fdt_fixup_ethernet again to set macaddr for more aliases

Sometimes some ethernet aliases do not exist in U-Boot DT but they
exist in the DT used to boot the system (for example, modified via DT
overlays). In this situation setup_environment is called again in
ft_board_setup() to generate macaddr environment variable for them.
However now the call to fdt_fixup_ethernet() is moved before the call
of ft_board_setup().

Call fdt_fixup_ethernet() again to add MAC addresses for the extra
ethernet aliases.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
[updated commit message]
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agosunxi: SPI: fix pinmuxing for Allwinner H6 SoCs
Daniel Wagenknecht [Thu, 16 Dec 2021 19:42:10 +0000 (20:42 +0100)]
sunxi: SPI: fix pinmuxing for Allwinner H6 SoCs

The driver for SPI0 on Allwinner H6 SoCs did not use the correct define
SUN50I_GPC_SPI0 for the pin function, but one for a different Allwinner
SoC series.

Fix the conditionals to use the correct define for H6 SoCs. This matches
the conditional logic in the SPL spi driver.

Tested by probing the spi-flash on a pine64_h64-model-b board with
adapted device-tree (disable mmc2, enable spi0).

Signed-off-by: Daniel Wagenknecht <dwagenk@mailbox.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2 years agoMerge tag 'efi-2022-04-rc1-3' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sat, 29 Jan 2022 18:50:19 +0000 (13:50 -0500)]
Merge tag 'efi-2022-04-rc1-3' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2022-04-rc1-3

Documentation:

* update Nokia RX-51 documentation and move it to rst
* describe boot switch settings for HiFive Unmatched board

UEFI:

* fix the checking of images hashes and signatures
* provide the RISCV_EFI_BOOT_PROTOCOL

2 years agoMerge branch '2022-01-28-assorted-fixes'
Tom Rini [Sat, 29 Jan 2022 18:42:58 +0000 (13:42 -0500)]
Merge branch '2022-01-28-assorted-fixes'

- Extend the pci command to support a few more features.
- Add support for custom SPL boot device names (so it's easier for users
  to understand)
- Updates for am64x to address some review comments.
- Migration deadline notice for DM_SERIAL
- coreboot payload test
- Support rsa3072 signatures.
- DFU should skip writing empty UBI pages, bootcount printf format char
  correction.

2 years agosquashfs: show an error message if the inode_table can't be, allocated
Lars Weber [Thu, 13 Jan 2022 13:28:45 +0000 (14:28 +0100)]
squashfs: show an error message if the inode_table can't be, allocated

Signed-off-by: Lars Weber <weber@weber-software.com>
2 years agoefi_loader: hash the image once before checking against db/dbx
Ilias Apalodimas [Fri, 28 Jan 2022 22:20:32 +0000 (00:20 +0200)]
efi_loader: hash the image once before checking against db/dbx

We don't have to recalculate the image hash every time we check against a
new db/dbx entry.  So let's add a flag forcing it to run once since we only
support sha256 hashes

Suggested-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoefi_loader: correctly handle mixed hashes and signatures in db
Ilias Apalodimas [Fri, 28 Jan 2022 22:20:31 +0000 (00:20 +0200)]
efi_loader: correctly handle mixed hashes and signatures in db

A mix of signatures and hashes in db doesn't always work as intended.
Currently if the digest algorithm is not explicitly set to sha256 we
stop walking the security database and reject the image.

That's problematic in case we find and try to check a signature before
inspecting the sha256 hash.  If the image is unsigned we will reject it
even if the digest matches.

Since we no longer reject the image on unknown algorithms add an explicit
check and reject the image if any other hash algorithm apart from sha256
is detected on dbx.

Suggested-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agolib: allow printing RISC-V EFI Boot Protocol GUID
Heinrich Schuchardt [Fri, 28 Jan 2022 18:29:47 +0000 (19:29 +0100)]
lib: allow printing RISC-V EFI Boot Protocol GUID

On RISC-V a new UEFI protocol has been introduced. Support printing
its GUID using %pUs.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoefi_loader: Enable RISCV_EFI_BOOT_PROTOCOL support
Sunil V L [Fri, 28 Jan 2022 15:18:44 +0000 (20:48 +0530)]
efi_loader: Enable RISCV_EFI_BOOT_PROTOCOL support

This adds support for new RISCV_EFI_BOOT_PROTOCOL to
communicate the boot hart ID to bootloader/kernel on RISC-V
UEFI platforms.

The specification of the protocol is hosted at:
https://github.com/riscv-non-isa/riscv-uefi

Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agotools: mkeficapsule: rework the code a little bit
AKASHI Takahiro [Tue, 18 Jan 2022 04:39:45 +0000 (13:39 +0900)]
tools: mkeficapsule: rework the code a little bit

Abstract common routines to make the code easily understandable.
No functional change.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agotools: mkeficapsule: output messages to stderr instead of stdout
AKASHI Takahiro [Tue, 18 Jan 2022 04:39:44 +0000 (13:39 +0900)]
tools: mkeficapsule: output messages to stderr instead of stdout

All the error messages should be printed out to stderr.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoefi_loader: correct function comment style
Heinrich Schuchardt [Thu, 20 Jan 2022 18:48:20 +0000 (19:48 +0100)]
efi_loader: correct function comment style

Replace @return and @param.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agodoc: describe MSEL settings for booting from SD card
Heinrich Schuchardt [Thu, 27 Jan 2022 01:50:28 +0000 (02:50 +0100)]
doc: describe MSEL settings for booting from SD card

unmatched.rst describes booting from SD card or from SPI. But only for
booting from SPI the boot selection settings are described.

Add the missing information.

Fix a typo 'uSD'.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2 years agoNokia RX-51: Convert documentation to rst format
Pali Rohár [Mon, 24 Jan 2022 19:45:54 +0000 (20:45 +0100)]
Nokia RX-51: Convert documentation to rst format

Convert documentation to rst format

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoNokia RX-51: Update documentation about flashing
Pali Rohár [Mon, 24 Jan 2022 19:45:53 +0000 (20:45 +0100)]
Nokia RX-51: Update documentation about flashing

This change contains update for doc/README.nokia_rx51 documentation file
with information how to load U-Boot image to device RAM without need to
flash it and also how to flash it into OneNAND via 0xFFFF flasher.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoNokia RX-51: Update documentation about ext2/3/4
Pali Rohár [Mon, 24 Jan 2022 19:45:52 +0000 (20:45 +0100)]
Nokia RX-51: Update documentation about ext2/3/4

Since commit 25c5b6517854 ("Nokia RX-51: Do not try calling both ext2load
and ext4load") command ext4load is used for all ext2/3/4 fs variants.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agodm: serial: Add a migration deadline for serial
Simon Glass [Sat, 22 Jan 2022 12:03:50 +0000 (05:03 -0700)]
dm: serial: Add a migration deadline for serial

This probably should have been done a while back since it is a core
system. Very few boards remain to be migrated.

Addd a migration deadline for a year out.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agogitlab/azure: x86: Add a coreboot test
Simon Glass [Fri, 21 Jan 2022 17:23:01 +0000 (10:23 -0700)]
gitlab/azure: x86: Add a coreboot test

Coreboot supports U-Boot as a payload and this recently got a bit of a
facelist. Add a test for this.

For now this uses a binary build of coreboot (v4.15). Future work could
potentially build it from source, but we need to figure out the
toolchain problems first, since coreboot uses its own toolchain. It
turns out that this is tricky, because coreboot fails to build with a
vanilla gcc.

This needs some changes to the hooks scripts as well. An example build
is at https://source.denx.de/u-boot/custodians/u-boot-dm/-/jobs/359687

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agoconfigs: am64x_evm_r5/a53_defconfig: Enable configs required for Ethboot
Vignesh Raghavendra [Fri, 21 Jan 2022 07:17:54 +0000 (12:47 +0530)]
configs: am64x_evm_r5/a53_defconfig: Enable configs required for Ethboot

Enable config options needed to support Ethernet boot on AM64x SK.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
2 years agoconfigs: am64xx_evm: Increase BSS max size to 16K
Vignesh Raghavendra [Fri, 21 Jan 2022 07:17:53 +0000 (12:47 +0530)]
configs: am64xx_evm: Increase BSS max size to 16K

With Ethboot support in SPL, network stack requires more BSS area, so
increase BSS max size to 16K

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
2 years agoARM: dts: k3-am642-sk: Disable cpsw_port1 in SPL
Vignesh Raghavendra [Fri, 21 Jan 2022 07:17:52 +0000 (12:47 +0530)]
ARM: dts: k3-am642-sk: Disable cpsw_port1 in SPL

ROM supports cpsw_port2 for Ethernet boot and SPL stages continue to
download images on the same port, therefore there is no need to enable
cpsw_port1. Disable the same.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
2 years agonet: ti: am65-cpsw-nuss: Fix err msg for port bind failures
Vignesh Raghavendra [Fri, 21 Jan 2022 07:17:51 +0000 (12:47 +0530)]
net: ti: am65-cpsw-nuss: Fix err msg for port bind failures

Replace error case print with meaning full message.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
2 years agorsa: adds rsa3072 algorithm
Jamin Lin [Wed, 19 Jan 2022 08:23:21 +0000 (16:23 +0800)]
rsa: adds rsa3072 algorithm

Add to support rsa 3072 bits algorithm in tools
for image sign at host side and adds rsa 3072 bits
verification in the image binary.

Add test case in vboot for sha384 with rsa3072 algorithm testing.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agobootcount: fix printf() code
Heinrich Schuchardt [Wed, 19 Jan 2022 00:33:43 +0000 (01:33 +0100)]
bootcount: fix printf() code

For printing phys_addr_t we should use %pa to avoid warning like:

drivers/bootcount/bootcount_syscon.c:110:17: note: in expansion of macro ‘dev_err’
  110 |                 dev_err(dev, "%s: Unsupported register size: %d\n", __func__,
      |                 ^~~~~~~

seen for sandbox_defconfig with CONFIG_PHYS_64BIT=y.

Cf. commit 1eebd14b7902 ("vsprintf: Add modifier for phys_addr_t")

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agodfu: mtd: skip empty pages when writing page for UBI partition
Patrick Delaunay [Tue, 18 Jan 2022 09:26:21 +0000 (10:26 +0100)]
dfu: mtd: skip empty pages when writing page for UBI partition

Align the DFU MTD backend for the UBI partitions with the mtd command write
behavior when the option .dontskipff is not used: don't write the empty
pages (full of 0xFF); it is not required for UBI, see [1] for details.

This patch avoids the "free space fixup" procedure in the kernel [2]
and allows to program a UBIFS volume generated by mkfs.ubifs without the
option -F, --space-fixup.

The MTD DFU backend implements this behavior introduced on DFU NAND
backend by the commit 13cb7cc9e8e4 ("dfu: Add option to skip empty pages
when flashing UBI images to NAND") and also supported by the command nand
by CONFIG_CMD_NAND_TRIMFFS and by commit c9494866df83 ("cmd_nand: add nand
write.trimffs command").

[1] http://www.linux-mtd.infradead.org/doc/ubi.html#L_flasher_algo
[2] http://www.linux-mtd.infradead.org/faq/ubifs.html#L_free_space_fixup

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agopci: Extend 'pci' command with bus option '*'
Pali Rohár [Mon, 17 Jan 2022 15:38:40 +0000 (16:38 +0100)]
pci: Extend 'pci' command with bus option '*'

Allow to call 'pci' and 'pci regions' commands with bus option '*' which
cause pci to process all buses.

PCIe is point-to-point HW and so on each bus is maximally one physical
device. Therefore for PCIe it is common to have multiple buses.

This change allows to easily print all available PCIe devices in system.

Make '*' as default option when no bus argument is specified.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agopci: Add checks for valid cmdline arguments
Pali Rohár [Mon, 17 Jan 2022 15:38:39 +0000 (16:38 +0100)]
pci: Add checks for valid cmdline arguments

Currently pci command ignores invalid cmdline arguments and do something.
Add checks that all passed arguments were processed.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agopci: Extend 'pci regions' command with bus number
Pali Rohár [Mon, 17 Jan 2022 15:38:38 +0000 (16:38 +0100)]
pci: Extend 'pci regions' command with bus number

'pci regions' currently prints only region information from bus 0 which
belongs to controller 0. Parser for 'pci regions' cmdline currently ignores
any additional arguments and so U-Boot always uses bus 0.

Regions are stored in controller (not on the bus) and therefore to retrieve
controller from the bus, it is needed to call pci_get_controller() which
returns root bus. Because bus 0 is root bus, current code worked fine for
controller 0.

Extend cmdline parser for 'pci regions' to allows specifying bus number,
extend pci_show_regions() code to accept also non-zero bus number and
print bus ranges for which is regions configuration assigned.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agopci: Fix setting controller's last_busno
Pali Rohár [Mon, 17 Jan 2022 15:38:37 +0000 (16:38 +0100)]
pci: Fix setting controller's last_busno

Initially it is set to dev_seq but update to the last bus number is
missing. Fix it.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agospl: add support for custom boot method names
Heiko Thiery [Mon, 17 Jan 2022 15:25:41 +0000 (16:25 +0100)]
spl: add support for custom boot method names

Currently the names MMC1, MMC2 and MMC2_2 are output in the SPL. To
achieve more userbility here the name of the boot source can be returned.
E.g. for "MMC1" -> "eMMC" or "MMC2" -> "SD card".

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Reviewed-by: Michael Walle <michael@walle.cc>
Tested-by: Michael Walle <michael@walle.cc>
2 years agoMerge branch '2022-01-28-fastboot-updates'
Tom Rini [Fri, 28 Jan 2022 17:13:23 +0000 (12:13 -0500)]
Merge branch '2022-01-28-fastboot-updates'

- 3 DFU/fastboot bugfixes

2 years agofastboot: only look up real partition names when no alias exists
Matthias Schiffer [Thu, 16 Dec 2021 10:26:38 +0000 (11:26 +0100)]
fastboot: only look up real partition names when no alias exists

Having U-Boot look up the passed partition name even though an alias
exists is unexpected, leading to warning messages (when the alias name
doesn't exist as a real partition name) or the use of the wrong
partition.

Change part_get_info_by_name_or_alias() to consider real partitions
names only if no alias of the same name exists, allowing to use aliases
to override the configuration for existing partition names.

Also change one use of strcpy() to strlcpy().

Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Reviewed-by: Sean Anderson <sean.anderson@seco.com>
2 years agodfu: handle short frame result of UPLOAD in state_dfu_idle
Patrick Delaunay [Wed, 13 Oct 2021 15:01:37 +0000 (17:01 +0200)]
dfu: handle short frame result of UPLOAD in state_dfu_idle

In DFU v1.1 specification [1] the DFU_UPLOAD (Short Frame)
is handled only in dfuUPLOADIDLE state:

- Figure A.1 Interface state transition diagram

- the state description in chapter A.2

A.2.3 State 2 dfuIDLE
  on Receipt of the DFU_UPLOAD request,and bitCanUpload = 1
  the Next State is dfuUPLOADIDLE

A.2.10 State 9 dfuUPLOAD-IDLE
  When the length of the data transferred by the device in response
  to a DFU_UPLOAD request is less than wLength. (Short frame)
  the Next State is dfuIDLE

In current code, when an UPLOAD is completely performed after the first
request (for example with wLength=200 and data read = 9), the DFU state
stay at dfuUPLOADIDLE until receiving a DFU_UPLOAD or a DFU_ABORT request
even it is unnecessary as the previous DFU_UPLOAD request already reached
the EOF.

This patch proposes to finish the DFU uploading (don't go to dfuUPLOADIDLE)
and completes the control-read operation (go to DFU_STATE_dfuIDLE) when
the first UPLOAD response has a short frame as an end of file (EOF)
indicator even if it is not explicitly allowed in the DFU specification
but this seems logical.

[1] https://www.usb.org/sites/default/files/DFU_1.1.pdf

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2 years agofastboot: fix fastboot_set_reboot_flag()
Roman Stratiienko [Sat, 8 May 2021 22:25:24 +0000 (01:25 +0300)]
fastboot: fix fastboot_set_reboot_flag()

In case CONFIG_FASTBOOT_FLASH_MMC_DEV == 0, compile-time condition
is not met and fastboot_set_reboot_flag() fails.

Fixes: a362ce214f03 ("fastboot: Implement generic fastboot_set_reboot_flag")
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2 years agoMerge tag 'dm-pull-26jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Thu, 27 Jan 2022 19:14:47 +0000 (14:14 -0500)]
Merge tag 'dm-pull-26jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm

acpi refactoring to allow non-x86 use
binman support for bintools (binary tools)
minor tools improvements in preparation for FDT signing
various minor fixes and improvements

2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Thu, 27 Jan 2022 01:41:38 +0000 (20:41 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-usb

2 years agousb: gadget: Add CDC ACM function
Loic Poulain [Thu, 25 Nov 2021 17:16:15 +0000 (18:16 +0100)]
usb: gadget: Add CDC ACM function

Add support for CDC ACM using the new UDC and gadget API. This protocol
can be used for serial over USB data transfer and is widely supported
by various OS (GNU/Linux, MS-Windows, OSX...). The usual purpose of
such link is to access device debug console and can be useful for
products not exposing regular UART to the user.

A default stdio device named 'usbacm' is created, and can be used
to redirect console to USB link over CDC ACM:

> setenv stdin usbacm; setenv stdout usbacm

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2 years agolib/circbuf: Make circbuf selectable symbol
Loic Poulain [Thu, 25 Nov 2021 17:16:14 +0000 (18:16 +0100)]
lib/circbuf: Make circbuf selectable symbol

It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>