oweals/u-boot.git
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 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 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 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

4 years agotest: dm: update test for open-drain/open-source emulation in gpio-uclass
Neil Armstrong [Tue, 5 May 2020 08:43:18 +0000 (10:43 +0200)]
test: dm: update test for open-drain/open-source emulation in gpio-uclass

Add tests for testing open-drain/open-source emulation in gpio-uclass.
It also adds two test3-gpios configured as GPIO_ACTIVE_LOW.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agogpio: emulate open drain & open source in dm_gpio_set_value()
Neil Armstrong [Tue, 5 May 2020 08:43:17 +0000 (10:43 +0200)]
gpio: emulate open drain & open source in dm_gpio_set_value()

Handle the GPIOD_OPEN_DRAIN & GPIOD_OPEN_SOURCE flags to emulate open drain
and open source by setting the GPIO line as input depending on the
requested value.

The behaviour is taken from the Linux gpiolib.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoMerge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-spi
Tom Rini [Mon, 11 May 2020 12:27:55 +0000 (08:27 -0400)]
Merge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-spi

- zap lpc32xx_ssp driver (Jagan)
- rename of phy nodev call (Jagan)
- iopoll with sleep_us (Jagan)
- MX25R6435F flash (Ye Li)

4 years agoodroid-c2: enable USB host controller
Beniamino Galvani [Sun, 18 Aug 2019 13:42:55 +0000 (15:42 +0200)]
odroid-c2: enable USB host controller

Enable the second USB controller, which is connected to a hub with 4
ports. The first controller is for the OTG port and is currently not
supported.

Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
[narmstrong: removed useless DWC2_UTMI_WIDTH in meson64.h]
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
4 years agoNokia RX-51: Update README.nokia_rx51
Pali Rohár [Tue, 31 Mar 2020 22:35:17 +0000 (00:35 +0200)]
Nokia RX-51: Update README.nokia_rx51

Fix some typos, add information about setup_omap_atag, remove old suff
about ONENAND_SUPPORT and update guide for UBIFS.

Signed-off-by: Pali Rohár <pali@kernel.org>
4 years agoNokia RX-51: Disable some unused features to decrease size of u-boot binary
Pali Rohár [Tue, 31 Mar 2020 22:35:16 +0000 (00:35 +0200)]
Nokia RX-51: Disable some unused features to decrease size of u-boot binary

Maximal allowed size of U-Boot binary for Nokia N900 is just 262144 bytes.

Signed-off-by: Pali Rohár <pali@kernel.org>
4 years agoNokia RX-51: Enable CONFIG_CONSOLE_MUX
Pali Rohár [Tue, 31 Mar 2020 22:35:15 +0000 (00:35 +0200)]
Nokia RX-51: Enable CONFIG_CONSOLE_MUX

After this change both device display and serial console would contain
U-Boto output automatically without any future configuration. This would
allow easier debugging on real device as access to serial console is hard
and also in qemu emulator where it is easier to copy+paste from serial
console as from SDL framebuffer.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
4 years agoNokia RX-51: Remember setup_console_atag option
Pali Rohár [Tue, 31 Mar 2020 22:35:14 +0000 (00:35 +0200)]
Nokia RX-51: Remember setup_console_atag option

When variable setup_console_atag is unset then read default value from OMAP
atags which passed NOLO bootloader to U-Boot.

This would allow to boot Maemo Linux kernel from U-Boot with serial console
settings configured in NOLO bootloader (which loads U-Boot).

So serial console needs to be enabled only at one place, globally in NOLO.

Signed-off-by: Pali Rohár <pali@kernel.org>
4 years agoNokia RX-51: Remove PART* macros
Pali Rohár [Tue, 31 Mar 2020 22:35:13 +0000 (00:35 +0200)]
Nokia RX-51: Remove PART* macros

Now when code for defining partitions is duplicated at two locations
(option CONFIG_MTDPARTS_DEFAULT in nokia_rx51_defconfig file and macro
OMAP_TAG_PARTITION_CONFIG in rx51.c file) there is no need to have common
macros. Lets inline PART* macros to rx51.c file.

Signed-off-by: Pali Rohár <pali@kernel.org>
4 years agoNokia RX-51: Revert back onenand defitions
Pali Rohár [Tue, 31 Mar 2020 22:35:12 +0000 (00:35 +0200)]
Nokia RX-51: Revert back onenand defitions

In commit commit 43ede0bca7fc ("Kconfig: Migrate MTDIDS_DEFAULT /
MTDPARTS_DEFAULT") were removed definitions for onenand partitions.

Revert them back and enable needed options for onenand support.

Signed-off-by: Pali Rohár <pali@kernel.org>
4 years agoNokia RX-51: Move code from defconfig back to C header file
Pali Rohár [Tue, 31 Mar 2020 22:35:11 +0000 (00:35 +0200)]
Nokia RX-51: Move code from defconfig back to C header file

In commit commit 37304aaf60bf ("Convert CONFIG_USE_PREBOOT and
CONFIG_PREBOOT to Kconfig") was moved complicated multiline script code
from C header to oneliner in defconfig. After this change multiline to wide
oneliner it is hard to read this code and even harder to debug. Moreover
this script code should be at place where are other scripts, so move it
back to C header file.

Define new env variable preboot which stores this script and in option
CONFIG_PREBOOT calls this preboot variable.

Signed-off-by: Pali Rohár <pali@kernel.org>
4 years agoNokia RX-51: Move comment about CONFIG_SYS_TEXT_BASE to correct place
Pali Rohár [Tue, 31 Mar 2020 22:35:10 +0000 (00:35 +0200)]
Nokia RX-51: Move comment about CONFIG_SYS_TEXT_BASE to correct place

In commit commit 278b90ce786f ("configs: Migrate CONFIG_SYS_TEXT_BASE") was
moved definition for CONFIG_SYS_TEXT_BASE option but author probably forgot
to move also comment for lines which are moving. So do it now!

Signed-off-by: Pali Rohár <pali@kernel.org>
4 years agoNokia RX-51: Add README.nokia_rx51 file to MAINTAINERS
Pali Rohár [Tue, 31 Mar 2020 22:35:09 +0000 (00:35 +0200)]
Nokia RX-51: Add README.nokia_rx51 file to MAINTAINERS

This entry was missing in MAINTAINERS file.

Signed-off-by: Pali Rohár <pali@kernel.org>
4 years agoNokia RX-51: Update my email address
Pali Rohár [Tue, 31 Mar 2020 22:35:08 +0000 (00:35 +0200)]
Nokia RX-51: Update my email address

I'm using a new email address, so reflect this state also in U-Boot.

Signed-off-by: Pali Rohár <pali@kernel.org>
4 years agovideo: omap: change include order
Dario Binacchi [Sun, 3 May 2020 19:27:48 +0000 (21:27 +0200)]
video: omap: change include order

Apply u-boot coding style on include files order as described by the
wiki https://www.denx.de/wiki/U-Boot/CodingStyle.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
4 years agoarm: K3: Increase default SYSFW image size allocation
Andrew F. Davis [Thu, 30 Apr 2020 19:12:19 +0000 (15:12 -0400)]
arm: K3: Increase default SYSFW image size allocation

The memory allocated to store the FIT image containing SYSFW and board
configuration data is statically defined to the largest size expected.
Some additions to the board configuration data has pushed us slightly
over the current defined size on some HS devices, expand to 278000.

Signed-off-by: Andrew F. Davis <afd@ti.com>
4 years agosf: Add Macronix MX25R6435F SPI NOR flash to flash parameters array
Ye Li [Sun, 3 May 2020 13:02:56 +0000 (21:02 +0800)]
sf: Add Macronix MX25R6435F SPI NOR flash to flash parameters array

On i.mx7ulp EVK board, we use MX25R6435F NOR flash, add its parameters
and IDs to flash parameter array. Otherwise, the flash probe will fails.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agospi: fix dev parameter in dev_* calls
Dario Binacchi [Sat, 2 May 2020 15:45:50 +0000 (17:45 +0200)]
spi: fix dev parameter in dev_* calls

Probably the non-use of the device parameter by the print routines did
not generate compilation errors.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
4 years agospi: nxp-fspi: Use new readl_poll_sleep_timeout API
Kuldeep Singh [Mon, 27 Apr 2020 07:08:51 +0000 (12:38 +0530)]
spi: nxp-fspi: Use new readl_poll_sleep_timeout API

Board gets reset when performing burst read/write operations. On the
other hand, no such behaviour is observed on small size operations.

In Linux, readl_poll_timeout API already adds delay of 1us which is
further skipped in U-boot. Hence, use new "readl_poll_sleep_timeout" API
which adds delay alongwith timeout functionality.

Signed-off-by: Kuldeep Singh <kuldeep.singh@nxp.com>
4 years agoiopoll: Add readl_poll_sleep_timeout
Jagan Teki [Sat, 2 May 2020 07:15:03 +0000 (12:45 +0530)]
iopoll: Add readl_poll_sleep_timeout

Add readl poll API with sleep and timeout support.

This change is referenced from Linux from below commit:
commit <5f5323a14cad19323060a8cbf9d96f2280a462dd> ("iopoll:
introduce read_poll_timeout macro")

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agoiopoll: Add dealy to read poll
Jagan Teki [Sat, 2 May 2020 07:15:02 +0000 (12:45 +0530)]
iopoll: Add dealy to read poll

Some drivers and other bsp code not only poll the
register with timeout but also required to delay
on each transaction.

This patch add that requirement by adding sleep_us
variable so-that read_poll_timeout now support
delay as well.

This change is referenced from Linux from below commit:
commit <5f5323a14cad19323060a8cbf9d96f2280a462dd> ("iopoll:
introduce read_poll_timeout macro")

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agoiopoll: Add read_poll_timeout common API
Jagan Teki [Sat, 2 May 2020 07:15:01 +0000 (12:45 +0530)]
iopoll: Add read_poll_timeout common API

Add read_poll_timeout common API similar to Linux iopoll.

readx_poll_timeout will trigger read_poll_timeout with
proper op. This will help to extend the functionalities
like sleep_us to poll timeout in future.

This change is referenced from Linux from below commit:
commit <5f5323a14cad19323060a8cbf9d96f2280a462dd> ("iopoll:
introduce read_poll_timeout macro")

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agoclk: Fix clk func names in comments
Jagan Teki [Fri, 1 May 2020 18:15:08 +0000 (23:45 +0530)]
clk: Fix clk func names in comments

clk function names in comments should be prefix with
clk instead of clock.

Fix it.

Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agophy: Use _nodev naming convention if non-device clients
Jagan Teki [Fri, 1 May 2020 18:14:18 +0000 (23:44 +0530)]
phy: Use _nodev naming convention if non-device clients

Clients that are requesting some of uclass API's
without a device (with ofnode) usually have _nodev
naming convention.

- clk_get_by_index_nodev
- clk_get_by_name_nodev
- reset_get_by_index_nodev
- gpio_request_by_name_nodev

So, update the same naming convention PHY framework.

This doesn't change the existing functionality.

Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Tom Rini <trini@konsulko.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agophy: Fix node description of phy_get_by_node
Jagan Teki [Fri, 1 May 2020 18:14:17 +0000 (23:44 +0530)]
phy: Fix node description of phy_get_by_node

node is most of device related API's are termed as device
node and without device related API's are termed as ofnode.

generic_phy_get_by_node API is without device API, so fixed
the node description as ofnode.

Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Tom Rini <trini@konsulko.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agospi: Zap lpc32xx_ssp driver-related code
Jagan Teki [Fri, 1 May 2020 16:34:50 +0000 (22:04 +0530)]
spi: Zap lpc32xx_ssp driver-related code

lpc32xx_ssp driver is deprecated, no active updates
and no board user, hence dropped the same.

Cc: Vladimir Zapolskiy <vz@mleia.com>
Cc: Albert ARIBAUD <albert.aribaud@3adev.fr>
Cc: Tom Rini <trini@konsulko.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agoimx8: cpu: check resource owned after sid fail
Peng Fan [Tue, 5 May 2020 12:28:46 +0000 (20:28 +0800)]
imx8: cpu: check resource owned after sid fail

When we create software partition, we still need let parent
partition to configure sid, so move the check after sid failed.

Acked-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: imx8qxp: update fdt_file according to m4 state
Peng Fan [Tue, 5 May 2020 12:28:45 +0000 (20:28 +0800)]
imx: imx8qxp: update fdt_file according to m4 state

Update fdt_file according to m4 parts state

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: imx8qm: update fdt_file according to m4 state
Peng Fan [Tue, 5 May 2020 12:28:44 +0000 (20:28 +0800)]
imx: imx8qm: update fdt_file according to m4 state

Update fdt_file according to m4 parts state

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: imx8qm/qxp: check whether m4 partition booted
Peng Fan [Tue, 5 May 2020 12:28:43 +0000 (20:28 +0800)]
imx: imx8qm/qxp: check whether m4 partition booted

Add code to check m4 partition booted or not, we will use this
to runtime set device tree file that passed to Linux Kernel.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx8: Select boot device dynamically
Ye Li [Tue, 5 May 2020 12:28:42 +0000 (20:28 +0800)]
imx8: Select boot device dynamically

For fspi build, we will enable both SPL NOR support and SPL SPI
support. SPL will dynamically check the resource owner then
select corresponding boot device.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: imx8qm/qxp: Recover SPL data section for partition reboot
Peng Fan [Tue, 5 May 2020 12:28:41 +0000 (20:28 +0800)]
imx: imx8qm/qxp: Recover SPL data section for partition reboot

When doing partition reboot, the boot image won't be reloaded by ROM,
it is just CPU reset to boot entry. The SW has to keep the boot image
inside the RAM unchanged. It includes both the TEXT section and DATA
section.

For SPL, the problem is DATA section will be updated at runtime, so in
next partition reboot the data is not same as the initial value from
cold boot. If any code depends on the initial value, then it will have
problem.

This patch introduces a mechanism to recover the data section
for partition reboot. It adds a new section in image for saving
data section. When from cold boot, the data section will be saved
to that new section at SPL early phase. When from partition reboot,
the data section will be restored from the new section.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: imx8qm/imx8qxp: Power down the resources before SPL jump to u-boot
Peng Fan [Tue, 5 May 2020 12:28:40 +0000 (20:28 +0800)]
imx: imx8qm/imx8qxp: Power down the resources before SPL jump to u-boot

Make sure that all devices that are powered up by SPL are powered down
before entering into the u-boot. Otherwise the subsystem/device will
never be powered down by SCFW, due to SPL and u-boot are in different
partitions.

Benefiting from power domain driver, this patch implements the function
"imx8_power_off_pd_devices" to power off all active devices.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: imx8qm/qxp: add get_board_serial
Peng Fan [Tue, 5 May 2020 12:28:39 +0000 (20:28 +0800)]
imx: imx8qm/qxp: add get_board_serial

Add get_board_serial support, the info could be got from fuse.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: imx8qm/qxp: Fix issue in get_effective_memsize
Ye Li [Tue, 5 May 2020 12:28:38 +0000 (20:28 +0800)]
imx: imx8qm/qxp: Fix issue in get_effective_memsize

When Trusty OS allocates the mem region from 0xfe0000000-0xffffffff,
the get_effective_memsize does not return correct memory size.
There is a check in get_effective_memsize to find the memreg where
the u-boot is running, and return the size of that memreg as the result
of get_effective_memsize. When using aligned start, the value is
0x80200000 since it is 2MB aligned. Thus the finding of memreg will
fail and return the PHYS_SDRAM_1_SIZE because u-boot text base is
0x80020000. This cause u-boot is relocated to the high memory where has
been occupied by Trusty OS.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>