Compare commits

...

234 Commits

Author SHA1 Message Date
fd915f073f Prepare v2018.11-stm32mp-r4
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Iec3c340613a9cf693fb1264e13749b3e7c077472
2020-01-14 13:26:49 +01:00
8028962d9f video: stm32: stm32_dsi: don't enable regulator if no dt entry
Regulator phy_dsi is not mandatory and its related device
tree entry could be then not defined. This patch checks
the dt entry before enabling the regulator preventing
error when not present.

Signed-off-by: Yannick Fertre <yannick.fertre@st.com>
Change-Id: Ibf022e279ae4bcb6627a7ace19b8279833554eb1
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/153675
Reviewed-by: Philippe CORNU <philippe.cornu@st.com>
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-01-14 13:26:49 +01:00
2e43485f80 video: check hardware version of DSI
Check the hardware version of DSI. Versions 1.30 & 1.31 are only
supported. Rename the parameter priv by dsi into all functions.

Signed-off-by: Yannick Fertre <yannick.fertre@st.com>
Change-Id: I2dfe8dcedc96e193ae35e0048bddafc39b13903f
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/153674
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-01-14 13:26:49 +01:00
cbe462a123 stm32mp1: update MAC address provisioning
Add Prerequisite: check if MAC address is not yet provisioned.
and add Warning for second provisioning.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Ida7462afcb326e0761d6bbb355b3a9a8e96fb25b
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/153325
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-01-14 13:26:49 +01:00
ed513fa816 stm32mp1: update vddcore if needed
Update the vddcore with information of OPP when needed.
VDDCORE is provided by BUCK1 of STMPIC1

Change-Id: I845d08dcbe270a6b9339cdca96d25b1f4ce0e13e

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Ia3b4a5043eb1e152baecea5fabd0e1673135ac06
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/151665
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2020-01-14 13:26:49 +01:00
022dea8d36 stm32mp1: clk: configure pll1 with OPP
The PLL1 node (st,pll1) is optional in device tree, the max supported
frequency define in OPP node is used when the node is absent.

Change-Id: Iaff7f49da0cc8a01050b402be816b4c5c739fe56
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/151664
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-01-14 13:26:49 +01:00
67d6c24552 stm32mp1: spl: display error in board_init_f
Update board_init_f and try to display error message
when console is available.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I41a641a07fd12da45b392920fc3407e608926396
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/151663
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2020-01-14 13:26:49 +01:00
f21da5ab66 stm32mp1: add bsec driver in SPL
Add the bsec driver in SPL, as it is needed by SOC part number detection.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I7a042a9ffbb5c2668034eddf5ace91271bb53c5f
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/151662
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2020-01-14 13:26:49 +01:00
11e5838cdb Add config for target STM32MP157C-DK2
Add config for target STM32MP157C-DK2=
CONFIG_TARGET_STM32MP157C_DK2 allow to reduce the size of U-Boot
when the support of st board dk2 is not needed.

Change-Id: Ie3300eb16e734851a3d58bcf4f029c3066165513
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/149503
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-01-14 13:26:49 +01:00
e87bd559a3 video: orisetech_otm8009a: fill characteristics of DSI data link
Fill characteristics of DSI data link to platform data instead of
mipi device to avoid memory corruption.

Signed-off-by: Yannick Fertré <yannick.fertre@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/146733
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Philippe CORNU <philippe.cornu@st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Change-Id: If16ab3eba7e7c3864ee917e042a271310bb91e29
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/149076
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-01-14 13:26:49 +01:00
b9cfde9109 video: raydium_rm68200: fill characteristics of DSI data link
Fill characteristics of DSI data link to platform data instead of
mipi device to avoid memory corruption.

Signed-off-by: Yannick Fertré <yannick.fertre@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/146732
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Philippe CORNU <philippe.cornu@st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Change-Id: I932b05998487fdd672b20e98fa55e5e5e1be24b0
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/149075
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-01-14 13:26:49 +01:00
275062832c video: stm32: stm32_dsi: copy DSI fields
Copy the DSI data link characteristics from panel
platform data to mipi DSI device.

Signed-off-by: Yannick Fertré <yannick.fertre@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/146731
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Philippe CORNU <philippe.cornu@st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Change-Id: I9e64ad6cc828d446ccd9a974ed50d65f9942f1be
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/149074
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-01-14 13:26:49 +01:00
1b0ac8992d video: mipi update panel platform data
Add new fields "lanes, format & mode_flags" to structure
mipi_dsi_panel_plat.

Signed-off-by: Yannick Fertré <yannick.fertre@st.com>
Change-Id: I51ed5d96bc6d4b1a45dd3cae9b1328b4c4d3b52b
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/149073
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-01-14 13:26:49 +01:00
68b5cfba08 video: stm32mp1 update
Signed-off-by: Yannick Fertré <yannick.fertre@st.com>
Change-Id: Ifcf29254db59a786e457ebe31ba76ad2aad67d21
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/149072
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-01-14 13:26:49 +01:00
3de9b926c4 ram: stm32mp1: don't display the prompt two times
Remove one "DDR>" display on command
- next
- step
- go

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I6004c77337da88fcc073b421245687c3f74b30a8
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/147443
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2020-01-14 13:26:49 +01:00
b7db3619f8 dts: stm32: alignment with v4.19-stm32mp-r3
Device tree alignment with Kernel v4.19-stm32mp-r3

Change-Id: I30f44f7f4c0558c17ba6106668e6aaa593809507
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/145708
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2020-01-14 13:26:49 +01:00
37045967c3 net: dwc_et_qos: implement phy-reset-gpios for stm32
Add management of property "phy-reset-gpios" to configure any GPIO used
to reset the PHY

Change-Id: If510c11ecfdf4e33feded847da6899b99e75df75
Signed-off-by: Christophe Roullier <christophe.roullier@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/143175
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-12-04 18:28:50 +01:00
a0162f45e2 stm32mp1: reset halt workaround: extend SoC revision check
Not only version 0x20000500 but also 0x20010500 needs the same
workaround.

Modify the mask to include the second version in the check.

Signed-off-by: Antonio Borneo <antonio.borneo@st.com>
Change-Id: I5e8adfe8b70fdeeca03c89c5d1bae9be43f99db1
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/143706
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-12-04 18:28:50 +01:00
658e38f1a7 stm32mp1: do not fixup the DeviceTree with coproc_rsc_addr/size
Do not update the DeviceTree with the coproc_rsc_addr/size properties as
this is no more required now that stm32_copro writes the resource table
address in a backup register.
Also consider some more error cases.

Change-Id: I13fa076ba9d138ab510e88601b858ec0d359c55c
Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/143689
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-12-04 18:28:50 +01:00
71d5ed8066 remoteproc: stm32: store resource table address in backup register
Store the firmware resource table address in the dedicated backup
register.

Change-Id: I55a3f20f5fe2a6138a57d1d1c506422473648189
Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/143688
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-12-04 18:28:50 +01:00
88dfe17619 stm32mp1: declare backup register for copro resource table address
Use the backup register #17 as coprocessor resource table address.

Change-Id: I9d52bab22058735c7790a38f165f88f074322304
Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/143687
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-12-04 18:28:50 +01:00
4d084310ca remoteproc: store resource table address and size
When rproc-uclass rproc_load_rsc_table() is called, store the address
and the size of the resource table in the private data, so these
information can be used by the drivers.

Change-Id: I6b4f0de4ff9876856e24388c80a01af4b1228241
Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/143686
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Arnaud POULIQUEN <arnaud.pouliquen@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-12-04 18:28:50 +01:00
bdbf4d7506 i2c: stm32f7_i2c: allows for any bus frequency
Do not limitate to 3 (100KHz, 400KHz, 1MHz) bus frequencies, but
instead allow for any frequency. Depending on the requested
frequency (via the clock-frequency DT entry), use the spec
data from either Standard, Fast or Fast Plus mode.

In order to do so, the driver do not use anymore spec identifier
by directly handle the requested frequency and from it retrieve
the corresponding spec data to be used for the computation
of the timing register.

Change-Id: I44e04e48643f0d3554334318ff2111860ca0f8ab
Signed-off-by: Alain Volmat <alain.volmat@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/144006
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-12-04 18:28:50 +01:00
b3a725aba6 mmc: stm32_sdmmc2: implement host_power_cycle callback
For the correct power cycle sequence with stm32_sdmmc2, the write of the
power cycle value in PWRCTL field of SDMMC_POWER register is now done in
stm32_sdmmc2_host_power_cycle() and no more in stm32_sdmmc2_pwrcycle().

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: I0e2b14a7529118831672e3c564a23b3e1ad98013
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/142394
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Christophe KERELLO <christophe.kerello@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-12-04 18:28:50 +01:00
ec157da292 mmc: add a driver callback for power-cycle
Some MMC peripherals require specific power cycle sequence, where some
registers need to be written between the regulator is turned off and then
back on. This is the case for the MMC IP embedded in STM32MP1 SoC.

In STM32MP157 reference manual [1], the power cycle sequence is:
1. Reset the SDMMC with the RCC.SDMMCxRST register bit. This will reset
the SDMMC to the reset state and the CPSM and DPSM to the Idle state.
2. Disable the Vcc power to the card.
3. Set the SDMMC in power-cycle state. This will make that the
SDMMC_D[7:0], SDMMC_CMD and SDMMC_CK are driven low, to prevent the card
from being supplied through the signal lines.
4. After minimum 1ms enable the Vcc power to the card.
5. After the power ramp period set the SDMMC to the power-off state for
minimum 1ms. The SDMMC_D[7:0], SDMMC_CMD and SDMMC_CK are set to
drive “1”.
6. After the 1ms delay set the SDMMC to power-on state in which the
SDMMC_CK clock will be enabled.
7. After 74 SDMMC_CK cycles the first command can be sent to the card.

The step 3. cannot be handled by the current framework implementation.
A new callback (host_power_cycle) is created, and called in
mmc_power_cycle(), after mmc_power_off().

The incorrect power cycle sequence has shown some boot failures on
STM32MP1 with some SD-cards, especially on cold boots when the input
frequency is low (<= 25MHz).
Those failures are no more seen with this correct power cycle sequence.

[1] https://www.st.com/resource/en/reference_manual/DM00327659.pdf

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: Ie04221759e9ff16b2f47cff3818c4b9321cd3f7b
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/142393
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Christophe KERELLO <christophe.kerello@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-12-04 18:28:50 +01:00
02d5c1dfa6 stm32mp1: ram: increase vdd2_ddr: buck2 for 32bits LPDDR
Need to increase the LPDDR2/LPDDR3 the voltage vdd2_ddr: buck2
form 1.2V to 1.25V for 32bits configuration.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Ifeb02af238a2e3d0407465a868761e5efd7f968b
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/142535
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Nicolas LE BAYON <nicolas.le.bayon@st.com>
2019-12-04 18:28:50 +01:00
5cd4de52ec board: stm32mp1: fixup the USB product id for fastboot
Select a specific product id used during USB enumeration
when the fastboot gadget is used.

For ST Microelectronics board we are using
the VID:PID = 0x0483:0x0AFB for fastboot
as defined in http://www.linux-usb.org/usb.ids

This patch avoid conflict when the same USB VID/PID is used for
fastboot and DFU (two different protocols associated to the same PID).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Id25154105bef11c7ed8031aed96e7c67b1805885
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/142124
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Christophe GUIBOUT <christophe.guibout@st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
Reviewed-by: Nicolas LOUBOUTIN <nicolas.louboutin@st.com>
Tested-by: Christophe GUIBOUT <christophe.guibout@st.com>
2019-12-04 18:28:50 +01:00
1c51ffe4b1 stm32mp1: stm32prog rename ENV_BUF_LEN to ALT_BUF_LEN
Use correct name for dfu alternate buffer max length: ALT_BUF_LEN.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I50c3bbbd4010c9f0228d4d5bb7e0cda2e8f7fe3b
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/139276
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-12-04 18:28:50 +01:00
c25ecf1718 stm32mp1: stm32prog: correctly handle buffers in create_partitions
Use 8Kb bytes buffer in create_partitions to avoid stack corruption
when the 1KB is not enought (with many partitions).

Remove cmdbuf buffer to avoid overflow.

Add protection when the 8KB-100 bytes limit is reached to detect overflow.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I97f97df3c557070ef9e16c801d21b8bc169d88ce
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/139275
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-12-04 18:28:50 +01:00
ff234a202c ARM: dts: stm32: reduce vddcore max voltage
Reduce vddcore max voltage to follow SoC specifications
for 800MHz new cpu profile.

Change-Id: I24ca415d48b8cce145ec659aa91ddb7828a7e792
Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133440
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-12-04 18:28:50 +01:00
a99ea99ade stm32mp1: updade cpu info for 800 MHz profile support
Add support of overdrive OTP in the CPU identifier and add more
STM32 MPUs Part = STM32MP151Fxx, STM32MP153Fxx, STM32MP157Fxx,
STM32MP151Dxx, STM32MP153Dxx, STM32MP157Dxx

The STM32MP1 series is available in 3 different lines which are pin-to-pin
compatible:
- STM32MP157: Dual Cortex-A7 cores, Cortex-M4 core @ 209 MHz,
              3D GPU, DSI display interface and CAN FD
- STM32MP153: Dual Cortex-A7 cores, Cortex-M4 core @ 209 MHz
              and CAN FD
- STM32MP151: Single Cortex-A7 core, Cortex-M4 core @ 209 MHz

Each line comes with a security option (cryptography & secure boot)
& a Cortex-A frequency option :

- A      Basic + Cortex-A7 @ 650 MHz
- C      Secure Boot + HW Crypto + Cortex-A7 @ 650 MHz
- D      Basic + Cortex-A7 @ 800 MHz
- F      Secure Boot + HW Crypto + Cortex-A7 @ 800 MHz

Change-Id: I7571dedb712ab25c96d11250fe0897161e7afde1
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133344
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2019-12-04 18:28:50 +01:00
0803eb6f0a stm32mp1: support of STM32MP15x Rev.Z
Add support for Rev.Z of STM32MP15x cpu.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Ia92100c29f7ea0bac70daee811aea2d32b00773d
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/136826
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-12-04 18:28:50 +01:00
4299e2f9d6 Prepare v2018.11-stm32mp-r3.2
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I74c70e03797c1483f117940879a7fdc616d50a90
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/151673
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2019-12-04 18:19:31 +01:00
6cf129b9b9 dts: stm32: alignment with v4.19-stm32mp-r2.4
Device tree alignment with the latest kernel delivery v4.19-stm32mp-r2.4

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I23f44856b0e2cd15492bf3295b6f3df87f8d35f6
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/152032
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-12-04 18:18:53 +01:00
16b00d6151 stm32mp1: Keep error led ON in case of low power detection
Since commit 2b1399e98c ("stm32mp1: 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.

Change-Id: I5954842931a3f46d943b91004a060d6fb5072109
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/151155
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-12-02 17:57:53 +01:00
0521742dac Prepare v2018.11-stm32mp-r3.1
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I5c0736307d87ee0b68456869eb060ec2fcb4690a
2019-09-04 17:03:05 +02:00
6b2a20d5e9 remoteproc: rproc-uclass: Fix elf header parsing
If p_type is different from LOAD type the phdr pointer is not
incremented. As consequence following sections are never loaded.

Change-Id: Ia4f55e56f34cf235bb12d0e48af88639040f55ef
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/141879
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Fabien DESSENNE <fabien.dessenne@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-09-04 16:40:50 +02:00
22eea618b3 Prepare v2018.11-stm32mp-r3
- Add SPI driver
- Add RTC driver for UEFI
- Migrate qspi driver to spi-mem framework
- DDR setting v1.45 / alignment with latest CubeMX generation
- Solve issues of ethernet driver and phy
- Activate UEFI support for EBBR (https://github.com/ARM-software/ebbr)
- Update bootcmd and migrate to Kconfig (CONFIG_BOOTCOMMAND)
- Prepare bootcmd for Android
- Alignment for latest kernel device tree v4.19-stm32mp-r2
- Alignment with up-streamed drivers
- Many other corrections


Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: If45cf134951830d1c4e3428512d042c8f82b0bda
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/138045
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-09-03 11:20:42 +02:00
d62f14dece ARM: dts: stm32mp1: move FDCAN to PLL4_R
LTDC modifies the clock frequency to adapt it to the display. Such
frequency change is not detected by the FDCAN driver that instead
cache the value at probe and pretend to use it later.

Keep the LTDC alone on PLL4_Q by moving the FDCAN to PLL4_R.

Signed-off-by: Antonio Borneo <antonio.borneo@st.com>
Change-Id: Ide537d091d8ee33f89ee50edad59ea237e517e42
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/140379
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-09-03 11:20:42 +02:00
89cd4a7513 mmc: stm32_sdmmc2: Increase SDMMC_BUSYD0END_TIMEOUT_US
Increase SDMMC_BUSYD0END_TIMEOUT_US from 1s to 2s to
avoid timeout error during blocks erase on some sdcard

Issue seen on Kingston 16GB :
  Device: STM32 SDMMC2
  Manufacturer ID: 27
  OEM: 5048
  Name: SD16G
  Bus Speed: 50000000
  Mode: SD High Speed (50MHz)
  card capabilities: widths [4, 1] modes [SD Legacy, SD High Speed (50MHz)]
  host capabilities: widths [4, 1] modes [MMC legacy, SD Legacy, MMC High Speed (26MHz), SD High Speed (50MHz), MMC High Speed (52MHz)]
  Rd Block Len: 512
  SD version 3.0
  High Capacity: Yes
  Capacity: 14.5 GiB
  Bus Width: 4-bit
  Erase Group Size: 512 Bytes

Issue reproduced with following command:

STM32MP> mmc erase 0 100000

MMC erase: dev # 0, block # 0, count 1048576 ... mmc erase failed
16384 blocks erased: ERROR

By by setting SDMMC_BUSYD0END_TIMEOUT_US at 2 seconds and by adding
time measurement in stm32_sdmmc2_end_cmd() as shown below:

	+start = get_timer(0);
	/* Polling status register */
	ret = readl_poll_timeout(priv->base + SDMMC_STA,
				 status, status & mask,
 				 SDMMC_BUSYD0END_TIMEOUT_US);

	+printf("time = %ld ms\n", get_timer(start));

We get the following trace:

STM32MP> mmc erase 0  100000

MMC erase: dev # 0, block # 0, count 1048576 ...
time = 17 ms
time = 1 ms
time = 1025 ms
time = 54 ms
time = 56 ms
time = 1021 ms
time = 57 ms
time = 56 ms
time = 1020 ms
time = 53 ms
time = 57 ms
time = 1021 ms
time = 53 ms
time = 57 ms
time = 1313 ms
time = 54 ms
time = 56 ms
time = 1026 ms
time = 54 ms
time = 56 ms
time = 1036 ms
time = 54 ms
time = 56 ms
time = 1028 ms
time = 53 ms
time = 56 ms
time = 1027 ms
time = 54 ms
time = 56 ms
time = 1024 ms
time = 54 ms
time = 56 ms
time = 1020 ms
time = 54 ms
time = 57 ms
time = 1023 ms
time = 54 ms
time = 56 ms
time = 1033 ms
time = 53 ms
time = 57 ms
....
time = 53 ms
time = 57 ms
time = 1021 ms
time = 56 ms
time = 56 ms
time = 1026 ms
time = 54 ms
time = 56 ms
1048576 blocks erased: OK

We see that 1 second timeout is not enough, we also see one measurement
up to 1313 ms. Set the timeout to 2 second to keep a security margin.

Change-Id: I51a798f5dd2deae42daedf6a8d65dfad45de5f4c
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/139038
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Christophe KERELLO <christophe.kerello@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-09-03 11:20:42 +02:00
91d9cea7d2 Revert "mmc: increase timeout for erase command"
This patch didn't fix anymore the original issue visible on v2018.11.
On v2019.07, this patch must be reverted, the fix must be done in
stm32_sdmmc.c driver.

This reverts commit 710aa969bef754253df3ce9f9f8b586b830f96b6.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Change-Id: I61bca0431a20571e2a62f04b760fe124b9c427aa
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/139037
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Christophe KERELLO <christophe.kerello@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-09-03 11:20:42 +02:00
57eeb4d8cc mach-stm32mp1: Overwrite serial and MAC address from OTP
Force read of serial and MAC address from OTP and overwrite
serial and MAC address environment variable.

Change-Id: I2a4d1fdedad7c6f9857073901dfefe82f82e1fdb
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/139195
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-09-03 11:20:42 +02:00
2ac7bedb81 configs: stm32mp1: Enable CONFIG_ENV_OVERWRITE flag
Allows to overwrite environment variable
This is needed to overwrite serial and mac address environment
variable.

Change-Id: I3464b3072b9839287cebaed9272b4b72b852e838
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/139194
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-09-03 11:20:42 +02:00
026ca8e670 dt-bindings: clock: stm32mp1: support disabled fixed clock
Add precision for disabled fixed clock in stm32mp1 binding.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I2a53ba272337036ba919b19cfcba63a9653568f6
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/137812
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2019-09-03 11:20:42 +02:00
0470194891 stm32mp1: ram: fix address issue in 2 tests
If user choose to test memory size is 1GByte (0x40000000),
memory address would overflow in test "Random" and
test "FrequencySelectivePattern".
Thus the system would hangs up when running DDR test.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Bossen WU <bossen.wu@st.com>
Change-Id: I61354d6c7a8f90f3ba20d3130339ef5d37905d8e
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/136875
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2019-09-03 11:20:41 +02:00
b09e8d7430 ARM: dts: stm32: dk1: activate adc used for usb power check
The ADC is deactivated in kernel but U-Boot uses ADC measurements
on adc1 channels 18 and 19 for USB power check.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I90ae4ebf67c39de79927bd586c3614e4279c2a33
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/134895
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-09-03 11:20:41 +02:00
b17bf20445 dts: stm32: alignment with v4.19-stm32mp-r2
Device tree alignment with the latest kernel delivery v4.19-stm32mp-r2

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Ib10a27589a5fb36c22c276f12a5d2b67daf1f3e2
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133369
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2019-09-03 11:20:41 +02:00
368f7883c6 rtc: Add rtc driver for stm32mp1
Add support of STM32MP1 rtc driver.
Enable it trusted, basic and optee configurations.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
Change-Id: Ied132f9956314118b5d4592a2027f0bab01123d3
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/134632
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
Reviewed-by: Amelie DELAUNAY <amelie.delaunay@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-07-01 11:37:19 +02:00
08961a8ba0 clk: stm32mp1: Add RTC clock entry
Add RTCAPB and RTC clock support.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I6c56cc375fe8e96b6925c43c76a4594cc47adf0e
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/134631
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-06-17 09:57:38 +02:00
d57907dcd9 spi: stm32_qspi: Remove STM32_QSPI_CR_FTHRES_MASK
On STM32 F4/F7/H7 SoCs, FTHRES is a 5 bits field in QSPI_CR register,
but for STM32MP1 SoCs, FTHRES is a 4 bits field long.
STM32_QSPI_CR_FTHRES_MASK definition is not correct.

Even if it is currently not used, remove STM32_QSPI_CR_FTHRES_MASK
to avoid confusion in the future.

Change-Id: I3afebd86dc2f413bf013715d712e0e02b93f09f5
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/134149
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Christophe KERELLO <christophe.kerello@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-17 09:57:38 +02:00
b329a6493b stm32mp1: activate command dtimg
Add command dtimg used to boot ANDROID

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Ia6565b2a30ada3fe212be395acbd3f191fc616b0
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/135283
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2019-06-17 09:26:21 +02:00
be067d4370 stm32mp1: add boot command for Android
Allow to boot android with
CONFIG_BOOTCOMMAND="run bootcmd_android"

The bootcmd override DISTRO script "mmc_boot" to boot android on mmc
using system_${suffix} partition (with "_a") by default
- display splash screen
- load device tree form dtimg
- load kernel and set bootargs
- start kernel

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I8c6b3b7fc0252ccba15eb1af76fb6f7b3a1ef8e4
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/135282
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2019-06-17 09:26:21 +02:00
8cdd05a678 stm32mp1: add environment variable for board id and board rev
Add variable to identify board with HW id (read from OTP)
and revision.

Change-Id: Ie94060ff60c185630a5decbd1398b00511e09a93
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/135281
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-17 09:26:21 +02:00
c3fc0de32b cmd: part: get partition number based on partition name
Add a service to get the partition number from the partition name.

This command can be used to set a variable with the correct partition
identifier and manage command with don't support selection with
the partition name, or for bootargs by example:

part nb mmc 0 system_a rootpart_nb
env set bootargs root=/dev/mmcblk0p${rootpart_nb}

Change-Id: Ia48c0a83612d8240e9f345dc04100108b152a7e3
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/135280
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-17 09:26:21 +02:00
449958f998 cmd: dtimg: get devicetree index based on board identifier and revision
The dtimg includes several devicetrees selected by an index.
Each device tree is added in the dtimg associated with a board identifier
(and optionally a board revision).

This service is added to get back the index associated to the board id
and optionally the board rev.

Change-Id: Ie7670d4a9ee132953296a8616ce5575b6fa65de4
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/135279
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-17 09:26:20 +02:00
a442d542f9 stm32mp1: activate PRE_CONSOLE_BUFFER
Correctly handle silent=1 in the default environment.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I31cc401c389468eb5e255fe81b90dc9e95006962
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/135381
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2019-06-17 09:26:20 +02:00
c77afe905d stm32mp1: activate CONFIG_SILENT_CONSOLE
Allow to disable console with environment variable 'silent':
> env set silent 1; env save

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Ic9bdb0af617a9d61c03fc97a442a35d4f8325be8
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/135380
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2019-06-17 09:26:20 +02:00
173c86b980 console: execute flush on uart when silent is removed
Avoid to flush buffer when silent console is activated as the
console can be reactivate later, after relocation, when the env will
be updated with the saved one.

Solve issue (missing beginning of U-Boot trace) when:
- CONFIG_SILENT_CONSOLE is activated
- silent=1 is defined in default environment (CONFIG_EXTRA_ENV_SETTINGS)
- silent is removed in saved environment with:
      > env delete silent; env save

Only functional when PRE_CONSOLE_BUFFER is activated.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Ib96067d6b0c74e86223e7ef829f25552cfe1b655
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/135379
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2019-06-17 09:26:20 +02:00
a717a8c963 console: update silent tag after env load
Update the "silent" property with the variable "silent" get from
saved environment, it solves the issue when:
- CONFIG_SILENT_CONSOLE is activated
- silent is not defined in default environment
- silent is requested in saved environment with:
  > env set silent 1; env save

On next reboot the console is not disabled as expected after relocation
and the environment load from flash (the callback is not called when
the INSERT is requested in the created hash table)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I099a878524b6225164ae5fa1624402c21939a781
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/135378
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2019-06-17 09:26:20 +02:00
95be59a62b stm32mp1: syscon: remove etzpc support
Support for ETZPC is removed as this device is not present
in Linux kernel device tree.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I12f90587e2b7b9307cbbbdd7201c1857844af2bd
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/135482
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-06-17 09:26:20 +02:00
61082e30c2 stm32mp1: cleanup fdt support
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I908b51649d35edc647c8fbe561d83a827df92b90
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/135481
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-06-17 09:26:19 +02:00
42ffa538db pinctrl: stmfx: update pinconf settings
Alignment with kernel driver.

According to the following tab (coming from STMFX datasheet), updates
have to done in stmfx_pinctrl_conf_set function:

-"type" has to be set when "bias" is configured as "pull-up or pull-down"
-PIN_CONFIG_DRIVE_PUSH_PULL should only be used when gpio is configured as
 output. There is so no need to check direction.

  DIR | TYPE | PUPD | MFX GPIO configuration
  ----|------|------|---------------------------------------------------
  1   | 1    | 1    | OUTPUT open drain with internal pull-up resistor
  ----|------|------|---------------------------------------------------
  1   | 1    | 0    | OUTPUT open drain with internal pull-down resistor
  ----|------|------|---------------------------------------------------
  1   | 0    | 0/1  | OUTPUT push pull no pull
  ----|------|------|---------------------------------------------------
  0   | 1    | 1    | INPUT with internal pull-up resistor
  ----|------|------|---------------------------------------------------
  0   | 1    | 0    | INPUT with internal pull-down resistor
  ----|------|------|---------------------------------------------------
  0   | 0    | 1    | INPUT floating
  ----|------|------|---------------------------------------------------
  0   | 0    | 0    | analog (GPIO not used, default setting)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Ic5087db15247c15f883ab012e11d8fb4d0673695
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/135469
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-06-17 09:26:19 +02:00
a9e7ff977e stm32mp1: display information when U-Boot is compiled for OP-TEE
The added trace allows to detected error only with trace;
For example boot with OP-TEE & U-Boot for trusted mode =
FREEZE during relocation because end of Memory is reserved by OP-TEE.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I541efe80a8f049391cd0496dd2b5194a6dc22473
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/135334
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-06-17 09:26:19 +02:00
6dccaf25ab ram: stm32mp1: cleanup driver
Alignment with upstream:
- remove pwr (not used)
- introduce CONFIG_STM32MP1_DDR_TESTS
- remove stm32mp1_tuning.h for prototypes only used in tuning.c
- move many tuning buffers in stack to reduce memory footprint

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Ief77856ca65e83d9946b07ff012a709fb99c8629
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/135095
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-06-17 09:26:19 +02:00
e3da87025c stm32mp1: cosmetic: cleanup board
Alignment with up-stream.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Iad9168589683bfb40ca356b5a744fcedc9701baf
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/135094
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-06-17 09:26:19 +02:00
b01e1d633a arm: stm32mp1: deploy spl in root folder
Deploy u-boot-spl.stm32 binary in u-boot root folder like
the rest of the boards.
This makes it more streamlined when building in Yocto,
Buildroot etc..
- continue to generate all SPL files in spl sub-directory
- copy in root folder the needed file for user (YOCTO, buildroot):
  u-boot-spl.stm32

[backport of 1b35c90836]
[backport of 29e1a64c06]

Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I76533a6287e38f0d91f92c368e656894ce7fea4e
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/135093
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-06-17 09:26:19 +02:00
34e08a48c5 stm32mp: cosmetic: cleanup arch
Alignment with up-stream.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I6eaa767c31c8c8125a9593e4cbb154520a4a16d6
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/135092
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-06-17 09:26:18 +02:00
5abed36ebd cli: deactivate some feature for SPL
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I31e7667c70e7f238976b867cfa7fb620623f357e
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/134443
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-06-17 09:26:18 +02:00
d4e92b29a4 stm32mp1: check the boot-source to disable bootdelay
Allows to avoid to wait 2 second in U-Boot before to
start STM32CubeProgrammer command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I5bec02eb9f688cb5a2dc9025d024be01e09a02f5
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/134063
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-06-17 09:26:18 +02:00
2294b26f4a stm32mp1: use gd to store frequency information
Use existing gd structure to store frequency information
which can be used in drivers or arch without new request.

Change-Id: Ibe32fe00b89f2ad5b345a46d4bd80d41c1c0cf02
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/134026
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2019-06-17 09:26:18 +02:00
2b1399e98c stm32mp1: support of error led on ed1/ev1 board
Create a function led_error_blink and add node in device
tree.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I282911f43d565511221106198bde5101b4ec659b
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133929
2019-06-17 09:26:18 +02:00
996b3080a6 ARM: dts: stm32mp1: DDR config v1.45
Update DDR configuration with the latest update:
- Change DQSGE to 1 for DDR3, to cure missing DQS preamble.

Change-Id: Ibf609264ca2d1ab93c7f5bd5f949b4eb352fae94
Signed-off-by: Nicolas Le Bayon <nicolas.le.bayon@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133883
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-17 09:26:18 +02:00
3e098b9cba remoteproc: stm32_copro: Fix warnings when compiling with W=1
This patch solves the following warnings:

drivers/remoteproc/stm32_copro.c: In function 'st_of_to_priv':
drivers/remoteproc/stm32_copro.c:60:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if (len < 3 * sizeof(fdt32_t)) {
          ^
drivers/remoteproc/stm32_copro.c:77:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if (len < 3 * sizeof(fdt32_t)) {
          ^
drivers/remoteproc/stm32_copro.c: In function 'stm32_copro_da_to_pa':
drivers/remoteproc/stm32_copro.c:156:9: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
  if (da >= 0 && da < STM32_RETRAM_SIZE)
         ^~

Change-Id: I7ab177325f121fdf59efdf4979ec7c4eb2e78dcb
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133272
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-17 09:24:15 +02:00
cf4c209e78 pinctrl: pinctrl_stm32: Fix warnings when compiling with W=1
drivers/pinctrl/pinctrl_stm32.c:139:13: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
    if (*idx < 0)
             ^
drivers/pinctrl/pinctrl_stm32.c: At top level:
drivers/pinctrl/pinctrl_stm32.c:218:5: warning: no previous prototype for 'stm32_pinctrl_probe' [-Wmissing-prototypes]
 int stm32_pinctrl_probe(struct udevice *dev)
     ^~~~~~~~~~~~~~~~~~~

This patch solves the following warnings:

Change-Id: Ibd0c9a5e680377bbb065dea706c2ff4daa1d01cf
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133271
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrice CHOTARD <patrice.chotard@st.com>
2019-06-17 09:24:15 +02:00
86305e1d60 ram: stm32mp1_ram: Fix warnings when compiling with W=1
This patch solves the following warnings:

drivers/ram/stm32mp1/stm32mp1_ram.c: In function 'stm32mp1_ddr_clk_enable':
drivers/ram/stm32mp1/stm32mp1_ram.c:33:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (idx = 0; idx < ARRAY_SIZE(clkname); idx++) {
                    ^
drivers/ram/stm32mp1/stm32mp1_ram.c: In function 'stm32mp1_ddr_setup':
drivers/ram/stm32mp1/stm32mp1_ram.c:98:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (idx = 0; idx < ARRAY_SIZE(param); idx++) {
                    ^

Change-Id: I4cebe75cf58c9f460ebfc42f4fe5124164de23d5
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133270
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-17 09:24:15 +02:00
59db4e04f3 ram: stm32mp1_ddr: Fix warnings when compiling with W=1
This patch solves the following warnings:

drivers/ram/stm32mp1/stm32mp1_ddr.c:642:6: warning: no previous prototype for 'mode_register_write' [-Wmissing-prototypes]
 void mode_register_write(struct ddr_info *priv, u8 addr, u16 data)
      ^~~~~~~~~~~~~~~~~~~

Change-Id: I41c70b685514b783fdbf56fd9d464c5fab7b374c
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133269
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-17 09:24:15 +02:00
e18553fc1a phy: phy-stm32-usbphyc: Fix warnings when compiling with W=1
This patch solves the following warnings:

drivers/phy/phy-stm32-usbphyc.c:63:6: warning: no previous prototype for 'stm32_usbphyc_get_pll_params' [-Wmissing-prototypes]
 void stm32_usbphyc_get_pll_params(u32 clk_rate, struct pll_params *pll_params)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

Change-Id: I7ad629180f5dcff3faa6d5926bb7b3d076465e65
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133268
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-17 09:24:15 +02:00
790af47bca misc: stm32_fuse: Fix warnings when compiling with W=1
This patch solves the following warnings:

drivers/misc/stm32mp_fuse.c:20:5: warning: no previous prototype for 'fuse_read' [-Wmissing-prototypes]
 int fuse_read(u32 bank, u32 word, u32 *val)
     ^~~~~~~~~
  CC      cmd/sf.o
drivers/misc/stm32mp_fuse.c:52:5: warning: no previous prototype for 'fuse_prog' [-Wmissing-prototypes]
 int fuse_prog(u32 bank, u32 word, u32 val)
     ^~~~~~~~~
drivers/misc/stm32mp_fuse.c:83:5: warning: no previous prototype for 'fuse_sense' [-Wmissing-prototypes]
 int fuse_sense(u32 bank, u32 word, u32 *val)
     ^~~~~~~~~~
drivers/misc/stm32mp_fuse.c:114:5: warning: no previous prototype for 'fuse_override' [-Wmissing-prototypes]
 int fuse_override(u32 bank, u32 word, u32 val)
     ^~~~~~~~~~~~~

Change-Id: Ife3950c72e40dfeb6ab541676c73a4a82814945e
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133267
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-17 09:24:14 +02:00
422680882f mailbox: stm32-ipcc: Fix warnings when compiling with W=1
This patch solves the following warnings:

drivers/mailbox/stm32-ipcc.c: In function 'stm32_ipcc_probe':
drivers/mailbox/stm32-ipcc.c:130:42: warning: pointer targets in passing argument 3 of 'dev_read_prop' differ in signedness [-Wpointer-sign]
  cell = dev_read_prop(dev, "st,proc_id", &len);
                                          ^

Change-Id: I0e63720a32f401506269b33dc0928d4554e9704a
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133266
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-17 09:24:14 +02:00
497f679861 power: regulator: stm32: Fix warnings when compiling with W=1
This patch solves the following warnings:

drivers/power/regulator/stm32-vrefbuf.c: In function 'stm32_vrefbuf_set_value':
drivers/power/regulator/stm32-vrefbuf.c:80:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (uV == stm32_vrefbuf_voltages[i]) {
          ^~

Change-Id: Icfa1d7dfa5ba391019b6b93db9084079243b6d95
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133265
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-17 09:24:14 +02:00
274fb39006 spi: stm32: Fix warnings when compiling with W=1
This patch solves the following warnings:

drivers/spi/stm32_spi.c: In function 'stm32_spi_write_txfifo':
drivers/spi/stm32_spi.c:116:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (priv->tx_len >= sizeof(u32) &&
                    ^~
drivers/spi/stm32_spi.c:122:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   } else if (priv->tx_len >= sizeof(u16) &&
                           ^~
drivers/spi/stm32_spi.c: In function 'stm32_spi_read_rxfifo':
drivers/spi/stm32_spi.c:150:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       (priv->rx_len >= sizeof(u32) || (sr & SPI_SR_RXWNE))) {
                     ^~
drivers/spi/stm32_spi.c:156:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       (priv->rx_len >= sizeof(u16) ||
                     ^~
drivers/core/simple-bus.c:15:12: warning: no previous prototype for 'simple_bus_translate' [-Wmissing-prototypes]
 fdt_addr_t simple_bus_translate(struct udevice *dev, fdt_addr_t addr)
            ^~~~~~~~~~~~~~~~~~~~
drivers/spi/stm32_spi.c: In function 'stm32_spi_set_speed':
drivers/spi/stm32_spi.c:335:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
      div > STM32_MBR_DIV_MAX)
          ^
drivers/spi/stm32_spi.c:344:19: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
  if ((mbrdiv - 1) < 0)
                   ^
drivers/spi/stm32_spi.c: In function 'stm32_spi_probe':
drivers/spi/stm32_spi.c:531:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (i = 0; i < ARRAY_SIZE(priv->cs_gpios); i++) {
                ^

Change-Id: Icbf0ea5e01fa4ff3b4aad4ce8534a4f714c0e741
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133264
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-17 09:24:14 +02:00
2a350181f0 serial: stm32: Fix warnings when compiling with W=1
This patch solves the following warnings:

drivers/serial/serial_stm32.c: In function 'stm32_serial_probe':
drivers/serial/serial_stm32.c:207:23: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
  if (plat->clock_rate < 0) {
                       ^

Change-Id: I849299bd045f34dc1670008ca42ada2a220a38e5
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133263
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-17 09:24:14 +02:00
79650e2b79 clk: clk_stm32mp1: Fix warnings when compiling with W=1
This patch solves the following warnings:

drivers/clk/clk_stm32mp1.c: In function 'stm32mp1_clk_get_parent':
drivers/clk/clk_stm32mp1.c:826:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (i = 0; i < ARRAY_SIZE(stm32mp1_clks); i++)
                ^

Change-Id: Ic6f34caa42db5674d6539bb314cbdabd5e0888ae
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133262
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-17 09:24:14 +02:00
1d928b90e3 stm32mp: stm32prog_usb: Fix warnings when compiling with W=1
This patch solves the following warnings:

arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c:166:6: warning: no previous prototype for 'dfu_initiated_callback' [-Wmissing-prototypes]
 void dfu_initiated_callback(struct dfu_entity *dfu)
      ^~~~~~~~~~~~~~~~~~~~~~

Change-Id: Id335a931cf24d1640fed50c32c266739113b3e3d
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133261
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-17 09:24:13 +02:00
bbd9fa6e3f stm32mp: stm32prog_serial: Fix warnings when compiling with W=1
This patch solves the following warnings:

arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c:32:20: warning: no previous prototype for 'stm32prog_get_entity' [-Wmissing-prototypes]
 struct dfu_entity *stm32prog_get_entity(struct stm32prog_data *data)
                    ^~~~~~~~~~~~~~~~~~~~
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c: In function 'stm32prog_read':
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c:131:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if (ret < buffer_size) {
          ^
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c: In function 'stm32prog_start':
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c:341:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (address != data->phase) {
               ^~
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c:348:44: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if (address == DEFAULT_ADDRESS || address == data->phase) {
                                            ^~
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c: In function 'download_command':
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c:795:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (i = size; i < codesize; i++)
                    ^
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c: In function 'read_partition_command':
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c:888:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (; i < codesize; i++)
            ^

Change-Id: Iea77151b99f453551054679831f56dbc6482a56b
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133260
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-17 09:24:13 +02:00
04ba3e7d9b adc: stm32: Fix warnings when compiling with W=1
This patch solves the following warnings:

drivers/adc/stm32-adc-core.c: In function 'stm32h7_adc_clk_sel':
drivers/adc/stm32-adc-core.c:87:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (i = 0; i < ARRAY_SIZE(stm32h7_adc_ckmodes_spec); i++) {
                 ^
drivers/adc/stm32-adc-core.c:107:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (i = 0; i < ARRAY_SIZE(stm32h7_adc_ckmodes_spec); i++) {
                ^

Change-Id: I48fd8f027af85f1fe40f7ba603e8efe967106a81
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133259
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-17 09:24:13 +02:00
b4b56a70f9 stm32mp1: bsec: Fix warnings when compiling with W=1
This patch solves the following warnings:

arch/arm/mach-stm32mp/bsec.c: In function 'stm32mp_bsec_read':
arch/arm/mach-stm32mp/bsec.c:363:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if (offset >= STM32_BSEC_OTP_OFFSET) {
             ^~
arch/arm/mach-stm32mp/bsec.c: In function 'stm32mp_bsec_write':
arch/arm/mach-stm32mp/bsec.c:398:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if (offset >= STM32_BSEC_OTP_OFFSET) {
             ^~

Change-Id: I89a4a52294a76c6e6262cdfcae7fdc66d879497a
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133258
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-17 09:24:13 +02:00
7cde650ff7 adc: stm32-adc: Fix warnings when compiling with W=1
This patch solves the following warnings:

drivers/adc/stm32-adc.c: In function 'stm32_adc_chan_of_init':
drivers/adc/stm32-adc.c:176:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if (num_channels > adc->cfg->max_channels) {
                   ^

Change-Id: I4a240f32a090f9f59fa40cced146e52796f2edee
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133257
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-17 09:24:13 +02:00
2c9ef7bba9 cmd: stm32key: Fix warnings when compiling with W=1
This patch solves the following warnings:

arch/arm/mach-stm32mp/cmd_stm32key.c:69:5: warning: no previous prototype for 'do_stm32key' [-Wmissing-prototypes]
 int do_stm32key(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
     ^~~~~~~~~~~

Change-Id: I7577ac44f3d833c3f91d8dbd204471b99a662966
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133256
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
6977610cd4 i2c: stm32f7_i2c: Fix warnings when compiling with W=1
This patch solves the following warnings:

drivers/i2c/stm32f7_i2c.c: In function 'stm32_i2c_compute_solutions':
drivers/i2c/stm32f7_i2c.c:524:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if (scldel < scldel_min)
               ^
drivers/i2c/stm32f7_i2c.c:530:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (((sdadel >= sdadel_min) &&
                  ^~
drivers/i2c/stm32f7_i2c.c:531:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
          (sdadel <= sdadel_max)) &&
                  ^~
drivers/i2c/stm32f7_i2c.c: In function 'stm32_i2c_choose_solution':
drivers/i2c/stm32f7_i2c.c:621:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
      if (clk_error < clk_error_prev) {
                    ^

Change-Id: I41b51a9fbf3cc7a0efb63d5c5b8f20acfe29c2f1
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133255
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
4aeb115193 gpio: stm32_gpio: Fix warnings when compiling with W=1
This patch solves the following warnings:

drivers/gpio/stm32_gpio.c: In function 'stm32_offset_to_index':
drivers/gpio/stm32_gpio.c:34:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if (idx == offset)
            ^~

Change-Id: I7accf005d5493957e5e476f4404aaf4ea339bf20
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133254
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
edf333448f cmd: pinmux: Fix warnings when compiling with W=1
This patch solves the following warnings:

cmd/pinmux.c: In function 'do_dev':
cmd/pinmux.c:26:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
   if (ret) {
      ^
cmd/pinmux.c:30:2: note: here
  case 1:
  ^~~~

Change-Id: I5535cd16093a910caaf48055330b4a0f555f7bf4
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133253
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
649aba2bad stm32mp1: cmd_stm32prog: Fix warnings when compiling with W=1
This patch solves the following warnings:

arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c: In function ‘stm32prog_header_check’:
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c:122:16: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare]
  for (i = 0; i < (sizeof(raw_header->padding) / 4); i++) {
                ^
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c: In function ‘parse_ip’:
u-boot/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c:286:17: warning: comparison of integer expressions of different signedness: ‘__kernel_size_t’ {aka ‘unsigned int’} and ‘int’ [-Wsign-compare]
   if (strlen(p) != len + 1) {
                 ^~

arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c: In function 'treat_partition_list':
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c:818:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if (data->dev[j].dev_type == -1) {
                              ^~
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c: In function 'create_partitions':
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c:895:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (mmc_id < ARRAY_SIZE(uuid_mmc)) {
                ^
  CC      cmd/version.o
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c: At top level:
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c:1524:6: warning: no previous prototype for 'stm32prog_devices_init' [-Wmissing-prototypes]
 void stm32prog_devices_init(struct stm32prog_data *data)
      ^~~~~~~~~~~~~~~~~~~~~~
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c: In function 'parse_flash_layout':
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c:428:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
    if (column == 0 && p == col) {
       ^
arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c:439:3: note: here
   default:
   ^~~~~~~

Change-Id: I3acefb406bfc8091ae5f908cfff1f6f31429603a
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133252
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
78bcf76da2 board: stm32mp1: cmd_stboard: Fix warnings when compiling with W=1
This patch solves the following warnings:

board/st/stm32mp1/cmd_stboard.c:24:16: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare]
  for (i = 0; i < ARRAY_SIZE(st_board_id); i++)
                ^

Change-Id: Ie93d7229fcae4ec951e3d4ddc83b8b2a74f17a08
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133251
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
d42837075d net: dwc_eth_qos: Fix warnings when compiling with W=1
This patch solves the following warnings:

drivers/net/dwc_eth_qos.c:624:6: warning: no previous prototype for 'eqos_stop_clks_tegra186' [-Wmissing-prototypes]
 void eqos_stop_clks_tegra186(struct udevice *dev)
      ^~~~~~~~~~~~~~~~~~~~~~~
drivers/net/dwc_eth_qos.c:639:6: warning: no previous prototype for 'eqos_stop_clks_stm32' [-Wmissing-prototypes]
 void eqos_stop_clks_stm32(struct udevice *dev)
      ^~~~~~~~~~~~~~~~~~~~
drivers/net/dwc_eth_qos.c:1293:6: warning: no previous prototype for 'eqos_stop' [-Wmissing-prototypes]
 void eqos_stop(struct udevice *dev)
      ^~~~~~~~~
drivers/net/dwc_eth_qos.c:1347:5: warning: no previous prototype for 'eqos_send' [-Wmissing-prototypes]
 int eqos_send(struct udevice *dev, void *packet, int length)
     ^~~~~~~~~
drivers/net/dwc_eth_qos.c:1388:5: warning: no previous prototype for 'eqos_recv' [-Wmissing-prototypes]
 int eqos_recv(struct udevice *dev, int flags, uchar **packetp)
     ^~~~~~~~~
drivers/net/dwc_eth_qos.c:1412:5: warning: no previous prototype for 'eqos_free_pkt' [-Wmissing-prototypes]
 int eqos_free_pkt(struct udevice *dev, uchar *packet, int length)
     ^~~~~~~~~~~~~

Change-Id: I59dd686cee8f53b091cc875e12f9ee2ad2fc3271
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133250
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
d08a553a8e board: stm32mp1: Fix warnings when compiling with W=1
This patch solves the following warnings:

board/st/stm32mp1/stm32mp1.c:164:6: warning: no previous prototype for 'board_is_dk2' [-Wmissing-prototypes]
 bool board_is_dk2(void)
      ^~~~~~~~~~~~
board/st/stm32mp1/stm32mp1.c:193:5: warning: no previous prototype for 'board_mmc_init' [-Wmissing-prototypes]
 int board_mmc_init(void)
     ^~~~~~~~~~~~~~
board/st/stm32mp1/stm32mp1.c:200:6: warning: no previous prototype for 'board_qspi_init' [-Wmissing-prototypes]
 void board_qspi_init(void)
      ^~~~~~~~~~~~~~~
board/st/stm32mp1/stm32mp1.c:276:6: warning: no previous prototype for 'board_usbotg_init' [-Wmissing-prototypes]
 void board_usbotg_init(void)
      ^~~~~~~~~~~~~~~~~
board/st/stm32mp1/stm32mp1.c:416:5: warning: no previous prototype for 'g_dnl_board_usb_cable_connected' [-Wmissing-prototypes]
 int g_dnl_board_usb_cable_connected(void)
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
board/st/stm32mp1/stm32mp1.c:426:5: warning: no previous prototype for 'g_dnl_bind_fixup' [-Wmissing-prototypes]
 int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
     ^~~~~~~~~~~~~~~~
board/st/stm32mp1/stm32mp1.c:546:5: warning: no previous prototype for 'board_interface_eth_init' [-Wmissing-prototypes]
 int board_interface_eth_init(int interface_type, bool eth_clk_sel_reg,
     ^~~~~~~~~~~~~~~~~~~~~~~~
board/st/stm32mp1/stm32mp1.c:849:19: warning: no previous prototype for 'env_get_location' [-Wmissing-prototypes]
 enum env_location env_get_location(enum env_operation op, int prio)
                   ^~~~~~~~~~~~~~~~
board/st/stm32mp1/stm32mp1.c:876:13: warning: no previous prototype for 'env_ext4_get_intf' [-Wmissing-prototypes]
 const char *env_ext4_get_intf(void)
             ^~~~~~~~~~~~~~~~~
board/st/stm32mp1/stm32mp1.c:889:13: warning: no previous prototype for 'env_ext4_get_dev_part' [-Wmissing-prototypes]
 const char *env_ext4_get_dev_part(void)
             ^~~~~~~~~~~~~~~~~~~~~
board/st/stm32mp1/stm32mp1.c:946:6: warning: no previous prototype for 'board_quiesce_devices' [-Wmissing-prototypes]
 void board_quiesce_devices(void)
      ^~~~~~~~~~~~~~~~~~~~~
board/st/stm32mp1/stm32mp1.c:1008:6: warning: no previous prototype for 'board_mtdparts_default' [-Wmissing-prototypes]
 void board_mtdparts_default(const char **mtdids, const char **mtdparts)
      ^~~~~~~~~~~~~~~~~~~~~~
board/st/stm32mp1/stm32mp1.c:1093:6: warning: no previous prototype for 'board_stm32copro_image_process' [-Wmissing-prototypes]
 void board_stm32copro_image_process(ulong fw_image, size_t fw_size)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Change-Id: I74605129d464688965da49d731c72431aa1313e8
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133249
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
e11d95c3ce stm32mp1: Fix warnings when compiling with W=1
This patch solves the following warnings:

arch/arm/mach-stm32mp/cpu.c:386:16: warning: comparison between signed
and unsigned integer expressions [-Wsign-compare]
   if (instance > ARRAY_SIZE(serial_addr))
                ^

Change-Id: I4a724828b579fbfbc3c26e27904867393eb87948
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133248
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
97c4504a0e spi: stm32_qspi: avoid warnings when building with W=1 option
This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
 - [-Wtype-limits]
 - [-Wsign-compare]

Change-Id: I345f990ea09b2be01e7db5dc3397a22593eae09a
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/132880
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
639d358acf mmc: stm32_sdmmc2: avoid warnings when building with W=1 option
This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
 - [-Wmissing-prototypes]
 - [-Wimplicit-fallthrough=]

Change-Id: I212f1c9723b88cda533b27464e32ac949f69a264
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/132879
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
f2e7a5b262 mtd: rawnand: stm32_fmc2: avoid warnings when building with W=1 option
This patch solves warnings detected by setting W=1 when building.

Warnings type detected:
 - [-Wsign-compare]
 - [-Wtype-limits]

Change-Id: I25ceb25341ffdb655607d6010f637650fad1d15e
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/132878
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
9cfd3376f7 dm: adc: uclass: get reference regulator once
device_get_supply_regulator() only needs to be called once.
But each time there's call to adc_vxx_value() for instance, it calls
adc_vxx_platdata_update() -> device_get_supply_regulator().

So, move device_get_supply_regulator() to pre_probe() routine.

This also allows vdd_supply/vss_supply to be provided directly from
uc_pdata, e.g dt-binding variant like stm32-adc provide its own
'vref-supply'.

Change-Id: I7141e575e3648ee35e6a95a44e71bbdf3f1b031a
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
[reapply a4a87f7b74]
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/131297
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
ccc895942f serial: stm32: remove watchog reset in debug putc
For STM32MP, the watchdog is based on DM and the function watchod_reset
call the function uclass_get_device(UCLASS_WDT) to found the driver
associated IWDG2.

As this reset is not mandatory in debug putc (the  uart fifo will be
empty after some us), we can simplify the code by removing this call.

And this patch avoid issue when putc is called before initialization
of DM core, before the parsing of the device tree parsing and each
node bound to driver; that also avoid memory leak.

Change-Id: I182687e29342c3dfdb1c3d501506fb01811a3909
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/131239
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2019-06-12 18:29:19 +02:00
c3217b04cd fs: ext4: do not write on filesystem with metadata_csum feature
U-Boot doesn't support metadata_csum feature. Writing to filesystem with
metadata_csum feature makes the filesystem corrupted and unbootable by
Linux:

[    2.527495] EXT4-fs (mmcblk0p2): ext4_check_descriptors: Checksum for group 0 failed (52188!=0)
[    2.537421] EXT4-fs (mmcblk0p2): ext4_check_descriptors: Checksum for group 1 failed (5262!=0)
...
[    2.653308] EXT4-fs (mmcblk0p2): ext4_check_descriptors: Checksum for group 14 failed (42611!=0)
[    2.662179] EXT4-fs (mmcblk0p2): ext4_check_descriptors: Checksum for group 15 failed (21527!=0)
[    2.687920] JBD2: journal checksum error
[    2.691982] EXT4-fs (mmcblk0p2): error loading journal
[    2.698292] VFS: Cannot open root device "mmcblk0p2" or unknown-block(179,2): error -74

Don't write to filesystem with meatadata_csum feature to not corrupt the
filesystem.

Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
[backport of 2e7365518a]

Change-Id: Icac8b1841bb574bdbcbc0522bb50973aaf7a10eb
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/131128
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
4701adfa82 stm32mp1: add check for presence of environment in boot device
For boot from flash, check presence of default environment to force
save env.

Change-Id: I06d288a1f0de94cc2618ed5ee81183018d1fcc6d
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/131127
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-06-12 18:29:19 +02:00
51da0de92c Change FDT memory type from runtime data to boot services data
Following Ard's suggestion:
Runtime data sections are intended for data that is used by the runtime
services implementation.
Let's change the type to EFI_BOOT_SERVICES_DATA

This also fixes booting of armv7 using efi and fdtcontroladdr

Suggested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
[backport of http://patchwork.ozlabs.org/patch/1084888/]

Change-Id: Ibf8d4e611f4e42d026c0924fc140cd7b8116cb69
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/130999
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
539d60142f serial: stm32: add Framing error support
Add management of Bit 1 of USART_ISR = FE: Framing error
This bit is set by hardware when a de-synchronization, excessive noise
or a break character is detected. It is cleared by software, writing 1
to the FECF bit in the USART_ICR register (for stm32 after f4).

Change-Id: I31b1d3ab476d95e4265c8b509e9e8406769c6875
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/130864
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
Reviewed-by: Fabrice GASNIER <fabrice.gasnier@st.com>
2019-06-12 18:29:19 +02:00
038753164d stm32mp1: migrate BOOTCOMMAND in defconfig
Migration needed after commit b6251db8c3 ("Kconfig:
Introduce USE_BOOTCOMMAND and migrate BOOTCOMMAND")

Change-Id: I183e04ae8606a07f1f9f637ef9018e3c19f919b2
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/129736
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2019-06-12 18:29:19 +02:00
7dc89bab59 stm32mp1: dfu: reset pointer at the end of the stm32prog command
Reset data pointer stm32prog_data to avoid data abort
when "dfu" command is used after "stm32prog command"

Change-Id: Id23adcb3bc156a40fc65fef4df8a134de1dec2f9
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/129938
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2019-06-12 18:29:19 +02:00
891268d775 mtd: rawnand: stm32_fmc2: fix oob free offset
This patch set the correct size and offset of the oob free region.

Change-Id: Ib1c5ae9b06eff55549bdd87576ef3c9cdf1d199b
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/129889
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
9ee3938bca mmc: stm32_sdmmc2: reload watchdog
This patch solves a watchdog reset issue during mmc erase command.

Change-Id: I0caaea396a9a9aa0280660751590f0945b090186
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/129888
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
e0fcd22cd6 video: OTM8009A: remove trace during probe
Change dev_err to dev_dbg for regulator trace.
Add dev_err when erro is detected.

Change-Id: I938adb51d9d5cbd3448dbb9845bcf7f6172a9524
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/129124
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Philippe CORNU <philippe.cornu@st.com>
Reviewed-by: Yannick FERTRE <yannick.fertre@st.com>
2019-06-12 18:29:19 +02:00
bcad06b2ff efi: add protection for block_dev
Check the value of block_dev before to use this pointer.
This patch solves problem for the command "load"
when ubifs is previously mounted; in this case the function
blk_get_device_part_str("ubi 0") don't return error
but return block_dev = NULL and then data abort.

Change-Id: I2a1e2bf1c8023fc2f463ce107949d0dc6f3bf0ea
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/129399
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-06-12 18:29:19 +02:00
7157fa1d0e test/py: Mark some pinmux tests as sandbox-centric
trini update of upstreamed patch:
Mark some tests as sandbox-centric

Change-Id: I72d43417dccb64e3ee8be5e0144db08eba473ade
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-on: https://gerrit.st.com/129397
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
92b1335d5f ARM: dts: stm32: alignment with v4.19-stm32mp-r1.2
Change-Id: Ic9b3df51ca2c8d6d8879aa0aa07528c3661f6c33
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/128949
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-06-12 18:29:19 +02:00
bf89e5e463 stm32mp1: Manage all RGMII interfaces for eth
Board codes for stm32mp1, manage all rgmii interfaces
(rgmii, rgmii-id, rgmii-rxid, rgmii-txid)

Change-Id: Iae63224c3508a34f13257c6c2c73117c7730a31b
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/128948
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Christophe ROULLIER <christophe.roullier@st.com>
2019-06-12 18:29:19 +02:00
f4bc35b197 stm32mp1: increase CONFIG_ENV_SIZE
To allows to save current environment in SDCARD,
which already larger than 4KB.
  Environment size: 4106/4091 bytes
we need to increase the value of CONFIG_ENV_SIZE to 8KB.

Change-Id: Iec6b3e825770236f6a8d04b8d2b160cf2f345286
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/128947
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-06-12 18:29:19 +02:00
66793a538d board: stm32mp1: Update power supply check via USB TYPE-C
Add 2 new checks:
 - detect when USB TYPE-C cable is not plugged correctly.
   In this case, GND and VBUS pins are connected but not CC1
   and CC2 pins.

 - detect is an USB Type-C charger supplies more than 3 Amps
   which is not compliant with the USB Type-C specification

In these 2 situations, stop the boot process and let red led
blinks forever.

   V cc1      |   V cc2     | power supply | red led | console message
range (Volts) |range (Volts)|   (Amps)     | blinks  |
--------------|-------------|--------------|---------|-----------------------------------
    > 2.15    |   < 0.2     |     > 3      | for ever| USB TYPE-C charger not compliant with specification
[2.15 - 1.23[ |   < 0.2     |     3        |   NO    | NO
[1.23 - 0.66[ |   < 0.2     |     1.5      | 3 times | WARNING 1.5A power supply detected
[0.66 - 0]    |   < 0.2     |     0.5      | 2 times | WARNING 500mA power supply detected
    < 0.2     |   < 0.2     |              | for ever| ERROR USB TYPE-C connection in unattached mode
    > 0.2     |   > 0.2     |              | for ever| ERROR USB TYPE-C connection in unattached mode

Change-Id: I803e791c4a996ecedd41a7bb8b6855d11f45d38d
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/127540
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
3d48f24256 board: stm32mp1: add spi nand support
This patch adds the support of the spi nand device in mtdparts command.

Change-Id: Id708e0e9584d8460e90637f0db18f1804f3e1283
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-on: https://gerrit.st.com/128094
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>

# Conflicts:
#	include/configs/stm32mp1.h
2019-06-12 18:29:19 +02:00
208786420d board: stm32mp1: rework board_mtdparts_default
This patch prepares the support of the spi nand device.

Change-Id: I043065b3c27d583be550a353078c92f9c2b15428
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-on: https://gerrit.st.com/128093
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-06-12 18:29:19 +02:00
fe4a37e985 spi: stm32_qspi: add exec_op support
This patch adds exec_op support used in SPI-MEM framework.
Thanks to exec_op support, spi nand framework can currently be used
with QSPI IP.

Change-Id: I951744082c61a7e88e73ce870a329d8bc19fbdea
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-on: https://gerrit.st.com/128092
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
a62067f8ff spi: stm32_qspi: use readl_poll_timeout to avoid infinite loop
Change-Id: I0bd7787747f8a266a87198b10b2b77bac0406280
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-on: https://gerrit.st.com/128091
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
924fb0070d spi: stm32_qspi: rework end of transfer
This patch prepares the add of exec_op function used by spi-mem framework.
stm32_qspi_wait_cmd function will be called in exec_op function.

Change-Id: I79236beefde7ea1056b47ec74c1cf21f98227404
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-on: https://gerrit.st.com/128090
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
0c82ca32d8 spi: stm32_qspi: rework read/write data function
This patch prepares the add of exec_op function used by spi-mem framework.
stm32_qspi_tx_poll function will be called in exec_op function.

Change-Id: I8cd1e4c128e71e6720a3adaa46f3ad03ce13f3a3
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-on: https://gerrit.st.com/128089
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
a2ddf2bacf spi: stm32_qspi: manage different flashes
There is 2 chip select. Each chip select can manage different flashes that
have different configurations (frequency, mode).

The controller has to be properly configured for each flash. Set_speed and
set_mode functions are not systematically called before the bus is claimed.
To avoid any issues, the flash configuration is saved the first time
claim_bus function is called, and then is systematically restored each time
we move from a different chip select.

Change-Id: I9e94d4ade934eba6760a90f28ccdbfd4fd771705
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-on: https://gerrit.st.com/128088
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
df7e29293b spi: stm32_qspi: remove useless functions and local variables
Change-Id: Ie0b1a15735e76a71e4c6def439adf630672069c3
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-on: https://gerrit.st.com/128087
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
ea6fec0b6f spi: stm32_qspi: set fsize to max address
This patch set the fsize to max address. It not necessary to know
the flash size.

Change-Id: Icc00c818a44780e147690a2ae6db618d81f707f9
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-on: https://gerrit.st.com/128086
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
966e7ed9af spi: spi-mem: Claim SPI bus before spi mem access
It is necessary to call spi_claim_bus() before starting any SPI
transactions and this restriction would also apply when calling spi-mem
operations. Therefore claim and release bus before requesting transfer
via exec_op.

Change-Id: I2ec36bfe8645520016ca61f9a5869e8dcf065fe6
Signed-off-by: Vignesh R <vigneshr@ti.com>
Tested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Tested-by: Stefan Roese <sr@denx.de>
Tested-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
Tested-by: Jagan Teki <jagan@amarulasolutions.com> #zynq-microzed
Reviewed-on: https://gerrit.st.com/128085
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Christophe KERELLO <christophe.kerello@st.com>
Tested-by: Christophe KERELLO <christophe.kerello@st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
36cec76b09 spi: spi-mem: Extend spi_mem_adjust_op_size() to honor max xfer size
Extend spi_mem_adjust_op_size() to take spi->max_write_size and
spi->max_read_size into account.

Change-Id: Iddabffb420608ae39c5c79cc53baa55c3810e25c
Signed-off-by: Vignesh R <vigneshr@ti.com>
Tested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Tested-by: Stefan Roese <sr@denx.de>
Tested-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
Tested-by: Jagan Teki <jagan@amarulasolutions.com> #zynq-microzed
Reviewed-on: https://gerrit.st.com/128084
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Christophe KERELLO <christophe.kerello@st.com>
Tested-by: Christophe KERELLO <christophe.kerello@st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
68be2f8e4f spi: spi-mem: Allow use of spi_mem_exec_op for all SPI modes
SPI controllers support all types of SPI modes including dual/quad bus
widths. Therefore remove constraint wrt SPI mode from spi-mem layer.

Change-Id: I781cc2fa299a6ca4d62ddd5b270f86034fd2aa03
Signed-off-by: Vignesh R <vigneshr@ti.com>
Tested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Tested-by: Stefan Roese <sr@denx.de>
Tested-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
Tested-by: Jagan Teki <jagan@amarulasolutions.com> #zynq-microzed
Reviewed-on: https://gerrit.st.com/128083
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Christophe KERELLO <christophe.kerello@st.com>
Tested-by: Christophe KERELLO <christophe.kerello@st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
30db435de3 configs: stm32mp15: Enable STM32_SPI and CMD_SPI flag
This enables the SPI support for STM32MP15.

Change-Id: I0443c434613dd69e05af3884569a2686ef8de5a0
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/127798
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
bc858f6314 spi: stm32: Add Serial Peripheral Interface driver for STM32MP
Add SPI driver support for STM32MP SoCs family.

Change-Id: I70967cfddfc81ef0164ef6837772837c360a640e
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/127801
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
459a0c45b8 clk: stm32mp1: Add SPI1 clock entry
Change-Id: I8f294872c92efc5a3f0b18961c667bc29d949a2d
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/127800
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
a4ec9ce9df stm32mp1: activate UEFI defconfig
Activates the UEFI configuration mandatory for the ARM
Embedded Base Boot Requirements (EBBR) specification.
see https://github.com/ARM-software/ebbr

Adds the command bootefi.

Change-Id: Ic7659fb4efb56a417062b8946498fb1a71dcd5f7
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/127734
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-06-12 18:29:19 +02:00
a897ef513f stm32mp1: dts: override the compatible for SDMMC2
If the SDMMC2 compatible changes in the U-Boot device tree
located at ${fdtcontroladdr} address, this DT can't be reused for
EFI boot for kernel, with the comand

$> bootefi <image address> ${fdtcontroladdr}

The patch only adds the needed U-Boot compatible and keeps the original
compatibles of kernel device tree, as fallback.

Change-Id: Idfabe57e28e6767a626ee6b06c56ab54a19f296f
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/127666
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2019-06-12 18:29:19 +02:00
bfa3dd2269 stm32mp1: deactivate WATCHDOG in defconfig
Deactivate WATCHDOG by default in u-boot to avoid issue to boot kernel
and rootfs without the needed daemon to reload it.

Change-Id: I8af7eb32ce3cd09e1cec6fb2fc4107a6ea895bbb
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/127483
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-06-12 18:29:19 +02:00
0794bcc845 gpio: stm32: Remove .ofmatch callback
As compatible string "st,stm32-gpio" is no more used, .ofmatch
callback becomes useless, remove it.

Change-Id: Ie72f86e0d9538ff380f5e3bb6d535629e97573e9
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/126444
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
0f1eb28985 ARM: dts: stm32: Remove useless "st,stm32-gpio" compatible string
Since pinctrl_stm32 driver update, each gpio bank is now binded
by pinctrl driver. The compatible string "st,stm32-gpio" becomes
useless, remove it.

Change-Id: I537b9ce9e3a9921324838a06adce1b384e6249b9
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/126443
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
04b05a110a pinctrl: stm32: update .bind callback
Update .bind callback in order to bind all pinctrl subnodes
with "gpio-controller" property to gpio_stm32 driver.

Change-Id: Iea41ff242d5e78e9c4bb904c9b5efc2d9bd4c47e
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/126442
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
2a2abc60b2 gpio: stm32: Rename stm32f7_gpio to stm32_gpio
As this driver is used on stm32f4/f7/h7 and stm32mp1
SoCs, rename it with a more generic name.

Change-Id: I9b97cc4945c76d2a7bb269e7d2bf63cf6a8e6651
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/126441
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
a94c0486c1 stm32mp1: psci: add synchronization with ROM code
Use SGI0 interruption  and TAMP_BACKUP_MAGIC_NUMBER
to synchronize the core1 boot sequence requested by
core0 in psci_cpu_on():
- a initial interruption is needed in ROM code after
  RCC_MP_GRSTCSETR_MPUP1RST (psci_cpu_off)
- the ROM code set to 0 the 2 registers
  + TAMP_BACKUP_BRANCH_ADDRESS
  + TAMP_BACKUP_MAGIC_NUMBER
  when magic is not egual to
  BOOT_API_A7_CORE0_MAGIC_NUMBER

This patch solve issue for cpu1 restart in kernel.
echo 0 > /sys/devices/system/cpu/cpu1/online
echo 1 > /sys/devices/system/cpu/cpu1/online

Change-Id: I2928dc437dbc58e763115cdb66fe93e07a012a28
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/126762
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-06-12 18:29:19 +02:00
0ea9de32aa board: stm32mp1: Update the way vdd-supply is retrieved from DT
Due to kernel DT alignment, pwr-supply is renamed to vdd-supply
and is a subnode of pwr-regulators.

Change-Id: I3020651a309516aa527cdd7114ec8e5da93f7f80
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/126480
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
de03197119 ARM: dts: stm32: Update pwr-regulators node for ED1 and DK1
To align with kernel device tree, the pwr node is reworked.
pwr-supply is renamed and put under a pwr-regulators sub-node.

Change-Id: I939c632ccedb073583662ac33d013a589d8e4d47
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/126479
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
3a4bf1551c stm32mp1: reload watchdog during ddr test
Avoid watchdog during infinite DDR test.

Change-Id: I71fe0e256b52cff27fc61829863685d584b4e750
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/126784
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2019-06-12 18:29:19 +02:00
2a1aa43aef stm32mp1: update loop management in infinite test
Reduce verbosity of the infinite tests to avoid CubeMX issue.
test and display loop by 1024*1024 accesses: read or write.

Change-Id: I43717c94bc844db371e6aa96aa45abb6266a4577
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/126783
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2019-06-12 18:29:19 +02:00
de99afc2b0 stm32mp1: add pattern parameter in infinite write test
Change-Id: I5d1826f726a93b69905291a18a18b9f8f2cfdbf4
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/126782
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2019-06-12 18:29:19 +02:00
a1423d5ddc pinctrl: stm32: cosmetic: reduce delta with upstream branch
Protect configuration registers with a hardware spinlock.

If a hwspinlock is defined in the device-tree node used it
to be sure that none of the others processors on the SoC could
change the configuration at the same time.

Change-Id: I0855704157fb77fe7cf01292e8dbcbf2914c0f44
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/127326
2019-06-12 18:29:19 +02:00
c766a755dd hwspinlock: cosmetic: use priv data in stm32 hardware spinlock
Backport of commit 9119f547d3 ("hwspinlock: add stm32
hardware spinlock support")' accepted after upstream review.

Change-Id: If5b132bb9ab5a2010f6c4231c509241d8122d6dc
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/127325
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
c89d129408 net: dwc_eth_qos: add delay for SWR operation
Need more delay to have eth-ck enable when software reset operation
for specific PHY (Phy without crystal)

Change-Id: Ia1833a9a5c16b80a25dcadd422b0d260227c7ada
Signed-off-by: Christophe Roullier <christophe.roullier@st.com>
Reviewed-on: https://gerrit.st.com/125912
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
61a2ad5773 ARM: dts: stm32: Remove g-tx-fifo-size for stm32mp157c-u-boot
As dwc2_udc_otg driver has been updated and is able to manage
an array of tx-fifo-size, g-tx-fifo-size doesn't need to be
overload anymore.

Change-Id: Ic4e23beb767275e39490db60345973eddcadc1b1
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/125885
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
ba6fcdb933 board: stm32mp1: Add tx_fifo_sz_array support
Allows to use an array of tx-fifo-size defined in device tree
as following:
   g-tx-fifo-size = <128 128 64 64 64 64 32 32>;

Change-Id: Ie1386895ad28c278082b32330aec6b9132f9d5e6
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/125884
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
6bdb3885bf usb: dwc2_udc_otg: Add tx_fifo_sz array support
All TX fifo size can be different, add tx_fifo_sz_array[]
into dwc2_plat_otg_data to be able to set them.

tx_fifo_sz_array[] is 17 Bytes long and can contains max 16
tx fifo size (synopsys IP supports max 16 IN endpoints).
First entry of tx_fifo_sz_array[] is the number of element
the array contains.

In case of tx_fifo_sz_array[] doesn't contains the same
number of element than max hardware endpoint, display
an error message.

Change-Id: Iaa47c39aeab0e434a6baa6eccc1d2e509f3f12f1
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/125883
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
790b4cd7dc usb: dwc2_udc_otg: Read MAX_HW_ENDPOINT from HWCFG4 register
Some DWC2 ip variant doesn't use 16 hardware endpoint as hardcoded
in the driver. Bits INEps [29:26] of HWCFG4 register allows to get
this information.

Change-Id: Iaf1646eab749b898c2fb5c7e5a70d76ceebb2101
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/125882
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
81d312946c ram: stm32mp1: update parameter array initialization
Force alignment of the size of parameters array with
the expected value by the binding.

Change-Id: I9fbdcc55b1cd18866fa9d0816475184fede2a650
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/125991
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
Reviewed-by: Nicolas LE BAYON <nicolas.le.bayon@st.com>
2019-06-12 18:29:19 +02:00
624506fea3 stm32mp1: cosmetic: update bootcmd
Respect the 80 characters limitation, as done for up-streamed
version of this patch.

Change-Id: Id9ee103eb5a1c4cf02eefd8317ebb7cac3cd32a8
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/126281
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2019-06-12 18:29:19 +02:00
3efd0a5da1 stm32mp1: cosmetics: remove unused STM32MP_SYSCON_IWDG
Associated syscon driver no more exist,
so the define STM32MP_SYSCON_IWDG can be removed.

Change-Id: If84857521def1f98c00acc5b866ff6755e2094a2
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/126115
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2019-06-12 18:29:19 +02:00
c8521622a3 stm32mp1: cosmetics: remove duplicated line
Remove duplicated define CONFIG_SYS_MAX_NAND_DEVICE

Change-Id: I7cb01c3f095bc79872c3f399dd9e291e4d520c2d
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/125913
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2019-06-12 18:29:19 +02:00
35bbb3e561 cmd: stm32prog: reload watchdog in getc loop
The command stm32prog need to reload the watchdog to avoid
reset for some error case (when U-Boot don't received data).

Change-Id: I1f5b62ca79fbc654c5fd396fdf45a3f235fdb0f6
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/124966
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-06-12 18:29:19 +02:00
702c220c6a cmd: stm32prog: delay NACK when checksum error is detected
Wait few ms to be sure that all data are received in the FIFO of
UART before flush it; that avoid synchronization error when NACK
is sent to STM32CubeProgrammer, so the commit improves the serial
programming robustness (rootfs can be updated without freeze).

Change-Id: I08aa2c1555884932661639b2458ae57847549257
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/124967
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-06-12 18:29:19 +02:00
466fa08754 stm32mp1: dts: remove propertie hnp-srp-disable
"hnp-srp-disable" property of usbotg_hs node must be
enable ONLY for HOST support but it is not activated
by default, so it can be removed.

Change-Id: Ic25545e8492aed0d1a0c228e8bcdba6f2aaacbdc
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/125848
2019-06-12 18:29:19 +02:00
1a9a49c696 stm32mp1: dts: dk1: remove v3v3 node in u-boot dtsi
Remove the duplicate property regulator-always-on,
already present in kernel devicetree stm32mp157a-dk1.dts.

Change-Id: If3628c8b6fd8867958b79c366f1d24896b673784
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/125847
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2019-06-12 18:29:19 +02:00
d412c90472 stm32mp1: add op-tee defconfig in README
Change-Id: I6ddc2b99066d9d861f0e8b8f8f6f3ea8d9fb1727
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/125566
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-06-12 18:29:19 +02:00
3b8056ccbc stm32mp1: reset halt workaround: no debug if sec close device
If sec close device, DBGMCU can't be accessed, so we do not
debug in this case. Information is stored in bit 6 of OTP0 data.

Change-Id: I067b37286e7af30cab318b4cad5bddd27104816a
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/125739
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2019-06-12 18:29:19 +02:00
3eee756d7a stm32mp: cosmetics: rename stm32mp1_helper_dbg.S
Remane stm32mp1_helper_dgb.S to stm32mp1_helper_dbg.S

Change-Id: Ib80d45f0a4e39c43854e5287a81314ebc00d4a4f
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/125738
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2019-06-12 18:29:19 +02:00
2545f10899 stm32mp1: stm32prog command: use linux reserved UUID for RAW partiton
The specification request that "Binary" partition in flash
layout use the the linux reserved UUID
(GUID = 8DA63339-0007-60C0-C436-083AC8230908).
That to avoid auto mount request in Linux.

The previous used UUID data, was used for Windows
FAT file system.

See https://wiki.st.com/stm32mpu/index.php/STM32CubeProgrammer_flashlayout
chapter GPT_partition_of_block_device-_SD_card_-2F_eMMC
and https://en.wikipedia.org/wiki/Microsoft_basic_data_partition

Change-Id: I2559720b86474d10551d51c2d96af687e7bfb58f
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/125748
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-06-12 18:29:19 +02:00
3b5b7158a7 srm32mp1: ram: add Loop and Address for some tests
Add parameter for the last-added tests (come from memtester)
in SPL DDR interactive mode
- BlockSequential
- Checkerboard
- BitSpread
- BitFlip
- WalkingOnes
- WalkingZeroes

Change-Id: I32092640a765db68466474d90a9536410c7e5ce9
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/125786
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2019-06-12 18:29:19 +02:00
e7d2582fac ARM: dts: stm32: Remove usb1600 property for stm32mp157a-dk1-u-boot
This property was introduced temporary to manage different USB
initialization between EV1 and DK1/2 boards. Now the presence
of stusb1600 node is used. So remove the usb1600 property.

Change-Id: I02f048b8614143bee9949219b62cf4649ca02a96
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/125842
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
48b24d6363 board: stm32mp1: Remove usage of temporary usb1600 property
usb1600 property was temporary introduced by
'commit b2b7fd4c4b9f ("ARM: dts: stmp32: add usb1600 in usbo node
for u-boot for stm32mp157a-dk1")' to be able to manage different usb
initialization between EV1 and DK1/2 board.

Since kernel DT is using new node stusb1600 describing the
USB type-C controller for DK1/2 boards.

Test this node presence in DT instead and remove the usb1600 property.

Change-Id: I5ee255432773813cc2399c8606e0aef62a9f3062
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/125841
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
a093c9007d stm32mp1: cosmetic: cleanup
Alignment with upstream

Change-Id: I65617d1698f7d519dddb906e85480042c0b83caf
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/125699
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2019-06-12 18:29:19 +02:00
6403ca7be6 configs: stm32mp15: Enable WDT flags
This allows to enable WATCHDOG and WDT flags to
be able to reset the watchdog and to support watchdog driver
model.

Change-Id: I9287e4b2b9f4fa14c7eb2d0280e03736eb57cf3f
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/125148
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
6f250948c2 board: stm32mp1: Start watchdog
Add watchdog_start() call in both basic and trusted mode.
Add also the watchdog_reset().

Change-Id: I4a94420abe5b5603bedbf72dee58effad7d08b70
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/125147
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
36a7d40ef9 watchdog: stm32mp: Convert driver to use WDT UCLASS
Change-Id: I7f129ade72164bae91d8805b2eb9468f9b70101a
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/125146
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
4c1f94966f watchdog: Kconfig: Sort entry alphabetically
Change-Id: I487a163d25b15b0f98f521e1a2f9b36503948d44
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/125381
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
13da149192 pinctrl: stmfx: add .get_pin_muxing callback support
This is needed to get pin muxing state of STMFX GPIO expander.

Change-Id: I43ac3bf12810b8b3e20d791814cbed6ec83220f1
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/125687
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-06-12 18:29:19 +02:00
fbc47b135b stm32mp1: configs: Add CONFIG_OF_SPL_REMOVE_PROPS
Removes unused device tree property in SPL
to reduce the SPL size by 1kB

Change-Id: Id0eff5b025dfb0603e640d70640a221d35f25b38
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/121420
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-06-12 18:29:19 +02:00
aebd74760b stm32mp1: dts: remove dm-pre-reloc for config node
This tag is not necessary as always added in SPL
device tree (see cmd_fdtgrep in scripts/Makefile.lib).

Change-Id: I035b38233874824ffa1a14d4d44d4532de7fbce6
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/121421
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2019-06-12 18:29:19 +02:00
8c5d675f52 remoteproc: rproc-uclass: Fix warnings for aarch64 platforms
drivers/remoteproc/rproc-uclass.c:452:25: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
   flush_cache(rounddown((int)dst, ARCH_DMA_MINALIGN),
                         ^
include/linux/kernel.h:81:9: note: in definition of macro 'rounddown'
  typeof(x) __x = (x);    \
         ^
include/linux/kernel.h:81:19: note: in definition of macro 'rounddown'
                   ^
drivers/remoteproc/rproc-uclass.c:453:16: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
        roundup((int)dst + phdr->p_filesz,
                ^
include/linux/kernel.h:76:5: note: in definition of macro 'roundup'
  (((x) + (__y - 1)) / __y) * __y;  \
     ^
drivers/remoteproc/rproc-uclass.c:455:18: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
        rounddown((int)dst, ARCH_DMA_MINALIGN));
                  ^
drivers/remoteproc/rproc-uclass.c: In function 'rproc_elf_find_load_rsc_table':
drivers/remoteproc/rproc-uclass.c:559:9: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
   dst = (void *)shdr->sh_addr;
drivers/remoteproc/rproc-uclass.c:567:24: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  flush_cache(rounddown((int)dst, ARCH_DMA_MINALIGN),
                        ^
drivers/remoteproc/rproc-uclass.c:568:15: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
       roundup((int)dst + shdr->sh_size,
               ^
drivers/remoteproc/rproc-uclass.c:570:17: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
       rounddown((int)dst, ARCH_DMA_MINALIGN));

Change-Id: I89846ee5080752bfe7fe5d95d58ce538c571671a
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/121432
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
21c5829424 stm32mp1: Update env_get_location for NOR support
Update env_get_location() to be able to save environment into
NOR (SPI_FLASH).

Change-Id: I04e6d8142ff182325d4a754bf13cdccf5902e59d
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/121332
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
940ddbc900 configs: stm32mp15: Enable ENV_IS_SPI_FLASH
Add all relative flags needed by ENV_IS_IN_SPI_FLASH

Previously, a 256KB partition in NOR was reserved for
the BMP splashscreen which is now located in the bootfs
partition. We can reuse this partition to save the U-Boot
environment.

Change-Id: I9434585d2dbcfbb37a1f543fe0ae540ac1509c37
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/121331
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
b377093fca dm: spi: Read default speed and mode values from DT
This patch update the behavior introduced by commit 96907c0fe5
("dm: spi: Read default speed and mode values from DT")

In case of DT boot, don't read default speed and mode for SPI from
CONFIG_*, instead read from DT node. This will make sure that boards
with multiple SPI/QSPI controllers can be probed at different
bus frequencies and SPI modes.

DT values will be always used when available (full DM support of
SPI slave with DT node); for example splash (in splash_sf_read_raw)
or SPL boot (in spl_spi_load_image). The caller of
spi_get_bus_and_cs() don't need to force speed=0.

And the current behavior don't change if the SPI slave is not
present (device with generic driver is created automatically)
or if platdata is used (CONFIG_OF_PLATDATA).

Change-Id: Ia3eb3f02b0006148c86c19e60d4b552b81744ed6
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/121330
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-06-12 18:29:19 +02:00
5788a42f1a configs: stm32mp15: Enable ENV_IS_IN_UBI
Add all relative flags needed by ENV_IS_IN_UBI

Change-Id: I299b6f66a3aeb5b31c32d884d554385760bdec01
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/121329
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
16d6123875 stm32mp1: Fix board_mtdparts_default
When ENV_IS_IN_UBI is enable, board_mtdparts_default() is called
early, before relocation.

At this step, GD_FLG_ENV_READY flag is not set, env_get() always returns
the same buffer reference on consecutive call. As consequence, s_nand0 is
set, in case s_nor0 is set, s_nand0 is then updated with same value than
s_nor0.

To take care of that, use a temporary buffer which is copied into s_nor0
and/or s_nand0.

As s_nand0 and s_nor0 are long string, the gd->env_buf[32] is too small,
apply same solution than in commit a7eb1d66c7
("mtd: Make mtdparts work with pre-reloc env") to avoid the following
message: "env_buf [32 bytes] too small for value of ..."

Change-Id: I404cdb25de197dcada3fb266dc1e5d3465ac9a91
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/121328
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
1c0f4f647a mtd: Fix get_mtdparts()
When ENV_IS_IN_UBI is enable, get_mtdparts is called before relocation.

During first get_mtdparts() call, mtdparts is not available in environment,
it can be retrieved by calling board_mtdparts_default(), but following
env_set() do nothing as we are before relocation. Finally mtdparts is
still not available in environment.

At second get_mtdparts() call, use_defaults is false, but mtdparts is still
not in environment and is NULL.

Remove use_defaults bool, only mtdparts criteria is useful.

Fixes: commit 5ffcd50612 ("mtd: Use default mtdparts/mtids when not defined
in the environment")

Change-Id: Ibf57c68b062fc0e86f701dbb881c1f49a1086046
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/121327
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
10f73393dc stm32mp1: Add env_get_location()
In case of several environment location support, env_get_location
is needed to select the correct location depending of the boot
device .

Change-Id: Ia0c9a265e78a5fc49f0870323f8e644093abae5f
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/121326
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
03dd632d3d configs: stm32mp15: Enable ENV_IS_IN_EXT4 and all relative flags
Enable ENV_IS_IN_EXT4 and all relative flags to be able to
load/save environment in EXT4 partition.

This will allows to load/save environment on both sdcard and eMMC.
As for stm32mp15, bootfs has not the same partition number on sdcard
and on eMMC, we use "auto" key which allows to find the first
partition in device with bootable flag which is partition 4 on sdcard
and partition 2 on eMMC.

Change-Id: Iecda1a27a04db9aedcf1f10764c7b3b692e40863
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/121325
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
953db29a1e env: enable saveenv command when one CONFIG_ENV_IS_IN is activated
Introduce ENV_IS_IN_DEVICE to test if one the
CONFIG_ENV_IS_IN_ is defined and support the command
saveenv even if CONFIG_ENV_IS_NOWHERE is activated

Change-Id: I1d5c3ed7085398cf9a28f2cb2eb11fc090cb203d
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/125906
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2019-06-12 18:29:19 +02:00
60d5ed2593 env: allow ENV_IS_NOWHERE with other storage target
Allow U-Boot to get default environment for some boot mode
(USB for example), and to select storage location when it is
booting from flash device;
ENVL_NOWHERE is present in env_locations with other one.

Change-Id: I0363120e7e18660c35572dc380527df6da2923a0
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/125071
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2019-06-12 18:29:19 +02:00
c488932624 board: stm32mp1: Add env_ext4_get_dev_part() and env_ext4_get_intf()
This allows to :
 - select the current device to save the environment file
 - select the correct EXT4 boot device instance
   and partition to save the environment file.

For EXT4, device is mmc, device instance is 0 for sdcard or 1 for eMMC.
The partition is set to "auto" to select the first partition with
bootable flag.

Change-Id: I164197cc99cc670a1ede39131089bc4fd1445797
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/121324
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
4e5a7e85a4 stm32mp1: Give access to get_bootmode() outside cpu.c
Allow to call get_bootmode() outside cpu.c to be able to
retrieve the boot device instance. This is needed to save
the environment on the correct boot device instance.

Change-Id: I85c0985aae7a9c81db0643b343e80445206b0cec
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/121323
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
5f708b807b env: ext4: Allow overriding interface, device and partition
For platform which can boot on different device, this allows
to override interface, device and partition from board code.

Change-Id: Iaa3dfcd07cb86e2ea705922744cdca3da5f0bb5a
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/121322
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
0f02fac220 stm32mp1: ram: add some dynamic register
Add useful register access with interactive mode:
dxngsr0/1 and zq0sr0/1

Change-Id: Ie86672e607029afb7fe564f219661e4096ade68a
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/120663
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-06-12 18:29:19 +02:00
4efe255ddd ram: stm32mp1: update help message for interactive mode
Alignment with last WIKI page.

Change-Id: I87b6de232e889e351af328c55d4007c85483a3c5
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/119929
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-06-12 18:29:19 +02:00
cb5e4e89b3 dts: stm32mp1: use u-boot,dm-pre-proper
replace property u-boot,dm-pre-reloc by new property
u-boot,dm-pre-proper when it is possible

Change-Id: I1b0c04f33bbbcf48df35e9083674bd36c358d739
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/120646
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2019-06-12 18:29:19 +02:00
54fe4129a6 fdt: Allow indicating a node is for U-Boot proper only
This add missing parts for previous commit 06f94461a9
("fdt: Allow indicating a node is for U-Boot proper only")


At present it is not possible to specify that a node should be used before
relocation (in U-Boot proper) without it also ending up in SPL and TPL
device trees. Add a new "u-boot,dm-pre-proper" boolean property for this.

Tested with "u-boot,dm-pre-proper" for video driver, without live tree.

Change-Id: I456de145f4689539dfa0c9fcda8ff0b6be0238a7
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/120645
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2019-06-12 18:29:19 +02:00
5fe1f7750b power: regulator: Return success on attempt to disable an always-on regulator
commit 4f86a724e8 ("power: regulator: denied disable on always-on
regulator") throws an error when requested to disable an always-on
regulator. It is right that an always-on regulator should not be
attempted to be disabled. But at the same time regulator framework
should not return an error when such request is received. Instead
it should just return success without attempting to disable the
specified regulator. This is because the requesting driver will
not have the idea if the regulator is always-on or not. The
requesting driver will always try to enable/disable regulator as
per the required flow. So it is upto regulator framework to not
break such scenarios.

Change-Id: Ib01b40775cd3d4314ac00c26afdc4fd316e6511b
Fixes: 4f86a724e8 ("power: regulator: denied disable on always-on regulator")
Reported-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-on: https://gerrit.st.com/119873
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-06-12 18:29:19 +02:00
f7503df12a stm32mp1: enable TAMP clock before access to register
Normally RTCAPBEN is already enable by ROM code, but it
is safe to enable the clock in all the case.

Change-Id: I288096ee787bbaf8a7eb291e3792c4e1eb46a417
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/119875
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2019-06-12 18:29:19 +02:00
e8cc04677d Prepare v2018.11-stm32mp-r2.5
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I7dd4371d7b19443d75b04bc5a5b989b2e3099603
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/135441
2019-06-12 18:29:19 +02:00
4d63375083 psci: protect variable used before relocation
Move the variable invoke_psci_fn in .data section
and the driver access it safely it before relocation.

Without patch the variable is located in .bss section
and the probe requested relocation corrupt the device tree
(probe requested by board_f.c::print_resetinfo()).

Change-Id: If993a440864151e93451cb3a25496e76e3006e9c
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/135581
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-06-12 18:26:50 +02:00
a9501c3eb8 stm32mp1: Add PSCI node access before relocation
Add node in DT and avoid error to search UCLASS_SYSRESET in
board_f.c::print_resetinfo() and lost 1.6s in U-Boot
for the trusted boot chain.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I47ef11c3363be3aaba73a588107e2a876c0eb953
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/135443
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2019-06-10 14:39:16 +02:00
57588fa01f Prepare v2018.11-stm32mp-r2.4
Change-Id: Idbdfb5b27599270d724e6a01fd82c20585d3c28a
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/133208
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-05-21 11:10:28 +02:00
9b08cfac37 usb: dwc2: fix gadget disconnect
This fixes a disconnect issue detected with fastboot command, when using
dwc2 driver.
- On u-boot side:
uboot>$ fastboot 0
- On USB host PC side, few seconds after
PC>$ fastboot reboot # Get stuck, uboot target never reboots

By enabling DEBUG_ISR logs, the bus suspend interrupt is seen before the
PC command has been issued. When the USB bus suspend occurs, there's a HACK
that disables the fastboot (composite driver). Here is the call stack
upon USB bus suspend:
- dwc2_handle_usb_suspend_intr()
  - dev->driver->disconnect()
    - composite_disconnect()
      - reset_config()
        - f->disable()
          - fastboot_disable()
            - usb_ep_disable(f_fb->out_ep);
            - usb_ep_disable(f_fb->in_ep);
            .. other disable calls.

When the resume interrupt happens, everything has been disabled, then
nothing happens. fastboot command gets stuck on HOST side.

Remove original HACK, that disconnects the composite driver upon
USB bus suspend. Implement disconnect detection instead:
- check GINTSTS OTG interrupt
- read GOTGINT register
- check GOTGINT, SesEndDet bit (e.g. session end)
This is inspired by what is implemented currently in Linux dwc2 driver.

Reviewed-by: Marek Vasut <marex@denx.de>
[backport of 7fd9f31c6b]

Change-Id: I1eb776d1032222d5320408172206bb37465d2430
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/131243
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-05-13 09:59:20 +02:00
7414eea7e0 Prepare v2018.11-stm32mp-r2.3
Change-Id: I7a86fd4f95d536f6926c13c0ca4ea98337e65046
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/131170
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-04-16 17:17:43 +02:00
be710c5302 ed1: add pull-up on serial rx of console connected to STLINK
Avoid U-Boot auto-boot interruption for line break detection
on console when the RX line connected to STLINK is floating
(-IO error in getc cause by framing error and testc return 1)

Change-Id: I4ba0e1f4e3430157833dfda483c754f7da129d24
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/131191
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Gerald BAEZA <gerald.baeza@st.com>
2019-04-16 17:16:33 +02:00
6b6506fcca dk1: add pull-up on serial rx of console connected to STLINK
Avoid U-Boot auto-boot interruption for line break detection
on console when the RX line connected to STLINK is floating
(-IO error in getc cause by framing error and testc return 1)

Change-Id: Id723ae5228bdc54827f0997e1a4c6ad7da4a77f5
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/130968
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Antonio Maria BORNEO <antonio.borneo@st.com>
Reviewed-by: Jean Philippe ROMAIN <jean-philippe.romain@st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
Tested-by: Jean Philippe ROMAIN <jean-philippe.romain@st.com>
2019-04-16 10:01:29 +02:00
f55001ad5e Prepare v2018.11-stm32mp-r2.2
Change-Id: Ibc9e493c51009d22339cf3b4f9b48b18897b1515
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2019-03-26 11:37:35 +01:00
aacb637b69 ARM: dts: stm32: update power supply of rm68200 on stm32mp157c-ev1
Supply of panel rm68200 has been modified (1v8 > 3v3).
Property power-supply need also to be modified.

Change-Id: I603e160c0c531f80f765934fad8f3c1b3dd2c0c6
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/128878
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-03-26 11:37:34 +01:00
dafa5e1643 clk: stm32mp1: Fix msk value for stm32mp1_clk_sel array
Change-Id: I45f9a75a7b08202b753ba3b4d6bc9aa7b121ccf4
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/126713
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-03-21 17:20:26 +01:00
e3614a1c5c ARM: dts: stm32: DDR config to v1.44
PUBL_regs: DXnGCR[0]= according to ddr_width to disable Byte
                      lane 2/3 in 16bit

Change-Id: I3a40805de6d1a245dcad45e4663e5f9e8010d93e
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/127270
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-03-21 17:19:29 +01:00
41b168d1ca ARM: dts: stm32: DDR config to v1.43
- fix LPDDR2/3 timing_calc to step RL/WL in relaxed
  timings mode
- remove  LPDDR3 RL3 (optional) support vs  MR0[7]
  because MR0[7] can't be read instead  always apply
  worse RL/WL for LPDDR3 when freq < 166MHz)
- change  MR3 to 48ohm drive  for LPDDR2/3
- change default ZPROG[7:4] = 0x1 for LPDDR2/3 ,
  '0' is not allowed even when ODT not used
- use DQSTRN for LPDDR2/3 (it was not set in PIR)
- LPDDR3: set dqsge/dwsgx gate extension to 2,2
  like LPDDR2
-DDRCTRL.dfitmg0:
  + for LPDDR3 tphy_wrlat = WL (as LPDDR2)
  + improvement for relaxed mode vs  RL/Wl at corner case.
    For example @533MHz RL/WL (relaxed) = 9/5 for LPDDR2/3
    and correction to MR2 accordingly

Change-Id: I28070897a5ca8fa5f2eb137ac40196cdfd6ebb81
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/120661
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2019-03-21 17:19:20 +01:00
161ca183f1 Prepare v2018.11-stm32mp-r2.1
Change-Id: I0b0cb81b650ac0c0d86154a54c00ab6c03fb47a5
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2019-02-26 13:16:15 +01:00
62e1fc0969 stm32mp1: clk: use the correct identifier for ethck
ETHCK_K is the identifier the kernel clock for ETH in kernel
binding, selected by ETHKSELR / gated by ETHCKEN = BIT(7).
U-Boot driver need to use the same identifier, so change ETHCK
to ETHCK_K.

Change-Id: I8c8544168618709193838cd16cc20b193ca0760f
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/125929
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Christophe ROULLIER <christophe.roullier@st.com>
Tested-by: Christophe ROULLIER <christophe.roullier@st.com>
2019-02-26 13:16:10 +01:00
3cbc4657ac dts: alignment with v4.19-stm32mp-r1.1
Device tree alignment with the latest labels:
+ v4.19-stm32mp-r1.1

Change-Id: I56b20bed29da44f6aa57cd31320ca449cba5604b
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/126378
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-02-25 10:46:40 +01:00
f9171debe0 dts: alignment with v4.19-stm32mp-r1
Device tree alignment with the latest labels:
+ v4.19-stm32mp-r1

Change-Id: Ia2dc2a012c6e6bb6db6bb5ef5063715f33adf173
Reviewed-on: https://gerrit.st.com/120639
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-02-25 10:44:33 +01:00
afbdd009be stm32mp1: update bootcmd
Clearly separate bootcmd for stm32mp1 board
(bootcmd_stm32mp) and preboot management.
That solve issue for fastboot continue command.

Change-Id: Ifbb9eadbc9dd0c0bed13fb88dc06feb809990afa
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/125562
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-02-15 17:48:49 +01:00
e3a6e5a5e6 cmd: fastboot: add reload of watchdog
Add reload of watchdog for fastboot command,
as it was done for DFU in run_usb_dnl_gadget()

Change-Id: If24f5763db534fa440675f2e5b75a7684e6471d1
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/119945
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2019-02-15 17:48:24 +01:00
6b420c01c2 stm32mp1: skip sysconf init in trusted mode
This part is done in TF-A in trusted mode.

Change-Id: I3087e8a8d64200cdbbb5c979a99cf85457c2ee54
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/120673
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-02-15 17:47:51 +01:00
72b346ed24 net: dwc_eth_qos: Don't reconnect phy if previously done
This avoid to connect and configure an already configured PHY and more
precisely autonegotiation steps which takes several seconds.

Change-Id: Ie0b0f343f547508c32282d3f010fc98a51640075
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/125867
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-02-15 17:46:37 +01:00
b417219136 configs: stm32mp15: no need to select PHY_FIXED
By default we use the Generic PHY, no need to select PHY_FIXED.
So remove it.

Change-Id: I18abe24d61cab1dd883566bb3c4a1c86c2c03758
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/125866
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-02-15 17:46:35 +01:00
76eea16eb0 Revert "net: dwc_eth_qos: initialize PHY in probe() once"
Issue detected when executing command "dhcp" twice with no
ethernet cable plugged.
First "dhcp" execution, phy_startup() failed then eqos->phy is
set to NULL.
Second "dhcp" execution, eqos->phy is still NULL and phy_startup()
is called and crashed due to NULL pointer.

Reverting this patch restores a correct behaviour.

This reverts commit 0a465ee1f6230797ceee213743ef89e30fe2e98f.

Change-Id: I3f0c84a2fdef06c7796940f88972cfff9e2cdbf2
Reviewed-on: https://gerrit.st.com/125865
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Tested-by: Patrice CHOTARD <patrice.chotard@st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-02-15 17:46:32 +01:00
146431276c net: dwc_eth_qos: Fix error path return value
In two error cases, eqos_probe() returns 0 as return value.
Force ret variable with correct value.

Change-Id: Ie7808bd6b83515465be4e578fc629024d909d18a
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/120660
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-02-15 17:46:28 +01:00
3de73fb9d1 stm32mp1: basic boot: SPL enable access to GPIOZ bank
SPL need to set GPIOZ_SECCFGR = 0 to enable access to GPIOZ bank
(open security).

Change-Id: I33f322625c31c9f05ab5a8eca9f7ca30adaabd71
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/119874
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-02-06 10:13:26 +01:00
aaef786348 stm32mp1: correct management for SYSCFG.BOOTR
Correct bit operation (miss-placed parenthesis) and
add define for register bits of SYSCFG_BOOTR register.

Change-Id: I05d52be3c8ce4016ed8e56b91c8fcc02b311a104
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/119872
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-02-06 10:12:56 +01:00
b6d9a0f0ca stm32mp1: clk: correctly handle Clock Spreading Generator
To activate the csg option, the driver need to set the bit2
of PLLNCR register = SSCG_CTRL: Spread Spectrum Clock Generator
of PLLn enable.

Change-Id: Id93643ef505310bef65e0e025753abc0da7ba43e
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/119871
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2019-02-06 10:12:21 +01:00
a120b9bdb3 Prepare v2018.11-stm32mp-r2
U-Boot v2018.11 delivery for STMP32MP15x Series support

For build details see board/st/stm32mp1/README

- add architecture stm32mp (arch/arm/mach-stm32mp)
  with STMP32MP15x Serie support

- add the STMicroelectronics board stm32mp1 (board/st/stm32mp1).
  This generic board supports all the bootable devices for all
  STM32MP1 boards with generic distribution feature (CONFIG_DISTRO).
  The supported bootable devices are:
  + SDCard
  + eMMC
  + NOR (SF)
  + NAND devices

- Add device tree for the supported boards
  + stm32mp157c-ev1
  + stm32mp157c-ed1
  + stm32mp157a-dk1
  + stm32mp157c-dk2

- Add defconfig for the 2 supported boot chain :
      ROM code => FSBL  => SSBL => OS (Linux Kernel)
                  SYSRAM    DDR
          with First Stage Bootloader (FSBL)
          and Second Stage Bootloader (SSBL)

  + The "Trusted" boot chain (defconfig_file : stm32mp15_trusted_defconfig)
    ROM code => FSBL = Trusted Firmware-A (TF-A) => SSBL = U-Boot

  + The "Basic" boot chain (defconfig_file : stm32mp15_basic_defconfig)
    ROM code => FSBL = U-Boot SPL => SSBL = U-Boot

- Add/Supports drivers in U-Boot:
  + RCC drivers for Clock, Reset, Sysreset
    * drivers/clk/clk_stm32mp1.c
    * drivers/reset/stm32-reset.c
  + GPIO (drivers/gpio/stm32f7_gpio.c)
  + PINCONTROL (drivers/pinctrl/pinctrl_stm32.c)
  + UART/USART (drivers/serial/serial_stm32.c)
  + DDR controller and PHY (drivers/ram/stm32mp1)
  + SDCard/MMC controller = SDMMC (drivers/mmc/stm32_sdmmc2.c)
  + NAND controller FMC (drivers/mtd/nand/raw/stm32_fmc2_nand.c)
  + NOR controller QSPI (drivers/spi/stm32_qspi.c)
  + USB OTG controller (OTG DWC2) and PHY (USBPHYC)
    * drivers/phy/phy-stm32-usbphyc.c
    * drivers/usb/gadget/dwc2_udc_otg.c
    * drivers/usb/gadget/gen_udc_otg_phy.c
    * drivers/usb/host/dwc2.c
  + ETH (drivers/net/dwc_eth_qos.c)
  + I2C (drivers/i2c/stm32f7_i2c.c)
  + PWR regulator (arch/arm/mach-stm32mp/pwr_regulator.c)
  + VREF regulator (drivers/power/regulator/stm32-vrefbuf.c)
  + STPMIC1 (PMIC and regulator)
    * drivers/power/pmic/stpmic1.c
    * drivers/power/regulator/stpmic1.c
  + BSEC for OTP (arch/arm/mach-stm32mp/bsec.c)
  + WATCHDOG (drivers/watchdog/stm32mp_wdt.c)
  + ADC (drivers/adc/stm32-adc.c and stm32-adc-core.c)
  + HWSINLOCK (drivers/hwspinlock/stm32_hwspinlock.c)
  + IPCC mailbox (drivers/mailbox/stm32-ipcc.c)
  + VIDEO drivers for LTDC and DSI
    * drivers/video/stm32/stm32_dsi.c
    * drivers/video/stm32/stm32_ltdc.c
  + Panels drivers
    * drivers/video/dw_mipi_dsi.c
    * drivers/video/mipi_display.c
    * drivers/video/orisetech_otm8009a.c
    * drivers/video/raydium-rm68200.c
  + SYSCFG init (in board: board/st/stm32mp1/stm32mp1.c)
  + STMFX gpio expendeur (drivers/pinctrl/pinctrl-stmfx.c)

- Added, supported or modified commands are
  + stm32prog for STM32CubeProgrammer tools support (USB or UART)
    in U-Boot (arch/arm/mach-stm32mp/cmd_stm32prog)
  + rproc for M4 firmware load (drivers/remoteproc/stm32_copro.c)
  + fuse support with 2 banks for OTP (BSEC) and
    STMPIC1 non volatile memory (drivers/misc/stm32mp_fuse.c)
  + poweroff (arch/arm/mach-stm32mp/cmd_poweroff.c)
  + stm32key (arch/arm/mach-stm32mp/cmd_stm32key.c)

Information
- savenv is not supported (CONFIG_ENV_IS_NOWHERE is activated by default)
- boot from NAND is not supported for basic boot

Change-Id: Iac367a1a414b5444a0800e0e88839b54c341355e
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/115489
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-01-24 17:24:55 +01:00
00a5933e98 stm32mp1: update RCC binding after kernel realignment
RCC is no more a mfd and add a complete example
and alignment with lastest TF-A binding

Change-Id: Icb3a5f234a55e87e718a4e7cd2baea7cdbc80db0
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/116650
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Nicolas LE BAYON <nicolas.le.bayon@st.com>
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2019-01-24 11:49:19 +01:00
3b9e8d9000 stm32mp1: use DBGMCU register to detect the revision
Avoid issue when boot context is invalid,
for engineering boot mode for example.

Change-Id: Ie286490790ba4bb2bdee2ee923f23a5ba1f9eb96
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/116448
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Nicolas LE BAYON <nicolas.le.bayon@st.com>
Reviewed-by: Jean Michel SIMON <jean-michel.simon@st.com>
Tested-by: Jean Michel SIMON <jean-michel.simon@st.com>
Reviewed-on: https://gerrit.st.com/116498
2019-01-22 11:51:16 +01:00
62f620eb8d stm32mp1: add a delay loop early in SPL for debugger attach
Current Soc revision has a known limitation regarding debug linked
to reset halt. For this purpose we couldn't attach inside the rom code.
We may integrate a delay loop early in the SPL boot process to wait
for the debugger to attach.

Today, we use a backup register bit to know if we are in debug mode and
add a loop at the beginning of SPL execution, in the weak function
save_boot_params() called by reset function in arch/cpu/armv7/start.S.

This can be removed when using the Soc revision that fixes the limitation.

Anyway, this source code identifies the Soc revision and is
only executed if it corresponds, so it can be kept on other revisions
without any consequence.

Change-Id: Idd0ff0d790010e29bb6f644b8923c802d191fc1d
Depends-On: I459ee5bd294660ec6cc48cd8ea08ba35be0c51ba
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/116178
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
Reviewed-on: https://gerrit.st.com/116368
2019-01-21 10:08:55 +01:00
85e7457155 dts: stm32mp1: change default minimal buck1 value
Minimal value is the value set during boot or before suspend.
We must ensure that the value is a functional value to boot.

Change-Id: Ie46314ea2dde2125f2f34f0c926b9c7d61ea3f39
Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
Reviewed-on: https://gerrit.st.com/116153
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/116259
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-01-18 12:07:42 +01:00
ffe232a956 remoteproc: align flush operation
Align flush operation at the cache line size (ARCH_DMA_MINALIGN)
This patch avoid error=
  CACHE: Misaligned operation at range


Change-Id: I5252c5ea5c0cb44062d37c0e0729343d59879df5
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/115943
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-on: https://gerrit.st.com/115965
2019-01-16 09:52:26 +01:00
6893b88a4a remoteproc: stm32m: update translation support
After update of device tree, update the driver to support
the translate for the RETRAM region only in stm32_copro_da_to_pa()
to avoid probe error..

Change-Id: I6d008d10a51ad9fbc671e662027d6db3d9590b03
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/115696
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Arnaud POULIQUEN <arnaud.pouliquen@st.com>
Reviewed-on: https://gerrit.st.com/115964
2019-01-15 12:57:32 +01:00
5b2ef8968d dts: stm32mp1: alignment with kernel device tree
Add stm32mp157c-m4-srm.dtsi include include to be
align with the latest kernel device tree and avoid
issue with device tree generated by CubeMX

Change-Id: I229408e3ab28aae95d9e2f49ef74218033319efb
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/115657
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2019-01-11 11:37:33 +01:00
3c2227a329 stm32prog: force videoconsole output
Allow user feedback on screen when available
during STM32CubeProgrammer usage.

Change-Id: I9ab57ae280011db6e95bb0d2b5bbd2a5edb8c683
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/115358
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2019-01-09 17:19:55 +01:00
908c3bf50f video: check hardware version of DSI
Check the hardware version of DSI. Versions 1.30 & 1.31 are only
supported. Rename the parameter priv by dsi into all functions.

Change-Id: I31b7e9fb6169f1ab491aa2f5089650eff5e86d96
Reviewed-on: https://gerrit.st.com/115485
Signed-off-by: Yannick Fertré <yannick.fertre@st.com>
Reviewed-on: https://gerrit.st.com/115488
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2019-01-09 17:18:43 +01:00
e1532f83da cosmetic: video: rename priv variable to dsi
Use proper variable name

Change-Id: I213f95370c8876b93d59b4536b740e6571ff1893
Reviewed-on: https://gerrit.st.com/115485
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/115487
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-01-09 17:18:37 +01:00
a012f551a8 Prepare v2018.11-stm32mp-r1
Change-Id: I326f076790155b197ada21d8733139166ac9a874
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/115142
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2019-01-04 11:18:54 +01:00
263 changed files with 30459 additions and 2843 deletions

3
.gitignore vendored
View File

@ -88,3 +88,6 @@ GTAGS
*.orig
*~
\#*#
/oe-*
bitbake-cookerdaemon.log

View File

@ -242,7 +242,9 @@ F: drivers/misc/stm32mp_fuse.c
F: drivers/mmc/stm32_sdmmc2.c
F: drivers/phy/phy-stm32-usbphyc.c
F: drivers/pinctrl/pinctrl_stm32.c
F: drivers/power/pmic/stpmic1.c
F: drivers/power/regulator/stm32-vrefbuf.c
F: drivers/power/regulator/stpmic1.c
F: drivers/ram/stm32mp1/
F: drivers/misc/stm32_rcc.c
F: drivers/reset/stm32-reset.c

View File

@ -3,7 +3,7 @@
VERSION = 2018
PATCHLEVEL = 11
SUBLEVEL =
EXTRAVERSION =
EXTRAVERSION = -stm32mp-r4
NAME =
# *DOCUMENTATION*

3
README
View File

@ -2192,6 +2192,9 @@ The following options need to be configured:
CONFIG_SF_DEFAULT_MODE (see include/spi.h)
CONFIG_SF_DEFAULT_SPEED in Hz
In case of DT boot, SPI don't read default speed and mode
from CONFIG_*, but from platdata values computed from available
DT node
- TFTP Fixed UDP Port:
CONFIG_TFTP_PORT

View File

@ -1313,21 +1313,27 @@ config ARCH_STM32MP
select DM_GPIO
select DM_RESET
select DM_SERIAL
select ENV_VARS_UBOOT_RUNTIME_CONFIG
select MISC
select OF_CONTROL
select OF_LIBFDT
imply OF_LIBFDT_OVERLAY
select OF_SYSTEM_SETUP
select PINCTRL
select REGMAP
select SUPPORT_SPL
select SYSCON
select SYSRESET
select SYS_ARCH_TIMER
select SYS_THUMB_BUILD
imply CMD_DM
imply CMD_POWEROFF
help
Support for STM32MP SoC family developed by STMicroelectronics,
MPUs based on ARM cortex A core
U-BOOT is running in DDR and SPL support is the unsecure First Stage
BootLoader (FSBL)
U-BOOT is running in DDR, loaded by the First Stage BootLoader (FSBL).
FBSL can be TF-A: Trusted Firmware for Cortex A, for trusted boot chain.
SPL is the unsecure FSBL for the basic boot chain.
config ARCH_ROCKCHIP
bool "Support Rockchip SoCs"

View File

@ -49,6 +49,9 @@ unsigned long long get_ticks(void)
ulong timer_get_boot_us(void)
{
if (!gd->arch.timer_rate_hz)
timer_init();
return lldiv(get_ticks(), gd->arch.timer_rate_hz / 1000000);
}

View File

@ -553,6 +553,8 @@ dtb-$(CONFIG_ARCH_ASPEED) += ast2500-evb.dtb
dtb-$(CONFIG_ARCH_STI) += stih410-b2260.dtb
dtb-$(CONFIG_TARGET_STM32MP1) += \
stm32mp157a-dk1.dtb \
stm32mp157c-dk2.dtb \
stm32mp157c-ed1.dtb \
stm32mp157c-ev1.dtb

View File

@ -92,57 +92,46 @@
};
&gpioa {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpiob {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpioc {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpiod {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpioe {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpiof {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpiog {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpioh {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpioi {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpioj {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpiok {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};

View File

@ -87,57 +87,46 @@
};
&gpioa {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpiob {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpioc {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpiod {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpioe {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpiof {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpiog {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpioh {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpioi {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpioj {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpiok {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};

View File

@ -92,57 +92,46 @@
};
&gpioa {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpiob {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpioc {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpiod {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpioe {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpiof {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpiog {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpioh {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpioi {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpioj {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpiok {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};

View File

@ -130,7 +130,6 @@
gpioa: gpio@40020000 {
gpio-controller;
#gpio-cells = <2>;
compatible = "st,stm32-gpio";
reg = <0x0 0x400>;
clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOA)>;
st,bank-name = "GPIOA";
@ -140,7 +139,6 @@
gpiob: gpio@40020400 {
gpio-controller;
#gpio-cells = <2>;
compatible = "st,stm32-gpio";
reg = <0x400 0x400>;
clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOB)>;
st,bank-name = "GPIOB";
@ -151,7 +149,6 @@
gpioc: gpio@40020800 {
gpio-controller;
#gpio-cells = <2>;
compatible = "st,stm32-gpio";
reg = <0x800 0x400>;
clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOC)>;
st,bank-name = "GPIOC";
@ -161,7 +158,6 @@
gpiod: gpio@40020c00 {
gpio-controller;
#gpio-cells = <2>;
compatible = "st,stm32-gpio";
reg = <0xc00 0x400>;
clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOD)>;
st,bank-name = "GPIOD";
@ -171,7 +167,6 @@
gpioe: gpio@40021000 {
gpio-controller;
#gpio-cells = <2>;
compatible = "st,stm32-gpio";
reg = <0x1000 0x400>;
clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOE)>;
st,bank-name = "GPIOE";
@ -181,7 +176,6 @@
gpiof: gpio@40021400 {
gpio-controller;
#gpio-cells = <2>;
compatible = "st,stm32-gpio";
reg = <0x1400 0x400>;
clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOF)>;
st,bank-name = "GPIOF";
@ -191,7 +185,6 @@
gpiog: gpio@40021800 {
gpio-controller;
#gpio-cells = <2>;
compatible = "st,stm32-gpio";
reg = <0x1800 0x400>;
clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOG)>;
st,bank-name = "GPIOG";
@ -201,7 +194,6 @@
gpioh: gpio@40021c00 {
gpio-controller;
#gpio-cells = <2>;
compatible = "st,stm32-gpio";
reg = <0x1c00 0x400>;
clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOH)>;
st,bank-name = "GPIOH";
@ -211,7 +203,6 @@
gpioi: gpio@40022000 {
gpio-controller;
#gpio-cells = <2>;
compatible = "st,stm32-gpio";
reg = <0x2000 0x400>;
clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOI)>;
st,bank-name = "GPIOI";
@ -221,7 +212,6 @@
gpioj: gpio@40022400 {
gpio-controller;
#gpio-cells = <2>;
compatible = "st,stm32-gpio";
reg = <0x2400 0x400>;
clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOJ)>;
st,bank-name = "GPIOJ";
@ -231,7 +221,6 @@
gpiok: gpio@40022800 {
gpio-controller;
#gpio-cells = <2>;
compatible = "st,stm32-gpio";
reg = <0x2800 0x400>;
clocks = <&rcc 0 STM32F7_AHB1_CLOCK(GPIOK)>;
st,bank-name = "GPIOK";

View File

@ -54,7 +54,6 @@
gpioa: gpio@58020000 {
gpio-controller;
#gpio-cells = <2>;
compatible = "st,stm32-gpio";
reg = <0x0 0x400>;
clocks = <&rcc GPIOA_CK>;
st,bank-name = "GPIOA";
@ -63,7 +62,6 @@
gpiob: gpio@58020400 {
gpio-controller;
#gpio-cells = <2>;
compatible = "st,stm32-gpio";
reg = <0x400 0x400>;
clocks = <&rcc GPIOB_CK>;
st,bank-name = "GPIOB";
@ -72,7 +70,6 @@
gpioc: gpio@58020800 {
gpio-controller;
#gpio-cells = <2>;
compatible = "st,stm32-gpio";
reg = <0x800 0x400>;
clocks = <&rcc GPIOC_CK>;
st,bank-name = "GPIOC";
@ -81,7 +78,6 @@
gpiod: gpio@58020c00 {
gpio-controller;
#gpio-cells = <2>;
compatible = "st,stm32-gpio";
reg = <0xc00 0x400>;
clocks = <&rcc GPIOD_CK>;
st,bank-name = "GPIOD";
@ -90,7 +86,6 @@
gpioe: gpio@58021000 {
gpio-controller;
#gpio-cells = <2>;
compatible = "st,stm32-gpio";
reg = <0x1000 0x400>;
clocks = <&rcc GPIOE_CK>;
st,bank-name = "GPIOE";
@ -99,7 +94,6 @@
gpiof: gpio@58021400 {
gpio-controller;
#gpio-cells = <2>;
compatible = "st,stm32-gpio";
reg = <0x1400 0x400>;
clocks = <&rcc GPIOF_CK>;
st,bank-name = "GPIOF";
@ -108,7 +102,6 @@
gpiog: gpio@58021800 {
gpio-controller;
#gpio-cells = <2>;
compatible = "st,stm32-gpio";
reg = <0x1800 0x400>;
clocks = <&rcc GPIOG_CK>;
st,bank-name = "GPIOG";
@ -117,7 +110,6 @@
gpioh: gpio@58021c00 {
gpio-controller;
#gpio-cells = <2>;
compatible = "st,stm32-gpio";
reg = <0x1c00 0x400>;
clocks = <&rcc GPIOH_CK>;
st,bank-name = "GPIOH";
@ -126,7 +118,6 @@
gpioi: gpio@58022000 {
gpio-controller;
#gpio-cells = <2>;
compatible = "st,stm32-gpio";
reg = <0x2000 0x400>;
clocks = <&rcc GPIOI_CK>;
st,bank-name = "GPIOI";
@ -135,7 +126,6 @@
gpioj: gpio@58022400 {
gpio-controller;
#gpio-cells = <2>;
compatible = "st,stm32-gpio";
reg = <0x2400 0x400>;
clocks = <&rcc GPIOJ_CK>;
st,bank-name = "GPIOJ";
@ -144,7 +134,6 @@
gpiok: gpio@58022800 {
gpio-controller;
#gpio-cells = <2>;
compatible = "st,stm32-gpio";
reg = <0x2800 0x400>;
clocks = <&rcc GPIOK_CK>;
st,bank-name = "GPIOK";

View File

@ -105,5 +105,5 @@
<&pinctrl_sdmmc1_level_shifter>;
pinctrl-names = "default";
bus-width = <4>;
st,dirpol;
st,sig-dir;
};

View File

@ -5,7 +5,7 @@
/ {
soc {
ddr: ddr@0x5A003000{
ddr: ddr@5A003000{
u-boot,dm-pre-reloc;
compatible = "st,stm32mp1-ddr";

View File

@ -0,0 +1,120 @@
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/*
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
*
* STM32MP157C DK1/DK2 BOARD configuration
* 1x DDR3L 4Gb, 16-bit, 533MHz.
* Reference used NT5CC256M16DP-DI from NANYA
*
* DDR type / Platform DDR3/3L
* freq 533MHz
* width 16
* datasheet 1 = MT41J256M16-187 / DDR3-1066 bin F
* DDR density 4
* timing mode optimized
* Scheduling/QoS options : type = 2
* address mapping : RBC
* Tc > + 85C : N
*/
#define DDR_MEM_NAME "DDR3-1066/777 bin F 1x4Gb 533MHz v1.45"
#define DDR_MEM_SPEED 533000
#define DDR_MEM_SIZE 0x20000000
#define DDR_MSTR 0x00041401
#define DDR_MRCTRL0 0x00000010
#define DDR_MRCTRL1 0x00000000
#define DDR_DERATEEN 0x00000000
#define DDR_DERATEINT 0x00800000
#define DDR_PWRCTL 0x00000000
#define DDR_PWRTMG 0x00400010
#define DDR_HWLPCTL 0x00000000
#define DDR_RFSHCTL0 0x00210000
#define DDR_RFSHCTL3 0x00000000
#define DDR_RFSHTMG 0x0081008B
#define DDR_CRCPARCTL0 0x00000000
#define DDR_DRAMTMG0 0x121B2414
#define DDR_DRAMTMG1 0x000A041B
#define DDR_DRAMTMG2 0x0607080F
#define DDR_DRAMTMG3 0x0050400C
#define DDR_DRAMTMG4 0x07040607
#define DDR_DRAMTMG5 0x06060403
#define DDR_DRAMTMG6 0x02020002
#define DDR_DRAMTMG7 0x00000202
#define DDR_DRAMTMG8 0x00001005
#define DDR_DRAMTMG14 0x000000A0
#define DDR_ZQCTL0 0xC2000040
#define DDR_DFITMG0 0x02050105
#define DDR_DFITMG1 0x00000202
#define DDR_DFILPCFG0 0x07000000
#define DDR_DFIUPD0 0xC0400003
#define DDR_DFIUPD1 0x00000000
#define DDR_DFIUPD2 0x00000000
#define DDR_DFIPHYMSTR 0x00000000
#define DDR_ADDRMAP1 0x00070707
#define DDR_ADDRMAP2 0x00000000
#define DDR_ADDRMAP3 0x1F000000
#define DDR_ADDRMAP4 0x00001F1F
#define DDR_ADDRMAP5 0x06060606
#define DDR_ADDRMAP6 0x0F060606
#define DDR_ADDRMAP9 0x00000000
#define DDR_ADDRMAP10 0x00000000
#define DDR_ADDRMAP11 0x00000000
#define DDR_ODTCFG 0x06000600
#define DDR_ODTMAP 0x00000001
#define DDR_SCHED 0x00000C01
#define DDR_SCHED1 0x00000000
#define DDR_PERFHPR1 0x01000001
#define DDR_PERFLPR1 0x08000200
#define DDR_PERFWR1 0x08000400
#define DDR_DBG0 0x00000000
#define DDR_DBG1 0x00000000
#define DDR_DBGCMD 0x00000000
#define DDR_POISONCFG 0x00000000
#define DDR_PCCFG 0x00000010
#define DDR_PCFGR_0 0x00010000
#define DDR_PCFGW_0 0x00000000
#define DDR_PCFGQOS0_0 0x02100C03
#define DDR_PCFGQOS1_0 0x00800100
#define DDR_PCFGWQOS0_0 0x01100C03
#define DDR_PCFGWQOS1_0 0x01000200
#define DDR_PCFGR_1 0x00010000
#define DDR_PCFGW_1 0x00000000
#define DDR_PCFGQOS0_1 0x02100C03
#define DDR_PCFGQOS1_1 0x00800040
#define DDR_PCFGWQOS0_1 0x01100C03
#define DDR_PCFGWQOS1_1 0x01000200
#define DDR_PGCR 0x01442E02
#define DDR_PTR0 0x0022AA5B
#define DDR_PTR1 0x04841104
#define DDR_PTR2 0x042DA068
#define DDR_ACIOCR 0x10400812
#define DDR_DXCCR 0x00000C40
#define DDR_DSGCR 0xF200011F
#define DDR_DCR 0x0000000B
#define DDR_DTPR0 0x36D477D0
#define DDR_DTPR1 0x098B00D8
#define DDR_DTPR2 0x10023600
#define DDR_MR0 0x00000830
#define DDR_MR1 0x00000000
#define DDR_MR2 0x00000208
#define DDR_MR3 0x00000000
#define DDR_ODTCR 0x00010000
#define DDR_ZQ0CR1 0x00000038
#define DDR_DX0GCR 0x0000CE81
#define DDR_DX0DLLCR 0x40000000
#define DDR_DX0DQTR 0xFFFFFFFF
#define DDR_DX0DQSTR 0x3DB02000
#define DDR_DX1GCR 0x0000CE81
#define DDR_DX1DLLCR 0x40000000
#define DDR_DX1DQTR 0xFFFFFFFF
#define DDR_DX1DQSTR 0x3DB02000
#define DDR_DX2GCR 0x0000CE80
#define DDR_DX2DLLCR 0x40000000
#define DDR_DX2DQTR 0xFFFFFFFF
#define DDR_DX2DQSTR 0x3DB02000
#define DDR_DX3GCR 0x0000CE80
#define DDR_DX3DLLCR 0x40000000
#define DDR_DX3DQTR 0xFFFFFFFF
#define DDR_DX3DQSTR 0x3DB02000
#include "stm32mp15-ddr.dtsi"

View File

@ -0,0 +1,120 @@
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/*
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
*
* STM32MP157C DK1/DK2 BOARD configuration
* 1x DDR3L 4Gb, 16-bit, 533MHz.
* Reference used NT5CC256M16DP-DI from NANYA
*
* DDR type / Platform DDR3/3L
* freq 533MHz
* width 16
* datasheet 0 = MT41J256M16-187 / DDR3-1066 bin G
* DDR density 4
* timing mode optimized
* Scheduling/QoS options : type = 2
* address mapping : RBC
* Tc > + 85C : N
*/
#define DDR_MEM_NAME "DDR3-1066/888 bin G 1x4Gb 533MHz v1.45"
#define DDR_MEM_SPEED 533000
#define DDR_MEM_SIZE 0x20000000
#define DDR_MSTR 0x00041401
#define DDR_MRCTRL0 0x00000010
#define DDR_MRCTRL1 0x00000000
#define DDR_DERATEEN 0x00000000
#define DDR_DERATEINT 0x00800000
#define DDR_PWRCTL 0x00000000
#define DDR_PWRTMG 0x00400010
#define DDR_HWLPCTL 0x00000000
#define DDR_RFSHCTL0 0x00210000
#define DDR_RFSHCTL3 0x00000000
#define DDR_RFSHTMG 0x0081008B
#define DDR_CRCPARCTL0 0x00000000
#define DDR_DRAMTMG0 0x121B2414
#define DDR_DRAMTMG1 0x000A041C
#define DDR_DRAMTMG2 0x0608090F
#define DDR_DRAMTMG3 0x0050400C
#define DDR_DRAMTMG4 0x08040608
#define DDR_DRAMTMG5 0x06060403
#define DDR_DRAMTMG6 0x02020002
#define DDR_DRAMTMG7 0x00000202
#define DDR_DRAMTMG8 0x00001005
#define DDR_DRAMTMG14 0x000000A0
#define DDR_ZQCTL0 0xC2000040
#define DDR_DFITMG0 0x02060105
#define DDR_DFITMG1 0x00000202
#define DDR_DFILPCFG0 0x07000000
#define DDR_DFIUPD0 0xC0400003
#define DDR_DFIUPD1 0x00000000
#define DDR_DFIUPD2 0x00000000
#define DDR_DFIPHYMSTR 0x00000000
#define DDR_ADDRMAP1 0x00070707
#define DDR_ADDRMAP2 0x00000000
#define DDR_ADDRMAP3 0x1F000000
#define DDR_ADDRMAP4 0x00001F1F
#define DDR_ADDRMAP5 0x06060606
#define DDR_ADDRMAP6 0x0F060606
#define DDR_ADDRMAP9 0x00000000
#define DDR_ADDRMAP10 0x00000000
#define DDR_ADDRMAP11 0x00000000
#define DDR_ODTCFG 0x06000600
#define DDR_ODTMAP 0x00000001
#define DDR_SCHED 0x00000C01
#define DDR_SCHED1 0x00000000
#define DDR_PERFHPR1 0x01000001
#define DDR_PERFLPR1 0x08000200
#define DDR_PERFWR1 0x08000400
#define DDR_DBG0 0x00000000
#define DDR_DBG1 0x00000000
#define DDR_DBGCMD 0x00000000
#define DDR_POISONCFG 0x00000000
#define DDR_PCCFG 0x00000010
#define DDR_PCFGR_0 0x00010000
#define DDR_PCFGW_0 0x00000000
#define DDR_PCFGQOS0_0 0x02100C03
#define DDR_PCFGQOS1_0 0x00800100
#define DDR_PCFGWQOS0_0 0x01100C03
#define DDR_PCFGWQOS1_0 0x01000200
#define DDR_PCFGR_1 0x00010000
#define DDR_PCFGW_1 0x00000000
#define DDR_PCFGQOS0_1 0x02100C03
#define DDR_PCFGQOS1_1 0x00800040
#define DDR_PCFGWQOS0_1 0x01100C03
#define DDR_PCFGWQOS1_1 0x01000200
#define DDR_PGCR 0x01442E02
#define DDR_PTR0 0x0022AA5B
#define DDR_PTR1 0x04841104
#define DDR_PTR2 0x042DA068
#define DDR_ACIOCR 0x10400812
#define DDR_DXCCR 0x00000C40
#define DDR_DSGCR 0xF200011F
#define DDR_DCR 0x0000000B
#define DDR_DTPR0 0x38D488D0
#define DDR_DTPR1 0x098B00D8
#define DDR_DTPR2 0x10023600
#define DDR_MR0 0x00000840
#define DDR_MR1 0x00000000
#define DDR_MR2 0x00000208
#define DDR_MR3 0x00000000
#define DDR_ODTCR 0x00010000
#define DDR_ZQ0CR1 0x00000038
#define DDR_DX0GCR 0x0000CE81
#define DDR_DX0DLLCR 0x40000000
#define DDR_DX0DQTR 0xFFFFFFFF
#define DDR_DX0DQSTR 0x3DB02000
#define DDR_DX1GCR 0x0000CE81
#define DDR_DX1DLLCR 0x40000000
#define DDR_DX1DQTR 0xFFFFFFFF
#define DDR_DX1DQSTR 0x3DB02000
#define DDR_DX2GCR 0x0000CE80
#define DDR_DX2DLLCR 0x40000000
#define DDR_DX2DQTR 0xFFFFFFFF
#define DDR_DX2DQSTR 0x3DB02000
#define DDR_DX3GCR 0x0000CE80
#define DDR_DX3DLLCR 0x40000000
#define DDR_DX3DQTR 0xFFFFFFFF
#define DDR_DX3DQSTR 0x3DB02000
#include "stm32mp15-ddr.dtsi"

View File

@ -0,0 +1,120 @@
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/*
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
*
* STM32MP157C ED1 BOARD configuration
* 2x DDR3L 4Gb each, 16-bit, 533MHz, Single Die Package in flyby topology.
* Reference used NT5CC256M16DP-DI from NANYA
*
* DDR type / Platform DDR3/3L
* freq 533MHz
* width 32
* datasheet 1 = MT41J256M16-187 / DDR3-1066 bin F
* DDR density 8
* timing mode optimized
* Scheduling/QoS options : type = 2
* address mapping : RBC
* Tc > + 85C : N
*/
#define DDR_MEM_NAME "DDR3-1066/777 bin F 2x4Gb 533MHz v1.45"
#define DDR_MEM_SPEED 533000
#define DDR_MEM_SIZE 0x40000000
#define DDR_MSTR 0x00040401
#define DDR_MRCTRL0 0x00000010
#define DDR_MRCTRL1 0x00000000
#define DDR_DERATEEN 0x00000000
#define DDR_DERATEINT 0x00800000
#define DDR_PWRCTL 0x00000000
#define DDR_PWRTMG 0x00400010
#define DDR_HWLPCTL 0x00000000
#define DDR_RFSHCTL0 0x00210000
#define DDR_RFSHCTL3 0x00000000
#define DDR_RFSHTMG 0x0081008B
#define DDR_CRCPARCTL0 0x00000000
#define DDR_DRAMTMG0 0x121B2414
#define DDR_DRAMTMG1 0x000A041B
#define DDR_DRAMTMG2 0x0607080F
#define DDR_DRAMTMG3 0x0050400C
#define DDR_DRAMTMG4 0x07040607
#define DDR_DRAMTMG5 0x06060403
#define DDR_DRAMTMG6 0x02020002
#define DDR_DRAMTMG7 0x00000202
#define DDR_DRAMTMG8 0x00001005
#define DDR_DRAMTMG14 0x000000A0
#define DDR_ZQCTL0 0xC2000040
#define DDR_DFITMG0 0x02050105
#define DDR_DFITMG1 0x00000202
#define DDR_DFILPCFG0 0x07000000
#define DDR_DFIUPD0 0xC0400003
#define DDR_DFIUPD1 0x00000000
#define DDR_DFIUPD2 0x00000000
#define DDR_DFIPHYMSTR 0x00000000
#define DDR_ADDRMAP1 0x00080808
#define DDR_ADDRMAP2 0x00000000
#define DDR_ADDRMAP3 0x00000000
#define DDR_ADDRMAP4 0x00001F1F
#define DDR_ADDRMAP5 0x07070707
#define DDR_ADDRMAP6 0x0F070707
#define DDR_ADDRMAP9 0x00000000
#define DDR_ADDRMAP10 0x00000000
#define DDR_ADDRMAP11 0x00000000
#define DDR_ODTCFG 0x06000600
#define DDR_ODTMAP 0x00000001
#define DDR_SCHED 0x00000C01
#define DDR_SCHED1 0x00000000
#define DDR_PERFHPR1 0x01000001
#define DDR_PERFLPR1 0x08000200
#define DDR_PERFWR1 0x08000400
#define DDR_DBG0 0x00000000
#define DDR_DBG1 0x00000000
#define DDR_DBGCMD 0x00000000
#define DDR_POISONCFG 0x00000000
#define DDR_PCCFG 0x00000010
#define DDR_PCFGR_0 0x00010000
#define DDR_PCFGW_0 0x00000000
#define DDR_PCFGQOS0_0 0x02100C03
#define DDR_PCFGQOS1_0 0x00800100
#define DDR_PCFGWQOS0_0 0x01100C03
#define DDR_PCFGWQOS1_0 0x01000200
#define DDR_PCFGR_1 0x00010000
#define DDR_PCFGW_1 0x00000000
#define DDR_PCFGQOS0_1 0x02100C03
#define DDR_PCFGQOS1_1 0x00800040
#define DDR_PCFGWQOS0_1 0x01100C03
#define DDR_PCFGWQOS1_1 0x01000200
#define DDR_PGCR 0x01442E02
#define DDR_PTR0 0x0022AA5B
#define DDR_PTR1 0x04841104
#define DDR_PTR2 0x042DA068
#define DDR_ACIOCR 0x10400812
#define DDR_DXCCR 0x00000C40
#define DDR_DSGCR 0xF200011F
#define DDR_DCR 0x0000000B
#define DDR_DTPR0 0x36D477D0
#define DDR_DTPR1 0x098B00D8
#define DDR_DTPR2 0x10023600
#define DDR_MR0 0x00000830
#define DDR_MR1 0x00000000
#define DDR_MR2 0x00000208
#define DDR_MR3 0x00000000
#define DDR_ODTCR 0x00010000
#define DDR_ZQ0CR1 0x00000038
#define DDR_DX0GCR 0x0000CE81
#define DDR_DX0DLLCR 0x40000000
#define DDR_DX0DQTR 0xFFFFFFFF
#define DDR_DX0DQSTR 0x3DB02000
#define DDR_DX1GCR 0x0000CE81
#define DDR_DX1DLLCR 0x40000000
#define DDR_DX1DQTR 0xFFFFFFFF
#define DDR_DX1DQSTR 0x3DB02000
#define DDR_DX2GCR 0x0000CE81
#define DDR_DX2DLLCR 0x40000000
#define DDR_DX2DQTR 0xFFFFFFFF
#define DDR_DX2DQSTR 0x3DB02000
#define DDR_DX3GCR 0x0000CE81
#define DDR_DX3DLLCR 0x40000000
#define DDR_DX3DQTR 0xFFFFFFFF
#define DDR_DX3DQSTR 0x3DB02000
#include "stm32mp15-ddr.dtsi"

View File

@ -1,9 +1,8 @@
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/*
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
*/
/* STM32MP157C ED1 and ED2 BOARD configuration
*
* STM32MP157C ED1 BOARD configuration
* 2x DDR3L 4Gb each, 16-bit, 533MHz, Single Die Package in flyby topology.
* Reference used NT5CC256M16DP-DI from NANYA
*
@ -15,10 +14,10 @@
* timing mode optimized
* Scheduling/QoS options : type = 2
* address mapping : RBC
* Tc > + 85C : N
*/
#define DDR_MEM_NAME "DDR3-1066 bin G 2x4Gb 533MHz v1.36"
#define DDR_MEM_SPEED 533
#define DDR_MEM_NAME "DDR3-1066/888 bin G 2x4Gb 533MHz v1.45"
#define DDR_MEM_SPEED 533000
#define DDR_MEM_SIZE 0x40000000
#define DDR_MSTR 0x00040401
@ -62,7 +61,7 @@
#define DDR_ADDRMAP11 0x00000000
#define DDR_ODTCFG 0x06000600
#define DDR_ODTMAP 0x00000001
#define DDR_SCHED 0x00001201
#define DDR_SCHED 0x00000C01
#define DDR_SCHED1 0x00000000
#define DDR_PERFHPR1 0x01000001
#define DDR_PERFLPR1 0x08000200
@ -74,15 +73,15 @@
#define DDR_PCCFG 0x00000010
#define DDR_PCFGR_0 0x00010000
#define DDR_PCFGW_0 0x00000000
#define DDR_PCFGQOS0_0 0x02100B03
#define DDR_PCFGQOS0_0 0x02100C03
#define DDR_PCFGQOS1_0 0x00800100
#define DDR_PCFGWQOS0_0 0x01100B03
#define DDR_PCFGWQOS0_0 0x01100C03
#define DDR_PCFGWQOS1_0 0x01000200
#define DDR_PCFGR_1 0x00010000
#define DDR_PCFGW_1 0x00000000
#define DDR_PCFGQOS0_1 0x02100B03
#define DDR_PCFGQOS1_1 0x00800100
#define DDR_PCFGWQOS0_1 0x01100B03
#define DDR_PCFGQOS0_1 0x02100C03
#define DDR_PCFGQOS1_1 0x00800040
#define DDR_PCFGWQOS0_1 0x01100C03
#define DDR_PCFGWQOS1_1 0x01000200
#define DDR_PGCR 0x01442E02
#define DDR_PTR0 0x0022AA5B
@ -90,7 +89,7 @@
#define DDR_PTR2 0x042DA068
#define DDR_ACIOCR 0x10400812
#define DDR_DXCCR 0x00000C40
#define DDR_DSGCR 0xF200001F
#define DDR_DSGCR 0xF200011F
#define DDR_DCR 0x0000000B
#define DDR_DTPR0 0x38D488D0
#define DDR_DTPR1 0x098B00D8
@ -100,7 +99,7 @@
#define DDR_MR2 0x00000208
#define DDR_MR3 0x00000000
#define DDR_ODTCR 0x00010000
#define DDR_ZQ0CR1 0x0000005B
#define DDR_ZQ0CR1 0x00000038
#define DDR_DX0GCR 0x0000CE81
#define DDR_DX0DLLCR 0x40000000
#define DDR_DX0DQTR 0xFFFFFFFF

File diff suppressed because it is too large Load Diff

View File

@ -17,16 +17,23 @@
gpio9 = &gpioj;
gpio10 = &gpiok;
gpio25 = &gpioz;
pinctrl0 = &pinctrl;
pinctrl1 = &pinctrl_z;
};
config {
u-boot,dm-pre-reloc;
/* need PSCI for sysreset during board_f */
psci {
u-boot,dm-pre-proper;
};
clocks {
u-boot,dm-pre-reloc;
};
reboot {
u-boot,dm-pre-reloc;
};
soc {
u-boot,dm-pre-reloc;
@ -39,6 +46,14 @@
};
};
&bsec {
u-boot,dm-pre-reloc;
};
&clk_csi {
u-boot,dm-pre-reloc;
};
&clk_hsi {
u-boot,dm-pre-reloc;
};
@ -47,26 +62,81 @@
u-boot,dm-pre-reloc;
};
&clk_lse {
u-boot,dm-pre-reloc;
};
&clk_lsi {
u-boot,dm-pre-reloc;
};
&clk_csi {
&clk_lse {
u-boot,dm-pre-reloc;
};
&rcc {
&cpu0_opp_table {
u-boot,dm-spl;
opp-650000000 {
u-boot,dm-spl;
};
opp-800000000 {
u-boot,dm-spl;
};
};
&gpioa {
u-boot,dm-pre-reloc;
};
&rcc_reboot {
&gpiob {
u-boot,dm-pre-reloc;
};
&gpioc {
u-boot,dm-pre-reloc;
};
&gpiod {
u-boot,dm-pre-reloc;
};
&gpioe {
u-boot,dm-pre-reloc;
};
&gpiof {
u-boot,dm-pre-reloc;
};
&gpiog {
u-boot,dm-pre-reloc;
};
&gpioh {
u-boot,dm-pre-reloc;
};
&gpioi {
u-boot,dm-pre-reloc;
};
&gpioj {
u-boot,dm-pre-reloc;
};
&gpiok {
u-boot,dm-pre-reloc;
};
&gpioz {
u-boot,dm-pre-reloc;
};
&iwdg2 {
u-boot,dm-pre-reloc;
};
/* pre-reloc probe = reserve video frame buffer in video_reserve() */
&ltdc {
u-boot,dm-pre-proper;
};
&pinctrl {
u-boot,dm-pre-reloc;
};
@ -75,62 +145,22 @@
u-boot,dm-pre-reloc;
};
&gpioa {
compatible = "st,stm32-gpio";
&pwr {
u-boot,dm-pre-reloc;
};
&gpiob {
compatible = "st,stm32-gpio";
&rcc {
u-boot,dm-pre-reloc;
};
&gpioc {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
&sdmmc1 {
compatible = "st,stm32-sdmmc2", "arm,pl18x", "arm,primecell";
};
&gpiod {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
&sdmmc2 {
compatible = "st,stm32-sdmmc2", "arm,pl18x", "arm,primecell";
};
&gpioe {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpiof {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpiog {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpioh {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpioi {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpioj {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpiok {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
};
&gpioz {
compatible = "st,stm32-gpio";
u-boot,dm-pre-reloc;
&sdmmc3 {
compatible = "st,stm32-sdmmc2", "arm,pl18x", "arm,primecell";
};

View File

@ -0,0 +1,173 @@
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/*
* Copyright : STMicroelectronics 2018
*/
#include <dt-bindings/clock/stm32mp1-clksrc.h>
#include "stm32mp157-u-boot.dtsi"
#include "stm32mp15-ddr3-1x4Gb-1066-binG.dtsi"
/ {
aliases {
i2c3 = &i2c4;
mmc0 = &sdmmc1;
};
config {
u-boot,boot-led = "heartbeat";
u-boot,error-led = "error";
st,adc_usb_pd = <&adc1 18>, <&adc1 19>;
st,fastboot-gpios = <&gpioa 13 GPIO_ACTIVE_LOW>;
st,stm32prog-gpios = <&gpioa 14 GPIO_ACTIVE_LOW>;
};
led {
red {
label = "error";
gpios = <&gpioa 13 GPIO_ACTIVE_LOW>;
default-state = "off";
status = "okay";
};
blue {
default-state = "on";
};
};
};
&adc {
status = "okay";
};
&clk_hse {
st,digbypass;
};
&i2c4 {
u-boot,dm-pre-reloc;
};
&i2c4_pins_a {
u-boot,dm-pre-reloc;
pins {
u-boot,dm-pre-reloc;
};
};
&pmic {
u-boot,dm-pre-reloc;
};
&rcc {
st,clksrc = <
CLK_MPU_PLL1P
CLK_AXI_PLL2P
CLK_MCU_PLL3P
CLK_PLL12_HSE
CLK_PLL3_HSE
CLK_PLL4_HSE
CLK_RTC_LSE
CLK_MCO1_DISABLED
CLK_MCO2_DISABLED
>;
st,clkdiv = <
1 /*MPU*/
0 /*AXI*/
0 /*MCU*/
1 /*APB1*/
1 /*APB2*/
1 /*APB3*/
1 /*APB4*/
2 /*APB5*/
23 /*RTC*/
0 /*MCO1*/
0 /*MCO2*/
>;
st,pkcs = <
CLK_CKPER_HSE
CLK_FMC_ACLK
CLK_QSPI_ACLK
CLK_ETH_DISABLED
CLK_SDMMC12_PLL4P
CLK_DSI_DSIPLL
CLK_STGEN_HSE
CLK_USBPHY_HSE
CLK_SPI2S1_PLL3Q
CLK_SPI2S23_PLL3Q
CLK_SPI45_HSI
CLK_SPI6_HSI
CLK_I2C46_HSI
CLK_SDMMC3_PLL4P
CLK_USBO_USBPHY
CLK_ADC_CKPER
CLK_CEC_LSE
CLK_I2C12_HSI
CLK_I2C35_HSI
CLK_UART1_HSI
CLK_UART24_HSI
CLK_UART35_HSI
CLK_UART6_HSI
CLK_UART78_HSI
CLK_SPDIF_PLL4P
CLK_FDCAN_PLL4R
CLK_SAI1_PLL3Q
CLK_SAI2_PLL3Q
CLK_SAI3_PLL3Q
CLK_SAI4_PLL3Q
CLK_RNG1_LSI
CLK_RNG2_LSI
CLK_LPTIM1_PCLK1
CLK_LPTIM23_PCLK3
CLK_LPTIM45_LSE
>;
/* VCO = 1066.0 MHz => P = 266 (AXI), Q = 533 (GPU), R = 533 (DDR) */
pll2: st,pll@1 {
cfg = < 2 65 1 0 0 PQR(1,1,1) >;
frac = < 0x1400 >;
u-boot,dm-pre-reloc;
};
/* VCO = 417.8 MHz => P = 209, Q = 24, R = 11 */
pll3: st,pll@2 {
cfg = < 1 33 1 16 36 PQR(1,1,1) >;
frac = < 0x1a04 >;
u-boot,dm-pre-reloc;
};
/* VCO = 594.0 MHz => P = 99, Q = 74, R = 74 */
pll4: st,pll@3 {
cfg = < 3 98 5 7 7 PQR(1,1,1) >;
u-boot,dm-pre-reloc;
};
};
&sdmmc1 {
u-boot,dm-spl;
};
&sdmmc1_b4_pins_a {
u-boot,dm-spl;
pins1 {
u-boot,dm-spl;
};
pins2 {
u-boot,dm-spl;
};
};
&uart4 {
u-boot,dm-pre-reloc;
};
&uart4_pins_a {
u-boot,dm-pre-reloc;
pins1 {
u-boot,dm-pre-reloc;
};
pins2 {
u-boot,dm-pre-reloc;
/* pull-up on rx to avoid floating level */
bias-pull-up;
};
};

View File

@ -0,0 +1,767 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2018 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com>.
*/
/dts-v1/;
#include "stm32mp157c.dtsi"
#include "stm32mp157cac-pinctrl.dtsi"
#include "stm32mp157c-m4-srm.dtsi"
#include <dt-bindings/input/input.h>
#include <dt-bindings/mfd/st,stpmic1.h>
/ {
model = "STMicroelectronics STM32MP157A-DK1 Discovery Board";
compatible = "st,stm32mp157a-dk1", "st,stm32mp157";
aliases {
ethernet0 = &ethernet0;
serial0 = &uart4;
serial1 = &usart3;
serial2 = &uart7;
};
chosen {
stdout-path = "serial0:115200n8";
};
memory@c0000000 {
reg = <0xc0000000 0x20000000>;
};
reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
ranges;
retram: retram@0x38000000 {
compatible = "shared-dma-pool";
reg = <0x38000000 0x10000>;
no-map;
};
mcuram: mcuram@0x30000000 {
compatible = "shared-dma-pool";
reg = <0x30000000 0x40000>;
no-map;
};
mcuram2: mcuram2@0x10000000 {
compatible = "shared-dma-pool";
reg = <0x10000000 0x40000>;
no-map;
};
vdev0vring0: vdev0vring0@10040000 {
compatible = "shared-dma-pool";
reg = <0x10040000 0x2000>;
no-map;
};
vdev0vring1: vdev0vring1@10042000 {
compatible = "shared-dma-pool";
reg = <0x10042000 0x2000>;
no-map;
};
vdev0buffer: vdev0buffer@10044000 {
compatible = "shared-dma-pool";
reg = <0x10044000 0x4000>;
no-map;
};
gpu_reserved: gpu@d4000000 {
reg = <0xd4000000 0x4000000>;
no-map;
};
};
sram: sram@10050000 {
compatible = "mmio-sram";
reg = <0x10050000 0x10000>;
#address-cells = <1>;
#size-cells = <1>;
ranges = <0 0x10050000 0x10000>;
dma_pool: dma_pool@0 {
reg = <0x0 0x10000>;
pool;
};
};
led {
compatible = "gpio-leds";
blue {
label = "heartbeat";
gpios = <&gpiod 11 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "heartbeat";
default-state = "off";
};
};
sound {
compatible = "audio-graph-card";
label = "STM32MP1-DK";
routing =
"Playback" , "MCLK",
"Capture" , "MCLK",
"MICL" , "Mic Bias";
dais = <&sai2a_port &sai2b_port &i2s2_port>;
status = "okay";
};
usb_phy_tuning: usb-phy-tuning {
st,hs-dc-level = <2>;
st,fs-rftime-tuning;
st,hs-rftime-reduction;
st,hs-current-trim = <15>;
st,hs-impedance-trim = <1>;
st,squelch-level = <3>;
st,hs-rx-offset = <2>;
st,no-lsfs-sc;
};
};
&adc {
pinctrl-names = "default";
pinctrl-0 = <&adc12_ain_pins_a>, <&adc12_usb_pwr_pins_a>;
vdd-supply = <&vdd>;
vdda-supply = <&vdd>;
vref-supply = <&vrefbuf>;
status = "disabled";
adc1: adc@0 {
/*
* Type-C USB_PWR_CC1 & USB_PWR_CC2 on in18 & in19.
* Use at least 5 * RC time, e.g. 5 * (Rp + Rd) * C:
* 5 * (56 + 47kOhms) * 5pF => 2.5us.
* Use arbitrary margin here (e.g. 5µs).
*/
st,min-sample-time-nsecs = <5000>;
/* AIN connector, USB Type-C CC1 & CC2 */
st,adc-channels = <0 1 6 13 18 19>;
status = "okay";
};
adc2: adc@100 {
/* AIN connector, temp sensor, USB Type-C CC1 & CC2 */
st,adc-channels = <0 1 2 6 12 18 19>;
/* temperature sensor min sample time */
st,min-sample-time-nsecs = <10000>;
status = "okay";
};
adc_temp: temp {
status = "okay";
};
};
&cec {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&cec_pins_b>;
pinctrl-1 = <&cec_pins_sleep_b>;
status = "okay";
};
&cpu0{
cpu-supply = <&vddcore>;
};
&cpu1{
cpu-supply = <&vddcore>;
};
&dma1 {
sram = <&dma_pool>;
};
&dma2 {
sram = <&dma_pool>;
};
&dts {
status = "okay";
};
&ethernet0 {
status = "okay";
pinctrl-0 = <&ethernet0_rgmii_pins_a>;
pinctrl-1 = <&ethernet0_rgmii_pins_sleep_a>;
pinctrl-names = "default", "sleep";
phy-mode = "rgmii-id";
max-speed = <1000>;
phy-handle = <&phy0>;
mdio0 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "snps,dwmac-mdio";
phy0: ethernet-phy@0 {
reg = <0>;
};
};
};
&gpu {
contiguous-area = <&gpu_reserved>;
status = "okay";
};
&i2c1 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&i2c1_pins_a>;
pinctrl-1 = <&i2c1_pins_sleep_a>;
i2c-scl-rising-time-ns = <100>;
i2c-scl-falling-time-ns = <7>;
status = "okay";
/delete-property/dmas;
/delete-property/dma-names;
cs42l51: cs42l51@4a {
compatible = "cirrus,cs42l51";
reg = <0x4a>;
#sound-dai-cells = <0>;
status = "okay";
VL-supply = <&v3v3>;
VD-supply = <&v1v8_audio>;
VA-supply = <&v1v8_audio>;
VAHP-supply = <&v1v8_audio>;
reset-gpios = <&gpiog 9 GPIO_ACTIVE_LOW>;
clocks = <&sai2a>;
clock-names = "MCLK";
cs42l51_port: port {
#address-cells = <1>;
#size-cells = <0>;
cs42l51_tx_endpoint: endpoint@0 {
reg = <0>;
remote-endpoint = <&sai2a_endpoint>;
frame-master;
bitclock-master;
};
cs42l51_rx_endpoint: endpoint@1 {
reg = <1>;
remote-endpoint = <&sai2b_endpoint>;
frame-master;
bitclock-master;
};
};
};
hdmi-transmitter@39 {
compatible = "sil,sii9022";
reg = <0x39>;
iovcc-supply = <&v3v3_hdmi>;
cvcc12-supply = <&v1v2_hdmi>;
reset-gpios = <&gpioa 10 GPIO_ACTIVE_LOW>;
interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
interrupt-parent = <&gpiog>;
status = "okay";
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
sii9022_in: endpoint {
remote-endpoint = <&ltdc_ep0_out>;
};
};
port@1 {
reg = <1>;
sii9022_tx_endpoint: endpoint {
remote-endpoint = <&i2s2_endpoint>;
};
};
};
};
};
&i2c4 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&i2c4_pins_a>;
pinctrl-1 = <&i2c4_pins_sleep_a>;
i2c-scl-rising-time-ns = <185>;
i2c-scl-falling-time-ns = <20>;
clock-frequency = <400000>;
status = "okay";
/delete-property/dmas;
/delete-property/dma-names;
typec: stusb1600@28 {
compatible = "st,stusb1600";
reg = <0x28>;
interrupts = <11 IRQ_TYPE_EDGE_FALLING>;
interrupt-parent = <&gpioi>;
pinctrl-names = "default";
pinctrl-0 = <&stusb1600_pins_a>;
status = "okay";
typec_con: connector {
compatible = "usb-c-connector";
label = "USB-C";
power-role = "dual";
power-opmode = "default";
};
};
pmic: stpmic@33 {
compatible = "st,stpmic1";
reg = <0x33>;
interrupts-extended = <&exti_pwr 55 IRQ_TYPE_EDGE_FALLING>;
interrupt-controller;
#interrupt-cells = <2>;
status = "okay";
wakeup-source;
regulators {
compatible = "st,stpmic1-regulators";
ldo1-supply = <&v3v3>;
ldo3-supply = <&vdd_ddr>;
ldo6-supply = <&v3v3>;
pwr_sw1-supply = <&bst_out>;
pwr_sw2-supply = <&bst_out>;
vddcore: buck1 {
regulator-name = "vddcore";
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <1350000>;
regulator-always-on;
regulator-initial-mode = <0>;
regulator-over-current-protection;
};
vdd_ddr: buck2 {
regulator-name = "vdd_ddr";
regulator-min-microvolt = <1350000>;
regulator-max-microvolt = <1350000>;
regulator-always-on;
regulator-initial-mode = <0>;
regulator-over-current-protection;
};
vdd: buck3 {
regulator-name = "vdd";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
st,mask-reset;
regulator-initial-mode = <0>;
regulator-over-current-protection;
};
v3v3: buck4 {
regulator-name = "v3v3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
regulator-over-current-protection;
regulator-initial-mode = <0>;
};
v1v8_audio: ldo1 {
regulator-name = "v1v8_audio";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
interrupts = <IT_CURLIM_LDO1 0>;
};
v3v3_hdmi: ldo2 {
regulator-name = "v3v3_hdmi";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
interrupts = <IT_CURLIM_LDO2 0>;
};
vtt_ddr: ldo3 {
regulator-name = "vtt_ddr";
regulator-min-microvolt = <500000>;
regulator-max-microvolt = <750000>;
regulator-always-on;
regulator-over-current-protection;
};
vdd_usb: ldo4 {
regulator-name = "vdd_usb";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
interrupts = <IT_CURLIM_LDO4 0>;
};
vdda: ldo5 {
regulator-name = "vdda";
regulator-min-microvolt = <2900000>;
regulator-max-microvolt = <2900000>;
interrupts = <IT_CURLIM_LDO5 0>;
regulator-boot-on;
};
v1v2_hdmi: ldo6 {
regulator-name = "v1v2_hdmi";
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <1200000>;
regulator-always-on;
interrupts = <IT_CURLIM_LDO6 0>;
};
vref_ddr: vref_ddr {
regulator-name = "vref_ddr";
regulator-always-on;
regulator-over-current-protection;
};
bst_out: boost {
regulator-name = "bst_out";
interrupts = <IT_OCP_BOOST 0>;
};
vbus_otg: pwr_sw1 {
regulator-name = "vbus_otg";
interrupts = <IT_OCP_OTG 0>;
};
vbus_sw: pwr_sw2 {
regulator-name = "vbus_sw";
interrupts = <IT_OCP_SWOUT 0>;
regulator-active-discharge = <1>;
};
};
onkey {
compatible = "st,stpmic1-onkey";
interrupts = <IT_PONKEY_F 0>, <IT_PONKEY_R 0>;
interrupt-names = "onkey-falling", "onkey-rising";
power-off-time-sec = <10>;
status = "okay";
};
watchdog {
compatible = "st,stpmic1-wdt";
status = "disabled";
};
};
};
&i2c5 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&i2c5_pins_a>;
pinctrl-1 = <&i2c5_pins_sleep_a>;
/delete-property/dmas;
/delete-property/dma-names;
status = "disabled";
};
&i2s2 {
clocks = <&rcc SPI2>, <&rcc SPI2_K>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
clock-names = "pclk", "i2sclk", "x8k", "x11k";
pinctrl-names = "default", "sleep";
pinctrl-0 = <&i2s2_pins_a>;
pinctrl-1 = <&i2s2_pins_sleep_a>;
status = "okay";
i2s2_port: port {
i2s2_endpoint: endpoint {
remote-endpoint = <&sii9022_tx_endpoint>;
format = "i2s";
mclk-fs = <256>;
};
};
};
&ipcc {
status = "okay";
};
&iwdg2 {
timeout-sec = <32>;
status = "okay";
};
&ltdc {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&ltdc_pins_a>;
pinctrl-1 = <&ltdc_pins_sleep_a>;
status = "okay";
port {
#address-cells = <1>;
#size-cells = <0>;
ltdc_ep0_out: endpoint@0 {
reg = <0>;
remote-endpoint = <&sii9022_in>;
};
};
};
&m4_rproc {
memory-region = <&retram>, <&mcuram>, <&mcuram2>, <&vdev0vring0>,
<&vdev0vring1>, <&vdev0buffer>;
mboxes = <&ipcc 0>, <&ipcc 1>, <&ipcc 2>;
mbox-names = "vq0", "vq1", "shutdown";
interrupt-parent = <&exti>;
interrupts = <68 1>;
interrupt-names = "wdg";
wakeup-source;
recovery;
status = "okay";
};
&pwr {
pwr-regulators {
vdd-supply = <&vdd>;
vdd_3v3_usbfs-supply = <&vdd_usb>;
};
};
&rng1 {
status = "okay";
};
&rtc {
status = "okay";
};
&sai2 {
clocks = <&rcc SAI2>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
clock-names = "pclk", "x8k", "x11k";
pinctrl-names = "default", "sleep";
pinctrl-0 = <&sai2a_pins_a>, <&sai2b_pins_b>;
pinctrl-1 = <&sai2a_sleep_pins_a>, <&sai2b_sleep_pins_b>;
status = "okay";
sai2a: audio-controller@4400b004 {
#clock-cells = <0>;
dma-names = "tx";
clocks = <&rcc SAI2_K>;
clock-names = "sai_ck";
status = "okay";
sai2a_port: port {
sai2a_endpoint: endpoint {
remote-endpoint = <&cs42l51_tx_endpoint>;
format = "i2s";
mclk-fs = <256>;
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <32>;
};
};
};
sai2b: audio-controller@4400b024 {
dma-names = "rx";
st,sync = <&sai2a 2>;
status = "okay";
clocks = <&rcc SAI2_K>, <&sai2a>;
clock-names = "sai_ck", "MCLK";
sai2b_port: port {
sai2b_endpoint: endpoint {
remote-endpoint = <&cs42l51_rx_endpoint>;
format = "i2s";
mclk-fs = <256>;
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <32>;
};
};
};
};
&sdmmc1 {
pinctrl-names = "default", "opendrain", "sleep";
pinctrl-0 = <&sdmmc1_b4_pins_a>;
pinctrl-1 = <&sdmmc1_b4_od_pins_a>;
pinctrl-2 = <&sdmmc1_b4_sleep_pins_a>;
broken-cd;
st,neg-edge;
bus-width = <4>;
vmmc-supply = <&v3v3>;
status = "okay";
};
&sdmmc3 {
pinctrl-names = "default", "opendrain", "sleep";
pinctrl-0 = <&sdmmc3_b4_pins_a>;
pinctrl-1 = <&sdmmc3_b4_od_pins_a>;
pinctrl-2 = <&sdmmc3_b4_sleep_pins_a>;
broken-cd;
st,neg-edge;
bus-width = <4>;
vmmc-supply = <&v3v3>;
status = "disabled";
};
&spi4 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&spi4_pins_a>;
pinctrl-1 = <&spi4_sleep_pins_a>;
status = "disabled";
};
&spi5 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&spi5_pins_a>;
pinctrl-1 = <&spi5_sleep_pins_a>;
status = "disabled";
};
&timers1 {
/* spare dmas for other usage */
/delete-property/dmas;
/delete-property/dma-names;
status = "disabled";
pwm {
pinctrl-0 = <&pwm1_pins_a>;
pinctrl-1 = <&pwm1_sleep_pins_a>;
pinctrl-names = "default", "sleep";
status = "okay";
};
timer@0 {
status = "okay";
};
};
&timers3 {
/delete-property/dmas;
/delete-property/dma-names;
status = "disabled";
pwm {
pinctrl-0 = <&pwm3_pins_a>;
pinctrl-1 = <&pwm3_sleep_pins_a>;
pinctrl-names = "default", "sleep";
status = "okay";
};
timer@2 {
status = "okay";
};
};
&timers4 {
/delete-property/dmas;
/delete-property/dma-names;
status = "disabled";
pwm {
pinctrl-0 = <&pwm4_pins_a &pwm4_pins_b>;
pinctrl-1 = <&pwm4_sleep_pins_a &pwm4_sleep_pins_b>;
pinctrl-names = "default", "sleep";
status = "okay";
};
timer@3 {
status = "okay";
};
};
&timers5 {
/delete-property/dmas;
/delete-property/dma-names;
status = "disabled";
pwm {
pinctrl-0 = <&pwm5_pins_a>;
pinctrl-1 = <&pwm5_sleep_pins_a>;
pinctrl-names = "default", "sleep";
status = "okay";
};
timer@4 {
status = "okay";
};
};
&timers6 {
status = "okay";
/* spare dmas for other usage */
/delete-property/dmas;
/delete-property/dma-names;
timer@5 {
status = "okay";
};
};
&timers12 {
/delete-property/dmas;
/delete-property/dma-names;
status = "disabled";
pwm {
pinctrl-0 = <&pwm12_pins_a>;
pinctrl-1 = <&pwm12_sleep_pins_a>;
pinctrl-names = "default", "sleep";
status = "okay";
};
timer@11 {
status = "okay";
};
};
&uart4 {
pinctrl-names = "default", "sleep", "idle", "no_console_suspend";
pinctrl-0 = <&uart4_pins_a>;
pinctrl-1 = <&uart4_sleep_pins_a>;
pinctrl-2 = <&uart4_idle_pins_a>;
pinctrl-3 = <&uart4_pins_a>;
/delete-property/dmas;
/delete-property/dma-names;
status = "okay";
};
&uart7 {
pinctrl-names = "default", "sleep", "idle";
pinctrl-0 = <&uart7_pins_a>;
pinctrl-1 = <&uart7_sleep_pins_a>;
pinctrl-2 = <&uart7_idle_pins_a>;
/delete-property/dmas;
/delete-property/dma-names;
status = "disabled";
};
&usart3 {
pinctrl-names = "default", "sleep", "idle";
pinctrl-0 = <&usart3_pins_b>;
pinctrl-1 = <&usart3_sleep_pins_b>;
pinctrl-2 = <&usart3_idle_pins_b>;
st,hw-flow-ctrl;
status = "disabled";
};
&usbh_ehci {
phys = <&usbphyc_port0>;
phy-names = "usb";
status = "okay";
};
&usbotg_hs {
extcon = <&typec>;
phys = <&usbphyc_port1 0>;
phy-names = "usb2-phy";
status = "okay";
};
&usbphyc {
vdd3v3-supply = <&vdd_usb>;
status = "okay";
};
&usbphyc_port0 {
st,phy-tuning = <&usb_phy_tuning>;
};
&usbphyc_port1 {
st,phy-tuning = <&usb_phy_tuning>;
};
&vrefbuf {
regulator-min-microvolt = <2500000>;
regulator-max-microvolt = <2500000>;
vdda-supply = <&vdd>;
status = "okay";
};

View File

@ -0,0 +1,6 @@
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/*
* Copyright : STMicroelectronics 2018
*/
#include "stm32mp157a-dk1-u-boot.dtsi"

View File

@ -0,0 +1,147 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2018 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com>.
*/
/dts-v1/;
#include "stm32mp157a-dk1.dts"
#include <dt-bindings/rtc/rtc-stm32.h>
/ {
model = "STMicroelectronics STM32MP157C-DK2 Discovery Board";
compatible = "st,stm32mp157c-dk2", "st,stm32mp157";
aliases {
serial3 = &usart2;
};
wifi_pwrseq: wifi-pwrseq {
compatible = "mmc-pwrseq-simple";
reset-gpios = <&gpioh 4 GPIO_ACTIVE_LOW>;
};
};
&dsi {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
dsi_in: endpoint {
remote-endpoint = <&ltdc_ep1_out>;
};
};
port@1 {
reg = <1>;
dsi_out: endpoint {
remote-endpoint = <&panel_in>;
};
};
};
panel: panel@0 {
compatible = "orisetech,otm8009a";
reg = <0>;
reset-gpios = <&gpioe 4 GPIO_ACTIVE_LOW>;
power-supply = <&v3v3>;
status = "okay";
port {
panel_in: endpoint {
remote-endpoint = <&dsi_out>;
};
};
};
};
&i2c1 {
touchscreen@2a {
compatible = "focaltech,ft6236";
reg = <0x2a>;
interrupts = <2 2>;
interrupt-parent = <&gpiof>;
interrupt-controller;
touchscreen-size-x = <480>;
touchscreen-size-y = <800>;
panel = <&panel>;
status = "okay";
};
touchscreen@38 {
compatible = "focaltech,ft6336";
reg = <0x38>;
interrupts = <2 2>;
interrupt-parent = <&gpiof>;
interrupt-controller;
touchscreen-size-x = <480>;
touchscreen-size-y = <800>;
panel = <&panel>;
status = "okay";
};
};
&ltdc {
status = "okay";
port {
#address-cells = <1>;
#size-cells = <0>;
ltdc_ep1_out: endpoint@1 {
reg = <1>;
remote-endpoint = <&dsi_in>;
};
};
};
&rtc {
st,lsco = <RTC_OUT2_RMP>;
pinctrl-0 = <&rtc_out2_rmp_pins_a>;
pinctrl-names = "default";
};
/* Wifi */
&sdmmc2 {
arm,primecell-periphid = <0x10153180>;
pinctrl-names = "default", "opendrain", "sleep";
pinctrl-0 = <&sdmmc2_b4_pins_b>;
pinctrl-1 = <&sdmmc2_b4_od_pins_b>;
pinctrl-2 = <&sdmmc2_b4_sleep_pins_a>;
non-removable;
st,neg-edge;
bus-width = <4>;
vmmc-supply = <&v3v3>;
mmc-pwrseq = <&wifi_pwrseq>;
#address-cells = <1>;
#size-cells = <0>;
keep-power-in-suspend;
status = "okay";
brcmf: bcrmf@1 {
reg = <1>;
compatible = "brcm,bcm4329-fmac";
};
};
/* Bluetooth */
&usart2 {
pinctrl-names = "default", "sleep", "idle";
pinctrl-0 = <&usart2_pins_a>;
pinctrl-1 = <&usart2_sleep_pins_a>;
pinctrl-2 = <&usart2_idle_pins_a>;
st,hw-flow-ctrl;
status = "okay";
bluetooth {
shutdown-gpios = <&gpioz 6 GPIO_ACTIVE_HIGH>;
compatible = "brcm,bcm43438-bt";
max-speed = <3000000>;
};
};

View File

@ -9,44 +9,38 @@
/ {
aliases {
i2c3 = &i2c4;
mmc0 = &sdmmc1;
mmc1 = &sdmmc2;
i2c3 = &i2c4;
};
config {
u-boot,boot-led = "heartbeat";
u-boot,error-led = "error";
st,fastboot-gpios = <&gpioa 13 GPIO_ACTIVE_LOW>;
st,stm32prog-gpios = <&gpioa 14 GPIO_ACTIVE_LOW>;
};
led {
compatible = "gpio-leds";
red {
label = "stm32mp:red:status";
label = "error";
gpios = <&gpioa 13 GPIO_ACTIVE_LOW>;
default-state = "off";
status = "okay";
};
green {
label = "stm32mp:green:user";
gpios = <&gpioa 14 GPIO_ACTIVE_LOW>;
default-state = "on";
};
orange {
label = "stm32mp:orange:status";
gpios = <&gpioh 7 GPIO_ACTIVE_HIGH>;
default-state = "off";
};
blue {
label = "stm32mp:blue:user";
gpios = <&gpiod 11 GPIO_ACTIVE_HIGH>;
default-state = "on";
};
};
};
&uart4_pins_a {
&clk_hse {
st,digbypass;
};
&i2c4 {
u-boot,dm-pre-reloc;
pins1 {
u-boot,dm-pre-reloc;
};
pins2 {
u-boot,dm-pre-reloc;
};
};
&i2c4_pins_a {
@ -56,19 +50,10 @@
};
};
&uart4 {
u-boot,dm-pre-reloc;
};
&i2c4 {
u-boot,dm-pre-reloc;
};
&pmic {
u-boot,dm-pre-reloc;
};
/* CLOCK init */
&rcc {
st,clksrc = <
CLK_MPU_PLL1P
@ -101,7 +86,7 @@
CLK_FMC_ACLK
CLK_QSPI_ACLK
CLK_ETH_DISABLED
CLK_SDMMC12_PLL3R
CLK_SDMMC12_PLL4P
CLK_DSI_DSIPLL
CLK_STGEN_HSE
CLK_USBPHY_HSE
@ -110,7 +95,7 @@
CLK_SPI45_HSI
CLK_SPI6_HSI
CLK_I2C46_HSI
CLK_SDMMC3_PLL3R
CLK_SDMMC3_PLL4P
CLK_USBO_USBPHY
CLK_ADC_CKPER
CLK_CEC_LSE
@ -121,26 +106,19 @@
CLK_UART35_HSI
CLK_UART6_HSI
CLK_UART78_HSI
CLK_SPDIF_PLL3Q
CLK_FDCAN_PLL4Q
CLK_SPDIF_PLL4P
CLK_FDCAN_PLL4R
CLK_SAI1_PLL3Q
CLK_SAI2_PLL3Q
CLK_SAI3_PLL3Q
CLK_SAI4_PLL3Q
CLK_RNG1_CSI
CLK_RNG2_CSI
CLK_RNG1_LSI
CLK_RNG2_LSI
CLK_LPTIM1_PCLK1
CLK_LPTIM23_PCLK3
CLK_LPTIM45_PCLK3
CLK_LPTIM45_LSE
>;
/* VCO = 1300.0 MHz => P = 650 (CPU) */
pll1: st,pll@0 {
cfg = < 2 80 0 0 0 PQR(1,0,0) >;
frac = < 0x800 >;
u-boot,dm-pre-reloc;
};
/* VCO = 1066.0 MHz => P = 266 (AXI), Q = 533 (GPU), R = 533 (DDR) */
pll2: st,pll@1 {
cfg = < 2 65 1 0 0 PQR(1,1,1) >;
@ -148,44 +126,54 @@
u-boot,dm-pre-reloc;
};
/* VCO = 786.4 MHz => P = 197, Q = 49, R = 98 */
/* VCO = 417.8 MHz => P = 209, Q = 24, R = 11 */
pll3: st,pll@2 {
cfg = < 2 97 3 15 7 PQR(1,1,1) >;
frac = < 0x9ba >;
cfg = < 1 33 1 16 36 PQR(1,1,1) >;
frac = < 0x1a04 >;
u-boot,dm-pre-reloc;
};
/* VCO = 508.0 MHz => P = 56, Q = 56, R = 56 */
/* VCO = 594.0 MHz => P = 99, Q = 74, R = 74 */
pll4: st,pll@3 {
cfg = < 5 126 8 8 8 PQR(1,1,1) >;
cfg = < 3 98 5 7 7 PQR(1,1,1) >;
u-boot,dm-pre-reloc;
};
};
/* SPL part **************************************/
/* MMC1 boot */
&sdmmc1_b4_pins_a {
u-boot,dm-spl;
pins {
u-boot,dm-spl;
};
};
&sdmmc1_dir_pins_a {
u-boot,dm-spl;
pins {
u-boot,dm-spl;
};
};
&sdmmc1 {
u-boot,dm-spl;
};
/* MMC2 boot */
&sdmmc1_b4_pins_a {
u-boot,dm-spl;
pins1 {
u-boot,dm-spl;
};
pins2 {
u-boot,dm-spl;
};
};
&sdmmc1_dir_pins_a {
u-boot,dm-spl;
pins1 {
u-boot,dm-spl;
};
pins2 {
u-boot,dm-spl;
};
};
&sdmmc2 {
u-boot,dm-spl;
};
&sdmmc2_b4_pins_a {
u-boot,dm-spl;
pins {
pins1 {
u-boot,dm-spl;
};
pins2 {
u-boot,dm-spl;
};
};
@ -197,6 +185,18 @@
};
};
&sdmmc2 {
u-boot,dm-spl;
&uart4 {
u-boot,dm-pre-reloc;
};
&uart4_pins_a {
u-boot,dm-pre-reloc;
pins1 {
u-boot,dm-pre-reloc;
};
pins2 {
u-boot,dm-pre-reloc;
/* pull-up on rx to avoid floating level */
bias-pull-up;
};
};

View File

@ -6,22 +6,96 @@
/dts-v1/;
#include "stm32mp157c.dtsi"
#include "stm32mp157-pinctrl.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/mfd/st,stpmu1.h>
#include "stm32mp157caa-pinctrl.dtsi"
#include "stm32mp157c-m4-srm.dtsi"
#include <dt-bindings/mfd/st,stpmic1.h>
/ {
model = "STMicroelectronics STM32MP157C eval daughter";
compatible = "st,stm32mp157c-ed1", "st,stm32mp157";
chosen {
stdout-path = "serial3:115200n8";
stdout-path = "serial0:115200n8";
};
memory@c0000000 {
reg = <0xC0000000 0x40000000>;
};
reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
ranges;
retram: retram@0x38000000 {
compatible = "shared-dma-pool";
reg = <0x38000000 0x10000>;
no-map;
};
mcuram: mcuram@0x30000000 {
compatible = "shared-dma-pool";
reg = <0x30000000 0x40000>;
no-map;
};
mcuram2: mcuram2@0x10000000 {
compatible = "shared-dma-pool";
reg = <0x10000000 0x40000>;
no-map;
};
vdev0vring0: vdev0vring0@10040000 {
compatible = "shared-dma-pool";
reg = <0x10040000 0x2000>;
no-map;
};
vdev0vring1: vdev0vring1@10042000 {
compatible = "shared-dma-pool";
reg = <0x10042000 0x2000>;
no-map;
};
vdev0buffer: vdev0buffer@10044000 {
compatible = "shared-dma-pool";
reg = <0x10044000 0x4000>;
no-map;
};
gpu_reserved: gpu@e8000000 {
reg = <0xe8000000 0x8000000>;
no-map;
};
};
aliases {
serial0 = &uart4;
};
sram: sram@10050000 {
compatible = "mmio-sram";
reg = <0x10050000 0x10000>;
#address-cells = <1>;
#size-cells = <1>;
ranges = <0 0x10050000 0x10000>;
dma_pool: dma_pool@0 {
reg = <0x0 0x10000>;
pool;
};
};
led {
compatible = "gpio-leds";
blue {
label = "heartbeat";
gpios = <&gpiod 9 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "heartbeat";
default-state = "off";
};
};
sd_switch: regulator-sd_switch {
compatible = "regulator-gpio";
regulator-name = "sd_switch";
@ -36,40 +110,93 @@
};
};
&rng1 {
&adc {
/* ANA0, ANA1 are dedicated pins and don't need pinctrl: only in6. */
vdd-supply = <&vdd>;
vdda-supply = <&vdda>;
vref-supply = <&vdda>;
status = "okay";
};
&timers6 {
status = "okay";
timer@5 {
adc1: adc@0 {
st,adc-channels = <0 1>;
/* 16.5 ck_cycles sampling time */
st,min-sample-time-nsecs = <400>;
status = "okay";
};
jadc1: jadc@0 {
st,adc-channels = <0 1>;
/* 16.5 ck_cycles sampling time */
st,min-sample-time-nsecs = <400>;
status = "okay";
};
/* temperature sensor on adc2 */
adc2: adc@100 {
status = "okay";
};
adc_temp: temp {
status = "okay";
};
};
&i2c4 {
&cpu0{
cpu-supply = <&vddcore>;
};
&cpu1{
cpu-supply = <&vddcore>;
};
&dac {
pinctrl-names = "default";
pinctrl-0 = <&dac_ch1_pins_a &dac_ch2_pins_a>;
vref-supply = <&vdda>;
status = "okay";
dac1: dac@1 {
status = "okay";
};
dac2: dac@2 {
status = "okay";
};
};
&dma1 {
sram = <&dma_pool>;
};
&dma2 {
sram = <&dma_pool>;
};
&dts {
status = "okay";
};
&gpu {
contiguous-area = <&gpu_reserved>;
status = "okay";
};
&i2c4 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&i2c4_pins_a>;
pinctrl-1 = <&i2c4_pins_sleep_a>;
i2c-scl-rising-time-ns = <185>;
i2c-scl-falling-time-ns = <20>;
clock-frequency = <400000>;
status = "okay";
/delete-property/dmas;
/delete-property/dma-names;
pmic: stpmu1@33 {
compatible = "st,stpmu1";
pmic: stpmic@33 {
compatible = "st,stpmic1";
reg = <0x33>;
interrupts = <0 2>;
interrupt-parent = <&gpioa>;
interrupts-extended = <&exti_pwr 55 IRQ_TYPE_EDGE_FALLING>;
interrupt-controller;
#interrupt-cells = <2>;
status = "okay";
st,main_control_register = <0x04>;
st,vin_control_register = <0xc0>;
st,usb_control_register = <0x30>;
wakeup-source;
regulators {
compatible = "st,stpmu1-regulators";
compatible = "st,stpmic1-regulators";
ldo1-supply = <&v3v3>;
ldo2-supply = <&v3v3>;
ldo3-supply = <&vdd_ddr>;
@ -80,23 +207,11 @@
vddcore: buck1 {
regulator-name = "vddcore";
regulator-min-microvolt = <800000>;
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <1350000>;
regulator-always-on;
regulator-initial-mode = <2>;
regulator-initial-mode = <0>;
regulator-over-current-protection;
regulator-state-standby {
regulator-on-in-suspend;
regulator-suspend-microvolt = <1200000>;
regulator-mode = <8>;
};
regulator-state-mem {
regulator-off-in-suspend;
};
regulator-state-disk {
regulator-off-in-suspend;
};
};
vdd_ddr: buck2 {
@ -104,22 +219,8 @@
regulator-min-microvolt = <1350000>;
regulator-max-microvolt = <1350000>;
regulator-always-on;
regulator-initial-mode = <2>;
regulator-initial-mode = <0>;
regulator-over-current-protection;
regulator-state-standby {
regulator-suspend-microvolt = <1350000>;
regulator-on-in-suspend;
regulator-mode = <8>;
};
regulator-state-mem {
regulator-suspend-microvolt = <1350000>;
regulator-on-in-suspend;
regulator-mode = <8>;
};
regulator-state-disk {
regulator-off-in-suspend;
};
};
vdd: buck3 {
@ -127,46 +228,18 @@
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
st,mask_reset;
regulator-initial-mode = <8>;
st,mask-reset;
regulator-initial-mode = <0>;
regulator-over-current-protection;
regulator-state-standby {
regulator-suspend-microvolt = <3300000>;
regulator-on-in-suspend;
regulator-mode = <8>;
};
regulator-state-mem {
regulator-suspend-microvolt = <3300000>;
regulator-on-in-suspend;
regulator-mode = <8>;
};
regulator-state-disk {
regulator-suspend-microvolt = <3300000>;
regulator-on-in-suspend;
regulator-mode = <8>;
};
};
v3v3: buck4 {
regulator-name = "v3v3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-boot-on;
regulator-always-on;
regulator-over-current-protection;
regulator-initial-mode = <8>;
regulator-state-standby {
regulator-suspend-microvolt = <3300000>;
regulator-unchanged-in-suspend;
regulator-mode = <8>;
};
regulator-state-mem {
regulator-off-in-suspend;
};
regulator-state-disk {
regulator-off-in-suspend;
};
regulator-initial-mode = <0>;
};
vdda: ldo1 {
@ -174,18 +247,6 @@
regulator-min-microvolt = <2900000>;
regulator-max-microvolt = <2900000>;
interrupts = <IT_CURLIM_LDO1 0>;
interrupt-parent = <&pmic>;
regulator-state-standby {
regulator-suspend-microvolt = <2900000>;
regulator-unchanged-in-suspend;
};
regulator-state-mem {
regulator-off-in-suspend;
};
regulator-state-disk {
regulator-off-in-suspend;
};
};
v2v8: ldo2 {
@ -193,36 +254,14 @@
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <2800000>;
interrupts = <IT_CURLIM_LDO2 0>;
interrupt-parent = <&pmic>;
regulator-state-standby {
regulator-suspend-microvolt = <2800000>;
regulator-unchanged-in-suspend;
};
regulator-state-mem {
regulator-off-in-suspend;
};
regulator-state-disk {
regulator-off-in-suspend;
};
};
vtt_ddr: ldo3 {
regulator-name = "vtt_ddr";
regulator-min-microvolt = <0000000>;
regulator-max-microvolt = <1000000>;
regulator-min-microvolt = <500000>;
regulator-max-microvolt = <750000>;
regulator-always-on;
regulator-over-current-protection;
regulator-state-standby {
regulator-off-in-suspend;
};
regulator-state-mem {
regulator-off-in-suspend;
};
regulator-state-disk {
regulator-off-in-suspend;
};
};
vdd_usb: ldo4 {
@ -230,17 +269,6 @@
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
interrupts = <IT_CURLIM_LDO4 0>;
interrupt-parent = <&pmic>;
regulator-state-standby {
regulator-unchanged-in-suspend;
};
regulator-state-mem {
regulator-off-in-suspend;
};
regulator-state-disk {
regulator-off-in-suspend;
};
};
vdd_sd: ldo5 {
@ -248,19 +276,7 @@
regulator-min-microvolt = <2900000>;
regulator-max-microvolt = <2900000>;
interrupts = <IT_CURLIM_LDO5 0>;
interrupt-parent = <&pmic>;
regulator-boot-on;
regulator-state-standby {
regulator-suspend-microvolt = <2900000>;
regulator-unchanged-in-suspend;
};
regulator-state-mem {
regulator-off-in-suspend;
};
regulator-state-disk {
regulator-off-in-suspend;
};
};
v1v8: ldo6 {
@ -268,69 +284,92 @@
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
interrupts = <IT_CURLIM_LDO6 0>;
interrupt-parent = <&pmic>;
regulator-state-standby {
regulator-suspend-microvolt = <1800000>;
regulator-unchanged-in-suspend;
};
regulator-state-mem {
regulator-off-in-suspend;
};
regulator-state-disk {
regulator-off-in-suspend;
};
};
vref_ddr: vref_ddr {
regulator-name = "vref_ddr";
regulator-always-on;
regulator-over-current-protection;
regulator-state-standby {
regulator-on-in-suspend;
};
regulator-state-mem {
regulator-on-in-suspend;
};
regulator-state-disk {
regulator-off-in-suspend;
};
};
bst_out: boost {
bst_out: boost {
regulator-name = "bst_out";
interrupts = <IT_OCP_BOOST 0>;
interrupt-parent = <&pmic>;
};
};
vbus_otg: pwr_sw1 {
regulator-name = "vbus_otg";
interrupts = <IT_OCP_OTG 0>;
interrupt-parent = <&pmic>;
regulator-active-discharge;
};
vbus_sw: pwr_sw2 {
regulator-name = "vbus_sw";
interrupts = <IT_OCP_SWOUT 0>;
interrupt-parent = <&pmic>;
regulator-active-discharge;
regulator-active-discharge = <1>;
};
};
onkey {
compatible = "st,stpmic1-onkey";
interrupts = <IT_PONKEY_F 0>, <IT_PONKEY_R 0>;
interrupt-names = "onkey-falling", "onkey-rising";
power-off-time-sec = <10>;
status = "okay";
};
watchdog {
compatible = "st,stpmic1-wdt";
status = "disabled";
};
};
};
&ipcc {
status = "okay";
};
&iwdg2 {
timeout-sec = <32>;
status = "okay";
};
&m4_rproc {
memory-region = <&retram>, <&mcuram>, <&mcuram2>, <&vdev0vring0>,
<&vdev0vring1>, <&vdev0buffer>;
mboxes = <&ipcc 0>, <&ipcc 1>, <&ipcc 2>;
mbox-names = "vq0", "vq1", "shutdown";
interrupt-parent = <&exti>;
interrupts = <68 1>;
interrupt-names = "wdg";
wakeup-source;
recovery;
status = "okay";
};
&pwr {
pwr-supply = <&vdd>;
pwr-regulators {
vdd-supply = <&vdd>;
vdd_3v3_usbfs-supply = <&vdd_usb>;
};
};
&rng1 {
status = "okay";
};
&rtc {
status = "okay";
};
&sdmmc1 {
pinctrl-names = "default", "opendrain", "sleep";
pinctrl-0 = <&sdmmc1_b4_pins_a &sdmmc1_dir_pins_a>;
pinctrl-1 = <&sdmmc1_b4_od_pins_a &sdmmc1_dir_pins_a>;
pinctrl-2 = <&sdmmc1_b4_sleep_pins_a &sdmmc1_dir_sleep_pins_a>;
broken-cd;
st,dirpol;
st,negedge;
st,pin-ckin;
st,sig-dir;
st,neg-edge;
st,use-ckin;
bus-width = <4>;
vmmc-supply = <&vdd_sd>;
vqmmc-supply = <&sd_switch>;
@ -343,36 +382,46 @@
};
&sdmmc2 {
pinctrl-names = "default", "opendrain", "sleep";
pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_pins_a>;
pinctrl-1 = <&sdmmc2_b4_od_pins_a &sdmmc2_d47_pins_a>;
pinctrl-2 = <&sdmmc2_b4_sleep_pins_a &sdmmc2_d47_sleep_pins_a>;
non-removable;
no-sd;
no-sdio;
st,dirpol;
st,negedge;
st,neg-edge;
bus-width = <8>;
vmmc-supply = <&v3v3>;
vqmmc-supply = <&vdd>;
vqmmc-supply = <&v3v3>;
mmc-ddr-3_3v;
status = "okay";
};
&timers6 {
status = "okay";
/* spare dmas for other usage */
/delete-property/dmas;
/delete-property/dma-names;
timer@5 {
status = "okay";
};
};
&uart4 {
pinctrl-names = "default";
pinctrl-names = "default", "sleep", "idle", "no_console_suspend";
pinctrl-0 = <&uart4_pins_a>;
pinctrl-1 = <&uart4_sleep_pins_a>;
pinctrl-2 = <&uart4_idle_pins_a>;
pinctrl-3 = <&uart4_pins_a>;
/delete-property/dmas;
/delete-property/dma-names;
status = "okay";
};
&usbotg_hs {
usb33d-supply = <&usb33>;
vbus-supply = <&vbus_otg>;
};
&usbphyc_port0 {
phy-supply = <&vdd_usb>;
vdda1v1-supply = <&reg11>;
vdda1v8-supply = <&reg18>;
};
&usbphyc_port1 {
phy-supply = <&vdd_usb>;
vdda1v1-supply = <&reg11>;
vdda1v8-supply = <&reg18>;
&usbphyc {
vdd3v3-supply = <&vdd_usb>;
};

View File

@ -7,29 +7,23 @@
/ {
aliases {
spi0 = &qspi;
gpio26 = &stmfx_pinctrl;
i2c1 = &i2c2;
i2c4 = &i2c5;
pinctrl2 = &stmfx_pinctrl;
spi0 = &qspi;
};
};
&flash0 {
compatible = "spi-flash";
u-boot,dm-spl;
};
&flash1 {
compatible = "spi-flash";
};
&v3v3 {
regulator-always-on;
};
&usbotg_hs {
g-tx-fifo-size = <576>;
};
/* SPL part **************************************/
&qspi {
u-boot,dm-spl;
};
@ -60,8 +54,3 @@
u-boot,dm-spl;
};
};
&flash0 {
u-boot,dm-spl;
};

View File

@ -6,44 +6,555 @@
/dts-v1/;
#include "stm32mp157c-ed1.dts"
#include <dt-bindings/input/input.h>
#include <dt-bindings/soc/stm32-hdp.h>
/ {
model = "STMicroelectronics STM32MP157C eval daughter on eval mother";
compatible = "st,stm32mp157c-ev1", "st,stm32mp157c-ed1", "st,stm32mp157";
chosen {
stdout-path = "serial0:115200n8";
};
aliases {
serial1 = &usart3;
ethernet0 = &ethernet0;
};
clocks {
clk_ext_camera: clk-ext-camera {
#clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <24000000>;
};
};
joystick {
compatible = "gpio-keys";
#size-cells = <0>;
pinctrl-0 = <&joystick_pins>;
pinctrl-names = "default";
button-0 {
label = "JoySel";
linux,code = <KEY_ENTER>;
interrupt-parent = <&stmfx_pinctrl>;
interrupts = <0 IRQ_TYPE_EDGE_RISING>;
};
button-1 {
label = "JoyDown";
linux,code = <KEY_DOWN>;
interrupt-parent = <&stmfx_pinctrl>;
interrupts = <1 IRQ_TYPE_EDGE_RISING>;
};
button-2 {
label = "JoyLeft";
linux,code = <KEY_LEFT>;
interrupt-parent = <&stmfx_pinctrl>;
interrupts = <2 IRQ_TYPE_EDGE_RISING>;
};
button-3 {
label = "JoyRight";
linux,code = <KEY_RIGHT>;
interrupt-parent = <&stmfx_pinctrl>;
interrupts = <3 IRQ_TYPE_EDGE_RISING>;
};
button-4 {
label = "JoyUp";
linux,code = <KEY_UP>;
interrupt-parent = <&stmfx_pinctrl>;
interrupts = <4 IRQ_TYPE_EDGE_RISING>;
};
};
panel_backlight: panel-backlight {
compatible = "gpio-backlight";
gpios = <&gpiod 13 GPIO_ACTIVE_LOW>;
default-on;
status = "okay";
};
spdif_out: spdif-out {
#sound-dai-cells = <0>;
compatible = "linux,spdif-dit";
status = "okay";
spdif_out_port: port {
spdif_out_endpoint: endpoint {
remote-endpoint = <&sai4a_endpoint>;
};
};
};
spdif_in: spdif-in {
#sound-dai-cells = <0>;
compatible = "linux,spdif-dir";
status = "okay";
spdif_in_port: port {
spdif_in_endpoint: endpoint {
remote-endpoint = <&spdifrx_endpoint>;
};
};
};
sound: sound {
compatible = "audio-graph-card";
label = "STM32MP1-EV";
routing =
"AIF1CLK" , "MCLK1",
"AIF2CLK" , "MCLK1",
"IN1LN" , "MICBIAS2",
"DMIC2DAT" , "MICBIAS1",
"DMIC1DAT" , "MICBIAS1";
dais = <&sai2a_port &sai2b_port &sai4a_port &spdifrx_port
&dfsdm0_port &dfsdm1_port &dfsdm2_port &dfsdm3_port>;
status = "okay";
};
dmic0: dmic-0 {
compatible = "dmic-codec";
#sound-dai-cells = <1>;
status = "okay";
port {
dmic0_endpoint: endpoint {
remote-endpoint = <&dfsdm_endpoint0>;
};
};
};
dmic1: dmic-1 {
compatible = "dmic-codec";
#sound-dai-cells = <1>;
status = "okay";
port {
dmic1_endpoint: endpoint {
remote-endpoint = <&dfsdm_endpoint1>;
};
};
};
dmic2: dmic-2 {
compatible = "dmic-codec";
#sound-dai-cells = <1>;
status = "okay";
port {
dmic2_endpoint: endpoint {
remote-endpoint = <&dfsdm_endpoint2>;
};
};
};
dmic3: dmic-3 {
compatible = "dmic-codec";
#sound-dai-cells = <1>;
status = "okay";
port {
dmic3_endpoint: endpoint {
remote-endpoint = <&dfsdm_endpoint3>;
};
};
};
usb_phy_tuning: usb-phy-tuning {
st,hs-dc-level = <2>;
st,fs-rftime-tuning;
st,hs-rftime-reduction;
st,hs-current-trim = <15>;
st,hs-impedance-trim = <1>;
st,squelch-level = <3>;
st,hs-rx-offset = <2>;
st,no-lsfs-sc;
};
};
&cec {
pinctrl-names = "default";
pinctrl-names = "default", "sleep";
pinctrl-0 = <&cec_pins_a>;
pinctrl-1 = <&cec_pins_sleep_a>;
};
&dcmi {
status = "okay";
pinctrl-names = "default", "sleep";
pinctrl-0 = <&dcmi_pins_a>;
pinctrl-1 = <&dcmi_sleep_pins_a>;
port {
dcmi_0: endpoint {
remote-endpoint = <&ov5640_0>;
bus-width = <8>;
hsync-active = <0>;
vsync-active = <0>;
pclk-sample = <1>;
pclk-max-frequency = <77000000>;
};
};
};
&dfsdm {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&dfsdm_clkout_pins_a
&dfsdm_data1_pins_a &dfsdm_data3_pins_a>;
pinctrl-1 = <&dfsdm_clkout_sleep_pins_a
&dfsdm_data1_sleep_pins_a &dfsdm_data3_sleep_pins_a>;
spi-max-frequency = <2048000>;
clocks = <&rcc DFSDM_K>, <&rcc ADFSDM_K>;
clock-names = "dfsdm", "audio";
status = "okay";
dfsdm0: filter@0 {
compatible = "st,stm32-dfsdm-dmic";
st,adc-channels = <3>;
st,adc-channel-names = "dmic_u1";
st,adc-channel-types = "SPI_R";
st,adc-channel-clk-src = "CLKOUT";
st,filter-order = <3>;
status = "okay";
asoc_pdm0: dfsdm-dai {
compatible = "st,stm32h7-dfsdm-dai";
#sound-dai-cells = <0>;
io-channels = <&dfsdm0 0>;
status = "okay";
dfsdm0_port: port {
dfsdm_endpoint0: endpoint {
remote-endpoint = <&dmic0_endpoint>;
};
};
};
};
dfsdm1: filter@1 {
compatible = "st,stm32-dfsdm-dmic";
st,adc-channels = <1>;
st,adc-channel-names = "dmic_u2";
st,adc-channel-types = "SPI_F";
st,adc-channel-clk-src = "CLKOUT";
st,filter-order = <3>;
status = "okay";
asoc_pdm1: dfsdm-dai {
compatible = "st,stm32h7-dfsdm-dai";
#sound-dai-cells = <0>;
io-channels = <&dfsdm1 0>;
status = "okay";
dfsdm1_port: port {
dfsdm_endpoint1: endpoint {
remote-endpoint = <&dmic1_endpoint>;
};
};
};
};
dfsdm2: filter@2 {
compatible = "st,stm32-dfsdm-dmic";
st,adc-channels = <3>;
st,adc-channel-names = "dmic_u3";
st,adc-channel-types = "SPI_F";
st,adc-channel-clk-src = "CLKOUT";
st,filter-order = <3>;
status = "okay";
asoc_pdm2: dfsdm-dai {
compatible = "st,stm32h7-dfsdm-dai";
#sound-dai-cells = <0>;
io-channels = <&dfsdm2 0>;
status = "okay";
dfsdm2_port: port {
dfsdm_endpoint2: endpoint {
remote-endpoint = <&dmic2_endpoint>;
};
};
};
};
dfsdm3: filter@3 {
compatible = "st,stm32-dfsdm-dmic";
st,adc-channels = <1>;
st,adc-channel-names = "dmic_u4";
st,adc-channel-types = "SPI_R";
st,adc-channel-clk-src = "CLKOUT";
st,filter-order = <3>;
status = "okay";
asoc_pdm3: dfsdm-dai {
compatible = "st,stm32h7-dfsdm-dai";
#sound-dai-cells = <0>;
io-channels = <&dfsdm3 0>;
status = "okay";
dfsdm3_port: port {
dfsdm_endpoint3: endpoint {
remote-endpoint = <&dmic3_endpoint>;
};
};
};
};
};
&dsi {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
dsi_in: endpoint {
remote-endpoint = <&ltdc_ep0_out>;
};
};
port@1 {
reg = <1>;
dsi_out: endpoint {
remote-endpoint = <&dsi_panel_in>;
};
};
};
panel_dsi: panel-dsi@0 {
compatible = "raydium,rm68200";
reg = <0>;
reset-gpios = <&gpiof 15 GPIO_ACTIVE_LOW>;
power-supply = <&v3v3>;
backlight = <&panel_backlight>;
status = "okay";
port {
dsi_panel_in: endpoint {
remote-endpoint = <&dsi_out>;
};
};
};
};
&ethernet0 {
status = "okay";
pinctrl-0 = <&ethernet0_rgmii_pins_a>;
pinctrl-1 = <&ethernet0_rgmii_pins_sleep_a>;
pinctrl-names = "default", "sleep";
phy-mode = "rgmii-id";
max-speed = <1000>;
phy-handle = <&phy0>;
mdio0 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "snps,dwmac-mdio";
phy0: ethernet-phy@0 {
reg = <0>;
};
};
};
&fmc {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&fmc_pins_a>;
pinctrl-1 = <&fmc_sleep_pins_a>;
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
nand: nand@0 {
reg = <0>;
nand-on-flash-bbt;
#address-cells = <1>;
#size-cells = <1>;
};
};
&hdp {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&hdp0_pins_a &hdp6_pins_a &hdp7_pins_a>;
pinctrl-1 = <&hdp0_pins_sleep_a &hdp6_pins_sleep_a &hdp7_pins_sleep_a>;
status = "disabled";
muxing-hdp = <(STM32_HDP(0, HDP0_GPOVAL_0) |
STM32_HDP(6, HDP6_GPOVAL_6) |
STM32_HDP(7, HDP7_GPOVAL_7))>;
};
&i2c2 {
pinctrl-names = "default";
pinctrl-names = "default", "sleep";
pinctrl-0 = <&i2c2_pins_a>;
pinctrl-1 = <&i2c2_pins_sleep_a>;
i2c-scl-rising-time-ns = <185>;
i2c-scl-falling-time-ns = <20>;
status = "okay";
/delete-property/dmas;
/delete-property/dma-names;
wm8994: wm8994@1b {
compatible = "wlf,wm8994";
#sound-dai-cells = <0>;
reg = <0x1b>;
status = "okay";
gpio-controller;
#gpio-cells = <2>;
DBVDD-supply = <&vdd>;
SPKVDD1-supply = <&vdd>;
SPKVDD2-supply = <&vdd>;
AVDD2-supply = <&v1v8>;
CPVDD-supply = <&v1v8>;
wlf,ldoena-always-driven;
clocks = <&sai2a>;
clock-names = "MCLK1";
wlf,gpio-cfg = <0x8101 0xa100 0xa100 0xa100 0xa101 0xa101 0xa100 0xa101 0xa101 0xa101 0xa101>;
ports {
#address-cells = <1>;
#size-cells = <0>;
wm8994_tx_port: port@0 {
reg = <0>;
wm8994_tx_endpoint: endpoint {
remote-endpoint = <&sai2a_endpoint>;
};
};
wm8994_rx_port: port@1 {
reg = <1>;
wm8994_rx_endpoint: endpoint {
remote-endpoint = <&sai2b_endpoint>;
};
};
};
};
ov5640: camera@3c {
compatible = "ovti,ov5640";
reg = <0x3c>;
clocks = <&clk_ext_camera>;
clock-names = "xclk";
DOVDD-supply = <&v2v8>;
powerdown-gpios = <&stmfx_pinctrl 18 (GPIO_ACTIVE_HIGH | GPIO_PUSH_PULL)>;
reset-gpios = <&stmfx_pinctrl 19 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>;
rotation = <180>;
status = "okay";
port {
ov5640_0: endpoint {
remote-endpoint = <&dcmi_0>;
bus-width = <8>;
data-shift = <2>; /* lines 9:2 are used */
hsync-active = <0>;
vsync-active = <0>;
pclk-sample = <1>;
pclk-max-frequency = <77000000>;
};
};
};
stmfx: stmfx@42 {
compatible = "st,stmfx-0300";
reg = <0x42>;
interrupts = <8 IRQ_TYPE_EDGE_RISING>;
interrupt-parent = <&gpioi>;
vdd-supply = <&v3v3>;
stmfx_pinctrl: stmfx-pin-controller {
compatible = "st,stmfx-0300-pinctrl";
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <2>;
gpio-ranges = <&stmfx_pinctrl 0 0 24>;
pinctrl-names = "default";
pinctrl-0 = <&hog_pins>;
hog_pins: hog {
pins = "gpio14";
bias-pull-down;
};
joystick_pins: joystick {
pins = "gpio0", "gpio1", "gpio2", "gpio3", "gpio4";
bias-pull-down;
};
};
};
gt9147: goodix_ts@5d {
compatible = "goodix,gt9147";
reg = <0x5d>;
panel = <&panel_dsi>;
status = "okay";
irq-gpios = <&stmfx_pinctrl 14 GPIO_ACTIVE_HIGH>;
irq-flags = <IRQ_TYPE_EDGE_RISING>;
};
};
&i2c4 {
pmic: stpmic@33 {
regulators {
v1v8: ldo6 {
regulator-enable-ramp-delay = <300000>;
};
};
};
};
&i2c5 {
pinctrl-names = "default";
pinctrl-names = "default", "sleep";
pinctrl-0 = <&i2c5_pins_a>;
pinctrl-1 = <&i2c5_pins_sleep_a>;
i2c-scl-rising-time-ns = <185>;
i2c-scl-falling-time-ns = <20>;
/delete-property/dmas;
/delete-property/dma-names;
};
&ltdc {
status = "okay";
port {
#address-cells = <1>;
#size-cells = <0>;
ltdc_ep0_out: endpoint@0 {
reg = <0>;
remote-endpoint = <&dsi_in>;
};
};
};
&m_can1 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&m_can1_pins_a>;
pinctrl-1 = <&m_can1_sleep_pins_a>;
status = "okay";
};
&qspi {
pinctrl-names = "default";
pinctrl-names = "default", "sleep";
pinctrl-0 = <&qspi_clk_pins_a &qspi_bk1_pins_a &qspi_bk2_pins_a>;
pinctrl-1 = <&qspi_clk_sleep_pins_a &qspi_bk1_sleep_pins_a &qspi_bk2_sleep_pins_a>;
reg = <0x58003000 0x1000>, <0x70000000 0x4000000>;
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
flash0: mx66l51235l@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-rx-bus-width = <4>;
spi-max-frequency = <108000000>;
@ -52,6 +563,7 @@
};
flash1: mx66l51235l@1 {
compatible = "jedec,spi-nor";
reg = <1>;
spi-rx-bus-width = <4>;
spi-max-frequency = <108000000>;
@ -60,11 +572,110 @@
};
};
&sai2 {
clocks = <&rcc SAI2>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
pinctrl-names = "default", "sleep";
pinctrl-0 = <&sai2a_pins_a>, <&sai2b_pins_a>;
pinctrl-1 = <&sai2a_sleep_pins_a>, <&sai2b_sleep_pins_a>;
clock-names = "pclk", "x8k", "x11k";
status = "okay";
sai2a: audio-controller@4400b004 {
#clock-cells = <0>;
dma-names = "tx";
clocks = <&rcc SAI2_K>;
clock-names = "sai_ck";
status = "okay";
sai2a_port: port {
sai2a_endpoint: endpoint {
remote-endpoint = <&wm8994_tx_endpoint>;
format = "i2s";
mclk-fs = <256>;
};
};
};
sai2b: audio-controller@4400b024 {
dma-names = "rx";
clocks = <&rcc SAI2_K>, <&sai2a>;
clock-names = "sai_ck", "MCLK";
status = "okay";
sai2b_port: port {
sai2b_endpoint: endpoint {
remote-endpoint = <&wm8994_rx_endpoint>;
format = "i2s";
mclk-fs = <256>;
};
};
};
};
&sai4 {
clocks = <&rcc SAI4>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
clock-names = "pclk", "x8k", "x11k";
status = "okay";
sai4a: audio-controller@50027004 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&sai4a_pins_a>;
pinctrl-1 = <&sai4a_sleep_pins_a>;
dma-names = "tx";
clocks = <&rcc SAI4_K>;
clock-names = "sai_ck";
st,iec60958;
status = "okay";
sai4a_port: port {
sai4a_endpoint: endpoint {
remote-endpoint = <&spdif_out_endpoint>;
};
};
};
};
&sdmmc3 {
pinctrl-names = "default", "opendrain", "sleep";
pinctrl-0 = <&sdmmc3_b4_pins_a>;
pinctrl-1 = <&sdmmc3_b4_od_pins_a>;
pinctrl-2 = <&sdmmc3_b4_sleep_pins_a>;
vmmc-supply = <&v3v3>;
broken-cd;
st,neg-edge;
bus-width = <4>;
status = "disabled";
};
&spdifrx {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&spdifrx_pins_a>;
pinctrl-1 = <&spdifrx_pins_a>;
status = "okay";
spdifrx_port: port {
spdifrx_endpoint: endpoint {
remote-endpoint = <&spdif_in_endpoint>;
};
};
};
&spi1 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&spi1_pins_a>;
pinctrl-1 = <&spi1_sleep_pins_a>;
status = "disabled";
};
&timers2 {
status = "disabled";
/* spare dmas for other usage (un-delete to enable pwm capture) */
/delete-property/dmas;
/delete-property/dma-names;
pwm {
pinctrl-0 = <&pwm2_pins_a>;
pinctrl-names = "default";
pinctrl-1 = <&pwm2_sleep_pins_a>;
pinctrl-names = "default", "sleep";
status = "okay";
};
timer@1 {
@ -74,9 +685,12 @@
&timers8 {
status = "disabled";
/delete-property/dmas;
/delete-property/dma-names;
pwm {
pinctrl-0 = <&pwm8_pins_a>;
pinctrl-names = "default";
pinctrl-1 = <&pwm8_sleep_pins_a>;
pinctrl-names = "default", "sleep";
status = "okay";
};
timer@7 {
@ -86,9 +700,12 @@
&timers12 {
status = "disabled";
/delete-property/dmas;
/delete-property/dma-names;
pwm {
pinctrl-0 = <&pwm12_pins_a>;
pinctrl-names = "default";
pinctrl-1 = <&pwm12_sleep_pins_a>;
pinctrl-names = "default", "sleep";
status = "okay";
};
timer@11 {
@ -96,6 +713,15 @@
};
};
&usart3 {
pinctrl-names = "default", "sleep", "idle";
pinctrl-0 = <&usart3_pins_a>;
pinctrl-1 = <&usart3_sleep_pins_a>;
pinctrl-2 = <&usart3_idle_pins_a>;
st,hw-flow-ctrl;
status = "disabled";
};
&usbh_ehci {
phys = <&usbphyc_port0>;
phy-names = "usb";
@ -114,3 +740,11 @@
&usbphyc {
status = "okay";
};
&usbphyc_port0 {
st,phy-tuning = <&usb_phy_tuning>;
};
&usbphyc_port1 {
st,phy-tuning = <&usb_phy_tuning>;
};

View File

@ -0,0 +1,961 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2019 - All Rights Reserved
* Author: Fabien Dessenne <fabien.dessenne@st.com> for STMicroelectronics.
*/
&pinctrl {
m4_adc1_in6_pins_a: m4-adc1-in6 {
pins {
pinmux = <STM32_PINMUX('F', 12, RSVD)>;
};
};
m4_adc12_ain_pins_a: m4-adc12-ain-0 {
pins {
pinmux = <STM32_PINMUX('C', 3, RSVD)>, /* ADC1 in13 */
<STM32_PINMUX('F', 12, RSVD)>, /* ADC1 in6 */
<STM32_PINMUX('F', 13, RSVD)>, /* ADC2 in2 */
<STM32_PINMUX('F', 14, RSVD)>; /* ADC2 in6 */
};
};
m4_adc12_usb_pwr_pins_a: m4-adc12-usb-pwr-pins-0 {
pins {
pinmux = <STM32_PINMUX('A', 4, RSVD)>, /* ADC12 in18 */
<STM32_PINMUX('A', 5, RSVD)>; /* ADC12 in19 */
};
};
m4_cec_pins_a: m4-cec-0 {
pins {
pinmux = <STM32_PINMUX('A', 15, RSVD)>;
};
};
m4_cec_pins_b: m4-cec-1 {
pins {
pinmux = <STM32_PINMUX('B', 6, RSVD)>;
};
};
m4_dac_ch1_pins_a: m4-dac-ch1 {
pins {
pinmux = <STM32_PINMUX('A', 4, RSVD)>;
};
};
m4_dac_ch2_pins_a: m4-dac-ch2 {
pins {
pinmux = <STM32_PINMUX('A', 5, RSVD)>;
};
};
m4_dcmi_pins_a: m4-dcmi-0 {
pins {
pinmux = <STM32_PINMUX('H', 8, RSVD)>,/* DCMI_HSYNC */
<STM32_PINMUX('B', 7, RSVD)>,/* DCMI_VSYNC */
<STM32_PINMUX('A', 6, RSVD)>,/* DCMI_PIXCLK */
<STM32_PINMUX('H', 9, RSVD)>,/* DCMI_D0 */
<STM32_PINMUX('H', 10, RSVD)>,/* DCMI_D1 */
<STM32_PINMUX('H', 11, RSVD)>,/* DCMI_D2 */
<STM32_PINMUX('H', 12, RSVD)>,/* DCMI_D3 */
<STM32_PINMUX('H', 14, RSVD)>,/* DCMI_D4 */
<STM32_PINMUX('I', 4, RSVD)>,/* DCMI_D5 */
<STM32_PINMUX('B', 8, RSVD)>,/* DCMI_D6 */
<STM32_PINMUX('E', 6, RSVD)>,/* DCMI_D7 */
<STM32_PINMUX('I', 1, RSVD)>,/* DCMI_D8 */
<STM32_PINMUX('H', 7, RSVD)>,/* DCMI_D9 */
<STM32_PINMUX('I', 3, RSVD)>,/* DCMI_D10 */
<STM32_PINMUX('H', 15, RSVD)>;/* DCMI_D11 */
};
};
m4_dfsdm_clkout_pins_a: m4-dfsdm-clkout-pins-0 {
pins {
pinmux = <STM32_PINMUX('B', 13, RSVD)>; /* DFSDM_CKOUT */
};
};
m4_dfsdm_data1_pins_a: m4-dfsdm-data1-pins-0 {
pins {
pinmux = <STM32_PINMUX('C', 3, RSVD)>; /* DFSDM_DATA1 */
};
};
m4_dfsdm_data3_pins_a: m4-dfsdm-data3-pins-0 {
pins {
pinmux = <STM32_PINMUX('F', 13, RSVD)>; /* DFSDM_DATA3 */
};
};
m4_ethernet0_rgmii_pins_a: m4-rgmii-0 {
pins {
pinmux = <STM32_PINMUX('G', 5, RSVD)>, /* ETH_RGMII_CLK125 */
<STM32_PINMUX('G', 4, RSVD)>, /* ETH_RGMII_GTX_CLK */
<STM32_PINMUX('G', 13, RSVD)>, /* ETH_RGMII_TXD0 */
<STM32_PINMUX('G', 14, RSVD)>, /* ETH_RGMII_TXD1 */
<STM32_PINMUX('C', 2, RSVD)>, /* ETH_RGMII_TXD2 */
<STM32_PINMUX('E', 2, RSVD)>, /* ETH_RGMII_TXD3 */
<STM32_PINMUX('B', 11, RSVD)>, /* ETH_RGMII_TX_CTL */
<STM32_PINMUX('C', 1, RSVD)>, /* ETH_MDC */
<STM32_PINMUX('A', 2, RSVD)>, /* ETH_MDIO */
<STM32_PINMUX('C', 4, RSVD)>, /* ETH_RGMII_RXD0 */
<STM32_PINMUX('C', 5, RSVD)>, /* ETH_RGMII_RXD1 */
<STM32_PINMUX('B', 0, RSVD)>, /* ETH_RGMII_RXD2 */
<STM32_PINMUX('B', 1, RSVD)>, /* ETH_RGMII_RXD3 */
<STM32_PINMUX('A', 1, RSVD)>, /* ETH_RGMII_RX_CLK */
<STM32_PINMUX('A', 7, RSVD)>; /* ETH_RGMII_RX_CTL */
};
};
m4_fmc_pins_a: m4-fmc-0 {
pins {
pinmux = <STM32_PINMUX('D', 4, RSVD)>, /* FMC_NOE */
<STM32_PINMUX('D', 5, RSVD)>, /* FMC_NWE */
<STM32_PINMUX('D', 11, RSVD)>, /* FMC_A16_FMC_CLE */
<STM32_PINMUX('D', 12, RSVD)>, /* FMC_A17_FMC_ALE */
<STM32_PINMUX('D', 14, RSVD)>, /* FMC_D0 */
<STM32_PINMUX('D', 15, RSVD)>, /* FMC_D1 */
<STM32_PINMUX('D', 0, RSVD)>, /* FMC_D2 */
<STM32_PINMUX('D', 1, RSVD)>, /* FMC_D3 */
<STM32_PINMUX('E', 7, RSVD)>, /* FMC_D4 */
<STM32_PINMUX('E', 8, RSVD)>, /* FMC_D5 */
<STM32_PINMUX('E', 9, RSVD)>, /* FMC_D6 */
<STM32_PINMUX('E', 10, RSVD)>, /* FMC_D7 */
<STM32_PINMUX('G', 9, RSVD)>, /* FMC_NE2_FMC_NCE */
<STM32_PINMUX('D', 6, RSVD)>; /* FMC_NWAIT */
};
};
m4_hdp0_pins_a: m4-hdp0-0 {
pins {
pinmux = <STM32_PINMUX('I', 12, RSVD)>; /* HDP0 */
};
};
m4_hdp6_pins_a: m4-hdp6-0 {
pins {
pinmux = <STM32_PINMUX('K', 5, RSVD)>; /* HDP6 */
};
};
m4_hdp7_pins_a: m4-hdp7-0 {
pins {
pinmux = <STM32_PINMUX('K', 6, RSVD)>; /* HDP7 */
};
};
m4_i2c1_pins_a: m4-i2c1-0 {
pins {
pinmux = <STM32_PINMUX('D', 12, RSVD)>, /* I2C1_SCL */
<STM32_PINMUX('F', 15, RSVD)>; /* I2C1_SDA */
};
};
m4_i2c2_pins_a: m4-i2c2-0 {
pins {
pinmux = <STM32_PINMUX('H', 4, RSVD)>, /* I2C2_SCL */
<STM32_PINMUX('H', 5, RSVD)>; /* I2C2_SDA */
};
};
m4_i2c5_pins_a: m4-i2c5-0 {
pins {
pinmux = <STM32_PINMUX('A', 11, RSVD)>, /* I2C5_SCL */
<STM32_PINMUX('A', 12, RSVD)>; /* I2C5_SDA */
};
};
m4_i2s2_pins_a: m4-i2s2-0 {
pins {
pinmux = <STM32_PINMUX('I', 3, RSVD)>, /* I2S2_SDO */
<STM32_PINMUX('B', 9, RSVD)>, /* I2S2_WS */
<STM32_PINMUX('A', 9, RSVD)>; /* I2S2_CK */
};
};
m4_ltdc_pins_a: m4-ltdc-a-0 {
pins {
pinmux = <STM32_PINMUX('G', 7, RSVD)>, /* LCD_CLK */
<STM32_PINMUX('I', 10, RSVD)>, /* LCD_HSYNC */
<STM32_PINMUX('I', 9, RSVD)>, /* LCD_VSYNC */
<STM32_PINMUX('F', 10, RSVD)>, /* LCD_DE */
<STM32_PINMUX('H', 2, RSVD)>, /* LCD_R0 */
<STM32_PINMUX('H', 3, RSVD)>, /* LCD_R1 */
<STM32_PINMUX('H', 8, RSVD)>, /* LCD_R2 */
<STM32_PINMUX('H', 9, RSVD)>, /* LCD_R3 */
<STM32_PINMUX('H', 10, RSVD)>, /* LCD_R4 */
<STM32_PINMUX('C', 0, RSVD)>, /* LCD_R5 */
<STM32_PINMUX('H', 12, RSVD)>, /* LCD_R6 */
<STM32_PINMUX('E', 15, RSVD)>, /* LCD_R7 */
<STM32_PINMUX('E', 5, RSVD)>, /* LCD_G0 */
<STM32_PINMUX('E', 6, RSVD)>, /* LCD_G1 */
<STM32_PINMUX('H', 13, RSVD)>, /* LCD_G2 */
<STM32_PINMUX('H', 14, RSVD)>, /* LCD_G3 */
<STM32_PINMUX('H', 15, RSVD)>, /* LCD_G4 */
<STM32_PINMUX('I', 0, RSVD)>, /* LCD_G5 */
<STM32_PINMUX('I', 1, RSVD)>, /* LCD_G6 */
<STM32_PINMUX('I', 2, RSVD)>, /* LCD_G7 */
<STM32_PINMUX('D', 9, RSVD)>, /* LCD_B0 */
<STM32_PINMUX('G', 12, RSVD)>, /* LCD_B1 */
<STM32_PINMUX('G', 10, RSVD)>, /* LCD_B2 */
<STM32_PINMUX('D', 10, RSVD)>, /* LCD_B3 */
<STM32_PINMUX('I', 4, RSVD)>, /* LCD_B4 */
<STM32_PINMUX('A', 3, RSVD)>, /* LCD_B5 */
<STM32_PINMUX('B', 8, RSVD)>, /* LCD_B6 */
<STM32_PINMUX('D', 8, RSVD)>; /* LCD_B7 */
};
};
m4_ltdc_pins_b: m4-ltdc-b-0 {
pins {
pinmux = <STM32_PINMUX('I', 14, RSVD)>, /* LCD_CLK */
<STM32_PINMUX('I', 12, RSVD)>, /* LCD_HSYNC */
<STM32_PINMUX('I', 13, RSVD)>, /* LCD_VSYNC */
<STM32_PINMUX('K', 7, RSVD)>, /* LCD_DE */
<STM32_PINMUX('I', 15, RSVD)>, /* LCD_R0 */
<STM32_PINMUX('J', 0, RSVD)>, /* LCD_R1 */
<STM32_PINMUX('J', 1, RSVD)>, /* LCD_R2 */
<STM32_PINMUX('J', 2, RSVD)>, /* LCD_R3 */
<STM32_PINMUX('J', 3, RSVD)>, /* LCD_R4 */
<STM32_PINMUX('J', 4, RSVD)>, /* LCD_R5 */
<STM32_PINMUX('J', 5, RSVD)>, /* LCD_R6 */
<STM32_PINMUX('J', 6, RSVD)>, /* LCD_R7 */
<STM32_PINMUX('J', 7, RSVD)>, /* LCD_G0 */
<STM32_PINMUX('J', 8, RSVD)>, /* LCD_G1 */
<STM32_PINMUX('J', 9, RSVD)>, /* LCD_G2 */
<STM32_PINMUX('J', 10, RSVD)>, /* LCD_G3 */
<STM32_PINMUX('J', 11, RSVD)>, /* LCD_G4 */
<STM32_PINMUX('K', 0, RSVD)>, /* LCD_G5 */
<STM32_PINMUX('K', 1, RSVD)>, /* LCD_G6 */
<STM32_PINMUX('K', 2, RSVD)>, /* LCD_G7 */
<STM32_PINMUX('J', 12, RSVD)>, /* LCD_B0 */
<STM32_PINMUX('J', 13, RSVD)>, /* LCD_B1 */
<STM32_PINMUX('J', 14, RSVD)>, /* LCD_B2 */
<STM32_PINMUX('J', 15, RSVD)>, /* LCD_B3 */
<STM32_PINMUX('K', 3, RSVD)>, /* LCD_B4 */
<STM32_PINMUX('K', 4, RSVD)>, /* LCD_B5 */
<STM32_PINMUX('K', 5, RSVD)>, /* LCD_B6 */
<STM32_PINMUX('K', 6, RSVD)>; /* LCD_B7 */
};
};
m4_m_can1_pins_a: m4-m-can1-0 {
pins {
pinmux = <STM32_PINMUX('H', 13, RSVD)>, /* CAN1_TX */
<STM32_PINMUX('I', 9, RSVD)>; /* CAN1_RX */
};
};
m4_pwm1_pins_a: m4-pwm1-0 {
pins {
pinmux = <STM32_PINMUX('E', 9, RSVD)>, /* TIM1_CH1 */
<STM32_PINMUX('E', 11, RSVD)>, /* TIM1_CH2 */
<STM32_PINMUX('E', 14, RSVD)>; /* TIM1_CH4 */
};
};
m4_pwm2_pins_a: m4-pwm2-0 {
pins {
pinmux = <STM32_PINMUX('A', 3, RSVD)>; /* TIM2_CH4 */
};
};
m4_pwm3_pins_a: m4-pwm3-0 {
pins {
pinmux = <STM32_PINMUX('C', 7, RSVD)>; /* TIM3_CH2 */
};
};
m4_pwm4_pins_a: m4-pwm4-0 {
pins {
pinmux = <STM32_PINMUX('D', 14, RSVD)>, /* TIM4_CH3 */
<STM32_PINMUX('D', 15, RSVD)>; /* TIM4_CH4 */
};
};
m4_pwm4_pins_b: m4-pwm4-1 {
pins {
pinmux = <STM32_PINMUX('D', 13, RSVD)>; /* TIM4_CH2 */
};
};
m4_pwm5_pins_a: m4-pwm5-0 {
pins {
pinmux = <STM32_PINMUX('H', 11, RSVD)>; /* TIM5_CH2 */
};
};
m4_pwm8_pins_a: m4-pwm8-0 {
pins {
pinmux = <STM32_PINMUX('I', 2, RSVD)>; /* TIM8_CH4 */
};
};
m4_pwm12_pins_a: m4-pwm12-0 {
pins {
pinmux = <STM32_PINMUX('H', 6, RSVD)>; /* TIM12_CH1 */
};
};
m4_qspi_bk1_pins_a: m4-qspi-bk1-0 {
pins {
pinmux = <STM32_PINMUX('F', 8, RSVD)>, /* QSPI_BK1_IO0 */
<STM32_PINMUX('F', 9, RSVD)>, /* QSPI_BK1_IO1 */
<STM32_PINMUX('F', 7, RSVD)>, /* QSPI_BK1_IO2 */
<STM32_PINMUX('F', 6, RSVD)>, /* QSPI_BK1_IO3 */
<STM32_PINMUX('B', 6, RSVD)>; /* QSPI_BK1_NCS */
};
};
m4_qspi_bk2_pins_a: m4-qspi-bk2-0 {
pins {
pinmux = <STM32_PINMUX('H', 2, RSVD)>, /* QSPI_BK2_IO0 */
<STM32_PINMUX('H', 3, RSVD)>, /* QSPI_BK2_IO1 */
<STM32_PINMUX('G', 10, RSVD)>, /* QSPI_BK2_IO2 */
<STM32_PINMUX('G', 7, RSVD)>, /* QSPI_BK2_IO3 */
<STM32_PINMUX('C', 0, RSVD)>; /* QSPI_BK2_NCS */
};
};
m4_qspi_clk_pins_a: m4-qspi-clk-0 {
pins {
pinmux = <STM32_PINMUX('F', 10, RSVD)>; /* QSPI_CLK */
};
};
m4_rtc_out2_rmp_pins_a: m4-rtc-out2-rmp-pins-0 {
pins {
pinmux = <STM32_PINMUX('I', 8, RSVD)>; /* RTC_OUT2_RMP */
};
};
m4_sai2a_pins_a: m4-sai2a-0 {
pins {
pinmux = <STM32_PINMUX('I', 5, RSVD)>, /* SAI2_SCK_A */
<STM32_PINMUX('I', 6, RSVD)>, /* SAI2_SD_A */
<STM32_PINMUX('I', 7, RSVD)>, /* SAI2_FS_A */
<STM32_PINMUX('E', 0, RSVD)>; /* SAI2_MCLK_A */
};
};
m4_sai2b_pins_a: m4-sai2b-0 {
pins {
pinmux = <STM32_PINMUX('E', 12, RSVD)>, /* SAI2_SCK_B */
<STM32_PINMUX('E', 13, RSVD)>, /* SAI2_FS_B */
<STM32_PINMUX('E', 14, RSVD)>, /* SAI2_MCLK_B */
<STM32_PINMUX('F', 11, RSVD)>; /* SAI2_SD_B */
};
};
m4_sai2b_pins_b: m4-sai2b-2 {
pins {
pinmux = <STM32_PINMUX('F', 11, RSVD)>; /* SAI2_SD_B */
};
};
m4_sai4a_pins_a: m4-sai4a-0 {
pins {
pinmux = <STM32_PINMUX('B', 5, RSVD)>; /* SAI4_SD_A */
};
};
m4_sdmmc1_b4_pins_a: m4-sdmmc1-b4-0 {
pins {
pinmux = <STM32_PINMUX('C', 8, RSVD)>, /* SDMMC1_D0 */
<STM32_PINMUX('C', 9, RSVD)>, /* SDMMC1_D1 */
<STM32_PINMUX('C', 10, RSVD)>, /* SDMMC1_D2 */
<STM32_PINMUX('C', 11, RSVD)>, /* SDMMC1_D3 */
<STM32_PINMUX('D', 2, RSVD)>, /* SDMMC1_CMD */
<STM32_PINMUX('C', 12, RSVD)>; /* SDMMC1_CK */
};
};
m4_sdmmc1_dir_pins_a: m4-sdmmc1-dir-0 {
pins {
pinmux = <STM32_PINMUX('F', 2, RSVD)>, /* SDMMC1_D0DIR */
<STM32_PINMUX('C', 7, RSVD)>, /* SDMMC1_D123DIR */
<STM32_PINMUX('B', 9, RSVD)>, /* SDMMC1_CDIR */
<STM32_PINMUX('E', 4, RSVD)>; /* SDMMC1_CKIN */
};
};
m4_sdmmc2_b4_pins_a: m4-sdmmc2-b4-0 {
pins {
pinmux = <STM32_PINMUX('B', 14, RSVD)>, /* SDMMC2_D0 */
<STM32_PINMUX('B', 15, RSVD)>, /* SDMMC2_D1 */
<STM32_PINMUX('B', 3, RSVD)>, /* SDMMC2_D2 */
<STM32_PINMUX('B', 4, RSVD)>, /* SDMMC2_D3 */
<STM32_PINMUX('G', 6, RSVD)>, /* SDMMC2_CMD */
<STM32_PINMUX('E', 3, RSVD)>; /* SDMMC2_CK */
};
};
m4_sdmmc2_b4_pins_b: m4-sdmmc2-b4-1 {
pins {
pinmux = <STM32_PINMUX('B', 14, RSVD)>, /* SDMMC2_D0 */
<STM32_PINMUX('B', 15, RSVD)>, /* SDMMC2_D1 */
<STM32_PINMUX('B', 3, RSVD)>, /* SDMMC2_D2 */
<STM32_PINMUX('B', 4, RSVD)>, /* SDMMC2_D3 */
<STM32_PINMUX('G', 6, RSVD)>, /* SDMMC2_CMD */
<STM32_PINMUX('E', 3, RSVD)>; /* SDMMC2_CK */
};
};
m4_sdmmc2_d47_pins_a: m4-sdmmc2-d47-0 {
pins {
pinmux = <STM32_PINMUX('A', 8, RSVD)>, /* SDMMC2_D4 */
<STM32_PINMUX('A', 9, RSVD)>, /* SDMMC2_D5 */
<STM32_PINMUX('E', 5, RSVD)>, /* SDMMC2_D6 */
<STM32_PINMUX('D', 3, RSVD)>; /* SDMMC2_D7 */
};
};
m4_sdmmc3_b4_pins_a: m4-sdmmc3-b4-0 {
pins {
pinmux = <STM32_PINMUX('F', 0, RSVD)>, /* SDMMC3_D0 */
<STM32_PINMUX('F', 4, RSVD)>, /* SDMMC3_D1 */
<STM32_PINMUX('F', 5, RSVD)>, /* SDMMC3_D2 */
<STM32_PINMUX('D', 7, RSVD)>, /* SDMMC3_D3 */
<STM32_PINMUX('F', 1, RSVD)>, /* SDMMC3_CMD */
<STM32_PINMUX('G', 15, RSVD)>; /* SDMMC3_CK */
};
};
m4_spdifrx_pins_a: m4-spdifrx-0 {
pins {
pinmux = <STM32_PINMUX('G', 12, RSVD)>; /* SPDIF_IN1 */
};
};
m4_spi4_pins_a: m4-spi4-0 {
pins {
pinmux = <STM32_PINMUX('E', 12, RSVD)>, /* SPI4_SCK */
<STM32_PINMUX('E', 14, RSVD)>, /* SPI4_MOSI */
<STM32_PINMUX('E', 13, RSVD)>; /* SPI4_MISO */
};
};
m4_spi5_pins_a: m4-spi5-0 {
pins {
pinmux = <STM32_PINMUX('F', 7, RSVD)>, /* SPI5_SCK */
<STM32_PINMUX('F', 9, RSVD)>, /* SPI5_MOSI */
<STM32_PINMUX('F', 8, RSVD)>; /* SPI5_MISO */
};
};
m4_stusb1600_pins_a: m4-stusb1600-0 {
pins {
pinmux = <STM32_PINMUX('I', 11, RSVD)>;
};
};
m4_uart4_pins_a: m4-uart4-0 {
pins {
pinmux = <STM32_PINMUX('G', 11, RSVD)>, /* UART4_TX */
<STM32_PINMUX('B', 2, RSVD)>; /* UART4_RX */
};
};
m4_uart7_pins_a: m4-uart7-0 {
pins {
pinmux = <STM32_PINMUX('E', 8, RSVD)>, /* USART7_TX */
<STM32_PINMUX('E', 7, RSVD)>; /* USART7_RX */
};
};
m4_usart2_pins_a: m4-usart2-0 {
pins {
pinmux = <STM32_PINMUX('D', 5, RSVD)>, /* USART2_TX */
<STM32_PINMUX('D', 4, RSVD)>, /* USART2_RTS */
<STM32_PINMUX('D', 6, RSVD)>, /* USART2_RX */
<STM32_PINMUX('D', 3, RSVD)>; /* USART2_CTS_NSS */
};
};
m4_usart3_pins_a: m4-usart3-0 {
pins {
pinmux = <STM32_PINMUX('B', 10, RSVD)>, /* USART3_TX */
<STM32_PINMUX('G', 8, RSVD)>, /* USART3_RTS */
<STM32_PINMUX('B', 12, RSVD)>, /* USART3_RX */
<STM32_PINMUX('I', 10, RSVD)>; /* USART3_CTS_NSS */
};
};
m4_usart3_pins_b: m4-usart3-1 {
pins {
pinmux = <STM32_PINMUX('B', 10, RSVD)>, /* USART3_TX */
<STM32_PINMUX('G', 8, RSVD)>, /* USART3_RTS */
<STM32_PINMUX('B', 12, RSVD)>, /* USART3_RX */
<STM32_PINMUX('B', 13, RSVD)>; /* USART3_CTS_NSS */
};
};
m4_usbotg_hs_pins_a: m4-usbotg_hs-0 {
pins {
pinmux = <STM32_PINMUX('A', 10, RSVD)>; /* OTG_ID */
};
};
m4_usbotg_fs_dp_dm_pins_a: m4-usbotg-fs-dp-dm-0 {
pins {
pinmux = <STM32_PINMUX('A', 11, RSVD)>, /* OTG_FS_DM */
<STM32_PINMUX('A', 12, RSVD)>; /* OTG_FS_DP */
};
};
};
&pinctrl_z {
m4_i2c4_pins_a: m4-i2c4-0 {
pins {
pinmux = <STM32_PINMUX('Z', 4, AF6)>, /* I2C4_SCL */
<STM32_PINMUX('Z', 5, AF6)>; /* I2C4_SDA */
};
};
m4_spi1_pins_a: m4-spi1-0 {
pins {
pinmux = <STM32_PINMUX('Z', 0, AF5)>, /* SPI1_SCK */
<STM32_PINMUX('Z', 2, AF5)>, /* SPI1_MOSI */
<STM32_PINMUX('Z', 1, AF5)>; /* SPI1_MISO */
};
};
};
&m4_rproc {
m4_system_resources {
#address-cells = <1>;
#size-cells = <0>;
m4_timers2: timer@40000000 {
compatible = "rproc-srm-dev";
reg = <0x40000000>;
clocks = <&rcc TIM2_K>;
clock-names = "int";
status = "disabled";
};
m4_timers3: timer@40001000 {
compatible = "rproc-srm-dev";
reg = <0x40001000>;
clocks = <&rcc TIM3_K>;
clock-names = "int";
status = "disabled";
};
m4_timers4: timer@40002000 {
compatible = "rproc-srm-dev";
reg = <0x40002000>;
clocks = <&rcc TIM4_K>;
clock-names = "int";
status = "disabled";
};
m4_timers5: timer@40003000 {
compatible = "rproc-srm-dev";
reg = <0x40003000>;
clocks = <&rcc TIM5_K>;
clock-names = "int";
status = "disabled";
};
m4_timers6: timer@40004000 {
compatible = "rproc-srm-dev";
reg = <0x40004000>;
clocks = <&rcc TIM6_K>;
clock-names = "int";
status = "disabled";
};
m4_timers7: timer@40005000 {
compatible = "rproc-srm-dev";
reg = <0x40005000>;
clocks = <&rcc TIM7_K>;
clock-names = "int";
status = "disabled";
};
m4_timers12: timer@40006000 {
compatible = "rproc-srm-dev";
reg = <0x40006000>;
clocks = <&rcc TIM12_K>;
clock-names = "int";
status = "disabled";
};
m4_timers13: timer@40007000 {
compatible = "rproc-srm-dev";
reg = <0x40007000>;
clocks = <&rcc TIM13_K>;
clock-names = "int";
status = "disabled";
};
m4_timers14: timer@40008000 {
compatible = "rproc-srm-dev";
reg = <0x40008000>;
clocks = <&rcc TIM14_K>;
clock-names = "int";
status = "disabled";
};
m4_lptimer1: timer@40009000 {
compatible = "rproc-srm-dev";
reg = <0x40009000>;
clocks = <&rcc LPTIM1_K>;
clock-names = "mux";
status = "disabled";
};
m4_spi2: spi@4000b000 {
compatible = "rproc-srm-dev";
reg = <0x4000b000>;
clocks = <&rcc SPI2_K>;
status = "disabled";
};
m4_i2s2: audio-controller@4000b000 {
compatible = "rproc-srm-dev";
reg = <0x4000b000>;
status = "disabled";
};
m4_spi3: spi@4000c000 {
compatible = "rproc-srm-dev";
reg = <0x4000c000>;
clocks = <&rcc SPI3_K>;
status = "disabled";
};
m4_i2s3: audio-controller@4000c000 {
compatible = "rproc-srm-dev";
reg = <0x4000c000>;
status = "disabled";
};
m4_spdifrx: audio-controller@4000d000 {
compatible = "rproc-srm-dev";
reg = <0x4000d000>;
clocks = <&rcc SPDIF_K>;
clock-names = "kclk";
status = "disabled";
};
m4_usart2: serial@4000e000 {
compatible = "rproc-srm-dev";
reg = <0x4000e000>;
interrupt-parent = <&exti>;
interrupts = <27 1>;
clocks = <&rcc USART2_K>;
status = "disabled";
};
m4_usart3: serial@4000f000 {
compatible = "rproc-srm-dev";
reg = <0x4000f000>;
interrupt-parent = <&exti>;
interrupts = <28 1>;
clocks = <&rcc USART3_K>;
status = "disabled";
};
m4_uart4: serial@40010000 {
compatible = "rproc-srm-dev";
reg = <0x40010000>;
interrupt-parent = <&exti>;
interrupts = <30 1>;
clocks = <&rcc UART4_K>;
status = "disabled";
};
m4_uart5: serial@40011000 {
compatible = "rproc-srm-dev";
reg = <0x40011000>;
interrupt-parent = <&exti>;
interrupts = <31 1>;
clocks = <&rcc UART5_K>;
status = "disabled";
};
m4_i2c1: i2c@40012000 {
compatible = "rproc-srm-dev";
reg = <0x40012000>;
interrupt-parent = <&exti>;
interrupts = <21 1>;
clocks = <&rcc I2C1_K>;
status = "disabled";
};
m4_i2c2: i2c@40013000 {
compatible = "rproc-srm-dev";
reg = <0x40013000>;
interrupt-parent = <&exti>;
interrupts = <22 1>;
clocks = <&rcc I2C2_K>;
status = "disabled";
};
m4_i2c3: i2c@40014000 {
compatible = "rproc-srm-dev";
reg = <0x40014000>;
interrupt-parent = <&exti>;
interrupts = <23 1>;
clocks = <&rcc I2C3_K>;
status = "disabled";
};
m4_i2c5: i2c@40015000 {
compatible = "rproc-srm-dev";
reg = <0x40015000>;
interrupt-parent = <&exti>;
interrupts = <25 1>;
clocks = <&rcc I2C5_K>;
status = "disabled";
};
m4_cec: cec@40016000 {
compatible = "rproc-srm-dev";
reg = <0x40016000>;
interrupt-parent = <&exti>;
interrupts = <69 1>;
clocks = <&rcc CEC_K>, <&rcc CK_LSE>;
clock-names = "cec", "hdmi-cec";
status = "disabled";
};
m4_dac: dac@40017000 {
compatible = "rproc-srm-dev";
reg = <0x40017000>;
clocks = <&rcc DAC12>;
clock-names = "pclk";
status = "disabled";
};
m4_uart7: serial@40018000 {
compatible = "rproc-srm-dev";
reg = <0x40018000>;
interrupt-parent = <&exti>;
interrupts = <32 1>;
clocks = <&rcc UART7_K>;
status = "disabled";
};
m4_uart8: serial@40019000 {
compatible = "rproc-srm-dev";
reg = <0x40019000>;
interrupt-parent = <&exti>;
interrupts = <33 1>;
clocks = <&rcc UART8_K>;
status = "disabled";
};
m4_timers1: timer@44000000 {
compatible = "rproc-srm-dev";
reg = <0x44000000>;
clocks = <&rcc TIM1_K>;
clock-names = "int";
status = "disabled";
};
m4_timers8: timer@44001000 {
compatible = "rproc-srm-dev";
reg = <0x44001000>;
clocks = <&rcc TIM8_K>;
clock-names = "int";
status = "disabled";
};
m4_usart6: serial@44003000 {
compatible = "rproc-srm-dev";
reg = <0x44003000>;
interrupt-parent = <&exti>;
interrupts = <29 1>;
clocks = <&rcc USART6_K>;
status = "disabled";
};
m4_spi1: spi@44004000 {
compatible = "rproc-srm-dev";
reg = <0x44004000>;
clocks = <&rcc SPI1_K>;
status = "disabled";
};
m4_i2s1: audio-controller@44004000 {
compatible = "rproc-srm-dev";
reg = <0x44004000>;
status = "disabled";
};
m4_spi4: spi@44005000 {
compatible = "rproc-srm-dev";
reg = <0x44005000>;
clocks = <&rcc SPI4_K>;
status = "disabled";
};
m4_timers15: timer@44006000 {
compatible = "rproc-srm-dev";
reg = <0x44006000>;
clocks = <&rcc TIM15_K>;
clock-names = "int";
status = "disabled";
};
m4_timers16: timer@44007000 {
compatible = "rproc-srm-dev";
reg = <0x44007000>;
clocks = <&rcc TIM16_K>;
clock-names = "int";
status = "disabled";
};
m4_timers17: timer@44008000 {
compatible = "rproc-srm-dev";
reg = <0x44008000>;
clocks = <&rcc TIM17_K>;
clock-names = "int";
status = "disabled";
};
m4_spi5: spi@44009000 {
compatible = "rproc-srm-dev";
reg = <0x44009000>;
clocks = <&rcc SPI5_K>;
status = "disabled";
};
m4_sai1: sai@4400a000 {
compatible = "rproc-srm-dev";
reg = <0x4400a000>;
clocks = <&rcc SAI1_K>;
clock-names = "sai_ck";
status = "disabled";
};
m4_sai2: sai@4400b000 {
compatible = "rproc-srm-dev";
reg = <0x4400b000>;
clocks = <&rcc SAI2_K>;
clock-names = "sai_ck";
status = "disabled";
};
m4_sai3: sai@4400c000 {
compatible = "rproc-srm-dev";
reg = <0x4400c000>;
clocks = <&rcc SAI3_K>;
clock-names = "sai_ck";
status = "disabled";
};
m4_dfsdm: dfsdm@4400d000 {
compatible = "rproc-srm-dev";
reg = <0x4400d000>;
clocks = <&rcc DFSDM_K>;
clock-names = "dfsdm";
status = "disabled";
};
m4_m_can1: can@4400e000 {
compatible = "rproc-srm-dev";
reg = <0x4400e000>, <0x44011000>;
clocks = <&rcc FDCAN>, <&rcc FDCAN_K>;
clock-names = "hclk", "cclk";
status = "disabled";
};
m4_m_can2: can@4400f000 {
compatible = "rproc-srm-dev";
reg = <0x4400f000>, <0x44011000>;
clocks = <&rcc FDCAN>, <&rcc FDCAN_K>;
clock-names = "hclk", "cclk";
status = "disabled";
};
m4_dma1: dma@48000000 {
compatible = "rproc-srm-dev";
reg = <0x48000000>;
clocks = <&rcc DMA1>;
status = "disabled";
};
m4_dma2: dma@48001000 {
compatible = "rproc-srm-dev";
reg = <0x48001000>;
clocks = <&rcc DMA2>;
status = "disabled";
};
m4_dmamux1: dma-router@48002000 {
compatible = "rproc-srm-dev";
reg = <0x48002000>;
clocks = <&rcc DMAMUX>;
status = "disabled";
};
m4_adc: adc@48003000 {
compatible = "rproc-srm-dev";
reg = <0x48003000>;
clocks = <&rcc ADC12>, <&rcc ADC12_K>;
clock-names = "bus", "adc";
status = "disabled";
};
m4_sdmmc3: sdmmc@48004000 {
compatible = "rproc-srm-dev";
reg = <0x48004000>, <0x48005000>;
clocks = <&rcc SDMMC3_K>;
status = "disabled";
};
m4_usbotg_hs: usb-otg@49000000 {
compatible = "rproc-srm-dev";
reg = <0x49000000>;
clocks = <&rcc USBO_K>;
clock-names = "otg";
status = "disabled";
};
m4_hash2: hash@4c002000 {
compatible = "rproc-srm-dev";
reg = <0x4c002000>;
clocks = <&rcc HASH2>;
status = "disabled";
};
m4_rng2: rng@4c003000 {
compatible = "rproc-srm-dev";
reg = <0x4c003000>;
clocks = <&rcc RNG2_K>;
status = "disabled";
};
m4_crc2: crc@4c004000 {
compatible = "rproc-srm-dev";
reg = <0x4c004000>;
clocks = <&rcc CRC2>;
status = "disabled";
};
m4_cryp2: cryp@4c005000 {
compatible = "rproc-srm-dev";
reg = <0x4c005000>;
clocks = <&rcc CRYP2>;
status = "disabled";
};
m4_dcmi: dcmi@4c006000 {
compatible = "rproc-srm-dev";
reg = <0x4c006000>;
clocks = <&rcc DCMI>;
clock-names = "mclk";
status = "disabled";
};
m4_lptimer2: timer@50021000 {
compatible = "rproc-srm-dev";
reg = <0x50021000>;
clocks = <&rcc LPTIM2_K>;
clock-names = "mux";
status = "disabled";
};
m4_lptimer3: timer@50022000 {
compatible = "rproc-srm-dev";
reg = <0x50022000>;
clocks = <&rcc LPTIM3_K>;
clock-names = "mux";
status = "disabled";
};
m4_lptimer4: timer@50023000 {
compatible = "rproc-srm-dev";
reg = <0x50023000>;
clocks = <&rcc LPTIM4_K>;
clock-names = "mux";
status = "disabled";
};
m4_lptimer5: timer@50024000 {
compatible = "rproc-srm-dev";
reg = <0x50024000>;
clocks = <&rcc LPTIM5_K>;
clock-names = "mux";
status = "disabled";
};
m4_sai4: sai@50027000 {
compatible = "rproc-srm-dev";
reg = <0x50027000>;
clocks = <&rcc SAI4_K>;
clock-names = "sai_ck";
status = "disabled";
};
m4_qspi: qspi@58003000 {
compatible = "rproc-srm-dev";
reg = <0x58003000>, <0x70000000>;
clocks = <&rcc QSPI_K>;
status = "disabled";
};
m4_ethernet0: ethernet@5800a000 {
compatible = "rproc-srm-dev";
reg = <0x5800a000>;
clock-names = "stmmaceth",
"mac-clk-tx",
"mac-clk-rx",
"ethstp",
"syscfg-clk";
clocks = <&rcc ETHMAC>,
<&rcc ETHTX>,
<&rcc ETHRX>,
<&rcc ETHSTP>,
<&rcc SYSCFG>;
status = "disabled";
};
};
};

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,90 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2018 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com>
*/
#include "stm32mp157-pinctrl.dtsi"
/ {
soc {
pinctrl: pin-controller@50002000 {
st,package = <STM32MP157CAA>;
gpioa: gpio@50002000 {
status = "okay";
ngpios = <16>;
gpio-ranges = <&pinctrl 0 0 16>;
};
gpiob: gpio@50003000 {
status = "okay";
ngpios = <16>;
gpio-ranges = <&pinctrl 0 16 16>;
};
gpioc: gpio@50004000 {
status = "okay";
ngpios = <16>;
gpio-ranges = <&pinctrl 0 32 16>;
};
gpiod: gpio@50005000 {
status = "okay";
ngpios = <16>;
gpio-ranges = <&pinctrl 0 48 16>;
};
gpioe: gpio@50006000 {
status = "okay";
ngpios = <16>;
gpio-ranges = <&pinctrl 0 64 16>;
};
gpiof: gpio@50007000 {
status = "okay";
ngpios = <16>;
gpio-ranges = <&pinctrl 0 80 16>;
};
gpiog: gpio@50008000 {
status = "okay";
ngpios = <16>;
gpio-ranges = <&pinctrl 0 96 16>;
};
gpioh: gpio@50009000 {
status = "okay";
ngpios = <16>;
gpio-ranges = <&pinctrl 0 112 16>;
};
gpioi: gpio@5000a000 {
status = "okay";
ngpios = <16>;
gpio-ranges = <&pinctrl 0 128 16>;
};
gpioj: gpio@5000b000 {
status = "okay";
ngpios = <16>;
gpio-ranges = <&pinctrl 0 144 16>;
};
gpiok: gpio@5000c000 {
status = "okay";
ngpios = <8>;
gpio-ranges = <&pinctrl 0 160 8>;
};
};
pinctrl_z: pin-controller-z@54004000 {
st,package = <STM32MP157CAA>;
gpioz: gpio@54004000 {
status = "okay";
ngpios = <8>;
gpio-ranges = <&pinctrl_z 0 400 8>;
};
};
};
};

View File

@ -0,0 +1,62 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2018 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com>
*/
#include "stm32mp157-pinctrl.dtsi"
/ {
soc {
pinctrl: pin-controller@50002000 {
st,package = <STM32MP157CAB>;
gpioa: gpio@50002000 {
status = "okay";
ngpios = <16>;
gpio-ranges = <&pinctrl 0 0 16>;
};
gpiob: gpio@50003000 {
status = "okay";
ngpios = <16>;
gpio-ranges = <&pinctrl 0 16 16>;
};
gpioc: gpio@50004000 {
status = "okay";
ngpios = <16>;
gpio-ranges = <&pinctrl 0 32 16>;
};
gpiod: gpio@50005000 {
status = "okay";
ngpios = <16>;
gpio-ranges = <&pinctrl 0 48 16>;
};
gpioe: gpio@50006000 {
status = "okay";
ngpios = <16>;
gpio-ranges = <&pinctrl 0 64 16>;
};
gpiof: gpio@50007000 {
status = "okay";
ngpios = <6>;
gpio-ranges = <&pinctrl 6 86 6>;
};
gpiog: gpio@50008000 {
status = "okay";
ngpios = <10>;
gpio-ranges = <&pinctrl 6 102 10>;
};
gpioh: gpio@50009000 {
status = "okay";
ngpios = <2>;
gpio-ranges = <&pinctrl 0 112 2>;
};
};
};
};

View File

@ -0,0 +1,78 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2018 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com>
*/
#include "stm32mp157-pinctrl.dtsi"
/ {
soc {
pinctrl: pin-controller@50002000 {
st,package = <STM32MP157CAC>;
gpioa: gpio@50002000 {
status = "okay";
ngpios = <16>;
gpio-ranges = <&pinctrl 0 0 16>;
};
gpiob: gpio@50003000 {
status = "okay";
ngpios = <16>;
gpio-ranges = <&pinctrl 0 16 16>;
};
gpioc: gpio@50004000 {
status = "okay";
ngpios = <16>;
gpio-ranges = <&pinctrl 0 32 16>;
};
gpiod: gpio@50005000 {
status = "okay";
ngpios = <16>;
gpio-ranges = <&pinctrl 0 48 16>;
};
gpioe: gpio@50006000 {
status = "okay";
ngpios = <16>;
gpio-ranges = <&pinctrl 0 64 16>;
};
gpiof: gpio@50007000 {
status = "okay";
ngpios = <16>;
gpio-ranges = <&pinctrl 0 80 16>;
};
gpiog: gpio@50008000 {
status = "okay";
ngpios = <16>;
gpio-ranges = <&pinctrl 0 96 16>;
};
gpioh: gpio@50009000 {
status = "okay";
ngpios = <16>;
gpio-ranges = <&pinctrl 0 112 16>;
};
gpioi: gpio@5000a000 {
status = "okay";
ngpios = <12>;
gpio-ranges = <&pinctrl 0 128 12>;
};
};
pinctrl_z: pin-controller-z@54004000 {
st,package = <STM32MP157CAC>;
gpioz: gpio@54004000 {
status = "okay";
ngpios = <8>;
gpio-ranges = <&pinctrl_z 0 400 8>;
};
};
};
};

View File

@ -0,0 +1,62 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2018 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com>
*/
#include "stm32mp157-pinctrl.dtsi"
/ {
soc {
pinctrl: pin-controller@50002000 {
st,package = <STM32MP157CAD>;
gpioa: gpio@50002000 {
status = "okay";
ngpios = <16>;
gpio-ranges = <&pinctrl 0 0 16>;
};
gpiob: gpio@50003000 {
status = "okay";
ngpios = <16>;
gpio-ranges = <&pinctrl 0 16 16>;
};
gpioc: gpio@50004000 {
status = "okay";
ngpios = <16>;
gpio-ranges = <&pinctrl 0 32 16>;
};
gpiod: gpio@50005000 {
status = "okay";
ngpios = <16>;
gpio-ranges = <&pinctrl 0 48 16>;
};
gpioe: gpio@50006000 {
status = "okay";
ngpios = <16>;
gpio-ranges = <&pinctrl 0 64 16>;
};
gpiof: gpio@50007000 {
status = "okay";
ngpios = <6>;
gpio-ranges = <&pinctrl 6 86 6>;
};
gpiog: gpio@50008000 {
status = "okay";
ngpios = <10>;
gpio-ranges = <&pinctrl 6 102 10>;
};
gpioh: gpio@50009000 {
status = "okay";
ngpios = <2>;
gpio-ranges = <&pinctrl 0 112 2>;
};
};
};
};

View File

@ -7,6 +7,8 @@
#ifndef _GPIO_H_
#define _GPIO_H_
#define STM32_GPIOS_PER_BANK 16
enum stm32_gpio_port {
STM32_GPIO_PORT_A = 0,
STM32_GPIO_PORT_B,
@ -109,6 +111,9 @@ struct stm32_gpio_regs {
struct stm32_gpio_priv {
struct stm32_gpio_regs *regs;
unsigned int gpio_range;
};
int stm32_offset_to_index(struct udevice *dev, unsigned int offset);
#endif /* _GPIO_H_ */

View File

@ -16,8 +16,12 @@ config SPL
select SPL_REGMAP
select SPL_DM_RESET
select SPL_SERIAL_SUPPORT
select SPL_SPI_LOAD
select SPL_SYSCON
select SPL_DRIVERS_MISC_SUPPORT
select SPL_WATCHDOG_SUPPORT
imply BOOTSTAGE_STASH if SPL_BOOTSTAGE
imply SPL_BOOTSTAGE
imply SPL_DISPLAY_PRINT
imply SPL_LIBDISK_SUPPORT
config SYS_SOC
@ -25,18 +29,99 @@ config SYS_SOC
config TARGET_STM32MP1
bool "Support stm32mp1xx"
select ARCH_SUPPORT_PSCI
select ARCH_SUPPORT_PSCI if !STM32MP1_TRUSTED
select CPU_V7A
select CPU_V7_HAS_NONSEC
select CPU_V7_HAS_NONSEC if !STM32MP1_TRUSTED
select CPU_V7_HAS_VIRT
select OF_BOARD_SETUP
select PINCTRL_STM32
select STM32_RCC
select STM32_RESET
select SYS_ARCH_TIMER
select SYSRESET_SYSCON
select STM32_SERIAL
imply BOOTCOUNT_LIMIT
imply PRE_CONSOLE_BUFFER
imply SILENT_CONSOLE
imply SYSRESET_PSCI if STM32MP1_TRUSTED
imply SYSRESET_SYSCON if !STM32MP1_TRUSTED
help
target STMicroelectronics SOC STM32MP1 family
STM32MP157, STM32MP153 or STM32MP151
STMicroelectronics MPU with core ARMv7
dual core A7 for STM32MP157/3, monocore for STM32MP151
config STM32MP1_RESET_HALT_WORKAROUND
bool "workaround for reset halt debug on stm32mp15x"
depends on TARGET_STM32MP1
default y
help
Activate a workaround for current STM32MP15x revision B
limitation on debug reset halt not handle by ROM code:
add a delay loop early in the SPL boot process to wait for
the debugger to attach
it can be removed when using the Soc revision
that fixes the limitation.
config STM32MP1_TRUSTED
bool "Support trusted boot with TF-A"
default y if !SPL
select ARM_SMCCC
help
Say Y here to enable boot with TF-A
Trusted boot chain is :
BootRom => TF-A.stm32 (clock & DDR) => U-Boot.stm32
TF-A monitor provides proprietary smc to manage secure devices
config STM32MP1_OPTEE
bool "Support trusted boot with TF-A and OPTEE"
depends on STM32MP1_TRUSTED
default n
help
Say Y here to enable boot with TF-A and OPTEE
Trusted boot chain is :
BootRom => TF-A.stm32 (clock & DDR) => OPTEE => U-Boot.stm32
OPTEE monitor provide ST smc to manage secure devices
config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_MMC2
hex "Partition to use for MMC2 to load U-Boot from"
depends on SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION && TARGET_STM32MP1
default 1
help
Partition on the MMC2 to load U-Boot from when the MMC2 is being
used in raw mode
config STM32_ETZPC
bool "STM32 Extended TrustZone Protection"
depends on TARGET_STM32MP1
default y
help
Say y to enable STM32 Extended TrustZone Protection
Controller (ETZPC)
config CMD_STM32PROG
bool "command stm32prog for STM32CudeProgrammer"
default y
depends on CMD_DFU
imply CMD_GPT if MMC
imply DFU_MMC if MMC
imply DFU_NAND if NAND
select DFU_RAM
imply DFU_SF if DM_SPI_FLASH
select DFU_VIRT
select PARTITION_TYPE_GUID
help
activate a specific command stm32prog for STM32MP soc family
witch update the device with the tools STM32CubeProgrammer,
using UART with STM32 protocol or USB with DFU protocol
NB: access to not volatile memory (NOR/NAND/SD/eMMC) is based
on U-Boot DFU framework
config CMD_STM32KEY
bool "command stm32key to fuse public key hash"
default y
depends on CMD_FUSE
help
fuse public key hash in corresponding fuse used to authenticate
binary.
config SYS_TEXT_BASE
prompt "U-Boot base address"
@ -46,17 +131,27 @@ config SYS_TEXT_BASE
when DDR driver is used:
DDR + 1MB (0xC0100000)
config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_MMC2
hex "Partition on MMC2 to use to load U-Boot from"
depends on SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
config PRE_CON_BUF_ADDR
default 0xC02FF000
config PRE_CON_BUF_SZ
default 4096
config NR_DRAM_BANKS
default 1
help
Partition on the second MMC to load U-Boot from when the MMC is being
used in raw mode
source "board/st/stm32mp1/Kconfig"
config BOOTSTAGE_STASH_ADDR
default 0xC3000000
if BOOTCOUNT_LIMIT
config SYS_BOOTCOUNT_SINGLEWORD
default y
# TAMP_BOOTCOUNT = TAMP_BACKUP_REGISTER(21)
config SYS_BOOTCOUNT_ADDR
default 0x5C00A154
endif
# currently activated for debug / should be deactivated for real product
if DEBUG_UART
config DEBUG_UART_BOARD_INIT
@ -71,4 +166,6 @@ config DEBUG_UART_CLOCK
default 64000000
endif
source "board/st/stm32mp1/Kconfig"
endif

View File

@ -6,11 +6,17 @@
obj-y += cpu.o
obj-y += dram_init.o
obj-y += syscon.o
obj-y += bsec.o
ifdef CONFIG_SPL_BUILD
obj-y += spl.o
obj-$(CONFIG_STM32MP1_RESET_HALT_WORKAROUND) += stm32mp1_helper_dbg.o
else
obj-y += bsec.o
endif
obj-$(CONFIG_CMD_STM32PROG) += cmd_stm32prog/
obj-$(CONFIG_CMD_STM32KEY) += cmd_stm32key.o
obj-$(CONFIG_SYSRESET) += cmd_poweroff.o
obj-$(CONFIG_ARMV7_PSCI) += psci.o
endif
obj-$(CONFIG_$(SPL_)DM_REGULATOR) += pwr_regulator.o
obj-$(CONFIG_OF_SYSTEM_SETUP) += fdt.o

View File

@ -7,10 +7,14 @@
#include <dm.h>
#include <misc.h>
#include <asm/io.h>
#include <asm/arch/stm32mp1_smc.h>
#include <linux/arm-smccc.h>
#include <linux/iopoll.h>
#define BSEC_OTP_MAX_VALUE 95
#ifndef CONFIG_STM32MP1_TRUSTED
#define BSEC_TIMEOUT_US 10000
/* BSEC REGISTER OFFSET (base relative) */
@ -168,7 +172,7 @@ static int bsec_shadow_register(u32 base, u32 otp)
ret = bsec_power_safmem(base, true);
if (ret)
return ret;
power_up = 1;
power_up = true;
}
/* set BSEC_OTP_CTRL_OFF with the otp value*/
writel(otp | BSEC_READ, base + BSEC_OTP_CTRL_OFF);
@ -270,6 +274,7 @@ static int bsec_program_otp(long base, u32 val, u32 otp)
return ret;
}
#endif /* CONFIG_STM32MP1_TRUSTED */
/* BSEC MISC driver *******************************************************/
struct stm32mp_bsec_platdata {
@ -278,6 +283,11 @@ struct stm32mp_bsec_platdata {
static int stm32mp_bsec_read_otp(struct udevice *dev, u32 *val, u32 otp)
{
#ifdef CONFIG_STM32MP1_TRUSTED
return stm32_smc(STM32_SMC_BSEC,
STM32_SMC_READ_OTP,
otp, 0, val);
#else
struct stm32mp_bsec_platdata *plat = dev_get_platdata(dev);
u32 tmp_data = 0;
int ret;
@ -299,27 +309,46 @@ static int stm32mp_bsec_read_otp(struct udevice *dev, u32 *val, u32 otp)
/* restore shadow value */
ret = bsec_write_shadow(plat->base, tmp_data, otp);
return ret;
#endif
}
static int stm32mp_bsec_read_shadow(struct udevice *dev, u32 *val, u32 otp)
{
#ifdef CONFIG_STM32MP1_TRUSTED
return stm32_smc(STM32_SMC_BSEC,
STM32_SMC_READ_SHADOW,
otp, 0, val);
#else
struct stm32mp_bsec_platdata *plat = dev_get_platdata(dev);
return bsec_read_shadow(plat->base, val, otp);
#endif
}
static int stm32mp_bsec_write_otp(struct udevice *dev, u32 val, u32 otp)
{
#ifdef CONFIG_STM32MP1_TRUSTED
return stm32_smc_exec(STM32_SMC_BSEC,
STM32_SMC_PROG_OTP,
otp, val);
#else
struct stm32mp_bsec_platdata *plat = dev_get_platdata(dev);
return bsec_program_otp(plat->base, val, otp);
#endif
}
static int stm32mp_bsec_write_shadow(struct udevice *dev, u32 val, u32 otp)
{
#ifdef CONFIG_STM32MP1_TRUSTED
return stm32_smc_exec(STM32_SMC_BSEC,
STM32_SMC_WRITE_SHADOW,
otp, val);
#else
struct stm32mp_bsec_platdata *plat = dev_get_platdata(dev);
return bsec_write_shadow(plat->base, val, otp);
#endif
}
static int stm32mp_bsec_read(struct udevice *dev, int offset,
@ -330,12 +359,13 @@ static int stm32mp_bsec_read(struct udevice *dev, int offset,
bool shadow = true;
int nb_otp = size / sizeof(u32);
int otp;
unsigned int offs = offset;
if (offset >= STM32_BSEC_OTP_OFFSET) {
offset -= STM32_BSEC_OTP_OFFSET;
if (offs >= STM32_BSEC_OTP_OFFSET) {
offs -= STM32_BSEC_OTP_OFFSET;
shadow = false;
}
otp = offset / sizeof(u32);
otp = offs / sizeof(u32);
if (otp < 0 || (otp + nb_otp - 1) > BSEC_OTP_MAX_VALUE) {
dev_err(dev, "wrong value for otp, max value : %i\n",
@ -365,12 +395,13 @@ static int stm32mp_bsec_write(struct udevice *dev, int offset,
bool shadow = true;
int nb_otp = size / sizeof(u32);
int otp;
unsigned int offs = offset;
if (offset >= STM32_BSEC_OTP_OFFSET) {
offset -= STM32_BSEC_OTP_OFFSET;
if (offs >= STM32_BSEC_OTP_OFFSET) {
offs -= STM32_BSEC_OTP_OFFSET;
shadow = false;
}
otp = offset / sizeof(u32);
otp = offs / sizeof(u32);
if (otp < 0 || (otp + nb_otp - 1) > BSEC_OTP_MAX_VALUE) {
dev_err(dev, "wrong value for otp, max value : %d\n",
@ -405,8 +436,23 @@ static int stm32mp_bsec_ofdata_to_platdata(struct udevice *dev)
return 0;
}
#if !defined(CONFIG_STM32MP1_TRUSTED) && !defined(CONFIG_SPL_BUILD)
static int stm32mp_bsec_probe(struct udevice *dev)
{
int otp;
struct stm32mp_bsec_platdata *plat = dev_get_platdata(dev);
/* update unlocked shadow for OTP cleared by the rom code */
for (otp = 57; otp <= BSEC_OTP_MAX_VALUE; otp++)
if (!bsec_read_SR_lock(plat->base, otp))
bsec_shadow_register(plat->base, otp);
return 0;
}
#endif
static const struct udevice_id stm32mp_bsec_ids[] = {
{ .compatible = "st,stm32mp-bsec" },
{ .compatible = "st,stm32mp15-bsec" },
{}
};
@ -417,15 +463,7 @@ U_BOOT_DRIVER(stm32mp_bsec) = {
.ofdata_to_platdata = stm32mp_bsec_ofdata_to_platdata,
.platdata_auto_alloc_size = sizeof(struct stm32mp_bsec_platdata),
.ops = &stm32mp_bsec_ops,
.flags = DM_FLAG_PRE_RELOC,
};
/* bsec IP is not present in device tee, manage IP address by platdata */
static struct stm32mp_bsec_platdata stm32_bsec_platdata = {
.base = STM32_BSEC_BASE,
};
U_BOOT_DEVICE(stm32mp_bsec) = {
.name = "stm32mp_bsec",
.platdata = &stm32_bsec_platdata,
#if !defined(CONFIG_STM32MP1_TRUSTED) && !defined(CONFIG_SPL_BUILD)
.probe = stm32mp_bsec_probe,
#endif
};

View File

@ -0,0 +1,24 @@
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/*
* Copyright (C) 2019, STMicroelectronics - All Rights Reserved
*/
#include <common.h>
#include <command.h>
#include <sysreset.h>
int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
int ret;
puts("poweroff ...\n");
mdelay(100);
ret = sysreset_walk(SYSRESET_POWER);
if (ret == -EINPROGRESS)
mdelay(1000);
/*NOTREACHED when power off*/
return CMD_RET_FAILURE;
}

View File

@ -0,0 +1,101 @@
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/*
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
*/
#include <common.h>
#include <command.h>
#include <console.h>
#include <misc.h>
#include <dm/device.h>
#include <dm/uclass.h>
#define STM32_OTP_HASH_KEY_START 24
#define STM32_OTP_HASH_KEY_SIZE 8
static void read_hash_value(u32 addr)
{
int i;
for (i = 0; i < STM32_OTP_HASH_KEY_SIZE; i++) {
printf("OTP value %i: %x\n", STM32_OTP_HASH_KEY_START + i,
__be32_to_cpu(*(u32 *)addr));
addr += 4;
}
}
static void fuse_hash_value(u32 addr, bool print)
{
struct udevice *dev;
u32 word, val;
int i, ret;
ret = uclass_get_device_by_driver(UCLASS_MISC,
DM_GET_DRIVER(stm32mp_bsec),
&dev);
if (ret) {
pr_err("Can't find stm32mp_bsec driver\n");
return;
}
for (i = 0; i < STM32_OTP_HASH_KEY_SIZE; i++) {
if (print)
printf("Fuse OTP %i : %x\n",
STM32_OTP_HASH_KEY_START + i,
__be32_to_cpu(*(u32 *)addr));
word = STM32_OTP_HASH_KEY_START + i;
val = __be32_to_cpu(*(u32 *)addr);
misc_write(dev, STM32_BSEC_OTP(word), &val, 4);
addr += 4;
}
}
static int confirm_prog(void)
{
puts("Warning: Programming fuses is an irreversible operation!\n"
" This may brick your system.\n"
" Use this command only if you are sure of what you are doing!\n"
"\nReally perform this fuse programming? <y/N>\n");
if (confirm_yesno())
return 1;
puts("Fuse programming aborted\n");
return 0;
}
static int do_stm32key(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
{
u32 addr;
const char *op = argc >= 2 ? argv[1] : NULL;
int confirmed = argc > 3 && !strcmp(argv[2], "-y");
argc -= 2 + confirmed;
argv += 2 + confirmed;
if (argc < 1)
return CMD_RET_USAGE;
addr = simple_strtoul(argv[0], NULL, 16);
if (!addr)
return CMD_RET_USAGE;
if (!strcmp(op, "read"))
read_hash_value(addr);
if (!strcmp(op, "fuse")) {
if (!confirmed && !confirm_prog())
return CMD_RET_FAILURE;
fuse_hash_value(addr, !confirmed);
}
return CMD_RET_SUCCESS;
}
U_BOOT_CMD(stm32key, 4, 1, do_stm32key,
"Fuse ST Hash key",
"read <addr>: Read the hash store at addr in memory\n"
"stm32key fuse [-y] <addr> : Fuse hash store at addr in otp\n");

View File

@ -0,0 +1,9 @@
# SPDX-License-Identifier: GPL-2.0+
#
# Copyright (C) 2018, STMicroelectronics - All Rights Reserved
#
obj-y += cmd_stm32prog.o
obj-y += stm32prog.o
obj-y += stm32prog_serial.o
obj-y += stm32prog_usb.o

View File

@ -0,0 +1,102 @@
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/*
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
*/
#include <common.h>
#include <command.h>
#include <dfu.h>
#include "stm32prog.h"
DECLARE_GLOBAL_DATA_PTR;
static void enable_vidconsole(void)
{
#ifdef CONFIG_DM_VIDEO
char *stdname;
char buf[64];
stdname = env_get("stdout");
if (!strstr(stdname, "vidconsole")) {
snprintf(buf, sizeof(buf), "%s,vidconsole", stdname);
env_set("stdout", buf);
}
stdname = env_get("stderr");
if (!strstr(stdname, "vidconsole")) {
snprintf(buf, sizeof(buf), "%s,vidconsole", stdname);
env_set("stderr", buf);
}
#endif
}
static int do_stm32prog(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
{
struct stm32prog_data *data;
ulong addr, size;
int dev;
enum stm32prog_link_t link = LINK_UNDEFINED;
bool reset = false;
if (argc < 3 || argc > 5)
return CMD_RET_USAGE;
if (!strcmp(argv[1], "serial")) {
link = LINK_SERIAL;
} else {
if (!strcmp(argv[1], "usb")) {
link = LINK_USB;
} else {
pr_err("not supported link=%s\n", argv[1]);
return CMD_RET_USAGE;
}
}
dev = (int)simple_strtoul(argv[2], NULL, 10);
addr = STM32_DDR_BASE;
size = 0;
if (argc > 3) {
addr = simple_strtoul(argv[3], NULL, 16);
if (!addr)
return CMD_RET_FAILURE;
}
if (argc > 4)
size = simple_strtoul(argv[4], NULL, 16);
enable_vidconsole();
data = stm32prog_init(link, dev, addr, size);
if (!data)
return CMD_RET_FAILURE;
switch (link) {
case LINK_SERIAL:
reset = stm32prog_serial_loop(data);
break;
case LINK_USB:
reset = stm32prog_usb_loop(data, dev);
break;
default:
break;
}
stm32prog_clean(data);
puts("Download done\n");
if (reset) {
puts("Reset...\n");
run_command("reset", 0);
}
return CMD_RET_SUCCESS;
}
U_BOOT_CMD(stm32prog, 5, 0, do_stm32prog,
"<link> <dev> [<addr>] [<size>]\n"
"start communication with tools STM32Cubeprogrammer on <link> with Flashlayout at <addr>",
"<link> = serial|usb\n"
"<dev> = device instance\n"
"<addr> = address of flashlayout\n"
"<size> = size of flashlayout\n"
);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,202 @@
/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */
/*
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
*/
#ifndef _STM32PROG_H_
#define _STM32PROG_H_
/* - configuration part -----------------------------*/
#define USART_BL_VERSION 0x40 /* USART bootloader version V4.0*/
#define UBOOT_BL_VERSION 0x03 /* bootloader version V0.3*/
#define DEVICE_ID_BYTE1 0x05 /* MSB byte of device ID*/
#define DEVICE_ID_BYTE2 0x00 /* LSB byte of device ID*/
#define USART_RAM_BUFFER_SIZE 256 /* Size of USART_RAM_Buf buffer*/
/* - Commands -----------------------------*/
#define GET_CMD_COMMAND 0x00 /* Get CMD command*/
#define GET_VER_COMMAND 0x01 /* Get Version command*/
#define GET_ID_COMMAND 0x02 /* Get ID command*/
#define GET_PHASE_COMMAND 0x03 /* Get Phase command*/
#define RM_COMMAND 0x11 /* Read Memory command*/
#define READ_PART_COMMAND 0x12 /* Read Partition command*/
#define START_COMMAND 0x21 /* START command (Go)*/
#define DOWNLOAD_COMMAND 0x31 /* Download command*/
/* existing command for other STM32 but not used */
/* ERASE 0x43 */
/* EXTENDED_ERASE 0x44 */
/* WRITE_UNPROTECTED 0x73 */
/* READOUT_PROTECT 0x82 */
/* READOUT_UNPROTECT 0x92 */
/* - miscellaneous defines ----------------------------------------*/
#define INIT_BYTE 0x7F /*Init Byte ID*/
#define ACK_BYTE 0x79 /*Acknowlede Byte ID*/
#define NACK_BYTE 0x1F /*No Acknowlede Byte ID*/
#define ABORT_BYTE 0x5F /*ABORT*/
/* - phase defines ------------------------------------------------*/
#define PHASE_FLASHLAYOUT 0x00
#define PHASE_FIRST_USER 0x10
#define PHASE_LAST_USER 0xF0
#define PHASE_CMD 0xF1
#define PHASE_OTP 0xF2
#define PHASE_SSP 0xF3
#define PHASE_PMIC 0xF4
#define PHASE_END 0xFE
#define PHASE_RESET 0xFF
#define PHASE_DO_RESET 0x1FF
#define DEFAULT_ADDRESS 0xFFFFFFFF
#define OTP_SIZE 1024
#define PMIC_SIZE 8
enum stm32prog_link_t {
LINK_SERIAL,
LINK_USB,
LINK_UNDEFINED,
};
struct image_header_s {
bool present;
u32 image_checksum;
u32 image_length;
};
struct raw_header_s {
u32 magic_number;
u32 image_signature[64 / 4];
u32 image_checksum;
u32 header_version;
u32 image_length;
u32 image_entry_point;
u32 reserved1;
u32 load_address;
u32 reserved2;
u32 version_number;
u32 option_flags;
u32 ecdsa_algorithm;
u32 ecdsa_public_key[64 / 4];
u32 padding[83 / 4];
u32 binary_type;
};
#define BL_HEADER_SIZE sizeof(struct raw_header_s)
/* partition type in flashlayout file */
enum stm32prog_part_type {
PART_BINARY,
PART_SYSTEM,
PART_FILESYSTEM,
RAW_IMAGE
};
/* device information */
struct stm32prog_dev_t {
enum dfu_device_type dev_type;
char dev_id;
struct blk_desc *block_dev;
u32 lba_blk_size; /* for MMC RAW */
u32 erase_size;
struct mtd_info *mtd;
/* list of partition for this device / ordered in offset */
struct list_head part_list;
};
/* partition information build form FlashLayout and device */
struct stm32prog_part_t {
/* FlashLayout inforamtion */
int option;
int id;
enum stm32prog_part_type part_type;
enum dfu_device_type dev_type;
char dev_id;
/* partition name
* (16 char in gpt, + 1 for null terminated string
*/
char name[16 + 1];
u64 addr;
u64 size;
enum stm32prog_part_type bin_nb; /* SSBL repeatition */
/* information on associated device */
struct stm32prog_dev_t *dev; /* pointer to device */
/* partition id in gpt when >0, -1 and -2 for boot partition of MMC */
s16 part_id;
int alt_id; /* alt id in usb/dfu */
struct list_head list;
};
#define STM32PROG_MAX_DEV 5
struct stm32prog_data {
/* Layout information */
int dev_nb; /* device number*/
struct stm32prog_dev_t dev[STM32PROG_MAX_DEV]; /* array of device */
int part_nb; /* nb of partition */
struct stm32prog_part_t *part_array; /* array of partition */
int full_update;
/* command internal information */
unsigned int phase;
u32 offset;
char error[255];
struct stm32prog_part_t *cur_part;
u32 *otp_part;
u8 pmic_part[PMIC_SIZE];
/* STM32 header information */
struct raw_header_s *header_data;
struct image_header_s header;
/* SERIAL information */
u32 cursor;
u32 packet_number;
u32 checksum;
u8 *buffer; /* size = USART_RAM_BUFFER_SIZE*/
int dfu_seq;
u8 read_phase;
};
/* OTP access */
int stm32prog_otp_write(struct stm32prog_data *data, u32 offset,
u8 *buffer, long *size);
int stm32prog_otp_read(struct stm32prog_data *data, u32 offset,
u8 *buffer, long *size);
int stm32prog_otp_start(struct stm32prog_data *data);
/* PMIC access */
int stm32prog_pmic_write(struct stm32prog_data *data, u32 offset,
u8 *buffer, long *size);
int stm32prog_pmic_read(struct stm32prog_data *data, u32 offset,
u8 *buffer, long *size);
int stm32prog_pmic_start(struct stm32prog_data *data);
/* generic part*/
u8 stm32prog_header_check(struct raw_header_s *raw_header,
struct image_header_s *header);
int stm32prog_dfu_init(struct stm32prog_data *data);
void stm32prog_end_phase(struct stm32prog_data *data);
void stm32prog_next_phase(struct stm32prog_data *data);
void stm32prog_do_reset(struct stm32prog_data *data);
int stm32prog_serial_init(struct stm32prog_data *data, int link_dev);
char *stm32prog_get_error(struct stm32prog_data *data);
#define stm32prog_err(args...) {\
if (data->phase != PHASE_RESET) { \
sprintf(data->error, args); \
data->phase = PHASE_RESET; \
pr_err("Error: %s\n", data->error); } \
}
/* Main function */
struct stm32prog_data *stm32prog_init(enum stm32prog_link_t link,
int dev, ulong addr, ulong size);
bool stm32prog_serial_loop(struct stm32prog_data *data);
bool stm32prog_usb_loop(struct stm32prog_data *data, int dev);
void stm32prog_clean(struct stm32prog_data *data);
#endif

View File

@ -0,0 +1,984 @@
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/*
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
*/
#include <common.h>
#include <console.h>
#include <dfu.h>
#include <malloc.h>
#include <serial.h>
#include <watchdog.h>
#include <dm/lists.h>
#include <dm/device-internal.h>
#include "stm32prog.h"
struct udevice *down_serial_dev;
const u8 cmd_id[] = {
GET_CMD_COMMAND,
GET_VER_COMMAND,
GET_ID_COMMAND,
GET_PHASE_COMMAND,
RM_COMMAND,
READ_PART_COMMAND,
START_COMMAND,
DOWNLOAD_COMMAND
};
#define NB_CMD sizeof(cmd_id)
/* DFU support for serial *********************************************/
static struct dfu_entity *stm32prog_get_entity(struct stm32prog_data *data)
{
int alt_id;
if (!data->cur_part)
if (data->phase == PHASE_FLASHLAYOUT)
alt_id = 0;
else
return NULL;
else
alt_id = data->cur_part->alt_id;
return dfu_get_entity(alt_id);
}
static int stm32prog_write(struct stm32prog_data *data, u8 *buffer,
u32 buffer_size)
{
struct dfu_entity *dfu_entity;
u8 ret = 0;
dfu_entity = stm32prog_get_entity(data);
if (!dfu_entity)
return -ENODEV;
ret = dfu_write(dfu_entity,
buffer,
buffer_size,
data->dfu_seq);
if (ret) {
stm32prog_err("DFU write failed [%d] cnt: %d",
ret, data->dfu_seq);
}
data->dfu_seq++;
/* handle rollover as in driver/dfu/dfu.c */
data->dfu_seq &= 0xffff;
if (buffer_size == 0)
data->dfu_seq = 0; /* flush done */
return ret;
}
static int stm32prog_read(struct stm32prog_data *data, u8 phase, u32 offset,
u8 *buffer, u32 buffer_size)
{
struct dfu_entity *dfu_entity;
u32 size;
int ret;
/* pr_debug("%s entry\n", __func__); */
if (data->dfu_seq) {
stm32prog_err("DFU write pending for phase %d, seq %d",
data->phase, data->dfu_seq);
return -EINVAL;
}
if (phase == PHASE_FLASHLAYOUT || phase > PHASE_LAST_USER) {
stm32prog_err("read failed : phase %d is invalid", phase);
return -EINVAL;
}
if (data->read_phase <= PHASE_LAST_USER &&
phase != data->read_phase) {
/* clear previous read session */
dfu_entity = dfu_get_entity(data->read_phase - 1);
if (dfu_entity)
dfu_transaction_cleanup(dfu_entity);
}
dfu_entity = dfu_get_entity(phase - 1);
if (!dfu_entity) {
stm32prog_err("read failed : phase %d is unknown", phase);
return -ENODEV;
}
/* clear pending read before to force offset */
if (dfu_entity->inited &&
(data->read_phase != phase || data->offset != offset))
dfu_transaction_cleanup(dfu_entity);
/* initiate before to force offset */
if (!dfu_entity->inited) {
ret = dfu_transaction_initiate(dfu_entity, true);
if (ret < 0) {
stm32prog_err("DFU read init failed [%d] phase = %d offset = 0x%08x",
ret, phase, offset);
return ret;
}
}
/* force new offset */
if (dfu_entity->offset != offset)
dfu_entity->offset = offset;
data->offset = offset;
data->read_phase = phase;
pr_debug("\nSTM32 download read %s offset=0x%x\n",
dfu_entity->name, offset);
ret = dfu_read(dfu_entity, buffer, buffer_size,
dfu_entity->i_blk_seq_num);
if (ret < 0) {
stm32prog_err("DFU read failed [%d] phase = %d offset = 0x%08x",
ret, phase, offset);
return ret;
}
size = ret;
if (size < buffer_size) {
data->offset = 0;
data->read_phase = PHASE_END;
memset(buffer + size, 0, buffer_size - size);
} else {
data->offset += size;
}
/*pr_debug("%s exit ret=%d\n", __func__, ret);*/
return ret;
}
/* UART access ***************************************************/
int stm32prog_serial_init(struct stm32prog_data *data, int link_dev)
{
struct udevice *dev = NULL;
int node;
char alias[10];
const char *path;
struct dm_serial_ops *ops;
/* no parity, 8 bits, 1 stop */
u32 serial_config = SERIAL_DEFAULT_CONFIG;
down_serial_dev = NULL;
sprintf(alias, "serial%d", link_dev);
path = fdt_get_alias(gd->fdt_blob, alias);
if (!path) {
pr_err("%s alias not found", alias);
return -ENODEV;
}
node = fdt_path_offset(gd->fdt_blob, path);
if (!uclass_get_device_by_of_offset(UCLASS_SERIAL, node,
&dev)) {
down_serial_dev = dev;
} else if (node > 0 &&
!lists_bind_fdt(gd->dm_root, offset_to_ofnode(node),
&dev)) {
if (!device_probe(dev))
down_serial_dev = dev;
}
/*pr_debug("alias=%s, path=%s, node = %d, dev=%0x\n",
* alias, path, node, (u32)down_serial_dev);
*/
if (!down_serial_dev) {
pr_err("%s = %s device not found", alias, path);
return -ENODEV;
}
/* force silent console on uart only when used */
if (gd->cur_serial_dev == down_serial_dev)
gd->flags |= GD_FLG_DISABLE_CONSOLE | GD_FLG_SILENT;
else
gd->flags &= ~(GD_FLG_DISABLE_CONSOLE | GD_FLG_SILENT);
ops = serial_get_ops(down_serial_dev);
if (!ops) {
pr_err("%s = %s missing ops", alias, path);
return -ENODEV;
}
if (!ops->setconfig) {
pr_err("%s = %s missing setconfig", alias, path);
return -ENODEV;
}
clrsetbits_le32(&serial_config, SERIAL_PAR_MASK, SERIAL_PAR_EVEN);
return ops->setconfig(down_serial_dev, serial_config);
}
static void stm32prog_serial_flush(void)
{
struct dm_serial_ops *ops = serial_get_ops(down_serial_dev);
int err;
do {
err = ops->getc(down_serial_dev);
} while (err != -EAGAIN);
}
static int stm32prog_serial_getc_err(void)
{
struct dm_serial_ops *ops = serial_get_ops(down_serial_dev);
int err;
do {
err = ops->getc(down_serial_dev);
if (err == -EAGAIN) {
ctrlc();
WATCHDOG_RESET();
}
} while ((err == -EAGAIN) && (!had_ctrlc()));
return err;
}
static u8 stm32prog_serial_getc(void)
{
int err;
err = stm32prog_serial_getc_err();
return err >= 0 ? err : 0;
}
static bool stm32prog_serial_get_buffer(u8 *buffer, u32 *count)
{
struct dm_serial_ops *ops = serial_get_ops(down_serial_dev);
int err;
do {
err = ops->getc(down_serial_dev);
if (err >= 0) {
*buffer++ = err;
*count -= 1;
} else if (err == -EAGAIN) {
ctrlc();
WATCHDOG_RESET();
} else {
break;
}
} while (*count && !had_ctrlc());
return !!(err < 0);
}
static void stm32prog_serial_putc(u8 w_byte)
{
struct dm_serial_ops *ops = serial_get_ops(down_serial_dev);
int err;
do {
err = ops->putc(down_serial_dev, w_byte);
} while (err == -EAGAIN);
}
/* Helper function ************************************************/
static u8 stm32prog_header(struct stm32prog_data *data)
{
u8 ret;
u8 boot = 0;
struct dfu_entity *dfu_entity;
u64 size = 0;
/*pr_debug("%s entry\n", __func__);*/
dfu_entity = stm32prog_get_entity(data);
if (!dfu_entity)
return -ENODEV;
printf("\nSTM32 download write %s\n", dfu_entity->name);
/* force cleanup to avoid issue with previous read */
dfu_transaction_cleanup(dfu_entity);
ret = stm32prog_header_check(data->header_data,
&data->header);
/* no header : max size is partition size */
if (ret) {
dfu_entity->get_medium_size(dfu_entity, &size);
data->header.image_length = size;
}
/**** Flash the header if necessary for boot partition */
if (data->phase < PHASE_FIRST_USER)
boot = 1;
/* write header if boot partition */
if (boot) {
if (ret) {
stm32prog_err("invalid header (error %d)", ret);
} else {
ret = stm32prog_write(data,
(u8 *)data->header_data,
BL_HEADER_SIZE);
}
} else {
if (ret)
printf(" partition without checksum\n");
ret = 0;
}
free(data->header_data);
data->header_data = NULL;
/*pr_debug("%s result=%d\n", __func__, ret);*/
return ret;
}
static u8 stm32prog_start(struct stm32prog_data *data, u32 address)
{
u8 ret = 0;
struct dfu_entity *dfu_entity;
/*pr_debug("%s entry\n", __func__);*/
if (address < 0x100) {
if (address == PHASE_OTP)
return stm32prog_otp_start(data);
if (address == PHASE_PMIC)
return stm32prog_pmic_start(data);
if (address == PHASE_RESET || address == PHASE_END) {
data->cur_part = NULL;
data->dfu_seq = 0;
data->phase = address;
return 0;
}
if (address != data->phase) {
stm32prog_err("invalid received phase id %d, current phase is %d",
(u8)address, (u8)data->phase);
return -EINVAL;
}
}
/* check the last loaded partition */
if (address == DEFAULT_ADDRESS || address == data->phase) {
switch (data->phase) {
case PHASE_END:
case PHASE_RESET:
case PHASE_DO_RESET:
data->cur_part = NULL;
data->phase = PHASE_DO_RESET;
return 0;
}
dfu_entity = stm32prog_get_entity(data);
if (!dfu_entity)
return -ENODEV;
if (data->dfu_seq) {
ret = dfu_flush(dfu_entity, NULL, 0, data->dfu_seq);
data->dfu_seq = 0;
if (ret) {
stm32prog_err("DFU flush failed [%d]", ret);
return ret;
}
}
printf("\n received length = 0x%x\n", data->cursor);
if (data->header.present) {
if (data->cursor !=
(data->header.image_length + BL_HEADER_SIZE)) {
stm32prog_err("transmission interrupted (length=0x%x expected=0x%x)",
data->cursor,
data->header.image_length +
BL_HEADER_SIZE);
return -EIO;
}
if (data->header.image_checksum != data->checksum) {
stm32prog_err("invalid checksum received (0x%x expected 0x%x)",
data->checksum,
data->header.image_checksum);
return -EIO;
}
printf("\n checksum OK (0x%x)\n", data->checksum);
}
stm32prog_end_phase(data);
/* update DFU with received flashlayout */
if (data->phase == PHASE_FLASHLAYOUT)
stm32prog_dfu_init(data);
/* found next selected partition */
stm32prog_next_phase(data);
} else {
void (*entry)(void) = (void *)address;
printf("## Starting application at 0x%x ...\n", address);
(*entry)();
printf("## Application terminated\n");
ret = -ENOEXEC;
}
/*pr_debug("%s exit ret=%d, phase=0x%x, add=0x%x\n", __func__,
* ret, data->phase, address);
*/
return ret;
}
/*
* Function Name : get_address
* Description : Get address if it is valid
* Input : None
* Output : None
* Return : The address area or Error_32
*/
static u32 get_address(u8 *tmp_xor)
{
u32 address = 0x0;
u8 data;
data = stm32prog_serial_getc();
*tmp_xor ^= data;
address |= ((u32)data) << 24;
data = stm32prog_serial_getc();
address |= ((u32)data) << 16;
*tmp_xor ^= data;
data = stm32prog_serial_getc();
address |= ((u32)data) << 8;
*tmp_xor ^= data;
data = stm32prog_serial_getc();
address |= ((u32)data);
*tmp_xor ^= data;
return address;
}
static void stm32prog_serial_result(u8 result)
{
/* always flush fifo before to send result */
stm32prog_serial_flush();
stm32prog_serial_putc(result);
}
/* Command -----------------------------------------------*/
/*
* Function Name : get_cmd_command
* Description : Respond to Get command
* Input : None
* Output : None
* Return : None
*/
static void get_cmd_command(struct stm32prog_data *data)
{
u32 counter = 0x0;
stm32prog_serial_putc(NB_CMD);
stm32prog_serial_putc(USART_BL_VERSION);
for (counter = 0; counter < NB_CMD; counter++)
stm32prog_serial_putc(cmd_id[counter]);
stm32prog_serial_result(ACK_BYTE);
}
/*
* Function Name : get_version_command
* Description : Respond to Get Version command
* Input : None
* Output : None
* Return : None
*/
static void get_version_command(struct stm32prog_data *data)
{
stm32prog_serial_putc(UBOOT_BL_VERSION);
stm32prog_serial_result(ACK_BYTE);
}
/*
* Function Name : get_id_command
* Description : Respond to Get ID command
* Input : None
* Output : None
* Return : None
*/
static void get_id_command(struct stm32prog_data *data)
{
/* Send Device IDCode */
stm32prog_serial_putc(0x1);
stm32prog_serial_putc(DEVICE_ID_BYTE1);
stm32prog_serial_putc(DEVICE_ID_BYTE2);
stm32prog_serial_result(ACK_BYTE);
}
/*
* Function Name : get_phase_command
* Description : Respond to Get phase
* Input : None
* Output : None
* Return : None
*/
static void get_phase_command(struct stm32prog_data *data)
{
char *err_msg = NULL;
u8 i, length = 0;
u32 destination = DEFAULT_ADDRESS; /* destination address */
int phase = data->phase;
if (phase == PHASE_RESET || phase == PHASE_DO_RESET) {
err_msg = stm32prog_get_error(data);
length = strlen(err_msg);
}
if (phase == PHASE_FLASHLAYOUT)
destination = STM32_DDR_BASE;
stm32prog_serial_putc(length + 5); /* Total length */
stm32prog_serial_putc(phase & 0xFF); /* partition ID */
stm32prog_serial_putc(destination); /* byte 1 of address */
stm32prog_serial_putc(destination >> 8); /* byte 2 of address */
stm32prog_serial_putc(destination >> 16); /* byte 3 of address */
stm32prog_serial_putc(destination >> 24); /* byte 4 of address */
stm32prog_serial_putc(length); /* Information length */
for (i = 0; i < length; i++)
stm32prog_serial_putc(err_msg[i]);
stm32prog_serial_result(ACK_BYTE);
if (phase == PHASE_RESET)
stm32prog_do_reset(data);
}
/*
* Function Name : read_memory_command
* Description : Read data from memory
* Input : None
* Output : None
* Return : None
*/
static void read_memory_command(struct stm32prog_data *data)
{
u32 address = 0x0;
u8 rcv_data = 0x0, tmp_xor = 0x0;
u32 counter = 0x0;
/* Read memory address */
address = get_address(&tmp_xor);
/* If address memory is not received correctly */
rcv_data = stm32prog_serial_getc();
if (rcv_data != tmp_xor) {
stm32prog_serial_result(NACK_BYTE);
return;
}
stm32prog_serial_result(ACK_BYTE);
/* Read the number of bytes to be received:
* Max NbrOfData = Data + 1 = 256
*/
rcv_data = stm32prog_serial_getc();
tmp_xor = ~rcv_data;
if (stm32prog_serial_getc() != tmp_xor) {
stm32prog_serial_result(NACK_BYTE);
return;
}
/* If checksum is correct send ACK */
stm32prog_serial_result(ACK_BYTE);
/* Send data to the host:
* Number of data to read = data + 1
*/
for (counter = (rcv_data + 1); counter != 0; counter--)
stm32prog_serial_putc(*(u8 *)(address++));
}
/*
* Function Name : start_command
* Description : Jump to user application in RAM or partition check
* Input : None
* Output : None
* Return : None
*/
static void start_command(struct stm32prog_data *data)
{
u32 address = 0;
u8 tmp_xor = 0x0;
u8 ret, rcv_data;
/* Read memory address */
address = get_address(&tmp_xor);
/* If address memory is not received correctly */
rcv_data = stm32prog_serial_getc();
if (rcv_data != tmp_xor) {
stm32prog_serial_result(NACK_BYTE);
return;
}
/* validate partition */
ret = stm32prog_start(data,
address);
if (ret)
stm32prog_serial_result(ABORT_BYTE);
else
stm32prog_serial_result(ACK_BYTE);
}
/*
* Function Name : download_command
* Description : Write data to Flash
* Input : None
* Output : None
* Return : Result
*/
static void download_command(struct stm32prog_data *data)
{
u32 address = 0x0;
u8 my_xor = 0x0;
u8 rcv_xor;
u32 counter = 0x0, codesize = 0x0;
u8 *ramaddress = 0;
u8 rcv_data = 0x0;
struct image_header_s *image_header = &data->header;
u32 cursor = data->cursor;
long size = 0;
u8 operation;
u32 packet_number;
u32 result = ACK_BYTE;
u8 ret;
unsigned int i;
bool error;
int rcv;
address = get_address(&my_xor);
/* If address memory is not received correctly */
rcv_xor = stm32prog_serial_getc();
if (rcv_xor != my_xor) {
result = NACK_BYTE;
goto end;
}
/* If address valid send ACK */
stm32prog_serial_result(ACK_BYTE);
/* get packet number and operation type */
operation = (u8)((u32)address >> 24);
packet_number = ((u32)(((u32)address << 8))) >> 8;
switch (operation) {
/* supported operation */
case PHASE_FLASHLAYOUT:
case PHASE_OTP:
case PHASE_PMIC:
break;
default:
result = NACK_BYTE;
goto end;
}
/* check the packet number */
if (packet_number == 0) {
/* erase: re-initialize the image_header struct */
data->packet_number = 0;
if (data->header_data)
memset(data->header_data, 0, BL_HEADER_SIZE);
else
data->header_data = calloc(1, BL_HEADER_SIZE);
cursor = 0;
data->cursor = 0;
data->checksum = 0;
/*idx = cursor;*/
} else {
data->packet_number++;
}
/* Check with the number of current packet if the device receive
* the true packet
*/
if (packet_number != data->packet_number) {
data->packet_number--;
result = NACK_BYTE;
goto end;
}
/*-- Read number of bytes to be written and data -----------*/
/* Read the number of bytes to be written:
* Max NbrOfData = data + 1 <= 256
*/
rcv_data = stm32prog_serial_getc();
/* NbrOfData to write = data + 1 */
codesize = rcv_data + 0x01;
if (codesize > USART_RAM_BUFFER_SIZE) {
result = NACK_BYTE;
goto end;
}
/* Checksum Initialization */
my_xor = rcv_data;
/* UART receive data and send to Buffer */
counter = codesize;
error = stm32prog_serial_get_buffer(data->buffer, &counter);
/* read checksum */
if (!error) {
rcv = stm32prog_serial_getc_err();
error = !!(rcv < 0);
rcv_xor = rcv;
}
if (error) {
printf("transmission error on packet %d, byte %d\n",
packet_number, codesize - counter);
/* waiting end of packet before flush & NACK */
mdelay(30);
data->packet_number--;
result = NACK_BYTE;
goto end;
}
/* Compute Checksum */
ramaddress = data->buffer;
for (counter = codesize; counter != 0; counter--)
my_xor ^= *(ramaddress++);
/* If Checksum is incorrect */
if (rcv_xor != my_xor) {
printf("checksum error on packet %d\n",
packet_number);
/* wait to be sure that all data are received
* in the FIFO before flush
*/
mdelay(30);
data->packet_number--;
result = NACK_BYTE;
goto end;
}
/* Update current position in buffer */
data->cursor += codesize;
if (operation == PHASE_OTP) {
size = data->cursor - cursor;
/* no header for OTP */
if (stm32prog_otp_write(data, cursor,
data->buffer, &size))
result = ABORT_BYTE;
goto end;
}
if (operation == PHASE_PMIC) {
size = data->cursor - cursor;
/* no header for PMIC */
if (stm32prog_pmic_write(data, cursor,
data->buffer, &size))
result = ABORT_BYTE;
goto end;
}
if (cursor < BL_HEADER_SIZE) {
/* size = portion of header in this chunck */
if (data->cursor >= BL_HEADER_SIZE)
size = BL_HEADER_SIZE - cursor;
else
size = data->cursor - cursor;
memcpy((void *)((u32)(data->header_data) + cursor),
data->buffer, size);
cursor += size;
if (cursor == BL_HEADER_SIZE) {
/* Check and Write the header */
if (stm32prog_header(data)) {
result = ABORT_BYTE;
goto end;
}
} else {
goto end;
}
}
/*
* pr_debug("packet_number = 0x%x\n", packet_number);
* pr_debug("cursor = 0x%x\n", data->cursor);
* pr_debug("image_length = 0x%x\n", image_header->image_length);
* pr_debug("codesize = 0x%x\n", codesize);
*/
if (image_header->present) {
if (data->cursor <= BL_HEADER_SIZE)
goto end;
/* compute checksum on payload */
for (i = (unsigned long)size; i < codesize; i++)
data->checksum += data->buffer[i];
if (data->cursor >
image_header->image_length + BL_HEADER_SIZE) {
pr_err("expected size exceeded\n");
result = ABORT_BYTE;
goto end;
}
/* write data (payload) */
ret = stm32prog_write(data,
&data->buffer[size],
codesize - size);
} else {
/* write all */
ret = stm32prog_write(data,
data->buffer,
codesize);
}
if (ret)
result = ABORT_BYTE;
end:
/*pr_debug("%s : result = 0x%x\n", __func__, result);*/
stm32prog_serial_result(result);
}
/*
* Function Name : read_partition
* Description : read data from Flash
* Input : None
* Output : None
* Return : Result
*/
static void read_partition_command(struct stm32prog_data *data)
{
u32 i, part_id, codesize, offset = 0, rcv_data;
long size;
u8 tmp_xor;
int res;
u8 buffer[256];
part_id = stm32prog_serial_getc();
tmp_xor = part_id;
offset = get_address(&tmp_xor);
rcv_data = stm32prog_serial_getc();
if (rcv_data != tmp_xor) {
pr_debug("1st checksum received = %x, computed %x\n",
rcv_data, tmp_xor);
goto error;
}
stm32prog_serial_putc(ACK_BYTE);
/* NbrOfData to read = data + 1 */
rcv_data = stm32prog_serial_getc();
codesize = rcv_data + 0x01;
tmp_xor = rcv_data;
rcv_data = stm32prog_serial_getc();
if ((rcv_data ^ tmp_xor) != 0xFF) {
pr_debug("2nd checksum received = %x, computed %x\n",
rcv_data, tmp_xor);
goto error;
}
pr_debug("%s : %x\n", __func__, part_id);
rcv_data = 0;
switch (part_id) {
case PHASE_OTP:
size = codesize;
if (!stm32prog_otp_read(data, offset, buffer, &size))
rcv_data = size;
break;
case PHASE_PMIC:
size = codesize;
if (!stm32prog_pmic_read(data, offset, buffer, &size))
rcv_data = size;
break;
default:
res = stm32prog_read(data, part_id, offset,
buffer, codesize);
if (res > 0)
rcv_data = res;
break;
}
if (rcv_data > 0) {
stm32prog_serial_putc(ACK_BYTE);
/*----------- Send data to the host -----------*/
for (i = 0; i < rcv_data; i++)
stm32prog_serial_putc(buffer[i]);
/*----------- Send filler to the host -----------*/
for (; i < codesize; i++)
stm32prog_serial_putc(0x0);
return;
}
stm32prog_serial_result(ABORT_BYTE);
return;
error:
stm32prog_serial_result(NACK_BYTE);
}
/** SERIAL LOOP ****************************************************/
/*
* Function Name : stm32prog_serial_loop
* Description : USART bootloader Loop routine
* Input : data
* Output : None
* Return : None
*/
bool stm32prog_serial_loop(struct stm32prog_data *data)
{
u32 counter = 0x0;
u8 command = 0x0;
u8 found;
int phase = data->phase;
/* element of cmd_func need to aligned with cmd_id[]*/
void (*cmd_func[NB_CMD])(struct stm32prog_data *) = {
/* GET_CMD_COMMAND */ get_cmd_command,
/* GET_VER_COMMAND */ get_version_command,
/* GET_ID_COMMAND */ get_id_command,
/* GET_PHASE_COMMAND */ get_phase_command,
/* RM_COMMAND */ read_memory_command,
/* READ_PART_COMMAND */ read_partition_command,
/* START_COMMAND */ start_command,
/* DOWNLOAD_COMMAND */ download_command
};
/* flush and NACK pending command received during u-boot init
* request command reemit
*/
stm32prog_serial_result(NACK_BYTE);
clear_ctrlc(); /* forget any previous Control C */
while (!had_ctrlc()) {
phase = data->phase;
if (phase == PHASE_DO_RESET)
return true;
/* Get the user command: read first byte */
command = stm32prog_serial_getc();
if (command == INIT_BYTE) {
puts("\nConnected\n");
stm32prog_serial_result(ACK_BYTE);
continue;
}
found = 0;
for (counter = 0; counter < NB_CMD; counter++)
if (cmd_id[counter] == command) {
found = 1;
break;
}
if (found)
if ((command ^ stm32prog_serial_getc()) != 0xFF)
found = 0;
if (!found) {
/* wait to be sure that all data are received
* in the FIFO before flush (CMD and XOR)
*/
mdelay(3);
stm32prog_serial_result(NACK_BYTE);
} else {
/*pr_debug("+ cmd %x\n", counter);*/
stm32prog_serial_result(ACK_BYTE);
cmd_func[counter](data);
}
WATCHDOG_RESET();
}
/* clean device */
if (gd->cur_serial_dev == down_serial_dev) {
/* restore console on uart */
gd->flags &= ~(GD_FLG_DISABLE_CONSOLE | GD_FLG_SILENT);
}
down_serial_dev = NULL;
return false; /* no reset after ctrlc */
}

View File

@ -0,0 +1,285 @@
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/*
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
*/
#include <common.h>
#include <console.h>
#include <dfu.h>
#include <g_dnl.h>
#include <usb.h>
#include <watchdog.h>
#include "stm32prog.h"
struct stm32prog_data *stm32prog_data;
static int stm32prog_get_alternate(struct stm32prog_data *data)
{
if (data->cur_part)
return data->cur_part->alt_id;
else
return -EINVAL;
}
static int stm32prog_set_phase(struct stm32prog_data *data, u8 phase,
u32 offset)
{
struct stm32prog_part_t *part;
int i;
if (phase == data->phase) {
data->offset = offset;
data->dfu_seq = 0;
return 0;
}
/* found partition */
for (i = 0; i < data->part_nb; i++) {
part = &data->part_array[i];
if (part->id == phase) {
data->cur_part = part;
data->phase = phase;
data->offset = offset;
data->dfu_seq = 0;
return 0;
}
}
return -EINVAL;
}
static int stm32prog_cmd_write(u64 offset, void *buf, long *len)
{
u8 phase;
u32 address;
u8 *pt = buf;
void (*entry)(void);
int ret;
if (*len < 5) {
pr_err("size not allowed\n");
return -EINVAL;
}
if (offset) {
pr_err("invalid offset\n");
return -EINVAL;
}
phase = pt[0];
address = (pt[1] << 24) | (pt[2] << 16) | (pt[3] << 8) | pt[4];
if (phase == PHASE_RESET) {
entry = (void *)address;
printf("## Starting application at 0x%x ...\n", address);
(*entry)();
printf("## Application terminated\n");
return 0;
}
/* set phase and offset */
ret = stm32prog_set_phase(stm32prog_data, phase, address);
if (ret)
pr_err("failed: %d\n", ret);
return ret;
}
#define PHASE_MIN_SIZE 9
static int stm32prog_cmd_read(u64 offset, void *buf, long *len)
{
u32 destination = DEFAULT_ADDRESS; /* destination address */
u32 dfu_offset;
u8 *pt_buf = buf;
int phase;
char *err_msg;
int length;
if (*len < PHASE_MIN_SIZE) {
pr_err("request exceeds allowed area\n");
return -EINVAL;
}
if (offset) {
*len = 0; /* EOF for second request */
return 0;
}
phase = stm32prog_data->phase;
if (phase == PHASE_FLASHLAYOUT)
destination = STM32_DDR_BASE;
dfu_offset = stm32prog_data->offset;
/* mandatory header, size = PHASE_MIN_SIZE */
*pt_buf++ = (u8)(phase & 0xFF);
*pt_buf++ = (u8)(destination);
*pt_buf++ = (u8)(destination >> 8);
*pt_buf++ = (u8)(destination >> 16);
*pt_buf++ = (u8)(destination >> 24);
*pt_buf++ = (u8)(dfu_offset);
*pt_buf++ = (u8)(dfu_offset >> 8);
*pt_buf++ = (u8)(dfu_offset >> 16);
*pt_buf++ = (u8)(dfu_offset >> 24);
if (phase == PHASE_RESET || phase == PHASE_DO_RESET) {
err_msg = stm32prog_get_error(stm32prog_data);
length = strlen(err_msg);
if (length + PHASE_MIN_SIZE > *len)
length = *len - PHASE_MIN_SIZE;
memcpy(pt_buf, err_msg, length);
*len = PHASE_MIN_SIZE + length;
stm32prog_do_reset(stm32prog_data);
} else if (phase == PHASE_FLASHLAYOUT) {
*pt_buf++ = stm32prog_data->part_nb ? 1 : 0;
*len = PHASE_MIN_SIZE + 1;
} else {
*len = PHASE_MIN_SIZE;
}
return 0;
}
/* DFU access to virtual partition */
void dfu_flush_callback(struct dfu_entity *dfu)
{
if (!stm32prog_data)
return;
if (dfu->dev_type == DFU_DEV_VIRT) {
if (dfu->data.virt.dev_num == PHASE_OTP)
stm32prog_otp_start(stm32prog_data);
else if (dfu->data.virt.dev_num == PHASE_PMIC)
stm32prog_pmic_start(stm32prog_data);
return;
}
if (dfu->dev_type == DFU_DEV_RAM) {
if (dfu->alt == 0 &&
stm32prog_data->phase == PHASE_FLASHLAYOUT) {
stm32prog_end_phase(stm32prog_data);
/* waiting DFU DETACH for reenumeration */
}
return;
}
if (dfu->alt == stm32prog_get_alternate(stm32prog_data)) {
stm32prog_end_phase(stm32prog_data);
stm32prog_next_phase(stm32prog_data);
}
}
void dfu_initiated_callback(struct dfu_entity *dfu)
{
int phase;
if (!stm32prog_data)
return;
phase = stm32prog_data->phase;
if (dfu->alt == stm32prog_get_alternate(stm32prog_data)) {
dfu->offset = stm32prog_data->offset;
stm32prog_set_phase(stm32prog_data, phase, 0);
pr_debug("dfu offset = 0x%llx\n", dfu->offset);
}
}
int dfu_write_medium_virt(struct dfu_entity *dfu, u64 offset,
void *buf, long *len)
{
if (dfu->dev_type != DFU_DEV_VIRT)
return -EINVAL;
switch (dfu->data.virt.dev_num) {
case PHASE_CMD:
return stm32prog_cmd_write(offset, buf, len);
case PHASE_OTP:
return stm32prog_otp_write(stm32prog_data, (u32)offset,
buf, len);
case PHASE_PMIC:
return stm32prog_pmic_write(stm32prog_data, (u32)offset,
buf, len);
}
*len = 0;
return 0;
}
int dfu_read_medium_virt(struct dfu_entity *dfu, u64 offset,
void *buf, long *len)
{
if (dfu->dev_type != DFU_DEV_VIRT)
return -EINVAL;
switch (dfu->data.virt.dev_num) {
case PHASE_CMD:
return stm32prog_cmd_read(offset, buf, len);
case PHASE_OTP:
return stm32prog_otp_read(stm32prog_data, (u32)offset,
buf, len);
case PHASE_PMIC:
return stm32prog_pmic_read(stm32prog_data, (u32)offset,
buf, len);
}
*len = 0;
return 0;
}
int dfu_get_medium_size_virt(struct dfu_entity *dfu, u64 *size)
{
if (dfu->dev_type != DFU_DEV_VIRT) {
*size = 0;
pr_debug("%s, invalid dev_type = %d\n",
__func__, dfu->dev_type);
return -EINVAL;
}
switch (dfu->data.virt.dev_num) {
case PHASE_CMD:
*size = 512;
break;
case PHASE_OTP:
*size = OTP_SIZE;
break;
case PHASE_PMIC:
*size = PMIC_SIZE;
break;
}
return 0;
}
/* USB download gadget for STM32 Programmer */
static const char product[] =
"USB download gadget@Device ID /0x500, @Revision ID /0x0000";
bool stm32prog_usb_loop(struct stm32prog_data *data, int dev)
{
int ret;
bool result;
stm32prog_data = data;
g_dnl_set_product(product);
if (stm32prog_data->phase == PHASE_FLASHLAYOUT) {
ret = run_usb_dnl_gadget(dev, "usb_dnl_dfu");
if (ret || stm32prog_data->phase == PHASE_DO_RESET)
return ret;
/* prepare the second enumeration with the FlashLayout */
if (stm32prog_data->phase == PHASE_FLASHLAYOUT)
stm32prog_dfu_init(data);
/* found next selected partition */
stm32prog_next_phase(data);
}
ret = run_usb_dnl_gadget(dev, "usb_dnl_dfu") ;
result = !!(ret) || (stm32prog_data->phase == PHASE_DO_RESET);
stm32prog_data = NULL;
return result;
}
int g_dnl_get_board_bcd_device_number(int gcnum)
{
pr_debug("%s\n", __func__);
return 0x200;
}

View File

@ -3,7 +3,21 @@
# Copyright (C) 2018, STMicroelectronics - All Rights Reserved
#
ALL-$(CONFIG_SPL_BUILD) += spl/u-boot-spl.stm32
ifndef CONFIG_SPL
ALL-y += u-boot.stm32
else
ifdef CONFIG_SPL_BUILD
ALL-y += u-boot-spl.stm32
endif
endif
MKIMAGEFLAGS_u-boot.stm32 = -T stm32image -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE)
u-boot.stm32: MKIMAGEOUTPUT = u-boot.stm32.log
u-boot.stm32: u-boot.bin FORCE
$(call if_changed,mkimage)
MKIMAGEFLAGS_u-boot-spl.stm32 = -T stm32image -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE)
@ -11,3 +25,6 @@ spl/u-boot-spl.stm32: MKIMAGEOUTPUT = spl/u-boot-spl.stm32.log
spl/u-boot-spl.stm32: spl/u-boot-spl.bin FORCE
$(call if_changed,mkimage)
u-boot-spl.stm32 : spl/u-boot-spl.stm32
$(call if_changed,copy)

View File

@ -6,18 +6,24 @@
#include <clk.h>
#include <debug_uart.h>
#include <environment.h>
#include <fdt_support.h>
#include <misc.h>
#include <wdt.h>
#include <asm/io.h>
#include <asm/arch/stm32.h>
#include <asm/arch/sys_proto.h>
#include <dm/device.h>
#include <dm/lists.h>
#include <dm/uclass.h>
#include <dt-bindings/clock/stm32mp1-clks.h>
/* RCC register */
#define RCC_TZCR (STM32_RCC_BASE + 0x00)
#define RCC_DBGCFGR (STM32_RCC_BASE + 0x080C)
#define RCC_BDCR (STM32_RCC_BASE + 0x0140)
#define RCC_MP_APB5ENSETR (STM32_RCC_BASE + 0x0208)
#define RCC_MP_AHB5ENSETR (STM32_RCC_BASE + 0x0210)
#define RCC_BDCR_VSWRST BIT(31)
#define RCC_BDCR_RTCSRC GENMASK(17, 16)
#define RCC_DBGCFGR_DBGCKEN BIT(8)
@ -44,6 +50,9 @@
#define DBGMCU_IDC_REV_ID_MASK GENMASK(31, 16)
#define DBGMCU_IDC_REV_ID_SHIFT 16
/* GPIOZ registers */
#define GPIOZ_SECCFGR 0x54004030
/* boot interface from Bootrom
* - boot instance = bit 31:16
* - boot device = bit 15:0
@ -55,10 +64,29 @@
#define BOOTROM_INSTANCE_SHIFT 16
/* BSEC OTP index */
#define BSEC_OTP_RPN 1
#define BSEC_OTP_SERIAL 13
#define BSEC_OTP_PKG 16
#define BSEC_OTP_MAC 57
/* Device Part Number (RPN) = OTP_DATA1 lower 8 bits */
#define RPN_SHIFT 0
#define RPN_MASK GENMASK(7, 0)
/* Package = bit 27:29 of OTP16
* - 100: LBGA448 (FFI) => AA = LFBGA 18x18mm 448 balls p. 0.8mm
* - 011: LBGA354 (LCI) => AB = LFBGA 16x16mm 359 balls p. 0.8mm
* - 010: TFBGA361 (FFC) => AC = TFBGA 12x12mm 361 balls p. 0.5mm
* - 001: TFBGA257 (LCC) => AD = TFBGA 10x10mm 257 balls p. 0.5mm
* - others: Reserved
*/
#define PKG_SHIFT 27
#define PKG_MASK GENMASK(2, 0)
DECLARE_GLOBAL_DATA_PTR;
#if !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)
#ifndef CONFIG_STM32MP1_TRUSTED
static void security_init(void)
{
/* Disable the backup domain write protection */
@ -113,7 +141,12 @@ static void security_init(void)
* Bit 16 ITAMP1E: RTC power domain supply monitoring
*/
writel(0x0, TAMP_CR1);
/* GPIOZ: deactivate the security */
writel(BIT(0), RCC_MP_AHB5ENSETR);
writel(0x0, GPIOZ_SECCFGR);
}
#endif /* CONFIG_STM32MP1_TRUSTED */
/*
* Debug init
@ -127,13 +160,19 @@ static void dbgmcu_init(void)
}
#endif /* !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD) */
static u32 get_bootmode(void)
#if !defined(CONFIG_STM32MP1_TRUSTED) && \
(!defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD))
/* get bootmode from ROM code boot context: saved in TAMP register */
static void update_bootmode(void)
{
u32 boot_mode;
#if !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)
u32 bootrom_itf = readl(BOOTROM_PARAM_ADDR);
u32 bootrom_device, bootrom_instance;
/* enable TAMP clock = RTCAPBEN */
writel(BIT(8), RCC_MP_APB5ENSETR);
/* read bootrom context */
bootrom_device =
(bootrom_itf & BOOTROM_MODE_MASK) >> BOOTROM_MODE_SHIFT;
bootrom_instance =
@ -147,12 +186,14 @@ static u32 get_bootmode(void)
clrsetbits_le32(TAMP_BOOT_CONTEXT,
TAMP_BOOT_MODE_MASK,
boot_mode << TAMP_BOOT_MODE_SHIFT);
#else
/* read TAMP backup register */
boot_mode = (readl(TAMP_BOOT_CONTEXT) & TAMP_BOOT_MODE_MASK) >>
TAMP_BOOT_MODE_SHIFT;
}
#endif
return boot_mode;
u32 get_bootmode(void)
{
/* read bootmode from TAMP backup register */
return (readl(TAMP_BOOT_CONTEXT) & TAMP_BOOT_MODE_MASK) >>
TAMP_BOOT_MODE_SHIFT;
}
/*
@ -167,16 +208,18 @@ int arch_cpu_init(void)
#if !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)
dbgmcu_init();
#ifndef CONFIG_STM32MP1_TRUSTED
security_init();
update_bootmode();
#endif
#endif
/* get bootmode from BootRom context: saved in TAMP register */
boot_mode = get_bootmode();
if ((boot_mode & TAMP_BOOT_DEVICE_MASK) == BOOT_SERIAL_UART)
gd->flags |= GD_FLG_SILENT | GD_FLG_DISABLE_CONSOLE;
#if defined(CONFIG_DEBUG_UART) && \
!defined(CONFIG_STM32MP1_TRUSTED) && \
(!defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD))
else
debug_uart_init();
@ -203,25 +246,112 @@ u32 get_cpu_rev(void)
return (read_idc() & DBGMCU_IDC_REV_ID_MASK) >> DBGMCU_IDC_REV_ID_SHIFT;
}
static u32 get_otp(int index, int shift, int mask)
{
int ret;
struct udevice *dev;
u32 otp = 0;
ret = uclass_get_device_by_driver(UCLASS_MISC,
DM_GET_DRIVER(stm32mp_bsec),
&dev);
if (!ret)
ret = misc_read(dev, STM32_BSEC_SHADOW(index),
&otp, sizeof(otp));
return (otp >> shift) & mask;
}
/* Get Device Part Number (RPN) from OTP */
static u32 get_cpu_rpn(void)
{
return get_otp(BSEC_OTP_RPN, RPN_SHIFT, RPN_MASK);
}
u32 get_cpu_type(void)
{
return (read_idc() & DBGMCU_IDC_DEV_ID_MASK) >> DBGMCU_IDC_DEV_ID_SHIFT;
u32 id;
id = (read_idc() & DBGMCU_IDC_DEV_ID_MASK) >> DBGMCU_IDC_DEV_ID_SHIFT;
return (id << 16) | get_cpu_rpn();
}
/* Get Package options from OTP */
u32 get_cpu_package(void)
{
return get_otp(BSEC_OTP_PKG, PKG_SHIFT, PKG_MASK);
}
#if defined(CONFIG_DISPLAY_CPUINFO)
int print_cpuinfo(void)
{
char *cpu_s, *cpu_r;
char *cpu_s, *cpu_r, *pkg;
/* MPUs Part Numbers */
switch (get_cpu_type()) {
case CPU_STMP32MP15x:
cpu_s = "15x";
case CPU_STM32MP157Fxx:
cpu_s = "157F";
break;
case CPU_STM32MP157Dxx:
cpu_s = "157D";
break;
case CPU_STM32MP157Cxx:
cpu_s = "157C";
break;
case CPU_STM32MP157Axx:
cpu_s = "157A";
break;
case CPU_STM32MP153Fxx:
cpu_s = "153F";
break;
case CPU_STM32MP153Dxx:
cpu_s = "153D";
break;
case CPU_STM32MP153Cxx:
cpu_s = "153C";
break;
case CPU_STM32MP153Axx:
cpu_s = "153A";
break;
case CPU_STM32MP151Fxx:
cpu_s = "151F";
break;
case CPU_STM32MP151Dxx:
cpu_s = "151D";
break;
case CPU_STM32MP151Cxx:
cpu_s = "151C";
break;
case CPU_STM32MP151Axx:
cpu_s = "151A";
break;
default:
cpu_s = "?";
cpu_s = "????";
break;
}
/* Package */
switch (get_cpu_package()) {
case PKG_AA_LBGA448:
pkg = "AA";
break;
case PKG_AB_LBGA354:
pkg = "AB";
break;
case PKG_AC_TFBGA361:
pkg = "AC";
break;
case PKG_AD_TFBGA257:
pkg = "AD";
break;
default:
pkg = "??";
break;
}
/* REVISION */
switch (get_cpu_rev()) {
case CPU_REVA:
cpu_r = "A";
@ -229,12 +359,15 @@ int print_cpuinfo(void)
case CPU_REVB:
cpu_r = "B";
break;
case CPU_REVZ:
cpu_r = "Z";
break;
default:
cpu_r = "?";
break;
}
printf("CPU: STM32MP%s.%s\n", cpu_s, cpu_r);
printf("CPU: STM32MP%s%s Rev.%s\n", cpu_s, pkg, cpu_r);
return 0;
}
@ -242,20 +375,48 @@ int print_cpuinfo(void)
static void setup_boot_mode(void)
{
const u32 serial_addr[] = {
STM32_USART1_BASE,
STM32_USART2_BASE,
STM32_USART3_BASE,
STM32_UART4_BASE,
STM32_UART5_BASE,
STM32_USART6_BASE,
STM32_UART7_BASE,
STM32_UART8_BASE
};
char cmd[60];
u32 boot_ctx = readl(TAMP_BOOT_CONTEXT);
u32 boot_mode =
(boot_ctx & TAMP_BOOT_MODE_MASK) >> TAMP_BOOT_MODE_SHIFT;
int instance = (boot_mode & TAMP_BOOT_INSTANCE_MASK) - 1;
pr_debug("%s: boot_ctx=0x%x => boot_mode=%x, instance=%d\n",
__func__, boot_ctx, boot_mode, instance);
unsigned int instance = (boot_mode & TAMP_BOOT_INSTANCE_MASK) - 1;
u32 forced_mode = (boot_ctx & TAMP_BOOT_FORCED_MASK);
struct udevice *dev;
int alias;
debug("%s: boot_ctx=0x%x => boot_mode=%x, instance=%d forced=%x\n",
__func__, boot_ctx, boot_mode, instance, forced_mode);
switch (boot_mode & TAMP_BOOT_DEVICE_MASK) {
case BOOT_SERIAL_UART:
sprintf(cmd, "%d", instance);
env_set("boot_device", "uart");
if (instance > ARRAY_SIZE(serial_addr))
break;
/* serial : search associated alias in devicetree */
sprintf(cmd, "serial@%x", serial_addr[instance]);
if (uclass_get_device_by_name(UCLASS_SERIAL, cmd, &dev))
break;
if (fdtdec_get_alias_seq(gd->fdt_blob, "serial",
dev_of_offset(dev), &alias))
break;
sprintf(cmd, "%d", alias);
env_set("boot_device", "serial");
env_set("boot_instance", cmd);
/* restore console on uart when not used */
if (gd->cur_serial_dev != dev) {
gd->flags &= ~(GD_FLG_SILENT |
GD_FLG_DISABLE_CONSOLE);
printf("serial boot with console enabled!\n");
}
break;
case BOOT_SERIAL_USB:
env_set("boot_device", "usb");
@ -279,6 +440,36 @@ static void setup_boot_mode(void)
pr_debug("unexpected boot mode = %x\n", boot_mode);
break;
}
switch (forced_mode) {
case BOOT_FASTBOOT:
printf("Enter fastboot!\n");
env_set("preboot", "env set preboot; fastboot 0");
break;
case BOOT_STM32PROG:
env_set("boot_device", "usb");
env_set("boot_instance", "0");
break;
case BOOT_UMS_MMC0:
case BOOT_UMS_MMC1:
case BOOT_UMS_MMC2:
printf("Enter UMS!\n");
instance = forced_mode - BOOT_UMS_MMC0;
sprintf(cmd, "env set preboot; ums 0 mmc %d", instance);
env_set("preboot", cmd);
break;
case BOOT_RECOVERY:
env_set("preboot", "env set preboot; run altbootcmd");
break;
case BOOT_NORMAL:
break;
default:
pr_debug("unexpected forced boot mode = %x\n", forced_mode);
break;
}
/* clear TAMP for next reboot */
clrsetbits_le32(TAMP_BOOT_CONTEXT, TAMP_BOOT_FORCED_MASK, BOOT_NORMAL);
}
/*
@ -292,19 +483,16 @@ static int setup_mac_address(void)
int i;
u32 otp[2];
uchar enetaddr[6];
char buf[ARP_HLEN_ASCII + 1];
struct udevice *dev;
/* MAC already in environment */
if (eth_env_get_enetaddr("ethaddr", enetaddr))
return 0;
ret = uclass_get_device_by_driver(UCLASS_MISC,
DM_GET_DRIVER(stm32mp_bsec),
&dev);
if (ret)
return ret;
ret = misc_read(dev, BSEC_OTP_MAC * 4 + STM32_BSEC_OTP_OFFSET,
ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_MAC),
otp, sizeof(otp));
if (ret)
return ret;
@ -316,9 +504,11 @@ static int setup_mac_address(void)
pr_err("invalid MAC address in OTP %pM", enetaddr);
return -EINVAL;
}
pr_debug("OTP MAC address = %pM\n", enetaddr);
ret = !eth_env_set_enetaddr("ethaddr", enetaddr);
if (!ret)
sprintf(buf, "%pM", enetaddr);
ret = env_set("ethaddr", buf);
if (ret)
pr_err("Failed to set mac address %pM from OTP: %d\n",
enetaddr, ret);
#endif
@ -333,28 +523,78 @@ static int setup_serial_number(void)
struct udevice *dev;
int ret;
if (env_get("serial#"))
return 0;
ret = uclass_get_device_by_driver(UCLASS_MISC,
DM_GET_DRIVER(stm32mp_bsec),
&dev);
if (ret)
return ret;
ret = misc_read(dev, BSEC_OTP_SERIAL * 4 + STM32_BSEC_OTP_OFFSET,
ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_SERIAL),
otp, sizeof(otp));
if (ret)
return ret;
sprintf(serial_string, "%08x%08x%08x", otp[0], otp[1], otp[2]);
sprintf(serial_string, "%08X%08X%08X", otp[0], otp[1], otp[2]);
env_set("serial#", serial_string);
return 0;
}
#if defined(CONFIG_WDT) && \
(defined(CONFIG_SPL_WATCHDOG_SUPPORT) || !defined(CONFIG_SPL_BUILD))
/* Called by macro WATCHDOG_RESET */
void watchdog_reset(void)
{
static ulong next_reset;
struct udevice *watchdog_dev;
ulong now;
now = timer_get_us();
/* Do not reset the watchdog too often, only every 1 sec */
if (now > next_reset) {
/*
* Watchdog has been enabled at SPL stage, to avoid
* watchdog_dev bad reference after relocation, we don't save
* it in a static variable, we retrieve it each time using
* uclass_get_device() call.
*/
if (uclass_get_device(UCLASS_WDT, 0, &watchdog_dev))
return;
wdt_reset(watchdog_dev);
next_reset = now + 1000000;
}
}
int watchdog_start(void)
{
struct udevice *watchdog_dev;
if (uclass_get_device_by_seq(UCLASS_WDT, 0, &watchdog_dev)) {
debug("Watchdog: Not found by seq!\n");
if (uclass_get_device(UCLASS_WDT, 0, &watchdog_dev)) {
puts("Watchdog: Not found!\n");
return 0;
}
}
wdt_start(watchdog_dev, 0, 0);
printf("Watchdog: Started\n");
return 0;
}
#else
int watchdog_start(void)
{
return 0;
}
#endif
int arch_misc_init(void)
{
watchdog_start();
setup_boot_mode();
setup_mac_address();
setup_serial_number();

224
arch/arm/mach-stm32mp/fdt.c Normal file
View File

@ -0,0 +1,224 @@
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/*
* Copyright (C) 2019, STMicroelectronics - All Rights Reserved
*/
#include <common.h>
#include <fdt_support.h>
#include <syscon.h>
#include <asm/arch/sys_proto.h>
#include <dt-bindings/pinctrl/stm32-pinfunc.h>
#include <linux/io.h>
#define ETZPC_DECPROT(n) (STM32_ETZPC_BASE + 0x10 + 4 * (n))
#define ETZPC_DECPROT_NB 6
#define DECPROT_MASK 0x03
#define NB_PROT_PER_REG 0x10
#define DECPROT_NB_BITS 2
#define DECPROT_SECURED 0x00
#define DECPROT_WRITE_SECURE 0x01
#define DECPROT_MCU_ISOLATION 0x02
#define DECPROT_NON_SECURED 0x03
#define ETZPC_RESERVED 0xffffffff
static const u32 stm32mp1_ip_addr[] = {
0x5c008000, /* 00 stgenc */
0x54000000, /* 01 bkpsram */
0x5c003000, /* 02 iwdg1 */
0x5c000000, /* 03 usart1 */
0x5c001000, /* 04 spi6 */
0x5c002000, /* 05 i2c4 */
ETZPC_RESERVED, /* 06 reserved */
0x54003000, /* 07 rng1 */
0x54002000, /* 08 hash1 */
0x54001000, /* 09 cryp1 */
0x5a003000, /* 0A ddrctrl */
0x5a004000, /* 0B ddrphyc */
0x5c009000, /* 0C i2c6 */
ETZPC_RESERVED, /* 0D reserved */
ETZPC_RESERVED, /* 0E reserved */
ETZPC_RESERVED, /* 0F reserved */
0x40000000, /* 10 tim2 */
0x40001000, /* 11 tim3 */
0x40002000, /* 12 tim4 */
0x40003000, /* 13 tim5 */
0x40004000, /* 14 tim6 */
0x40005000, /* 15 tim7 */
0x40006000, /* 16 tim12 */
0x40007000, /* 17 tim13 */
0x40008000, /* 18 tim14 */
0x40009000, /* 19 lptim1 */
0x4000a000, /* 1A wwdg1 */
0x4000b000, /* 1B spi2 */
0x4000c000, /* 1C spi3 */
0x4000d000, /* 1D spdifrx */
0x4000e000, /* 1E usart2 */
0x4000f000, /* 1F usart3 */
0x40010000, /* 20 uart4 */
0x40011000, /* 21 uart5 */
0x40012000, /* 22 i2c1 */
0x40013000, /* 23 i2c2 */
0x40014000, /* 24 i2c3 */
0x40015000, /* 25 i2c5 */
0x40016000, /* 26 cec */
0x40017000, /* 27 dac */
0x40018000, /* 28 uart7 */
0x40019000, /* 29 uart8 */
ETZPC_RESERVED, /* 2A reserved */
ETZPC_RESERVED, /* 2B reserved */
0x4001c000, /* 2C mdios */
ETZPC_RESERVED, /* 2D reserved */
ETZPC_RESERVED, /* 2E reserved */
ETZPC_RESERVED, /* 2F reserved */
0x44000000, /* 30 tim1 */
0x44001000, /* 31 tim8 */
ETZPC_RESERVED, /* 32 reserved */
0x44003000, /* 33 usart6 */
0x44004000, /* 34 spi1 */
0x44005000, /* 35 spi4 */
0x44006000, /* 36 tim15 */
0x44007000, /* 37 tim16 */
0x44008000, /* 38 tim17 */
0x44009000, /* 39 spi5 */
0x4400a000, /* 3A sai1 */
0x4400b000, /* 3B sai2 */
0x4400c000, /* 3C sai3 */
0x4400d000, /* 3D dfsdm */
0x4400e000, /* 3E tt_fdcan */
ETZPC_RESERVED, /* 3F reserved */
0x50021000, /* 40 lptim2 */
0x50022000, /* 41 lptim3 */
0x50023000, /* 42 lptim4 */
0x50024000, /* 43 lptim5 */
0x50027000, /* 44 sai4 */
0x50025000, /* 45 vrefbuf */
0x4c006000, /* 46 dcmi */
0x4c004000, /* 47 crc2 */
0x48003000, /* 48 adc */
0x4c002000, /* 49 hash2 */
0x4c003000, /* 4A rng2 */
0x4c005000, /* 4B cryp2 */
ETZPC_RESERVED, /* 4C reserved */
ETZPC_RESERVED, /* 4D reserved */
ETZPC_RESERVED, /* 4E reserved */
ETZPC_RESERVED, /* 4F reserved */
ETZPC_RESERVED, /* 50 sram1 */
ETZPC_RESERVED, /* 51 sram2 */
ETZPC_RESERVED, /* 52 sram3 */
ETZPC_RESERVED, /* 53 sram4 */
ETZPC_RESERVED, /* 54 retram */
0x49000000, /* 55 otg */
0x48004000, /* 56 sdmmc3 */
0x48005000, /* 57 dlybsd3 */
0x48000000, /* 58 dma1 */
0x48001000, /* 59 dma2 */
0x48002000, /* 5A dmamux */
0x58002000, /* 5B fmc */
0x58003000, /* 5C qspi */
0x58004000, /* 5D dlybq */
0x5800a000, /* 5E eth */
ETZPC_RESERVED, /* 5F reserved */
};
/* fdt helper */
static bool fdt_disable_subnode_by_address(void *fdt, int offset, u32 addr)
{
int node;
for (node = fdt_first_subnode(fdt, offset);
node >= 0;
node = fdt_next_subnode(fdt, node)) {
if (addr == (u32)fdt_getprop(fdt, node, "reg", 0)) {
if (fdtdec_get_is_enabled(fdt, node)) {
fdt_status_disabled(fdt, node);
return true;
}
return false;
}
}
return false;
}
static int stm32_fdt_fixup_etzpc(void *fdt)
{
const u32 *array;
int array_size, i;
int soc_node, offset, shift;
u32 addr, status, decprot[ETZPC_DECPROT_NB];
array = stm32mp1_ip_addr;
array_size = ARRAY_SIZE(stm32mp1_ip_addr);
for (i = 0; i < ETZPC_DECPROT_NB; i++)
decprot[i] = readl(ETZPC_DECPROT(i));
soc_node = fdt_path_offset(fdt, "/soc");
if (soc_node < 0)
return soc_node;
for (i = 0; i < array_size; i++) {
offset = i / NB_PROT_PER_REG;
shift = (i % NB_PROT_PER_REG) * DECPROT_NB_BITS;
status = (decprot[offset] >> shift) & DECPROT_MASK;
addr = array[i];
debug("ETZPC: 0x%08x decprot %d=%d\n", addr, i, status);
if (addr == ETZPC_RESERVED ||
status == DECPROT_NON_SECURED)
continue;
if (fdt_disable_subnode_by_address(fdt, soc_node, addr))
printf("ETZPC: 0x%08x node disabled, decprot %d=%d\n",
addr, i, status);
}
return 0;
}
/*
* This function is called right before the kernel is booted. "blob" is the
* device tree that will be passed to the kernel.
*/
int ft_system_setup(void *blob, bd_t *bd)
{
int ret = 0;
u32 pkg;
if (CONFIG_IS_ENABLED(STM32_ETZPC)) {
ret = stm32_fdt_fixup_etzpc(blob);
if (ret)
return ret;
}
switch (get_cpu_package()) {
case PKG_AA_LBGA448:
pkg = STM32MP157CAA;
break;
case PKG_AB_LBGA354:
pkg = STM32MP157CAB;
break;
case PKG_AC_TFBGA361:
pkg = STM32MP157CAC;
break;
case PKG_AD_TFBGA257:
pkg = STM32MP157CAD;
break;
default:
pkg = 0;
break;
}
if (pkg) {
do_fixup_by_compat_u32(blob, "st,stm32mp157-pinctrl",
"st,package", pkg, false);
do_fixup_by_compat_u32(blob, "st,stm32mp157-z-pinctrl",
"st,package", pkg, false);
}
return ret;
}

View File

@ -6,6 +6,15 @@
#ifndef __MACH_STM32MP_DDR_H_
#define __MACH_STM32MP_DDR_H_
int board_ddr_power_init(void);
/* DDR power initializations */
enum ddr_type {
STM32MP_DDR3,
STM32MP_LPDDR2_16,
STM32MP_LPDDR2_32,
STM32MP_LPDDR3_16,
STM32MP_LPDDR3_32,
};
int board_ddr_power_init(enum ddr_type ddr_type);
#endif

View File

@ -8,6 +8,8 @@
#define _STM32_GPIO_H_
#include <asm/gpio.h>
#define STM32_GPIOS_PER_BANK 16
enum stm32_gpio_port {
STM32_GPIO_PORT_A = 0,
STM32_GPIO_PORT_B,
@ -110,5 +112,9 @@ struct stm32_gpio_regs {
struct stm32_gpio_priv {
struct stm32_gpio_regs *regs;
unsigned int gpio_range;
};
int stm32_offset_to_index(struct udevice *dev, unsigned int offset);
#endif /* _STM32_GPIO_H_ */

View File

@ -13,13 +13,10 @@
#define STM32_RCC_BASE 0x50000000
#define STM32_PWR_BASE 0x50001000
#define STM32_DBGMCU_BASE 0x50081000
#define STM32_BSEC_BASE 0x5C005000
#define STM32_TZC_BASE 0x5C006000
#define STM32_ETZPC_BASE 0x5C007000
#define STM32_TAMP_BASE 0x5C00A000
#ifdef CONFIG_DEBUG_UART_BASE
/* hardcoded value can be only used for DEBUG UART */
#define STM32_USART1_BASE 0x5C000000
#define STM32_USART2_BASE 0x4000E000
#define STM32_USART3_BASE 0x4000F000
@ -28,20 +25,28 @@
#define STM32_USART6_BASE 0x44003000
#define STM32_UART7_BASE 0x40018000
#define STM32_UART8_BASE 0x40019000
#endif
#define STM32_SYSRAM_BASE 0x2FFC0000
#define STM32_SYSRAM_SIZE SZ_256K
#define STM32_MCU_SRAM_BASE 0x30000000
#define STM32_MCU_SRAM_SIZE (3 * SZ_128K)
#define STM32_DDR_BASE 0xC0000000
#define STM32_DDR_SIZE SZ_1G
#define STM32_RETRAM_BASE 0x38000000
#define STM32_RETRAM_SIZE 0x00010000
#ifndef __ASSEMBLY__
#include <asm/types.h>
/* enumerated used to identify the SYSCON driver instance */
enum {
STM32MP_SYSCON_UNKNOWN,
STM32MP_SYSCON_STGEN,
STM32MP_SYSCON_PWR,
STM32MP_SYSCON_STGEN,
STM32MP_SYSCON_SYSCFG,
};
/*
@ -87,18 +92,38 @@ enum boot_device {
/* TAMP registers */
#define TAMP_BACKUP_REGISTER(x) (STM32_TAMP_BASE + 0x100 + 4 * x)
/* secure access */
#define TAMP_BACKUP_MAGIC_NUMBER TAMP_BACKUP_REGISTER(4)
#define TAMP_BACKUP_BRANCH_ADDRESS TAMP_BACKUP_REGISTER(5)
/* non secure access */
#define TAMP_COPRO_RSC_TBL_ADDRESS TAMP_BACKUP_REGISTER(17)
#define TAMP_BOOT_CONTEXT TAMP_BACKUP_REGISTER(20)
#define TAMP_BOOTCOUNT TAMP_BACKUP_REGISTER(21)
#define TAMP_BOOT_MODE_MASK GENMASK(15, 8)
#define TAMP_BOOT_MODE_SHIFT 8
#define TAMP_BOOT_DEVICE_MASK GENMASK(7, 4)
#define TAMP_BOOT_INSTANCE_MASK GENMASK(3, 0)
#define TAMP_BOOT_FORCED_MASK GENMASK(7, 0)
#define TAMP_BOOT_DEBUG_ON BIT(16)
enum forced_boot_mode {
BOOT_NORMAL = 0x00,
BOOT_FASTBOOT = 0x01,
BOOT_RECOVERY = 0x02,
BOOT_STM32PROG = 0x03,
BOOT_UMS_MMC0 = 0x10,
BOOT_UMS_MMC1 = 0x11,
BOOT_UMS_MMC2 = 0x12,
};
/* offset used for BSEC driver: misc_read and misc_write */
#define STM32_BSEC_SHADOW_OFFSET 0x0
#define STM32_BSEC_SHADOW(id) (STM32_BSEC_SHADOW_OFFSET + (id) * 4)
#define STM32_BSEC_OTP_OFFSET 0x80000000
#define STM32_BSEC_OTP(id) (STM32_BSEC_OTP_OFFSET + (id) * 4)
#define BSEC_OTP_BOARD 59
#endif /* __ASSEMBLY__*/
#endif /* _MACH_STM32_H_ */

View File

@ -0,0 +1,75 @@
/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */
/*
* Copyright (C) 2019, STMicroelectronics - All Rights Reserved
*/
#ifndef __STM32MP1_SMC_H__
#define __STM32MP1_SMC_H__
#include <linux/arm-smccc.h>
/*
* SMC function IDs for STM32 Service queries
* STM32 SMC services use the space between 0x82000000 and 0x8200FFFF
* like this is defined in SMC calling Convention by ARM
* for SiP (silicon Partner)
* http://infocenter.arm.com/help/topic/com.arm.doc.den0028a/index.html
*/
#define STM32_SMC_VERSION 0x82000000
/* SMC reserved for future ST services */
#define STM32_SMC_RESERVED_ST 0x82000001
/* Secure Service access from Non-secure */
#define STM32_SMC_RCC 0x82001000
#define STM32_SMC_PWR 0x82001001
#define STM32_SMC_RTC 0x82001002
#define STM32_SMC_BSEC 0x82001003
/* Register access service use for RCC/RTC/PWR */
#define STM32_SMC_REG_WRITE 0x1
#define STM32_SMC_REG_SET 0x2
#define STM32_SMC_REG_CLEAR 0x3
/* Service for BSEC */
#define STM32_SMC_READ_SHADOW 0x01
#define STM32_SMC_PROG_OTP 0x02
#define STM32_SMC_WRITE_SHADOW 0x03
#define STM32_SMC_READ_OTP 0x04
#define STM32_SMC_READ_ALL 0x05
#define STM32_SMC_WRITE_ALL 0x06
/* SMC error codes */
#define STM32_SMC_OK 0x0
#define STM32_SMC_NOT_SUPPORTED -1
#define STM32_SMC_FAILED -2
#define STM32_SMC_INVALID_PARAMS -3
#define stm32_smc_exec(svc, op, data1, data2) \
stm32_smc(svc, op, data1, data2, NULL)
#ifdef CONFIG_ARM_SMCCC
static inline u32 stm32_smc(u32 svc, u8 op, u32 data1, u32 data2, u32 *result)
{
struct arm_smccc_res res;
arm_smccc_smc(svc, op, data1, data2, 0, 0, 0, 0, &res);
if (res.a0) {
pr_err("%s: Failed to exec in secure mode (err = %ld)\n",
__func__, res.a0);
return -EINVAL;
}
if (result)
*result = (u32)res.a1;
return 0;
}
#else
static inline u32 stm32_smc(u32 svc, u8 op, u32 data1, u32 data2, u32 *result)
{
return 0;
}
#endif
#endif /* __STM32MP1_SMC_H__ */

View File

@ -3,13 +3,43 @@
* Copyright (C) 2015-2017, STMicroelectronics - All Rights Reserved
*/
#define CPU_STMP32MP15x 0x500
/* ID = Device Version (bit31:16) + Device Part Number (RPN) (bit7:0) */
#define CPU_STM32MP157Cxx 0x05000000
#define CPU_STM32MP157Axx 0x05000001
#define CPU_STM32MP153Cxx 0x05000024
#define CPU_STM32MP153Axx 0x05000025
#define CPU_STM32MP151Cxx 0x0500002E
#define CPU_STM32MP151Axx 0x0500002F
#define CPU_STM32MP157Fxx 0x05000080
#define CPU_STM32MP157Dxx 0x05000081
#define CPU_STM32MP153Fxx 0x050000A4
#define CPU_STM32MP153Dxx 0x050000A5
#define CPU_STM32MP151Fxx 0x050000AE
#define CPU_STM32MP151Dxx 0x050000AF
/* return CPU_STMP32MPxx constants */
/* return CPU_STMP32MP...Xxx constants */
u32 get_cpu_type(void);
#define CPU_REVA 0x1000
#define CPU_REVB 0x2000
#define CPU_REVZ 0x2001
/* return CPU_REV constants */
u32 get_cpu_rev(void);
/* Get Package options from OTP */
u32 get_cpu_package(void);
#define PKG_AA_LBGA448 4
#define PKG_AB_LBGA354 3
#define PKG_AC_TFBGA361 2
#define PKG_AD_TFBGA257 1
/* return boot mode */
u32 get_bootmode(void);
/* start IWDG watchdog */
int watchdog_start(void);
/* board power management : configure vddcore according OPP */
void board_vddcore_init(u32 voltage_mv);
int board_vddcore_set(void);

View File

@ -47,14 +47,14 @@ static u32 __secure stm32mp_get_gicd_base_address(void)
return (periphbase & CBAR_MASK) + GIC_DIST_OFFSET;
}
static void __secure stm32mp_smp_kick_all_cpus(void)
static void __secure stm32mp_raise_sgi0(int cpu)
{
u32 gic_dist_addr;
gic_dist_addr = stm32mp_get_gicd_base_address();
/* kick all CPUs (except this one) by writing to GICD_SGIR */
writel(1U << 24, gic_dist_addr + GICD_SGIR);
/* ask cpu with SGI0 */
writel((BIT(cpu) << 16), gic_dist_addr + GICD_SGIR);
}
void __secure psci_arch_cpu_entry(void)
@ -62,6 +62,9 @@ void __secure psci_arch_cpu_entry(void)
u32 cpu = psci_get_cpu_id();
psci_set_state(cpu, PSCI_AFFINITY_LEVEL_ON);
/* reset magic in TAMP register */
writel(0xFFFFFFFF, TAMP_BACKUP_MAGIC_NUMBER);
}
int __secure psci_features(u32 function_id, u32 psci_fid)
@ -103,7 +106,13 @@ int __secure psci_affinity_info(u32 function_id, u32 target_affinity,
int __secure psci_migrate_info_type(u32 function_id)
{
/* Trusted OS is either not present or does not require migration */
/*
* in Power_State_Coordination_Interface_PDD_v1_1_DEN0022D.pdf
* return 2 = Trusted OS is either not present or does not require
* migration, system of this type does not require the caller
* to use the MIGRATE function.
* MIGRATE function calls return NOT_SUPPORTED.
*/
return 2;
}
@ -121,6 +130,17 @@ int __secure psci_cpu_on(u32 function_id, u32 target_cpu, u32 pc,
if (psci_state[cpu] == PSCI_AFFINITY_LEVEL_ON)
return ARM_PSCI_RET_ALREADY_ON;
/* reset magic in TAMP register */
if (readl(TAMP_BACKUP_MAGIC_NUMBER))
writel(0xFFFFFFFF, TAMP_BACKUP_MAGIC_NUMBER);
/*
* ROM code need a first SGI0 after core reset
* core is ready when magic is set to 0 in ROM code
*/
while (readl(TAMP_BACKUP_MAGIC_NUMBER))
stm32mp_raise_sgi0(cpu);
/* store target PC and context id*/
psci_save(cpu, pc, context_id);
@ -136,7 +156,8 @@ int __secure psci_cpu_on(u32 function_id, u32 target_cpu, u32 pc,
writel(BOOT_API_A7_CORE0_MAGIC_NUMBER,
TAMP_BACKUP_MAGIC_NUMBER);
stm32mp_smp_kick_all_cpus();
/* Generate an IT to start the core */
stm32mp_raise_sgi0(cpu);
return ARM_PSCI_RET_SUCCESS;
}

View File

@ -8,6 +8,7 @@
#include <errno.h>
#include <regmap.h>
#include <syscon.h>
#include <asm/arch/stm32mp1_smc.h>
#include <power/pmic.h>
#include <power/regulator.h>
@ -32,13 +33,20 @@ struct stm32mp_pwr_priv {
static int stm32mp_pwr_write(struct udevice *dev, uint reg,
const uint8_t *buff, int len)
{
#ifndef CONFIG_STM32MP1_TRUSTED
struct stm32mp_pwr_priv *priv = dev_get_priv(dev);
#endif
u32 val = *(u32 *)buff;
if (len != 4)
return -EINVAL;
#ifdef CONFIG_STM32MP1_TRUSTED
return stm32_smc_exec(STM32_SMC_PWR, STM32_SMC_REG_WRITE,
STM32MP_PWR_CR3, val);
#else /* CONFIG_STM32MP1_TRUSTED */
return regmap_write(priv->regmap, STM32MP_PWR_CR3, val);
#endif /* CONFIG_STM32MP1_TRUSTED */
}
static int stm32mp_pwr_read(struct udevice *dev, uint reg, uint8_t *buff,

View File

@ -7,13 +7,24 @@
#include <dm.h>
#include <spl.h>
#include <asm/io.h>
#include <asm/arch/sys_proto.h>
#include <linux/libfdt.h>
static int spl_board_load_image(struct spl_image_info *spl_image,
struct spl_boot_device *bootdev)
{
/* TODO : add download support in SPL without TF-A */
return -1;
}
SPL_LOAD_IMAGE_METHOD("UART", 0, BOOT_DEVICE_UART, spl_board_load_image);
SPL_LOAD_IMAGE_METHOD("USB", 0, BOOT_DEVICE_USB, spl_board_load_image);
u32 spl_boot_device(void)
{
u32 boot_mode;
boot_mode = (readl(TAMP_BOOT_CONTEXT) & TAMP_BOOT_MODE_MASK) >>
TAMP_BOOT_MODE_SHIFT;
boot_mode = get_bootmode();
switch (boot_mode) {
case BOOT_FLASH_SD_1:
@ -22,6 +33,21 @@ u32 spl_boot_device(void)
case BOOT_FLASH_SD_2:
case BOOT_FLASH_EMMC_2:
return BOOT_DEVICE_MMC2;
case BOOT_SERIAL_UART_1:
case BOOT_SERIAL_UART_2:
case BOOT_SERIAL_UART_3:
case BOOT_SERIAL_UART_4:
case BOOT_SERIAL_UART_5:
case BOOT_SERIAL_UART_6:
case BOOT_SERIAL_UART_7:
case BOOT_SERIAL_UART_8:
return BOOT_DEVICE_UART;
case BOOT_SERIAL_USB_OTG:
return BOOT_DEVICE_USB;
case BOOT_FLASH_NAND_FMC:
return BOOT_DEVICE_NAND;
case BOOT_FLASH_NOR_QSPI:
return BOOT_DEVICE_SPI;
}
return BOOT_DEVICE_MMC1;
@ -44,43 +70,67 @@ int spl_boot_partition(const u32 boot_device)
}
}
#ifdef CONFIG_SPL_DISPLAY_PRINT
void spl_display_print(void)
{
DECLARE_GLOBAL_DATA_PTR;
const char *model;
/* same code than show_board_info() but not compiled for SPL
* see CONFIG_DISPLAY_BOARDINFO & common/board_info.c
*/
model = fdt_getprop(gd->fdt_blob, 0, "model", NULL);
if (model)
printf("Model: %s\n", model);
}
#endif
__weak int board_vddcore_set(void)
{
return 0;
}
void board_init_f(ulong dummy)
{
struct udevice *dev;
int ret;
int ret, clk, reset, pinctrl, power;
arch_cpu_init();
ret = spl_early_init();
if (ret) {
debug("spl_early_init() failed: %d\n", ret);
debug("%s: spl_early_init() failed: %d\n", __func__, ret);
hang();
}
ret = uclass_get_device(UCLASS_CLK, 0, &dev);
if (ret) {
debug("Clock init failed: %d\n", ret);
return;
}
clk = uclass_get_device(UCLASS_CLK, 0, &dev);
if (clk)
debug("%s: Clock init failed: %d\n", __func__, clk);
ret = uclass_get_device(UCLASS_RESET, 0, &dev);
if (ret) {
debug("Reset init failed: %d\n", ret);
return;
}
reset = uclass_get_device(UCLASS_RESET, 0, &dev);
if (reset)
debug("%s: Reset init failed: %d\n", __func__, reset);
ret = uclass_get_device(UCLASS_PINCTRL, 0, &dev);
if (ret) {
debug("%s: Cannot find pinctrl device\n", __func__);
return;
}
pinctrl = uclass_get_device(UCLASS_PINCTRL, 0, &dev);
if (pinctrl)
debug("%s: Cannot find pinctrl device: %d\n",
__func__, pinctrl);
/* enable console uart printing */
preloader_console_init();
watchdog_start();
/* change vddcore if needed after clock tree init */
power = board_vddcore_set();
if (clk || reset || pinctrl || power)
printf("%s: probe failed clk=%d reset=%d pinctrl=%d power=%d\n",
__func__, clk, reset, pinctrl, power);
ret = uclass_get_device(UCLASS_RAM, 0, &dev);
if (ret) {
debug("DRAM init failed: %d\n", ret);
return;
printf("DRAM init failed: %d\n", ret);
hang();
}
}

View File

@ -0,0 +1,139 @@
/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */
/*
* Copyright (c) 2019, STMicroelectronics - All Rights Reserved
*
*/
/*****************************************************************************
* This file is only needed for current Soc revision which has a limitation on
* debug reset halt. This can be removed when using the Soc revision that
* fixes the limitation. Anyway, this source code identifies the Soc revision
* and is only executed if it corresponds, so it can be kept on other
* revisions without any consequence.
* The revisions that need the workaround have ID values:
* - 0x2000X500
* - 0x2001X500
****************************************************************************/
#include <linux/linkage.h>
#include <asm/macro.h>
#define BIT(nr) (1 << (nr))
#define BSEC_OTP_DATA0_ADDR 0x5C005200
#define BSEC_OTP_DATA0_CLOSED BIT(6)
#define DBG_DSCR_ADDR 0x500D0088
#define DBG_DSCR_HDBGEN BIT(14)
#define RCC_DBGCFGR_ADDR 0x5000080C
#define RCC_DBGCFGR_DBGCKEN BIT(8)
#define PWR_CR1_ADDR 0x50001000
#define PWR_CR1_DBP BIT(8)
#define DBGMCU_IDC_ADDR 0x50081000
#define DBGMCU_IDC_MASK 0xFFFE0FFF
#define DBGMCU_IDC_VALUE 0x20000500
#define TAMP_BKP_REGISTER_20 (0x5C00A100 + (20 << 2))
.globl save_boot_params
ENTRY(save_boot_params)
/*
* This function is the first call after reset.
* Boot rom parameters are stored in r0..r3, so we mustn't use them
* here. And because they are saved in r9..r12 just after the
* execution of this function, we should firstly use these registers.
* And then, if more registers needed, we have to start by using
* r8, and then r7 and so on. By this way, debug will be done in
* conditions closed to the initial context.
*/
/*
* Check Sec Close bit in OTP (word 0 bit 6). If enabled, do not allow
* debug session and exit function.
*/
ldr r12, =BSEC_OTP_DATA0_ADDR
ldr r12, [r12]
ands r11, r12, #BSEC_OTP_DATA0_CLOSED
bne func_exit
/* Check Soc revision */
ldr r12, =RCC_DBGCFGR_ADDR
ldr r11, [r12] /* read RCC_DBGCFGR (r11) */
orr r10, r11, #RCC_DBGCFGR_DBGCKEN
str r10, [r12] /* update RCC_DBGCFGR */
ldr r10, =DBGMCU_IDC_ADDR
ldr r10, [r10] /* read DBGMCU_IDC (r10) */
str r11, [r12] /* restore RCC_DBGCFGR (r11) */
ldr r12, =DBGMCU_IDC_MASK
and r10, r12 /* mask reserved bits */
ldr r11, =DBGMCU_IDC_VALUE
teq r10, r11 /* test DBGMCU_IDC */
bne func_exit
/* Disable the backup domain write protection */
ldr r12, =PWR_CR1_ADDR
ldr r11, [r12]
orr r11, r11, #PWR_CR1_DBP
str r11, [r12]
poll_dbp:
ldr r11, [r12]
tst r11, #PWR_CR1_DBP
beq poll_dbp
/* Clear tamper 20 bit 16 if set */
ldr r12, =TAMP_BKP_REGISTER_20
ldr r11, [r12]
tst r11, #(BIT(16))
beq func_exit
bic r11, #(BIT(16))
str r11, [r12]
/* Re-enable the backup domain write protection */
ldr r12, =PWR_CR1_ADDR
ldr r11, [r12]
bic r11, #PWR_CR1_DBP
str r11, [r12]
poll_dbp_2:
ldr r11, [r12]
tst r11, #PWR_CR1_DBP
bne poll_dbp_2
/* Get current time + 1 second */
/* CNTFRQ */
mrc p15, 0, r12, c14, c0, 0
/* CNTPCT_64 */
mrrc p15, 0, r11, r10, c14
add r12, r12, r11
loop:
/* Check A7 DBG_DSCR HDBGEN bit value */
ldr r10, =DBG_DSCR_ADDR
ldr r10, [r10]
tst r10, #DBG_DSCR_HDBGEN
beq loop_continue
/* Sw break */
bkpt 5
/* Jump entrypoint */
b reset
loop_continue:
/* Check 1 second expiration */
mrrc p15, 0, r10, r9, c14
/* Check if MSB 64-bit increment needed */
cmp r12, r11
bmi msb_incr
cmp r12, r10
bmi func_exit
b loop
msb_incr:
cmp r12, r10
bpl loop
cmp r11, r10
bmi loop
func_exit:
b save_boot_params_ret
ENDPROC(save_boot_params)

View File

@ -9,10 +9,10 @@
#include <asm/arch/stm32.h>
static const struct udevice_id stm32mp_syscon_ids[] = {
{ .compatible = "st,stm32-stgen",
.data = STM32MP_SYSCON_STGEN },
{ .compatible = "st,stm32mp1-pwr",
.data = STM32MP_SYSCON_PWR },
{ .compatible = "st,stm32mp1-pwr", .data = STM32MP_SYSCON_PWR },
{ .compatible = "st,stm32-stgen", .data = STM32MP_SYSCON_STGEN },
{ .compatible = "st,stm32mp157-syscfg",
.data = STM32MP_SYSCON_SYSCFG },
{ }
};

View File

@ -712,6 +712,14 @@
sandbox_tee {
compatible = "sandbox,tee";
};
pinctrl {
compatible = "sandbox,pinctrl";
};
hwspinlock@0 {
compatible = "sandbox,hwspinlock";
};
};
#include "sandbox_pmic.dtsi"

View File

@ -97,6 +97,7 @@ struct sandbox_state {
/* Information about Watchdog */
struct sandbox_wdt_info wdt;
bool hwspinlock; /* Hardware Spinlock status */
ulong next_tag; /* Next address tag to allocate */
struct list_head mapmem_head; /* struct sandbox_mapmem_entry */
};

View File

@ -9,4 +9,15 @@ config SYS_VENDOR
config SYS_CONFIG_NAME
default "stm32mp1"
config CMD_STBOARD
bool "stboard - command for OTP board information"
default y
help
This compile the stboard command to
read and write the board in the OTP.
config TARGET_STM32MP157C_DK2
bool "support of STMicroelectronics STM32MP157C-DK2 Discovery Board"
default y
endif

View File

@ -2,7 +2,9 @@ STM32MP1 BOARD
M: Patrick Delaunay <patrick.delaunay@st.com>
L: uboot-stm32@st-md-mailman.stormreply.com (moderated for non-subscribers)
S: Maintained
F: board/st/stm32mp1
F: include/configs/stm32mp1.h
F: configs/stm32mp15_basic_defconfig
F: arch/arm/dts/stm32mp157*
F: board/st/stm32mp1
F: configs/stm32mp15_basic_defconfig
F: configs/stm32mp15_optee_defconfig
F: configs/stm32mp15_trusted_defconfig
F: include/configs/stm32mp1.h

View File

@ -7,6 +7,7 @@ ifdef CONFIG_SPL_BUILD
obj-y += spl.o
else
obj-y += stm32mp1.o
obj-$(CONFIG_CMD_STBOARD) += cmd_stboard.o
endif
obj-y += board.o

View File

@ -25,17 +25,21 @@ It features:
Everything is supported in Linux but U-Boot is limited to:
1. UART
2. SDCard/MMC controller (SDMMC)
3. NAND controller (FMC)
4. NOR controller (QSPI)
5. USB controller (OTG DWC2)
And the necessary drivers
1. I2C
2. STPMU1
2. STPMU1 (PMIC and regulator)
2. STPMIC1 (PMIC and regulator)
3. Clock, Reset, Sysreset
4. Fuse
Currently the following boards are supported:
+ stm32mp157c-ev1
+ stm32mp157c-ed1
+ stm32mp157a-dk1
+ stm32mp157c-dk2
3. Boot Sequences
=================
@ -45,15 +49,28 @@ BootRom => FSBL in SYSRAM => SSBL in DDR => OS (Linux Kernel)
with FSBL = First Stage Bootloader
SSBL = Second Stage Bootloader
One boot configuration is supported:
3 boot configurations are supported:
The "Basic" boot chain (defconfig_file : stm32mp15_basic_defconfig)
1) The "Trusted" boot chain (defconfig_file : stm32mp15_trusted_defconfig)
BootRom => FSBL = Trusted Firmware-A (TF-A) => SSBL = U-Boot
TF-A performs a full initialization of Secure peripherals and installs a
secure monitor.
U-Boot is running in normal world and uses TF-A monitor
to access to secure resources.
2) The "Trusted & OP-TEE" boot chain (defconfig_file : stm32mp15_optee_defconfig)
BootRom => FSBL = Trusted Firmware-A (TF-A) => SSBL = U-Boot
TF-A performs a full initialization of Secure peripherals and installs OP-TEE
from specific partitions (teeh, teed, teex).
U-Boot is running in normal world and uses OP-TEE monitor to access.
3) The "Basic" boot chain (defconfig_file : stm32mp15_basic_defconfig)
BootRom => FSBL = U-Boot SPL => SSBL = U-Boot
SPL has limited security initialisation
U-Boot is running in secure mode and provide a secure monitor to the kernel
with only PSCI support (Power State Coordination Interface defined by ARM)
with only PSCI support (Power State Coordination Interface defined by ARM).
All the STM32MP1 board supported by U-Boot use the same generic board
All the STM32MP1 boards supported by U-Boot use the same generic board
stm32mp1 which support all the bootable devices.
Each board is configurated only with the associated device tree.
@ -64,12 +81,18 @@ Each board is configurated only with the associated device tree.
You need to select the appropriate device tree for your board,
the supported device trees for stm32mp157 are:
+ ev1: eval board with pmic stpmu1 (ev1 = mother board + daughter ed1)
+ ev1: eval board with pmic stpmic1 (ev1 = mother board + daughter ed1)
dts: stm32mp157c-ev1
+ ed1: daughter board with pmic stpmu1
+ ed1: daughter board with pmic stpmic1
dts: stm32mp157c-ed1
+ dk1: Discovery board
dts: stm32mp157a-dk1
+ dk2: Discovery board = dk1 with a BT/WiFI combo and a DSI panel
dts: stm32mp157c-dk2
5. Build Procedure
==================
@ -90,29 +113,40 @@ the supported device trees for stm32mp157 are:
# export KBUILD_OUTPUT=/path/to/output
for example: use one output directory for each configuration
# export KBUILD_OUTPUT=stm32mp15_trusted
# export KBUILD_OUTPUT=stm32mp15_optee
# export KBUILD_OUTPUT=stm32mp15_basic
4. Configure the U-Boot:
you can build outside of code directory:
# export KBUILD_OUTPUT=../build/stm32mp15_trusted
4. Configure U-Boot:
# make <defconfig_file>
- For trusted boot mode : "stm32mp15_trusted_defconfig"
- For trusted & optee boot mode : "stm32mp15_optee_defconfig"
- For basic boot mode: "stm32mp15_basic_defconfig"
5. Configure the device-tree and build the U-Boot image:
# make DEVICE_TREE=<name> all
example:
basic boot on ev1
# export KBUILD_OUTPUT=stm32mp15_basic
# make stm32mp15_basic_defconfig
a) trusted boot on ev1
# export KBUILD_OUTPUT=stm32mp15_trusted
# make stm32mp15_trusted_defconfig
# make DEVICE_TREE=stm32mp157c-ev1 all
basic boot on ed1
b) trusted & OP-TEE boot on dk1
# export KBUILD_OUTPUT=stm32mp15_optee
# make stm32mp15_optee_defconfig
# make DEVICE_TREE=stm32mp157a-dk1 all
c) basic boot on dk2
# export KBUILD_OUTPUT=stm32mp15_basic
# make stm32mp15_basic_defconfig
# make DEVICE_TREE=stm32mp157c-ed1 all
# make DEVICE_TREE=stm32mp157c-dk2 all
6. Output files
@ -122,26 +156,42 @@ the supported device trees for stm32mp157 are:
So in the output directory (selected by KBUILD_OUTPUT),
you can found the needed files:
a) For Trusted boot (with or without OP-TEE)
+ FSBL = tf-a.stm32 (provided by TF-A compilation)
+ SSBL = u-boot.stm32
b) For Basic boot
+ FSBL = spl/u-boot-spl.stm32
+ SSBL = u-boot.img
6. Switch Setting for Boot Mode
===============================
You can select the boot mode, on the board ed1 with the switch SW1
You can select the boot mode,
- on the daugther board ed1 with the switch SW1 : BOOT0, BOOT1, BOOT2
- on board DK1/DK2 with the switch SW1 (BOOT1 forced to 0)
-----------------------------------
Boot Mode BOOT2 BOOT1 BOOT0
-----------------------------------
Reserved 0 0 0
NOR 0 0 1
SD-Card 1 1 1
SD-Card 1 0 1
eMMC 0 1 0
NAND 0 1 1
Recovery 1 1 0
Recovery 0 0 0
- on board DK1/DK2 with the switch SW1 : BOOT0, BOOT2
(BOOT1 forced to 0, NOR not supported)
--------------------------
Boot Mode BOOT2 BOOT0
--------------------------
Reserved 1 0
SD-Card 1 1
Recovery 0 0
Recovery is a boot from serial link (UART/USB) and it is used with
STM32CubeProgrammer tool to load executable in RAM and to update the flash
devices available on the board (NOR/NAND/eMMC/SDCARD).
@ -158,14 +208,14 @@ The minimal requirements for STMP32MP1 boot up to U-Boot are:
- one ssbl partition for U-Boot
Then the minimal GPT partition is:
----- ------- --------- -------------
| Num | Name | Size | Content |
----- ------- -------- --------------
| 1 | fsbl1 | 256 KiB | TF-A or SPL |
| 2 | fsbl2 | 256 KiB | TF-A or SPL |
| 3 | ssbl | enought | U-Boot |
| * | - | - | Boot/Rootfs|
----- ------- --------- -------------
----- ------- --------- --------------
| Num | Name | Size | Content |
----- ------- --------- --------------
| 1 | fsbl1 | 256 KiB | TF-A or SPL |
| 2 | fsbl2 | 256 KiB | TF-A or SPL |
| 3 | ssbl | enought | U-Boot |
| * | - | - | Boot/Rootfs |
----- ------- --------- --------------
(*) add bootable partition for extlinux.conf
following Generic Distribution
@ -189,7 +239,7 @@ for example: with gpt table with 128 entries
you can add other partitions for kernel
one partition rootfs for example:
-n 3:5154: -c 4:rootfs
-n 4:5154: -c 4:rootfs \
c) copy the FSBL (2 times) and SSBL file on the correct partition.
in this example in partition 1 to 3
@ -199,7 +249,12 @@ for example: with gpt table with 128 entries
# dd if=u-boot-spl.stm32 of=/dev/mmcblk0p2
# dd if=u-boot.img of=/dev/mmcblk0p3
To boot from SDCard, select BootPinMode = 1 1 1 and reset.
for trusted boot mode :
# dd if=tf-a.stm32 of=/dev/mmcblk0p1
# dd if=tf-a.stm32 of=/dev/mmcblk0p2
# dd if=u-boot.stm32 of=/dev/mmcblk0p3
To boot from SDCard, select BootPinMode = 1 0 1 and reset.
8. Prepare eMMC
===============
@ -208,7 +263,7 @@ You can use U-Boot to copy binary in eMMC.
In the next example, you need to boot from SDCARD and the images (u-boot-spl.stm32, u-boot.img)
are presents on SDCARD (mmc 0) in ext4 partition 4 (bootfs).
To boot from SDCard, select BootPinMode = 1 1 1 and reset.
To boot from SDCard, select BootPinMode = 1 0 1 and reset.
Then you update the eMMC with the next U-Boot command :
@ -250,7 +305,20 @@ Mac id storage and retrieval in stm32mp otp :
To program a MAC address on virgin OTP words above, you can use the fuse command
on bank 0 to access to internal OTP:
example to set mac address "12:34:56:78:9a:bc"
Prerequisite: check if a MAC address isn't yet programmed in OTP
1- check OTP: their value must be equal to 0
STM32MP> fuse sense 0 57 2
Sensing bank 0:
Word 0x00000039: 00000000 00000000
2- check environment variable
STM32MP> env print ethaddr
## Error: "ethaddr" not defined
Example to set mac address "12:34:56:78:9a:bc"
1- Write OTP
STM32MP> fuse prog -y 0 57 0x78563412 0x0000bc9a
@ -264,5 +332,43 @@ on bank 0 to access to internal OTP:
### Setting environment from OTP MAC address = "12:34:56:78:9a:bc"
4 check env update
STM32MP> print ethaddr
STM32MP> env print ethaddr
ethaddr=12:34:56:78:9a:bc
warning:: This MAC address provisioning can't be executed twice on the same
board as the OTP are protected. It is already done for the board
provided by STMicroelectronics.
10. Coprocessor firmware
========================
U-Boot can boot the coprocessor before the kernel (coprocessor early boot).
A/ Manuallly by using rproc commands (update the bootcmd)
Configurations
# env set name_copro "stm32mp15_m4.elf"
# env set dev_copro 0
# env set loadaddr_copro 0xC1000000
Load binary from bootfs partition (number 4) on SDCard (mmc 0)
# ext4load mmc 0:4 ${loadaddr_copro} ${name_copro}
=> ${filesize} updated with the size of the loaded file
Start M4 firmware with remote proc command
# rproc init
# rproc load ${dev_copro} ${loadaddr_copro} ${filesize}
# rproc load_rsc ${dev_copro} ${loadaddr_copro} ${filesize}
# rproc start ${dev_copro}
B/ Automatically by using FIT feature and generic DISTRO bootcmd
see examples in this directory :
Generate FIT including kernel + device tree + M4 firmware
with cfg with M4 boot
$> mkimage -f fit_copro_kernel_dtb.its fit_copro_kernel_dtb.itb
Then using DISTRO configuration file: see extlinux.conf to select
the correct configuration
=> stm32mp157c-ev1-m4
=> stm32mp157c-dk2-m4

View File

@ -8,7 +8,7 @@
#include <asm/io.h>
#include <asm/arch/ddr.h>
#include <power/pmic.h>
#include <power/stpmu1.h>
#include <power/stpmic1.h>
#ifdef CONFIG_DEBUG_UART_BOARD_INIT
void board_debug_uart_init(void)
@ -37,64 +37,189 @@ void board_debug_uart_init(void)
}
#endif
#ifdef CONFIG_PMIC_STPMU1
int board_ddr_power_init(void)
#ifdef CONFIG_PMIC_STPMIC1
u32 opp_voltage_mv;
void board_vddcore_init(u32 voltage_mv)
{
opp_voltage_mv = voltage_mv;
}
int board_vddcore_set(void)
{
struct udevice *dev;
int ret;
u32 value;
if (!opp_voltage_mv)
return 0;
ret = uclass_get_device_by_driver(UCLASS_PMIC,
DM_GET_DRIVER(pmic_stpmu1), &dev);
DM_GET_DRIVER(pmic_stpmic1), &dev);
if (ret)
return ret;
/* VDDCORE= STMPCI1 BUCK1 ramp=+25mV, 5 => 725mV, 36 => 1500mV */
value = ((opp_voltage_mv - 725) / 25) + 5;
if (value < 5)
value = 5;
if (value > 36)
value = 36;
return pmic_clrsetbits(dev,
STPMIC1_BUCKX_MAIN_CR(STPMIC1_BUCK1),
STPMIC1_BUCK_VOUT_MASK,
STPMIC1_BUCK_VOUT(value));
}
int board_ddr_power_init(enum ddr_type ddr_type)
{
struct udevice *dev;
bool buck3_at_1800000v = false;
int ret;
u32 buck2;
ret = uclass_get_device_by_driver(UCLASS_PMIC,
DM_GET_DRIVER(pmic_stpmic1), &dev);
if (ret)
/* No PMIC on board */
return 0;
/* Set LDO3 to sync mode */
ret = pmic_reg_read(dev, STPMU1_LDOX_CTRL_REG(STPMU1_LDO3));
if (ret < 0)
return ret;
switch (ddr_type) {
case STM32MP_DDR3:
/* VTT = Set LDO3 to sync mode */
ret = pmic_reg_read(dev, STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3));
if (ret < 0)
return ret;
ret &= ~STPMU1_LDO3_MODE;
ret &= ~STPMU1_LDO12356_OUTPUT_MASK;
ret |= STPMU1_LDO3_DDR_SEL << STPMU1_LDO12356_OUTPUT_SHIFT;
ret &= ~STPMIC1_LDO3_MODE;
ret &= ~STPMIC1_LDO12356_VOUT_MASK;
ret |= STPMIC1_LDO_VOUT(STPMIC1_LDO3_DDR_SEL);
ret = pmic_reg_write(dev, STPMU1_LDOX_CTRL_REG(STPMU1_LDO3),
ret);
if (ret < 0)
return ret;
ret = pmic_reg_write(dev, STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3),
ret);
if (ret < 0)
return ret;
/* Set BUCK2 to 1.35V */
ret = pmic_clrsetbits(dev,
STPMU1_BUCKX_CTRL_REG(STPMU1_BUCK2),
STPMU1_BUCK_OUTPUT_MASK,
STPMU1_BUCK2_1350000V);
if (ret < 0)
return ret;
/* VDD_DDR = Set BUCK2 to 1.35V */
ret = pmic_clrsetbits(dev,
STPMIC1_BUCKX_MAIN_CR(STPMIC1_BUCK2),
STPMIC1_BUCK_VOUT_MASK,
STPMIC1_BUCK2_1350000V);
if (ret < 0)
return ret;
/* Enable BUCK2 and VREF */
ret = pmic_clrsetbits(dev,
STPMU1_BUCKX_CTRL_REG(STPMU1_BUCK2),
STPMU1_BUCK_EN, STPMU1_BUCK_EN);
if (ret < 0)
return ret;
/* Enable VDD_DDR = BUCK2 */
ret = pmic_clrsetbits(dev,
STPMIC1_BUCKX_MAIN_CR(STPMIC1_BUCK2),
STPMIC1_BUCK_ENA, STPMIC1_BUCK_ENA);
if (ret < 0)
return ret;
mdelay(STPMU1_DEFAULT_START_UP_DELAY_MS);
mdelay(STPMIC1_DEFAULT_START_UP_DELAY_MS);
ret = pmic_clrsetbits(dev, STPMU1_VREF_CTRL_REG,
STPMU1_VREF_EN, STPMU1_VREF_EN);
if (ret < 0)
return ret;
/* Enable VREF */
ret = pmic_clrsetbits(dev, STPMIC1_REFDDR_MAIN_CR,
STPMIC1_VREF_ENA, STPMIC1_VREF_ENA);
if (ret < 0)
return ret;
mdelay(STPMU1_DEFAULT_START_UP_DELAY_MS);
mdelay(STPMIC1_DEFAULT_START_UP_DELAY_MS);
/* Enable LDO3 */
ret = pmic_clrsetbits(dev,
STPMU1_LDOX_CTRL_REG(STPMU1_LDO3),
STPMU1_LDO_EN, STPMU1_LDO_EN);
if (ret < 0)
return ret;
/* Enable VTT = LDO3 */
ret = pmic_clrsetbits(dev,
STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3),
STPMIC1_LDO_ENA, STPMIC1_LDO_ENA);
if (ret < 0)
return ret;
mdelay(STPMU1_DEFAULT_START_UP_DELAY_MS);
mdelay(STPMIC1_DEFAULT_START_UP_DELAY_MS);
break;
case STM32MP_LPDDR2_16:
case STM32MP_LPDDR2_32:
case STM32MP_LPDDR3_16:
case STM32MP_LPDDR3_32:
/*
* configure VDD_DDR1 = LDO3
* Set LDO3 to 1.8V
* + bypass mode if BUCK3 = 1.8V
* + normal mode if BUCK3 != 1.8V
*/
ret = pmic_reg_read(dev,
STPMIC1_BUCKX_MAIN_CR(STPMIC1_BUCK3));
if (ret < 0)
return ret;
if ((ret & STPMIC1_BUCK3_1800000V) == STPMIC1_BUCK3_1800000V)
buck3_at_1800000v = true;
ret = pmic_reg_read(dev, STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3));
if (ret < 0)
return ret;
ret &= ~STPMIC1_LDO3_MODE;
ret &= ~STPMIC1_LDO12356_VOUT_MASK;
ret |= STPMIC1_LDO3_1800000;
if (buck3_at_1800000v)
ret |= STPMIC1_LDO3_MODE;
ret = pmic_reg_write(dev, STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3),
ret);
if (ret < 0)
return ret;
/* VDD_DDR2 : Set BUCK2 to 1.2V (16bits) or 1.25V (32 bits)*/
switch (ddr_type) {
case STM32MP_LPDDR2_32:
case STM32MP_LPDDR3_32:
buck2 = STPMIC1_BUCK2_1250000V;
break;
default:
case STM32MP_LPDDR2_16:
case STM32MP_LPDDR3_16:
buck2 = STPMIC1_BUCK2_1200000V;
break;
}
ret = pmic_clrsetbits(dev,
STPMIC1_BUCKX_MAIN_CR(STPMIC1_BUCK2),
STPMIC1_BUCK_VOUT_MASK,
buck2);
if (ret < 0)
return ret;
/* Enable VDD_DDR1 = LDO3 */
ret = pmic_clrsetbits(dev, STPMIC1_LDOX_MAIN_CR(STPMIC1_LDO3),
STPMIC1_LDO_ENA, STPMIC1_LDO_ENA);
if (ret < 0)
return ret;
mdelay(STPMIC1_DEFAULT_START_UP_DELAY_MS);
/* Enable VDD_DDR2 =BUCK2 */
ret = pmic_clrsetbits(dev,
STPMIC1_BUCKX_MAIN_CR(STPMIC1_BUCK2),
STPMIC1_BUCK_ENA, STPMIC1_BUCK_ENA);
if (ret < 0)
return ret;
mdelay(STPMIC1_DEFAULT_START_UP_DELAY_MS);
/* Enable VREF */
ret = pmic_clrsetbits(dev, STPMIC1_REFDDR_MAIN_CR,
STPMIC1_VREF_ENA, STPMIC1_VREF_ENA);
if (ret < 0)
return ret;
mdelay(STPMIC1_DEFAULT_START_UP_DELAY_MS);
break;
default:
break;
};
return 0;
}

View File

@ -0,0 +1,145 @@
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/*
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
*/
#include <common.h>
#include <console.h>
#include <misc.h>
#include <dm/device.h>
#include <dm/uclass.h>
static bool check_stboard(u16 board)
{
unsigned int i;
const u16 st_board_id[] = {
0x1272,
0x1263,
0x1264,
0x1298,
0x1341,
0x1497,
};
for (i = 0; i < ARRAY_SIZE(st_board_id); i++)
if (board == st_board_id[i])
return true;
return false;
}
static void display_stboard(u32 otp)
{
printf("Board: MB%04x Var%d Rev.%c-%02d\n",
otp >> 16,
(otp >> 12) & 0xF,
((otp >> 8) & 0xF) - 1 + 'A',
otp & 0xF);
}
static int do_stboard(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
{
int ret;
u32 otp;
u8 revision;
unsigned long board, variant, bom;
struct udevice *dev;
int confirmed = argc == 6 && !strcmp(argv[1], "-y");
argc -= 1 + confirmed;
argv += 1 + confirmed;
if (argc != 0 && argc != 4)
return CMD_RET_USAGE;
ret = uclass_get_device_by_driver(UCLASS_MISC,
DM_GET_DRIVER(stm32mp_bsec),
&dev);
ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_BOARD),
&otp, sizeof(otp));
if (ret) {
puts("OTP read error");
return CMD_RET_FAILURE;
}
if (argc == 0) {
if (!otp)
puts("Board : OTP board FREE\n");
else
display_stboard(otp);
return CMD_RET_SUCCESS;
}
if (otp) {
display_stboard(otp);
printf("ERROR: OTP board not FREE\n");
return CMD_RET_FAILURE;
}
if (strict_strtoul(argv[0], 16, &board) < 0 ||
board == 0 || board > 0xFFFF) {
printf("argument %d invalid: %s\n", 1, argv[0]);
return CMD_RET_USAGE;
}
if (strict_strtoul(argv[1], 10, &variant) < 0 ||
variant == 0 || variant > 15) {
printf("argument %d invalid: %s\n", 2, argv[1]);
return CMD_RET_USAGE;
}
revision = argv[2][0] - 'A' + 1;
if (strlen(argv[2]) > 1 || revision == 0 || revision > 15) {
printf("argument %d invalid: %s\n", 3, argv[2]);
return CMD_RET_USAGE;
}
if (strict_strtoul(argv[3], 10, &bom) < 0 ||
bom == 0 || bom > 15) {
printf("argument %d invalid: %s\n", 4, argv[3]);
return CMD_RET_USAGE;
}
otp = (board << 16) | (variant << 12) | (revision << 8) | bom;
display_stboard(otp);
printf("=> OTP[%d] = %08X\n", BSEC_OTP_BOARD, otp);
if (!check_stboard((u16)board)) {
printf("Unknown board MB%04x\n", (u16)board);
return CMD_RET_FAILURE;
}
if (!confirmed) {
printf("Warning: Programming BOARD in OTP is irreversible!\n");
printf("Really perform this OTP programming? <y/N>\n");
if (!confirm_yesno()) {
puts("BOARD programming aborted\n");
return CMD_RET_FAILURE;
}
}
ret = misc_write(dev, STM32_BSEC_OTP(BSEC_OTP_BOARD),
&otp, sizeof(otp));
if (ret) {
puts("BOARD programming error\n");
return CMD_RET_FAILURE;
}
puts("BOARD programming done\n");
return CMD_RET_SUCCESS;
}
U_BOOT_CMD(stboard, 6, 0, do_stboard,
"read/write board reference in OTP",
"\n"
" Print current board information\n"
"stboard [-y] <Board> <Variant> <Revision> <BOM>\n"
" Write board information\n"
" - Board: xxxx, example 1264 for MB1264\n"
" - Variant: 1 ... 15\n"
" - Revision: A...O\n"
" - BOM: 1...15\n");

View File

@ -0,0 +1,20 @@
# Generic Distro Configuration for STM32MP157
menu title Select the boot mode
TIMEOUT 20
DEFAULT stm32mp157c-ev1
LABEL stm32mp157c-ev1
KERNEL /fit_kernel_dtb.itb#ev1
APPEND root=/dev/mmcblk0p6 rootwait rw earlyprintk console=ttyS3,115200
LABEL stm32mp157c-ev1-m4
KERNEL /fit_copro_kernel_dtb.itb#ev1-m4
APPEND root=/dev/mmcblk0p6 rootwait rw earlyprintk console=ttyS3,115200
LABEL stm32mp157c-dk2
KERNEL /fit_kernel_dtb.itb#dk2
APPEND root=/dev/mmcblk0p6 rootwait rw earlyprintk console=ttyS3,115200
LABEL stm32mp157c-dk2-m4
KERNEL /fit_copro_kernel_dtb.itb#dk2-m4
APPEND root=/dev/mmcblk0p6 rootwait rw earlyprintk console=ttyS3,115200

View File

@ -0,0 +1,103 @@
/*
* Compilation:
* mkimage -f fit_copro_kernel_dtb.its fit_copro_kernel_dtb.itb
*/
/dts-v1/;
/ {
description = "U-Boot fitImage for stm32mp157";
#address-cells = <1>;
images {
copro {
description = "M4 copro";
data = /incbin/("stm32mp15_m4.elf");
type = "stm32copro";
arch = "arm";
compression = "none";
load = <0xC0800000>;
hash-1 {
algo = "sha1";
};
};
kernel {
description = "Linux kernel";
data = /incbin/("zImage");
type = "kernel";
arch = "arm";
os = "linux";
compression = "none";
load = <0xC0008000>;
entry = <0xC0008000>;
hash-1 {
algo = "sha1";
};
};
fdt-dk2 {
description = "FDT dk2";
data = /incbin/("stm32mp157c-dk2.dtb");
type = "flat_dt";
arch = "arm";
compression = "none";
hash-1 {
algo = "sha1";
};
};
fdt-ev1 {
description = "FDT ev1";
data = /incbin/("stm32mp157c-ev1.dtb");
type = "flat_dt";
arch = "arm";
compression = "none";
hash-1 {
algo = "sha1";
};
};
};
configurations {
default = "dk2-m4";
dk2-m4 {
description = "dk2-m4";
loadables = "copro";
kernel = "kernel";
fdt = "fdt-dk2";
hash-1 {
algo = "sha1";
};
};
dk2 {
description = "dk2";
kernel = "kernel";
fdt = "fdt-dk2";
hash-1 {
algo = "sha1";
};
};
ev1-m4 {
description = "ev1-m4";
loadables = "copro";
kernel = "kernel";
fdt = "fdt-ev1";
hash-1 {
algo = "sha1";
};
};
ev1 {
description = "ev1";
kernel = "kernel";
fdt = "fdt-ev1";
hash-1 {
algo = "sha1";
};
};
};
};

View File

@ -0,0 +1,82 @@
/*
* Compilation:
* mkimage -f fit_kernel_dtb.its fit_kernel_dtb.itb
*
* Files in linux build dir:
* - arch/arm/boot/zImage
* - arch/arm/boot/dts/stm32mp157c-dk2.dtb
* - arch/arm/boot/dts/stm32mp157c-ev1.dtb
*
* load mmc 0:4 $kernel_addr_r fit_kernel_dtb.itb
* bootm $kernel_addr_r
* bootm $kernel_addr_r#dk2
* bootm $kernel_addr_r#ev1
*
* or use extlinux.conf in this directory
*/
/dts-v1/;
/ {
description = "U-Boot fitImage for stm32mp157";
#address-cells = <1>;
images {
kernel {
description = "Linux kernel";
data = /incbin/("zImage");
type = "kernel";
arch = "arm";
os = "linux";
compression = "none";
load = <0xC0008000>;
entry = <0xC0008000>;
hash-1 {
algo = "sha1";
};
};
fdt-dk2 {
description = "FDT dk2";
data = /incbin/("stm32mp157c-dk2.dtb");
type = "flat_dt";
arch = "arm";
compression = "none";
hash-1 {
algo = "sha1";
};
};
fdt-ev1 {
description = "FDT ev1";
data = /incbin/("stm32mp157c-ev1.dtb");
type = "flat_dt";
arch = "arm";
compression = "none";
hash-1 {
algo = "sha1";
};
};
};
configurations {
default = "dk2";
dk2 {
description = "dk2";
kernel = "kernel";
fdt = "fdt-dk2";
hash-1 {
algo = "sha1";
};
};
ev1 {
description = "ev1";
kernel = "kernel";
fdt = "fdt-ev1";
hash-1 {
algo = "sha1";
};
};
};
};

View File

@ -9,24 +9,37 @@
#include <dm.h>
#include <ram.h>
#include <asm/io.h>
#include <post.h>
#include <power/pmic.h>
#include <power/stpmu1.h>
#include <power/stpmic1.h>
#include <asm/arch/ddr.h>
void spl_board_init(void)
{
/* Keep vdd on during the reset cycle */
#if defined(CONFIG_PMIC_STPMU1) && defined(CONFIG_SPL_POWER_SUPPORT)
#if defined(CONFIG_PMIC_STPMIC1) && defined(CONFIG_SPL_POWER_SUPPORT)
struct udevice *dev;
int ret;
ret = uclass_get_device_by_driver(UCLASS_PMIC,
DM_GET_DRIVER(pmic_stpmu1), &dev);
DM_GET_DRIVER(pmic_stpmic1), &dev);
if (!ret)
pmic_clrsetbits(dev,
STPMU1_MASK_RESET_BUCK,
STPMU1_MASK_RESET_BUCK3,
STPMU1_MASK_RESET_BUCK3);
STPMIC1_BUCKS_MRST_CR,
STPMIC1_MRST_BUCK(STPMIC1_BUCK3),
STPMIC1_MRST_BUCK(STPMIC1_BUCK3));
/* Check if debug is enabled to program PMIC according to the bit */
if ((readl(TAMP_BOOT_CONTEXT) & TAMP_BOOT_DEBUG_ON) && !ret) {
printf("Keep debug unit ON\n");
pmic_clrsetbits(dev, STPMIC1_BUCKS_MRST_CR,
STPMIC1_MRST_BUCK_DEBUG,
STPMIC1_MRST_BUCK_DEBUG);
if (STPMIC1_MRST_LDO_DEBUG)
pmic_clrsetbits(dev, STPMIC1_LDOS_MRST_CR,
STPMIC1_MRST_LDO_DEBUG,
STPMIC1_MRST_LDO_DEBUG);
}
#endif
}

File diff suppressed because it is too large Load Diff

View File

@ -953,6 +953,14 @@ config CMD_PCMCIA
about 1990. These devices are typically removable memory or network
cards using a standard 68-pin connector.
config CMD_PINMUX
bool "pinmux - show pins muxing"
default y if PINCTRL
help
Parse all available pin-controllers and show pins muxing. This
is useful for debug purpoer to check the pin muxing and to know if
a pin is configured as a GPIO or as an alternate function.
config CMD_POWEROFF
bool "poweroff"
help

View File

@ -103,6 +103,7 @@ ifdef CONFIG_PCI
obj-$(CONFIG_CMD_PCI) += pci.o
endif
obj-y += pcmcia.o
obj-$(CONFIG_CMD_PINMUX) += pinmux.o
obj-$(CONFIG_CMD_PXE) += pxe.o
obj-$(CONFIG_CMD_WOL) += wol.o
obj-$(CONFIG_CMD_QFW) += qfw.o

View File

@ -35,7 +35,7 @@ static int do_adc_info(cmd_tbl_t *cmdtp, int flag, int argc,
char *const argv[])
{
struct udevice *dev;
unsigned int data_mask;
unsigned int data_mask, ch_mask;
int ret, vss, vdd;
if (argc < 2)
@ -49,6 +49,10 @@ static int do_adc_info(cmd_tbl_t *cmdtp, int flag, int argc,
printf("ADC Device '%s' :\n", argv[1]);
ret = adc_channel_mask(dev, &ch_mask);
if (!ret)
printf("channel mask: %x\n", ch_mask);
ret = adc_data_mask(dev, &data_mask);
if (!ret)
printf("data mask: %x\n", data_mask);
@ -67,8 +71,9 @@ static int do_adc_info(cmd_tbl_t *cmdtp, int flag, int argc,
static int do_adc_single(cmd_tbl_t *cmdtp, int flag, int argc,
char *const argv[])
{
struct udevice *dev;
unsigned int data;
int ret;
int ret, uV;
if (argc < 3)
return CMD_RET_USAGE;
@ -81,7 +86,62 @@ static int do_adc_single(cmd_tbl_t *cmdtp, int flag, int argc,
return CMD_RET_FAILURE;
}
printf("%u\n", data);
ret = uclass_get_device_by_name(UCLASS_ADC, argv[1], &dev);
if (!ret && !adc_raw_to_uV(dev, data, &uV))
printf("%u, %d uV\n", data, uV);
else
printf("%u\n", data);
return CMD_RET_SUCCESS;
}
static int do_adc_scan(cmd_tbl_t *cmdtp, int flag, int argc,
char *const argv[])
{
struct adc_channel ch[ADC_MAX_CHANNEL];
struct udevice *dev;
unsigned int ch_mask;
int i, chan, ret, uV;
if (argc < 2)
return CMD_RET_USAGE;
ret = uclass_get_device_by_name(UCLASS_ADC, argv[1], &dev);
if (ret) {
pr_err("Can't get the ADC %s: %d\n", argv[1], ret);
return CMD_RET_FAILURE;
}
switch (argc) {
case 3:
ch_mask = simple_strtoul(argv[2], NULL, 0);
if (ch_mask)
break;
case 2:
ret = adc_channel_mask(dev, &ch_mask);
if (ret) {
pr_err("Can't get mask for %s: %d\n", dev->name, ret);
return CMD_RET_FAILURE;
}
break;
}
ret = adc_channels_single_shot(dev->name, ch_mask, ch);
if (ret) {
pr_err("Can't get single shot for %s (chans mask: 0x%x): %d\n",
dev->name, ch_mask, ret);
return CMD_RET_FAILURE;
}
for (chan = 0, i = 0; chan < ADC_MAX_CHANNEL; chan++) {
if (!(ch_mask & ADC_CHANNEL(chan)))
continue;
if (!adc_raw_to_uV(dev, ch[i].data, &uV))
printf("[%02d]: %u, %d uV\n", ch[i].id, ch[i].data, uV);
else
printf("[%02d]: %u\n", ch[i].id, ch[i].data);
i++;
}
return CMD_RET_SUCCESS;
}
@ -90,6 +150,7 @@ static cmd_tbl_t cmd_adc_sub[] = {
U_BOOT_CMD_MKENT(list, 1, 1, do_adc_list, "", ""),
U_BOOT_CMD_MKENT(info, 2, 1, do_adc_info, "", ""),
U_BOOT_CMD_MKENT(single, 3, 1, do_adc_single, "", ""),
U_BOOT_CMD_MKENT(scan, 3, 1, do_adc_scan, "", ""),
};
static int do_adc(cmd_tbl_t *cmdtp, int flag, int argc,
@ -115,6 +176,7 @@ static int do_adc(cmd_tbl_t *cmdtp, int flag, int argc,
static char adc_help_text[] =
"list - list ADC devices\n"
"adc info <name> - Get ADC device info\n"
"adc single <name> <channel> - Get Single data of ADC device channel";
"adc single <name> <channel> - Get Single data of ADC device channel\n"
"adc scan <name> [channel mask] - Scan all [or masked] ADC channels";
U_BOOT_CMD(adc, 4, 1, do_adc, "ADC sub-system", adc_help_text);

View File

@ -124,8 +124,14 @@ static int do_bmp_display(cmd_tbl_t * cmdtp, int flag, int argc, char * const ar
break;
case 4:
addr = simple_strtoul(argv[1], NULL, 16);
x = simple_strtoul(argv[2], NULL, 10);
y = simple_strtoul(argv[3], NULL, 10);
if (!strcmp(argv[2], "m"))
x = BMP_ALIGN_CENTER;
else
x = simple_strtoul(argv[2], NULL, 10);
if (!strcmp(argv[3], "m"))
y = BMP_ALIGN_CENTER;
else
y = simple_strtoul(argv[3], NULL, 10);
break;
default:
return CMD_RET_USAGE;
@ -249,9 +255,11 @@ int bmp_display(ulong addr, int x, int y)
if (!ret) {
bool align = false;
# ifdef CONFIG_SPLASH_SCREEN_ALIGN
align = true;
# endif /* CONFIG_SPLASH_SCREEN_ALIGN */
if (CONFIG_IS_ENABLED(SPLASH_SCREEN_ALIGN) ||
x == BMP_ALIGN_CENTER ||
y == BMP_ALIGN_CENTER)
align = true;
ret = video_bmp_display(dev, addr, x, y, align);
}
#elif defined(CONFIG_LCD)

View File

@ -190,13 +190,13 @@ static efi_status_t copy_fdt(ulong *fdt_addrp, ulong *fdt_sizep)
/* Safe fdt location is at 127MB */
new_fdt_addr = fdt_ram_start + (127 * 1024 * 1024) + fdt_size;
ret = efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS,
EFI_RUNTIME_SERVICES_DATA, fdt_pages,
EFI_BOOT_SERVICES_DATA, fdt_pages,
&new_fdt_addr);
if (ret != EFI_SUCCESS) {
/* If we can't put it there, put it somewhere */
new_fdt_addr = (ulong)memalign(EFI_PAGE_SIZE, fdt_size);
ret = efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS,
EFI_RUNTIME_SERVICES_DATA, fdt_pages,
EFI_BOOT_SERVICES_DATA, fdt_pages,
&new_fdt_addr);
if (ret != EFI_SUCCESS) {
printf("ERROR: Failed to reserve space for FDT\n");
@ -625,7 +625,7 @@ void efi_set_bootdev(const char *dev, const char *devnr, const char *path)
part = blk_get_device_part_str(dev, devnr, &desc, &fs_partition,
1);
if (part < 0)
if (part < 0 || !desc)
return;
bootefi_device_path = efi_dp_from_part(desc, part);

View File

@ -98,10 +98,52 @@ static int do_dtimg_size(cmd_tbl_t *cmdtp, int flag, int argc,
return dtimg_get_fdt(argc, argv, CMD_DTIMG_SIZE);
}
static int do_dtimg_getindex(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
{
char *endp;
ulong hdr_addr;
int index;
char buf[512] = { 0 };
if (argc < 4)
return CMD_RET_USAGE;
hdr_addr = simple_strtoul(argv[1], &endp, 16);
if (*endp != '\0') {
printf("Error: Wrong image address\n");
return CMD_RET_FAILURE;
}
if (!android_dt_check_header(hdr_addr)) {
printf("Error: DT image header is incorrect\n");
return CMD_RET_FAILURE;
}
index = android_dt_get_index(hdr_addr, strtoul(argv[2], NULL, 0),
strtoul(argv[3], NULL, 0));
if (index < 0) {
printf("Error: board id %04lx not found in DT table\n",
strtoul(argv[2], NULL, 0));
return CMD_RET_FAILURE;
}
snprintf(buf, sizeof(buf), "%i", index);
if (argc == 5)
env_set(argv[4], buf);
else
printf("%s\n", buf);
return CMD_RET_SUCCESS;
}
static cmd_tbl_t cmd_dtimg_sub[] = {
U_BOOT_CMD_MKENT(dump, 2, 0, do_dtimg_dump, "", ""),
U_BOOT_CMD_MKENT(start, 4, 0, do_dtimg_start, "", ""),
U_BOOT_CMD_MKENT(size, 4, 0, do_dtimg_size, "", ""),
U_BOOT_CMD_MKENT(getindex, 5, 0, do_dtimg_getindex, "", ""),
};
static int do_dtimg(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
@ -137,5 +179,11 @@ U_BOOT_CMD(
" - get size (hex, bytes) of FDT in the image, by index\n"
" <addr>: image address in RAM, in hex\n"
" <index>: index of desired FDT in the image\n"
" <varname>: name of variable where to store size of FDT"
" <varname>: name of variable where to store size of FDT\n"
"dtimg getindex <addr> <board_id> <board_rev> [varname]\n"
" - get index of FDT in the image, by board identifier and revision\n"
" <addr>: image address in RAM, in hex\n"
" <board_id>: board identifier\n"
" <board_rev>: board revision (0 if not used)\n"
" [varname]: name of variable where to store index of FDT"
);

View File

@ -13,6 +13,7 @@
#include <fastboot.h>
#include <net.h>
#include <usb.h>
#include <watchdog.h>
static int do_fastboot_udp(int argc, char *const argv[],
uintptr_t buf_addr, size_t buf_size)
@ -74,6 +75,7 @@ static int do_fastboot_usb(int argc, char *const argv[],
break;
if (ctrlc())
break;
WATCHDOG_RESET();
usb_gadget_handle_interrupts(controller_index);
}

View File

@ -39,18 +39,24 @@
DECLARE_GLOBAL_DATA_PTR;
#if !defined(CONFIG_ENV_IS_IN_EEPROM) && \
!defined(CONFIG_ENV_IS_IN_FLASH) && \
!defined(CONFIG_ENV_IS_IN_MMC) && \
!defined(CONFIG_ENV_IS_IN_FAT) && \
!defined(CONFIG_ENV_IS_IN_EXT4) && \
!defined(CONFIG_ENV_IS_IN_NAND) && \
!defined(CONFIG_ENV_IS_IN_NVRAM) && \
!defined(CONFIG_ENV_IS_IN_ONENAND) && \
!defined(CONFIG_ENV_IS_IN_SATA) && \
!defined(CONFIG_ENV_IS_IN_SPI_FLASH) && \
!defined(CONFIG_ENV_IS_IN_REMOTE) && \
!defined(CONFIG_ENV_IS_IN_UBI) && \
#if defined(CONFIG_ENV_IS_IN_EEPROM) || \
defined(CONFIG_ENV_IS_IN_FLASH) || \
defined(CONFIG_ENV_IS_IN_MMC) || \
defined(CONFIG_ENV_IS_IN_FAT) || \
defined(CONFIG_ENV_IS_IN_EXT4) || \
defined(CONFIG_ENV_IS_IN_NAND) || \
defined(CONFIG_ENV_IS_IN_NVRAM) || \
defined(CONFIG_ENV_IS_IN_ONENAND) || \
defined(CONFIG_ENV_IS_IN_SATA) || \
defined(CONFIG_ENV_IS_IN_SPI_FLASH) || \
defined(CONFIG_ENV_IS_IN_REMOTE) || \
defined(CONFIG_ENV_IS_IN_UBI)
#define ENV_IS_IN_DEVICE
#endif
#if !defined(ENV_IS_IN_DEVICE) && \
!defined(CONFIG_ENV_IS_NOWHERE)
# error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|MMC|FAT|EXT4|\
NAND|NVRAM|ONENAND|SATA|SPI_FLASH|REMOTE|UBI} or CONFIG_ENV_IS_NOWHERE
@ -738,7 +744,7 @@ ulong env_get_ulong(const char *name, int base, ulong default_val)
}
#ifndef CONFIG_SPL_BUILD
#if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
#if defined(CONFIG_CMD_SAVEENV) && defined(ENV_IS_IN_DEVICE)
static int do_env_save(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
{
@ -1194,7 +1200,7 @@ static cmd_tbl_t cmd_env_sub[] = {
#if defined(CONFIG_CMD_RUN)
U_BOOT_CMD_MKENT(run, CONFIG_SYS_MAXARGS, 1, do_run, "", ""),
#endif
#if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
#if defined(CONFIG_CMD_SAVEENV) && defined(ENV_IS_IN_DEVICE)
U_BOOT_CMD_MKENT(save, 1, 0, do_env_save, "", ""),
#endif
U_BOOT_CMD_MKENT(set, CONFIG_SYS_MAXARGS, 0, do_env_set, "", ""),
@ -1266,7 +1272,7 @@ static char env_help_text[] =
#if defined(CONFIG_CMD_RUN)
"env run var [...] - run commands in an environment variable\n"
#endif
#if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
#if defined(CONFIG_CMD_SAVEENV) && defined(ENV_IS_IN_DEVICE)
"env save - save environment\n"
#endif
"env set [-f] name [arg ...]\n";

View File

@ -24,6 +24,7 @@
enum cmd_part_info {
CMD_PART_INFO_START = 0,
CMD_PART_INFO_SIZE,
CMD_PART_INFO_NB,
};
static int do_part_uuid(int argc, char * const argv[])
@ -149,6 +150,9 @@ static int do_part_info(int argc, char * const argv[], enum cmd_part_info param)
case CMD_PART_INFO_SIZE:
snprintf(buf, sizeof(buf), LBAF, info.size);
break;
case CMD_PART_INFO_NB:
snprintf(buf, sizeof(buf), "%i", part);
break;
default:
printf("** Unknown cmd_part_info value: %d\n", param);
return 1;
@ -172,6 +176,11 @@ static int do_part_size(int argc, char * const argv[])
return do_part_info(argc, argv, CMD_PART_INFO_SIZE);
}
static int do_part_nb(int argc, char * const argv[])
{
return do_part_info(argc, argv, CMD_PART_INFO_NB);
}
static int do_part(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
if (argc < 2)
@ -185,6 +194,8 @@ static int do_part(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return do_part_start(argc - 2, argv + 2);
else if (!strcmp(argv[1], "size"))
return do_part_size(argc - 2, argv + 2);
else if (!strcmp(argv[1], "nb"))
return do_part_nb(argc - 2, argv + 2);
return CMD_RET_USAGE;
}
@ -206,5 +217,8 @@ U_BOOT_CMD(
" part can be either partition number or partition name\n"
"part size <interface> <dev> <part> <varname>\n"
" - set environment variable to the size of the partition (in blocks)\n"
" part can be either partition number or partition name"
" part can be either partition number or partition name\n"
"part nb <interface> <dev> <part> <varname>\n"
" - set environment variable to the number of the partition\n"
" part shall be the partition name"
);

147
cmd/pinmux.c Normal file
View File

@ -0,0 +1,147 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
*/
#include <common.h>
#include <command.h>
#include <dm.h>
#include <errno.h>
#include <dm/pinctrl.h>
#include <dm/uclass-internal.h>
#define LIMIT_DEVNAME 30
static struct udevice *currdev;
static int do_dev(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
const char *name;
int ret;
switch (argc) {
case 2:
name = argv[1];
ret = uclass_get_device_by_name(UCLASS_PINCTRL, name, &currdev);
if (ret) {
printf("Can't get the pin-controller: %s!\n", name);
return CMD_RET_FAILURE;
}
/* fall through */
case 1:
if (!currdev) {
printf("Pin-controller device is not set!\n");
return CMD_RET_USAGE;
}
printf("dev: %s\n", currdev->name);
}
return CMD_RET_SUCCESS;
}
static int show_pinmux(struct udevice *dev)
{
char pin_name[PINNAME_SIZE];
char pin_mux[PINMUX_SIZE];
int pins_count;
int i;
int ret;
pins_count = pinctrl_get_pins_count(dev);
if (pins_count == -ENOSYS) {
printf("Ops get_pins_count not supported\n");
return pins_count;
}
for (i = 0; i < pins_count; i++) {
ret = pinctrl_get_pin_name(dev, i, pin_name, PINNAME_SIZE);
if (ret == -ENOSYS) {
printf("Ops get_pin_name not supported\n");
return ret;
}
ret = pinctrl_get_pin_muxing(dev, i, pin_mux, PINMUX_SIZE);
if (ret) {
printf("Ops get_pin_muxing error (%d)\n", ret);
return ret;
}
printf("%-*s: %-*s\n", PINNAME_SIZE, pin_name,
PINMUX_SIZE, pin_mux);
}
return 0;
}
static int do_status(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
struct udevice *dev;
int ret = CMD_RET_USAGE;
if (currdev && (argc < 2 || strcmp(argv[1], "-a")))
return show_pinmux(currdev);
if (argc < 2 || strcmp(argv[1], "-a"))
return ret;
uclass_foreach_dev_probe(UCLASS_PINCTRL, dev) {
/* insert a separator between each pin-controller display */
printf("--------------------------\n");
printf("%s:\n", dev->name);
ret = show_pinmux(dev);
if (ret < 0)
printf("Can't display pin muxing for %s\n",
dev->name);
}
return ret;
}
static int do_list(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
struct udevice *dev;
printf("| %-*.*s| %-*.*s| %s\n",
LIMIT_DEVNAME, LIMIT_DEVNAME, "Device",
LIMIT_DEVNAME, LIMIT_DEVNAME, "Driver",
"Parent");
uclass_foreach_dev_probe(UCLASS_PINCTRL, dev) {
printf("| %-*.*s| %-*.*s| %s\n",
LIMIT_DEVNAME, LIMIT_DEVNAME, dev->name,
LIMIT_DEVNAME, LIMIT_DEVNAME, dev->driver->name,
dev->parent->name);
}
return CMD_RET_SUCCESS;
}
static cmd_tbl_t pinmux_subcmd[] = {
U_BOOT_CMD_MKENT(dev, 2, 1, do_dev, "", ""),
U_BOOT_CMD_MKENT(list, 1, 1, do_list, "", ""),
U_BOOT_CMD_MKENT(status, 2, 1, do_status, "", ""),
};
static int do_pinmux(cmd_tbl_t *cmdtp, int flag, int argc,
char * const argv[])
{
cmd_tbl_t *cmd;
argc--;
argv++;
cmd = find_cmd_tbl(argv[0], pinmux_subcmd, ARRAY_SIZE(pinmux_subcmd));
if (!cmd || argc > cmd->maxargs)
return CMD_RET_USAGE;
return cmd->cmd(cmdtp, flag, argc, argv);
}
U_BOOT_CMD(pinmux, CONFIG_SYS_MAXARGS, 1, do_pinmux,
"show pin-controller muxing",
"list - list UCLASS_PINCTRL devices\n"
"pinmux dev [pincontroller-name] - select pin-controller device\n"
"pinmux status [-a] - print pin-controller muxing [for all]\n"
)

View File

@ -8,11 +8,13 @@
#include <command.h>
#include <malloc.h>
#include <mapmem.h>
#include <lcd.h>
#include <linux/string.h>
#include <linux/ctype.h>
#include <errno.h>
#include <linux/list.h>
#include <fs.h>
#include <splash.h>
#include <asm/io.h>
#include "menu.h"
@ -488,6 +490,7 @@ struct pxe_label {
*
* title - the name of the menu as given by a 'menu title' line.
* default_label - the name of the default label, if any.
* bmp - the bmp file name which is displayed in background
* timeout - time in tenths of a second to wait for a user key-press before
* booting the default label.
* prompt - if 0, don't prompt for a choice unless the timeout period is
@ -498,6 +501,7 @@ struct pxe_label {
struct pxe_menu {
char *title;
char *default_label;
char *bmp;
int timeout;
int prompt;
struct list_head labels;
@ -850,6 +854,7 @@ enum token_type {
T_FDTDIR,
T_ONTIMEOUT,
T_IPAPPEND,
T_BACKGROUND,
T_INVALID
};
@ -883,6 +888,7 @@ static const struct token keywords[] = {
{"fdtdir", T_FDTDIR},
{"ontimeout", T_ONTIMEOUT,},
{"ipappend", T_IPAPPEND,},
{"background", T_BACKGROUND,},
{NULL, T_INVALID}
};
@ -1160,6 +1166,10 @@ static int parse_menu(cmd_tbl_t *cmdtp, char **c, struct pxe_menu *cfg,
nest_level + 1);
break;
case T_BACKGROUND:
err = parse_sliteral(c, &cfg->bmp);
break;
default:
printf("Ignoring malformed menu command: %.*s\n",
(int)(*c - s), s);
@ -1574,6 +1584,20 @@ static void handle_pxe_menu(cmd_tbl_t *cmdtp, struct pxe_menu *cfg)
struct menu *m;
int err;
#ifdef CONFIG_CMD_BMP
/* display BMP if available */
if (cfg->bmp) {
if (get_relfile(cmdtp, cfg->bmp, load_addr)) {
run_command("cls", 0);
bmp_display(load_addr,
BMP_ALIGN_CENTER, BMP_ALIGN_CENTER);
} else {
printf("Skipping background bmp %s for failure\n",
cfg->bmp);
}
}
#endif
m = pxe_menu_to_menu(cfg);
if (!m)
return;

View File

@ -103,7 +103,7 @@ static int do_remoteproc_list(cmd_tbl_t *cmdtp, int flag, int argc,
}
/**
* do_remoteproc_load() - Load a remote processor with binary image
* do_remoteproc_load() - Load a remote processor with binary or elf image
* @cmdtp: unused
* @flag: unused
* @argc: argument count for the load function
@ -142,6 +142,49 @@ static int do_remoteproc_load(cmd_tbl_t *cmdtp, int flag, int argc,
return ret ? CMD_RET_FAILURE : 0;
}
/**
* do_remoteproc_load_rsc_table() - Get resource table from an elf image
* @cmdtp: unused
* @flag: unused
* @argc: argument count for the load function
* @argv: arguments for the load function
*
* Return: 0 if no error, else returns appropriate error value.
*/
static int do_remoteproc_load_rsc_table(cmd_tbl_t *cmdtp, int flag, int argc,
char *const argv[])
{
ulong addr, size, rsc_addr;
unsigned int rsc_size;
int id, ret;
if (argc != 4)
return CMD_RET_USAGE;
id = (int)simple_strtoul(argv[1], NULL, 3);
addr = simple_strtoul(argv[2], NULL, 16);
size = simple_strtoul(argv[3], NULL, 16);
if (!size) {
printf("\t Expect some size??\n");
return CMD_RET_USAGE;
}
if (!rproc_is_initialized()) {
printf("\tRemote Processors are not initialized\n");
return CMD_RET_USAGE;
}
ret = rproc_load_rsc_table(id, addr, size, &rsc_addr, &rsc_size);
printf("Remote Processor %d resource table %s : 0x%08lx-0x%x\n",
id, ret ? "Not found" : "Found", ret ? 0 : rsc_addr,
ret ? 0 : rsc_size);
return ret ? CMD_RET_FAILURE : 0;
}
/**
* do_remoteproc_wrapper() - wrapper for various rproc commands
* @cmdtp: unused
@ -172,6 +215,9 @@ static int do_remoteproc_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
if (!strcmp(argv[0], "start")) {
ret = rproc_start(id);
if (!ret)
env_set("copro_state", "booted");
} else if (!strcmp(argv[0], "stop")) {
ret = rproc_stop(id);
} else if (!strcmp(argv[0], "reset")) {
@ -213,6 +259,12 @@ static cmd_tbl_t cmd_remoteproc_sub[] = {
"- id: ID of the remote processor(see 'list' cmd)\n"
"- addr: Address in memory of the image to loadup\n"
"- size: Size of the image to loadup\n"),
U_BOOT_CMD_MKENT(load_rsc, 5, 1, do_remoteproc_load_rsc_table,
"Load resource table address from remote processor provided image",
"<id> [addr] [size]\n"
"- id: ID of the remote processor(see 'list' cmd)\n"
"- addr: Address in memory of the image\n"
"- size: Size of the image\n"),
U_BOOT_CMD_MKENT(start, 1, 1, do_remoteproc_wrapper,
"Start remote processor",
"id - ID of the remote processor (see 'list' cmd)\n"),
@ -272,8 +324,10 @@ U_BOOT_CMD(rproc, 5, 1, do_remoteproc,
"\n\tSubcommands:\n"
"\tinit - Enumerate and initalize the remote processors\n"
"\tlist - list available remote processors\n"
"\tload <id> [addr] [size]- Load the remote processor with binary\n"
"\tload <id> [addr] [size]- Load the remote processor with\n"
"\t image stored at address [addr] in memory\n"
"\tload_rsc <id> [addr] [size]- Load resource table from remote\n"
"\t processor provided image at address [addr]\n"
"\tstart <id> - Start the remote processor(must be loaded)\n"
"\tstop <id> - Stop the remote processor\n"
"\treset <id> - Reset the remote processor\n"

View File

@ -81,14 +81,13 @@ static int do_spi_flash_probe(int argc, char * const argv[])
{
unsigned int bus = CONFIG_SF_DEFAULT_BUS;
unsigned int cs = CONFIG_SF_DEFAULT_CS;
/* In DM mode, defaults speed and mode will be taken from DT */
unsigned int speed = CONFIG_SF_DEFAULT_SPEED;
unsigned int mode = CONFIG_SF_DEFAULT_MODE;
char *endp;
#ifdef CONFIG_DM_SPI_FLASH
struct udevice *new, *bus_dev;
int ret;
/* In DM mode defaults will be taken from DT */
speed = 0, mode = 0;
#else
struct spi_flash *new;
#endif

View File

@ -14,6 +14,7 @@
#include <part.h>
#include <usb.h>
#include <usb_mass_storage.h>
#include <watchdog.h>
static int ums_read_sector(struct ums *ums_dev,
ulong start, lbaint_t blkcnt, void *buf)
@ -226,6 +227,8 @@ static int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
rc = CMD_RET_SUCCESS;
goto cleanup_register;
}
WATCHDOG_RESET();
}
cleanup_register:

View File

@ -116,6 +116,7 @@ endif
obj-y += cli.o
obj-$(CONFIG_FSL_DDR_INTERACTIVE) += cli_simple.o cli_readline.o
obj-$(CONFIG_STM32MP1_DDR_INTERACTIVE) += cli_simple.o cli_readline.o
obj-$(CONFIG_DFU_OVER_USB) += dfu.o
obj-y += command.o
obj-$(CONFIG_$(SPL_)LOG) += log.o

View File

@ -434,7 +434,6 @@ static int reserve_uboot(void)
debug("Reserving %ldk for U-Boot at: %08lx\n",
gd->mon_len >> 10, gd->relocaddr);
}
gd->start_addr_sp = gd->relocaddr;
return 0;

View File

@ -13,6 +13,12 @@
#include <cli.h>
#include <watchdog.h>
#ifdef CONFIG_SPL_BUILD
#undef CONFIG_CMDLINE_EDITING
#undef CONFIG_AUTO_COMPLETE
#undef CONFIG_SHOW_ACTIVITY
#endif
DECLARE_GLOBAL_DATA_PTR;
static const char erase_seq[] = "\b \b"; /* erase sequence */

View File

@ -463,6 +463,11 @@ static void print_pre_console_buffer(int flushpoint)
char buf_out[CONFIG_PRE_CON_BUF_SZ + 1];
char *buf_in;
#ifdef CONFIG_SILENT_CONSOLE
if (gd->flags & GD_FLG_SILENT)
return;
#endif
buf_in = map_sysmem(CONFIG_PRE_CON_BUF_ADDR, CONFIG_PRE_CON_BUF_SZ);
if (gd->precon_buf_idx > CONFIG_PRE_CON_BUF_SZ)
in = gd->precon_buf_idx - CONFIG_PRE_CON_BUF_SZ;
@ -511,8 +516,11 @@ void putc(const char c)
membuff_putbyte(&gd->console_out, c);
#endif
#ifdef CONFIG_SILENT_CONSOLE
if (gd->flags & GD_FLG_SILENT)
if (gd->flags & GD_FLG_SILENT) {
if (!(gd->flags & GD_FLG_DEVINIT))
pre_console_putc(c);
return;
}
#endif
#ifdef CONFIG_DISABLE_CONSOLE
@ -552,8 +560,11 @@ void puts(const char *s)
membuff_put(&gd->console_out, s, strlen(s));
#endif
#ifdef CONFIG_SILENT_CONSOLE
if (gd->flags & GD_FLG_SILENT)
if (gd->flags & GD_FLG_SILENT) {
if (!(gd->flags & GD_FLG_DEVINIT))
pre_console_puts(s);
return;
}
#endif
#ifdef CONFIG_DISABLE_CONSOLE
@ -713,14 +724,22 @@ int console_assign(int file, const char *devname)
return -1;
}
static void console_update_silent(void)
/* return true if the 'silent' flag is removed */
static bool console_update_silent(void)
{
#ifdef CONFIG_SILENT_CONSOLE
if (env_get("silent") != NULL)
if (env_get("silent") != NULL) {
gd->flags |= GD_FLG_SILENT;
else
} else {
unsigned long flags = gd->flags;
gd->flags &= ~GD_FLG_SILENT;
return !!(flags & GD_FLG_SILENT);
}
#endif
return false;
}
int console_announce_r(void)
@ -785,6 +804,13 @@ int console_init_r(void)
#if CONFIG_IS_ENABLED(CONSOLE_MUX)
int iomux_err = 0;
#endif
int flushpoint;
/* update silent for env loaded from flash (initr_env) */
if (console_update_silent())
flushpoint = PRE_CONSOLE_FLUSHPOINT1_SERIAL;
else
flushpoint = PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL;
/* set default handlers at first */
gd->jt->getc = serial_getc;
@ -862,7 +888,7 @@ done:
if ((stdio_devices[stdin] == NULL) && (stdio_devices[stdout] == NULL))
return 0;
#endif
print_pre_console_buffer(PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL);
print_pre_console_buffer(flushpoint);
return 0;
}
@ -876,8 +902,13 @@ int console_init_r(void)
struct list_head *list = stdio_get_list();
struct list_head *pos;
struct stdio_dev *dev;
int flushpoint;
console_update_silent();
/* update silent for env loaded from flash (initr_env) */
if (console_update_silent())
flushpoint = PRE_CONSOLE_FLUSHPOINT1_SERIAL;
else
flushpoint = PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL;
#ifdef CONFIG_SPLASH_SCREEN
/*
@ -940,7 +971,7 @@ int console_init_r(void)
if ((stdio_devices[stdin] == NULL) && (stdio_devices[stdout] == NULL))
return 0;
#endif
print_pre_console_buffer(PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL);
print_pre_console_buffer(flushpoint);
return 0;
}

View File

@ -153,4 +153,46 @@ void android_dt_print_contents(ulong hdr_addr)
unmap_sysmem(fdt);
}
}
#endif
/**
* Get dtb index based on board identifier and revision.
*
* @param hdr_addr Start address of DT image
* @param board_id board identifier
* @param board_rev board revision (0 if not used)
*
* @return index in dt table
*/
int android_dt_get_index(ulong hdr_addr, u32 board_id, u32 board_rev)
{
const struct dt_table_header *hdr;
u32 entry_count, entries_offset, entry_size;
u32 i;
int ret = -1;
hdr = map_sysmem(hdr_addr, sizeof(*hdr));
entry_count = fdt32_to_cpu(hdr->dt_entry_count);
entries_offset = fdt32_to_cpu(hdr->dt_entries_offset);
entry_size = fdt32_to_cpu(hdr->dt_entry_size);
unmap_sysmem(hdr);
for (i = 0; i < entry_count; ++i) {
const ulong e_addr = hdr_addr + entries_offset + i * entry_size;
const struct dt_table_entry *e;
e = map_sysmem(e_addr, sizeof(*e));
if ((fdt32_to_cpu(e->id) == board_id) &&
(board_rev == 0 || fdt32_to_cpu(e->rev) == board_rev)) {
ret = i;
unmap_sysmem(e);
break;
}
unmap_sysmem(e);
}
return ret;
}

View File

@ -166,6 +166,7 @@ static const table_entry_t uimage_type[] = {
{ IH_TYPE_FIRMWARE_IVT, "firmware_ivt", "Firmware with HABv4 IVT" },
{ IH_TYPE_PMMC, "pmmc", "TI Power Management Micro-Controller Firmware",},
{ IH_TYPE_STM32IMAGE, "stm32image", "STMicroelectronics STM32 Image" },
{ IH_TYPE_STM32COPRO, "stm32copro", "STMicroelectronics STM32 Coprocessor Image"},
{ -1, "", "", },
};

View File

@ -77,12 +77,21 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
/*
* Load U-Boot image from SPI flash into RAM
* In DM mode: defaults speed and mode will be
* taken from DT when available
*/
#ifdef CONFIG_DM_SPI_FLASH
/* In DM mode defaults will be taken from DT */
flash = spi_flash_probe(CONFIG_SF_DEFAULT_BUS,
CONFIG_SF_DEFAULT_CS,
0,
0);
#else
flash = spi_flash_probe(CONFIG_SF_DEFAULT_BUS,
CONFIG_SF_DEFAULT_CS,
CONFIG_SF_DEFAULT_SPEED,
CONFIG_SF_DEFAULT_MODE);
#endif
if (!flash) {
puts("SPI probe failed.\n");
return -ENODEV;

View File

@ -233,6 +233,8 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe,
request, requesttype, value, index, size);
dev->status = USB_ST_NOT_PROC; /*not yet processed */
mdelay(5);
err = submit_control_msg(dev, pipe, data, size, setup_packet);
if (err < 0)
return err;

View File

@ -215,3 +215,5 @@ CONFIG_UT_TIME=y
CONFIG_UT_DM=y
CONFIG_UT_ENV=y
CONFIG_UT_OVERLAY=y
CONFIG_DM_HWSPINLOCK=y
CONFIG_HWSPINLOCK_SANDBOX=y

View File

@ -1,65 +1,129 @@
CONFIG_ARM=y
CONFIG_ARCH_STM32MP=y
CONFIG_SYS_MALLOC_F_LEN=0x2000
CONFIG_SYS_MALLOC_F_LEN=0x3000
CONFIG_SPL_MMC_SUPPORT=y
CONFIG_SPL=y
CONFIG_TARGET_STM32MP1=y
CONFIG_SPL_SPI_FLASH_SUPPORT=y
CONFIG_SPL_SPI_SUPPORT=y
# CONFIG_ARMV7_VIRT is not set
CONFIG_DISTRO_DEFAULTS=y
CONFIG_NR_DRAM_BANKS=1
CONFIG_FIT=y
CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=3
CONFIG_SPL_I2C_SUPPORT=y
CONFIG_SPL_MTD_SUPPORT=y
CONFIG_SPL_POWER_SUPPORT=y
CONFIG_SYS_PROMPT="STM32MP> "
# CONFIG_CMD_BOOTD is not set
CONFIG_CMD_DTIMG=y
# CONFIG_CMD_ELF is not set
# CONFIG_CMD_IMI is not set
# CONFIG_CMD_XIMG is not set
# CONFIG_CMD_EXPORTENV is not set
# CONFIG_CMD_IMPORTENV is not set
CONFIG_CMD_MEMINFO=y
CONFIG_CMD_MEMTEST=y
CONFIG_CMD_ADC=y
CONFIG_CMD_CLK=y
CONFIG_CMD_DFU=y
CONFIG_CMD_FUSE=y
CONFIG_CMD_GPIO=y
CONFIG_CMD_GPT=y
CONFIG_CMD_I2C=y
CONFIG_CMD_MMC=y
CONFIG_CMD_REMOTEPROC=y
CONFIG_CMD_SF=y
CONFIG_CMD_SPI=y
CONFIG_CMD_USB=y
CONFIG_CMD_USB_MASS_STORAGE=y
CONFIG_CMD_BMP=y
CONFIG_CMD_CACHE=y
CONFIG_CMD_TIME=y
CONFIG_CMD_TIMER=y
CONFIG_CMD_PMIC=y
CONFIG_CMD_REGULATOR=y
CONFIG_CMD_EXT4_WRITE=y
CONFIG_CMD_MTDPARTS=y
CONFIG_CMD_UBI=y
# CONFIG_SPL_DOS_PARTITION is not set
CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1"
CONFIG_OF_SPL_REMOVE_PROPS="interrupts interrupt-names interrupts-extended interrupt-controller \\\#interrupt-cells interrupt-parent dmas dma-names assigned-clocks assigned-clock-rates assigned-clock-parents hwlocks"
CONFIG_ENV_IS_NOWHERE=y
CONFIG_ENV_IS_IN_EXT4=y
CONFIG_ENV_IS_IN_SPI_FLASH=y
CONFIG_ENV_IS_IN_UBI=y
CONFIG_ENV_EXT4_INTERFACE="mmc"
CONFIG_ENV_EXT4_DEVICE_AND_PART="0:auto"
CONFIG_ENV_EXT4_FILE="/uboot.env"
CONFIG_STM32_ADC=y
CONFIG_USB_FUNCTION_FASTBOOT=y
CONFIG_FASTBOOT_BUF_ADDR=0xC0000000
CONFIG_FASTBOOT_BUF_SIZE=0x02000000
CONFIG_FASTBOOT_USB_DEV=1
CONFIG_FASTBOOT_FLASH=y
CONFIG_FASTBOOT_FLASH_MMC_DEV=1
CONFIG_DM_HWSPINLOCK=y
CONFIG_HWSPINLOCK_STM32=y
CONFIG_DM_I2C=y
CONFIG_SYS_I2C_STM32F7=y
CONFIG_LED=y
CONFIG_LED_GPIO=y
CONFIG_DM_MAILBOX=y
CONFIG_STM32_IPCC=y
CONFIG_DM_MMC=y
CONFIG_STM32_SDMMC2=y
CONFIG_MTD=y
CONFIG_NAND=y
CONFIG_NAND_STM32_FMC2=y
CONFIG_DM_SPI_FLASH=y
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_BAR=y
CONFIG_SPI_FLASH_MACRONIX=y
CONFIG_SPI_FLASH_SPANSION=y
CONFIG_SPI_FLASH_STMICRO=y
CONFIG_SPI_FLASH_WINBOND=y
# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
CONFIG_SPI_FLASH_MTD=y
CONFIG_DM_ETH=y
CONFIG_DWC_ETH_QOS=y
CONFIG_PHY=y
CONFIG_PHY_STM32_USBPHYC=y
# CONFIG_PINCTRL_FULL is not set
CONFIG_PINCONF=y
# CONFIG_SPL_PINCTRL_FULL is not set
CONFIG_PINCTRL_STMFX=y
CONFIG_DM_PMIC=y
# CONFIG_SPL_PMIC_CHILDREN is not set
CONFIG_PMIC_STPMU1=y
CONFIG_PMIC_STPMIC1=y
CONFIG_DM_REGULATOR_FIXED=y
CONFIG_DM_REGULATOR_GPIO=y
CONFIG_DM_REGULATOR_STM32_VREFBUF=y
CONFIG_DM_REGULATOR_STPMU1=y
CONFIG_DM_REGULATOR_STPMIC1=y
CONFIG_STM32MP1_DDR_INTERACTIVE=y
CONFIG_REMOTEPROC_STM32_COPRO=y
CONFIG_DM_RTC=y
CONFIG_RTC_STM32=y
CONFIG_SERIAL_RX_BUFFER=y
CONFIG_STM32_SERIAL=y
CONFIG_SPI=y
CONFIG_DM_SPI=y
CONFIG_STM32_QSPI=y
CONFIG_STM32_SPI=y
CONFIG_USB=y
CONFIG_DM_USB=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_GENERIC=y
CONFIG_USB_DWC2=y
CONFIG_USB_STORAGE=y
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_MANUFACTURER="STMicroelectronics"
CONFIG_USB_GADGET_VENDOR_NUM=0x0483
CONFIG_USB_GADGET_PRODUCT_NUM=0x5720
CONFIG_USB_GADGET_DWC2_OTG=y
CONFIG_USB_GADGET_DOWNLOAD=y
CONFIG_DM_VIDEO=y
CONFIG_BACKLIGHT_GPIO=y
CONFIG_VIDEO_LCD_ORISETECH_OTM8009A=y
CONFIG_VIDEO_LCD_RAYDIUM_RM68200=y
CONFIG_VIDEO_STM32=y
CONFIG_VIDEO_STM32_DSI=y
CONFIG_VIDEO_STM32_MAX_XRES=1280
CONFIG_VIDEO_STM32_MAX_YRES=800
CONFIG_FDT_FIXUP_PARTITIONS=y

View File

@ -0,0 +1,115 @@
CONFIG_ARM=y
CONFIG_ARCH_STM32MP=y
CONFIG_SYS_MALLOC_F_LEN=0x3000
CONFIG_TARGET_STM32MP1=y
CONFIG_STM32MP1_OPTEE=y
CONFIG_DISTRO_DEFAULTS=y
CONFIG_FIT=y
CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
CONFIG_SYS_PROMPT="STM32MP> "
# CONFIG_CMD_BOOTD is not set
CONFIG_CMD_DTIMG=y
# CONFIG_CMD_ELF is not set
# CONFIG_CMD_IMI is not set
# CONFIG_CMD_XIMG is not set
# CONFIG_CMD_EXPORTENV is not set
# CONFIG_CMD_IMPORTENV is not set
CONFIG_CMD_MEMINFO=y
CONFIG_CMD_MEMTEST=y
CONFIG_CMD_ADC=y
CONFIG_CMD_CLK=y
CONFIG_CMD_DFU=y
CONFIG_CMD_FUSE=y
CONFIG_CMD_GPIO=y
CONFIG_CMD_I2C=y
CONFIG_CMD_MMC=y
CONFIG_CMD_REMOTEPROC=y
CONFIG_CMD_SF=y
CONFIG_CMD_SPI=y
CONFIG_CMD_USB=y
CONFIG_CMD_USB_MASS_STORAGE=y
CONFIG_CMD_BMP=y
CONFIG_CMD_CACHE=y
CONFIG_CMD_TIME=y
CONFIG_CMD_TIMER=y
CONFIG_CMD_PMIC=y
CONFIG_CMD_REGULATOR=y
CONFIG_CMD_EXT4_WRITE=y
CONFIG_CMD_MTDPARTS=y
CONFIG_CMD_UBI=y
CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1"
CONFIG_ENV_IS_NOWHERE=y
CONFIG_ENV_IS_IN_EXT4=y
CONFIG_ENV_IS_IN_SPI_FLASH=y
CONFIG_ENV_IS_IN_UBI=y
CONFIG_ENV_EXT4_INTERFACE="mmc"
CONFIG_ENV_EXT4_DEVICE_AND_PART="0:auto"
CONFIG_ENV_EXT4_FILE="/uboot.env"
CONFIG_STM32_ADC=y
CONFIG_USB_FUNCTION_FASTBOOT=y
CONFIG_FASTBOOT_BUF_ADDR=0xC0000000
CONFIG_FASTBOOT_BUF_SIZE=0x02000000
CONFIG_FASTBOOT_USB_DEV=1
CONFIG_FASTBOOT_FLASH=y
CONFIG_FASTBOOT_FLASH_MMC_DEV=1
CONFIG_DM_HWSPINLOCK=y
CONFIG_HWSPINLOCK_STM32=y
CONFIG_DM_I2C=y
CONFIG_SYS_I2C_STM32F7=y
CONFIG_LED=y
CONFIG_LED_GPIO=y
CONFIG_DM_MAILBOX=y
CONFIG_STM32_IPCC=y
CONFIG_DM_MMC=y
CONFIG_STM32_SDMMC2=y
CONFIG_MTD=y
CONFIG_NAND=y
CONFIG_NAND_STM32_FMC2=y
CONFIG_DM_SPI_FLASH=y
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_BAR=y
CONFIG_SPI_FLASH_MACRONIX=y
CONFIG_SPI_FLASH_SPANSION=y
CONFIG_SPI_FLASH_STMICRO=y
CONFIG_SPI_FLASH_WINBOND=y
# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
CONFIG_SPI_FLASH_MTD=y
CONFIG_DM_ETH=y
CONFIG_DWC_ETH_QOS=y
CONFIG_PHY=y
CONFIG_PHY_STM32_USBPHYC=y
CONFIG_PINCONF=y
CONFIG_PINCTRL_STMFX=y
CONFIG_DM_PMIC=y
CONFIG_PMIC_STPMIC1=y
CONFIG_DM_REGULATOR_FIXED=y
CONFIG_DM_REGULATOR_GPIO=y
CONFIG_DM_REGULATOR_STM32_VREFBUF=y
CONFIG_DM_REGULATOR_STPMIC1=y
CONFIG_REMOTEPROC_STM32_COPRO=y
CONFIG_DM_RTC=y
CONFIG_RTC_STM32=y
CONFIG_SERIAL_RX_BUFFER=y
CONFIG_SPI=y
CONFIG_DM_SPI=y
CONFIG_STM32_QSPI=y
CONFIG_STM32_SPI=y
CONFIG_USB=y
CONFIG_DM_USB=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_GENERIC=y
CONFIG_USB_STORAGE=y
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_MANUFACTURER="STMicroelectronics"
CONFIG_USB_GADGET_VENDOR_NUM=0x0483
CONFIG_USB_GADGET_PRODUCT_NUM=0x5720
CONFIG_USB_GADGET_DWC2_OTG=y
CONFIG_DM_VIDEO=y
CONFIG_BACKLIGHT_GPIO=y
CONFIG_VIDEO_LCD_ORISETECH_OTM8009A=y
CONFIG_VIDEO_LCD_RAYDIUM_RM68200=y
CONFIG_VIDEO_STM32=y
CONFIG_VIDEO_STM32_DSI=y
CONFIG_VIDEO_STM32_MAX_XRES=1280
CONFIG_VIDEO_STM32_MAX_YRES=800
CONFIG_FDT_FIXUP_PARTITIONS=y

View File

@ -0,0 +1,114 @@
CONFIG_ARM=y
CONFIG_ARCH_STM32MP=y
CONFIG_SYS_MALLOC_F_LEN=0x3000
CONFIG_TARGET_STM32MP1=y
CONFIG_DISTRO_DEFAULTS=y
CONFIG_FIT=y
CONFIG_BOOTCOMMAND="run bootcmd_stm32mp"
CONFIG_SYS_PROMPT="STM32MP> "
# CONFIG_CMD_BOOTD is not set
CONFIG_CMD_DTIMG=y
# CONFIG_CMD_ELF is not set
# CONFIG_CMD_IMI is not set
# CONFIG_CMD_XIMG is not set
# CONFIG_CMD_EXPORTENV is not set
# CONFIG_CMD_IMPORTENV is not set
CONFIG_CMD_MEMINFO=y
CONFIG_CMD_MEMTEST=y
CONFIG_CMD_ADC=y
CONFIG_CMD_CLK=y
CONFIG_CMD_DFU=y
CONFIG_CMD_FUSE=y
CONFIG_CMD_GPIO=y
CONFIG_CMD_I2C=y
CONFIG_CMD_MMC=y
CONFIG_CMD_REMOTEPROC=y
CONFIG_CMD_SF=y
CONFIG_CMD_SPI=y
CONFIG_CMD_USB=y
CONFIG_CMD_USB_MASS_STORAGE=y
CONFIG_CMD_BMP=y
CONFIG_CMD_CACHE=y
CONFIG_CMD_TIME=y
CONFIG_CMD_TIMER=y
CONFIG_CMD_PMIC=y
CONFIG_CMD_REGULATOR=y
CONFIG_CMD_EXT4_WRITE=y
CONFIG_CMD_MTDPARTS=y
CONFIG_CMD_UBI=y
CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1"
CONFIG_ENV_IS_NOWHERE=y
CONFIG_ENV_IS_IN_EXT4=y
CONFIG_ENV_IS_IN_SPI_FLASH=y
CONFIG_ENV_IS_IN_UBI=y
CONFIG_ENV_EXT4_INTERFACE="mmc"
CONFIG_ENV_EXT4_DEVICE_AND_PART="0:auto"
CONFIG_ENV_EXT4_FILE="/uboot.env"
CONFIG_STM32_ADC=y
CONFIG_USB_FUNCTION_FASTBOOT=y
CONFIG_FASTBOOT_BUF_ADDR=0xC0000000
CONFIG_FASTBOOT_BUF_SIZE=0x02000000
CONFIG_FASTBOOT_USB_DEV=1
CONFIG_FASTBOOT_FLASH=y
CONFIG_FASTBOOT_FLASH_MMC_DEV=1
CONFIG_DM_HWSPINLOCK=y
CONFIG_HWSPINLOCK_STM32=y
CONFIG_DM_I2C=y
CONFIG_SYS_I2C_STM32F7=y
CONFIG_LED=y
CONFIG_LED_GPIO=y
CONFIG_DM_MAILBOX=y
CONFIG_STM32_IPCC=y
CONFIG_DM_MMC=y
CONFIG_STM32_SDMMC2=y
CONFIG_MTD=y
CONFIG_NAND=y
CONFIG_NAND_STM32_FMC2=y
CONFIG_DM_SPI_FLASH=y
CONFIG_SPI_FLASH=y
CONFIG_SPI_FLASH_BAR=y
CONFIG_SPI_FLASH_MACRONIX=y
CONFIG_SPI_FLASH_SPANSION=y
CONFIG_SPI_FLASH_STMICRO=y
CONFIG_SPI_FLASH_WINBOND=y
# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
CONFIG_SPI_FLASH_MTD=y
CONFIG_DM_ETH=y
CONFIG_DWC_ETH_QOS=y
CONFIG_PHY=y
CONFIG_PHY_STM32_USBPHYC=y
CONFIG_PINCONF=y
CONFIG_PINCTRL_STMFX=y
CONFIG_DM_PMIC=y
CONFIG_PMIC_STPMIC1=y
CONFIG_DM_REGULATOR_FIXED=y
CONFIG_DM_REGULATOR_GPIO=y
CONFIG_DM_REGULATOR_STM32_VREFBUF=y
CONFIG_DM_REGULATOR_STPMIC1=y
CONFIG_REMOTEPROC_STM32_COPRO=y
CONFIG_DM_RTC=y
CONFIG_RTC_STM32=y
CONFIG_SERIAL_RX_BUFFER=y
CONFIG_SPI=y
CONFIG_DM_SPI=y
CONFIG_STM32_QSPI=y
CONFIG_STM32_SPI=y
CONFIG_USB=y
CONFIG_DM_USB=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_GENERIC=y
CONFIG_USB_STORAGE=y
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_MANUFACTURER="STMicroelectronics"
CONFIG_USB_GADGET_VENDOR_NUM=0x0483
CONFIG_USB_GADGET_PRODUCT_NUM=0x5720
CONFIG_USB_GADGET_DWC2_OTG=y
CONFIG_DM_VIDEO=y
CONFIG_BACKLIGHT_GPIO=y
CONFIG_VIDEO_LCD_ORISETECH_OTM8009A=y
CONFIG_VIDEO_LCD_RAYDIUM_RM68200=y
CONFIG_VIDEO_STM32=y
CONFIG_VIDEO_STM32_DSI=y
CONFIG_VIDEO_STM32_MAX_XRES=1280
CONFIG_VIDEO_STM32_MAX_YRES=800
CONFIG_FDT_FIXUP_PARTITIONS=y

View File

@ -0,0 +1,17 @@
STMicroelectronics STM32 Platforms Device Tree Bindings
Each device tree must specify which STM32 SoC it uses,
using one of the following compatible strings:
st,stm32f429
st,stm32f469
st,stm32f746
st,stm32h743
st,stm32mp157
Required nodes:
- syscon: some subnode of the STM32 SoC node must be a
system controller node pointing to the control registers,
with the compatible string set to one of these tuples:
"st,stm32-syscfg", "syscon"

View File

@ -10,6 +10,7 @@ Required properties:
- compatible: Should be:
"st,stm32f42xx-rcc"
"st,stm32f469-rcc"
"st,stm32f746-rcc"
- reg: should be register base and length as documented in the
datasheet
- #reset-cells: 1, see below
@ -17,6 +18,9 @@ Required properties:
property, containing a phandle to the clock device node, an index selecting
between gated clocks and other clocks and an index specifying the clock to
use.
- clocks: External oscillator clock phandle
- high speed external clock signal (HSE)
- external I2S clock (I2S_CKIN)
Example:
@ -25,6 +29,7 @@ Example:
#clock-cells = <2>
compatible = "st,stm32f42xx-rcc", "st,stm32-rcc";
reg = <0x40023800 0x400>;
clocks = <&clk_hse>, <&clk_i2s_ckin>;
};
Specifying gated clocks
@ -66,6 +71,38 @@ The secondary index is bound with the following magic numbers:
0 SYSTICK
1 FCLK
2 CLK_LSI (low-power clock source)
3 CLK_LSE (generated from a 32.768 kHz low-speed external
crystal or ceramic resonator)
4 CLK_HSE_RTC (HSE division factor for RTC clock)
5 CLK_RTC (real-time clock)
6 PLL_VCO_I2S (vco frequency of I2S pll)
7 PLL_VCO_SAI (vco frequency of SAI pll)
8 CLK_LCD (LCD-TFT)
9 CLK_I2S (I2S clocks)
10 CLK_SAI1 (audio clocks)
11 CLK_SAI2
12 CLK_I2SQ_PDIV (post divisor of pll i2s q divisor)
13 CLK_SAIQ_PDIV (post divisor of pll sai q divisor)
14 CLK_HSI (Internal ocscillator clock)
15 CLK_SYSCLK (System Clock)
16 CLK_HDMI_CEC (HDMI-CEC clock)
17 CLK_SPDIF (SPDIF-Rx clock)
18 CLK_USART1 (U(s)arts clocks)
19 CLK_USART2
20 CLK_USART3
21 CLK_UART4
22 CLK_UART5
23 CLK_USART6
24 CLK_UART7
25 CLK_UART8
26 CLK_I2C1 (I2S clocks)
27 CLK_I2C2
28 CLK_I2C3
29 CLK_I2C4
30 CLK_LPTIMER (LPTimer1 clock)
)
Example:

Some files were not shown because too many files have changed in this diff Show More