platform/kernel/u-boot.git
4 years agoarch/arm/Makefile: sort machine names
Trevor Woerner [Wed, 6 May 2020 12:02:37 +0000 (08:02 -0400)]
arch/arm/Makefile: sort machine names

The comment immediately above the block of machine directory names implored
users to keep the macro names sorted, but, alas, this is no longer the case.

Put the list of machine directory names back in alphanumerical order by
CONFIG_* macro name, as the comment asks. Sort all the symbols as though they
all followed the convention of having the string "ARCH_" in the middle of
their definitions.

Signed-off-by: Trevor Woerner <twoerner@gmail.com>
4 years agoarm: lpc32xx: move SoC to mach-lpc32xx
Trevor Woerner [Wed, 6 May 2020 12:02:36 +0000 (08:02 -0400)]
arm: lpc32xx: move SoC to mach-lpc32xx

Following the example of most other SoCs in arch/$(ARCH)/cpu/$(CPU)/$(SOC)
move the lpc32xx code from arch/arm/cpu/arm926ejs/lpc32xx to
arch/arm/mach-lpc32xx.

Following the checklist from
commit 01f14456306c ("ARM: prepare for moving SoC sources into mach-*"):

    [1] move files from arch/arm/cpu/arm926ejs/lpc32xx to arch/arm/mach-lpx32xx
    [2] add machine entry to arch/arm/Makefile
    [3] remove "obj-y += ..." from arch/arm/cpu/arm926ejs/Makefile
    [4] fix the Kconfig file path in arch/arm/Kconfig
    [5] (no MAINTAINERS update)

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Trevor Woerner <twoerner@gmail.com>
4 years agorsa: don't use malloc.h in rsa-sign.c
Jonathan Gray [Fri, 15 May 2020 12:20:34 +0000 (22:20 +1000)]
rsa: don't use malloc.h in rsa-sign.c

stdlib.h is the header for malloc since at least c89/c90.
There is no system malloc.h on OpenBSD and trying to use malloc.h here
falls back to the U-Boot malloc.h breaking the build of qemu_arm64.

Fixes: 336d4615f8 ("dm: core: Create a new header file for 'compat' features")
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
4 years agoconfigs: mt7629: support usb host and udisk
Chunfeng Yun [Thu, 14 May 2020 05:56:19 +0000 (13:56 +0800)]
configs: mt7629: support usb host and udisk

Enable modules to support download image from usb

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
4 years agoMakefile: remove m68k GCC 3.4 workaround
Masahiro Yamada [Thu, 14 May 2020 02:38:20 +0000 (11:38 +0900)]
Makefile: remove m68k GCC 3.4 workaround

This code dates back to 2006, commit 483a0cf804df ("Fixes for gcc 3.4
based m68k toolchain,").

GCC 3.4 is so old. We do not support it.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
4 years agolib: Allow MD5 to be enabled in SPL
Simon Glass [Wed, 6 May 2020 14:03:56 +0000 (08:03 -0600)]
lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agopci: Fix typo in definition for PCI_DEV
Simon Glass [Sun, 10 May 2020 16:26:54 +0000 (10:26 -0600)]
pci: Fix typo in definition for PCI_DEV

Fix a typo in the comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agousb: Update struct usb_device to indicate speed enum
Simon Glass [Sun, 10 May 2020 16:26:53 +0000 (10:26 -0600)]
usb: Update struct usb_device to indicate speed enum

The speed member actually uses an enum, so add this to the comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
4 years agokbuild: spl: Add shrunk arch-dtbs to targets list
Jan Kiszka [Mon, 4 May 2020 12:38:31 +0000 (14:38 +0200)]
kbuild: spl: Add shrunk arch-dtbs to targets list

This avoids needless rebuilding.

Fixes: 2f57c95100f2 ("spl: dm: Make it possible for the SPL to pick its own DTB from a FIT")
CC: Jean-Jacques Hiblot <jjhiblot@ti.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
4 years agokbuild: spl: Fix parallel build
Jan Kiszka [Mon, 4 May 2020 12:38:30 +0000 (14:38 +0200)]
kbuild: spl: Fix parallel build

The dts dir must exists when running this rule.

That missing dependency broke e.g. "make -j" for the am65x targets.

Fixes: 2f57c95100f2 ("spl: dm: Make it possible for the SPL to pick its own DTB from a FIT")
CC: Jean-Jacques Hiblot <jjhiblot@ti.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
4 years agoMerge tag 'u-boot-stm32-20200514' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm
Tom Rini [Thu, 14 May 2020 12:44:06 +0000 (08:44 -0400)]
Merge tag 'u-boot-stm32-20200514' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm

- stm32mp1: migrate MTD and DFU configuration in Kconfig
- stm32mp1: add command stm32prog
- stm32mp1: several board and arch updates
- stm32mp1: activate data cache in SPL and before relocation
- Many improvment for AV96 board and DHCOR SoM
  (add new defconfig, DDR3 coding on DHCOR SoM, split between board and SOM
   Synchronize DDR setttings on DH SoMs, setting for I2C EEPROM)
- clk: stm32mp1: fix CK_MPU calculation
- DT alignment of stm32mp1 device tree with Linux 5.7-rc2

4 years agoMerge tag 'rpi-next-2020.07' of https://gitlab.denx.de/u-boot/custodians/u-boot-raspb...
Tom Rini [Thu, 14 May 2020 12:43:33 +0000 (08:43 -0400)]
Merge tag 'rpi-next-2020.07' of https://gitlab.denx.de/u-boot/custodians/u-boot-raspberrypi

- fix phy configuration for RPi4's bcmgenet
- sync RPi4's env size with other RPi configs
- add kconfig option to reserver more pages in the EFI mem map
- add support for SDMA which is used by RPi4
- fix corner case boot bug for RPi3 32-bit

4 years agoARM: dts: stm32mp1: DT alignment with Linux 5.7-rc2
Patrick Delaunay [Thu, 30 Apr 2020 13:52:46 +0000 (15:52 +0200)]
ARM: dts: stm32mp1: DT alignment with Linux 5.7-rc2

DT alignment with Linux 5.7-rc2, including the kernel commits

431c89e6f323 ARM: dts: stm32: use correct vqmmc regu for eMMC on stm32mp1 ED1/EV1 boards
79e965053872 ARM: dts: stm32: add disable-wp property for SD-card on STM32MP1 boards
877db62ea516 ARM: dts: stm32: add cd-gpios properties for SD-cards on STM32MP1 boards
7519e95ba5f8 ARM: dts: stm32: Do clean up in stmpic nodes on stm32mp15 boards
f68e2dbc591a ARM: dts: stm32: Rename stmfx joystick pins on stm32mp157c-ev1
d6210da4f8bf ARM: dts: stm32: add cpu clock-frequency property on stm32mp15x
b65b6fc56925 ARM: dts: stm32: add wakeup-source in all I2C nodes of stm32mp157c
1c1cf5996cfb ARM: dts: stm32: add i2c4 sleep pinctrl on stm32mp157c-ed1
bef15fc0fad9 ARM: dts: stm32: add i2c2/i2c5 sleep pinctrl on stm32mp157c-ev1
b7fc0a87b9ac ARM: dts: stm32: add i2c4 sleep pinctrl on stm32mp15xx-dkx
a5e557655285 ARM: dts: stm32: set i2c4 bus freq to 400KHz on stm32mp15 DK boards
8bc631b650a6 ARM: dts: stm32: set i2c4 bus freq to 400KHz on stm32mp157c-ed1
fccd6a577bb3 ARM: dts: stm32: Correct stmfx node name on stm32mp157c-ev1 board
cc775a83db65 ARM: dts: stm32: add resets property on all DMA nodes on stm32mp151
c5fae093511b ARM: dts: stm32: enable USB OTG Dual Role on stm32mp157c-ev1
9879e2165758 ARM: dts: stm32: add USB OTG pinctrl to stm32mp15
82ac8a81f985 ARM: dts: stm32: add USB OTG full support on stm32mp151
8714b26e2863 ARM: dts: stm32: remove useless properties in stm32mp157a-avenger96 stmpic node
a7959919709e ARM: dts: stm32: Add UART8 pins A pinmux entry on stm32mp1
4d7c53a684da ARM: dts: stm32: Add USART3 pins A pinmux entry on stm32mp1
80ab128332ee ARM: dts: stm32: Add SAI2A pins B pinmux entry on stm32mp1
ab7f98c0c546 ARM: dts: stm32: Add Ethernet0 RMII pins A pinmux entry on stm32mp1

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agoclk: stm32mp1: fix CK_MPU calculation
Lionel Debieve [Fri, 24 Apr 2020 13:47:57 +0000 (15:47 +0200)]
clk: stm32mp1: fix CK_MPU calculation

When the CK_MPU used PLL1_MPUDIV, the current rate is
wrong. The clock must use stm32mp1_mpu_div as a shift
value. Fix the check value used to enter PLL_MPUDIV.

Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agommc: stm32_sdmmc2: change the displayed config name
Patrick Delaunay [Thu, 30 Apr 2020 07:52:13 +0000 (09:52 +0200)]
mmc: stm32_sdmmc2: change the displayed config name

Change the mmc displayed name in U-Boot for stm32_sdmmc2 driver to
“STM32 SD/MMC”.

This stm32_sdmmc2 driver is for version 2 of the ST HW IP SDMMC but the
displayed name "STM32 SDMMC2" is confusing for user, between the
instance of SDMMC and the device identifier of MMC.

For example on EV1 board, we have:

STM32MP1> mmc list
 STM32 SDMMC2: 0 (SD)
 STM32 SDMMC2: 1 (eMMC)

Changed to more clear:

STM32MP1> mmc list
 STM32 SD/MMC: 0 (SD)
 STM32 SD/MMC: 1 (eMMC)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agoarm: stm32mp: activate data cache on DDR in SPL
Patrick Delaunay [Thu, 30 Apr 2020 14:30:21 +0000 (16:30 +0200)]
arm: stm32mp: activate data cache on DDR in SPL

Activate cache on DDR to improve the accesses to DDR used by SPL:
- CONFIG_SPL_BSS_START_ADDR
- CONFIG_SYS_SPL_MALLOC_START

Cache is configured only when DDR is fully initialized,
to avoid speculative access and issue in get_ram_size().
Data cache is deactivated at the end of SPL, to flush the data cache
and the TLB.

Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoarm: stm32mp: activate data cache in SPL and before relocation
Patrick Delaunay [Thu, 30 Apr 2020 14:30:20 +0000 (16:30 +0200)]
arm: stm32mp: activate data cache in SPL and before relocation

Activate the data cache in SPL and in U-Boot before relocation.

In arch_cpu_init(), the function early_enable_caches() sets the early
TLB, early_tlb[] located .init section, and set cacheable:
- for SPL, all the SYSRAM
- for U-Boot, all the DDR

After relocation, the function enable_caches() (called by board_r)
reconfigures the MMU with new TLB location (reserved in
board_f.c::reserve_mmu) and re-enable the data cache.

This patch allows to reduce the execution time, particularly
- for the device tree parsing in U-Boot pre-reloc stage
  (dm_extended_scan_fd =>dm_scan_fdt)
- in I2C timing computation in SPL (stm32_i2c_choose_solution())

For example, the result on STM32MP157C-DK2 board is:
   1,6s gain for trusted boot chain with TF-A
   2,2s gain for basic boot chain with SPL

For information, as TLB is added in .data section, the binary size
increased and the SPL load time by ROM code increased (30ms on DK2).

But early malloc can't be used for TLB because arch_cpu_init()
is executed before the early poll initialization done in spl_common_init()
called by spl_early_init() So it too late for this use case.
And if I initialize the MMU and the cache after this function it is
too late, as dm_init_and_scan and fdt parsing is also called in
spl_common_init().

And .BSS can be used in board_init_f(): only stack and global can use
before BSS init done in board_init_r().

So .data is the better solution without hardcoded location but if you
have size issue for SPL you can deactivate cache for SPL only
(with CONFIG_SPL_SYS_DCACHE_OFF).

Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoARM: stm32: Hog GPIO PF7 high on DHCOM to unlock SPI NOR nWP
Marek Vasut [Mon, 27 Apr 2020 10:26:43 +0000 (12:26 +0200)]
ARM: stm32: Hog GPIO PF7 high on DHCOM to unlock SPI NOR nWP

The SPI NOR nWP line is connected to GPIO PF7 on the SoM,
pull the GPIO line high by default to clear SPI NOR WP.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoARM: stm32: Define I2C EEPROM bus and address on DHCOM
Marek Vasut [Mon, 27 Apr 2020 10:26:42 +0000 (12:26 +0200)]
ARM: stm32: Define I2C EEPROM bus and address on DHCOM

Define I2C EEPROM bus and address, so that the 'eeprom' command uses
the correct ones and does not generate the following error:
    eeprom_rw_block: Cannot find udev for a bus 0

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoARM: dts: stm32: Synchronize DDR setttings on DH SoMs
Marek Vasut [Wed, 29 Apr 2020 13:08:38 +0000 (15:08 +0200)]
ARM: dts: stm32: Synchronize DDR setttings on DH SoMs

Add custom DDR DRAM settings for the DHCOR and DHCOM SoMs and put them
into use by the board file instead of the default ones. These new DRAM
settings are a better fit for the SoMs.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoARM: dts: stm32: Fix AV96 and DHCOR split
Marek Vasut [Mon, 27 Apr 2020 11:16:02 +0000 (13:16 +0200)]
ARM: dts: stm32: Fix AV96 and DHCOR split

The commit 132e5b68986d ("ARM: dts: stm32: Split AV96 into DHCOR SoM
and AV96 board") was not applied correctly and in full, and omitted
an important split of the SoM into 3V3 and 1V8 options. The Avenger96
board is based on the 1V8 IO option of the DHCOR SoM, however this is
an optional modification of the 3V3 IO DHCOR SoM with extra on-SoM
regulator to cater for the 96boards 1V8 IO requirements.

Reinstate the split between the 1V8 and 3V3 IO variants.

Fixes: 132e5b68986d ("ARM: dts: stm32: Split AV96 into DHCOR SoM and AV96 board")
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agostm32mp1: Fix warning display when 1.5A power supply is used
Patrice Chotard [Thu, 30 Apr 2020 16:41:05 +0000 (18:41 +0200)]
stm32mp1: Fix warning display when 1.5A power supply is used

On DK1/2 board, when a 1.5A power supply is detected, a warning
message is displayed. In this message, "1.5mA" is displayed instead
of "1.5A".

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoconfigs: stm32mp1: activate CONFIG_ERRNO_STR
Patrick Delaunay [Wed, 22 Apr 2020 12:29:20 +0000 (14:29 +0200)]
configs: stm32mp1: activate CONFIG_ERRNO_STR

Add support of errno_str, used in command pmic and regulator.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agoconfigs: stm32mp1: activate Ethernet PHY Realtek
Christophe Roullier [Wed, 22 Apr 2020 12:29:19 +0000 (14:29 +0200)]
configs: stm32mp1: activate Ethernet PHY Realtek

Need Realtek driver to manage in RTL8211F the configuration of the LED.
Initialize LCR (LED Control Register) to configure green LED for Link,
yellow LED for Active

Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Christophe Roullier <christophe.roullier@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoARM: dts: stm32mp15: use DDR3 files generated by STM32CubeMX
Patrick Delaunay [Wed, 22 Apr 2020 12:29:18 +0000 (14:29 +0200)]
ARM: dts: stm32mp15: use DDR3 files generated by STM32CubeMX

Use the DDR3 dtsi files generated by STM32CubeMX 5.6.0
Speed Bin Grade = using DDR3-1066G / 8-8-8 and all others
parameters at default value.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agogpio: stm32: support gpio ops in SPL
Patrick Delaunay [Wed, 22 Apr 2020 12:29:17 +0000 (14:29 +0200)]
gpio: stm32: support gpio ops in SPL

The GPIO support is needed in SPL to managed the SD cart detect
used on stm32mp157c-ev1 and dk2 board.
So this patch activates the associated code in stm32_gpio.c.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agoboard: stm32mp1: add timeout for I/O compensation ready
Patrick Delaunay [Wed, 22 Apr 2020 12:29:16 +0000 (14:29 +0200)]
board: stm32mp1: add timeout for I/O compensation ready

This patch avoids infinite loop when I/O compensation failed,
it adds a 1s timeout to detect error.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agoboard: stm32mp1: remove bootdelay configuration for usb or serial boot
Patrick Delaunay [Wed, 22 Apr 2020 12:29:15 +0000 (14:29 +0200)]
board: stm32mp1: remove bootdelay configuration for usb or serial boot

It is not allowed to change the user setting of bootdelay, so
remove the check of the boot-source to disable it dynamically
in board_late_init()

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoboard: stm32mp1: set environment variable fdtfile
Patrick Delaunay [Wed, 22 Apr 2020 12:29:14 +0000 (14:29 +0200)]
board: stm32mp1: set environment variable fdtfile

For booting Linux in the generic distro mechanism and support of
FDTDIR in extlinux.conf , cmd/pxe.c retrieves the FDT file name
from "fdtfile" environment variable.

Dynamically build this variable with compatible of STMicroelectronics
boards.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agoboard: stm32mp1: gt9147 IRQ before reset on EV1
Patrick Delaunay [Wed, 22 Apr 2020 12:29:13 +0000 (14:29 +0200)]
board: stm32mp1: gt9147 IRQ before reset on EV1

Software workaround for I2C issue on EV1 board,
configure the IRQ line for touchscreen before LCD reset
to fix the used I2C address.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agoboard: stm32mp1: update management of boot-led
Patrick Delaunay [Wed, 22 Apr 2020 12:29:12 +0000 (14:29 +0200)]
board: stm32mp1: update management of boot-led

Force boot-led ON and no more rely on default-state.
This patch avoid device-tree modification for U-Boot.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoboard: stm32mp1: Keep error led ON in case of low power detection
Patrice Chotard [Wed, 22 Apr 2020 12:29:11 +0000 (14:29 +0200)]
board: stm32mp1: Keep error led ON in case of low power detection

Since commit commit dd2810851eb1 ("stm32mp1: board: support of
error led on ed1/ev1 board") the attended behavior was no more
respected in case of low power source detection on DK2.

The expected behavior is either the error LED keeps blinking for ever,
or blinks 2 or 3 times and must stay ON.

Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoarm: stm32mp: spl: update error management in board_init_f
Patrick Delaunay [Wed, 22 Apr 2020 12:29:10 +0000 (14:29 +0200)]
arm: stm32mp: spl: update error management in board_init_f

Call hang when an error is detected for probe of any driver
needed for console or DDR init: clk, reset and pincontrol

NB: previous behavior with a return in board_init_f() was not correct;
    DDR is not initialized and SPL execution can't continue

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoarm: stm32mp: remove dependency for STM32KEY
Patrick Delaunay [Wed, 22 Apr 2020 12:29:09 +0000 (14:29 +0200)]
arm: stm32mp: remove dependency for STM32KEY

This command is not more depending on fuse command, but have
direct access to BSEC misc driver, so the dependency with
can be removed CMD_FUSE

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agostm32mp: stm32prog: add support of RAM target
Patrick Delaunay [Wed, 18 Mar 2020 08:25:03 +0000 (09:25 +0100)]
stm32mp: stm32prog: add support of RAM target

Add support of RAM target in flashlayout to load kernel image
("system") and device tree ("filesystem") in DDR with DFU and
start these images.

The flashlayout.tsv is:

- 0x01 fsbl Binary none 0x00000000 tf-a.stm32
- 0x03 ssbl Binary none 0x00000000 u-boot.stm32
P 0x10 kernel System ram0 0xC2000000 uImage.bin
P 0x11 dtb FileSystem ram0 0xC4000000 dtb.bin

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agostm32mp: stm32prog: support for script
Patrick Delaunay [Wed, 18 Mar 2020 08:25:02 +0000 (09:25 +0100)]
stm32mp: stm32prog: support for script

Support an U-Boot script included in uimage instead of flashlayout file
(text file in tsv format).

This feature is used to execute this script directly when U-Boot is
loaded in DDR (for update without STM32CubeProgrammer for example).

A simple example with dfu-util only is:

$> echo "dfu 0" > script.cmd
$> mkimage -C none -A arm -T script -d script.cmd script.uimg
$> mkimage -T stm32image -a 0xC0000000 -e 0xC0000000 -d script.uimg \
  script.stm32

$> dfu-util -d 0483:df11 -a 1 -D tf-a.stm32
$> dfu-util -d 0483:df11 -a 0 -D script.stm32
$> dfu-util -d 0483:df11 -a 0 -D u-boot.stm32
$> dfu-util -d 0483:df11 -a 0 -e

Then you can used dfu-utils to update your device

To increase speed, you can also switch to fastboot protocol with:
  echo "fastboot 0" > script.cmd

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agostm32mp: stm32prog: enable videoconsole
Patrick Delaunay [Wed, 18 Mar 2020 08:25:01 +0000 (09:25 +0100)]
stm32mp: stm32prog: enable videoconsole

Enable the videoconsole during the stm32prog command execution
to have information without UART.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agostm32mp: stm32prog: add serial link support
Patrick Delaunay [Wed, 18 Mar 2020 08:25:00 +0000 (09:25 +0100)]
stm32mp: stm32prog: add serial link support

Add a support of UART, using the same protocol than MCU STM32.

See "AN5275: USB DFU/USART protocols used in STM32MP1 Series
bootloaders" for details.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agostm32mp: stm32prog: add pmic NVM update support
Patrick Delaunay [Wed, 18 Mar 2020 08:24:59 +0000 (09:24 +0100)]
stm32mp: stm32prog: add pmic NVM update support

Add a virtual partition to update the pmic non volatile memory.
(on ST board, STPMIC1).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agostm32mp: stm32prog: add otp update support
Patrick Delaunay [Wed, 18 Mar 2020 08:24:58 +0000 (09:24 +0100)]
stm32mp: stm32prog: add otp update support

Add a virtual partition to update the STM32MP15x OTP based
on SMC service provided by TF-A.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agostm32mp: stm32prog: add support for delete option in flashlayout
Patrick Delaunay [Wed, 18 Mar 2020 08:24:57 +0000 (09:24 +0100)]
stm32mp: stm32prog: add support for delete option in flashlayout

Add support for delete option 'D' in flashlayout for
full device or for partitions

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agostm32mp: stm32prog: add support of ssbl copy
Patrick Delaunay [Wed, 18 Mar 2020 08:24:56 +0000 (09:24 +0100)]
stm32mp: stm32prog: add support of ssbl copy

For reliability of boot from NAND/SPI-NAND (with read-disturb issue)
the SSBL can be present several time, when it is indicated in the
flashlayout with "Binary(X)".
The received binary is copied X times by U-Boot on the target.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agostm32mp: stm32prog: adapt the MTD partitions
Patrick Delaunay [Wed, 18 Mar 2020 08:24:55 +0000 (09:24 +0100)]
stm32mp: stm32prog: adapt the MTD partitions

Dynamically adapt the MTD partitions in NOR/NAND/SPI-NAND when stm32prog
command detects in the parsed flash layout files:
- a fsbl partition in NOR.
- a tee partition in NOR/NAND/SPI-NAND

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agostm32mp: stm32prog: add MTD devices support
Patrick Delaunay [Wed, 18 Mar 2020 08:24:54 +0000 (09:24 +0100)]
stm32mp: stm32prog: add MTD devices support

Add support of MTD device (DFU_MTD backend) for
NOR, NAND or SPI-NAND target.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agostm32mp: stm32prog: add upport of partial update
Patrick Delaunay [Wed, 18 Mar 2020 08:24:53 +0000 (09:24 +0100)]
stm32mp: stm32prog: add upport of partial update

Add support of partial update, update only some partitions,
and check the coherence of the layout with the existing GPT
partitions (offset and size).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agostm32mp: stm32prog: add support of boot partition for eMMC device
Patrick Delaunay [Wed, 18 Mar 2020 08:24:52 +0000 (09:24 +0100)]
stm32mp: stm32prog: add support of boot partition for eMMC device

Add support of eMMC device boot partition with
part_id = -1 for offset="boot1"
     or = -2 for offset="boot2"

The stm32prog command configures the MMC DFU backend with "mmcpart"
and configure the eMMC (command "mmc bootbus" and "mmc partconf")
when the update is done.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agostm32mp: stm32prog: add MMC device
Patrick Delaunay [Wed, 18 Mar 2020 08:24:51 +0000 (09:24 +0100)]
stm32mp: stm32prog: add MMC device

Add support of MMC device (based on DFU_MMC backend)
for SD card and eMMC update.

Create a GPT partitioning on the device.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agostm32mp: stm32prog: add flash layout parsing
Patrick Delaunay [Wed, 18 Mar 2020 08:24:50 +0000 (09:24 +0100)]
stm32mp: stm32prog: add flash layout parsing

Build the list of device and of partition with
a tab separated value file with a stm32 header: the FlashLayout.tsv
(https://wiki.st.com/stm32mpu/wiki/STM32CubeProgrammer_flashlayout)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agostm32mp: add the command stm32prog
Patrick Delaunay [Wed, 18 Mar 2020 08:24:49 +0000 (09:24 +0100)]
stm32mp: add the command stm32prog

Add a specific command stm32prog for STM32MP soc family
witch allows to program the boot devices with the tool
STM32CubeProgrammer (http://www.st.com/STM32CubeProg).

This command uses the same UART STM32 protocol than MCU
STM32 with or USB with DFU protocol v1.1 (ithe MCU ST
extension are no supported).

The executed actions are based on a tab separated value file
with a stm32 header, the FlashLayout file
(https://wiki.st.com/stm32mpu/wiki/STM32CubeProgrammer_flashlayout).

This file is parsed by the U-Boot command to:
- initialize the devices
- create the partition table on each device
- initialize the DFU backend to access to not volatile memory
  (NOR/NAND/SD/eMMC) or to virtual device (OTP/PMIC)

Up to STM32PROG_MAX_DEV (5) devices can be updated with a FlashLayout.

The communication between U-Boot and STM32CubeProgrammer is done with
the specific alternate configuration (see "AN5275: USB DFU/USART protocols
used in STM32MP1 Series bootloaders" for details).

The command stm32prog is executed when a boot from USB is detected
(selected with bootpins) and we can program the boot devices with
a simple command (on Windows or Linux):

PC $>  STM32_Programmer_CLI -c port=usb1 -w flaslayout.tsv

1/ the ROM code loads TF-A in embedded RAM (DFU or uart)
2/ TF-A loads flashlayout file and U-Boot in DDR (DFU or uart)
3/ U-Boot executes the stm32prog command (DFU or uart)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agostm32mp: add function get_cpu_dev
Patrick Delaunay [Wed, 18 Mar 2020 08:24:48 +0000 (09:24 +0100)]
stm32mp: add function get_cpu_dev

Add a function get_cpu_dev to get the DEV_ID present
in DBGMCU_IDC register.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agodfu: add prototype for dfu_transaction_initiate/cleanup
Patrick Delaunay [Wed, 18 Mar 2020 08:24:47 +0000 (09:24 +0100)]
dfu: add prototype for dfu_transaction_initiate/cleanup

Add prototype for function dfu_transaction_initiate and
dfu_transaction_cleanup to avoid warning with W=1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agousb: gadget: g_dnl: add function g_dnl_set_product
Patrick Delaunay [Wed, 18 Mar 2020 08:24:46 +0000 (09:24 +0100)]
usb: gadget: g_dnl: add function g_dnl_set_product

Add a function g_dnl_set_product to change the Product string used in USB
enumeration in any command based on download gadget.

If the function is called with NULL pointer, the product string is set to
the default value (product[] = "USB download gadget").

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agodoc: stm32mp1: update DFU support example
Patrick Delaunay [Wed, 18 Mar 2020 08:22:54 +0000 (09:22 +0100)]
doc: stm32mp1: update DFU support example

Update stm32mp1 board documentation with new management of MMC and
MTD partitions and new PID df11.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agoboard: stm32mp1: adapt MTD partition for BOOT from NOR or NAND
Patrick Delaunay [Wed, 18 Mar 2020 08:22:53 +0000 (09:22 +0100)]
board: stm32mp1: adapt MTD partition for BOOT from NOR or NAND

Dynamically adapt the MTD partitions in NAND and SPI-NAND when boot from
NOR or NAND/SPI-NAND is detected.

This patch avoids to define the save MTD partition name for NOR and NAND
devices and issue with latest kernel: only the needed MTD partitions
are defined.

For boot from NOR
1/ bootloader (TF-A, U-Boot and OP-TE) in NOR
2/ one large UBI partition in NAND

For boot from NAND
1/ bootloader (TF-A, U-Boot and OP-TE) in MTD raw partition
2/ one large UBI partition

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agoboard: stm32mp1: support boot from spi-nand
Patrick Delaunay [Wed, 18 Mar 2020 08:22:52 +0000 (09:22 +0100)]
board: stm32mp1: support boot from spi-nand

Manage BOOT_FLASH_SPINAND, with boot_device="spi-nand"
and treat this value in bootcmd_stm32mp.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agoconfigs: stm32mp1: remove optee defconfig
Patrick Delaunay [Wed, 18 Mar 2020 08:22:51 +0000 (09:22 +0100)]
configs: stm32mp1: remove optee defconfig

As the op-tee presence is detected by U-boot, the stm32mp15_optee_defconfig
is identical to stm32mp15_trusted_defconfig and can be removed.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agoboard: stm32mp1: use FDT address provided by TF-A at boot time
Patrick Delaunay [Wed, 18 Mar 2020 08:22:50 +0000 (09:22 +0100)]
board: stm32mp1: use FDT address provided by TF-A at boot time

Save and use the FDT address provided by TF-A in r2 at boot time
(it is NT_FW_CONFIG = Non Trusted Firmware configuration file)

Address is saved in save_boot_params(), called by start.S
and the used DTB is gd->fdt_blob = board_fdt_blob_setup().

If dtb is not provided or invalid, U-Boot use as fallback
the builtin DTB.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agostm32mp1: dynamically detect op-tee presence
Patrick Delaunay [Wed, 18 Mar 2020 08:22:49 +0000 (09:22 +0100)]
stm32mp1: dynamically detect op-tee presence

Activate OP-TEE driver for trusted and optee defconfig.

This driver allows detection of TEE presence for boot from flash;
CONFIG_STM32MP1_OPTEE is also removed.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agoboard: stm32mp1: reserve memory for OP-TEE in device tree
Patrick Delaunay [Wed, 18 Mar 2020 08:22:48 +0000 (09:22 +0100)]
board: stm32mp1: reserve memory for OP-TEE in device tree

Add reserve memory for OP-TEE in U-Boot and in kernel device tree:
- no more reduce the DDR size in "memory" node:
  CONFIG_SYS_MEM_TOP_HIDE is no more used
- U-Boot device-tree defines the needed "reserved-memory" for OP-TEE
  and U-Boot should not use this reserved memory: board_get_usable_ram_top
  use lmb lib to found the first free region, the not reserved
  memory, enough to relocate U-Boot: the needed size of U-Boot
  is estimated with gd->mon_len + CONFIG_SYS_MALLOC_LEN.
- the optee node ("optee@...": firmware with compatible "linaro,optee-tz")
  and the associated "reserved-memory" are deactivated in kernel device
  tree when OP-TEE is not detected by U-Boot to prevent kernel issue
  (memory is reserved but not used, optee driver probe failed).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agostm32mp1: move MTDPART configuration in Kconfig
Patrick Delaunay [Wed, 18 Mar 2020 08:22:47 +0000 (09:22 +0100)]
stm32mp1: move MTDPART configuration in Kconfig

This patch reduces the stm32mp1 environment size and builds
dynamically the MTD partitions with information from defconfig
(CONFIG_MTDPARTS_...).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agostm32mp1: dynamically build DFU_ALT_INFO
Patrick Delaunay [Wed, 18 Mar 2020 08:22:46 +0000 (09:22 +0100)]
stm32mp1: dynamically build DFU_ALT_INFO

This patch reduces the stm32mp1 environment size and
builds dynamically the DFU board configuration with gpt
and mtd partitions and information from defconfig
(CONFIG_DFU_ALT_RAM0).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agoboard: stm32mp1: move set_dfu_alt_info in st common directory
Patrick Delaunay [Wed, 18 Mar 2020 08:22:45 +0000 (09:22 +0100)]
board: stm32mp1: move set_dfu_alt_info in st common directory

Move the stm32mp1 common code set_dfu_alt_info() in common directory,
this patch reduce the maintenance effort on this generic part (not board
dependent).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agoboard: stm32mp1: move board_get_mtdparts in st common directory
Patrick Delaunay [Wed, 18 Mar 2020 08:22:44 +0000 (09:22 +0100)]
board: stm32mp1: move board_get_mtdparts in st common directory

Move the stm32mp1 common code board_get_mtdparts() in common directory,
this patch reduce the maintenance effort on this generic part (not board
dependent).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
4 years agoARM: stm32: Implement DDR3 coding on DHCOR SoM
Marek Vasut [Wed, 22 Apr 2020 11:18:14 +0000 (13:18 +0200)]
ARM: stm32: Implement DDR3 coding on DHCOR SoM

The DHCOR board does exist in multiple variants with different DDR3
DRAM sizes. To cater for all of them, implement DDR3 code handling.
There are two GPIOs which code the DRAM size populated on the SoM,
read them out and use the value to pick the correct DDR3 config.

Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
4 years agoARM: dts: stm32: Rework DDR DT inclusion
Marek Vasut [Wed, 22 Apr 2020 11:18:13 +0000 (13:18 +0200)]
ARM: dts: stm32: Rework DDR DT inclusion

Adjust the DDR configuration dtsi such that they only generate the
DRAM configuration node, the DDR controller node is moved into the
stm32mp157-u-boot.dtsi itself. This permits including multiple DDR
configuration dtsi files in board DT.

Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
4 years agoram: stm32mp1: Add support for multiple configs
Marek Vasut [Wed, 22 Apr 2020 11:18:12 +0000 (13:18 +0200)]
ram: stm32mp1: Add support for multiple configs

Add support for multiple DRAM configuration subnodes, while retaining
the support for a single flat DRAM configuration node. This is useful
on systems which can be manufactured in multiple configurations and
where the DRAM configuration can be determined at runtime.

The code is augmented by a function which can be overridden on board
level, allowing a match on the configuration node name, very much like
the fitImage configuration node name matching works. The default match
is on the single top-level DRAM configuration, if matching on subnodes
is required, then this board_stm32mp1_ddr_config_name_match() must be
overridden.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
4 years agoARM: stm32: Implement board coding on AV96
Marek Vasut [Wed, 22 Apr 2020 11:18:11 +0000 (13:18 +0200)]
ARM: stm32: Implement board coding on AV96

The AV96 board does exist in multiple variants. To cater for all of
them, implement board code handling. There are two GPIOs which code
the type of the board, read them out and use the value to pick the
correct device tree from an fitImage.

Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Change-Id: Iddb330b9a66500495885457cbe17edc0eacaaf43

4 years agoARM: stm32: Add board_early_init_f() to SPL
Marek Vasut [Wed, 22 Apr 2020 11:18:10 +0000 (13:18 +0200)]
ARM: stm32: Add board_early_init_f() to SPL

Add weak implementation of board_early_init_f() hook into the
STM32MP1 SPL. This can be used to read out e.g. configuration
straps before initializing the DRAM.

Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
4 years agoARM: stm32: Add default config for DHCOR
Marek Vasut [Wed, 22 Apr 2020 11:18:09 +0000 (13:18 +0200)]
ARM: stm32: Add default config for DHCOR

Add default U-Boot configuration for the DHCOR SoM on AV96 board.

Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
4 years agoMerge tag 'arc-fixes-for-2020.07-rc3' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Wed, 13 May 2020 19:03:16 +0000 (15:03 -0400)]
Merge tag 'arc-fixes-for-2020.07-rc3' of https://gitlab.denx.de/u-boot/custodians/u-boot-arc

Here we improve clock support for recently introduced HSDK-4xD
board as well as finally enable external reset for the USB controller,
which is needed to recover USB functionality after "usb reset".

4 years agoARC: HSDK: add reset for EHCI
Eugeniy Paltsev [Wed, 13 May 2020 15:18:09 +0000 (18:18 +0300)]
ARC: HSDK: add reset for EHCI

Add reset phandle to EHCI device tree node to make on-chip reset
controller usable with EHCI.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoARC: HSDK: anounce state of BIM switch
Eugeniy Paltsev [Wed, 29 Apr 2020 18:36:44 +0000 (21:36 +0300)]
ARC: HSDK: anounce state of BIM switch

Anounce state of BIM switch which defines if U-boot is loaded
and started by preloader or not.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoARC: DTS: cleanup USB node names
Eugeniy Paltsev [Wed, 13 May 2020 15:15:12 +0000 (18:15 +0300)]
ARC: DTS: cleanup USB node names

Remove redundant '0x' from node names.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoCLK: ARC: HSDK: add separate clock map for HSDK-4xD
Eugeniy Paltsev [Thu, 7 May 2020 19:20:10 +0000 (22:20 +0300)]
CLK: ARC: HSDK: add separate clock map for HSDK-4xD

HSDK and HSDK-4xD clock trees are slightly different.
commit 1dfb2ec0d7fb ("ARC: HSDK: CGU: add support for timer clock")
introduce regression for HSDK board cause crash when setting
tunnel clock. Fix that.

Fixes: 1dfb2ec0d7fb ("ARC: HSDK: CGU: add support for timer clock")
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoCLK: ARC: HSDK: define clock map with DT binding constants
Eugeniy Paltsev [Thu, 7 May 2020 17:31:01 +0000 (20:31 +0300)]
CLK: ARC: HSDK: define clock map with DT binding constants

Define clock map with DT binding constants so clock map can be
discontinuous.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoCLK: ARC: HSDK: make set_clock optional
Eugeniy Paltsev [Thu, 7 May 2020 17:18:41 +0000 (20:18 +0300)]
CLK: ARC: HSDK: make set_clock optional

We don't want to allow change some clocks, i.e. DDR clock.
So allow to have set_clock to be unset in clock map.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoCLK: ARC: HSDK: prepare for multiple clock maps support
Eugeniy Paltsev [Thu, 7 May 2020 17:10:30 +0000 (20:10 +0300)]
CLK: ARC: HSDK: prepare for multiple clock maps support

The clock trees of HSDK and HSDK-4xD vary so we need to prepare
CGU driver for multiple clock maps support.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoCLK: ARC: HSDK: driver cleanup
Eugeniy Paltsev [Thu, 7 May 2020 16:00:08 +0000 (19:00 +0300)]
CLK: ARC: HSDK: driver cleanup

Minor code cleanup to improve readability. No functional change intended.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoCLK: ARC: HSDK: use appropriate config data types
Eugeniy Paltsev [Thu, 7 May 2020 14:52:11 +0000 (17:52 +0300)]
CLK: ARC: HSDK: use appropriate config data types

* constify clocks config data where is possible
* use more appropriate data types for clocks config

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoCLK: ARC: HSDK: drop unused offset
Eugeniy Paltsev [Thu, 7 May 2020 14:37:37 +0000 (17:37 +0300)]
CLK: ARC: HSDK: drop unused offset

Drop creg_div_oft offset as it doesn't vary (due to it is used for
CPU PLL only).

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoCLK: ARC: HSDK: avoid code duplication
Eugeniy Paltsev [Thu, 7 May 2020 13:59:54 +0000 (16:59 +0300)]
CLK: ARC: HSDK: avoid code duplication

hsdk_axi_clk_cfg and hsdk_tun_clk_cfg clock divider structures
and functions for their processing are almost the same so
merge them to avoid code duplication.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agorpi: use the newly-added RPI_EFI_NR_SPIN_PAGES
Kyle Evans [Wed, 26 Feb 2020 21:39:10 +0000 (15:39 -0600)]
rpi: use the newly-added RPI_EFI_NR_SPIN_PAGES

Some systems may use a slightly larger stub to do PSCI for booting the RPi
family.  The number of pages has been made configurable so that operating
systems building U-Boot for use in these kinds of environments can reserve
more memory in the EFI memory map.

Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
4 years agorpi: Kconfig option for initial page reservation
Kyle Evans [Wed, 26 Feb 2020 21:37:13 +0000 (15:37 -0600)]
rpi: Kconfig option for initial page reservation

While the nearly-universal default for the Raspberry Pi family is to use
spin tables and the spin table implementation provided by the Raspberry Pi
Foundation, FreeBSD and others may use a PSCI implementation instead.

Accommodate these setups by allowing them to configure for more than one
page to be reserved in the initial reservation.  The default reservation
remains as one page.

Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
4 years agoconfigs: rpi_arm64: enable SDHCI SDMA support
Matthias Brugger [Tue, 12 May 2020 10:02:07 +0000 (12:02 +0200)]
configs: rpi_arm64: enable SDHCI SDMA support

RPi4 supports SDMA on it's SDHCI controller. Enable to option for
the combine RPi3/4 config.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
4 years agommc: sdhci: Use debug for not supported SDMA info message
Matthias Brugger [Tue, 12 May 2020 10:02:06 +0000 (12:02 +0200)]
mmc: sdhci: Use debug for not supported SDMA info message

If CONFIG_MMC_SDHCI_SDMA is enabled but the HW could not support it,
we no longer error out. Instead we do not enable it in the host.
Change the output from printf to debug as this isn't an error but only
additional information now.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
4 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Tue, 12 May 2020 20:20:10 +0000 (16:20 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-usb

- Two DWC3 fixes

4 years agoMerge tag 'u-boot-amlogic-20200511' of https://gitlab.denx.de/u-boot/custodians/u...
Tom Rini [Tue, 12 May 2020 13:23:15 +0000 (09:23 -0400)]
Merge tag 'u-boot-amlogic-20200511' of https://gitlab.denx.de/u-boot/custodians/u-boot-amlogic

- Enable USB Host for Odroid-C2 board
- Add Open-Drain/Open-Source emulation in GPIO uclass

4 years agoconfigs: rpi_arm64: sync env size with rpi_{3,4}_defconfig
Marek Szyprowski [Tue, 5 May 2020 10:09:02 +0000 (12:09 +0200)]
configs: rpi_arm64: sync env size with rpi_{3,4}_defconfig

Use the same environment size as the configs dedicated for rpi3 and rpi4.
This allows to switch between the builds and not to loose the settings
stored on the SD card.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
4 years agoconfigs: rpi_4 : enable SDHCI_SDMA config
Jaehoon Chung [Fri, 27 Mar 2020 04:08:02 +0000 (13:08 +0900)]
configs: rpi_4 : enable SDHCI_SDMA config

Enable SDHCI_SDMA configuration.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
4 years agommc: sdhci: not return error when SDMA is not supported
Jaehoon Chung [Fri, 27 Mar 2020 04:08:01 +0000 (13:08 +0900)]
mmc: sdhci: not return error when SDMA is not supported

If Host controller doesn't support SDMA, it doesn't need to return
error. Because it can be worked with PIO mode.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
4 years agommc: sdhci: use phys2bus macro when dma address is accessed
Jaehoon Chung [Fri, 27 Mar 2020 04:08:00 +0000 (13:08 +0900)]
mmc: sdhci: use phys2bus macro when dma address is accessed

Use phys2bus macro when dma address is accessed.
Some targets need to use pyhs2bus macro. (e.g, RPI4)
After applied it, SDMA mode can be used.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
4 years agoarm: bcm283x: serial: Move ofdata reading to probe() method
Simon Glass [Mon, 23 Mar 2020 03:15:53 +0000 (21:15 -0600)]
arm: bcm283x: serial: Move ofdata reading to probe() method

We cannot rely on a parent bus that needs to be probed, until we know that
it is probed. That means that code in the ofdata_to_platdata() method
cannot rely on the parent bus being probed.

Move the ofdata code in the two serial drivers into a probe() method.

This fixes serial output on rpi_3b_32b with the following config.txt
options:

   enable_uart=1
   gpu_freq=250

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
4 years agoarm: dts: bcm283x: Allow UARTs to work before relocation
Simon Glass [Mon, 23 Mar 2020 03:15:52 +0000 (21:15 -0600)]
arm: dts: bcm283x: Allow UARTs to work before relocation

At present the pinctrl nodes are not enabled in pre-relocation U-Boot so
the UARTs do not correctly select the pinconfig to enable the UART pins.
Fix this so that the U-Boot banner is printed.

This fixes serial output on rpi_3b_32b with the following config.txt
options:

   enable_uart=1
   gpu_freq=250

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 9821636b64 (bcm2835_pinctrl: Probe pre-reloc)
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
4 years agonet: bcmgenet: Don't set ID_MODE_DIS when not using RGMII
Nicolas Saenz Julienne [Thu, 20 Feb 2020 16:36:31 +0000 (17:36 +0100)]
net: bcmgenet: Don't set ID_MODE_DIS when not using RGMII

As per Linux's driver, ID_MODE_DIS is only set when the PHY interface is
RGMII. Don't enable it for the rest of setups.

This has been seen to misconfigure RPi4's PHY when booting Linux.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
4 years agousb: dwc3: Add versal compatibility string to dwc3 glue ids
Siva Durga Prasad Paladugu [Tue, 12 May 2020 06:36:01 +0000 (08:36 +0200)]
usb: dwc3: Add versal compatibility string to dwc3 glue ids

Xilinx Versal platform uses dwc3 and hence its compatible string
needs to be added to dwc3 glue ids.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agousb: dwc3: add dis_del_phy_power_chg_quirk
Jagan Teki [Wed, 6 May 2020 07:50:25 +0000 (13:20 +0530)]
usb: dwc3: add dis_del_phy_power_chg_quirk

Add a quirk to clear the GUSB3PIPECTL.DELAYP1TRANS bit,
which specifies whether disable delay PHY power change
from P0 to P1/P2/P3 when link state changing from U0
to U1/U2/U3 respectively.

Reference from below Linux commit,

commit <00fe081dc3a3> ("usb: dwc3: add dis_del_phy_power_chg_quirk")

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agoPrepare v2020.07-rc2
Tom Rini [Mon, 11 May 2020 22:28:19 +0000 (18:28 -0400)]
Prepare v2020.07-rc2

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoMerge tag 'efi-2020-07-rc2-4' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Mon, 11 May 2020 18:23:23 +0000 (14:23 -0400)]
Merge tag 'efi-2020-07-rc2-4' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2020-07-rc2-4

This pull request comprises:
* bug fixes
* documentation fixes
* a new function to determine u16 string sizes and its unit test

4 years agoMerge tag 'ti-v2020.07-rc2' of https://gitlab.denx.de/u-boot/custodians/u-boot-ti
Tom Rini [Mon, 11 May 2020 16:04:54 +0000 (12:04 -0400)]
Merge tag 'ti-v2020.07-rc2' of https://gitlab.denx.de/u-boot/custodians/u-boot-ti

- Fix boot issues on Nokia RX-51
- Configure AM6 CPSW for 10Mbps in rgmii mode.
- Minor changes for J721e

4 years agoMerge tag 'u-boot-imx-20200511' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
Tom Rini [Mon, 11 May 2020 13:46:43 +0000 (09:46 -0400)]
Merge tag 'u-boot-imx-20200511' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx

i.MX for 2020.07
----------------

- i.MX NAND and nandbxb for i.MX8M
- imx8MM : new beacon devkit
- imx8MQ : new pico-imx8MQ
- imx8QXP : extend to enable M4, fixes
- add thermal support
- caches in SPL (missing board)
- Fixes

Travis: https://travis-ci.org/github/sbabic/u-boot-imx/builds/685391011