platform/kernel/u-boot.git
2 years agousb: dwc3: Add support for usb3-phy PHY configuration
Michal Simek [Wed, 9 Mar 2022 09:05:45 +0000 (10:05 +0100)]
usb: dwc3: Add support for usb3-phy PHY configuration

When usb3-phy label is found, PHY driver is called and serdes line is
initialized. This is preparation for serdes/psgtr driver to configure GT
lines based on description in DT.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2 years agogeneric-phy: s/CONFIG_PHY/CONFIG_IS_ENABLED(PHY)/
Michal Simek [Wed, 9 Mar 2022 09:05:44 +0000 (10:05 +0100)]
generic-phy: s/CONFIG_PHY/CONFIG_IS_ENABLED(PHY)/

Allow to disable PHY driver in SPL because it checks the CONFIG_SPL_PHY
variable for SPL builds.

The same change was done for usb by commit fd09c205fc57 ("usb:
s/CONFIG_DM_USB/CONFIG_IS_ENABLED(DM_USB)/").

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2 years agousb: gadget: ci: Make various ops const
Adam Ford [Fri, 4 Mar 2022 22:59:02 +0000 (16:59 -0600)]
usb: gadget: ci: Make various ops const

ci_udc_ops and ci_ep_ops do not change their operations.
Mark them as const.

Signed-off-by: Adam Ford <aford173@gmail.com>
2 years agoMerge branch '2022-04-21-further-cleanups'
Tom Rini [Thu, 21 Apr 2022 23:55:38 +0000 (19:55 -0400)]
Merge branch '2022-04-21-further-cleanups'

- Fix SPL_SYS_MALLOC_SIMPLE and non-SPL_FRAMEWORK boards (a large number
  of PowerPC platforms)
- Remove duplication of crc16 functionality
- Migrate COUNTER_FREQUENCY to CONFIG_COUNTER_FREQUENCY and have it in
  Kconfig

2 years agoarm: set cntfrq_el0 if CONFIG_COUNTER_FREQUENCY is valid
Peng Fan [Wed, 13 Apr 2022 09:47:22 +0000 (17:47 +0800)]
arm: set cntfrq_el0 if CONFIG_COUNTER_FREQUENCY is valid

Since COUNTER_FREQUENCY is obselete, so set cntfrq_el0 if
CONFIG_COUNTER_FREQUENCY is valid

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
2 years agoinclude/configs: drop COUNTER_FREQUENCY
Peng Fan [Wed, 13 Apr 2022 09:47:21 +0000 (17:47 +0800)]
include/configs: drop COUNTER_FREQUENCY

Since we have CONFIG_COUNTER_FREQUENCY enabled, no need COUNTER_FREQUENCY

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoconfigs: set CONFIG_COUNTER_FREQUENCY
Peng Fan [Wed, 13 Apr 2022 09:47:20 +0000 (17:47 +0800)]
configs: set CONFIG_COUNTER_FREQUENCY

Set CONFIG_COUNTER_FREQUENCY according to COUNTER_FREQUENCY in
config header file.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
[trini: Re-run migration]

2 years agoarch: arm: Kconfig: set default COUNTER_FREQUENCY
Peng Fan [Wed, 13 Apr 2022 09:47:19 +0000 (17:47 +0800)]
arch: arm: Kconfig: set default COUNTER_FREQUENCY

Set default COUNTER_FREQUENCY according to config header file
under include/configs/
i.MX6UL/ULL/7D/8QM/8QXP all has system counter frequency run at 8MHz,
so set default value for them.
SUNXI/EXYNOS/ROCKCHIP_RK3128/ROCKCHIP_RK3288/ROCKCHIP_RK322X/ROCKCHIP_RK3036
at 24MHz. ARCH_LX2160A at 25MHz
ARCH_ZYNQMP at 100MHz

2 years agoarch: arm: move COUNTER_FREQUENCY from versal to arm
Peng Fan [Wed, 13 Apr 2022 09:47:18 +0000 (17:47 +0800)]
arch: arm: move COUNTER_FREQUENCY from versal to arm

Make COUNTER_FREQUENCY usable to armv8 and armv7-a, not limited to
versal. And update help message.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2 years agoxilinx: versal: board: use CONFIG_COUNTER_FREQUENCY
Peng Fan [Wed, 13 Apr 2022 09:47:17 +0000 (17:47 +0800)]
xilinx: versal: board: use CONFIG_COUNTER_FREQUENCY

Since versal has CONFIG_COUNTER_FREQUENCY, so use it. And
COUNTER_FREQUENCY will be dropped.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>
2 years agomisc: atsha204a: Remove duplicate CRC-16 implementation
Pali Rohár [Tue, 12 Apr 2022 09:20:44 +0000 (11:20 +0200)]
misc: atsha204a: Remove duplicate CRC-16 implementation

ATSHA204A uses bit-reversed checksum of standard CRC-16 with polynomial
x^16 + x^15 + x^2 + 1.

This ATSHA204A specific checksum can be calculated just by using common
U-Boot functions bitrev16() and crc16().

So replace custom driver CRC-16 implementation by common U-Boot functions.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agofs: ext4: Use CRC-16 implementation from linux/crc16.h
Pali Rohár [Tue, 12 Apr 2022 09:20:43 +0000 (11:20 +0200)]
fs: ext4: Use CRC-16 implementation from linux/crc16.h

Implementation in linux/crc16.h provides standard CRC-16 algorithm with
polynomial x^16 + x^15 + x^2 + 1. Use it and remove duplicate ext4 CRC-16
specific code.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agocrc16: Move standard CRC-16 implementation from ubifs to lib
Pali Rohár [Tue, 12 Apr 2022 09:20:42 +0000 (11:20 +0200)]
crc16: Move standard CRC-16 implementation from ubifs to lib

This implementation provides standard CRC-16 algorithm with polynomial
x^16 + x^15 + x^2 + 1.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agocrc16: Rename fs/ubifs/crc16.h to include/linux/crc16.h
Pali Rohár [Tue, 12 Apr 2022 09:20:41 +0000 (11:20 +0200)]
crc16: Rename fs/ubifs/crc16.h to include/linux/crc16.h

File fs/ubifs/crc16.h is standard linux's crc16.h include file. So move it
from fs/ubifs to include/linux where are also other linux include files.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agocrc16-ccitt: Rename file with CRC-16-CCITT implementation to crc16-ccitt.c
Pali Rohár [Tue, 12 Apr 2022 09:20:40 +0000 (11:20 +0200)]
crc16-ccitt: Rename file with CRC-16-CCITT implementation to crc16-ccitt.c

U-Boot CRC-16 implementation uses polynomial x^16 + x^12 + x^5 + 1 which is
not standard CRC-16 algorithm, but it is known as CRC-16-CCITT. Rename file
crc16.c to crc16-ccitt.c to reduce confusion.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoSPL: Do not enable SPL_SYS_MALLOC_SIMPLE without SPL_FRAMEWORK by default
Pali Rohár [Fri, 8 Apr 2022 08:28:05 +0000 (10:28 +0200)]
SPL: Do not enable SPL_SYS_MALLOC_SIMPLE without SPL_FRAMEWORK by default

On P2020 board is SPL malloc simple always failing with error and loops:

  SD boot...
  alloc space exhausted
  Bad trap at PC: f8f8b5f0, SR: 21200, vector=d00
  NIP: 00000000 XER: 00000000 LR: 00000000 REGS: f8f8b5f0 TRAP: 20000000 DAR: 00000000
  MSR: 00021200 EE: 0 PR: 0 FP: 0 ME: 1 IR/DR: 00

  GPR00: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  GPR08: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  GPR16: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  GPR24: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  Call backtrace:
  Exception in kernel pc f8f8b5f0 signal 0

Inspection showed that gd->malloc_limit is zero. And it is because
generally SPL_FRAMEWORK initialize SPL's gd->malloc_limit. But when
SPL_FRAMEWORK is not enabled then in most cases nobody initialize
gd->malloc_limit and so SPL malloc simple does not work.

So disable SPL_SYS_MALLOC_SIMPLE by default when SPL_FRAMEWORK is not
enabled. SPL_SYS_MALLOC_SIMPLE can be disabled only by setting
SPL_SYS_MALLOC_F_LEN to zero. So do it.

This change fixes SPL error "alloc space exhausted" on P2020 board.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Thu, 21 Apr 2022 15:44:54 +0000 (11:44 -0400)]
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- mrvl_uart.sh: Remove script (Pali)
- Fix Espressobin build for configs where ENV is not in SPI (Rogier)
- mvebu: a37xx: Add support for reading OTP (Pali)
- mvebu: uDPU: Ethernet fixes and misc DT and defconfig changes (Robert)
- mvebu: Add support for reading LD0 and LD1 eFuse (Pali)
- kwboot: Replace fstat()+st_size by lseek()+SEEK_END (Pali)
- mvebu: turris_omnia: Enable CONFIG_CMD_FUSE (Pali)
- arm: Add CONFIG_SPL_SYS_NO_VECTOR_TABLE used on 32bit MVEBU (Pali)
- mvebu: a37xx: Add support for writing Security OTP values (Pali)
- mvebu: turris: Misc enhancements and cleanups / fixes (Pali)
- Sheevaplug : Use Marvell uclass mvgbe and PHY driver for Ethernet (Tony)

2 years agoMerge branch '2022-04-21-assorted-improvements'
Tom Rini [Thu, 21 Apr 2022 14:56:58 +0000 (10:56 -0400)]
Merge branch '2022-04-21-assorted-improvements'

- For the environment, add a arch_env_get_location hook and make use of
  it on some NXP platforms (so that boards can override SoCs).
- Remove some unused squashfs code from SPL
- Resync am335x beaglebone related DTS files
- Enable SPL_SEPARATE_BSS if SPL_BSS_START_ADDR is used

2 years agotreewide: Enable SPL_SEPARATE_BSS if SPL_BSS_START_ADDR is used
Sean Anderson [Tue, 12 Apr 2022 14:59:04 +0000 (10:59 -0400)]
treewide: Enable SPL_SEPARATE_BSS if SPL_BSS_START_ADDR is used

If .bss does not immediately follow the end of the image, then
CONFIG_SPL_SEPARATE_BSS must be selected. Typically, the location of bss
is specified by using CONFIG_SPL_BSS_START_ADDR in a linker script. On
these arches, CONFIG_SPL_SEPARATE_BSS should be enabled. If there is an
option to use an alternate boot script (e.g. CONFIG_SPL_LDSCRIPT is just
a default), just imply. If there is not, select.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
2 years agoboard: ti: am335x: Add support for BBE Extended WiFi
Paul Barker [Mon, 11 Apr 2022 15:42:01 +0000 (15:42 +0000)]
board: ti: am335x: Add support for BBE Extended WiFi

The Sancloud BeagleBone Enhanced Extended WiFi (BBE Extended WiFi) has
its own devicetree file and the board can be identified by the 2nd
letter of the config string within the common EEPROM.

Signed-off-by: Paul Barker <paul.barker@sancloud.com>
2 years agoboard: ti: am335x: Add BBE Lite support
Paul Barker [Mon, 11 Apr 2022 15:42:00 +0000 (15:42 +0000)]
board: ti: am335x: Add BBE Lite support

The Sancloud BeagleBone Enhanced Lite (BBE Lite) has its own devicetree
file and the board can be identified by the 2nd letter of the config
string within the common EEPROM.

Signed-off-by: Paul Barker <paul.barker@sancloud.com>
2 years agoarm: dts: Resync dts for BeagleBone and derivatives
Paul Barker [Mon, 11 Apr 2022 15:41:59 +0000 (15:41 +0000)]
arm: dts: Resync dts for BeagleBone and derivatives

Sync BeagleBone dts files & TPS dtsi files with Linux v5.17 and include
the SanCloud BBE Extended WiFi dts added in v5.18-rc1. Also pull in
changes to am33xx-l4.dtsi needed to support the BeagleBone Blue.

The change to use the cpsw switch driver (commit c477358e66a3 in Linux)
is excluded from the sync as u-boot does not recognise the new
compatible string.

Signed-off-by: Paul Barker <paul.barker@sancloud.com>
2 years agofs: Allow to compile FS_SQUASHFS only for proper U-Boot
Pali Rohár [Wed, 6 Apr 2022 21:34:00 +0000 (23:34 +0200)]
fs: Allow to compile FS_SQUASHFS only for proper U-Boot

CONFIG_SPL_FS_SQUASHFS cannot be disabled when CONFIG_FS_SQUASHFS is
enabled. Fix it.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoARM: imx: imx8m: env: Switch to arch_env_get_location()
Marek Vasut [Wed, 6 Apr 2022 00:21:34 +0000 (02:21 +0200)]
ARM: imx: imx8m: env: Switch to arch_env_get_location()

Implement arch_env_get_location() instead of env_get_location(), so that
the env_get_location() can be implemented on board level and override the
arch_env_get_location() architecture defaults.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Adam Ford <aford173@gmail.com>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Marek Behún <marek.behun@nic.cz>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Tommaso Merciai <tomm.merciai@gmail.com>
Cc: Vladimir Oltean <vladimir.oltean@nxp.com>
2 years agoarmv8: layerscape: env: Switch to arch_env_get_location()
Marek Vasut [Wed, 6 Apr 2022 00:21:33 +0000 (02:21 +0200)]
armv8: layerscape: env: Switch to arch_env_get_location()

Implement arch_env_get_location() instead of env_get_location(), so that
the env_get_location() can be implemented on board level and override the
arch_env_get_location() architecture defaults.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Adam Ford <aford173@gmail.com>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Marek Behún <marek.behun@nic.cz>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Tommaso Merciai <tomm.merciai@gmail.com>
Cc: Vladimir Oltean <vladimir.oltean@nxp.com>
2 years agoenv: Implement lower priority arch_env_get_location()
Marek Vasut [Wed, 6 Apr 2022 00:21:32 +0000 (02:21 +0200)]
env: Implement lower priority arch_env_get_location()

Currently there is only one way to override desired environment location,
by implementing env_get_location(). This is increasingly being conflated
both on board level and architecture level, which leads to a problem on
boards where this function is already implemented on architecture level,
since those boards have no way to override this environment location on
board level anymore.

Implement arch_env_get_location() function which is architecture specific
and should only ever be implemented in architecture code. This function
has lower priority than env_get_location(), which should only ever be
implemented in board code, and which overrides the arch_env_get_location()
architecture environment selection.

This way, architecture can define its default environment chooser, while
board can now override it as needed at all times.

There is no functional change, since env_get_location() simply returns
arch_env_get_location(), and arch_env_get_location() implements the
current env_get_location() default content.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Adam Ford <aford173@gmail.com>
Cc: Fabio Estevam <festevam@denx.de>
Cc: Marek Behún <marek.behun@nic.cz>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Tommaso Merciai <tomm.merciai@gmail.com>
Cc: Vladimir Oltean <vladimir.oltean@nxp.com>
2 years agoarm: kirkwood: Sheevaplug : Use Marvell uclass mvgbe and PHY driver for Ethernet
Tony Dinh [Sun, 17 Apr 2022 23:42:32 +0000 (16:42 -0700)]
arm: kirkwood: Sheevaplug : Use Marvell uclass mvgbe and PHY driver for Ethernet

The Globalscale Technologies Sheevaplug board has the network chip
Marvell 88E1116R. Use uclass mvgbe and the compatible driver M88E1310
driver to bring up Ethernet.

- Remove CONFIG_RESET_PHY_R symbol from all board files
- Use uclass mvgbe to bring up the network. And remove ad-hoc code.
- Enable CONFIG_PHY_MARVELL to properly configure the network.
- Miscellaneous changes: Move constants to .c file and remove header file
board/Marvell/sheevaplug/sheevaplug.h, use BIT macro, and add/cleanup
comments.

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
2 years agoarm: mvebu: turris_omnia: Enable CONFIG_CMD_FUSE
Pali Rohár [Wed, 6 Apr 2022 13:26:35 +0000 (15:26 +0200)]
arm: mvebu: turris_omnia: Enable CONFIG_CMD_FUSE

This allows to read eFuse on Turris Omnia.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoboard: turris: Rename atsha204a@64 DT node to crypto@64
Pali Rohár [Fri, 8 Apr 2022 14:30:15 +0000 (16:30 +0200)]
board: turris: Rename atsha204a@64 DT node to crypto@64

DT node name should be generic, therefore rename atsha204a@64 to crypto@64.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
2 years agoboard: turris: Allow to specify first eth idx of first MAC address
Pali Rohár [Fri, 8 Apr 2022 14:30:14 +0000 (16:30 +0200)]
board: turris: Allow to specify first eth idx of first MAC address

Turris Omnia uses first MAC address from OTP for second ethernet interface.
Second MAC address for third interface and third MAC address for first
interface.

Other Turris routers do not have this rotate by one mapping. So add
function parameter for specifying id of the first ethernet interface.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
2 years agoboard: turris: Do not cache Atsha device in BSS
Pali Rohár [Fri, 8 Apr 2022 14:30:13 +0000 (16:30 +0200)]
board: turris: Do not cache Atsha device in BSS

Atsha device is used prior relocation and at this early stage BSS does not
have to be ready yet. So do not cache Atsha device in BSS.

Fixes support for other Turris routers.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
2 years agoboard: turris: Move Turris Atsha OTP code to separate file
Pali Rohár [Fri, 8 Apr 2022 14:30:12 +0000 (16:30 +0200)]
board: turris: Move Turris Atsha OTP code to separate file

OTP code is not Atsha generic but also it is not Omnia specific. It is
common for all Turris routers which use Atsha cryptochip for storing OTP.
So move this common Turris specific Atsha OTP code from Turris Omnia into
separate file. It will be used also by other Turris routers.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
2 years agoarm: mvebu: a37xx: Add support for writing Security OTP values
Pali Rohár [Thu, 7 Apr 2022 09:32:10 +0000 (11:32 +0200)]
arm: mvebu: a37xx: Add support for writing Security OTP values

Implement write support for Security OTP values via mailbox API commands
MBOX_CMD_OTP_WRITE_32B and MBOX_CMD_OTP_WRITE.

Write support for North and South Bridge OTPs are not implemented as these
OTPs are already burned in factory with some data.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
2 years agoarm: mvebu: Enable CONFIG_SPL_SYS_NO_VECTOR_TABLE for 32-bit mvebu
Pali Rohár [Wed, 6 Apr 2022 14:20:20 +0000 (16:20 +0200)]
arm: mvebu: Enable CONFIG_SPL_SYS_NO_VECTOR_TABLE for 32-bit mvebu

U-Boot SPL is on 32-bit mvebu executed by the BootROM. And BootROM expects
that U-Boot SPL returns execution back to the BootROM. Vectors during
execution of U-Boot SPL should not be changed as BootROM does not expect it
and uses its own vectors. So do not overwrite vectors in SPL build.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoarm: Do not compile vector table when SYS_NO_VECTOR_TABLE is enabled
Pali Rohár [Wed, 6 Apr 2022 14:20:19 +0000 (16:20 +0200)]
arm: Do not compile vector table when SYS_NO_VECTOR_TABLE is enabled

Vector table is not used when SYS_NO_VECTOR_TABLE is enabled.
So do not compile it and reduce image size.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agoarm: Introduce new CONFIG_SPL_SYS_NO_VECTOR_TABLE option
Pali Rohár [Wed, 6 Apr 2022 14:20:18 +0000 (16:20 +0200)]
arm: Introduce new CONFIG_SPL_SYS_NO_VECTOR_TABLE option

Move OMAP4 specific option for disabling overwriting vector table into
config option CONFIG_SPL_SYS_NO_VECTOR_TABLE.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agotools: kwboot: Replace fstat()+st_size by lseek()+SEEK_END
Pali Rohár [Wed, 6 Apr 2022 13:18:59 +0000 (15:18 +0200)]
tools: kwboot: Replace fstat()+st_size by lseek()+SEEK_END

fstat()'s st_size works only for regular files. lseek() with SEEK_END works
also for block or MTD devices. This replacement allows kwboot to load
kwbimage from /dev/mtd0 for booting another device over /dev/ttyS0.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
2 years agoarm: mvebu: Add support for reading LD0 and LD1 eFuse
Pali Rohár [Wed, 6 Apr 2022 12:18:18 +0000 (14:18 +0200)]
arm: mvebu: Add support for reading LD0 and LD1 eFuse

Armada 385 contains 64 lines of HD eFuse and 2 lines of LD eFuse. HD eFuse
is used for secure boot and each line is 64 bits long + 1 lock bit. LD
eFuse lines are 256 bits long + 1 lock bit. LD 0 line is reserved for
Marvell Internal Use and LD 1 line is for General Purpose Data. U-Boot
already contains HD eFuse reading and programming support.

This patch implements LD eFuse reading support. LD 0 line is mapped to
U-Boot fuse bank 64 and LD 1 line to fuse bank 65.

LD 0 Marvell Internal Use line seems that was burned in factory with some
data and can be read by U-Boot fuse command:

  => fuse read 64 0 9

LD 1 General Purpose Data line is by default empty and can be read by
U-Boot fuse command:

  => fuse read 65 0 9

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
2 years agomvebu: uDPU: update defconfig
Robert Marko [Thu, 24 Mar 2022 09:57:39 +0000 (10:57 +0100)]
mvebu: uDPU: update defconfig

Update the current uDPU defconfig with following changes:
* Disable CONFIG_SPI_BOOT, its not needed for booting and the device boots
from eMMC anyway.
* Disable CONFIG_SYS_CONSOLE_INFO_QUIET, there is no need to diverge from
other boards by not priting the console device
* Enable CONFIG_CMD_MTD in order to allow use of the MTD tool
* Disable CONFIG_CMD_MTDPARTS, with MTD now being able to parse partitions
from DTS there is no need for it, the default MTDPARTS were incorrect
anyway
* Enable CONFIG_MMC_HS200_SUPPORT, the eMMC used support both HS200 and
HS400 modes, so enable at least HS200 because Xenon driver does not
support HS400 currently
* Replace CONFIG_SPI_FLASH_BAR with CONFIG_SPI_FLASH_SFDP_SUPPORT
Utilize SFDP parsing instead of relying on the extended address registers

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: dts: uDPU: fix non-working networking
Robert Marko [Thu, 24 Mar 2022 09:57:38 +0000 (10:57 +0100)]
arm: mvebu: dts: uDPU: fix non-working networking

uDPU is a bit of a specific device in that it does not have any copper
ports nor any ethernet PHY-s but 2 SFP ports.

This is an issue since MVNETA requires a PHY phandle or a fixed-link to
be defined under its node.
Since U-boot has no SFP support this is reasonable in order to know how
to configure the MAC.

However this also means that networking does not work on uDPU at all
currently, and fails with:

uDPU>> dhcp
Could not get PHY for neta@30000: addr 0
phy_connect failed
Could not get PHY for neta@40000: addr 1
phy_connect failed

So, to provide working networking using only SFP-s let add the fixed-link
at 1G which is much more common than 2.5G SFP-s as well as disable the
TX_DISABLE pins like done on Armada 7040 and 8040 platforms.

Since uDPU is not using any of the GPIO-s on the SB controller for any
purpose other than GPIO, a call to the pinctrl must be made in order for
it to get probed and thus register the SB GPIO bank, otherwise SB GPIO-s
are not registered at all.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agonet: mvneta: add SFP TX disable handling
Robert Marko [Thu, 24 Mar 2022 09:57:37 +0000 (10:57 +0100)]
net: mvneta: add SFP TX disable handling

Add support for handling SFP TX disable for MVNETA in the same fashion as
to what MVPP2 is doing in order to enable using SFP-s.

This allows using ethernet on SFP only boards.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: dts: uDPU: update DTS
Robert Marko [Thu, 24 Mar 2022 09:57:36 +0000 (10:57 +0100)]
arm: mvebu: dts: uDPU: update DTS

Update the uDPU DTS to the version that is pending upstream [1][2].

[1] https://patchwork.kernel.org/project/linux-arm-kernel/patch/20220322105857.1107016-1-robert.marko@sartura.hr/
[2] https://patchwork.kernel.org/project/linux-arm-kernel/patch/20220322105857.1107016-2-robert.marko@sartura.hr/

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: a37xx: Add support for reading Security OTP values
Pali Rohár [Wed, 23 Feb 2022 13:15:49 +0000 (14:15 +0100)]
arm: mvebu: a37xx: Add support for reading Security OTP values

It is not possible for the A53 core (on which U-Boot is running) to read it
directly. For this purpose Marvell defined mbox API for sending OTP
commands between CM3 and A53 cores.

Implement these Marvell fuse reading mbox commands via U-Boot fuse API.

Banks 0-43 are used for accessing Security OTP (44 rows with 67 bits via 44
banks and words 0-2).

Note that of the 67 bits, the 3 upper bits are: 1 lock bit and 2
auxiliary bits (meant for testing during the manufacture of the SOC, as
I understand it).

Also note that the lock bit and the auxiliary bits are not readable
via Marvell commands.

With CZ.NIC's commands the lock bit is readable.

Write support is not implemented yet.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: a37xx: Extend mbox_do_cmd() code
Pali Rohár [Wed, 23 Feb 2022 13:15:48 +0000 (14:15 +0100)]
arm: mvebu: a37xx: Extend mbox_do_cmd() code

Allow to specify input parameters, define all available mbox commands
supported by CZ.NIC's secure firmware and also Marvell's fuse.bin firmware
and fix parsing response from Marvell OTP commands.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: a37xx: Move generic mbox code to arch/arm/mach-mvebu
Pali Rohár [Wed, 23 Feb 2022 13:15:47 +0000 (14:15 +0100)]
arm: mvebu: a37xx: Move generic mbox code to arch/arm/mach-mvebu

Generic A3720 mbox code is currently in Turris Mox specific board file
board/CZ.NIC/turris_mox/mox_sp.c. Move it to board independent arch file
arch/arm/mach-mvebu/armada3700/mbox.c.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: a37xx: Enable fuse command on all Armada 3720 boards
Pali Rohár [Wed, 23 Feb 2022 13:15:46 +0000 (14:15 +0100)]
arm: mvebu: a37xx: Enable fuse command on all Armada 3720 boards

Allow to read OTP bits via U-Boot fuse command on all Armada 3720 boards.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: a37xx: Add support for reading NB and SB fuse OTP value
Pali Rohár [Wed, 23 Feb 2022 13:15:45 +0000 (14:15 +0100)]
arm: mvebu: a37xx: Add support for reading NB and SB fuse OTP value

Implement reading NB and SB fuses of Armada 37xx SOC via U-Boot fuse API.

Banks 0-43 are reserved for accessing Security OTP (not implemented yet).
Bank 44 is used for accessing North Bridge OTP (69 bits via words 0-2).
Bank 45 is used for accessing South Bridge OTP (97 bits via words 0-3).

Write support is not implemented yet because it looks like that both North
and South Bridge OTPs are already burned in factory with some data. The
meaning of some bits of North Bridge is documented in WTMI source code.
The meaning of bits in South Bridge is unknown.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
2 years agoarm: mvebu: Fix Espressobin build for configs where ENV is not in SPI
Rogier Stam [Tue, 8 Feb 2022 23:27:00 +0000 (00:27 +0100)]
arm: mvebu: Fix Espressobin build for configs where ENV is not in SPI

When storing the UBoot Environment in for example EXT4,
the U-Boot build is broken for several reasons:
1. armada-385-turris-omnia-u-boot.dtsi will not allow
   CONFIG_ENV_OFFSET and CONFIG_ENV_SIZE to be undefined
2. armada-37xx/board.c ft_board_setup function does not
   exist if CONFIG_ENV_IS_IN_SPI_FLASH is not defined

This commit changes these files so that selecting a
different location for the environment is possible.

Signed-off-by: Rogier Stam <rogier@unrailed.org>
Reviewed-by: Pali Rohár <pali@kernel.org>
2 years agotools/mrvl_uart.sh: Remove script
Pali Rohár [Thu, 3 Feb 2022 16:50:46 +0000 (17:50 +0100)]
tools/mrvl_uart.sh: Remove script

There are two tools for sending images over UART to Marvell SoCs: kwboot
and mrvl_uart.sh. kwboot received lot of new features and improvements in
last few months. There is no need to maintain two tools in U-Boot, so
remove old mrvl_uart.sh tool.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Marcel Ziswiler <marcel@ziswiler.com>
Tested-by: Marcel Ziswiler <marcel@ziswiler.com>
Reviewed-by: Tony Dinh <mibodhi@gmail.com>
2 years agoconfigs: Resync with savedefconfig
Tom Rini [Wed, 20 Apr 2022 18:48:59 +0000 (14:48 -0400)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoMerge branch '2022-04-20-assorted-improvements'
Tom Rini [Wed, 20 Apr 2022 18:33:53 +0000 (14:33 -0400)]
Merge branch '2022-04-20-assorted-improvements'

- Two TI K3 updates, update SYS_MALLOC_F_LEN default to be 0x2000 and
  move TI am33xx to use that as well, fix DT relocation with multiple
  DRAM banks, and add a gpio read sub-command.

2 years agocmd: gpio: Add `gpio read` subcommand
Diego Rondini [Mon, 11 Apr 2022 10:02:09 +0000 (12:02 +0200)]
cmd: gpio: Add `gpio read` subcommand

As explained in commit 4af2a33ee5b9 ("cmd: gpio: Make `gpio input`
return pin value again") the `gpio input` is used in scripts to obtain
the value of a pin, despite the fact that CMD_RET_FAILURE is
indistinguishable from a valid pin value.
To be able to detect failures and properly use the value of a GPIO in
scripts we introduce the `gpio read` command that sets the variable
`name` to the value of the pin. Return code of the `gpio read` command
can be used to check for CMD_RET_SUCCESS or CMD_RET_FAILURE.
CONFIG_CMD_GPIO_READ is used to enable the `gpio read` command.

Signed-off-by: Diego Rondini <diego.rondini@kynetics.com>
2 years agoram: k3-ddrss: Allow use of dt provided initial frequency
Dave Gerlach [Fri, 8 Apr 2022 21:46:50 +0000 (16:46 -0500)]
ram: k3-ddrss: Allow use of dt provided initial frequency

Allow device tree to provide ti,ddr-freq0 to be used as the initial DDR
frequency that is set for lpddr4 before initialization of the
controller. Make this optional and continue to use PLL bypass frequency
as is done currently if ti,ddr-freq0 is not provided.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
2 years agoimage: fdt: Fix DT relocation handling with multiple DRAM banks with gap
Marek Vasut [Fri, 8 Apr 2022 00:09:19 +0000 (02:09 +0200)]
image: fdt: Fix DT relocation handling with multiple DRAM banks with gap

The current implementation of boot_relocate_fdt() places DT at the
highest usable DRAM address, which is calculated as:
  env_get_bootm_low() + env_get_bootm_mapsize()
which by default becomes gd->ram_base + gd->ram_size.

Systems like i.MX53 can have multiple DRAM banks with gap between them,
e.g. have DRAM at 0x70000000-0x8fffffff and 0xb0000000-0xcfffffff , so
for them the calculated highest DRAM address is 0xafffffff, which is
exactly in the gap and thus not usable.

Fix this by iterating over all DRAM banks and tracking the remaining
amount of the total mapping size obtained from env_get_bootm_mapsize().
Limit the maximum LMB area size to each bank, to avoid using nonexistent
DRAM.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
2 years agoam33xx: Update SYS_MALLOC_F_LEN to use 0x2000 as the default
Tom Rini [Thu, 7 Apr 2022 16:33:24 +0000 (12:33 -0400)]
am33xx: Update SYS_MALLOC_F_LEN to use 0x2000 as the default

A number of platforms here had already been increasing the size a bit,
so lets moving all of them up.

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agoKconfig: Change SYS_MALLOC_F_LEN default to 0x2000
Tom Rini [Thu, 7 Apr 2022 16:33:23 +0000 (12:33 -0400)]
Kconfig: Change SYS_MALLOC_F_LEN default to 0x2000

The most commonly used value today is 0x2000 and not 0x400.  Rework the
Kconfig logic to use this more frequently used value as the default.

Cc: Andrew F. Davis <afd@ti.com>
Cc: Alex Nemirovsky <alex.nemirovsky@cortina-access.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Alison Wang <alison.wang@nxp.com>
Cc: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Cc: Andes <uboot@andestech.com>
Cc: Andre Przywara <andre.przywara@arm.com>
Cc: Bharat Gooty <bharat.gooty@broadcom.com>
Cc: David Lechner <david@lechnology.com>
Cc: Dzmitry Sankouski <dsankouski@gmail.com>
Cc: Enric Balletbo i Serra <eballetbo@gmail.com>
Cc: Eugeniy Paltsev <paltsev@synopsys.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Gerald Kerma <dreagle@doukki.net>
Cc: Gregory CLEMENT <gregory.clement@bootlin.com>
Cc: Holger Brunck <holger.brunck@hitachienergy.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Jassi Brar <jaswinder.singh@linaro.org>
Cc: Kristian Amlie <kristian.amlie@northern.tech>
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Liviu Dudau <liviu.dudau@foss.arm.com>
Cc: Luka Perkov <luka.perkov@sartura.hr>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Masami Hiramatsu <masami.hiramatsu@linaro.org>
Cc: Matthias Brugger <mbrugger@suse.com>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Michael Walle <michael@walle.cc>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Nikita Kiryanov <nikita@compulab.co.il>
Cc: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Cc: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Cc: Otavio Salvador <otavio@ossystems.com.br>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Paul Burton <paul.burton@mips.com>
Cc: Paul Kocialkowski <contact@paulk.fr>
Cc: Priyanka Jain <priyanka.jain@nxp.com>
Cc: Rajesh Bhagat <rajesh.bhagat@nxp.com>
Cc: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
Cc: Sergey Temerkhanov <s.temerkhanov@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stefan Bosch <stefan_b@posteo.net>
Cc: Stephan Gerhold <stephan@gerhold.net>
Cc: Tetsuyuki Kobayashi <koba@kmckk.co.jp>
Cc: Thomas Chou <thomas@wytron.com.tw>
Cc: Thomas Fitzsimmons <fitzsim@fitzsim.org>
Cc: Thomas Weber <weber@corscience.de>
Cc: Tony Dinh <mibodhi@gmail.com>
Cc: Trevor Woerner <twoerner@gmail.com>
Cc: Vitaly Andrianov <vitalya@ti.com>
Cc: Vladimir Zapolskiy <vz@mleia.com>
Cc: liuhao <liuhao@phytium.com.cn>
Cc: lixinde <lixinde@phytium.com.cn>
Cc: shuyiqi <shuyiqi@phytium.com.cn>
Cc: weichangzheng <weichangzheng@phytium.com.cn>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
Reviewed-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Kristian Amlie <kristian.amlie@northern.tech>
2 years agoram: k3-ddrss: Fix register name and explain its usage
Dominic Rath [Wed, 6 Apr 2022 09:56:47 +0000 (11:56 +0200)]
ram: k3-ddrss: Fix register name and explain its usage

The k3-ddrss driver wants to configure the DDRSS_V2A_CTL_REG to reflect
the maximum possible SDRAM of 2 GB for AM64x (instead of the register's
default that says 8 GB, which the AM64x DDR controller wouldn't support).

The offset 0x20 was correct, but the register name DDRSS_V2A_R1_MAT_REG
was that of the next register at offset 0x24.

Signed-off-by: Dominic Rath <rath@ibv-augsburg.net>
2 years agoMerge branch '2022-04-19-assorted-updates'
Tom Rini [Tue, 19 Apr 2022 21:02:21 +0000 (17:02 -0400)]
Merge branch '2022-04-19-assorted-updates'

- Migrate CONFIG_SYS_MEM_TOP_HIDE to Kconfig, IOMUX bugfix, 2 BTRFS
bugfixes, update .gitignore and .mailmap files, aspeed GPIO bugfix,
image-fit and squashfs code cleanups, enable EXT4 and ISO partitions on
DeveloperBox.
- populate u-boot,bootconf under /chosen, see
  https://github.com/devicetree-org/dt-schema/pull/71 for corresponding
  change

2 years agofs: Allow to compile FS_BTRFS when SPL is enabled
Pali Rohár [Thu, 7 Apr 2022 12:53:25 +0000 (14:53 +0200)]
fs: Allow to compile FS_BTRFS when SPL is enabled

Currently there is no btrfs support in SPL. But macro CONFIG_FS_BTRFS is
defined also when building SPL. When both FS_BTRFS and SPL are enabled
then build process throw compile error.

Fix check for btrfs code in fstypes[] to allow compiling FS_BTRFS only in
proper U-Boot.

Signed-off-by: Pali Rohár <pali@kernel.org>
2 years agobtrfs: Fix compilation on big endian systems
Pali Rohár [Thu, 7 Apr 2022 12:51:03 +0000 (14:51 +0200)]
btrfs: Fix compilation on big endian systems

Fix following two compile errors on big endian systems:

  CC      fs/btrfs/btrfs.o
In file included from include/linux/byteorder/big_endian.h:107,
                 from ./arch/powerpc/include/asm/byteorder.h:82,
                 from ./arch/powerpc/include/asm/bitops.h:8,
                 from include/linux/bitops.h:152,
                 from include/uuid.h:9,
                 from fs/btrfs/btrfs.c:10:
fs/btrfs/conv-funcs.h: In function ‘btrfs_key_to_disk’:
include/linux/byteorder/generic.h:90:21: error: ‘__cpu_to_le16’ undeclared (first use in this function); did you mean ‘__cpu_to_le16p’?
 #define cpu_to_le16 __cpu_to_le16
                     ^~~~~~~~~~~~~
fs/btrfs/conv-funcs.h:79:10: note: in expansion of macro ‘cpu_to_le16’
   __u16: cpu_to_le16,     \
          ^~~~~~~~~~~

  CC      fs/btrfs/compression.o
In file included from ./arch/powerpc/include/asm/unaligned.h:9,
                 from fs/btrfs/compression.c:16:
include/linux/unaligned/access_ok.h:6:19: error: redefinition of ‘get_unaligned_le16’
 static inline u16 get_unaligned_le16(const void *p)
                   ^~~~~~~~~~~~~~~~~~
In file included from fs/btrfs/ctree.h:16,
                 from fs/btrfs/btrfs.h:12,
                 from fs/btrfs/compression.c:8:
include/linux/unaligned/le_byteshift.h:40:19: note: previous definition of ‘get_unaligned_le16’ was here
 static inline u16 get_unaligned_le16(const void *p)
                   ^~~~~~~~~~~~~~~~~~

Include file asm/unaligned.h contains arch specific macros and functions
for unaligned access as opposite to linux/unaligned le_byteshift.h which
contains macros and functions specific to little endian systems only.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Qu Wenruo <wqu@suse.com>
2 years agoIOMUX: Fix access past end of console_devices
Sean Anderson [Wed, 6 Apr 2022 18:36:35 +0000 (14:36 -0400)]
IOMUX: Fix access past end of console_devices

We should only access console_devices[file][i] once we have checked that i
< cd_count[file]. Otherwise, we will access uninitialized memory at the end
of the loop. console_devices[file][i] should not be NULL, but putting the
assignment in the loop condition allows us to ensure that i is checked
beforehand. This isn't a bug, but it does make valgrind stop complaining.

Fixes: 400797cad3 ("IOMUX: Split out for_each_console_dev() helper macro")
Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Andrew Scull <ascull@google.com>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2 years agoConvert CONFIG_SYS_MEM_TOP_HIDE to Kconfig
Tom Rini [Wed, 6 Apr 2022 14:33:32 +0000 (10:33 -0400)]
Convert CONFIG_SYS_MEM_TOP_HIDE to Kconfig

This converts the following to Kconfig:
   CONFIG_SYS_MEM_TOP_HIDE

Signed-off-by: Tom Rini <trini@konsulko.com>
2 years agotools: add boot/ to .gitignore
Du Huanpeng [Thu, 7 Apr 2022 09:37:49 +0000 (17:37 +0800)]
tools: add boot/ to .gitignore

/tools/boot/ is a build product. Add it to .gitignore

Signed-off-by: Du Huanpeng <dhu@hodcarrier.org>
2 years agofs/squashfs: simplify sqfs_read()
Heinrich Schuchardt [Mon, 11 Apr 2022 20:54:44 +0000 (22:54 +0200)]
fs/squashfs: simplify sqfs_read()

* Don't check argument of free(). Free does this itself.
* Reduce scope of data_buffer. Remove duplicate free().
* Avoid superfluous NULL assignment.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
2 years agoimage-fit: don't check free() argument
Heinrich Schuchardt [Mon, 11 Apr 2022 18:08:03 +0000 (20:08 +0200)]
image-fit: don't check free() argument

* free() checks if its argument is NULL. Remove duplicate checks.
* Remove duplicate free(ovcopy).

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2 years agogpio: aspeed: Fix incorrect offset of read back register.
Billy Tsai [Wed, 13 Apr 2022 05:34:51 +0000 (13:34 +0800)]
gpio: aspeed: Fix incorrect offset of read back register.

The offset of the current read back register is the value of the gpio pin,
not the value written for the gpio output.
This patch fix it to avoid the other gpio output value controlled by the
same register being set incorrectly.

Fixes: 7ad889b0f37a ("gpio: Add Aspeed GPIO driver")
Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
2 years agoconfigs: Enable EXT4 and ISO partitions for the DeveloperBox
Ilias Apalodimas [Tue, 12 Apr 2022 21:16:44 +0000 (00:16 +0300)]
configs: Enable EXT4 and ISO partitions for the DeveloperBox

Since this box is SystemReady compliant enable ISO_PARTITION which is
needed to start some installers (e.g Fedora).  While at it enable EXT4
as well which is a common filesystem for targets

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Acked-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
2 years ago.mailmap: Start to use new amd.com email address
Michal Simek [Thu, 14 Apr 2022 13:50:46 +0000 (15:50 +0200)]
.mailmap: Start to use new amd.com email address

Xilinx has been acquired by AMD that's why emails should be also updated.
The patch is updating .mailmap file and also MAINTAINERS files as was done
by commit 5cd1ecb99490 ("ppc: qemu: Update MAINTAINERS for correct email
address").
The rest of my emails are not going to change.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
2 years agoimage-fdt: save name of FIT configuration in '/chosen' node
Daniel Golle [Tue, 12 Apr 2022 20:00:43 +0000 (21:00 +0100)]
image-fdt: save name of FIT configuration in '/chosen' node

It can be useful for the OS (Linux) to know which configuration has
been chosen by U-Boot when launching a FIT image.
Store the name of the FIT configuration node used in a new string
property called 'u-boot,bootconf' in the '/chosen' node in device tree.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2 years agoMerge tag 'u-boot-rockchip-20220418' of https://source.denx.de/u-boot/custodians...
Tom Rini [Tue, 19 Apr 2022 12:50:23 +0000 (08:50 -0400)]
Merge tag 'u-boot-rockchip-20220418' of https://source.denx.de/u-boot/custodians/u-boot-rockchip

- Add rk3066 SoC support;
- Add rk3066 MK808 board support;
- dts sync from kernel for rk322x, rk3288;
- some other board level config update;

2 years agoMerge branch '2022-04-18-dm-reducing-spl-memory-usage'
Tom Rini [Tue, 19 Apr 2022 12:14:15 +0000 (08:14 -0400)]
Merge branch '2022-04-18-dm-reducing-spl-memory-usage'

- Assorted DM cleanups from Simon.  This results in some noticeable
  binary size savings in SPL.

2 years agodm: core: Deal with a wrinkle with linker lists
Simon Glass [Sun, 27 Mar 2022 20:26:20 +0000 (14:26 -0600)]
dm: core: Deal with a wrinkle with linker lists

When every member of a linker list is aligned by the compiler, we can no
longer rely on the sizeof of the struct to determine the number of
entries.

For example, if the struct size is 0x90 but every entry is aligned to 0xa0
by the compiler, the linker list entries takes more space in memory and
the calculation of the number of entries is incorrect. For example, we may
see 0x12 entries when there are only 0x11.

This is a real problem. There may be a general solution, although I cannot
currently think of one. So far it only bites with OF_PLATDATA_RT which
creates a pointer to each entry of the 'struct udevice' linker_list. This
does not happen without that option, so it only affects SPL.

Work around it by manually calculating the aligned size of struct udevice,
then using that for the n_ent calculation.

Note: the alignment fix to linker list was here:

   0b2fa98aa5e linker_lists: Fix alignment issue

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agodm: core: Allow devres to be disabled in SPL
Simon Glass [Sun, 27 Mar 2022 20:26:19 +0000 (14:26 -0600)]
dm: core: Allow devres to be disabled in SPL

At present if devres is enabled in U-Boot proper it is enabled in SPL.
We don't normally want it there, so disable it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Angus Ainslie <angus@akkea.ca>
2 years agosandbox: Align linker lists to a 32-byte boundary
Simon Glass [Sun, 27 Mar 2022 20:26:18 +0000 (14:26 -0600)]
sandbox: Align linker lists to a 32-byte boundary

Use this larger boundary to ensure that linker lists at least start on the
maximum possible alignment boundary. See also the CONFIG_LINKER_LIST_ALIGN
setting, but that is host-arch-specific, so it seems better to use the
largest value for every host architecture.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agosandbox: Allow link flags to be given
Simon Glass [Sun, 27 Mar 2022 20:26:17 +0000 (14:26 -0600)]
sandbox: Allow link flags to be given

At present the link flags are not used for sandbox. Update the command
line to use them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoMakefile: Avoid resetting link flags in config.mk
Simon Glass [Sun, 27 Mar 2022 20:26:16 +0000 (14:26 -0600)]
Makefile: Avoid resetting link flags in config.mk

This makes it impossible to change them elsewhere. The default value is
'empty' anyway, so just drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agoMakefile: Drop a stale comment about linking
Simon Glass [Sun, 27 Mar 2022 20:26:15 +0000 (14:26 -0600)]
Makefile: Drop a stale comment about linking

The bug mentioned here is fixed, so drop the comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agosandbox: Correct loss of early output in SPL
Simon Glass [Sun, 27 Mar 2022 20:26:14 +0000 (14:26 -0600)]
sandbox: Correct loss of early output in SPL

At present fputc() is used before the console is available, then write()
is used. These are not compatible. Since fputc() buffers internally it is
better to use the write(), so that a partial line is immediately
displayed.

This has a slight effect on performance, but we are already using write()
for the vast majority of the output with no obvious impacts.

Signed-off-by: Simon Glass <sjg@chromium.org>
2 years agorockchip: video: mipi: add more compatible strings for rk3288/rk3399
Johan Jonker [Sat, 16 Apr 2022 08:25:16 +0000 (10:25 +0200)]
rockchip: video: mipi: add more compatible strings for rk3288/rk3399

The rk3288/RK3399 DT synced from Linux contains some different
compatible strings in the mipi node then origanal used in U-boot.
Allow both options to be backwards compatible and to be able
to handle recent rk3288.dtsi and rk3399.dtsi files.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: video: rk_edp: add more rk3288 edp node options
Johan Jonker [Sat, 16 Apr 2022 07:45:56 +0000 (09:45 +0200)]
rockchip: video: rk_edp: add more rk3288 edp node options

The rk3288 DT synced from Linux contains some different
properties in the edp node then origanal used in U-boot.
Allow both options to be backwards compatible and to be able
to handle recent rk3288.dtsi files.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoboard: rk3288: add more DT files to MAINTAINERS
Johan Jonker [Fri, 15 Apr 2022 21:21:45 +0000 (23:21 +0200)]
board: rk3288: add more DT files to MAINTAINERS

A number of rk3229/rk3288 DT files are synced from Linux.
Add a maintainer to look after them and to help with
review and testing.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoboard: google: veyron: add more DT files to MAINTAINERS
Johan Jonker [Fri, 15 Apr 2022 21:21:44 +0000 (23:21 +0200)]
board: google: veyron: add more DT files to MAINTAINERS

The Google Veyron rk3288 DT files are synced from Linux.
Add a maintainer to look after them and to help with
review and testing.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: fix boot_devices constants
Johan Jonker [Fri, 15 Apr 2022 21:21:43 +0000 (23:21 +0200)]
rockchip: fix boot_devices constants

The DT node name pattern in mmc-controller.yaml for mmc
is "^mmc(@.*)?$". The Rockchip mmc nodes have been synced
with Linux, so update the boot_devices constants as well.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoarm: dts: rockchip: move all rk3288 u-boot specific properties in separate dtsi files
Johan Jonker [Fri, 15 Apr 2022 21:21:39 +0000 (23:21 +0200)]
arm: dts: rockchip: move all rk3288 u-boot specific properties in separate dtsi files

In order to sync rk3288.dtsi from Linux it needed to
move all u-boot specific properties in separate dtsi files.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: rk3288-cru: sync the clock dt-binding header from Linux
Johan Jonker [Fri, 15 Apr 2022 21:21:38 +0000 (23:21 +0200)]
rockchip: rk3288-cru: sync the clock dt-binding header from Linux

In order to update the DT for rk3288
sync the clock dt-binding header.
This is the state as of v5.17 in Linux.
Keep SCLK_MAC_PLL in use for rk3288 clock driver.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: rk3288-power: sync power domain dt-binding header from Linux
Johan Jonker [Fri, 15 Apr 2022 21:21:37 +0000 (23:21 +0200)]
rockchip: rk3288-power: sync power domain dt-binding header from Linux

In order to update the DT for rk3288
sync the power domain dt-binding header.
This is the state as of v5.17 in Linux.
Change location to be more in line with other SoCs.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoarm: dts: rockchip: sync rk3229-evb.dts from Linux
Johan Jonker [Fri, 15 Apr 2022 21:21:36 +0000 (23:21 +0200)]
arm: dts: rockchip: sync rk3229-evb.dts from Linux

Sync rk3229-evb.dts from Linux version 5.17.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoarm: dts: rockchip: sync rk322x.dtsi from Linux
Johan Jonker [Fri, 15 Apr 2022 21:21:35 +0000 (23:21 +0200)]
arm: dts: rockchip: sync rk322x.dtsi from Linux

Sync rk322x.dtsi from Linux version 5.17.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoarm: dts: rockchip: move all rk322x u-boot specific properties in separate dtsi files
Johan Jonker [Fri, 15 Apr 2022 21:21:34 +0000 (23:21 +0200)]
arm: dts: rockchip: move all rk322x u-boot specific properties in separate dtsi files

In order to sync rk322x.dtsi from Linux, move all
U-boot specific properties in separate dtsi files.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: rk3228-cru: sync the clock dt-binding header from Linux
Johan Jonker [Fri, 15 Apr 2022 21:21:33 +0000 (23:21 +0200)]
rockchip: rk3228-cru: sync the clock dt-binding header from Linux

In order to update the DT for rk3228
sync the clock dt-binding header.
This is the state as of v5.17 in Linux.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: rk3228-power: sync power domain dt-binding header from Linux
Johan Jonker [Fri, 15 Apr 2022 21:21:32 +0000 (23:21 +0200)]
rockchip: rk3228-power: sync power domain dt-binding header from Linux

In order to update the DT for rk3228
sync the power domain dt-binding header.
This is the state as of v5.17 in Linux.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agodoc: rockchip: add rk3066 Rikomagic MK808
Johan Jonker [Sat, 16 Apr 2022 15:09:52 +0000 (17:09 +0200)]
doc: rockchip: add rk3066 Rikomagic MK808

Add rk3066 Rikomagic MK808 to the list of
mainline supported Rockchip boards.
Include instructions for creating and programming
images to NAND and SD card.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agodoc: rockchip: add px30/rk3326 boards and examples
Johan Jonker [Sat, 16 Apr 2022 15:09:51 +0000 (17:09 +0200)]
doc: rockchip: add px30/rk3326 boards and examples

There are several PX30/RK3326 boards in use without
mentioning in rockchip.rst. Add boards and examples.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agodoc: rockchip: restyle rockchip.rst
Johan Jonker [Sat, 16 Apr 2022 15:09:50 +0000 (17:09 +0200)]
doc: rockchip: restyle rockchip.rst

With more text coming to the rockchip.rst document,
give it a restyle first.

Changed:
  sort build examples alphabetically
  add git clone example
  fix bash examples
  fix phrases (grammer)
  fix typos

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: rk3066: add mk808_defconfig
Johan Jonker [Sat, 16 Apr 2022 15:09:49 +0000 (17:09 +0200)]
rockchip: rk3066: add mk808_defconfig

This commit adds the default configuration file and
relevant description for a MK808 board.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: rk3066: add Rikomagic MK808 board
Johan Jonker [Sat, 16 Apr 2022 15:09:48 +0000 (17:09 +0200)]
rockchip: rk3066: add Rikomagic MK808 board

MK808 is a RK3066-based board with 1 USB host and 1 USB OTG port,
HDMI and a micro-SD card slot. It also includes on-board NAND
and 1GB of SDRAM.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: rk3066: add core support
Johan Jonker [Sat, 16 Apr 2022 15:09:47 +0000 (17:09 +0200)]
rockchip: rk3066: add core support

Add the core architecture code for the rk3066.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agorockchip: tools: add rk3066 support to rkcommon.c
Johan Jonker [Sat, 16 Apr 2022 15:09:46 +0000 (17:09 +0200)]
rockchip: tools: add rk3066 support to rkcommon.c

Add rk3066 support to rkcommon.c

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoarm: dts: rockchip: add rk3066a-mk808.dts
Johan Jonker [Sat, 16 Apr 2022 15:09:45 +0000 (17:09 +0200)]
arm: dts: rockchip: add rk3066a-mk808.dts

MK808 is a RK3066-based board with 1 USB host and 1 USB OTG port,
HDMI and a micro-SD card slot. It also includes on-board NAND
and 1GB of SDRAM. Add rk3066a-mk808.dts. Move U-boot specific
things in a rk3066a-mk808-u-boot.dtsi file.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2 years agoarm: dts: rockchip: add rk3066a.dtsi
Johan Jonker [Sat, 16 Apr 2022 15:09:44 +0000 (17:09 +0200)]
arm: dts: rockchip: add rk3066a.dtsi

In the Linux DT the file rk3xxx.dtsi is shared between
rk3066 and rk3188. Add rk3066a.dtsi. Move U-boot specific
things in a rk3066a-u-boot.dtsi file.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>