platform/kernel/u-boot.git
2 years agoConvert CONFIG_UDP_CHECKSUM to Kconfig
Simon Glass [Sat, 18 Dec 2021 18:27:49 +0000 (11:27 -0700)]
Convert CONFIG_UDP_CHECKSUM to Kconfig

This converts the following to Kconfig:
   CONFIG_UDP_CHECKSUM

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoConvert CONFIG_KEEP_SERVERADDR to Kconfig
Simon Glass [Sat, 18 Dec 2021 18:27:48 +0000 (11:27 -0700)]
Convert CONFIG_KEEP_SERVERADDR to Kconfig

This converts the following to Kconfig:
   CONFIG_KEEP_SERVERADDR

Drop the preprocessor usage also.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Thu, 20 Jan 2022 17:40:20 +0000 (12:40 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- fdt_support: Add fdt_for_each_node_by_compatible() helper macro
  (Marek)
- turris_omnia: Fixup SATA or PCIe nodes at runtime in DT blob (Pali)
- pci_mvebu: Add support for Kirkwood PCIe controllers (Pali)
- SPL: More verifications for kwbimage in SPL (Pali)
- mvebu: Remove comphy_update_map() (Pali)
- Minor misc stuff

2 years agoMerge tag 'u-boot-amlogic-20220120' of https://source.denx.de/u-boot/custodians/u...
Tom Rini [Thu, 20 Jan 2022 14:40:04 +0000 (09:40 -0500)]
Merge tag 'u-boot-amlogic-20220120' of https://source.denx.de/u-boot/custodians/u-boot-amlogic

- Disable CONFIG_NET_RANDOM_ETHADDR for android configs
- meson64_android: define raw parts for bootloader to permit flashing with fastboot
- vim3: configure serial# from ethaddr to permit using fastboot like sei510/610

2 years agoMerge tag 'doc-2022-04-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Thu, 20 Jan 2022 14:39:45 +0000 (09:39 -0500)]
Merge tag 'doc-2022-04-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request doc-2022-04-rc1

Replace @return by Return: in code comments.

2 years agoarm: a37xx: Disable CONFIG_DEBUG_UART_ANNOUNCE
Pali Rohár [Tue, 18 Jan 2022 09:43:23 +0000 (10:43 +0100)]
arm: a37xx: Disable CONFIG_DEBUG_UART_ANNOUNCE

After next branch was merged to v2022.01 release, U-Boot on A3720 started
printing "<debug_uart>" line on UART during booting. There is no need to
print this debug line by default, so disable it via config option
CONFIG_DEBUG_UART_ANNOUNCE in all config files for Armada 3720 boards.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agophy: marvell: Remove unused function comphy_update_map()
Pali Rohár [Tue, 18 Jan 2022 09:33:20 +0000 (10:33 +0100)]
phy: marvell: Remove unused function comphy_update_map()

This weak function is not used anymore, so completely remove it.

Private struct comphy_map is not used by any board code anymore, so move it
into private driver header file comphy_core.h.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: turris_mox: Convert comphy_update_map() to board_fix_fdt()
Pali Rohár [Tue, 18 Jan 2022 09:33:19 +0000 (10:33 +0100)]
arm: mvebu: turris_mox: Convert comphy_update_map() to board_fix_fdt()

Code in board_fix_fdt() already detects connected MOX modules so there is
no need to have custom comphy_update_map() function for setting serdes
speeds.

This change sets phy-mode for MOX SFP module (when present) to sgmii.
Comphy driver then sets sgmii serdes speed for this module to 1.25G.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agodrivers: octeon: get rid of Unicode in code
Heinrich Schuchardt [Sun, 16 Jan 2022 22:11:58 +0000 (23:11 +0100)]
drivers: octeon: get rid of Unicode in code

Placing Unicode control codes <U+0080><U+0093> in the middle of a comment
does not make much sense. Let's get rid of all Unicode in
drivers/ram/octeon/octeon3_lmc.c.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: spl: Fix 100 column exceeds
Marek Behún [Fri, 14 Jan 2022 13:31:45 +0000 (14:31 +0100)]
arm: mvebu: spl: Fix 100 column exceeds

Fix 100 column exceeds in arch/arm/mach-mvebu/spl.c.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: spl: Use IS_ENABLED() instead of #ifdef where possible
Marek Behún [Fri, 14 Jan 2022 13:31:44 +0000 (14:31 +0100)]
arm: mvebu: spl: Use IS_ENABLED() instead of #ifdef where possible

Use the preferred
  if (IS_ENABLED(X))
instead of
  #ifdef X
where possible.

There are still places where this is not possible or is more complicated
to convert in this file. Leave those be for now.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: spl: Use preferred types u8/u16/u32 instead of uintN_t
Marek Behún [Fri, 14 Jan 2022 13:31:43 +0000 (14:31 +0100)]
arm: mvebu: spl: Use preferred types u8/u16/u32 instead of uintN_t

Checkpatch warns about using uint32/16/8_t instead of u32/16/8.

Use the preferred types.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: spl: Print srcaddr in error message
Marek Behún [Fri, 14 Jan 2022 13:31:42 +0000 (14:31 +0100)]
arm: mvebu: spl: Print srcaddr in error message

Print the wrong srcaddr (spl_image->offset) in error message also for
SATA case.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: Check for kwbimage data checksum
Pali Rohár [Fri, 14 Jan 2022 13:31:41 +0000 (14:31 +0100)]
arm: mvebu: Check for kwbimage data checksum

Last 4 bytes of kwbimage boot image is checksum. Verify it via the new
spl_check_board_image() function which is called by U-Boot SPL after
loading kwbimage.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoSPL: Add support for checking board / BootROM specific image types
Pali Rohár [Fri, 14 Jan 2022 13:31:40 +0000 (14:31 +0100)]
SPL: Add support for checking board / BootROM specific image types

Commit 9baab60b8054 ("SPL: Add support for parsing board / BootROM specific
image types") added support for loading board specific image types.

This commit adds support for a new weak function spl_parse_board_header()
which is called after loading boot image. Board may implement this function
for checking if loaded board specific image is valid.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: Check that kwbimage blockid matches boot mode
Pali Rohár [Fri, 14 Jan 2022 13:31:39 +0000 (14:31 +0100)]
arm: mvebu: Check that kwbimage blockid matches boot mode

Each boot mode has its own kwbimage specified by blockid. So check that
kwbimage is valid by blockid.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoSPL: Add struct spl_boot_device parameter into spl_parse_board_header()
Pali Rohár [Fri, 14 Jan 2022 13:31:38 +0000 (14:31 +0100)]
SPL: Add struct spl_boot_device parameter into spl_parse_board_header()

Add parameter spl_boot_device to spl_parse_board_header(), which allows
the implementations to see from which device we are booting and do
boot-device-specific checks of the image header.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: Check that kwbimage offset and blocksize are valid
Pali Rohár [Fri, 14 Jan 2022 13:31:37 +0000 (14:31 +0100)]
arm: mvebu: Check that kwbimage offset and blocksize are valid

There are certain restrictions for kwbimage offset and blocksize.
Validate them.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agopci: pci_mvebu: Add support for Kirkwood PCIe controllers
Pali Rohár [Thu, 13 Jan 2022 13:28:04 +0000 (14:28 +0100)]
pci: pci_mvebu: Add support for Kirkwood PCIe controllers

Kirkwood uses macros KW_DEFADR_PCI_MEM and KW_DEFADR_PCI_IO for base
address of PCIe mappings. Size of PCIe windows is not defined in any macro
yet, so export them in new KW_DEFADR_PCI_MEM_SIZE and KW_DEFADR_PCI_IO_SIZE
macros.

Kirkwood arch code already maps mbus windows for io and mem, so avoid
calling mvebu_mbus_add_window_by_id() function which would try to do
duplicate window mapping.

Kirkwood PCIe controllers already use "marvell,kirkwood-pcie" DT compatible
string, so mark pci_mvebu.c driver as compatible for it.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: turris_omnia: Fixup SATA or PCIe nodes at runtime in DT blob
Pali Rohár [Mon, 10 Jan 2022 10:47:18 +0000 (11:47 +0100)]
arm: mvebu: turris_omnia: Fixup SATA or PCIe nodes at runtime in DT blob

On of the MiniPCIe ports on Turris Omnia is also a mSATA port. Whether
it works in SATA or PCIe mode is determined by a strapping pin, which
value is read from the MCU.

We already determine which type of card is connected when configuring
SerDeses.

But until now we left both SATA and PCIe port 0 nodes in device tree
enabled, and so the SATA driver is probed in U-Boot / Linux even if we
know there is no mSATA card, and similarly PCIe driver tries to link on
port 0 even if we know there is mSATA card, not a PCIe card.

Fixup device tree blob to disable SATA node if mSATA card is not
present, and to disable PCIe port 0 node if mSATA card is present.

Do this for U-Boot's DT blob before relocation and also for kernel DT
blob before booting.

This ensures that software does not try to use SATA or PCIe HW when
corresponding PHY is not configured.

Signed-off-by: Pali Rohár <pali@kernel.org>
[ refactored and fixed some issues ]
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agofdt_support: Add fdt_for_each_node_by_compatible() helper macro
Marek Behún [Thu, 20 Jan 2022 00:04:42 +0000 (01:04 +0100)]
fdt_support: Add fdt_for_each_node_by_compatible() helper macro

Add macro fdt_for_each_node_by_compatible() to allow iterating over
fdt nodes by compatible string.

Convert various usages of
    off = fdt_node_offset_by_compatible(fdt, start, compat);
    while (off > 0) {
        code();
        off = fdt_node_offset_by_compatible(fdt, off, compat);
    }
and similar, to
    fdt_for_each_node_by_compatible(off, fdt, start, compat)
        code();

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoboard: amlogic: vim3: configure serial# from ethaddr
Mattijs Korpershoek [Wed, 19 Jan 2022 14:24:00 +0000 (15:24 +0100)]
board: amlogic: vim3: configure serial# from ethaddr

The Khadas VIM3 and VIM3L boards, which are supported in Android via
Yukawa [1] need a serial number for usb/fastboot enumeration.

Whenever the environment does not provide a serial#, use the eth mac
address as serial#.

[1] https://source.android.com/setup/build/devices#vim3_and_vim3l_boards

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://lore.kernel.org/r/20220119142400.127342-1-mkorpershoek@baylibre.com
2 years agoconfigs: meson64_android: define raw parts for bootloader
Mattijs Korpershoek [Fri, 7 Jan 2022 16:39:13 +0000 (17:39 +0100)]
configs: meson64_android: define raw parts for bootloader

Per the android documentation[1]:
- the mmc2boot0 partition should be labeled "bootloader".
- the mmc2boot1 partition should be labeled "bootenv".

Also the u-boot documentation[2] refers to a BOOT1_OFFSET of 1 block.

Define 2 raw partitions to store the bootloaders and the bootenv.

[1] https://source.android.com/setup/build/devices#vim3-fastboot
[2] https://u-boot.readthedocs.io/en/latest/board/amlogic/khadas-vim3l.html

Suggested-by: Gary Bisson <gary.bisson@boundarydevices.com>
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Link: https://lore.kernel.org/r/20220107163913.3393563-1-mkorpershoek@baylibre.com
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2 years agoconfigs: amlogic: Disable CONFIG_NET_RANDOM_ETHADDR for android
Mattijs Korpershoek [Wed, 12 Jan 2022 08:40:23 +0000 (09:40 +0100)]
configs: amlogic: Disable CONFIG_NET_RANDOM_ETHADDR for android

The Khadas vim3 and vim3l defconfigs introduced with:
f89b90d2d9 ("configs: add khadas-vim3{l}_android for AOSP support")
425f06f86e ("configs: prepare khadas-vim3{l}_ab_android for AOSP support")

were based on an outdated defconfig prior to the ede1f4f297 ("configs:
amlogic: Disable CONFIG_NET_RANDOM_ETHADDR when unnecessary") cleanup.

Disable CONFIG_NET_RANDOM_ETHADDR for the android configs as well to
stay consistent.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Link: https://lore.kernel.org/r/20220112084023.2858375-1-mkorpershoek@baylibre.com
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2 years agodoc: replace @return by Return:
Heinrich Schuchardt [Wed, 19 Jan 2022 17:05:50 +0000 (18:05 +0100)]
doc: replace @return by Return:

Sphinx expects Return: and not @return to indicate a return value.

find . -name '*.c' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

find . -name '*.h' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoMerge tag 'xilinx-for-v2022.04-rc1' of https://source.denx.de/u-boot/custodians/u...
Tom Rini [Wed, 19 Jan 2022 16:43:44 +0000 (11:43 -0500)]
Merge tag 'xilinx-for-v2022.04-rc1' of https://source.denx.de/u-boot/custodians/u-boot-microblaze

Xilinx changes for v2022.04-rc1

gpio:
- Add modepin driver

net:
- Save random mac addresses to eth variable

zynqmp gem:
- Add support for mdio bus DT description
- Add support for reset and SGMII phy configuration
- Reduce timeout for MDIO accesses

zynqmp clk:
- Fix clock handling for gem and usb

phy:
- Add zynqmp phy/serdes driver

serial:
- Add one missing compatible string

microblaze:
- Symbol alignement
- SPL fixups
- Code cleanups

zynqmp:
- Various dt changes, DP pre-reloc, gem resets, gem clocks
- Switch SOM to shared psu configuration
- Move dcache handling to firmware driver
- Workaround gmii2rgmii DT description issue
- Enable broadcasts again
- Change firmware enablement logic
- Small adjustement in firmware driver

versal:
- Support new mmc@ DT nodes
- Fix run time variable handling
- Add missing I2C_PMC ID for power domain

2 years agodoc: samsung: axy17lte: Fix underlines
Tom Rini [Wed, 19 Jan 2022 16:06:07 +0000 (11:06 -0500)]
doc: samsung: axy17lte: Fix underlines

A few sections had underlines that were too short, correct.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agofirmware: zynqmp: Do not report error if node is already configured
Michal Simek [Fri, 14 Jan 2022 12:25:37 +0000 (13:25 +0100)]
firmware: zynqmp: Do not report error if node is already configured

Power domain driver sends PM fragment to PMUFW. It is sent for every node
which is listed in DT. But some nodes could be already enabled but driver
is not capable to find it out. That's why it blinly sents request for every
listed IP. When PMUFW response by XST_PM_ALREADY_CONFIGURED error code
there is no need to show any error message because node is already enabled.
That's why cover this case with message when DEBUG is enabled.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/8c15ef0b68cf191f693d3d010f70ac24cfd8171f.1642163135.git.michal.simek@xilinx.com
2 years agofirmware: zynqmp: Move loading message to debug
Michal Simek [Fri, 14 Jan 2022 12:25:36 +0000 (13:25 +0100)]
firmware: zynqmp: Move loading message to debug

Power domain driver is using this function for every IP which is PD listed.
This can end up with a lot of messages which end up in boot log. That's why
show it only in EL3 as was used in past.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/d73fc8bc663110b6e8d5e70fdb6435d1199e9db8.1642163135.git.michal.simek@xilinx.com
2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-samsung
Tom Rini [Wed, 19 Jan 2022 13:09:34 +0000 (08:09 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-samsung

- Updates for a{3,7}y17lte platforms

2 years agoarm64: zynqmp: Change firmware dependency
Michal Simek [Fri, 14 Jan 2022 12:08:42 +0000 (13:08 +0100)]
arm64: zynqmp: Change firmware dependency

In case of mini U-Boot configurations there is no need to enable firmware
driver which just consume space for nothing. That's why add an option to
disable it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/d439399160ff3374f2b39f54f7dd70fa8c8bfea0.1642162121.git.michal.simek@xilinx.com
2 years agoarm64: xilinx: dts: Add dma properties to fix dtbs_check warnings
Shravya Kumbham [Fri, 14 Jan 2022 11:44:06 +0000 (12:44 +0100)]
arm64: xilinx: dts: Add dma properties to fix dtbs_check warnings

Update dma name and add #dma-cells properties to fix dtbs_check
warnings.

Signed-off-by: Shravya Kumbham <shravya.kumbham@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/fedbf83fd5c682b4d61905d2cb790d33c2f079d6.1642160644.git.michal.simek@xilinx.com
2 years agoarm64: zynqmp: Update USB node handle from dwc3 to usb
Manish Narani [Fri, 14 Jan 2022 11:43:35 +0000 (12:43 +0100)]
arm64: zynqmp: Update USB node handle from dwc3 to usb

The DWC3 bindings require all USB node handles to be '^usb@[0-9a-f]+$'.
Update the same in ZynqMP device tree.

Signed-off-by: Manish Narani <manish.narani@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/26fc2777eeb92cb5cb1d558d7c19cfb54ac42d0c.1642160613.git.michal.simek@xilinx.com
2 years agoarm64: zynqmp: Change compatible strings for cadence uart
Michal Simek [Fri, 14 Jan 2022 11:43:05 +0000 (12:43 +0100)]
arm64: zynqmp: Change compatible strings for cadence uart

Based on Linux kernel DT binding there should be different compatible
strings used that's why align zynqmp.dtsi with it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/e2404ccd22fd97fe6020be0b3b6eb3c8677f55b0.1642160583.git.michal.simek@xilinx.com
2 years agoMerge branch '2022-01-18-platform-updates'
Tom Rini [Tue, 18 Jan 2022 21:07:33 +0000 (16:07 -0500)]
Merge branch '2022-01-18-platform-updates'

- cubieboard7 MMC support, AST2600 MAC support

2 years agomiiphy.h: Remove CONFIG_DM_xxx guards
Tom Rini [Tue, 18 Jan 2022 18:38:00 +0000 (13:38 -0500)]
miiphy.h: Remove CONFIG_DM_xxx guards

Function prototypes must not be guarded with ifdef tests.  Doing so
prevents us from doing:
if (CONFIG_IS_ENABLED(FOO))
  func();

as that results in a warning when CONFIG_FOO is not enabled.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoclk: ast2600: Revise MII interface delay
Dylan Hung [Thu, 9 Dec 2021 02:12:28 +0000 (10:12 +0800)]
clk: ast2600: Revise MII interface delay

The clock delay of the RMII/RGMII interface is controlled by SCU340~35C.
These values are obtained by measurement and experiments so we simply
use macro to define them.

Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agoconfigs: ast2600: enable DM_MDIO and MDIO driver
Dylan Hung [Thu, 9 Dec 2021 02:12:27 +0000 (10:12 +0800)]
configs: ast2600: enable DM_MDIO and MDIO driver

Enable DM_MDIO and Aspeed MDIO driver for AST2600 EVB.

Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agoARM: dts: ast2600: Add MDIO devices
Dylan Hung [Thu, 9 Dec 2021 02:12:26 +0000 (10:12 +0800)]
ARM: dts: ast2600: Add MDIO devices

There are 4 MDIO bus controllers in AST2600 SOC.  Each of them can
connect to one or more PHY chips and is flexible to work with the 4 MAC
devices in AST2600.  On AST2600 EVB, MDIO 0,1,2,3 connect to the PHY
chips used by MAC 0,1,2,3 respectively.

Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agonet: ftgmac100: Add Aspeed AST2600 support
Dylan Hung [Thu, 9 Dec 2021 02:12:25 +0000 (10:12 +0800)]
net: ftgmac100: Add Aspeed AST2600 support

Add support of the MAC controller of Aspeed AST2600 SOC.  The MAC
controller is the same with AST2500, except it has stand-alone MDIO
hardware block.

Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agonet: ftgmac100: Add DM_MDIO support
Dylan Hung [Thu, 9 Dec 2021 02:12:24 +0000 (10:12 +0800)]
net: ftgmac100: Add DM_MDIO support

Add support for DM_MDIO to connect to PHY.  For the systems that have a
stand-alone MDIO hardware block, enable CONFIG_DM_MDIO to use driver
model for MDIO devices.

Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agoconfigs: Enable mmc support
Amit Singh Tomar [Sun, 28 Nov 2021 11:32:25 +0000 (17:02 +0530)]
configs: Enable mmc support

This commits enables mmc on the Actions Cubieboard7 board.

Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
2 years agommc: actions: add MMC driver for Actions OWL S700/S900
Amit Singh Tomar [Sun, 28 Nov 2021 11:32:24 +0000 (17:02 +0530)]
mmc: actions: add MMC driver for Actions OWL S700/S900

This commit adds support for MMC controllers found on Actions OWL
SoC platform(S700/S900).

Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
2 years agoARM: dts: s700: add MMC/SD controller node
Amit Singh Tomar [Sun, 28 Nov 2021 11:32:23 +0000 (17:02 +0530)]
ARM: dts: s700: add MMC/SD controller node

This patch adds node for mmc/sd controller found on Action Semi OWL
S700 SoC.

Since, upstream Linux binding has not been merged for S700 MMC/SD
controller, Changes are put in u-boot specific dtsi file.

Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
2 years agoARM: dts: sync Actions Semi S700 DT from Linux v5.16-rc3
Amit Singh Tomar [Thu, 2 Dec 2021 18:23:28 +0000 (23:53 +0530)]
ARM: dts: sync Actions Semi S700 DT from Linux v5.16-rc3

This Synchronizes the Actions Semi S700 SoC DT changes from
commit "g58e1100fdc59" ("Linux v5.16-rc3").

Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
2 years agoclk: actions: Add SD/MMC clocks
Amit Singh Tomar [Sun, 28 Nov 2021 11:32:21 +0000 (17:02 +0530)]
clk: actions: Add SD/MMC clocks

This commit adds SD/MMC clocks, and provides .set/get_rate callbacks
for SD/MMC device present on Actions OWL S700 SoCs.

Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
2 years agoclk: actions: Introduce dummy get/set_rate callbacks
Amit Singh Tomar [Sun, 28 Nov 2021 11:32:20 +0000 (17:02 +0530)]
clk: actions: Introduce dummy get/set_rate callbacks

This commit introduces get/set_rate callbacks, these are dummy at
the moment, and can be used to get/set clock for various devices
based on the clk id.

Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
2 years agoMerge branch '2022-01-17-assorted-updates'
Tom Rini [Tue, 18 Jan 2022 17:31:42 +0000 (12:31 -0500)]
Merge branch '2022-01-17-assorted-updates'

- musb gadget pinctrl-single, pxa3xx nand bugfixes
- btrfs BLAKE2 hash support and another btrfs fix
- board_r cleanups

2 years agopinctrl: single: add support for pinctrl-single, pins when #pinctrl-cells = 2
AJ Bagwell [Fri, 3 Dec 2021 15:18:53 +0000 (15:18 +0000)]
pinctrl: single: add support for pinctrl-single, pins when #pinctrl-cells = 2

Changes to the am33xx device (33e9021a) trees have been merged in from
the upstream linux kernel which now means the device tree uses the new
pins format (as of 5.10) where the confinguration can be stores as a
separate configuration value and pin mux mode which are then OR'd
together.

This patch adds support for the new format to u-boot so that
pinctrl-cells is now respected when reading in pinctrl-single,pins
Signed-off-by: Anthony Bagwell <anthony.bagwell@hivehome.com>
2 years agofs/btrfs: fix a bug that U-boot fs btrfs implementation doesn't handle NO_HOLE featur...
Qu Wenruo [Mon, 27 Dec 2021 06:11:14 +0000 (14:11 +0800)]
fs/btrfs: fix a bug that U-boot fs btrfs implementation doesn't handle NO_HOLE feature correctly

[BUG]
When passing a btrfs with NO_HOLE feature to U-boot, and if one file
contains holes, then the hash of the file is not correct in U-boot:

 # mkfs.btrfs -f test.img # Since v5.15, mkfs defaults to NO_HOLES
 # mount test.img /mnt/btrfs
 # xfs_io -f -c "pwrite 0 4k" -c "pwrite 8k 4k" /mnt/btrfs/file
 # md5sum /mnt/btrfs/file
 277f3840b275c74d01e979ea9d75ac19  /mnt/btrfs/file
 # umount /mnt/btrfs
 # ./u-boot
 => host bind 0 /home/adam/test.img
 => ls host 0
 <   >      12288  Mon Dec 27 05:35:23 2021  file
 => load host 0 0x1000000 file
 12288 bytes read in 0 ms
 => md5sum 0x1000000 0x3000
 md5 for 01000000 ... 01002fff ==> 855ffdbe4d0ccc5acab92e1b5330e4c1

The md5sum doesn't match at all.

[CAUSE]
In U-boot btrfs implementation, the function btrfs_read_file() has the
following iteration for file extent iteration:

/* Read the aligned part */
while (cur < aligned_end) {
ret = lookup_data_extent(root, &path, ino, cur, &next_offset);
if (ret < 0)
goto out;
if (ret > 0) {
/* No next, direct exit */
if (!next_offset) {
ret = 0;
goto out;
}
}
/* Read file extent */

But for NO_HOLES features, hole extents will not have any extent item
for it.
Thus if @cur is at a hole, lookup_data_extent() will just return >0, and
update @next_offset.

But we still believe there is some data to read for @cur for ret > 0
case, causing we read extent data from the next file extent.

This means, what we do for above NO_HOLES btrfs is:
- Read 4K data from disk to file offset [0, 4K)
  So far the data is still correct

- Read 4K data from disk to file offset [4K, 8K)
  We didn't skip the 4K hole, but read the data at file offset [8K, 12K)
  into file offset [4K, 8K).

  This causes the checksum mismatch.

[FIX]
Add extra check to skip to the next non-hole range after
lookup_data_extent().

Signed-off-by: Qu Wenruo <wqu@suse.com>
2 years agofs/btrfs: add dependency on BLAKE2 hash
Qu Wenruo [Mon, 27 Dec 2021 06:12:08 +0000 (14:12 +0800)]
fs/btrfs: add dependency on BLAKE2 hash

Now btrfs can utilize the newly intorudced BLAKE2 hash.

Signed-off-by: Qu Wenruo <wqu@suse.com>
2 years agolib: add BLAKE2 hash support
Qu Wenruo [Mon, 27 Dec 2021 06:12:07 +0000 (14:12 +0800)]
lib: add BLAKE2 hash support

The code is cross-ported from BLAKE2 reference implementation
(https://github.com/BLAKE2/BLAKE2).

With minimal change to remove unused macros/features.

Currently there is only one user inside U-boot (btrfs), and since it
only utilize BLAKE2B, all other favors are all removed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
[trini: Rename ROUND to R to avoid clash with <linux/bitops.h>
Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agocommon: board_r: drop ifdefs around header includes
Ovidiu Panait [Sat, 1 Jan 2022 17:13:31 +0000 (19:13 +0200)]
common: board_r: drop ifdefs around header includes

Drop the remaining ifdefs around header includes, to fix an old TODO.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
2 years agocommon: board_r: include asm-generic/gpio.h
Ovidiu Panait [Sat, 1 Jan 2022 17:13:30 +0000 (19:13 +0200)]
common: board_r: include asm-generic/gpio.h

Not all architectures define <asm/gpio.h> and even on those that do, the
header cannot be included for all boards without causing various build
failures.

Since common/board_r.c only needs gpio_hog_probe_all() declaration, include
<asm-generic/gpio.h> and drop the associated ifdef.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
2 years agocommon: board_r: move init_addr_map() to init.h
Ovidiu Panait [Sat, 1 Jan 2022 17:13:29 +0000 (19:13 +0200)]
common: board_r: move init_addr_map() to init.h

asm/mmu.h include is currently guarded by CONFIG_ADDR_MAP ifdef because
the header is only present on arm and powerpc. In order to remove the
dependency on this header and the associated ifdef, move init_addr_map()
declaration to init.h, since it is only called during the common init
sequence.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
2 years agocommon: board_r: drop initr_addr_map wrapper
Ovidiu Panait [Sat, 1 Jan 2022 17:13:28 +0000 (19:13 +0200)]
common: board_r: drop initr_addr_map wrapper

Add a return value to init_addr_map and use it directly in the
post-relocation init sequence, rather than using a wrapper stub.

Reviewed-by: Matthias Brugger <mbrugger@suse.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
2 years agocommon: board_r: drop initr_kgdb wrapper
Ovidiu Panait [Sat, 1 Jan 2022 17:13:27 +0000 (19:13 +0200)]
common: board_r: drop initr_kgdb wrapper

Add a return value to kgdb_init and use it directly in the post-relocation
init sequence, rather than using a wrapper stub. Also, move the "KGDB"
print message inside kgdb_init().

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
2 years agocommon: remove bedbug debugger support
Ovidiu Panait [Sat, 1 Jan 2022 17:13:26 +0000 (19:13 +0200)]
common: remove bedbug debugger support

Commit 98f705c9cefd ("powerpc: remove 4xx support") removed (in 2017) the
last code that made use of bedbug debugger support. Since there aren't
any boards left that define either CONFIG_CMD_BEDBUG or a real
bedbug_init(), drop this feature from u-boot.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agocommon: spl: move armv7m-specific code to spl_perform_fixups()
Ovidiu Panait [Sat, 1 Jan 2022 17:13:25 +0000 (19:13 +0200)]
common: spl: move armv7m-specific code to spl_perform_fixups()

Factor out armv7m fragment to spl_perform_fixups(), which is an arch/board
specific function designed for this purpose.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
2 years agodrivers: musb_gadget: Save endpoint desc to usb_ep->desc
qianfan Zhao [Tue, 16 Nov 2021 00:30:12 +0000 (08:30 +0800)]
drivers: musb_gadget: Save endpoint desc to usb_ep->desc

Fix fastboot flash bug.

If the downloading file size is equal to the partition size, "fastboot
flash" can't work, at least in sunxi platform, because used an
uninitalized point: ep->desc.

This patch also fixed 'data abort' bug in am335x platform.

Reproduce: fastboot flash loader1 spl/sunxi-spl.bin.

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
2 years agomtd: nand: pxa3xx: set mtd->dev
Robert Marko [Wed, 5 Jan 2022 15:01:00 +0000 (16:01 +0100)]
mtd: nand: pxa3xx: set mtd->dev

Currently the pxa3xx driver does not set the udevice in the mtd_info
struct and this prevents the mtd from parsing the partitions via DTS
like for SPI-NOR.

So simply set the mtd->dev to the driver udevice.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoMerge branch '2022-01-15-TI-platform-updates'
Tom Rini [Mon, 17 Jan 2022 16:24:43 +0000 (11:24 -0500)]
Merge branch '2022-01-15-TI-platform-updates'

- Let am335x_evm use the CPSW or PRUSS ethernet.
- Implement timer_get_boot_us in the omap timer driver
- gpmc bitflip, QSPI clock calculation on am437x, da8xx_gpio bugfixes
- Assorted K3 updates

2 years agoMerge tag 'u-boot-at91-2022.04-b' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Mon, 17 Jan 2022 13:36:12 +0000 (08:36 -0500)]
Merge tag 'u-boot-at91-2022.04-b' of https://source.denx.de/u-boot/custodians/u-boot-at91

Second set of u-boot-at91 features for the 2022.04 cycle:

This small feature set includes few changes for sama7g5 and sama7g5ek:
turn blue led on at boot, changes required for the Rev4 of the board,
better sync with the Linux DT with regards to the new DT nodes.

2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-pmic
Tom Rini [Mon, 17 Jan 2022 13:35:39 +0000 (08:35 -0500)]
Merge https://source.denx.de/u-boot/custodians/u-boot-pmic

- Apple M1 PMIC support

2 years agoMerge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-net
Tom Rini [Mon, 17 Jan 2022 13:35:11 +0000 (08:35 -0500)]
Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-net

- PXE label override support
- Fastboot UDP configurable port
- new phy driver: TI DP83869HM
- and few minor fixes to dsa.

2 years agoconfigs: at91: sama7g5ek: enable CONFIG_PHANDLE_CHECK_SEQ
Eugen Hristev [Tue, 4 Jan 2022 16:25:21 +0000 (18:25 +0200)]
configs: at91: sama7g5ek: enable CONFIG_PHANDLE_CHECK_SEQ

CONFIG_PHANDLE_CHECK_SEQ will allow different sequence number for nodes
that have the same name, but they are different.
In sama7g5ek case, there are multiple 'i2c@600' nodes which are child
nodes of different parent 'flexcom' nodes.
These are different i2c busses even if the node is the same, and have to be
differentiated.
Without this config, the sequence number 0 is reused for two i2c busses, and
this is something that we have to avoid:

Looking for 'i2c' at 4704, name i2c@600
   - serial0, /ahb/apb/serial@e1824200
   - i2c0, /ahb/apb/flexcom@e181c000/i2c@600
Found seq 0
i2c_post_bind: i2c@600, seq=0
Looking for 'i2c' at 6236, name i2c@600
   - serial0, /ahb/apb/serial@e1824200
   - i2c0, /ahb/apb/flexcom@e181c000/i2c@600
Found seq 0
i2c_post_bind: i2c@600, seq=0

After this patch:

Looking for 'i2c' at 4704, name i2c@600
   - serial0, /ahb/apb/serial@e1824200
   - i2c0, /ahb/apb/flexcom@e181c000/i2c@600
   - i2c1, /ahb/apb/flexcom@e2818000/i2c@600
Found seq 1

Before the patch:
=> i2c bus
Bus 0:  i2c@600
Bus 0:  i2c@600  (active 0)
   52: eeprom@52, offset len 1, flags 0
   53: eeprom@53, offset len 1, flags 0
=>

After the patch:
=> i2c bus
Bus 0:  i2c@600
Bus 1:  i2c@600  (active 1)
   52: eeprom@52, offset len 1, flags 0
   53: eeprom@53, offset len 1, flags 0

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
2 years agoARM: dts: at91: sama7g5ek: move eeproms to flexcom8
Eugen Hristev [Tue, 4 Jan 2022 16:23:36 +0000 (18:23 +0200)]
ARM: dts: at91: sama7g5ek: move eeproms to flexcom8

The rev4 of the board sama7g5ek has the eeproms on flexcom8 instead of
flexcom1.
Initialize flexcom8 with required pincontrol and move the eeproms accordingly.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
2 years agoARM: dts: at91: sama7g5: add flx8 and required nodes
Eugen Hristev [Tue, 4 Jan 2022 16:21:54 +0000 (18:21 +0200)]
ARM: dts: at91: sama7g5: add flx8 and required nodes

Add Flexcom8 node with required referenced nodes as phandles.
Since Flexcom8 is present in Linux, take the node exactly as-is from Linux.
Some nodes are referenced in Linux as phandles, the dma and the gic.
Add them as well to the file, even if they are unused by Uboot.
This is a step towards having the U-boot DT equivalent with the DT in Linux.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
2 years agonet: gem: Workaround gmii2rgmii bridge DT node issue
Ashok Reddy Soma [Fri, 14 Jan 2022 12:08:07 +0000 (13:08 +0100)]
net: gem: Workaround gmii2rgmii bridge DT node issue

For configurations with gmii2rgmii and external phy the DT nodes link
should be gem->gmii2rgmii->phy. But due to limitation in Linux driver
the DT is mentioned as gem->phy and gmii2rgmii->phy as shown in below DT.

ethernet@ff0c0000 {
compatible = "cdns,zynqmp-gem\0cdns,gem";
status = "okay";
interrupt-parent = <0x04>;
interrupts = <0x00 0x3b 0x04 0x00 0x3b 0x04>;
reg = <0x00 0xff0c0000 0x00 0x1000>;
clock-names = "pclk\0hclk\0tx_clk\0rx_clk\0tsu_clk";
#address-cells = <0x01>;
#size-cells = <0x00>;
#stream-id-cells = <0x01>;
iommus = <0x0d 0x875>;
power-domains = <0x0c 0x1e>;
clocks = <0x03 0x1f 0x03 0x69 0x03 0x2e 0x03 0x32 0x03 0x2c>;
phy-handle = <0x0e>;
phy-mode = "gmii";
xlnx,ptp-enet-clock = <0x00>;
local-mac-address = [ff ff ff ff ff ff];
phandle = <0x4d>;

mdio {
#address-cells = <0x01>;
#size-cells = <0x00>;
phandle = <0x4e>;

ethernet-phy@1 {
reg = <0x01>;
rxc-skew-ps = <0x708>;
txc-skew-ps = <0x708>;
phandle = <0x0e>;
};

gmii_to_rgmii_0@8 {
compatible = "xlnx,gmii-to-rgmii-1.0";
phy-handle = <0x0e>;
reg = <0x08>;
phandle = <0x4f>;
};
};
};

Since same DT is used in Linux and U-Boot we need to workaround this
issue by using the gmii2rgmii node which points to phy and we should
ignore the gem pointing to phy directly.

Do this workaround by updating priv->phydev->node value with
priv->phy_of_node only if it is not valid node.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Link: https://lore.kernel.org/r/641eb13425ffe80e0743f60cf90d0f940577b9e9.1642162085.git.michal.simek@xilinx.com
2 years agoRevert "net: gem: Disable broadcast setting"
Michal Simek [Fri, 14 Jan 2022 12:15:48 +0000 (13:15 +0100)]
Revert "net: gem: Disable broadcast setting"

This reverts commit eafdcda4a854932c0319656de7bf3f017f17ae67.

The main reason is that QEMU is using BOOTP protocol which is sending DHCP
Offer to a broadcast address that's why it can't be disabled.
DHCP protocol has no issue because it returns directly to client MAC
address.
Both of these options are described in RFC951
(https://datatracker.ietf.org/doc/html/rfc951#section-4)

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Link: https://lore.kernel.org/r/fc5f5e2aeca77847ed4ca6a263890375ab9f5163.1642162545.git.michal.simek@xilinx.com
2 years agopower: domain: Add Apple pmgr driver
Mark Kettenis [Mon, 10 Jan 2022 19:58:44 +0000 (20:58 +0100)]
power: domain: Add Apple pmgr driver

This driver supports power domains for the power management
controller found on Apple SoCs.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoarm: dts: apple: Add u-boot,dm-pre-reloc properties
Mark Kettenis [Mon, 10 Jan 2022 19:58:43 +0000 (20:58 +0100)]
arm: dts: apple: Add u-boot,dm-pre-reloc properties

These are necessary to make sure the power domains needed for the
serial console are availble in the pre-relocation phase.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoarm: dts: apple: Update Apple M1 device trees
Mark Kettenis [Mon, 10 Jan 2022 19:58:42 +0000 (20:58 +0100)]
arm: dts: apple: Update Apple M1 device trees

This synchronizes the device trees with those that are in the
process of being upstreamed into Linux. This is mostly the
current state of the device trees on the asahilinux branch
with a few extra bits used by OpenBSD. This includes device
trees for machines that were still missing.

There are still some differences that will hopefully be resolved
soon.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2 years agoboard: ti: am335x: Choose CPSW or PRUSS configuration based on jumper setting
Amjad Ouled-Ameur [Fri, 29 Oct 2021 14:08:17 +0000 (16:08 +0200)]
board: ti: am335x: Choose CPSW or PRUSS configuration based on jumper setting

The am335x-ice-v2 board's Ethernet ports can be configured
in 'MII' or 'RMII' mode to be connected to 'PRUSS' or 'CPSW'
Ethernet subsystems.

This patch sets the environment variable 'ice_mii' to
'mii' or 'rmii' accordingly. Based on that we choose the
appropriate board devicetree i.e. 'am335x-ice-v2.dtb' or
'am335x-ice-v2-prueth.dtb'.

Since there are 2 Ethernet ports with 2 modes, there can be 4
configurations but for now we consider both ports in different modes
to be an invalid configuration and prevent boot in that case.

Signed-off-by: Roger Quadros <rogerq@ti.com>
[Amjad: use overlay instead of using new am335x-ice-v2-prueth.dtb]
Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
[trini: Make prueth_is_mii be marked __maybe_unused]
Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agonand: gpmc: Handle bitflips in erased pages when using BCH ECC engine
David Rivshin [Thu, 18 Nov 2021 18:25:24 +0000 (13:25 -0500)]
nand: gpmc: Handle bitflips in erased pages when using BCH ECC engine

In the case of an erased (sub)page both the data and ECC are all 0xFF
bytes. This fails the normal ECC verification, as the computed ECC of
all-0xFF is not also 0xFF. The GPMC NAND driver attempted to detect
erased pages by checking that the ECC bytes are all-0xFF, but this had
two problems:
1) bitflips in the data were not corrected, so the data looked not-erased
2) bitflips in the ECC bytes were reported as uncorrectable ECC errors

The equivalent Linux driver [1] correctly handles this by counting the
number of 0-bits in the combination of data and ECC bytes. If the number
of 0-bits is less than the amount of bits correctable by the selected
ECC algorithm, then it is treated as an erased page with correctable
bitflips.

Implement similar, though simplified, logic in omap_correct_data_bch().

[1] see omap_elm_correct_data() in omap2.c

Signed-off-by: David Rivshin <drivshin@allworx.com>
2 years agoFix wrong QSPI clock calculation for AM4372
Stefan Mätje [Tue, 30 Nov 2021 00:06:56 +0000 (01:06 +0100)]
Fix wrong QSPI clock calculation for AM4372

On AM4372 the SPI_GCLK input gets its clock from the PRCM module which
divides the PER_CLKOUTM2 frequency (192MHz) by a fixed factor of 4.
See AM437x Reference Manual in section 27 QSPI >> 27.2 Integration.

The QSPI_FCLK therefore needs to take this factor into account and
becomes (192000000 / 4).

Signed-off-by: Stefan Mätje <stefan.maetje@esd.eu>
2 years agoconfigs: am43xx_hs_evm: Add SPL_USB_STORAGE Support
Amjad Ouled-Ameur [Mon, 6 Dec 2021 17:22:00 +0000 (18:22 +0100)]
configs: am43xx_hs_evm: Add SPL_USB_STORAGE Support

Enable CONFIG_SPL_USB_STORAGE to support UBS MSC boot support.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
2 years agoomap: timer: implement timer_get_boot_us
Christian Gmeiner [Thu, 16 Dec 2021 09:57:29 +0000 (10:57 +0100)]
omap: timer: implement timer_get_boot_us

To make the OMAP DM timer driver useful for the timing of
bootstages, we need to implement timer_get_boot_us(..).

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
2 years agogpio: da8xx_gpio: Fix gpio name with address
chao zeng [Fri, 7 Jan 2022 03:26:24 +0000 (11:26 +0800)]
gpio: da8xx_gpio: Fix gpio name with address

The GPIO bank numbers do not appear in the device tree,
so make the gpio name based on the address
(ie gpio@42110000_25 vs 25)

Signed-off-by: chao zeng <chao.zeng@siemens.com>
2 years agoARM: dts: K3-am642-r5-sk: Enable Second CPSW port in R5/A53 SPL
Vignesh Raghavendra [Fri, 24 Dec 2021 07:25:35 +0000 (12:55 +0530)]
ARM: dts: K3-am642-r5-sk: Enable Second CPSW port in R5/A53 SPL

Enable Second Ethernet port on which ROM support Ethboot.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
2 years agonet: fastboot: make UDP port net: configurable
Christian Gmeiner [Thu, 13 Jan 2022 07:40:06 +0000 (08:40 +0100)]
net: fastboot: make UDP port net: configurable

The fastboot protocol uses per default the UDP port 5554. In some cases
it might be needed to change the used port. The fastboot utility provides
a way to specifiy an other port number to use already.

  fastboot -s udp:192.168.1.76:1234 boot fastboot.img

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agonet: fsl: Fix busy flag polling register
Markus Koch [Tue, 11 Jan 2022 18:22:54 +0000 (19:22 +0100)]
net: fsl: Fix busy flag polling register

NXP's mEMAC reference manual, Chapter 6.5.5 "MDIO Ethernet Management
Interface usage", specifies to poll the BSY (0) bit in the CFG/STAT
register to wait until a transaction has finished, not bit 31 in the
data register.

In the Linux kernel, this has already been fixed in commit 26eee0210ad7
("net/fsl: fix a bug in xgmac_mdio").

This patch changes the register in the fman_mdio and fsl_ls_mdio
drivers.

As the MDIO_DATA_BSY define is no longer in use, this patch also removes
its definition from the fsl_memac header.

Signed-off-by: Markus Koch <markus@notsyncing.net>
Reviewed-by: Camelia Groza <camelia.groza@nxp.com>
2 years agonet: eth-phy: Demote missing phy-handle log message to debug
Marek Vasut [Sat, 1 Jan 2022 19:12:23 +0000 (20:12 +0100)]
net: eth-phy: Demote missing phy-handle log message to debug

Reduce the missing phy-handle log message to debug message. It is
possible for ethernet DT node to have no phy-handle e.g. in case
of a fixed-link connection. Furthermore, drop the FEC: prefix,
which is a copy-paste error and rather print the ethernet device
name.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agonet: phy: add TI DP83869HM ethernet driver
Dominic Rath [Wed, 22 Dec 2021 07:57:46 +0000 (08:57 +0100)]
net: phy: add TI DP83869HM ethernet driver

This driver is based on an older downstream TI kernel, with
changes and cleanups to work with mainline device-tree bindings.

Signed-off-by: Dominic Rath <rath@ibv-augsburg.net>
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agonet: dsa: sja1105: fix device id detection
Vladimir Oltean [Sat, 4 Dec 2021 23:00:35 +0000 (01:00 +0200)]
net: dsa: sja1105: fix device id detection

The sja1105_check_device_id() function contains logic to work without
changing the device tree on reworked boards, one of which I have (the
NXP LS1021A-TSN normally has a SJA1105T, but I have a version with a
resoldered SJA1105Q which is pin compatible). This logic is taken from
the Linux driver.

However this logic gets shortcircuited in U-Boot by an earlier check for
the exact device ID specified in the device tree. So the reworked board
does not probe the SJA1105Q switch. Remove this duplicated logic and let
the automatic device ID detection do its job.

Fixes: f24b666b2204 ("net: dsa: add driver for NXP SJA1105 L2 switch")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agonet: dsa: fix phydev->speed being uninitialized for the CPU port fixed PHY
Vladimir Oltean [Sat, 4 Dec 2021 23:00:34 +0000 (01:00 +0200)]
net: dsa: fix phydev->speed being uninitialized for the CPU port fixed PHY

If the DSA API is going to allow drivers to do things such as:

- phy_config in dsa_ops :: port_probe
- phy_startup in dsa_ops :: port_enable

then it would actually be good if the ->port_probe() method would
actually be called in all cases before the ->port_enable() is.

Currently this is true for user ports, but not true for the CPU port,
because the CPU port does not have a udevice registered for it (this is
all part of DSA's design). So the current issue is that after
phy_startup has finished for the CPU port, its phydev->speed is an
uninitialized value, because phy_config() was never called for the
priv->cpu_port_fixed_phy, and it is precisely phy_config() who copies
the speed into the phydev in the case of the fixed PHY driver.

So we need to simulate a probing event for the CPU port by manually
calling the driver's ->port_probe() method for the CPU port.

Fixes: 8a2982574854 ("net: dsa: introduce a .port_probe() method in struct dsa_ops")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agocmd: pxe_utils: sysboot: add label override support
Amjad Ouled-Ameur [Sat, 13 Nov 2021 13:09:20 +0000 (14:09 +0100)]
cmd: pxe_utils: sysboot: add label override support

This will allow consumers to choose a pxe label at runtime instead of
having to prompt the user. One good use-case for this, is choosing
whether or not to apply a dtbo depending on the hardware configuration.
e.g: for TI's AM335x EVM, it would be convenient to apply a particular
dtbo only when the J9 jumper is on PRUSS mode. To achieve this, the
pxe menu should have 2 labels, one with the dtbo and the other without,
then the "pxe_label_override" env variable should point to the label with
the dtbo at runtime only when the jumper is on PRUSS mode.

This change can be used for different use-cases and bring more
flexibilty to consumers who use sysboot/pxe_utils.

if "pxe_label_override" is set but does not exist in the pxe menu,
the code should fallback to the default label if given, and no failure
is returned but rather a warning message.

Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Artem Lapkin <email2tema@gmail.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2 years agomach-k3: am64_spl: Alias Ethernet RGMII boot to CPGMAC
Vignesh Raghavendra [Fri, 24 Dec 2021 07:25:33 +0000 (12:55 +0530)]
mach-k3: am64_spl: Alias Ethernet RGMII boot to CPGMAC

This is required to enables spl_net boot on AM64x

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
2 years agomach-k3: am642_init: Probe AM65 CPSW NUSS for R5/A53 SPL
Vignesh Raghavendra [Fri, 24 Dec 2021 07:25:32 +0000 (12:55 +0530)]
mach-k3: am642_init: Probe AM65 CPSW NUSS for R5/A53 SPL

In order to support Ethernet boot on AM64x, probe AM65 CPSW NUSS.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
2 years agoboard: ti: am64x: Init DRAM size in R5/A53 SPL
Vignesh Raghavendra [Fri, 24 Dec 2021 07:25:31 +0000 (12:55 +0530)]
board: ti: am64x: Init DRAM size in R5/A53 SPL

Call dram_init_banksize() from spl_board_init() otherwise TFTP download
fails due to lmb_get_free_size() not able to find unreserved region due
to lack of DRAM size info. Required to support Ethernet boot on AM64x.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
2 years agonet: ti: am65-cpsw: Add support for multi port independent MAC mode
Vignesh Raghavendra [Fri, 24 Dec 2021 07:25:30 +0000 (12:55 +0530)]
net: ti: am65-cpsw: Add support for multi port independent MAC mode

On certain TI SoC, like AM64x there is a CPSW3G which supports 2
external independent MAC ports for single CPSW instance.
It is not possible for Ethernet driver to register more than one port
for given instance.

This patch modifies top level CPSW NUSS as UCLASS_MISC and binds
UCLASS_ETH to individual ports so as to support bring up more than one
Ethernet interface in U-Boot.

Note that there is no isolation in the since, CPSW NUSS is in promisc
mode and forwards all packets to host.

Since top level driver is now UCLASS_MISC, board files would need to
instantiate this driver explicitly.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
2 years agomach-k3: common: Instantiate AM65 CPSW NUSS wrapper
Vignesh Raghavendra [Fri, 24 Dec 2021 07:25:29 +0000 (12:55 +0530)]
mach-k3: common: Instantiate AM65 CPSW NUSS wrapper

Probe toplevel AM65 CPSW NUSS driver from misc_init_r() when driver
is enabled. Since driver is modeled as UCLASS_MISC, we need to
explicitly probe the driver. Use common misc_init_r() that entire
K3 family of SoCs.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
2 years agodma: ti: k3-udma: Fix rflow reservation for PKTDMA
Vignesh Raghavendra [Thu, 23 Dec 2021 13:57:30 +0000 (19:27 +0530)]
dma: ti: k3-udma: Fix rflow reservation for PKTDMA

Driver has a bug in that it uses rflow_in_use bitmap when setting up free rflow range
from TISCI but use rflow_map for reservation in __udma_reserve_rflow()

Fix this by dropping rflow_in_use bitmap array and use rflow_map for
PKTDMA. BCDMA does not need rflow_in_use either.

This fixes CPSW3g not able to get DMA channels at R5 SPL on AM64x

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
2 years agoARM: mach-k3: sysfw-loader: Copy sysfw.itb to OCRAM in OSPI/SPI bootmode
Vignesh Raghavendra [Thu, 23 Dec 2021 13:56:03 +0000 (19:26 +0530)]
ARM: mach-k3: sysfw-loader: Copy sysfw.itb to OCRAM in OSPI/SPI bootmode

In case of xSPI bootmode OSPI flash is in DDR mode and needs to be accessed
in multiple of 16bit accesses Hence we cannot parse sysfw.itb FIT image
directly on OSPI flash via MMIO window. So, copy the image to internal
on-chip RAM before parsing the image.

Moreover, board cfg data maybe modified by ROM/TIFS in case of HS platform
and thus cannot reside in OSPI/xSPI and needs to be copied over to
internal OCRAM.

This unblocks OSPI/xSPI boot on HS platforms

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Reviewed-by: Dave Gerlach <d-gerlach@ti.com>
Tested-by: Keerthy <j-keerthy@ti.com>
Acked-by: Pratyush Yadav <p.yadav@ti.com>
2 years agoarm: mach-k3: am642_init: Unlock MCU PADCFG regs
Michael Liebert [Wed, 15 Dec 2021 15:14:28 +0000 (16:14 +0100)]
arm: mach-k3: am642_init: Unlock MCU PADCFG regs

Currently only the PADCFG registers of the main domain are unlocked.
Also unlock PADCFG registers of MCU domain, so MCU pin muxing can be configured by u-boot or Linux.

Signed-off-by: Michael Liebert <liebert@ibv-augsburg.de>
Tested-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Acked-by: Nishanth Menon <nm@ti.com>
2 years agoMerge tag 'efi-2022-04-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sat, 15 Jan 2022 12:39:09 +0000 (07:39 -0500)]
Merge tag 'efi-2022-04-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2022-04-rc1

Documentation:

* Fix building HTML documentation of readthedocs.io
* Add ARM Juno board documentation
* Build requirements for Alpine Linux
* Include DM headers in API documentation

UEFI:

* Fix section alignment of EFI binaries
* Fix header length of RISC-V EFI binaries allowing to run them on EDK II
* Remove kaslr-seed from device tree if the EFI_RNG_PROTOCOL is provided

Other:

* Let 'part list' show all 128 GPT partitions

2 years agoMerge branch '2022-01-14-assorted-fixes'
Tom Rini [Sat, 15 Jan 2022 12:34:46 +0000 (07:34 -0500)]
Merge branch '2022-01-14-assorted-fixes'

- A number of fixes in various subsystems.  This includes having the phy
  uclass track power-on and init counts as this should resolve some
  tricky functional problems on a number of platforms.

2 years agoefi: Tidy up some comments in efi header
Simon Glass [Tue, 4 Jan 2022 10:51:18 +0000 (03:51 -0700)]
efi: Tidy up some comments in efi header

Document the return value in efi_init(). Fix up @sizep in efi_info_get().
Use Return: instead of @return

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agoefi: Build the 64-bit app properly
Simon Glass [Tue, 4 Jan 2022 10:51:17 +0000 (03:51 -0700)]
efi: Build the 64-bit app properly

Now that the linker crash is resolved, build the 64-bit EFI app, including
all the required code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agox86: efi: Set the correct link flags for the 64-bit EFI app
Simon Glass [Tue, 4 Jan 2022 10:51:16 +0000 (03:51 -0700)]
x86: efi: Set the correct link flags for the 64-bit EFI app

At present some 32-bit settings are used with the 64-bit app. Fix this by
separating out the two cases.

Be careful not to break the 64-bit payload, which needs to build a 64-bit
EFI stub with a 32-bit U-Boot.

Signed-off-by: Christian Melki <christian.melki@t2data.com>
Signed-off-by: Simon Glass <sjg@chromium.org>