platform/kernel/u-boot.git
22 months agosunxi: board: annotate #endif lines
Andre Przywara [Mon, 28 Nov 2022 00:02:56 +0000 (00:02 +0000)]
sunxi: board: annotate #endif lines

The legacy Allwinner code is cluttered with #ifdef's, some of them even
nested, which makes the code hard to read and error prone.
Eventually we will get rid of most of them, but for now let's at least
annotate the #endif lines with the corresponding symbol the bracket
started with.

Reviewed-by: Samuel Holland <samuel@sholland.org>
Tested-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
22 months agosunxi: remove bogus mmc_pinmux_setup() prototype
Andre Przywara [Mon, 28 Nov 2022 00:55:20 +0000 (00:55 +0000)]
sunxi: remove bogus mmc_pinmux_setup() prototype

Since all callers of mmc_pinmux_setup() are located after the definition
of that function, there is no need for a forward declaration (anymore?).

Remove the prototype along with its #ifdef guards.

Reviewed-by: Samuel Holland <samuel@sholland.org>
Tested-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
22 months agosunxi: remove unused CONFIG_MMC_SUNXI_SLOT
Andre Przywara [Mon, 28 Nov 2022 00:03:53 +0000 (00:03 +0000)]
sunxi: remove unused CONFIG_MMC_SUNXI_SLOT

There is a CONFIG_MMC_SUNXI_SLOT definition in our sunxi_common.h config
header, which was used to note the first MMC controller to initialise.
The definition in that header was always set to 0, with no easy way of
overriding this, and certainly none of the existing boards made any use
of that (non-)feature.
Remove that definition and replace it with a constant 0 in the only
user, in board.c. It turns out that this is safe, as this is only used
in the SPL, and the BROM also unconditionally initialises MMC0.
This also removes the last legacy config symbol with SUN*I in it from
the whitelist.

Reviewed-by: Samuel Holland <samuel@sholland.org>
Tested-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
22 months agosunxi: Fix serial console for A10s-OLinuXino-MICRO
Mark Kettenis [Sun, 11 Dec 2022 22:00:54 +0000 (23:00 +0100)]
sunxi: Fix serial console for A10s-OLinuXino-MICRO

On this board CONFIG_CONS_INDEX needs to be 1 unlike other sun5i
boards.  Since this is the default, remove to bogus setting.

Fixes: 7095f8641863 ("sunxi: Convert CONS_INDEX to Kconfig")
Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
22 months agopinctrl: sunxi: Add P2WI and RSB pinmuxes
Samuel Holland [Fri, 18 Nov 2022 04:22:27 +0000 (22:22 -0600)]
pinctrl: sunxi: Add P2WI and RSB pinmuxes

P2WI and RSB are used to communicate with a PMIC. Most SoCs have only
one possible pinmux. F1C100s has two possibilities, with different mux
values, so omit it until some board needs one of them.

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>
22 months agosunxi: define SYS_MONITOR_LEN in Kconfig, not _defconfig
Andre Przywara [Sat, 19 Nov 2022 16:10:59 +0000 (16:10 +0000)]
sunxi: define SYS_MONITOR_LEN in Kconfig, not _defconfig

Commit 08574ed339fb ("Convert CONFIG_SYS_MONITOR_LEN to Kconfig") moved
the definition of said config variable from the common sunxi header to
*every board's* defconfig.
This is a platform choice, not board specific, so remove the variable
from there, instead set the one value for all Allwinner boards in
Kconfig.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
23 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)

23 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

23 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>
23 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>
23 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>
23 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

23 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>
23 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
23 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
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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

23 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

23 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>
23 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>
23 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>
23 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

23 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.

23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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

23 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>
23 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)

23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 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

23 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

23 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>
23 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
23 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
23 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>
23 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
23 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
23 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
23 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>
23 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
23 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
23 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>
23 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>
23 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>
23 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>
23 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>
23 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>
23 months agoi2c: nuvoton: renamed the NPCM i2c driver
Jim Liu [Mon, 21 Nov 2022 08:59:32 +0000 (16:59 +0800)]
i2c: nuvoton: renamed the NPCM i2c driver

The Makefile name is npcm_i2c but the driver is npcm-i2c.

Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
23 months agoMerge tag 'efi-2023-01-rc3' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sun, 4 Dec 2022 15:01:48 +0000 (10:01 -0500)]
Merge tag 'efi-2023-01-rc3' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2023-01-rc3

Documentation:

* describe DM firmware needed for j721e_evm
* describe management of UEFI security data base with eficonfig

UEFI:

* code clean-up for eficonfig command
* fix handling of DHCP aknowledge
* correct EFI memory type used for U-Boot code
* unit test for FatToStr() truncation
* add an EFI binary to print boot hart ID

Other:

* improve parameter checks in console functions
* fix variable initialization in blk_get_device_part_str

23 months agodoc: eficonfig: add description for UEFI Secure Boot Configuration
Masahisa Kojima [Fri, 2 Dec 2022 04:59:37 +0000 (13:59 +0900)]
doc: eficonfig: add description for UEFI Secure Boot Configuration

This commits adds the description for the UEFI Secure Boot
Configuration through the eficonfig menu.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Redacted the complete document.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
23 months agoeficonfig: use efi_get_next_variable_name_int()
Masahisa Kojima [Fri, 2 Dec 2022 04:59:36 +0000 (13:59 +0900)]
eficonfig: use efi_get_next_variable_name_int()

eficonfig command reads all possible UEFI load options
from 0x0000 to 0xFFFF to construct the menu. This takes too much
time in some environment.
This commit uses efi_get_next_variable_name_int() to read all
existing UEFI load options to significantlly reduce the count of
efi_get_var() call.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
23 months agoefi_loader: utility function to check the variable name is "Boot####"
Masahisa Kojima [Fri, 2 Dec 2022 04:59:35 +0000 (13:59 +0900)]
efi_loader: utility function to check the variable name is "Boot####"

Some commands need to enumerate the existing UEFI load
option variable("Boot####"). This commit transfers some code
from cmd/efidebug.c to lib/efi_loder/, then exposes
efi_varname_is_load_option() function to check whether
the UEFI variable name is "Boot####".

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
23 months agoeficonfig: use u16_strsize() to get u16 string buffer size
Masahisa Kojima [Fri, 2 Dec 2022 04:59:34 +0000 (13:59 +0900)]
eficonfig: use u16_strsize() to get u16 string buffer size

Use u16_strsize() to simplify the u16 string buffer
size calculation.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
23 months agoeficonfig: fix going one directory up issue
Masahisa Kojima [Fri, 2 Dec 2022 04:59:33 +0000 (13:59 +0900)]
eficonfig: fix going one directory up issue

The directory name in eficonfig menu entry contains the
'\' separator. strcmp() argument ".." is wrong and one directory
up handling does not work correctly. strcmp() argument must
include '\' separator.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
23 months agodoc: board: typo GIUD Microchip MPFS Icicle Kit doc
Heinrich Schuchardt [Wed, 30 Nov 2022 16:58:56 +0000 (17:58 +0100)]
doc: board: typo GIUD Microchip MPFS Icicle Kit doc

%s/GIUD/GUID/

Fixes: 9e550e18305f ("doc: board: Add Microchip MPFS Icicle Kit doc")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Bin Meng <bmeng@tinylab.org>