platform/kernel/u-boot.git
17 months agoarm: dts: rockchip: move all rk3128 u-boot specific properties in separate dtsi files
Johan Jonker [Fri, 9 Sep 2022 20:19:06 +0000 (22:19 +0200)]
arm: dts: rockchip: move all rk3128 u-boot specific properties in separate dtsi files

Move all rk3128 u-boot specific properties in separate dtsi files.
Sort emmc node.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
17 months agoarm: dts: rockchip: rk3128: bulk convert gpios to their constant counterparts
Johan Jonker [Fri, 9 Sep 2022 20:18:55 +0000 (22:18 +0200)]
arm: dts: rockchip: rk3128: bulk convert gpios to their constant counterparts

Bulk convert rk3128 DT gpios to their constant counterparts.

sed -i -f script.sed rk3128.dtsi
sed -i -f script.sed rk3128-evb.dts

================================

/rockchip,pins *=/bcheck
b # to end of script
:append-next-line
N
:check
/^[^;]*$/bappend-next-line
s/<RK_GPIO\([0-9]\) /<\1 /g
s/<\([^ ][^ ]*  *\)0 /<\1RK_PA0 /g
s/<\([^ ][^ ]*  *\)1 /<\1RK_PA1 /g
s/<\([^ ][^ ]*  *\)2 /<\1RK_PA2 /g
s/<\([^ ][^ ]*  *\)3 /<\1RK_PA3 /g
s/<\([^ ][^ ]*  *\)4 /<\1RK_PA4 /g
s/<\([^ ][^ ]*  *\)5 /<\1RK_PA5 /g
s/<\([^ ][^ ]*  *\)6 /<\1RK_PA6 /g
s/<\([^ ][^ ]*  *\)7 /<\1RK_PA7 /g
s/<\([^ ][^ ]*  *\)8 /<\1RK_PB0 /g
s/<\([^ ][^ ]*  *\)9 /<\1RK_PB1 /g
s/<\([^ ][^ ]*  *\)10 /<\1RK_PB2 /g
s/<\([^ ][^ ]*  *\)11 /<\1RK_PB3 /g
s/<\([^ ][^ ]*  *\)12 /<\1RK_PB4 /g
s/<\([^ ][^ ]*  *\)13 /<\1RK_PB5 /g
s/<\([^ ][^ ]*  *\)14 /<\1RK_PB6 /g
s/<\([^ ][^ ]*  *\)15 /<\1RK_PB7 /g
s/<\([^ ][^ ]*  *\)16 /<\1RK_PC0 /g
s/<\([^ ][^ ]*  *\)17 /<\1RK_PC1 /g
s/<\([^ ][^ ]*  *\)18 /<\1RK_PC2 /g
s/<\([^ ][^ ]*  *\)19 /<\1RK_PC3 /g
s/<\([^ ][^ ]*  *\)20 /<\1RK_PC4 /g
s/<\([^ ][^ ]*  *\)21 /<\1RK_PC5 /g
s/<\([^ ][^ ]*  *\)22 /<\1RK_PC6 /g
s/<\([^ ][^ ]*  *\)23 /<\1RK_PC7 /g
s/<\([^ ][^ ]*  *\)24 /<\1RK_PD0 /g
s/<\([^ ][^ ]*  *\)25 /<\1RK_PD1 /g
s/<\([^ ][^ ]*  *\)26 /<\1RK_PD2 /g
s/<\([^ ][^ ]*  *\)27 /<\1RK_PD3 /g
s/<\([^ ][^ ]*  *\)28 /<\1RK_PD4 /g
s/<\([^ ][^ ]*  *\)29 /<\1RK_PD5 /g
s/<\([^ ][^ ]*  *\)30 /<\1RK_PD6 /g
s/<\([^ ][^ ]*  *\)31 /<\1RK_PD7 /g
s/<\([^ ][^ ]*  *[^ ][^ ]*  *\)0 /<\1RK_FUNC_GPIO /g
s/<\([^ ][^ ]*  *[^ ][^ ]*  *\)RK_FUNC_\([1-9]\) /<\1\2 /g

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
17 months agorockchip: rk3128-cru: sync the clock dt-binding header from Linux
Johan Jonker [Fri, 9 Sep 2022 20:18:45 +0000 (22:18 +0200)]
rockchip: rk3128-cru: sync the clock dt-binding header from Linux

In order to update the DT for rk3128
sync the clock dt-binding header.
This is the state as of v6.0 in Linux.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
17 months agorockchip: enable fdt overlays for ROCK Pi 4 series
FUKAUMI Naoki [Sat, 10 Sep 2022 01:47:24 +0000 (01:47 +0000)]
rockchip: enable fdt overlays for ROCK Pi 4 series

add CONFIG_OF_LIBFDT_OVERLAY=y to support fdt overlays.

Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
17 months agorockchip: Only call binman when TPL available
Kever Yang [Sun, 18 Dec 2022 12:43:38 +0000 (20:43 +0800)]
rockchip: Only call binman when TPL available

Rockchip platform use TPL to do the DRAM initialize for all the SoCs,
if TPL is not available, means no available DRAM init program, and the
u-boot-rockchip.bin is not functionable.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Change-Id: I2299f1eddce5aa7d5fb1a3fb4d8aeaa995b397fa

17 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-x86
Tom Rini [Thu, 15 Dec 2022 18:06:00 +0000 (13:06 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-x86

- Adjust CONFIG_TEXT_BASE for BayTrail based platforms
- 2 cosmetic issue fixes

17 months agox86: cosmetic: Fix a typo in the reserve_arch() comments
Bin Meng [Thu, 24 Nov 2022 03:39:23 +0000 (11:39 +0800)]
x86: cosmetic: Fix a typo in the reserve_arch() comments

It should be fsp_continue().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
17 months agox86: som-db5800-som-6867: Adjust CONFIG_TEXT_BASE
Bin Meng [Thu, 24 Nov 2022 08:19:54 +0000 (16:19 +0800)]
x86: som-db5800-som-6867: Adjust CONFIG_TEXT_BASE

At present U-Boot no longer builds as a complete rom for som-db5800-som-6867.

    BINMAN  .binman_stamp
  Wrote map file './rom.map' to show errors
  binman: Section '/binman/rom': contents size 0x80302c (8400940) exceeds section size 0x800000 (8388608)

Checking rom.map we see 'intel-vga' section is overlapped with
other sections:

  <none>     fff00000  0009f7c8  u-boot-with-ucode-ptr
  <none>     fff90000  00010000  intel-vga
  <none>     fff9f7c8  00001aae  u-boot-dtb-with-ucode

Let's adjust CONFIG_TEXT_BASE to allow more space for U-Boot codes.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
17 months agox86: dfi-bt700: Adjust CONFIG_TEXT_BASE
Bin Meng [Thu, 24 Nov 2022 07:58:17 +0000 (15:58 +0800)]
x86: dfi-bt700: Adjust CONFIG_TEXT_BASE

At present U-Boot no longer builds as a complete rom for all the
configs of dfi-bt700.

    BINMAN  .binman_stamp
  Wrote map file './rom.map' to show errors
  binman: Section '/binman/rom': contents size 0x80e836 (8448054) exceeds section size 0x800000 (8388608)

Checking rom.map we see 'intel-vga' section is overlapped with
other sections:

  <none>     fff00000  000aac90  u-boot-with-ucode-ptr
  <none>     fffa0000  00010000  intel-vga
  <none>     fffaac90  00001df0  u-boot-dtb-with-ucode
  <none>     fffaca80  00019800  u-boot-ucode

Let's adjust CONFIG_TEXT_BASE to allow more space for U-Boot codes.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
17 months agox86: conga-qeval20-qa3-e3845: Adjust CONFIG_TEXT_BASE
Bin Meng [Thu, 24 Nov 2022 07:33:09 +0000 (15:33 +0800)]
x86: conga-qeval20-qa3-e3845: Adjust CONFIG_TEXT_BASE

At present U-Boot no longer builds as a complete rom for all the
configs of conga-qeval20-qa3-e3845.

    BINMAN  .binman_stamp
  Wrote map file './rom.map' to show errors
  binman: Section '/binman/rom': contents size 0x80b680 (8435328) exceeds section size 0x800000 (8388608)

Checking rom.map we see 'intel-vga' section is overlapped with
other sections:

  <none>     fff00000  000a7cb0  u-boot-with-ucode-ptr
  <none>     fffa0000  00010000  intel-vga
  <none>     fffa7cb0  00001c1a  u-boot-dtb-with-ucode
  <none>     fffa98d0  00019800  u-boot-ucode

Let's adjust CONFIG_TEXT_BASE to allow more space for U-Boot codes.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
17 months agox86: minnowmax: Adjust CONFIG_TEXT_BASE
Bin Meng [Thu, 24 Nov 2022 03:07:13 +0000 (11:07 +0800)]
x86: minnowmax: Adjust CONFIG_TEXT_BASE

At present U-Boot no longer builds as a complete rom for minnowmax.

    BINMAN  .binman_stamp
  Wrote map file './rom.map' to show errors
  binman: Section '/binman/rom': contents size 0x803146 (8401222) exceeds section size 0x800000 (8388608)

Checking rom.map we see 'fdtmap' section is overlapped with
'intel-vga' section:

  <none>     fffa1390  00019800  u-boot-ucode
  <none>     fffb0000  00010000  intel-vga
  <none>     fffbab90  00000539  fdtmap

Let's adjust CONFIG_TEXT_BASE to allow more space for U-Boot codes.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
17 months agox86: bayleybay: Adjust CONFIG_TEXT_BASE
Bin Meng [Thu, 24 Nov 2022 03:24:37 +0000 (11:24 +0800)]
x86: bayleybay: Adjust CONFIG_TEXT_BASE

At present U-Boot no longer builds as a complete rom for bayleybay.

    BINMAN  .binman_stamp
  Wrote map file './rom.map' to show errors
  binman: Section '/binman/rom': contents size 0x814706 (8472326) exceeds section size 0x800000 (8388608)

Checking rom.map we see 'fdtmap' section is overlapped with
'intel-vga' and 'intel-fsp' sections:

  <none>     fffa2150  0002a000  u-boot-ucode
  <none>     fffb0000  00010000  intel-vga
  <none>     fffc0000  00038000  intel-fsp
  <none>     fffcc150  00000539  fdtmap

Let's adjust CONFIG_TEXT_BASE to allow more space for U-Boot codes.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
17 months agox86: Fix i8259 ifdef include guard
Alistair Delva [Mon, 26 Sep 2022 22:23:26 +0000 (22:23 +0000)]
x86: Fix i8259 ifdef include guard

When building U-Boot with clang, it notices that the i8259.h include
guard does not work correctly due to a typo. Fix it.

Signed-off-by: Alistair Delva <adelva@google.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
18 months agoRevert "cmd: pxe_utils: Check fdtcontroladdr in label_boot"
Tom Rini [Tue, 13 Dec 2022 14:26:25 +0000 (09:26 -0500)]
Revert "cmd: pxe_utils: Check fdtcontroladdr in label_boot"

With the change here, all extlinux.conf files with only "KERNEL
/fitImage" don't work anymore. One common example of this would be those
files generated by thee Poky/OE WIC bootimg-partition bootloader
partition generator.

This reverts commit d5ba6188dfbf6bb68354bec86e483623f1f6dae2.

Reported-by: Neil Armstrong <neil.armstrong@linaro.org>
Reported-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
18 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Mon, 12 Dec 2022 14:00:58 +0000 (09:00 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- mvebu: Espressobin: Fix default env variables (Derek)

18 months agoMerge tag 'u-boot-stm32-20221212' of https://source.denx.de/u-boot/custodians/u-boot-stm
Tom Rini [Mon, 12 Dec 2022 13:59:13 +0000 (08:59 -0500)]
Merge tag 'u-boot-stm32-20221212' of https://source.denx.de/u-boot/custodians/u-boot-stm

phy: usbphyc: use regulator_set_enable_if_allowed for disabling vbus supply
dm: pmic: ignore disabled node in pmic_bind_children

18 months agodm: pmic: ignore disabled node in pmic_bind_children
Patrick Delaunay [Wed, 26 Oct 2022 13:05:10 +0000 (15:05 +0200)]
dm: pmic: ignore disabled node in pmic_bind_children

Ignore the disabled children node in pmic_bind_children() so the
disabled regulators in device tree are not registered.

This patch is based on the dm_scan_fdt_node() code - only the
activated nodes are bound -  and it solves possible issue when a
deactivated regulator is bound, error for duplicated regulator name
for example.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agophy: usbphyc: use regulator_set_enable_if_allowed for disabling vbus supply
Patrick Delaunay [Tue, 20 Sep 2022 11:39:56 +0000 (13:39 +0200)]
phy: usbphyc: use regulator_set_enable_if_allowed for disabling vbus supply

Use regulator_set_enable_if_allowed() api instead of regulator_set_enable()
while disabling vbus supply. This way the driver doesn't see an error
when it disable an always-on regulator for VBUS.

This patch is needed for STM32MP157C-DK2 board when the regulator
v3v3: buck4 used as the phy vbus supply in kernel device tree
is always on with the next hack for low power use-case:

&usbphyc_port0 {
        ...
/*
 * Hack to keep hub active until all connected devices are suspended
 * otherwise the hub will be powered off as soon as the v3v3 is disabled
 * and it can disturb connected devices.
 */
connector {
compatible = "usb-a-connector";
vbus-supply = <&v3v3>;
};
};

Without this patch and the previous update in DT the command
"usb stop" failed and the next command "usb start" cause a crash.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Marek Vasut <marex@denx.de>
18 months agoarm: mvebu: Espressobin: Fix default env variables
Derek LaHousse [Mon, 12 Dec 2022 06:34:17 +0000 (07:34 +0100)]
arm: mvebu: Espressobin: Fix default env variables

Default env variables on Espressobin boards are broken since commit c4df0f6f315c
("arm: mvebu: Espressobin: Set default value for $fdtfile env variable") as well
as the 'env default -a' command.

The algorithm to find free space in the default_environment[] array returns
after the first env variable instead of the correct position of the last
variable, where there is allocated free space.

This causes that U-Boot board_late_init() function to overwrite a portion of the
default environment with $ethXaddr and $fdtfile variables immediately after the
first env variable and so it is overwriting other variables.

This patch also adds an additional null byte to terminate the environment array.

But U-Boot board_late_init() function do not fill this nul byte explicitly. And
because of that, U-Boot is later trying to interpret remaining buffer as a
continuation of variable list. Normally buffer should be empty but due to the
above issue, it contains garbage from remaining env variables.

For example 'env default -a' command results in damaging variable names. It was
observed that scritaddr variable name was changed to criptaddr (without leading
's').

This bug was reported and discussed on the Armbian forum:
https://forum.armbian.com/topic/19564-making-espressobin-v7-work-in-2022/?do=findComment&comment=138136

Fix these issues in two steps:

1) Change code which finds free space for dynamic env variables in
default_environment[] array by jumping to the end of the variable list instead
of jumping after the first defined variable. [By Derek]

2) Add code which appends terminating nul byte as indication of the end of the
env list, after the last nul term env string. [By Pali]

Fixes: c4df0f6f315c ("arm: mvebu: Espressobin: Set default value for $fdtfile env variable")
Signed-off-by: Derek LaHousse <derek@seaofdirac.org>
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Stefan Roese <sr@denx.de>
18 months agoMerge tag 'u-boot-nand-20221211' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Sun, 11 Dec 2022 14:40:25 +0000 (09:40 -0500)]
Merge tag 'u-boot-nand-20221211' of https://source.denx.de/u-boot/custodians/u-boot-nand-flash

Merge tag 'u-boot-nand-20221211' of https://source.denx.de/u-boot/custodians/u-boot-nand-flash

- cmd: nand: Extend nand info to print ecc information
- rawnand: omap_gpmc: driver model support (the first patches of the series)
- mtd: nand: make Samsung SLC NAND usable again
- cmd: mtd: check if a block has to be skipped or erased
- spl: spl_legacy: fix invalid offset in SPL_COPY_PAYLOAD_ONLY

18 months agospl: spl_legacy: fix invalid offset in SPL_COPY_PAYLOAD_ONLY
Dai Okamura [Fri, 9 Dec 2022 11:40:21 +0000 (20:40 +0900)]
spl: spl_legacy: fix invalid offset in SPL_COPY_PAYLOAD_ONLY

This fixes the header offset calculation.

This issue was found on uniphier v7 SoCs with SPL.

Fixes: 06377c5a1f ("spl: spl_legacy: Fix NAND boot on OMAP3 BeagleBoard")
Signed-off-by: Dai Okamura <okamura.dai@socionext.com>
Reviewed-By: Michael Trimarchi <michael@amarulasolutions.com>
Acked-by: Michael Trimarchi <michael@amarulasolutions.com>
Link: https://lore.kernel.org/all/20221209114021.3074978-1-okamura.dai@socionext.com
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
18 months agomtd: nand: mxs_nand_spl: don't read useless pages
Dario Binacchi [Sun, 20 Nov 2022 09:57:04 +0000 (10:57 +0100)]
mtd: nand: mxs_nand_spl: don't read useless pages

The patch prevents pages beyond the last from being unnecessarily read.
This occurs when the last page to be read is not the last page of the
last block. Before this change we would have read all the pages up to
the end of the last block.

Suggested-by: Michael Trimarchi <michael@amarulasolutions.com>
Co-developed-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Acked-by: Michael Trimarchi <michael@amarulasolutions.com>
Link: https://lore.kernel.org/all/20221120095705.3019295-1-dario.binacchi@amarulasolutions.com
18 months agomtd: nand: drop EXPORT_SYMBOL_GPL for nanddev_erase()
Dario Binacchi [Tue, 8 Nov 2022 09:07:19 +0000 (10:07 +0100)]
mtd: nand: drop EXPORT_SYMBOL_GPL for nanddev_erase()

This function is only used within this module, so it is no longer
necessary to use EXPORT_SYMBOL_GPL().

This patch parallels the work done in the following patch:
https://lore.kernel.org/linux-mtd/20221018170205.1733958-1-dario.binacchi@amarulasolutions.com

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Reviewed-By: Michael Trimarchi <michael@amarulasolutions.com>
Link: https://lore.kernel.org/all/20221108090719.3631621-1-dario.binacchi@amarulasolutions.com
18 months agocmd: mtd: check if a block has to be skipped or erased
Dario Binacchi [Sun, 30 Oct 2022 14:14:13 +0000 (15:14 +0100)]
cmd: mtd: check if a block has to be skipped or erased

As reported by patch [1], the `mtd erase' command should not erase bad
blocks.
To force bad block erasing you have to use the `mtd erase.dontskipbad'
command.

This patch tries to fix the same issue without modifying code taken
from the linux kernel, in order to make further upgrades easier.

[1] https://lore.kernel.org/all/20221006031501.110290-2-mikhail.kshevetskiy@iopsys.eu/
Suggested-by: Michael Trimarchi <michael@amarulasolutions.com>
Co-developed-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Co-developed-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Tested-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
18 months agomtd: nand: make Samsung SLC NAND usable again
Michael Trimarchi [Fri, 21 Oct 2022 06:05:36 +0000 (08:05 +0200)]
mtd: nand: make Samsung SLC NAND usable again

Upstream linux commit 69fc01296c9281

commit a1286a1fc416 ("mtd: nand: Move Samsung specific init/detection
logic in nand_samsung.c") introduced a regression for Samsung SLC NAND
chips. Prior to this commit chip->bits_per_cell was initialized by calling
nand_get_bits_per_cell() before using nand_is_slc().
With the offending commit this call is skipped, leaving
chip->bits_per_cell cleared to zero when the manufacturer specific
'.detect' function calls nand_is_slc() which in turn interprets
bits_per_cell != 1 as indication for an MLC chip.
The effect is that e.g. a K9F1G08U0F NAND chip is falsely detected as
MLC NAND with 4KiB page size rather than SLC with 2KiB page size.

Add a call to nand_get_bits_per_cell() before calling the .detect hook
function in nand_manufacturer_detect(), so that the nand_is_slc()
calls in the manufacturer specific code will return correct results.

Reported-by: Marcin Gołaś <marcingol30@gmail.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Link: https://lore.kernel.org/all/20221021060536.11747-1-michael@amarulasolutions.com
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
18 months agomtd: rawnand: omap_gpmc: Reduce .bss usage
Roger Quadros [Tue, 11 Oct 2022 11:50:06 +0000 (14:50 +0300)]
mtd: rawnand: omap_gpmc: Reduce .bss usage

Allocate omap_ecclayout on the heap as we have
limited .bss space on AM64 R5 SPL configuration.

Reduces .bss usage by 2984 bytes.

Signed-off-by: Roger Quadros <rogerq@kernel.org>
Reviewed-By: Michael Trimarchi <michael@amarulasolutions.com>
Link: https://lore.kernel.org/all/20221011115012.6181-9-rogerq@kernel.org
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
18 months agomtd: rawnand: nand_spl_loaders: Fix cast type build warning
Roger Quadros [Tue, 11 Oct 2022 11:50:05 +0000 (14:50 +0300)]
mtd: rawnand: nand_spl_loaders: Fix cast type build warning

Fixes the below build warning on 64-bit platforms.

drivers/mtd/nand/raw/nand_spl_loaders.c:26:21: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
      dst = (void *)((int)dst - page_offset);

Signed-off-by: Roger Quadros <rogerq@kernel.org>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Link: https://lore.kernel.org/all/20221011115012.6181-8-rogerq@kernel.org
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
18 months agomtd: rawnand: omap_gpmc: Optimize NAND reads
Roger Quadros [Tue, 11 Oct 2022 11:50:02 +0000 (14:50 +0300)]
mtd: rawnand: omap_gpmc: Optimize NAND reads

Rename omap_nand_read() to omap_nand_read_buf() to reflect
actual behaviour.

Use FIFO read address instead of raw read address for reads.

The GPMC automatically converts 32-bit/16-bit reads to NAND
device specific reads (8/16 bit). Use the largest possible
read granularity size for more efficient reads.

Signed-off-by: Roger Quadros <rogerq@kernel.org>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Link: https://lore.kernel.org/all/20221011115012.6181-5-rogerq@kernel.org
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
18 months agomtd: rawnand: omap_gpmc: Fix build warning on 64-bit platforms
Roger Quadros [Tue, 11 Oct 2022 11:50:01 +0000 (14:50 +0300)]
mtd: rawnand: omap_gpmc: Fix build warning on 64-bit platforms

Pointer size cannot be assumed to be 32-bit, so use
use uintptr_t instead of uint32_t.

Fixes the below build warning on 64-bit builds.

drivers/mtd/nand/raw/omap_gpmc.c:439:10: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  head = ((uint32_t) buf) % 4;

Signed-off-by: Roger Quadros <rogerq@kernel.org>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Link: https://lore.kernel.org/all/20221011115012.6181-4-rogerq@kernel.org
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
18 months agomtd: rawnand: omap_gpmc: Enable build for K2/K3 platforms
Roger Quadros [Tue, 11 Oct 2022 11:50:00 +0000 (14:50 +0300)]
mtd: rawnand: omap_gpmc: Enable build for K2/K3 platforms

The GPMC module is present on some K2 and K3 SoCs.
Enable building GPMC NAND driver for K2/K3 platforms.

Signed-off-by: Roger Quadros <rogerq@kernel.org>
Reviewed-By: Michael Trimarchi <michael@amarulasolutions.com>
Link: https://lore.kernel.org/all/20221011115012.6181-3-rogerq@kernel.org
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
18 months agomtd: rawnand: omap_gpmc: Deprecate asm/arch/mem.h
Roger Quadros [Tue, 11 Oct 2022 11:49:59 +0000 (14:49 +0300)]
mtd: rawnand: omap_gpmc: Deprecate asm/arch/mem.h

We want to get rid of <asm/arch/mem.h> so don't
enforce it for new platforms.

This also means GPMC_MAX CS doesn't have to be defined
by platform code.

Define it locally here for now.

Signed-off-by: Roger Quadros <rogerq@kernel.org>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Link: https://lore.kernel.org/all/20221011115012.6181-2-rogerq@kernel.org
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
18 months agocmd: nand: Extend nand info to print ecc information
Michael Trimarchi [Thu, 22 Sep 2022 13:39:37 +0000 (15:39 +0200)]
cmd: nand: Extend nand info to print ecc information

Extract the information about ecc strength and ecc step size
from mtd controller. This information is usefull to check if
what we think as ecc is what we really configured.

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Link: https://lore.kernel.org/all/20220922133937.277463-1-michael@amarulasolutions.com
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
18 months agoMerge tag 'u-boot-stm32-20221207' of https://source.denx.de/u-boot/custodians/u-boot-stm
Tom Rini [Thu, 8 Dec 2022 16:25:08 +0000 (11:25 -0500)]
Merge tag 'u-boot-stm32-20221207' of https://source.denx.de/u-boot/custodians/u-boot-stm

- Drop MMCI interrupt-names in STM32H743, STM32MP15 and STM322MP13 DT

DHSOM:
  - Enable assorted ST specific commands
  - Add version variable
  - Add boot counter
STM32MP13:
  - Add sdmmc cd-gpios for STM32MP135F-DK
  - Add clock & reset support
STM32 ADC:
  - Split channel init into several routines
  - Add support of generic channels binding

18 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Thu, 8 Dec 2022 16:24:50 +0000 (11:24 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-usb

- DFU and RNDIS fixes

18 months agousb: gadget: rndis: Prevent InformationBufferOffset manipulation
Szymon Heidrich [Mon, 5 Dec 2022 09:28:23 +0000 (10:28 +0100)]
usb: gadget: rndis: Prevent InformationBufferOffset manipulation

Prevent access to arbitrary memory locations in gen_ndis_set_resp
via manipulation of buf->InformationBufferOffset. Original
implementation permits manipulation of InformationBufferOffset to
exploit OID_GEN_CURRENT_PACKET_FILTER to set arbitrary memory contents
within a 32byte offset as the devices packet filter. The packet filter
value may be next retrieved using gen_ndis_query_resp so it is possible
to extract specific memory regions two bytes a time.

The rndis_query_response was not modified as neither the buffer offset
nor length passed to gen_ndis_query_resp is used.

Signed-off-by: Szymon Heidrich <szymon.heidrich@gmail.com>
18 months agodfu: Make DFU virtual backend SPL friendly
Patrick Delaunay [Wed, 30 Nov 2022 10:42:02 +0000 (11:42 +0100)]
dfu: Make DFU virtual backend SPL friendly

Define stub for dfu_*_virt function in SPL, because
CONFIG_SPL_DFU_VIRT is not defined.

This patch avoids compilation issue in dfu_fill_entity() when
CONFIG_SPL_DFU is activated because the dfu_fill_entity_virt()
function is not available.

Fixes: ec44cace4b8d2 ("dfu: add DFU virtual backend")
Reported-by: Marek Vasut <marex@denx.de>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Marek Vasut <marex@denx.de>
18 months agousb: gadget: dfu: Fix check of transfer direction
Hugo SIMELIERE [Wed, 30 Nov 2022 08:29:16 +0000 (09:29 +0100)]
usb: gadget: dfu: Fix check of transfer direction

Commit fbce985e28eaca3af82afecc11961aadaf971a7e to fix CVE-2022-2347
blocks DFU usb requests.
The verification of the transfer direction was done by an equality
but it is a bit mask.

Signed-off-by: Hugo SIMELIERE <hsimeliere.opensource@witekio.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Sultan Qasim Khan <sultan.qasimkhan@nccgroup.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Marek Vasut <marex@denx.de>
18 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Thu, 8 Dec 2022 13:28:14 +0000 (08:28 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-riscv

- Kautuk's semihosting patch:
  move semihosting library from arm directory to common place and add
  RISC-V support
- Zong's Kconfig patch:
  use "imply" instead of "select" to allow user to decide if
  SPL_SEPARATE_BSS should be selected

18 months agoMerge tag 'u-boot-at91-fixes-2023.01-b' of https://source.denx.de/u-boot/custodians...
Tom Rini [Thu, 8 Dec 2022 13:27:50 +0000 (08:27 -0500)]
Merge tag 'u-boot-at91-fixes-2023.01-b' of https://source.denx.de/u-boot/custodians/u-boot-at91

Second set of u-boot-at91 fixes for the 2023.01 cycle:

This is a single tiny fix that allows the correct name for one pin on
sama7g5 device. People with DT coming from Linux will have build errors
without this if they add NAND device.

18 months agoriscv: use imply instead of select for SPL_SEPARATE_BSS
Zong Li [Wed, 16 Nov 2022 07:08:39 +0000 (07:08 +0000)]
riscv: use imply instead of select for SPL_SEPARATE_BSS

Use imply instead of select, then it can still be disabled by
board-specific defconfig, or be set to n manually.

Signed-off-by: Zong Li <zong.li@sifive.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
18 months agocommon/spl/Kconfig: add dependency on SPL_SEMIHOSTING for SPL payload
Kautuk Consul [Wed, 7 Dec 2022 11:42:36 +0000 (17:12 +0530)]
common/spl/Kconfig: add dependency on SPL_SEMIHOSTING for SPL payload

When we enable CONFIG_SPL and CONFIG_SPL_SEMIHOSTING then the code
in common/spl/spl_semihosting.c tries to use the
CONFIG_SPL_FS_LOAD_PAYLOAD_NAME string which remains undeclared
unless SPL_FS_EXT4 || SPL_FS_FAT || SPL_FS_SQUASHFS are configured.

Add a dependency of SPL_SEMIHOSTING in the depends for
SPL_FS_LOAD_PAYLOAD_NAME so that the code compiles fine.

Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
18 months agoarch/riscv: add semihosting support for RISC-V
Kautuk Consul [Wed, 7 Dec 2022 11:42:35 +0000 (17:12 +0530)]
arch/riscv: add semihosting support for RISC-V

We add RISC-V semihosting based serial console for JTAG based early
debugging.

The RISC-V semihosting specification is available at:
https://github.com/riscv/riscv-semihosting-spec/blob/main/riscv-semihosting-spec.adoc

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
18 months agolib: Add common semihosting library
Kautuk Consul [Wed, 7 Dec 2022 11:42:34 +0000 (17:12 +0530)]
lib: Add common semihosting library

We factor out the arch-independent parts of the ARM semihosting
implementation as a common library so that it can be shared
with RISC-V.

Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
18 months agoARM: stm32: Increment WDT by default on DHSOM
Marek Vasut [Tue, 6 Dec 2022 02:35:15 +0000 (03:35 +0100)]
ARM: stm32: Increment WDT by default on DHSOM

Enable watchdog timer on the DHSOM by default, both in U-Boot proper and
in SPL. This can be used in combination with boot counter by either SPL
or U-Boot proper to boot either copy of system software, e.g. in case of
full A/B update strategy.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
18 months agoARM: stm32: Increment boot counter in SPL on DHSOM
Marek Vasut [Tue, 6 Dec 2022 02:35:14 +0000 (03:35 +0100)]
ARM: stm32: Increment boot counter in SPL on DHSOM

Increment the boot counter already in U-Boot SPL instead of incrementing
it only later in U-Boot proper. This can be used by SPL to boot either of
two U-Boot copies and improve redundancy of software on the platform, e.g.
in case of full A/B update strategy.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
18 months agoARM: stm32: Enable assorted ST specific commands on DHSOM
Marek Vasut [Tue, 6 Dec 2022 02:35:13 +0000 (03:35 +0100)]
ARM: stm32: Enable assorted ST specific commands on DHSOM

Enable the stm32prog, stm32key, stboard commands on DHSOM.
Those can be used e.g. to implement verified boot.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
18 months agoARM: stm32: Add version variable to DHSOM
Marek Vasut [Tue, 1 Nov 2022 22:35:31 +0000 (23:35 +0100)]
ARM: stm32: Add version variable to DHSOM

Enable insertion of version variable into U-Boot environment on DHSOM,
to make it possible to check U-Boot version e.g. in U-Boot scripts.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
18 months agoARM: stm32: Add boot counter to DHSOM
Marek Vasut [Thu, 27 Oct 2022 21:17:55 +0000 (23:17 +0200)]
ARM: stm32: Add boot counter to DHSOM

Add boot counter to STM32MP15xx DHSOM. This aligns the software with
other upstream DHSOM products which already do enable boot counter.

The boot counter on STM32MP15xx is placed in the TAMP block TAMP_BKPxR
register 19, right past register 17 and 18 used for CM4 resource table
and state by the Linux kernel. The TAMP_BKPxR register block is used
because its contents survives warm reset, but not cold reset.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
18 months agoARM: dts: stm32: Drop MMCI interrupt-names
Marek Vasut [Wed, 2 Nov 2022 13:53:49 +0000 (14:53 +0100)]
ARM: dts: stm32: Drop MMCI interrupt-names

The pl18x MMCI driver does not use the interrupt-names property,
the binding document has been updated to recommend this property
be unused, remove it.
Backport of Marek's Linux patch:
https://lore.kernel.org/linux-arm-kernel/20221013221242.218808-3-marex@denx.de/

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Yann Gautier <yann.gautier@foss.st.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
18 months agoARM: dts: stm32: add sdmmc cd-gpios for STM32MP135F-DK
Yann Gautier [Wed, 2 Nov 2022 13:53:48 +0000 (14:53 +0100)]
ARM: dts: stm32: add sdmmc cd-gpios for STM32MP135F-DK

On STM32MP135F-DK, the SD card detect GPIO is GPIOH4.
Backport of the Linux patch:
https://lore.kernel.org/linux-arm-kernel/20220921160334.3227138-1-yann.gautier@foss.st.com/

Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
18 months agoadc: stm32mp15: add support of generic channels binding
Olivier Moysan [Wed, 23 Nov 2022 15:20:16 +0000 (16:20 +0100)]
adc: stm32mp15: add support of generic channels binding

Add support of generic IIO channels binding:
./devicetree/bindings/iio/adc/adc.yaml
Keep support of st,adc-channels for backward compatibility.

Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
18 months agoadc: stm32mp15: split channel init into several routines
Olivier Moysan [Wed, 23 Nov 2022 15:20:15 +0000 (16:20 +0100)]
adc: stm32mp15: split channel init into several routines

Split stm32_adc_chan_of_init channel initialization function into
several routines to increase readability and prepare channel
generic binding handling.

Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
18 months agoarm: dts: stm32mp13: add support of RCC driver
Gabriel Fernandez [Thu, 24 Nov 2022 10:36:05 +0000 (11:36 +0100)]
arm: dts: stm32mp13: add support of RCC driver

Adds support of Clock and Reset drivers for STM32MP13 platform.

Signed-off-by: Gabriel Fernandez <gabriel.fernandez@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
18 months agoclk: stm32mp13: introduce STM32MP13 RCC driver
Gabriel Fernandez [Thu, 24 Nov 2022 10:36:04 +0000 (11:36 +0100)]
clk: stm32mp13: introduce STM32MP13 RCC driver

STM32MP13 RCC driver uses Common Clock Framework and also a
'clk-stm32-core' API. Then STM32MPx RCC driver will contain only data
configuration (gates, mux, dividers and the way to check security)
or some specific clocks.
This API will be used by all new other generations of ST Socs.

Signed-off-by: Gabriel Fernandez <gabriel.fernandez@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
18 months agodt-bindings: stm32mp13: add clock & reset support for STM32MP13
Gabriel Fernandez [Thu, 24 Nov 2022 10:36:03 +0000 (11:36 +0100)]
dt-bindings: stm32mp13: add clock & reset support for STM32MP13

Add support of stm32mp13 DT bindings of clock and reset.

Signed-off-by: Gabriel Fernandez <gabriel.fernandez@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
18 months agoMerge tag 'sound-2023-01-rc4' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Tue, 6 Dec 2022 15:07:01 +0000 (10:07 -0500)]
Merge tag 'sound-2023-01-rc4' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for sound-2023-01-rc4

* Avoid endless loop and amend unit test
* Add man-page for the sound command
* Fix sandbox sound driver

18 months agoPrepare v2023.01-rc3
Tom Rini [Mon, 5 Dec 2022 20:21:53 +0000 (15:21 -0500)]
Prepare v2023.01-rc3

Signed-off-by: Tom Rini <trini@konsulko.com>
18 months agoMerge branch '2022-12-05-add-IPv6-support'
Tom Rini [Mon, 5 Dec 2022 18:28:22 +0000 (13:28 -0500)]
Merge branch '2022-12-05-add-IPv6-support'

To quote the author:
This patch set adds basic IPv6 support to U-boot.
It is based on Chris's Packham patches
(https://lists.denx.de/pipermail/u-boot/2017-January/279366.html)
Chris's patches were taken as base. There were efforts to launch it on
HiFive SiFive Unmatched board but the board didn't work well. The code was
refactored, fixed some bugs as CRC for little-endian, some parts were implemented in
our own way, something was taken from Linux. Finally we did manual tests and the
board worked well.

Testing was done on HiFive SiFive Unmatched board (RISC-V)

18 months agoconfigs: Add IPV6 config to sandbox_flattree_defconfig
Viacheslav Mitrofanov [Fri, 2 Dec 2022 09:18:17 +0000 (12:18 +0300)]
configs: Add IPV6 config to sandbox_flattree_defconfig

Allow to use IPV6 tests in sandbox

Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
18 months agoconfigs: Add IPV6 config to sandbox64_defconfig
Viacheslav Mitrofanov [Fri, 2 Dec 2022 09:18:16 +0000 (12:18 +0300)]
configs: Add IPV6 config to sandbox64_defconfig

Allow to use IPV6 tests in sandbox

Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
18 months agoconfigs: Add IPV6 config to sandbox_defconfig
Viacheslav Mitrofanov [Fri, 2 Dec 2022 09:18:14 +0000 (12:18 +0300)]
configs: Add IPV6 config to sandbox_defconfig

Allow to use IPV6 tests in sandbox

Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
18 months agotest: dm: eth: Add ip6_make_lladdr test
Viacheslav Mitrofanov [Fri, 2 Dec 2022 09:18:13 +0000 (12:18 +0300)]
test: dm: eth: Add ip6_make_lladdr test

Add a test that checks generated Link Local Address. Use in sandbox

Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agotest: dm: eth: Add ip6_make_snma test
Viacheslav Mitrofanov [Fri, 2 Dec 2022 09:18:12 +0000 (12:18 +0300)]
test: dm: eth: Add ip6_make_snma test

Add a test that checks generated Solicited Node Multicast Address from our
ipv6 address. Use in sandbox

Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agotest: dm: eth: Add ip6_addr_in_subnet test
Viacheslav Mitrofanov [Fri, 2 Dec 2022 09:18:11 +0000 (12:18 +0300)]
test: dm: eth: Add ip6_addr_in_subnet test

Add a test if two address are in the same subnet. Use in sandbox

Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agotest: dm: eth: Add csum_ipv6_magic test
Viacheslav Mitrofanov [Fri, 2 Dec 2022 09:18:10 +0000 (12:18 +0300)]
test: dm: eth: Add csum_ipv6_magic test

Test checksum computation. csum_ipv6_magic() uses in upper layer
protocols as TCP/UDP/ICMPv6/etc to calculate payload checksum.

Series-changes: 3
- Fixed style problems

Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agotest: dm: eth: Add string_to_ip6 test
Viacheslav Mitrofanov [Fri, 2 Dec 2022 09:18:09 +0000 (12:18 +0300)]
test: dm: eth: Add string_to_ip6 test

Add a test to check convertation from char* to struct in6_addr.
Use in sandbox

Series-changes: 3
- Fixed tests to use length param in string_to_ip6()

Series-changes: 5
- Add test under #ifdef

Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agonet: ping6: Add ping6 command
Viacheslav Mitrofanov [Fri, 2 Dec 2022 09:18:08 +0000 (12:18 +0300)]
net: ping6: Add ping6 command

Implement ping6 command to ping hosts using IPv6. It works the same way as
an ordinary ping command. There is no ICMP request so it is not possible
to ping our host. This patch adds options in Kconfig and Makefile to
build ping6 command.

Series-changes: 3
- Added structures and functions descriptions
- Added to ping6_receive() return value instead of void

Series-changes: 4
- Fixed structures and functions description style

Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agonet: tftp: Add IPv6 support for tftpboot
Viacheslav Mitrofanov [Fri, 2 Dec 2022 09:18:07 +0000 (12:18 +0300)]
net: tftp: Add IPv6 support for tftpboot

The command tftpboot uses IPv4 by default. Add the possibility to use IPv6
instead. If an address in the command is an IPv6 address it will use IPv6
to boot or if there is a suffix -ipv6 in the end of the command it also
force using IPv6. All other tftpboot features and parameters are left
the same.

Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agonet: ipv6: Incorporate IPv6 support into u-boot net subsystem
Viacheslav Mitrofanov [Fri, 2 Dec 2022 09:18:06 +0000 (12:18 +0300)]
net: ipv6: Incorporate IPv6 support into u-boot net subsystem

Add net_ip6_handler (an IPv6 packet handler) into net_loop. Add
neighbor discovery mechanism into network init process. That is the
main step to run IPv6 in u-boot. Now u-boot is capable to use NDP and
handle IPv6 packets.

Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agonet: ipv6: Add implementation of main IPv6 functions
Viacheslav Mitrofanov [Fri, 2 Dec 2022 09:18:05 +0000 (12:18 +0300)]
net: ipv6: Add implementation of main IPv6 functions

Functions that were exposed in "net: ipv6: Add IPv6 basic primitives"
had only empty implementations and were exposed as API for futher
patches. This patch add implementation of these functions. Main
functions are: net_ip6_handler() - IPv6 packet handler for incoming
packets; net_send_udp_packet6() - make up and send an UDP packet;
csum_ipv6_magic() - compute checksum of IPv6 "psuedo-header" per RFC2460
section 8.1; ip6_addr_in_subnet() - check if an address is in our
subnet. Other functions are auxiliary.

Series-changes: 3
- Added comments
- Fixed style problems
- Fixed return codes instead of -1

Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agonet: ipv6: Add ip6addr, gatewayip6, serverip6 variables callbacks
Viacheslav Mitrofanov [Fri, 2 Dec 2022 09:18:04 +0000 (12:18 +0300)]
net: ipv6: Add ip6addr, gatewayip6, serverip6 variables callbacks

Implement actions on ip6addr, gatewayip6, serverip6 varaibles.
on_ip6addr - convert IPv6 string addr to struct ip6_addr
on_gatewayip6 - convert IPv6 string addr to struct ip6_addr
on_serverip6 - convert IPv6 string addr to struct ip6_addr

Series-changes: 3
- Removed memory allocation
- Substituted -1 for error code

Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agonet: ipv6: Enable IPv6 typeconversion specifier
Viacheslav Mitrofanov [Fri, 2 Dec 2022 09:18:03 +0000 (12:18 +0300)]
net: ipv6: Enable IPv6 typeconversion specifier

Add the possibility to recognize IPv6 address in print function.
To output IPv6 address use %pI6 specifier.

Series-changes: 3
- Substituted #if (...) for if (...) to get better readability

Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agonet: ipv6: Add string_to_ip6 converter
Viacheslav Mitrofanov [Fri, 2 Dec 2022 09:18:02 +0000 (12:18 +0300)]
net: ipv6: Add string_to_ip6 converter

This functions is used as a converter from IPv6 address string notation
to struct ip6_addr that is used everywhere in IPv6 implementation. For
example it is used to parse and convert IPv6 address from tftpboot
command. Conversion algorithm uses two passes, first to verify syntax and
locate colons and second pass to read the address. In case of valid IPv6
address it returns 0.

Examples of valid strings:
2001:db8::0:1234:1
2001:0db8:0000:0000:0000:0000:1234:0001
::1
::ffff:192.168.1.1

Examples of invalid strings
2001:db8::0::0          (:: can only appear once)
2001:db8:192.168.1.1::1 (v4 part can only appear at the end)
192.168.1.1             (we don't implicity map v4)

Series-changes: 3
- Added function description
- Added length parameter to string_to_ip6()

Series-changes: 4
- Fixed function description style

Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agonet: ipv6: Add Neighbor Discovery Protocol (NDP)
Viacheslav Mitrofanov [Fri, 2 Dec 2022 09:18:01 +0000 (12:18 +0300)]
net: ipv6: Add Neighbor Discovery Protocol (NDP)

Implement basic of NDP. It doesn't include such things as Router
Solicitation, Router Advertisement and Redirect. It just has Neighbor
Solicitation and Neighbor Advertisement. Only these two features are used
in u-boot IPv6. Implementation of some NDP functions uses API that was
exposed in "net: ipv6: Add IPv6 basic primitives".

Also this patch inlcudes update in Makefile to build NDP.

Series-changes: 3
- Added structures and functions descriptions
- Fixed style problems

Series-changes: 4
- Fixed structures and functions description style

Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agonet: ipv6: Add callbacks declarations to get access to IPv6 variables
Viacheslav Mitrofanov [Fri, 2 Dec 2022 09:18:00 +0000 (12:18 +0300)]
net: ipv6: Add callbacks declarations to get access to IPv6 variables

Set up callbacks for main IPv6 variables ip6add, serverip6, gatewayip6
and set options to them in flag file. These variables are often set up by
users.

Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agonet: ipv6: Add IPv6 build options
Viacheslav Mitrofanov [Fri, 2 Dec 2022 09:17:59 +0000 (12:17 +0300)]
net: ipv6: Add IPv6 build options

Add options to Makefile and Kconfig file to build IPv6

Series-changes: 3
- Added help for IPv6 support

Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agonet: ipv6: Add IPv6 basic primitives
Viacheslav Mitrofanov [Fri, 2 Dec 2022 09:17:58 +0000 (12:17 +0300)]
net: ipv6: Add IPv6 basic primitives

This patch is a collection of basic primitives that are prerequisite for
further IPv6 implementation.

There are structures definition such as IPv6 header, UDP header
(for TFTP), ICMPv6 header. There are auxiliary defines such as protocol
codes, padding, struct size and etc. Also here are functions prototypes
and its empty implementation that will be used as API for further patches.
Here are variables declaration such as IPv6 address of our host,
gateway, ipv6 server.

Series-changes: 3
- Added functions and structures descriptions
- Removed enums ND_OPT_*. It will be moved into further patches
- Substituted -1 for error codes

Series-changes: 4
- Changed functions and structures description style

Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agosandbox: fix sound driver
Heinrich Schuchardt [Sun, 4 Dec 2022 19:48:57 +0000 (20:48 +0100)]
sandbox: fix sound driver

In the callback function we have to use memcpy(). Otherwise we add
the new samples on top of what is stored in the stream buffer.

If we don't have enough data, zero out the rest of the stream buffer.

Our sampling frequency is 48000. Let the batch size for the callback
function be 960. If we play a multiple of 20 ms, this will always be
a full batch.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agodoc: man-page for the sound command
Heinrich Schuchardt [Sun, 4 Dec 2022 15:16:12 +0000 (16:16 +0100)]
doc: man-page for the sound command

Provide a man-page for the sound command.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agocmd: fix long text for sound command
Heinrich Schuchardt [Sun, 4 Dec 2022 15:33:07 +0000 (16:33 +0100)]
cmd: fix long text for sound command

Make it clear that if only 1 parameter is provided this is the duration.

The ISO symbol for hertz is Hz.

Fixes: c0c88533fffd ("Sound: Add command for audio playback")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agotest: test sandbox sound driver more rigorously
Heinrich Schuchardt [Sun, 4 Dec 2022 16:11:41 +0000 (17:11 +0100)]
test: test sandbox sound driver more rigorously

Consider unexpected values for frequency:

* negative frequency
* zero frequency
* frequency exceeding sampling frequency

As in these cases the sum of the samples is zero also check the count of
the samples.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agosound: avoid endless loop
Heinrich Schuchardt [Sun, 4 Dec 2022 13:00:05 +0000 (14:00 +0100)]
sound: avoid endless loop

'sound play 1 100000' results in an endless loop on the sandbox.

If the frequency exceeds half the sampling rate, zero out the output
buffer.

Fixes: 511ed5fdd389 ("SOUND: SAMSUNG: Add I2S driver")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
18 months agoMerge tag 'xilinx-for-v2023.01-rc3-v2' of https://source.denx.de/u-boot/custodians...
Tom Rini [Mon, 5 Dec 2022 13:33:19 +0000 (08:33 -0500)]
Merge tag 'xilinx-for-v2023.01-rc3-v2' of https://source.denx.de/u-boot/custodians/u-boot-microblaze

Xilinx changes for v2023.01-rc3-v2

xilinx:
- Fix MAC address selection for System Controller from FRU
- Cleanup Kconfig (ZYNQ_MAC_IN_EEPROM symbol)

versal:
- Create u-boot.elf for mini spi configurations

versal-net:
- Enable MT35XU flash

zynq:
- Add missing timer to DT for mini configurations

zynqmp:
- Do not include psu_init to U-Boot by default
- Do not enable IPI by default to mini U-Boot
- Update Luca's fragment
- Fix SPL_FS_LOAD_PAYLOAD_NAME usage

spi:
- gqspi: Fix tapdelay values
- gqspi: Fix 64bit address support
- cadence: Remove condition for calling enable linear mode
- nor-core: Invert logic to reflect sst26 flash unlocked

net:
- Add PCS/PMA phy support

18 months agoMerge tag 'i2cfixes-for-v2023.01-rc3' of https://source.denx.de/u-boot/custodians...
Tom Rini [Mon, 5 Dec 2022 13:33:01 +0000 (08:33 -0500)]
Merge tag 'i2cfixes-for-v2023.01-rc3' of https://source.denx.de/u-boot/custodians/u-boot-i2c

i2c Fixes for v2023.01-rc3

- nuovoton driver:
  rename npcm_i2c -> npcm-i2c from Jim Liu

18 months agomtd: spi-nor-core: Invert logic to reflect sst26 flash unlocked
Algapally Santosh Sagar [Tue, 22 Nov 2022 05:18:33 +0000 (22:18 -0700)]
mtd: spi-nor-core: Invert logic to reflect sst26 flash unlocked

flash_is_locked is changed to flash_is_unlocked with commit 513c6071ce73
("mtd: spi: Convert is_locked callback to is_unlocked"). sst26_is_locked()
is also changed to sst26_is_unlocked() but the logic remained same.
Invert the logic for the flash lock/unlock to work properly.

Signed-off-by: Algapally Santosh Sagar <santoshsagar.algapally@amd.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
Link: https://lore.kernel.org/r/20221122051833.13306-1-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
18 months agoxilinx: zynqmp: Fix SPL_FS_LOAD_PAYLOAD_NAME usage
Michal Simek [Fri, 2 Dec 2022 13:06:15 +0000 (14:06 +0100)]
xilinx: zynqmp: Fix SPL_FS_LOAD_PAYLOAD_NAME usage

SPL_FS_LOAD_PAYLOAD_NAME depends on SPL to be enabled.
If SPL is not enabled code still expects SPL_FS_LOAD_PAYLOAD_NAME to be
present. That's why setup proper dependency in the code.
And by doing so also change the logic around dfu_alt_info string
composition to be simpler.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/3989c390a4acae13a1b05c040e14fb3d68bced02.1669986373.git.michal.simek@amd.com
18 months agoarm64: versal-net: Enable defconfig for Micron octal flashes
Ashok Reddy Soma [Tue, 29 Nov 2022 10:18:31 +0000 (11:18 +0100)]
arm64: versal-net: Enable defconfig for Micron octal flashes

Micron mt35 series octal flashes are under config option
CONFIG_SPI_FLASH_MT35XU. Enable it in default defconfig for octal
flashes to be detected.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/dfaf73a72c7b408f1b8530f411c405d3dcf9f854.1669717110.git.michal.simek@amd.com
18 months agospi: cadence-qspi: Remove condition for calling enable linear mode
Ashok Reddy Soma [Tue, 29 Nov 2022 11:41:34 +0000 (04:41 -0700)]
spi: cadence-qspi: Remove condition for calling enable linear mode

cadence_qspi_apb_enable_linear_mode() has a weak function defined, so no
need to gaurd this under if (CONFIG_IS_ENABLED(ARCH_VERSAL)).

In cadence_qspi_apb_write_execute(), enable linear mode is called twice by
mistake, remove extra one.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20221129114134.18909-1-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
18 months agoARM: zynq: Add missing twd timer for mini configurations
Michal Simek [Tue, 29 Nov 2022 12:23:20 +0000 (13:23 +0100)]
ARM: zynq: Add missing twd timer for mini configurations

The commit b7e0750d8872 ("zynq: Convert arm twd timer to DM driver")
switched timer to DM but missing to add nodes to all mini configurations.
Based on it missing timer end up in non functional system where any delay
doesn't work.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/2020fc7e3d4760e890265485b3c7e18eb1caf8be.1669724598.git.michal.simek@amd.com
18 months agoarm64: zynqmp: Do not enable IPI by default
Michal Simek [Tue, 29 Nov 2022 15:09:42 +0000 (16:09 +0100)]
arm64: zynqmp: Do not enable IPI by default

ZynqMP mini configurations are not using IPI driver and enabling this is
adding additional ~1200 Bytes (depends on configuration).
This ends up in situation that there is no enough space in OCM for
relocation that's why disable this driver for all mini configurations.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/c71bab3927cb71ae517d9c21f59f3d5cf0caf712.1669734580.git.michal.simek@amd.com
18 months agoarm64: zynqmp: Do not include psu_init to U-Boot by default
Michal Simek [Fri, 2 Dec 2022 08:18:06 +0000 (09:18 +0100)]
arm64: zynqmp: Do not include psu_init to U-Boot by default

The commit ed35de617013 ("Convert CONFIG_ZYNQMP_PSU_INIT_ENABLED to
Kconfig") converted CONFIG_ZYNQMP_PSU_INIT_ENABLED symbol and enabled it by
default which is not correct configuration.
Intention of this config was to have it enabled by default for SPL and
provide an option to users to also do low level initialization directly
from U-Boot.
That's why it is necessary to define second symbol with SPL marking in it
and properly use symbols depends on usage in Makefile.
Also disable ZYNQMP_PSU_INIT_ENABLED from boards which enables it by
default. CONFIG_SPL_ZYNQMP_PSU_INIT_ENABLED is enabled by default when SPL
is enabled.

Reported-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Reviewed-by: Luca Ceresoli <luca@lucaceresoli.net>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/d5fcbd66b05bf0d7ef594e66464ee23b48c5e4cc.1669969083.git.michal.simek@amd.com
18 months agoboard/xilinx/zynqmp/MAINTAINERS: change e-mail address for Luca Ceresoli
Luca Ceresoli [Sat, 3 Dec 2022 21:49:39 +0000 (22:49 +0100)]
board/xilinx/zynqmp/MAINTAINERS: change e-mail address for Luca Ceresoli

My Bootlin address is the preferred one now.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Link: https://lore.kernel.org/r/20221203214939.56608-1-luca@lucaceresoli.net
Signed-off-by: Michal Simek <michal.simek@amd.com>
18 months agoxilinx: Remove unused ZYNQ_MAC_IN_EEPROM/ZYNQ_GEM_I2C_MAC_OFFSET entries
Michal Simek [Wed, 23 Nov 2022 08:27:08 +0000 (09:27 +0100)]
xilinx: Remove unused ZYNQ_MAC_IN_EEPROM/ZYNQ_GEM_I2C_MAC_OFFSET entries

The commit ba74bcf3e07b ("xilinx: common: Remove
zynq_board_read_rom_ethaddr()") removed zynq_board_read_rom_ethaddr()
because xlnx,eeprom link via DT chosen node is no longer used. But forget
to remove Kconfig entries which are used by this code only.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/f97451ed33409838efea4071553b6da795cfc578.1669192026.git.michal.simek@amd.com
18 months agoxilinx: Add option to select SC id instead of DUT id for SC support
Michal Simek [Wed, 23 Nov 2022 11:48:44 +0000 (12:48 +0100)]
xilinx: Add option to select SC id instead of DUT id for SC support

Reading MAC address from on board EEPROM requires different type for System
Controller (SC).

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/90bb7cc5463568a690b979f18c8d42556986b46d.1669204122.git.michal.simek@amd.com
18 months agospi: zynqmp_qspi: Add support for 64-bit read/write
Venkatesh Yadav Abbarapu [Fri, 25 Nov 2022 10:44:13 +0000 (16:14 +0530)]
spi: zynqmp_qspi: Add support for 64-bit read/write

When we pass the 64-bit address to read/write, only lower 32-bit
address is getting updated. Program the upper 32-bit address in the
DMA destination memory address MSBs register, which can handle upto
44-bit destination address.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20221125104413.26140-1-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
18 months agoarm64: versal: Enable REMAKE_ELF for mini_ospi/mini_qspi
Venkatesh Yadav Abbarapu [Fri, 25 Nov 2022 08:46:39 +0000 (14:16 +0530)]
arm64: versal: Enable REMAKE_ELF for mini_ospi/mini_qspi

Enable the config REMAKE_ELF in xilinx_versal_mini_ospi_defconfig
and xilinx_versal_mini_qspi_defconfig which generates u-boot.elf.
This commit a8c281d4b737("Convert CONFIG_REMAKE_ELF to Kconfig")
misses to enable this config in these defconfigs.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20221125084639.23835-1-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
18 months agospi: zynqmp_gqspi: Update tapdelay value
T Karthik Reddy [Wed, 23 Nov 2022 09:04:51 +0000 (02:04 -0700)]
spi: zynqmp_gqspi: Update tapdelay value

The driver was using an incorrect value for GQSPI_LPBK_DLY_ADJ_DLY_1
tapdelay for Versal for frequencies above 100MHz. Change it from 2 to 1
based on the recommended value in IP spec.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
Link: https://lore.kernel.org/r/20221123090451.11409-1-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
18 months agoarm64: zynqmp: dynamically mark r5 cores as used
Lukas Funke [Fri, 28 Oct 2022 12:15:47 +0000 (14:15 +0200)]
arm64: zynqmp: dynamically mark r5 cores as used

When Linux boot takes over control of the pmu
(by signaling PM_INIT_FINALIZE via ipi), pmu will switch off 'unused'
rpu cores. The Xilinx zynqmp fsbl prevents switching off those cores by
marking rpu cores as 'used' when loading code partitions to those cores.
The current u-boot SPL is missing this behaviour, which results in
halting rpu cores during Linux boot.

This commit mimics the xilinx zynqmp fsbl behavior by marking r5 cores as
used when they are released during boot.

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
Signed-off-by: Lukas Funke <lukas.funke-oss@weidmueller.com>
Link: https://lore.kernel.org/r/20221028121547.26464-2-lukas.funke-oss@weidmueller.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
18 months agonet: xilinx_axi: check PCS/PMA PHY status in setup_phy
Andy Chiu [Tue, 1 Nov 2022 03:58:00 +0000 (11:58 +0800)]
net: xilinx_axi: check PCS/PMA PHY status in setup_phy

Both PCS/PMA PHY and the external PHY need to have a valid link status
in order to have Ethernet traffic. Check and wait this status at
setup_phy() so that we could diagnose if there is a PHY issue.

Signed-off-by: Andy Chiu <andy.chiu@sifive.com>
Reviewed-by: Greentime Hu <greentime.hu@sifive.com>
Link: https://lore.kernel.org/r/20221101035800.912644-3-andy.chiu@sifive.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
18 months agonet: xilinx_axi: add PCS/PMA PHY
Andy Chiu [Tue, 1 Nov 2022 03:57:59 +0000 (11:57 +0800)]
net: xilinx_axi: add PCS/PMA PHY

If we bridge an external PHY to Xilinx's PCS/PMA PHY and would like to
get and set the real status of the PHY facing the external world. Then
we should phy_connect() to the external PHY instead of the PCS/PMA one.
Thus, we add a pcs-handle DT entry, which have been merged in Linux, and
leave the configuration of it to the driver itself.

Unlike Linux, where the PCS/PMA PHY is managed by phylink, managing the
PCS/PMA PHY is only internal to the driver in U-Boot. The PCS/PMA PHY
pressents only when the phy-mode is configured as SGMII or 1000Base-X,
so it is always 1 Gbps and full-duplex and we may skip passing link
information out.

Signed-off-by: Andy Chiu <andy.chiu@sifive.com>
Reviewed-by: Greentime Hu <greentime.hu@sifive.com>
Link: https://lore.kernel.org/r/20221101035800.912644-2-andy.chiu@sifive.com
Signed-off-by: Michal Simek <michal.simek@amd.com>