Compare commits

...

303 Commits

Author SHA1 Message Date
d543131c58 Prepare v2020.01-stm32mp-r2.2
Update Makefile to prepare the label v2020.01-stm32mp-r2.2

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I2b24484c744e039acde57ce8b0371e845d5aa8ea
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/212647
Reviewed-by: CIBUILD <MDG-smet-aci-builds@list.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
2021-10-01 16:33:40 +02:00
51f9548860 stm32mp1: ram: add read valid training support
Add the read data eye training = training for optimal read valid placement
(RVTRN) when the built-in calibration is executed for LPDRR2 and LPDDR3.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Change-Id: I1a0a5850a0ac39ae33620ed14822892c394b1a98
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/218269
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/222303
2021-10-01 16:33:25 +02:00
9a6c642d92 dfu: dfu_mtd: set max_buf_size to erasesize also for NOR devices
For NOR, the logical DFU buffer size is the sector_size
(as it is done in mtd_sf.c) and in spi/sf_mtd.c:
  sf_mtd_info.erasesize = flash->sector_size;

For NAND, with has_pages = true, the DFU size was already limited
to erasesize.

So we can use for all the MTD devices:
  dfu->max_buf_size = mtd->erasesize

This part was initially copied from MTD command, where
data is fully available in RAM.

This patch avoids to write to many sector in dfu_mtd.c at the end
of the DFU transfert and avoids issues with USB timeout or WATCHDOG.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Change-Id: I5dae379041b74a89d3ed4c70ed34118b5431e5bb
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/190507
Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com>
Reviewed-by: CIBUILD <MDG-smet-aci-builds@list.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
(cherry picked from commit 0c9f8b3b152dd317b7407b61456264c2f6ead534)
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/212641
2021-07-08 17:06:41 +02:00
07151bda3b Prepare v2020.01-stm32mp-r2.1
Update Makefile to prepare the label v2020.01-stm32mp-r2.1

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Iec44731f322ac0fe0baade4c7b9dd03c705c3101
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/185994
2020-11-25 17:01:31 +01:00
3bc32e2f0a gpio: stm32: correct the bias management
Use the bias configuration for all the GPIO configurations and not
only for input GPIO, as indicated in Reference manual
(Table 81. Port bit configuration table).

[backport of commit 2c6df94c83 ("gpio: stm32: correct the bias
management")]

Fixes: 43efbb6a3e ("gpio: stm32: add ops get_dir_flags")
Fixes: f13ff88b61 ("gpio: stm32: add ops set_dir_flags")
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Change-Id: Ib0d32663ca2284fefc438abfae4b4dc211308387
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/185993
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-11-25 17:01:31 +01:00
5fc2ad22a2 pinctrl: stm32: display bias information for all pins
Display the bias information for input gpios or AF configuration,
and not only for output pin, as described in Reference manual
(Table 81. Port bit configuration table).

[backport of commit b305dbc08b ("pinctrl: stm32: display bias
 information for all pins")]

Fixes: da7a0bb1f2 ("pinctrl: stm32: add information on pin configuration")
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Change-Id: I11b888809f04b5fb4ac1ae457feb2ff6248646ce
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/185995
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2020-11-25 16:59:12 +01:00
ec12ce4fc6 board: st: stm32mp1: update load address for FIT examples
Update kernel load address for FIT examples to avoid relocation:
- Kernel example uses Image.gz with U-Boot gzip decompression
  at final kernel location 0x0xC0008000.
- Copro example loads zImage at a correct location (0xC4000000),
  to avoid zImage relocation before decompression by kernel code.

An other solution to avoid zImage relocation is to align
the kernel load and entry address with the real location in FIT
(the relocation of zImage is skipped in U-Boot bootm command for
identical address) but it is less flexible because this offset
depends on FIT content:

For example:

## Loading kernel from FIT Image at c2000000 ...
   Using 'ev1' configuration
   Trying 'kernel' kernel subimage
     Description:  Linux kernel
     Created:      2020-10-22   9:08:32 UTC
     Type:         Kernel Image
     Compression:  uncompressed
     Data Start:   0xc20000cc

The kernel offset in FIT is 0xCC in FIT and zImage is decompressed at
0xC0008000 by kernel code:

kernel {
	description = "Linux kernel";
	data = /incbin/("zImage");
	type = "kernel";
	arch = "arm";
	os = "linux";
	compression = "none";
	load = <0xC20000cc>;
	entry = <0xC20000cc>;
	hash-1 {
		algo = "sha1";
	};
};

[backport of commit 60a2dd6aa2 ("board: st: stm32mp1: update load
 address for FIT example")]

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Change-Id: I077eed496ea5fded723418afa845e759df8e6c9b
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/181710
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2020-11-25 14:57:32 +01:00
8288f5fe3d board: st: stm32mp1: Fix wrong CONFIG_IS_ENABLED() handling for ANDROID bootargs
CONFIG_IS_ENABLED() takes the kconfig name without the CONFIG_ prefix,
this patch fixes this macro uasage in board_late_init to treat the
ANDROID bootargs.

Fixes: ca00e437aa ("stm32mp1: update Android support")
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Nicolas LOUBOUTIN <nicolas.louboutin@st.com>
Change-Id: I4ea34955ea03ef90e5b67799308c5931b7b2ba00
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/184346
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-11-25 14:57:10 +01:00
7d78686049 Prepare v2020.01-stm32mp-r2
Update Makefile to prepare the label v2020.01-stm32mp-r2

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I9cb8ea4cb9c0b2112e6314a5a0adb205933ac6b4
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/176423
2020-10-15 19:16:58 +02:00
d269531688 reset: stm32: Add support of MCU HOLD BOOT
Handle the register RCC_MP_GCR without SET/CLR registers
but with a direct access to bit BOOT_MCU:
- deassert => set the bit: The MCU will not be in HOLD_BOOT
- assert => clear the bit: The MCU will be set in HOLD_BOOT

This patch is needed to correctly handle the MCU_HOLD_BOOT_R value
added in RCC reset binding: stm32mp1-resets.h

Fixes: a3a45d670b8f ("ARM: dts: stm32mp15: add MCU_HOLD_BOOT support")

Change-Id: Ic4f6a36fa0594203b3f994a9e1d48143b420f072
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/180909
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
Reviewed-by: Arnaud POULIQUEN <arnaud.pouliquen@st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-10-15 19:16:58 +02:00
ce97da4b5f stm32mp1: add remoteproc TEE support for trusted config
Add CONFIG_REMOTEPROC_OPTEE=y. This only adds in the build the
device to support the management of the Cortex-M4 firmware by OPTEE.
The feature has to be enable using device tree "st,stm32mp1-m4_optee"
compatible.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Change-Id: If7dc8800c09814a49c97275b92b4842c8ac17e07
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/178826
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-10-15 19:16:58 +02:00
bbbfff8041 remoteproc: stm32: add support of the remote proc management by OP-TEE
Add possibility to use the OP-TEE trusted application to manage the
cortex M4 firmware for the stm32mp1 machine.
The selection is done using the DT compatibility property
"st,stm32mp1-m4_optee".

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Change-Id: I21b67e48f5abb4016cb22de3d409406983593c5c
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/178825
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/179360
2020-10-15 19:16:58 +02:00
e7d9ce4749 remoteproc: Add remoteproc trusted application support
Add rproc-optee.c to implement the interface with the OP-TEE remoteproc
trusted application. This implementation allows to delegate the remote
proc firmware management to OP-TEE in case of firmware secured by OP-TEE.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Change-Id: I48ac13a4499d292f67cf9b7f1865a0867611ebe8
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/178824
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-10-15 19:16:58 +02:00
4a1b6fbe21 phy: stm32: usbphyc: manage optional vbus regulator on phy_power_on/off
This patch adds support for optional vbus regulator.
It is managed on phy_power_on/off calls and may be needed for host mode.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I47bb6a36ff3c0138c2a8ca5f6ee669c04b804eb1
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/178473
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2020-10-15 19:16:58 +02:00
d9cbf8c413 board: stm32pm1: update USB-C power detection algorithm on DK boards
USB-C power supply which are Power Delivery compliant (USB-PD) are able
to provide different voltage/current (for example 5V/3A 9V/3A 12V/2.25A...)

In this case, the power supply need to negotiate the voltage/current to
use with the device using CC1/CC2 USB-C signals.

If this negotiation occurs during ADC measurement (done also on CC1/CC2
USB-C signals) some ADC acquisition can be corrupted which cause wrong
power supply current detection.

To avoid this, the power supply current detection algorithm is updated
as following:
  - perform an ADC measurement, if a 3A current is detected, continue the
    boot process.
  - else, wait 20ms (max tPDDebounce duration) to ensure that USB-PD
    negotiation is done and perform another ADC measurement.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Change-Id: I260c4a913fea905a3d17c28af0a8d3eb2d1974cd
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/178171
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Fabrice GASNIER <fabrice.gasnier@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-10-15 19:16:58 +02:00
ca00e437aa stm32mp1: update Android support
Update the Android integration (Android 10 / Android 11 compliant)
and generate the needed variables for FASTBOOT and android bootargs
(OP-TEE detection).

Allow to boot android with CONFIG_BOOTCOMMAND="run bootcmd_android"

This bootcmd override the DISTRO script "mmc_boot" to boot android
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: Nicolas LOUBOUTIN <nicolas.louboutin@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I5f23177a9a5f3d5df618876c4d0ed1e3d680ce5a
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/177858
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-10-15 19:16:58 +02:00
8c0c2fca4a usb: dwc2: add "u-boot,force-vbus-detection" for stm32
On some board, the ID pin is not connected so the B session must be
overridden with "u-boot,force_b_session_valid" but the VBus sensing
must continue to be handle.

To managed it, this patch adds a new DT field
"u-boot,force-vbus-detection" to use with "u-boot,force_b_session_valid"

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I77269d852e0f410c31f9d1f869815c4328510c12
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/177081
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-10-15 19:16:58 +02:00
6cd5751891 stm32mp: limit size of cacheable DDR in pre-reloc stage
In pre-reloc stage, U-Boot marks cacheable the DDR limited by
the new config CONFIG_DDR_CACHEABLE_SIZE.

This patch allows to avoid any speculative access to DDR protected by
firewall and used by OP-TEE; the "no-map" reserved memory
node in DT are assumed after this limit:
STM32_DDR_BASE + DDR_CACHEABLE_SIZE.

Without security, in basic boot, the value is equal to STM32_DDR_SIZE.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I83cbdb047dd113dde223b9bfea31a85445ca29d6
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/176365
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-10-15 19:16:58 +02:00
dd86601c5d arm: cache: cp15: don't map the reserved region with no-map property
No more map the reserved region with "no-map" property by marking
the corresponding TLB entries with invalid entry (=0) to avoid
speculative access.

This patch fixes an issue on STM32MP15x where predictive read access
on secure DDR area are caught by OP-TEE.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I198048aab746a976bd057f8d4c541d77afa8a19a
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/176278
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-10-15 19:16:58 +02:00
ad0dd64cff image-fdt: save no-map parameter of reserve-memory
Save the no-map information present in reserve-memory node to allow
correct handling when the MMU is configured in board to avoid
speculative access.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: If651f6bea76a40fbec5130aaced17cf90b52c9b7
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/176277
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-10-15 19:16:58 +02:00
c6ab27b0c2 lmb: add lmb_is_reserved_flags
Add a new function lmb_is_reserved_flags to check is a
address is reserved with a specific flags.

This function can be used to check if an address had be
reserved with no-map flags with:

lmb_is_reserved_flags(lmb, addr, LMB_NOMAP);

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I3a6b2d08f2fa71209db00af8e5bab8cba85eedd3
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/176276
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-10-15 19:16:58 +02:00
a40654ad64 lmb: Add support of flags for no-map properties
Add "flags" in lmp_property to save the "no-map" property of reserved region
and a new function lmb_reserve_flags() to check this flag.

The default allocation use flags = LMB_NONE.

The adjacent reserved memory region are merged only when they have
the same flags value.

This patch is partially based on flags support done in Linux kernel
mm/memblock .c (previously lmb.c); it is why LMB_NOMAP = 0x4, it is
aligned with MEMBLOCK_NOMAP value.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I9c829e66e497632809a6cc58b5a52dd3cd9b9852
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/176275
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-10-15 19:16:58 +02:00
aa1bc502c7 configs: stm32mp15: activate CMD_EXPORTENV
Activate CONFIG_CMD_EXPORTENV to accept the command "env export".

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: If1d49fa8059b3c6fd60f667ed9ab31a19d59ff81
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/176257
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2020-10-15 19:16:58 +02:00
ff45903da3 configs: stm32mp15: activate CMD_IMPORTENV
Activate CONFIG_CMD_IMPORTENV to accept the command "env import".
This command is useful in script to include some variable.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I81473a93ee7a195c368348e98a38c125bfda859a
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/176256
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-10-15 19:16:58 +02:00
82ff48fb33 dfu: Fix handling of UBI partitions in MTD backend
For UBI partitions ("partubi" in dfu_alt_info), dfu_fill_entity_mtd sets
the mtd.ubi flag; however other functions incorrectly check for nand.ubi
instead. Fix this by checking for the correct flag.

Fixes: 6015af28ee ("dfu: add backend for MTD device")
Signed-off-by: Guillermo Rodriguez <guille.rodriguez@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I3683e7458daea6fc350fe5ba35aa85b07da86f48
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/176222
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-10-15 19:16:58 +02:00
2efc6eaef0 ARM: dts: stm32: update dsi node in stm32mp15-no-scmi.dtsi
If building DT for STM32MP151 or STM32MP153 SoCs, the following
issue occurs:

  DTC     arch/arm/dts/stm32mp157d-ev1.dtb
Error: u-boot/arch/arm/dts/stm32mp15-no-scmi.dtsi:104.1-5 Label or path dsi not found
FATAL ERROR: Syntax error parsing input tree
scripts/Makefile.lib:308: recipe for target 'arch/arm/dts/stm32mp153a-as-fftp01-mx.dtb' failed
make[3]: *** [arch/arm/dts/stm32mp153a-as-fftp01-mx.dtb] Error 1
make[3]: *** Waiting for unfinished jobs....

To fix it, the addon for dsi clocks must be updated in
stm32mp15-no-scmi.dtsi as dsi node not defined STM32MP151 and
STM32MP153 SoCs.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Change-Id: I4f15316062f379d1694bb0688e0b7772e946fe9f
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/175282
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-10-15 19:16:58 +02:00
f2a17f22b4 stm32mp: remove the unused define STM32_SMC_RCC
Remove the proprietary SMC for RCC acces as it is no managed
by SCMI clock and reset and alignment on TF-A file for the other
SMC: add comment for each SMC parameter, remove STM32_SMC_VERSION
and STM32_SMC_RTC.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I9f54d8f1e560b3a7077f515d0f0f28bd3c346e6d
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/173696
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: Arnaud POULIQUEN <arnaud.pouliquen@st.com>
2020-10-15 19:16:58 +02:00
6f452f0fdb remoteproc: stm32: update error management in stm32_copro_start
The coprocessor is running as soon as the hold boot is de-asserted.

So indicate this running state and save the resource table even
if the protective assert, to avoid autonomous reboot, is failed.

This error case should never occurs.

Change-Id: If11081706d310a6eb7ed2ba30291bdd20e74927b
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/173942
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Fabien DESSENNE <fabien.dessenne@st.com>
Reviewed-by: Arnaud POULIQUEN <arnaud.pouliquen@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-10-15 19:16:58 +02:00
ad0a25c1f9 remoteproc: stm32: use reset for hold boot
Use the reset function to handle the hold boot bit in RCC
with device tree handle.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Id4df826efcbb8c6e22a7d5ad02cfc7459ef27345
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/173695
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: Arnaud POULIQUEN <arnaud.pouliquen@st.com>
2020-10-15 19:16:58 +02:00
cc67b016fb ARM: dts: stm32mp15: add MCU_HOLD_BOOT support
Add MCU_HOLD_BOOT support for remoteproc.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I53d0ddd1d3d54e39bd0db070f83896dcf44fb9c1
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/173694
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: Arnaud POULIQUEN <arnaud.pouliquen@st.com>
2020-10-15 19:16:58 +02:00
5810af8356 arm: dts: stm32mp1: remove duplicate clock add-on
Remove the duplicate fixed clock add for U-Boot.

Fixes: 1616aa290b ("stm32mp1: alignment with v5.4-stm32mp-r1")

Change-Id: Ib0a9ee179b0e7a87f32aa7ebe8afd9070577a47c
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/173649
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-10-15 19:16:58 +02:00
2ba410bb78 arm: stm32mp: move dbgmcu_init call when DT is ready
As the dbgmcu_init use the function bsec_dbgswenable wich is based
on the DM and DT, its call can't be done before the driver model
is initialized in board_init_f::spl_early_init().

This function call is moved in spl_board_init().

Fixes: 252d8f6c75 ("ARM: stm32mp: protect DBGMCU_IDC access with BSEC")

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I6c01acdd7ae14158b85c176ba5576242ddce12f4
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/173546
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2020-10-15 19:16:58 +02:00
ec83cd9bbf cosmetic: replace CONFIG_IS_ENABLED by IS_ENABLED
As CONFIG_SPL_STM32MP1_TRUSTED variant don't exist, IS_ENABLED is
enough.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I042c9ff333d6145edbbf6704739d8e508d93417f
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/173545
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-10-15 19:16:58 +02:00
65b4986d0a optee: add property no-map to secure reserved memory
OP-TEE reserved memory node must set property "no-map" to prevent
Linux kernel from mapping secure memory unless what non-secure world
speculative accesses of the CPU can violate the memory firmware
configuration.

Change-Id: I1f6c0cda0b1d697005e9a519fd8980120b1931d9
Fixes: 6ccb05eae0 ("image: fdt: copy possible optee nodes to a loaded devicetree")
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/174733
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Tested-by: Patrice CHOTARD <patrice.chotard@st.com>
2020-10-15 19:16:58 +02:00
fd1e484485 fdtdec: optionnaly add property no-map to created reserved memory node
Add boolean input argument @no_map to helper function
fdtdec_add_reserved_memory() to add "no-map" property for an added
reserved memory node. This is needed for example when the reserved
memory relates to secure memory that the dear Linux kernel shall
not even map unless what non-secure world speculative accesses of the
CPU can violate the memory firmware configuration.

No function change. A later change will update to OPTEE library to
add no-map property to OP-TEE reserved memory nodes.

Change-Id: I8d959adeff23676479380cfc64a68d223c65e358
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/174732
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2020-10-15 19:16:58 +02:00
93cae77354 mtd: rawnand: stm32_fmc2: fix a buffer overflow
The chip select defined in the device tree could only be 0 or 1.

Change-Id: I688a52ccd98b560d06ec32d18c4660658d1b9853
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/173212
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-10-15 19:16:58 +02:00
5a3a11cc1b ARM: dts: stm32: add FMC2 EBI support for stm32mp15 EV boards
This patch adds FMC2 External Bus Interface support for stm32mp15
EV boards.

Change-Id: Iea8a87d62697ca29361089a5389fde5e7f939017
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/172832
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-10-15 19:16:58 +02:00
b8b8af62a4 configs: stm32mp: add CONFIG_STM32_FMC2_EBI
This patch enables the support of FMC2 EBI.

Change-Id: I997358613b3c16d663eb8428b400487fbaa079ca
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/172831
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-10-15 19:16:58 +02:00
6dfd682974 board: stm32mp1: update fdt fixup partitions table
This patch adds "st,stm32mp1-fmc2-nfc" compatible string in the
fdt fixup partitions table.

Change-Id: I11d730080eb18b956da75f5e80fef38926cf8114
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/172830
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-10-15 19:16:58 +02:00
2feeda764f mtd: rawnand: stm32_fmc2: get resources from parent node
FMC2 EBI support has been added. Common resources (registers base
address and clock) can now be shared between the 2 drivers using
"st,stm32mp1-fmc2-nfc" compatible string. It means that the
common resources should now be found in the parent device when EBI
node is available.

Change-Id: I7ac26366814b6778e174483b34dec3b54b02fef6
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/172829
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-10-15 19:16:58 +02:00
996dd2f642 memory: stm32-fmc2-ebi: add STM32 FMC2 EBI controller driver
The driver adds the support for the STMicroelectronics FMC2 EBI controller
found on STM32MP SOCs.

Change-Id: I86635e787f4cdee973e4ca30e6504b4a52525a4d
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/172828
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-10-15 19:16:58 +02:00
01ecb84f7e mtd: rawnand: stm32_fmc2: use clrsetbits_le32
This patch uses clrsetbits_le32 functions instead of multiple instructions.

Change-Id: I6fcaaf96715a88932e54891fae96e87e1e44eb3a
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/172827
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-10-15 19:16:58 +02:00
e0cdaf87cf mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros
This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.

Change-Id: I438cb63f240783647824e1e435d90e34c2b6f09c
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/172826
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-10-15 19:16:58 +02:00
fd74e65eef mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant
This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.

Change-Id: Iac1e63fc844527aa376e6541f0e67f5d960f5883
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/172825
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-10-15 19:16:58 +02:00
c0b1117f90 mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_5S for timeouts
FMC2_TIMEOUT_5S will be used each time that we need to wait.
It was seen, during stress tests in an overloaded system,
that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.

Change-Id: Idc11a4d1d25b36b246d978e21866908bfcf1055c
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/172824
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-10-15 19:16:58 +02:00
d4aa8b81ce mtd: rawnand: stm32_fmc2: remove useless inline comments
Remove inline comments that are useless since function label are
self explanatory.

Change-Id: I5f14f8134b3081e91519b41028676a0d94a0e775
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/172823
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-10-15 19:16:58 +02:00
0e03039a8f dts: ARM: stm32mp15: add OP-TEE node in u-boot DTSI
Add OP-TEE firmware node in stm32mp15 U-Boot DTSI. This node is
needed since commit [1] that changed U-Boot/stm32mp15 to detect
OP-TEE availability by probing the resource instead of relying on
U-Boot configuration. The software sequence implemented by [1] is
fine but U-Boot DTS/DTSI files were not updated accordingly since,
hence OP-TEE presence is never detected by U-Boot, preventing Linux
kernel from using OP-TEE resources.

For consistency and to synchronize stm32mp15 DTSI files (excluding
U-Boot specific DTSI files) with the Linux kernel ones, this change
also moves the OP-TEE reserved memory nodes from board generic DTSI
files to U-Boot specific board DTSI files.

[Backport of commit 9e69696506 ("dts: ARM: stm32mp15: add OP-TEE
node in u-boot DTSI")]
Link: [1] commit 43df0a159d ("stm32mp1: dynamically detect op-tee presence")
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Change-Id: I75130dfcd1012e19d78b105b5be36deb5ec15105
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/171497
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-10-15 19:16:58 +02:00
a7330f8372 board: stm32mp1: fix handling of DT OP-TEE reserved memory nodes
Fix the sequence in stm32mp1 fdt.c that disables OP-TEE resources
defined in FDT when U-boot detects OP-TEE firmware is not present.

Before this change, helper function stm32_fdt_disable_optee()
set property status to "disabled" for the OP-TEE reserved memory
nodes but this has no impact since Linux kernel does not consider
the status property for reserved-memory subnodes. This change
make U-Boot to attempt to delete the node instead.

[Backport of commit 9e69696506 ("dts: ARM: stm32mp15: add OP-TEE
node in u-boot DTSI")]
Fixes: 4a1b975dac ("board: stm32mp1: reserve memory for OP-TEE in device tree")
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Change-Id: I0e33eaaad343094c382be5aa5c2a663a30bbae66
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/171496
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-10-15 19:16:58 +02:00
fa5e201eb5 optee: fix copy of optee reserved-memory node
Fix the loop that parses FDT for a reserved memory node named "optee".

Before this change, if at least one subnode was found in the
reserved-memory node, the function endlessly looped since instruction
continue returned back in the loop without updating variable subnode.
This change fixes the issue by using a for loop.

[Backport of commit 05f0c74606 ("optee: fix copy of optee reserved-memory node")]
Fixes: 6ccb05eae0 ("image: fdt: copy possible optee nodes to a loaded devicetree")
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I4f9868f4285446ba8374bd584c49db10918a1ff5
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/171495
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-10-15 19:16:58 +02:00
d457bb3785 dts: stm32mp1: alignment with v5.4-stm32mp-r2
Device tree alignment with Linux kernel v5.4-stm32mp-r2

Change-Id: Ia9ae2e43e85f3a71d4ea9c756127e945687ffb4f
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/171131
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-10-15 19:16:58 +02:00
78c89e051d board: stm32mp1: use const for struct node_info
Use const for the variable nodes in ft_board_setup.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I02cb85f0e5504acd9c1192dc9762cd404bb7f040
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/170428
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-07-17 16:09:16 +02:00
0b71fb9aef board: stm32mp1: no MTD partitions fixup for serial boot
Remove the update of the MTD partitions in kernel device tree
for serial boot (USB / UART), and the kernel will use the MTD
partitions define in the loaded DTB because U-Boot can't known the
expected flash layout in this case.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Iaffbe4c566aa29f32e66803c79787eb74843de09
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/170427
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-07-17 16:09:16 +02:00
f66400cb2b stm32mp1: stm32prog: check result of find_mmc_device
Check result of find_mmc_device() before calling mmc_init().

This patch avoid a data abort when the command try to acces
to sd/mmc device deactivated in device tree.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I28c26381b4f45a78d97ea917280479c10df92e76
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/168794
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-07-17 16:09:16 +02:00
c771f3d966 net: dwc_eth_qos: Prevent DMA from writing updated RX DMA descriptor
The DMA may attempt to write a DMA descriptor in the ring while it is
being updated. By writing the DMA descriptor buffer address to 0, it
is assured the DMA will not use such a buffer and the buffer can be
updated without any interference.

[backport of commit 24891dd8d4 ("net: dwc_eth_qos: Prevent DMA from
writing updated RX DMA descriptor")]

Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Change-Id: I89db80e8c2846f329ce023a6e576a669f9cc34f1
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/169540
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Christophe ROULLIER <christophe.roullier@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-07-17 16:09:16 +02:00
205d65008c net: dwc_eth_qos: Invalidate RX packet DMA buffer
This patch prevents an issue where the RX packet might have been
accessed by the CPU, which now has cached data from the packet in
the caches and possibly various write buffers, and these data may
be evicted from the caches into the DRAM while the buffer is also
written by the DMA.

By invalidating the buffer after the CPU accessed it and before the
DMA populates the buffer, it is assured that the buffer will not be
corrupted.

[backport of commit a83ca0c280 ("net: dwc_eth_qos: Invalidate RX
packet DMA buffer")]

Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Change-Id: Ica7541540a3d61dede54cc570e9edff14e5a7d16
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/169539
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>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-07-17 16:09:16 +02:00
34e85a3e42 net: dwc_eth_qos: Invalidate RX descriptor before reading
The current code polls the RX desciptor ring for new packets by reading
the RX descriptor status. This works by accident, as the RX descriptors
are often in non-cacheable memory. However, the driver does support use
of RX descriptors in cacheable memory.

This patch adds a missing RX descriptor invalidation, which assures the
CPU will read a fresh copy of the RX descriptor instead of a cached one.

[backport of commit 738ee270fe ("net: dwc_eth_qos: Invalidate RX
descriptor before reading")]

Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Change-Id: I4d9b1c895ee5dea0d9b1d4b5ba9d303976891953
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/169538
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>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-07-17 16:09:16 +02:00
7293e1642b net: dwc_eth_qos: Flush the RX descriptors on init
Currently the code only flushes the first RX descriptor, not every entry
in the RX descriptor ring. Fix this, to make sure the DMA engine can pick
the RX descriptors correctly.

[backport of commit dd90c2e1ea ("net: dwc_eth_qos: Flush the RX
descriptors on init")]

Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Change-Id: I74c27ef355c7d0548fef368411577adc5536d16c
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/169537
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Christophe ROULLIER <christophe.roullier@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-07-17 16:09:16 +02:00
1a257f8c44 net: dwc_eth_qos: Correctly wrap around TX descriptor tail pointer
This code programs the next descriptor in the TX descriptor ring into
the hardware as the last valid TX descriptor. The problem is that if
the currenty descriptor is the last one in the array, the code will
not wrap around correctly and use TX descriptor 0 again, but instead
will use TX descriptor at address right past the TX descriptor ring,
which is the first descriptor in the RX ring.

Fix this by adding the necessary wrap-around.

[backport of commit 83858d8795 ("net: dwc_eth_qos: Correctly wrap
around TX descriptor tail pointer")]

Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Change-Id: I68f59b0a9eaf11823d4afa36db48867ae575cb82
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/169536
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>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-07-17 16:09:16 +02:00
5c03b4f4ba net: dwc_eth_qos: Fully rewrite RX descriptor field 3
The RX descriptor field 3 should contain only OWN and BUF1V bits before
being used for receiving data by the DMA engine. However, right now, if
the descriptor was already used for receiving data and is being cleared,
the field 3 is only modified and the aforementioned two bits are ORRed
into the field. This could lead to a residual dirty bits being left in
the field 3 from previous transfer, and it generally does. Fully set the
field 3 instead to clear those residual dirty bits.

[backport of commit 4332d80617 ("net: dwc_eth_qos: Fully rewrite RX
descriptor field 3")]

Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Change-Id: I943b8257ca6a8822751acaf9d980a182aae83800
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/169535
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>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-07-17 16:09:16 +02:00
8a22cfd866 ARM: dts: stm32: add reset support to uart nodes on stm32mp15x
STM32 serial can be reset via reset controller.
Add the support of reset to uart nodes on stm32mp15-u-boot.dtsi,
the add-ons file for U-Boot.

This patch prepare a synchro with the updated kernel device tree.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I1f502be5d9d0197f53e8075a283a102e05817c2b
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/169639
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-07-17 16:09:16 +02:00
ccfed0e171 i2c: stm32f7: SYSCFG Fast Mode Plus support for I2C STM32F7
Read SYSCFG bindings to set Fast Mode Plus bits if Fast Mode Plus
speed is selected.

Handle the stm32mp15 specific compatible to handle FastMode+
registers handling which is different on the stm32mp15 compared
to the stm32f7 or stm32h7.
Indeed, on the stm32mp15, the FastMode+ set and clear registers
are separated while on the other platforms (F7 or H7) the control
is done in a unique register.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Ib000bc59b2ad7201352c5a0a55ec6072221e1808
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/168358
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Alain VOLMAT <alain.volmat@st.com>
2020-07-17 16:09:16 +02:00
497d6a8af8 cmd: cache: Fix non-cached memory cachability
If dcache is switched OFF to ON state and if non-cached memory is
used, this non-cached memory must be re-declared as uncached to mmu
each time dcache is set ON.

Introduce noncached_set_region() to set this non-cached region's mmu
settings. Let architecture override it by defining it as a weak
function.

For ARM architecture, noncached_set_region() defines all noncached
region as non-cacheable.

Issue found on STM32MP1 platform using dwc_eth_qos ethernet driver,
when going from dcache OFF to dcache ON state, ethernet driver issued
TX timeout errors when performing dhcp or ping.

It can be reproduced with the following sequence:

dhcp
while true ; do
  ping 192.168.1.300 ;
  dcache off ;
  ping 192.168.1.300 ;
  dcache on ;
done

[backport of c2a2123e33 ("cmd: cache: Fix non-cached memory
cachability")]

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Change-Id: I83f1eb1bd1c7b2c1adf46ddf5fb1b6f445f8109b
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/164920
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-07-17 16:09:16 +02:00
8a551aceb9 ram: stm32mp1: use the DDR size by default in the test addressBus
The test 4 = "AddressBus [size] [addr]" without parameter
must use to detect alias for any address bit the default value
- size = size of DDR
- addr = start of DDR = 0xC0000000

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Ife6c470972f4bfe9616f63cec46317146507a2dd
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/166739
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-07-17 16:09:16 +02:00
4e146e59eb ram: stm32mp1: add size and addr parameter to test all
Add size and addr parameter to test "All" to override the default
value (4kB and STM32_DDR_BASE) used in tests using the optional
parameters [size] or [addr].

When other optional parameters are present before [addr],
they are replaced by default value:
- [loop] = "1"
- [pattern] = "-" (new: force default pattern)

Example to use:

DDR>test 0 1 0x20000

DDR>test 0 1 0x1000000 0xD0000000

Change-Id: Id92de3d924b6867219d678a450c01fd8abe8c268
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/166738
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-07-17 16:09:16 +02:00
ce0fc836be ram: stm32mp1: add parameter addr in test FrequencySelectivePattern
Add a parameter addr in test FrequencySelectivePattern to select
the base address used to execute the tests.

Default value (when the parameter is absent) is still STM32_DDR_BASE.

Change-Id: I3487912650c4bf7acb85b595e2865036cd0a953c
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/166737
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-07-17 16:09:16 +02:00
5f3dbf316c ram: stm32mp1: test: need to align the size parameter with the minimum size
When a test have a minimum size requirement, the size need to be
aligned with min_size, today only 4 bytes alignment is checked.

For example "Random" test, raised issue when size is not 8 bytes aligned
because address for buffer = address + size / 2 is not word aligned.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I30ed15c1cb533b69b264599a3bde0005b6859b67
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/167887
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-07-17 16:09:16 +02:00
545681d1bd arm: stm32mp: activate data cache on DDR in SPL
Activate cache on DDR to improve the accesses to DDR used by SPL:
- CONFIG_SPL_BSS_START_ADDR
- CONFIG_SYS_SPL_MALLOC_START

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

[backport from commit dc7e5f190d ("arm: stm32mp: activate data cache
on DDR in SPL")]

Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Iff6d634827e2ac1f9f7aadc7c35631761dc989a0
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/167894
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>
2020-07-17 16:09:16 +02:00
955a46dafd arm: stm32mp: activate data cache in SPL and before relocation
Activate the data cache in SPL and in U-Boot before relocation.

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

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

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

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

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

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

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

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

[backport from commit 7e8471cae5 ("arm: stm32mp: activate data cache
in SPL and before relocation")]

Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I6c07e5d7bcddb07b9ac272ad385dfc2577b1863f
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/167893
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>
2020-07-17 16:09:16 +02:00
f33c1edb03 arm: caches: manage phys_addr_t overflow in mmu_set_region_dcache_behaviour
Solved the overflow on phys_addr_t type for start + size in
mmu_set_region_dcache_behaviour() function.

This overflow is avoided by dividing start and end by 2 before addition,
and we only expecting that start and size are even.

This patch doesn't change the current function behavior if the
parameters (start or size) are not aligned on MMU_SECTION_SIZE.

For example, this overflow occurs on ARM32 with:
start = 0xC0000000 and size = 0x40000000
then start + size = 0x100000000 and end = 0x0.

For information the function behavior change with risk of regression,
if we just shift start and size before the addition.
Example with 2MB section size:
  MMU_SECTION_SIZE 0x200000 and MMU_SECTION_SHIFT = 21
  with start = 0x1000000, size = 0x1000000,
  - with the proposed patch, start = 0 and end = 0x1 as previously
  - with the more simple patch:
    end = (start >> MMU_SECTION_SHIFT) + (size >> MMU_SECTION_SHIFT)
    the value of end change:
    start >> 21 = 0, size >> 21 = 0 and end = 0x0 !!!

[backport from commit 54be09cd8f ("arm: caches: manage
phys_addr_t overflow in mmu_set_region_dcache_behaviour")]

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I3e39c9eabe8b4a654df98e63b2070e1d0ec80204
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/167892
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>
2020-07-17 16:09:16 +02:00
7f6657cbff arm: caches: add DCACHE_DEFAULT_OPTION
Add the new flags DCACHE_DEFAULT_OPTION to define the default
option to use according the compilation flags
CONFIG_SYS_ARM_CACHE_*.

This new compilation flag allows to simplify dram_bank_mmu_setup()
and can be used as third parameter (option=dcache option to select)
of mmu_set_region_dcache_behaviour function.

[backport from commit 2e8d68e241 ("arm: caches: add
DCACHE_DEFAULT_OPTION") ]

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I0929ad7a4caf3c429163684f09565f0ded12a412
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/167891
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>
2020-07-17 16:09:16 +02:00
12cf14d597 arm: caches: protect dram_bank_mmu_setup access to bi_dram
Add protection in dram_bank_mmu_setup() to avoid access to bd->bi_dram
before relocation.

This patch allow to use the generic weak function dram_bank_mmu_setup
to activate the MMU and the data cache in SPL or in U-Boot before
relocation, when bd->bi_dram is not yet initialized.

In this cases, the MMU must be initialized explicitly with
mmu_set_region_dcache_behaviour function.

[backport from commit c8ec1e3ff5 ("arm: caches: protect
dram_bank_mmu_setup access to bi_dram") ]

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I75e8c44ef3cb97aa0d0e2ceaf032d705d5b5ad26
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/167890
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>
2020-07-17 16:09:16 +02:00
33db240def configs: migrate CONFIG_SYS_ARM_CACHE_* in Kconfig
Move CONFIG_SYS_ARM_CACHE_WRITETHROUGH and
CONFIG_SYS_ARM_CACHE_WRITEALLOC into Kconfig done by moveconfig.py.

Kconfig uses a choice between the 3 values supported in U-Boot,
including the new configuration CONFIG_SYS_ARM_CACHE_WRITEBACK
(the default configuration).

The patch also avoids to select simultaneously 2 configurations.

[backport from commit f8dc7f2f18 ("configs: migrate
CONFIG_SYS_ARM_CACHE_* in Kconfig") ]

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Id7e12f790824624475eb5620bb0d91ae9efb62a4
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/167889
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>
2020-07-17 16:09:16 +02:00
5087abaa85 Prepare v2020.01-stm32mp-r1.1
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I55913129d4e0ff04b86702442c04060018af9cbf
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/173039
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-07-17 16:07:35 +02:00
815d902a2e board: update test on misc_read result in board_late_init
Update management of misc_read, which now return length of data
after the commit 8729b1ae2c ("misc: Update read() and write()
methods to return bytes xfered")

Fixes: 8b8b3d6b55 ("stm32mp1: board: add environment variable for board id and board rev")

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Ibd755e6f03fcd167f10d9a9bfe98d2b928493e09
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/171663
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>
2020-07-17 15:48:25 +02:00
764fc8b259 Prepare v2020.01-stm32mp-r1
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I01762962eaa565268c262247ee70e852d499fbe3
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/163194
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2020-05-29 14:00:46 +02:00
33f5ad695a ram: stm32mp1: test: increase minimum size for NoiseBurst test
As do_noise_burst use chunk of 128 bytes for load multiple, the lowest
tested size is 128 bytes.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I79151173b466f2daeda7cdbfaefe7db5bf81c3f7
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/167886
2020-05-29 14:00:46 +02:00
1c3ae11c6d power: regulator: stm32: vrefbuf: fix a possible overshoot when re-enabling
There maybe an overshoot:
- when disabling, then re-enabling vrefbuf too quickly
- or upon platform reset as external capacitor maybe slow
  discharging (VREFBUF is HiZ at reset by default).
VREFBUF is used by ADC/DAC on some boards. An overshoot on the reference
voltage make the conversions inaccurate for a short period of time. So:
- Don't put the VREFBUF in HiZ when disabling, to force an active
  discharge.
- Enforce a 1ms OFF/ON delay, also upon reset

Penalty is a 1ms delay is applied (even for a cold boot), when enabling
VREFBUF.

Fixes: 93cf0ae775 ("power: regulator: Add support for stm32-vrefbuf")

Change-Id: Idb6dab984884f50e47f061ac36fa89da760babd4
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/165878
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>
2020-05-29 14:00:46 +02:00
a653f3cbf4 mmc: stm32_sdmmc2: change the displayed config name
Change the mmc displayed name in U-Boot for stm32_sdmmc2 driver to
“STM32 SD/MMC”.

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

For example on EV1 board, we have:

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

Changed to more clear:

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

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I4bda9fd7fdf1c7fe42323749ad1977dc690e14db
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/165518
2020-05-29 14:00:46 +02:00
03259259d0 stm32mp1: Fix warning display when 1.5A power supply is used
On DK1/2 board, when a 1.5A power supply is detected, a warning
message is displayed. In this message, "1.5mA" is displayed instead
 of "1.5A".

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Change-Id: I27624bb6ba6af81e6f3524bcc904a0c9608ae5cb
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/159746
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/165739
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-05-29 14:00:46 +02:00
1d3e514fa5 clk: clk_stm32mp1: fix CK_MPU calculation
When the CK_MPU used PLL1_MPUDIV, the current rate is
wrong. The clock must use stm32mp1_mpu_div as a shift
value. Fix the check value used to enter PLL_MPUDIV.

Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
Change-Id: Iccb6400e95bcea2bf48b22c956a50f13fa5d3d34
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/164576
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Gabriel FERNANDEZ <gabriel.fernandez@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-05-29 14:00:46 +02:00
4810f8cf42 configs: stm32mp1: enable the fastboot oem command bootbus
Enable the fastboot oem command bootbus, used to configure the eMMC
boot behavior, with same format than 'mmc bootbus'
and with parameter: boot_bus_width reset_boot_bus_width boot_mode

On stm32mp1 boards the expected command is
$> fastboot oem partconf:0 0 0

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I3df1738f393278eeb2df2ad4fd8543360d3a5597
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/161402
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2020-05-29 14:00:46 +02:00
f5ed12df6d configs: stm32mp1: enable the fastboot oem command partconf
Enable the fastboot oem command partconf, used to seelct the correct
eMMC boot partition, with same format than 'mmc partconf'
with parameter: boot_ack boot_partition
On stm32mp1 family:
- boot_ack = 1 (Boot Acknowledge is needed by ROM code)
- boot_partition = 1 or 2 (Boot partition 1 / 2 enabled for boot)

So on EV1 board the expected commands to select boot parttion 1 or 2
$> fastboot oem partconf:1 1
$> fastboot oem partconf:1 2

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Ifc72cc530e2479312583fe81352d9f58b63388fe
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/161401
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2020-05-29 14:00:46 +02:00
8cb874795e configs: stm32mp1: enable fastboot oem command format
Enable the fastboot oem command format and set the variable
"partitions" with default eMMC partitions list.

Change-Id: Ia6ff004576355889c1813b2d056d9754110d8f2e
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/161400
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-05-29 14:00:46 +02:00
7a78063948 configs: stm32mp1: enable fastboot support of eMMC boot partition
Activate fastboot support on boot partition for eMMC, mmc1 device
on Microelectronics board (EV1).

Change-Id: Ie383431427f46a688dc1f0932522d8f34f3192a5
Signed-off-by: Jean-Philippe ROMAIN <jean-philippe.romain@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/161399
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-05-29 14:00:46 +02:00
66f69dddf2 fastboot: add command to select the eMCC boot configuration
Add command oem bootbus witch execute the command
``mmc bootbus <id> <arg>`` on the current fastboot mmc device
(<i> = CONFIG_FASTBOOT_FLASH_MMC_DEV) to set the eMMC boot
configuration on first update, with
<arg> =  boot_bus_width reset_boot_bus_width boot_mode

$> fastboot oem bootbus:<boot_bus_width> <reset_boot_bus_width> <boot_mode>

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I3e4476ed5db1d186ce48088d1d1e8140510f08ca
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/161398
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2020-05-29 14:00:46 +02:00
c43410bbd7 fastboot: add command to select the default emmc hwpart for boot
Add fastboot command oem partconf witch execute the command
``mmc partconf <id> <arg> 0`` on the current <id> mmc device
to configure the eMMC boot partition with
<arg>: boot_ack boot_partition, so the command is:

$> fastboot oem partconf:<boot_ack> <boot_partition>

The partition_access argument is forced to 0 (userdata)

Change-Id: I54be34962a84794d7c1af363107e5194e81f21bf
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/161397
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-05-29 14:00:46 +02:00
8924da734b fastboot: mmc: extend flash/erase for both emmc hwpart 1 and 2
Update the code and the configs for eMMC boot and userdata
partitions acces
- FASTBOOT_MMC_BOOT_SUPPORT: boot partition 1 and 2 (erase/write)
- FASTBOOT_MMC_BOOT1_NAME: boot partition 1, default name="mmc0boot0"
- FASTBOOT_MMC_BOOT2_NAME: boot partition 2, default name="mmc0boot1"

This patch also remove the unnecessary dependency with ARCH_MEDIATEK.
and EFI_PARTITION.

Change-Id: Icb31b968f623dbbdccd58b5e83ffe247c5797b01
Signed-off-by: Jean-Philippe ROMAIN <jean-philippe.romain@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/161396
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2020-05-29 14:00:46 +02:00
ebc7928c6b fastboot: mmc: Add CONFIG_FASTBOOT_MMC_USER_SUPPORT
Split userdata and boot partition support for eMMC update
and correct the description (update is supported).

The new configuration CONFIG_FASTBOOT_MMC_USER_SUPPORT
allows to activate support of userdata partition update, based on
target name=CONFIG_FASTBOOT_MMC_USER_NAME

This patch also removew the unnecessary dependency with ARCH_MEDIATEK
and EFI_PARTITION.

Change-Id: I4ae7c1ab59fed4861cde9322a8d12167c9d0187a
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/161395
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-05-29 14:00:46 +02:00
c84075de88 fastboot: mt85xx: add command to flash/erase emmc hwpart
This patch includes the following:
1. Add fastboot command to erase the whole EMMC_USER
2. Add fastboot command to flash image at EMMC_BOOT1
3. Add fastboot command to erase the whole EMMC_BOOT1
4. Enale CONFIG_FASTBOOT_MMC_BOOT1_SUPPORT for mt8518

[backport from commit 1fdbad021f ("fastboot: mt85xx: add command
 to flash/erase emmc hwpart")]

Signed-off-by: mingming lee <mingming.lee@mediatek.com>
Change-Id: Ief34383f4a8e87cef81bc311de42d1f39f1c35f4
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/161394
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-05-29 14:00:46 +02:00
1b4672e47e stm32mp1: increase teed partition
With TEE 3.7.0, the partition teed (OP-TEE pageable
code and data) need to increase up to 512KB.

Change-Id: I835f0c06bfc195456c3b4a0ff8e427013f9fe097
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/151865
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/161428
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-05-29 14:00:46 +02:00
854e792f63 stm32mp1: only support SD card after NOR in bootcmd_stm32mp
In the boot command used in ST boards, bootcmd_stm32mp, only support
the SD card as second stage, where is found the bootfs with DISTRO.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: If8226d1def9705c94aa14c3d9cc8dac493ad4a5a
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/161196
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2020-05-29 14:00:46 +02:00
390ed5cd15 ram: stm32mp1: add protection of minimum value in get_bufsize
Add protection on minimum value for result of get_bufsize.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I29f1f31d4312a6029cc38e3f4fe9aa0baedece7d
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/161169
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-05-29 14:00:46 +02:00
f67aa06fd4 stm32prog: add "Device Name" in iproduct during DFU USB enumeration
Add "Device Name" in iproduct during DFU USB enumeration
to have information in STM32CubeProgrammer trace.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I15e9f84cc4116350cbec881d243a86f28b819123
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/137947
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-05-29 14:00:46 +02:00
252d8f6c75 ARM: stm32mp: protect DBGMCU_IDC access with BSEC
As debugger must be totally closed on Sec closed chip,
the DBGMCU_IDC register is no more accessible (self
hosted debug is disabled with OTP).

This patch adds a function bsec_dbgswenable() to check
if the DBGMCU registers are available before to access them:
BSEC_DENABLE.DBGSWENABLE = self hosted debug status.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Ibccba1760354fd05e2c6877f2295adbea775757d
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/158720
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
Reviewed-by: Lionel DEBIEVE <lionel.debieve@st.com>
Tested-by: Lionel DEBIEVE <lionel.debieve@st.com>
2020-05-29 14:00:46 +02:00
ba3de73c19 stm32mp1: activate WATCHDOG
As kernel have now a solution so we will be able to enable
the watchdog at boot time. It is reloaded by the watchdog
framework (if CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED is set) and
until the userspace watchdog daemon takes over control.

Need presence of kernel patch:
"drivers: watchdog: stm32_iwdg: set WDOG_HW_RUNNING at probe"

Change-Id: I82f741b92b9e074c3f26ba4721c976a84765c402
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/158253
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-05-29 14:00:46 +02:00
8c47b4ed66 env: mmc: allow support of mmc_get_env_dev with OF_CONTROL
Use the weak function mmc_get_env_dev in mmc_offset_try_partition
function to allow dynamic selection of mmc device to use
and no more use directly the define CONFIG_SYS_MMC_ENV_DEV.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Ib0b23085d678421d429580e13560b4dad27c9378
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/153457
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2020-05-29 14:00:46 +02:00
af9d9d9148 libfdt: Revert 6dcb8ba4 from upstream libfdt
In upstream libfdt, 6dcb8ba4 "libfdt: Add helpers for accessing
unaligned words" introduced changes to support unaligned reads for ARM
platforms and 11738cf01f15 "libfdt: Don't use memcpy to handle unaligned
reads on ARM" improved the performance of these helpers.

In practice however, this only occurs when the user has forced the
device tree to be placed in memory in a non-aligned way, which in turn
violates both our rules and the Linux Kernel rules for how things must
reside in memory to function.

This "in practice" part is important as handling these other cases adds
visible (1 second or more) delay to boot in what would be considered the
fast path of the code.

Change-Id: I55beec6048a59eac19fe52c1bab72363cc05c9a5
Cc: Patrice CHOTARD <patrice.chotard@st.com>
Cc: Patrick DELAUNAY <patrick.delaunay@st.com>
Link: https://www.spinics.net/lists/devicetree-compiler/msg02972.html
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/155687
Tested-by: Patrice CHOTARD <patrice.chotard@st.com>
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-05-29 14:00:46 +02:00
a8e1f42a2d stm32mp1: board: lock OTP used for board and MAC address on ST board
Temporary patch (don't upstream it):
When ST boards (MB1263 for EV1, MB1272 for DK2/DK1) are detected
but the used OTP used are not locked, this patch force the lock of
these OTPs: MAC address = OTP 57 and 58
and board identifier =OTP 59.

This patch solve issue for the first ST boards provisioned
but not locked.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I76f1d3cd3a3b43a096bdf5f0a8f547c2a722363e
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/153405
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-05-29 14:00:46 +02:00
e6d439ae8e 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/+/153034
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-05-29 14:00:46 +02:00
b74ccba2e5 gpio: stmfx: add ops get_dir_flags
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I375f10587b02d30722492fc1101aaf214c8a873b
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/152520
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2020-05-29 14:00:46 +02:00
93fcf1f81c gpio: stmfx: add ops set_dir_flag
Manage the flags for GPIO configuration:
- open_drain, push_pull
- pull_up, pull_down

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I22160a764c0a6f8d963e9278bb2d361575e2769a
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/152519
2020-05-29 14:00:46 +02:00
f9458d8d84 gpio: stm32: add ops get_dir_flags
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I10d17ebccc888338f2b9f23a803aee50c0f8e089
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/152518
2020-05-29 14:00:46 +02:00
98fbdb4a05 gpio: stm32: add ops set_dir_flags
Manage flags for GPIO configuration:
- open_drain, open_source, push_pull
- pull_up, pull_down

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I41efb7f94304e2a2c1f0cc7dc1397728bc6ed91a
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/152517
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2020-05-29 14:00:46 +02:00
504cdaab25 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>
Change-Id: Iaedd84f9dbd915b275da6c6fc88022c5555088c0
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>
2020-05-29 14:00:46 +02:00
092c0e60b9 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>
Change-Id: Ief41f00fc4bb9064b84f00718e64716d90cee144
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>
2020-05-29 14:00:46 +02:00
e8394312ad 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>
Change-Id: I14fa5f04f845b1c8d41093b2e2d7f3f2fa2e04a5
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>
2020-05-29 14:00:46 +02:00
d720dfb7b9 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: I7c2bf70655b4ca7a682aca00eed31631b2088763
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/146730
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>
2020-05-29 14:00:46 +02:00
1bdd5e02f8 dts: reduce device tree for trusted boot
Remove the SPL only nodes for trusted boot chain.
Prepare the removal of basic defconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I784b62187091557c8b05161b70b578824e549195
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/152522
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>

# Conflicts:
#	arch/arm/dts/stm32mp157d-dk1-u-boot.dtsi
#	arch/arm/dts/stm32mp157d-ev1-u-boot.dtsi
#	arch/arm/dts/stm32mp157f-dk2-u-boot.dtsi
#	arch/arm/dts/stm32mp157f-ed1-u-boot.dtsi
#	arch/arm/dts/stm32mp157f-ev1-u-boot.dtsi
2020-05-29 14:00:46 +02:00
02d3e54c61 doc: add new board in documentation stm32mp1.rst
Add new board in documentation stm32mp1.rst:
+ stm32mp157a-ed1.dts
+ stm32mp157a-ev1.dts
+ stm32mp157d-dk1.dts
+ stm32mp157d-ed1.dts
+ stm32mp157d-ev1.dts
+ stm32mp157f-dk2.dts
+ stm32mp157f-ed1.dts
+ stm32mp157f-ev1.dts

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Ic10842f61b46982475da71c5f5fffa4c8ad34f64
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/153293
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
2020-05-29 14:00:46 +02:00
1616aa290b dts: stm32mp1: alignment with v5.4-stm32mp-r1
Device tree alignment with Linux kernel v5.4-stm32mp-r1

Change-Id: Ia9ae2e43e85f3a71d4ea9c756127e945687ffb4f
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-05-29 14:00:46 +02:00
0ea946e6b6 configs: stm32mp1_trusted_defconfig rely on SCMI support
Enable SCMI clock and reset domain support for stm32mp1 platform
and ARM SMC mailbox driver as used as communication channel for
SCMI messages between non-secure world and secure SCMI server.

Change-Id: Id6e8c7bc7b812ba39f50a9c331684c942745d483
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/150331
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-04-09 15:40:59 +02:00
0461ba3bf6 mailbox: add new arm smc/hvc mailbox
Basic mailbox inspired from https://patchwork.kernel.org/patch/11166071/.

When sending a message, the mailbox invokes the Cortex-A Arm Trustzone
secure monitor with an SMC or HVC instruction providing a function
identifier in register R0/X0 defined by the DTB.

Change-Id: Iccd6e35b11d7c7c0fdab5d35aee4c5224604f9c6
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/153900
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-04-09 15:40:59 +02:00
2996713e0c reset: add reset controller driver for SCMI agents
This change introduces a reset controller driver for SCMI agent devices.
When SCMI agent and SCMI reset domain drivers are enabled, SCMI agent
binds a reset controller device for each SCMI reset domain protocol
devices enabled in the FDT.

SCMI reset driver is embedded upon CONFIG_RESET_SCMI=y. If enabled,
CONFIG_SCMI_AGENT is also enabled.

SCMI Reset Domain protocol is defined in the SCMI specification [1].

[1] https://developer.arm.com/architectures/system-architectures/software-standards/scmi

Change-Id: Ib70a10ee3ce19a7800e544a4bdbc17081467a15d
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/155870
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-04-09 15:40:59 +02:00
39c0fee01f clk: add clock driver for SCMI agents
This change introduces a clock driver for SCMI agent devices. When
SCMI agent and SCMI clock drivers are enabled, SCMI agent binds a
clock device for each SCMI clock protocol devices enabled in the FDT.

SCMI clock driver is embedded upon CONFIG_CLK_SCMI=y. If enabled,
CONFIG_SCMI_AGENT is also enabled.

SCMI Clock protocol is defined in the SCMI specification [1].

[1] https://developer.arm.com/architectures/system-architectures/software-standards/scmi

Change-Id: I482e4670bf0677c2fc5c416fcf6d2ebfcdd6db4f
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/155869
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-04-09 15:40:59 +02:00
0eb1094322 misc: add new SCMI agent driver
This change introduces a SCMI agent driver in U-Boot in the misc U-class.
SCMI agent driver allows platforms to embed SCMI agent devices that
communication with a SCMI server as per the SCMI specification [1].

In the current state, the SCMI agent driver does not bind any SCMI
protocol to a U-Boot device driver. Former change will need to
provide a dedicated driver and add bind request from the loop in
scmi_agent_bind() for the expected SCMI protocols.

Communications between agent (client) and the SCMI server are based
on message exchange, for example through a mailbox device and some
piece of identified shared memory. With this change SCMI agent gets
the channel resources, currently mailbox references and shared memory
references from the U-Boot device tree.

Current implementation complies with SMT format data exchange which is
the often used by existing SCMI server implementations such as the
SCP-firmware [2].

[1] https://developer.arm.com/architectures/system-architectures/software-standards/scmi
[2] https://github.com/ARM-software/SCP-firmware.git

Change-Id: I4d95dfec20d0be5bc989c728042ba1e045c1ad90
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/153899
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-04-09 15:40:59 +02:00
e624ead041 clk: stm32mp1 gets root clocks from fdt
This change makes stm32mp1 clock driver to get the root clocks
reference from the device node in the FDT rather than fetching
straight these clocks by their name. Driver now stores the
clock reference and use it to know if a root clock is present,
get its rate or gets its related udevice reference.

Change-Id: Ic47f7891c8e3621cbc40aef4ebc54355e1fcfe12
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/153896
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-04-09 15:40:59 +02:00
613d93330f dts: stm32mp1: explicit clock reference needed by RCC clock driver
Define in the RCC clock provider node which root clocks the driver
depends on. These are root oscillators, which may be present or
not, upon FDT content.

Change-Id: I9565e66593bf785bf3616f10c76b168a87acaf77
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/153895
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-04-09 15:40:59 +02:00
7ecd24f37f Update binding clock st stm32 rcc
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
556638d9a3 Update binding i2c stm32
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I4f4e1aa36b39679710cfca2902b9ec5e45a9bf05
2020-04-09 15:40:59 +02:00
e1567e3a9e Update Binding phy stm32 usbphyc
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
68eaf1647f stm32mp1: update vddcore if needed
Update the vddcore with information of OPP when needed.
VDDCORE is provided by BUCK1 of STMPIC1

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>
(cherry picked from commit 646a3c5bd00b468e6b3c4b34c368e58162ed640b)
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/151760
2020-04-09 15:40:59 +02:00
ed7648c80c 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>
(cherry picked from commit 9a3be4d8e039bfd10934cc89327b62d769950054)
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/151759
2020-04-09 15:40:59 +02:00
ebebe21ddf pinctrl: stm32: add information on pin configuration
Add information on pin configuration used for pinmux command:
- bias configuration for output (disable, pull up, pull down)
- otype for input (open drain or push pull)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I080300e7ec59426020b1d175aa207029ecb5e0cb
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/144426
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2020-04-09 15:40:59 +02:00
87ce453b5f pinctrl: stmfx: add information on pin configuration
Add information on pin configuration used for pinmux command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I1b4851af3f935a0e9b02f80c3f5303f9f80502df
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/144425
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2020-04-09 15:40:59 +02:00
71452dd1e6 remoteproc: stm32: load resource table from firmware
Load the optional resource table from the firmware, and write its
address in the dedicated backup register.

Change-Id: Ia9622ce1565256b89d9311bb2628d108802fc048
Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/147987
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
a61d8f2901 stm32mp1: remove copro_state environment variable
Since the coprocessor state is tracked in a backup register, there is
no more need for tracking it in an environment variable : remove it.

Change-Id: Iffaa52a252e9976bf7249a1feaa4a765a6a1c2cb
Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/147986
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
df6f549101 remoteproc: stm32: track the coprocessor state in a backup register
Update the dedicated backup register to track the coprocessor state and
rely on that register to compute the .is_running() value (which expects
a return value of 0 -not 1- if the processor is running).

Change-Id: I56d39768ef0cd1417e10ff3b6073720d8a1c35c5
Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/147985
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
872619f601 stm32mp1: reset coprocessor status at cold boot
Reset ResourceTableAddress and CoprocessorState at cold boot, preserve
these values at standby wakeup.

Change-Id: I045af3cffcad0d8047048cfa6a4f5d39bc43763a
Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/147984
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
567a3ee1c3 stm32mp1: declare backup registers for coprocessor
Use the backup register #17 as coprocessor resource table address and
backup register #18 as coprocessor state.

Change-Id: I9d52bab22058735c7790a38f165f88f074322304
Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/147983
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
4395178912 remoteproc: elf_loader: Add ELF resource table load support
Add rproc_elf_load_rsc_table(), which searches for a resource table in
an elf64/elf32 image, and if found, copy it to device memory.
Add also the elf32 and elf64 variant of this API.
Add a test for this.

Change-Id: I72561f2d96962357165035f40ed1a0f4fce38e9b
Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/144641
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>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
2020-04-09 15:40:59 +02:00
0c744cd01e Add oe-* to .gitignore.
Add Yocto genenerated files in exclude list.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
849349795d stm32mp1: activated DDR interactive by default
Only used by ST CubeMX - DDR tuning tools
It is activated by default in OpenSTlinux delivery

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
ccc31c6065 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>
2020-04-09 15:40:59 +02:00
8c20503ce5 remoteproc: stm32: add TZEN support
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
1734b7b4cd stm32mp1: pwr: use SMC to access to secure ressource
For trusted boot, STM32MP1 need  to use SMC to access to PWR secure
ressource

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
9cfb76eea2 stm32mp1: Add ST proprietary SMC
Add proprietary SMC to access to secure ressource provided
or protected by ST TF-A.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
86139a6eab 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>
2020-04-09 15:40:59 +02:00
067dbfb06b 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>
2020-04-09 15:40:59 +02:00
21b57a166e 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>
2020-04-09 15:40:59 +02:00
2086a35dce 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>
2020-04-09 15:40:59 +02:00
5dbfd6ea2a usb: host: dwc2: add usb33d supply support for stm32mp1
Enable the usb33d-supply on STM32MP1 SoCs (with "st,stm32mp1-hsotg"
compatible), it is the external VBUS and ID sensing comparators supply
needed to perform OTG operation.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
5290bf2589 stm32mp1: use a specific SD/eMMC partition for U-Boot enviromnent
Save the environment at the end of the U-Boot partition, the GPT
partition named "ssbl" in SD card or eMMC and avoid requirements
on the "bootfs" file system generated via specific raw tools
(like wic and genimage).

With the previous configuration of the U-Boot environment saved in ext4
file, U-Boot need to create/modify the file uenv.txt in the ext4 file
system; so this EXT4 file system need to be generated without some
functionality, like metadata_csum and dir_index, because they are not
supported by U-Boot.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Ib3e7ff4191e854f532f393567064e998dbba7955

# Conflicts:
#	configs/stm32mp15_optee_defconfig
2020-04-09 15:40:59 +02:00
179c9a4f96 stm32mp1: board: add support of CONFIG_ENV_IS_IN_MMC
Add support of CONFIG_ENV_IS_IN_MMC in env_get_location, used for
all mmc device (SD card and eMMC).
The 2 configs CONFIG_ENV_IS_IN_MMC and CONFIG_ENV_IS_IN_EXT4 are
incompatible.

Add the weak function mmc_get_env_dev to select the mmc boot instance.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I70ead25623d0b196b353164a76409cef488a172e

# Conflicts:
#	board/st/stm32mp1/stm32mp1.c
2020-04-09 15:40:59 +02:00
cd3cf54427 env: mmc: add redundancy support in mmc_offset_try_partition
Manage 2 copy at the end of the partition selected by config
"u-boot,mmc-env-partition" to save the U-Boot environment,
with CONFIG_ENV_SIZE and 2*CONFIG_ENV_SIZE offset.

This patch allows to support redundancy (CONFIG_ENV_OFFSET_REDUND).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I3f39ef337e2318d7c857e0458d5bc66e374dfaba
2020-04-09 15:40:59 +02:00
72784878c5 env: mmc: correct the offset returned by mmc_offset_try_partition
The output of the function mmc_offset_try_partition must be a
byte offset in mmc and not a multiple of blksz.

This function is used in mmc_offset(), called by mmc_get_env_addr()
and the offset is used in write_env(), erase_env() and read_env().

In these function, blk_start = offset / mmc->read_bl_len
or /write_bl_len so this offset is not a multiple of blksz.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Ib5b400348308b65bb50d9bfff5fe681027bff4e5
2020-04-09 15:40:59 +02:00
acac967773 cmd: mtd: solve bad block support in erase command
This patch modify the loop in mtd erase command to erase one by one
the blocks in the requested area.

It solves issue on "mtd erase" command on nand with existing bad block,
the command is interrupted on the first bad block with the trace:
	"Skipping bad block at 0xffffffffffffffff"

In MTD driver (nand/raw), when a bad block is present on the MTD
device, the erase_op.fail_addr is not updated and we have the initial
value MTD_FAIL_ADDR_UNKNOWN = (ULL)-1.

This case seems normal in nand_base.c:nand_erase_nand(),
we have the 2 exit cases during the loop:

1/ we have a bad block (nand_block_checkbad)
	instr->state = MTD_ERASE_FAILED
	loop interrupted (goto erase_exit)

2/ if block erase failed (status & NAND_STATUS_FAIL)
	instr->state = MTD_ERASE_FAILED;
	instr->fail_addr =
				((loff_t)page << chip->page_shift);
	loop interrupted (goto erase_exit)

So erase_op.fail_addr can't be used if bad blocks were present
in the erased area; we need to use mtd_erase only one block to detect
and skip these existing bad blocks (as it is done in nand_util.c).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
2020-04-09 15:40:59 +02:00
90d3b1dda0 configs: stm32mp1: activate CONFIG_ERRNO_STR
Add support of errno_str, used in command pmic and regulator.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Ie45c9b3aed36a3a582774fa1dffcea89d2c4bcf4
2020-04-09 15:40:59 +02:00
550298e9cf configs: stm32mp1: activate Ethernet PHY Realtek
Need Realtek driver to manage in RTL8211F the configuration of the LED.
Initialize LCR (LED Control Register) to configure green LED for Link,
yellow LED for Active

Change-Id: I7cedf843510610b1a89f70db103e9f4c3e264560
Signed-off-by: Christophe Roullier <christophe.roullier@st.com>
2020-04-09 15:40:59 +02:00
5abb3f29bc ARM: dts: stm32mp15: use DDR3 files generated by STM32CubeMX
Use the DDR3 dtsi files generated by STM32CubeMX 5.6.0
Speed Bin Grade = using DDR3-1066G / 8-8-8 and all others
parameters at default value.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I9d49b85c2523409eb85071c740650a8615dac45d
2020-04-09 15:40:59 +02:00
75fd043c01 gpio: stm32: support gpio ops in SPL
The GPIO support is needed in SPL to managed the SD cart detect
used on stm32mp157c-ev1 and dk2 board.
So this pacth activates the associated code in stm32_gpio.c.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I355ddbc804eba6047ea147d830be57a5b9c4a87e
2020-04-09 15:40:59 +02:00
3b926d9f2e board: stm32mp1: add timeout for I/O compensation ready
This patch avoid infinite loop when I/O compensation failed,
it adds a 1s timeout to detect error.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Ia5fd6d6f4787d69ef9b4b5cebb334e5f2dc81ed3
2020-04-09 15:40:59 +02:00
3fb911290f board: stm32mp1: check env_get result in board_late_init
This patch avoids crash in strcmp when the boot_device is not
present in environment (this case should be never occur)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Ic051e25812481db408f2431c7962da1db1f198fb
2020-04-09 15:40:59 +02:00
f87a476691 board: stm32mp1: set environment variable fdtfile
For booting Linux in the generic distro mechanism and support of
FDTDIR in extlinux.conf , cmd/pxe.c retrieves the FDT file name
from "fdtfile" environment variable.

Dynamically build this variable with compatible of STMicroelectronics
boards.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: If6131518ee15d3299da69d674674ec03978eb58b
2020-04-09 15:40:59 +02:00
4a391ce61a board: stm32mp1: gt9147 IRQ before reset on EV1
Software workaround for I2C issue on EV1 board,
configure the IRQ line for touchscreen before LCD reset
to fix the used I2C address.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I5d296f8fd82b60a592b51029e7e420672d0e855b
2020-04-09 15:40:59 +02:00
be383b67f2 board: stm32mp1: update management of boot-led
Force boot-led ON and no more rely on default-state.
This patch avoid device-tree modification for U-Boot.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I15cb0a6245fb4cd5d23371683c2697f794adf306
2020-04-09 15:40:59 +02:00
e4deee25ef board: stm32mp1: Keep error led ON in case of low power detection
Since commit commit dd2810851e ("stm32mp1: board: support of
error led on ed1/ev1 board") the attended behavior was no more
respected in case of low power source detection on DK2.

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

Change-Id: I5954842931a3f46d943b91004a060d6fb5072109
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
2020-04-09 15:40:59 +02:00
290f470ef0 arm: stm32mp: spl: display error in board_init_f
Update board_init_f and try to display error message
when console is available.

This patch adds trace to debug a spl boot issue when DEBUG
and DEBUG_UART is not activated, after uart probe.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I41a641a07fd12da45b392920fc3407e608926396
2020-04-09 15:40:59 +02:00
38ace79bce arm: stm32mp: spl: 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
2020-04-09 15:40:59 +02:00
17f10c94b3 arm: stm32mp: detect U-Boot version used to save environment
Imply CONFIG_VERSION_VARIABLE for stm32mp1 target
and test U-Boot version ($env_ver) when the environment was
saved for the last time and to display warning trace.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I4735cdaa63f0d66a5ff23289c87782d8dfd5f1ba
2020-04-09 15:40:59 +02:00
8ba5f74174 arm: stm32mp: reset to default environment when serial# change
Serial number is first checkedi and, in case of mismatch, all
environment variables are resetted to their default value.

This patch allows to detect that environment is saved in a removable
device, as a SD card, and reused on a other board, potentially with
incompatible variables.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I8f6df6d28ce5b4b601ced711af3699d95e1576fb
2020-04-09 15:40:59 +02:00
33faf80a1b stm32mp: update dependency for STM32_ETZPC
Correct the dependency for STM32 ETZPC protection, linked to SOC
STM32MP identified by CONFIG_STM32MP15x and not linked to
CONFIG_TARGET_STM32MP1 (no more existing).

This patch fix an issue introduced by commit 846254888e ("stm32mp1:
split board and SOC support for STM32MP15x family").

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I6462afb2ec36ada8350ac4a7d4c36d2d99639d39
2020-04-09 15:40:59 +02:00
e9bfc3c27f net: dwc_et_qos: implement phy reg and max-speed for stm32
Add management of property "reg" to configure @ of phy and
also "max-speed" property to specify maximum speed in Mbit/s
supported by the device

Signed-off-by: Christophe Roullier <christophe.roullier@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
f1f16e0ab8 net: dwc_eth_qos: implement reset-gpios for stm32
Add management of property "reset-gpios" in the node identified by
"phy-handle" to configure any GPIO used to reset the PHY.

Signed-off-by: Christophe Roullier <christophe.roullier@st.com>
Reviewed-by: Patrice CHOTARD <patrice.chotard@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
840c3d713c phy: usbphyc: use regulator_set_enable_if_allowed for disabling vdd supply
Use regulator_set_enable_if_allowed() api instead of regulator_set_enable()
while disabling vdd supply. This way the driver doesn't see an error
when disabling an always-on regulator.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I230b778f5bf092459aaadca7d51fecbc808d417d
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/154518
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
2020-04-09 15:40:59 +02:00
43ba7819c9 stm32mp1: configs: add spi load support in spl
Add the boot for NOR, SPL load U-Boot.img at offset
CONFIG_SYS_SPI_U_BOOT_OFFS = 0x80000.
It is the start address of mtd partition ssbl in nor.

Change-Id: I4a35aa9f59ec60d284dd55b1ac1139d09d6f50e7
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
2020-04-09 15:40:59 +02:00
6bf602057b stm32mp: stm32prog: add support of RAM target
Add support of RAM target in flashlayout to load kernel image
("system") and device tree ("filesystem") in DDR with DFU and
start these images.

The flashlayout.tsv is:

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

Cover-letter:
stm32mp1: add command stm32prog

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

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

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

This FlashLayout file is loaded in DDR by TF-A during during a
serial boot or in a virtual device by stm32prog command
and is parsed by U-Boot (see "AN5275: USB DFU/USART protocols used
in STM32MP1 Series bootloaders" for details).

Regards
Patrick

END

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
42abbbe4eb stm32mp: stm32prog: support for script
Support a U-Boot script included in uimage instead of flashlayout file
(text file in tsv format).

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

A simple example with dfu-util only is:

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

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

Then you can used dfu-utils to update your device

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

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
99eae0a73e stm32mp: stm32prog: enable videoconsole
Enable the videoconsole during the stm32prog command execution
to have information without UART.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
42461cdd81 stm32mp: stm32prog: add serial link support
Add a support of UAR,  using the same UART STM32 protocol
than MCU STM32, see "AN5275: USB DFU/USART protocols
used in STM32MP1 Series bootloaders" for details.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
ab6c6bc0d7 stm32mp: stm32prog: add pmic NVM update support
Add a virtual partition to update the pmic not volatile memory.
(on ST board, STPMIC1).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
020567b5c2 stm32mp: stm32prog: add otp update support
Add a virtual partition to update the STM32MP15x OTP based
on SMC service provided by TF-A.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
1ccb656964 stm32mp: stm32prog: add support for delete option in flashlayout
Add support for delete option 'D' in flashlayout for
full device or for partitions

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
699c121181 stm32mp: stm32prog: add support of ssbl copy
For reliability of boot from NAND/SPI-NAND (with read-disturb issue)
the SSBL can be present several time, when it is indicated in the
flashlayout with "Binary(X)".
The received binary is copied X times by U-Boot on the target.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
4035dff056 stm32mp: stm32prog: adapt the MTD partitions
Dynamically adapt the MTD partitions in NOR/NAND/SPI-NAND when stm32prog
command detects in the parsed flash layout files:
- a fsbl partition in NOR.
- a tee partition in NOR/NAND/SPI-NAND

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I609771871d9986ed440c7620c048f24de42c83ba
2020-04-09 15:40:59 +02:00
9d1a2796a4 stm32mp: stm32prog: add MTD devices support
Add support of MTD device (DFU_MTD backend) for
NOR, NAND or SPI-NAND target.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
da198d31f5 stm32mp: stm32prog: add upport of partial update
Add support of partial update, update only some partitions,
and check the coherence of the layout with the existing GPT
partitions (offset and size).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
fab79bdcfa stm32mp: stm32prog: add support of boot partition for eMMC device
Add support of eMMC device boot partition with
part_id = -1 for offset="boot1"
     or = -2 for offset="boot2"

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

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
d298a9564a stm32mp: stm32prog: add MMC device
Add support of MMC device (based on DFU_MMC backend)
for SD card and eMMC update.

Create a GPT partitioning on the device.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
fe5de659be stm32mp: stm32prog: add flash layout parsing
Build the list of device and of partition with
a tab separated value file with a stm32 header: the FlashLayout.tsv
(https://wiki.st.com/stm32mpu/wiki/STM32CubeProgrammer_flashlayout)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
40de68cee6 stm32mp: add the command stm32prog
Add a specific command stm32prog for STM32MP soc family
witch allows to program the boot devices with the tool
STM32CubeProgrammer (http://www.st.com/STM32CubeProg).

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

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

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

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

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

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

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

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

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I4a84b1a09311e05ad95aed6ee847685b03771b29
2020-04-09 15:40:59 +02:00
93b5d7e6e4 stm32mp: add function get_cpu_dev
Add a function get_cpu_dev to get the DEV_ID present
in DBGMCU_IDC register.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
1fbf51225e dfu: add prototype for dfu_transaction_initiate/cleanup
Add prototype for function dfu_transaction_initiate and
dfu_transaction_cleanup to avoid warning with W=1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
40f1f3b350 usb: gadget: g_dnl: add function g_dnl_set_product
Add a function g_dnl_set_product to change the Product string used in USB
enumeration in any command based on download gadget.

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

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
8b354b0c80 doc: stm32mp1: update DFU support example
Update stm32mp1 board documentation with new management of MMC and
MTD partitions and new PID df11.

Cover-letter:
stm32mp1: migrate MTD and DFU configuration in Kconfig

This serie migrate the dynamically build MTD (CONFIG_SYS_MTDPARTS_RUNTIME)
and the DFU configuration (CONFIG_SET_DFU_ALT_INFO)
previously based on ENV variables to CONFIG_.

These patches reduce the size of the environment and allow to tune
for each target with a specific defconfig file.

This serie also removes the TEE deconfig, replaced by a dynamic
detection based on op-tee driver probe.

This serie depends on previous CONFIG migration proposed in
http://patchwork.ozlabs.org/project/uboot/list/?series=160899
- configs: migrate CONFIG_SET_DFU_ALT_INFO to defconfigs
- configs: migrate CONFIG_SYS_MTDPARTS_RUNTIME to defconfigs

END

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
d52a4936b9 board: stm32mp1: adapt MTD partition for BOOT from NOR or NAND
Dynamically adapt the MTD partitions in NAND and SPI-NAND when boot from
NOR or NAND/SPI-NAND is detected.

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

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

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

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# Conflicts:
#	board/st/common/stm32mp_mtdparts.c
2020-04-09 15:40:59 +02:00
00b8ba6f10 board: stm32mp1: support boot from spi-nand
Manage BOOT_FLASH_SPINAND, with boot_device="spi-nand"
and treat this value in bootcmd_stm32mp.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I3043020b8fdd70bdd9df04665efc5d87c37168b4
2020-04-09 15:40:59 +02:00
c53cd917c7 configs: stm32mp1: remove optee defconfig
As the op-tee presence is detected by U-boot, the stm32mp15_optee_defconfig
is identical to stm32mp15_trusted_defconfig and can be removed.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I40a6f1020a72505369d8fe3d8812956d21a7b2a7
2020-04-09 15:40:59 +02:00
f50346c201 board: stm32mp1: use FDT address provided by TF-A at boot time
Save and use the FDT address provided by TF-A in r2 at boot time
(it is NT_FW_CONFIG = Non Trusted Firmware configuration file)

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

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

Change-Id: I918c95d6671221dfaa0bd39f24589baf98bcbd09
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
467c1d1017 stm32mp1: dynamically detect op-tee presence
Activate OP-TEE driver for trusted and optee defconfig.

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

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I546d9b8b998328eacc805b3da6bf6e0b0e799fda
2020-04-09 15:40:59 +02:00
f847739643 board: stm32mp1: reserve memory for OP-TEE in device tree
Add reserve memory for OP-TEE in U-Boot and in kernel device tree:
- no more reduce the DDR size in "memory" node:
  CONFIG_SYS_MEM_TOP_HIDE is no more used
- U-Boot device-tree defines the needed "reserved-memory" for OP-TEE
  and U-Boot should not use this reserved memory: board_get_usable_ram_top
  use lmb lib to found the first free region, the not reserved
  memory, enough to relocate U-Boot: the needed size of U-Boot
  is estimated with gd->mon_len + CONFIG_SYS_MALLOC_LEN.
- the optee node ("optee@...": firmware with compatible "linaro,optee-tz")
  and the associated "reserved-memory" are deactivated in kernel device
  tree when OP-TEE is not detected by U-Boot to prevent kernel issue
  (memory is reserved but not used, optee driver probe failed).

Commit-notes:
This patch depends on "ARM: bootm: take into account gd->ram_top"
http://patchwork.ozlabs.org/project/uboot/list/?series=158413
END

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Ic3890656bee22adad71a14d064ee4ea2d2184874

# Conflicts:
#	arch/arm/dts/stm32mp157a-dk1.dts
2020-04-09 15:40:59 +02:00
827f81dbd1 stm32mp1: move MTDPART configuration in Kconfig
This patch reduces the stm32mp1 environment size and builds
dynamically the MTD partitions with information from defconfig
(CONFIG_MTDPARTS_...).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
304cfdeb9d stm32mp1: dynamically build DFU_ALT_INFO
This patch reduces the stm32mp1 environment size and
builds dynamically the DFU board configuration with gpt
and mtd partitions and information from defconfig
(CONFIG_DFU_ALT_RAM0).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
ad261f30ab board: stm32mp1: move set_dfu_alt_info in st common directory
Move the stm32mp1 common code set_dfu_alt_info() in common directory,
this patch reduce the maintenance effort on this generic part (not board
dependent).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I126528b072ee0c2ed2c1d7886b46e6d2de465615
2020-04-09 15:40:59 +02:00
f23f271463 board: stm32mp1: move board_get_mtdparts in st common directory
Move the stm32mp1 common code board_get_mtdparts() in common directory,
this patch reduce the maintenance effort on this generic part (not board
dependent).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
396d1893e2 clk: stm32mp1: add SPI5_K support
Add clock support for SPI5, as this instance is available on extension
connector of ST board.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
6c2f66e96d clk: stm32mp1: correct CKSELR masks
Correct three masks used to access on the RCC register
RCC_QSPICKSELR, RCC_FMCCKSELR and RCC_ADCCKSELR: only 3 bits.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
7a57ab281c tools: ftdgrep: correct the find regions loop in do_fdtgrep
Use realloc and update the loop executed in do_fdtgrep to find all
the regions: only test count > max_region after the second pass.

This patch solve an issue if the number of region found (count)
is greater then the default value (max_region = count = 100):
the second pass is never executed, because the loop stops after
the first pass (i = 0, count > 100, max_regions = 100)
with error -1 and the error message
"Internal error with fdtgrep_find_region".

I also update the error message.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
98c512096e mtd: add prototypes for weak function
This patch adds a prototype for the weak function
board_mtdparts_default().

It solves one warning when compiling with W=1 on stm32mp1 board:

board/st/stm32mp1/stm32mp1.c:
     warning: no previous prototype for 'board_mtdparts_default'
              [-Wmissing-prototypes]
     void board_mtdparts_default(const char **mtdids,
                                 const char **mtdparts)
          ^~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
f4624a4391 dm: core: Move "/chosen" and "/firmware" node scan
Use the new function dm_scan_fdt_ofnode_path() to scan all the nodes
which aren't devices themselves but may contain some:
- "/chosen"
- "/clocks"
- "/firmware"

The patch removes the strcmp call in recursive function dm_scan_fdt_live()
and also corrects a conflict with the 2 applied patches in
the commit 1712ca2192 ("dm: core: Scan /firmware node by default")
and in the commit 747558d014 ("dm: fdt: scan for devices under
/firmware too"): the subnodes of "/firmware" (optee for example)
are bound 2 times.

For example the dm tree command result on STM32MP1 is:

STM32MP> dm tree
 Class     Index  Probed  Driver                Name
 -----------------------------------------------------------
 root          0  [ + ]   root_driver           root_driver
 firmware      0  [   ]   psci                  |-- psci
 sysreset      0  [   ]   psci-sysreset         |   `-- psci-sysreset
 simple_bus    0  [ + ]   generic_simple_bus    |-- soc
...
 tee           0  [ + ]   optee                 |-- optee
...
 tee           1  [   ]   optee                 `-- optee

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-04-09 15:40:59 +02:00
6ffd8540af board_f.c: Insure 16 alignment of start_addr_sp and reserved memory
Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
a657a7c16b arm: set the relocated gd with gd->new_gd
Simplify the arm relocation behavior and get gd directly form new_gd,
as it is already done in crt0_64.S:

	ldr	x18, [x18, #GD_NEW_GD]		/* x18 <- gd->new_gd */

This patch avoid assumption on new GD location (new GD is below bd -
with #GD_SIZE offset).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
7ae35d8778 Revert "stm32mp1: remove the imply BOOTSTAGE"
This reverts the workaround introduced by the
commit 16fec9b0bc ("stm32mp1: remove the imply BOOTSTAGE")
As the bootstage alignment issue is now solved.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
bea2c7b022 board_f.c: Insure gd->new_bootstage alignment
In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To insure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
cdf7d1f354 i2c: stm32f7_i2c: allows for any bus frequency
Do not limit 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.

Signed-off-by: Alain Volmat <alain.volmat@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
60c22d5e72 i2c: stm32: Update to use standard enums for speed
Update this driver to use the new standard enums for speed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
2020-04-09 15:40:59 +02:00
d21fbced20 i2c: Add enums for i2c speed and address size
Some drivers define their own speed enums and use their own constants for
speed. It makes sense to have a unified defition of the different speeds.

Since many controllers have to do different things for fast/high speed, it
is a good idea to have an enum for the mode.

Add these as well as an enum for the address mode.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
2020-04-09 15:40:59 +02:00
8a1d6cc4f8 ram: stm32mp1: the property st, phy-cal becomes optional
This parameter "st,phy-cal" becomes optional and when it is
absent the built-in PHY calibration is done.

It is the case in the helper dtsi file "stm32mp15-ddr.dtsi"
except if DDR_PHY_CAL_SKIP is defined.

This patch also impact the ddr interactive mode
- the registers of the param 'phy.cal' are initialized to 0 when
  "st,phy-cal" is not present in device tree (default behavior when
  DDR_PHY_CAL_SKIP is not activated)
- the info 'cal' field can be use to change the calibration behavior
  - cal=1 => use param phy.cal to initialize the PHY, built-in training
             is skipped
  - cal=0 => param phy.cal is absent, built-in training is used (default)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
6c3b6e4c40 ram: stm32mp1: reduce delay after BIST reset for tuning
Reduce the delay after BIST delay, from 1ms to 10us
which is enough accoriding datasheet.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
a51afb8a3d ram: stm32mp1_ddr: fix self refresh disable during DQS training
DDRCTRL_PWRCTL.SELFREF_EN needs to be reset before DQS training step, not
to enter in self refresh mode during the execution of this phase.
Depending on settings, it can be set after the DQS training.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
059bb2ef52 ram: stm32mp1: update BIST config for tuning
Update the BIST config to compute the real use mask for the real
bank, row and col of the used DDR. The values are get from addrmap
register value.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
39347b5710 ram: stm32mp1: tuning: deactivate derating during BIST test
The derating (timing parameter derating using MR4 read value)
can't be activated during BIST test, as the MR4 read answer will
be not understood by BIST (BISTGSR.BDONE bit stay at 0,
BISTWCSR.DXWCNT = 0x206 instead of BISTWCR.BWCNT = 0x200).

This patch only impacts the tuning on LPDDR2/LPDDR3,
if derateen.derate_enable = 1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
6a58748058 ram: stm32mp1: tuning: add timeout for polling BISTGSR.BDDONE
Avoid to block the tuning procedure on BIST error (not finished
BIST procedure) by adding a 1000us timeout on the polling of
BISTGSR.BDDONE executed to detect the end of BIST.

The normal duration of the BIST test is around 5us.

This patch also cleanup comments.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
098eb7e6e9 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>
2020-04-09 15:40:59 +02:00
6a4f9800d5 ram: stm32mp1: display result for software read DQS gating
Display result information for software read DQS gating, the tuning 0
which be used by CubeMX DDR tuning tools.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
a503d36b1e ram: stm32mp1: 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>
2020-04-09 15:40:59 +02:00
069a298e16 tee: optee: use dev_info in print_os_revision
Display TEE version at information level; this patch replaces
debug() call to dev_info() in print_os_revision() function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
2020-04-09 15:40:59 +02:00
427f4c97ec stm32mp: psci: set cntfrq register of cpu on
This path allows to set the cntfrq register of targeted cpu.

Signed-off-by: Ludovic Barre <ludovic.barre@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
201021b38c ARM: dts: stm32mp1: DT alignment with Linux 5.6-rc1
This commit manages diversity for STM32M15x SOCs with:
- dedicated files to support all STM32MP15 SOCs family.
  The differences between those SOCs are:
  -STM32MP151 [1]: common file.
  -STM32MP153 [2]: STM32MP151 + CANs + a second CortexA7-CPU.
  -STM32MP157 [3]: STM32MP153 + DSI + GPU.
- new files to manage security diversity on STM32MP15x SOCs.
  On STM32MP15xY, "Y" gives information:
  -Y = A means no cryp IP and no secure boot.
  -Y = C means cryp IP + secure boot.
- stm32mp157 pinctrl files to better manage package diversity.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
3ad4dfa365 stm32mp1: add 800 MHz profile support
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 : Cortex-A7 @ 650 MHz
- C : Secure Boot + HW Crypto + Cortex-A7 @ 650 MHz
- D : Cortex-A7 @ 800 MHz
- F : Secure Boot + HW Crypto + Cortex-A7 @ 800 MHz

This patch adds the support of STM32MP15xD and STM32MP15xF in U-Boot.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
3980e9bd31 ARM: bootm: take into account gd->ram_top
If gd->ram_top has been tuned using board_get_usable_ram_top(),
it must be taken into account when reserving arch lmb.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
029f2a8a18 configs: migrate CONFIG_SYS_MTDPARTS_RUNTIME to defconfigs
Move CONFIG_SYS_MTDPARTS_RUNTIME into Kconfig done by moveconfig.py.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
cb1a9a491c configs: migrate CONFIG_SET_DFU_ALT_INFO to defconfigs
Move CONFIG_SET_DFU_ALT_INFO into Kconfig done by moveconfig.py.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2020-04-09 15:40:59 +02:00
e25cbd4ebb usb: musb-new: sunxi: change trace level for phy errors managed by uclass
As the error message is now displayed by generic phy functions,
the dev_err/pr_err can be change to dev_dbg/pr_debug.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
22f4621720 ata: dwc-ahci: change trace level for phy errors managed by uclass
As the error message is now displayed by generic phy functions,
the pr_err can be change to pr_debug.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
98c5108417 usb: dwc3: change trace level for phy errors managed by uclass
As the error message is now displayed by generic phy functions,
the pr_err can be change to pr_debug.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
6ecc24538a usb: host: ehci-hcd: change trace level for phy errors managed by uclass
As the error message is now displayed by generic phy functions,
the pr_err can be change to pr_debug.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
b5d3794538 usb: host: ohci: change trace level for phy errors managed by uclass
As the error message is now displayed by generic phy functions,
the dev_err can be change to dev_dbg.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
ee08e5ccae board: sunxi: change trace level for phy errors managed by uclass
As the error message is now displayed by generic phy functions,
the pr_err can be change to pr_idebug.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
7939ec5755 usb: gadget: dwc2: change trace level for phy errors managed by uclass
As the error message is now displayed by generic phy functions,
the dev_err can be change to dev_dbg.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
e7865dc660 phy: generic: add error trace to detect PHY issue in uclass
Add an error trace for PHY errors directly in generic phy
functions provided by PHY uclass.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
0bb1e1a024 usb: host: dwc2: add trace to have clean usb start
Solve issue for the display of "usb start" command on stm32mp1
because one carriage return is missing in DWC2 probe.

Before the patch:

STM32MP> usb start
starting USB...
Bus usb-otg@49000000:    Bus usbh-ehci@5800d000:   USB EHCI 1.00

after the patch:

STM32MP> usb start
starting USB...
Bus usb-otg@49000000: USB DWC2
Bus usbh-ehci@5800d000: USB EHCI 1.00

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
5ebb017c0b usb: host: dwc2: force reset assert
Assert reset before deassert in dwc2_reset;
this patch solve issues when the DWC2 registers are already
initialized with value incompatible with host mode.

Force a hardware reset of the IP reset all the DWC2 registers at
default value, the host driver start with a clean state
(Core Soft reset doen in dwc_otg_core_reset is not enought
 to reset all register).

The error can occurs in U-Boot when DWC2 device gadget driver
force device mode (called by ums or dfu command, before to execute
the usb start command).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
549ea25316 usb: host: dwc2: add clk support
Add support for clock with driver model.

This patch don't added dependency because when CONFIG_CLK
is not activated the clk function are stubbed.

Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
543dadc0e7 usb: host: dwc2: add phy support
Use generic phy to initialize the PHY associated to the
DWC2 device and available in the device tree.

This patch don't added dependency because when CONFIG_PHY
is not activated, the generic PHY function are stubbed.

Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
4d30853f4c dm: clk: add stub when CONFIG_CLK is deactivated
Add stub for functions clk_...() when CONFIG_CLK is deactivated.

This patch avoids compilation issues for driver using these API
without protection (#if CONFIG_IS_ENABLED(CLK))

For example, before this patch we have undefined reference to
`clk_disable_bulk') for code:
  clk_disable_bulk(&priv->clks);
  clk_release_bulk(&priv->clks);

The bulk stub set and test bulk->count to avoid error for the sequence:

  clk_get_bulk(dev, &priv->bulk);
	....
  if (clk_enable(&priv>bulk))
	return -EIO;

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
ade8a1132b test: env: add test for env info sub-command
Add a pytest for testing the env info sub-command:

test_env_info: test command with several option

test_env_info_quiet: test the result of the sub-command with quiet option,
'-q' as used for support in shell test; for example:
  if env info -p -d -q; then env save; fi

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
f13d5fec14 configs: sandbox: Enable sub command 'env info'
Enable support for sub command 'env info' in sandbox
with CONFIG_CMD_NVEDIT_INFO. This is aimed primarily
at adding unit test.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-04-09 15:40:59 +02:00
5ca0d7b88b stm32mp1: configs: activate CMD_ERASEENV
Activate the command env erase to reset the environment with the command:
> env erase

it is simpler than:
> env default -a
> env save

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
213fd4217a stm32mp1: use the command env info in env_check
Activate CMD_NVEDIT_INFO and use the new command "env info -d -p -q"
to automatically save the environment on first boot.

This patch allows to remove the env_default variable.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
cafac39c4d cmd: env: check real location for env info command
Check the current ENV location, dynamically provided by the weak
function env_get_location to be sure that the environment can be
persistent.

The compilation flag ENV_IS_IN_DEVICE is not enough when the board
dynamically select the available storage location (according boot
device for example).

This patch solves issue for stm32mp1 platform, when the boot device
is USB.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Change-Id: I0d30bc4290bfa4337cf64445db1247bb1cdb6410
2020-04-09 15:40:59 +02:00
c8a4852df2 cmd: env: use ENV_IS_IN_DEVICE in env info
Use the define ENV_IS_IN_DEVICE to test if one the
CONFIG_ENV_IS_IN_...  is defined and correct the detection of
persistent storage support in the command "env info"
if CONFIG_ENV_IS_NOWHERE is activated.

Since commit 60d5ed2593 ("env: allow ENV_IS_NOWHERE with
other storage target") test CONFIG_ENV_IS_NOWHERE is not
enough; see also commit 953db29a1e ("env: enable saveenv
command when one CONFIG_ENV_IS_IN is activated").

This patch avoids issue for this command in stm32mp1 platform.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Change-Id: I665e23f71dfcd0bced25d3db38bfbf4b7bdd294f
2020-04-09 15:40:59 +02:00
688a746b71 cmd: env: add option for quiet output on env info
The "env info" can be use for test with -d and -p parameter,
in scripting case the output of the command is not needed.

This patch allows to deactivate this output with a new option "-q".

For example, we can save the environment if default
environment is used and persistent storage is managed with:
  if env info -p -d -q; then env save; fi

Without the quiet option, I have the unnecessary traces
First boot:
      Default environment is used
      Environment can be persisted
      Saving Environment to EXT4... File System is consistent

Next boot:
      Environment was loaded from persistent storage
      Environment can be persisted

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-04-09 15:40:59 +02:00
d15d505e68 arm: stm32mp: fdt: update kernel device tree according the part number
Update the kernel device tree for STM32MP15x product lines according
the used soc and its part number, when CONFIG_OF_SYSTEM_SETUP is activated:
- STM32MP15XA hasn't Crypto (cryp1/2)
- STM32M151 and STM32M153 hasn't 3D GPU and DSI host
- STM32M151 hasn't CAN FD and has single A7

For example:

FDT: cpu 1 node remove for STM32MP151AAA Rev.B
FDT: can@4400e000 node disabled for STM32MP151AAA Rev.B
FDT: gpu@59000000 node disabled for STM32MP151AAA Rev.B
FDT: dsi@5a000000 node disabled for STM32MP151AAA Rev.B

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
7503bd3c0b arm: stm32mp: add function get_soc_name
Add a function get_soc_name to get a string with the full name
of the SOC "STM32MP15xxx Rev.x"

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
c61e9c4734 board: stm32mp1: display reference only for STMicroelectronics board
Display the reference MBxxxx found in OTP49
only for STMicroelectronics boards when CONFIG_CMD_STBOARD
is activated.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
2b06f8aa6f board: stm32mp1: add finished good in board identifier OTP
Update the command stboard to support the coding of OTP 59 with
finished good:

bit [31:16] (hex) => MBxxxx
bit [15:12] (dec) => Variant CPN (1....15)
bit [11:8]  (dec) => Revision board (index with A = 1, Z = 26)
bit [7:4]   (dec) => Variant FG : finished good (NEW)
bit [3:0]   (dec) => BOM (01, .... 255)

the command is:
stboard [-y] <Board> <VarCPN> <Revision> <VarFG> <BOM>

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
b8f4a9b022 arm: stm32mp: improve the error message for smc
Add the SMC code and operation for trace on errors.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
7c3d33629e board: stm32mp1: stboard: lock the OTP after programming
Lock the OTP used for board identification for the ST boards after
programming.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
fdf40ecdb4 arm: stm32mp: bsec: add permanent lock support in bsec driver
Add BSEC lock access (read / write) at 0xC0000000 offset of misc driver.
The write access only available for Trusted boot mode, based on new
SMC STM32_SMC_WRLOCK_OTP.

With the fuse command, the permanent lock status is accessed with
0x10000000 offset (0xC0000000 - 0x8000000 for OTP sense/program
divided by u32 size), for example:

Read lock status of fuse 57 (0x39)

  STM32MP> fuse sense 0 0x10000039 1

  Sensing bank 0:

  Word 0x10000039: 00000000

Set permanent lock of fuse 57 (0x39)

  STM32MP> fuse prog 0 0x10000039 1

  Sensing bank 0:

  Word 0x10000039: 00000000

WARNING: the OTP lock is updated only after reboot

WARING: Programming lock or fuses is an irreversible operation!
        This may brick your system.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
995691a72a arm: stm32mp: bsec: remove unneeded test
Remove the test offs < 0 , as offs is unsigned.

This patch solves the warnings when compiling with W=1
on stm32mp1 board:

In function ‘stm32mp_bsec_read’:
arch/arm/mach-stm32mp/bsec.c:368:11: warning:
comparison of unsigned expression < 0 is always false [-Wtype-limits]
  368 |  if (offs < 0 || (offs % 4) || (size % 4))
      |           ^
In function ‘stm32mp_bsec_write’:
arch/arm/mach-stm32mp/bsec.c:405:11: warning:
comparison of unsigned expression < 0 is always false [-Wtype-limits]
  405 |  if (offs < 0 || (offs % 4) || (size % 4))
      |           ^

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
8effeef082 board: stm32mp1: read OTP in command stboard
Read the value directly from the OTP and no more of the shadows
to avoid the need of reboot after stboard command to have correct value.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
f6944642bc board: stm32mp1: update command stboard on misc_write result
Update management of misc_write, which now return length of data
after the commit 8729b1ae2c ("misc: Update read() and write()
methods to return bytes xfered")

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
56644e98fb doc: add board documentation for stm32mp1
Change plain test README to rst format and move this file
in documentation directory.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
2020-04-09 15:40:59 +02:00
1aa532a32a env: add prototypes for weak function
This patch adds prototypes for several weak functions:
- env_ext4_get_intf
- env_ext4_get_dev_part
- env_get_location

It solves the following warnings when compiling with W=1
on stm32mp1 board:

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)
             ^~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
e7936073bc test: pinmux: add pincontrol-gpio for pin configuration
Add a simple pincontrol associated to the sandbox gpio driver,
that allows to check pin configuration with the command pinmux.

The pinmux test is also updated to test behavior with 2 pincontrols.

Example to check LED pin configuration:

=> pinmux list
| Device                        | Driver                        | Parent
| pinctrl-gpio                  | sandbox_pinctrl_gpio          | root_driver
| pinctrl                       | sandbox_pinctrl               | root_driver

=> pinmux dev pinctrl-gpio

=> pinmux status

a0        : gpio input .
a1        : gpio input .
a2        : gpio input .
a3        : gpio input .
a4        : gpio input .
a5        : gpio output .
a6        : gpio output .
...

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
9f8280479d test: dm: update test for pins configuration in gpio
Add tests for new API set_dir_flags and set_dir_flags and associated
code in gpio uclass.

Test support for new flags GPIO_OPEN_DRAIN, GPIO_OPEN_SOURCE
GPIO_PULL_UP and GPIO_PULL_DOWN.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
f8644087ac gpio: sandbox: cleanup binding support
Cleanup binding support, use the generic binding by default
(test u-class gpio_xlate_offs_flags function) and add
specific binding for added value.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-04-09 15:40:59 +02:00
281916763c test: dm: update test for pins configuration in pinctrl node
Add test for "pins" configuration in gpio uclass with set_state() ops
and test for generic parsing of pinconf_param array).

set_state() is called by:
- pinctrl_generic_set_state
 |- pinctrl_generic_set_state_subnode

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-04-09 15:40:59 +02:00
be6bacbb36 pinctrl: sandbox: Add mux information in get_pin_muxing
Add param information in pin information output.
This update prepare unitary test for pin configuration
in pinctrl node.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-04-09 15:40:59 +02:00
1fe7630b89 dt-bindings: gpio: alignment with kernel v5.3
Update the binding file for gpio, it is just an alignment
with kernel v5.3.
The U-Boot code example for gpio-hog (not directly linked
to binding) is moved in a new file doc/README.gpio.
[commit 21676b706e99 ("gpio: fixes for gpio-hog support")
& 'commit 4762a9988ede ("gpio: add gpio-hog support")']

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-04-09 15:40:59 +02:00
bf1baeef01 gpio: add ops to set dir flags
Add the ops for GPIO driver set_dir_flags() to set the dir flags.
The user can update the direction and configuration
of each GPIO with a only call to dm_gpio_set_dir_flags() or
dm_gpio_set_dir() and respecting the configuration provided by
device tree (saved in desc->flags).

When these optional ops are absent, the gpio uclass use the mandatory
ops (direction_output, direction_input, get_value) and desc->flags
to manage only the main dir flags:
- GPIOD_IS_IN
- GPIOD_IS_OUT
- GPIOD_IS_OUT_ACTIVE
- GPIOD_ACTIVE_LOW

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-04-09 15:40:59 +02:00
c2cb901c92 gpio: add ops to get dir flags
Add the ops for GPIO driver get_dir_flags(), allows to get dynamically
the current gpio configuration; it is used by the API function
dm_gpio_get_dir_flags().

When these optional ops are absent, the gpio uclass continues to use
the mandatory ops (direction_output, direction_input, get_value) and
value of desc->flags to manage only the main dir flags:
- GPIOD_IS_IN
- GPIOD_IS_OUT
- GPIOD_IS_OUT_ACTIVE
- GPIOD_ACTIVE_LOW

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-04-09 15:40:59 +02:00
e795e9a99a gpio: add support of new GPIO direction flag
This commit manages the new dir flags that can be used in gpio
specifiers to indicate the pull-up or pull-down resistor
configuration for output gpio (GPIO_PULL_UP, GPIO_PULL_DOWN)
or the Open Drain/Open Source configuration for input gpio
(GPIO_OPEN_DRAIN, GPIO_OPEN_SOURCE).

These flags are already supported in Linux kernel in gpio lib.

This patch only parse and save the direction flags in GPIO
descriptor (desc->flags), it prepares the introduction of new ops
to manage them.
The GPIO uclass supports new GPIO flags from device-tree
(GPIO_XXX define in include/dt-bindings/gpio/gpio.h)
and translate them in the dir flags (GPIOD_XXX):
- GPIO_PULL_UP     => GPIOD_PULL_UP
- GPIO_PULL_DOWN   => GPIOD_PULL_DOWN
- GPIO_OPEN_DRAIN  => GPIOD_OPEN_DRAIN
- GPIO_OPEN_SOURCE => GPIOD_OPEN_SOURCE

This patch also adds protection in the check_dir_flags function for
new invalid configuration of the dir flags.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-04-09 15:40:59 +02:00
be7d096ded gpio: update dir_flags management
Update the flag management in GPIO uclass: the desc->flags is always
combined with the requested flags and the GPIO descriptor is updated
for further call.

Add a function dm_gpio_get_dir_flags to get dynamically
the current dir_flags (configuration and value).

This patch prepare introduction of the dir flags support with new ops.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-04-09 15:40:59 +02:00
fdde526b59 gpio: add helper GPIOD_FLAGS_OUTPUT
Add a macro to provide the GPIO output value according
the dir flags content.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-04-09 15:40:59 +02:00
ebc7369a2c gpio: add function check_dir_flags
Add a dir flags validity check with a new function
check_dir_flags.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-04-09 15:40:59 +02:00
bb1ee2e21e gpio: add function _dm_gpio_set_dir_flags
Introduce the function _dm_gpio_set_dir_flags to set dir flags
without check if the GPIO is reserved.

Separate the reserved check for "set_dir" and "set_dir_flags".

This patch is a preliminary step to add new ops.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-04-09 15:40:59 +02:00
affdaa70e0 gpio: add function _gpio_get_value
Introduce the function _gpio_get_value to get the GPIO value
without check if it is reserved.
This patch prepare new ops introduction.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-04-09 15:40:59 +02:00
229e50b0f9 gpio: add gpio descriptor initialization helper
Add a helper function gpio_desc_init() to initialize the gpio descriptor;
with this function the flags will be always set to 0.

It wasn't the case before this patch in dm_gpio_lookup_name.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
887a521051 gpio: remove the open_drain API and ops
This patch removes the ops get_open_drain/set_open_drain
and the API dm_gpio_get_open_drain/dm_gpio_set_open_drain.

The ops only provided in one driver (mpc8xxx gpio) and the
associated API is never called in boards.

This patch prepare a more generic set/get_dir_flags ops,
including the open drain property.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
c91928f3c6 gpio: remove GPIOD_REQUESTED
Remove the define GPIOD_REQUESTED as it is never used
and use BIT() macro for other defines.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-04-09 15:40:59 +02:00
4cde40be71 dt-bindings: gpio: document the new pull-up/pull-down flags
This commit extends the flags that can be used in GPIO specifiers to
indicate if a pull-up resistor or pull-down resistor should be
enabled.

It is the backport of linux commit ede033e1e863c ('dt-bindings:
gpio: document the new pull-up/pull-down flags')
from Thomas Petazzoni <thomas.petazzoni@bootlin.com>
and integrated in v5.1-rc1
https://github.com/torvalds/linux/commit/ede033e1e863c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-04-09 15:40:59 +02:00
f035497bb6 dm: pinctrl: migrate pinctrl-generic to livetree
Migrate pinctrl-generic to livetree:
- dev_for_each_property
- dev_read_prop_by_prop
- dev_read_string_count
- dev_read_string_index
and get rid of DECLARE_GLOBAL_DATA_PTR.

This patch solves the parsing issue during sandbox tests for pin
configuration (OF_LIVE is activated in sandbox_defconfig
and sub node are not correctly parsed in
pinctrl_generic_set_state_subnode with fdt lib API).

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
8d2391ca38 dm: core: add ofnode and dev function to iterate on node property
Add functions to iterate on all property with livetree
- dev_read_first_prop
- dev_read_next_prop
- dev_read_prop_by_prop
and
- ofnode_get_first_property
- ofnode_get_next_property
- ofnode_get_property_by_prop

And helper: dev_for_each_property

For example:
struct ofprop property;

dev_for_each_property(property, config) {
	value = dev_read_prop_by_prop(&property, &propname, &len);

or:

for (res = ofnode_get_first_property(node, &property);
     !res;
     res = ofnode_get_next_property(&property))
{
     value = ofnode_get_property_by_prop(&property, &propname, &len);
....
}

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-04-09 15:40:59 +02:00
4175992659 dm: pinctrl: convert pinctrl-single to livetree
Convert 'pinctrl-single' using livetree functions
- dev_read_prop
- dev_read_u32_default
- dev_read_u32_array
- dev_read_bool
- dev_read_addr
and get rid of DECLARE_GLOBAL_DATA_PTR.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
af0d60a7bf configs: Resync with savedefconfig
Rsync all defconfig files using moveconfig.py

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I34e6641198b135347e9bb0ce2f3abb5850d45277
2020-04-09 15:40:59 +02:00
40ea2cc606 board: stm32: remove fdt_high and fdt_highinitrd_high
For stm32 f4, f7 and h7 boards, remove fdt_high and
initrd_high as they shouldn't be used, this allows the fdt
and initrd relocation.
This implies to set CONFIG_SYS_BOOTMAPSZ to indicate the
amount of memory available to contain kernel, device tree
and initrd for relocation.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
8ddc656248 board: stm32: fix extra env setings addresses
For stm32f4, f7 and h7 boards, reserve:
 - 4MB for kernel
 - 64KB for fdt, boot script, pxefile
 - the remaining memory for ramdisk

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
ec244f6770 stm32mp1: remove fdt_high and initrd_high in environment
Remove fdt_high and initrd_high (set to 0xffffffff) in stm32mp1 board
enviromnent, and U-Boot always relocate FDT and initrd in bootm command.

This relocation is limited by CONFIG_SYS_BOOTMAPSZ which indicates
the size of the memory region where it is safe to place data passed
to the Linux kernel (DTB, initrd), it is
a) Less than or equal to RAM size.
b) not within the kernel's highmem region

So 256M seems large enough in most circumstances and users
can override this value via environment variable "bootm_mapsize"
if needed.

This modification increases the boot time but avoid assumption
on aligned address for bootm command.

A user can still define this variables themselves if the FDT or
initrd is either left in-place or copied to a specific location.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2020-04-09 15:40:59 +02:00
08b7262bb3 clk: stm32mp1: solve type issue in stm32mp1_lse_enable and stm32mp1_clktree
Solve type issue in stm32mp1_lse_enable and stm32mp1_clktree.

This patch solves the warnings when compiling with W=1
on stm32mp1 board:

clk_stm32mp1.c: In function ‘stm32mp1_lse_enable’:
clk_stm32mp1.c:1238:15: warning: comparison of integer expressions
  of different signedness: ‘u32’ {aka ‘unsigned int’} and ‘int’
  [-Wsign-compare]
clk_stm32mp1.c:1239:13: warning: comparison of integer expressions
  of different signedness: ‘u32’ {aka ‘unsigned int’} and ‘int’
  [-Wsign-compare]

clk_stm32mp1.c: In function ‘stm32mp1_clktree’:
clk_stm32mp1.c:1814:17: warning: comparison of integer expressions
  of different signedness: ‘int’ and ‘unsigned int’
  [-Wsign-compare]

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
2020-04-09 15:40:59 +02:00
5a32473989 pinctrl: stmfx: update the result type of dm_i2c_reg_read
Use int as result of dm_i2c_reg_read to avoid warning with
W=1 (warning: comparison is always false due to limited range
of data type [-Wtype-limits])

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
2020-04-09 15:40:59 +02:00
fc78d9b15a board: stm32mp1: change dfu function to static
Change the dfu functions dfu_otp_read and dfu_pmic_read to static,
this patch avoids warning when compiling with W=1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
2020-04-09 15:40:59 +02:00
7e292ba409 board: stm32mp1: board: add include for dfu
Add include for dfu, add prototype for set_dfu_alt_info
and avoid warning when compiling with W=1.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
2020-04-09 15:40:59 +02:00
660d82c011 tools: mkimage: fix STM32 image format for big endian hosts
Two header fields are not properly converted to little endian
before assignment, resulting in incorrect header while executing
mkimage on big endian hosts.

Convert the value of the header fields image_checksum and
edcsa_algorithm to little endian before the assignment.

Signed-off-by: Antonio Borneo <antonio.borneo@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
9575d8958d stm32mp1: support of STM32MP15x Rev.Z
Add support for Rev.Z of STM32MP15x cpu.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
2020-04-09 15:40:59 +02:00
1a4e9db35c board: stm32mp1: update readme
Update readme:
- list the supported SOC and change family to STM32MP15x
- add warning on OTP write and prerequisite:
  check if MAC address is not yet provisioned.
- Use filesize for mmc write command (avoid to write all partition
  with ${partsize}). ${filesize} and ${partsize} are set by previous
  load command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
2020-04-09 15:40:59 +02:00
df5bdc26de ARM: dts: stm32m1: add reg for pll nodes
Fix the following DT dtc warnings for stm32mp1 boards:

Warning (unit_address_vs_reg): /soc/rcc@50000000/st,pll@0:
  node has a unit name, but no reg property
Warning (unit_address_vs_reg): /soc/rcc@50000000/st,pll@1:
  node has a unit name, but no reg property
Warning (unit_address_vs_reg): /soc/rcc@50000000/st,pll@2:
  node has a unit name, but no reg property
Warning (unit_address_vs_reg): /soc/rcc@50000000/st,pll@3:
  node has a unit name, but no reg property

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
2020-04-09 15:40:59 +02:00
1a686cc468 ARM: dts: stm32mp1: correct ddr node
This patch fix the warning:
dt.dts: Warning (simple_bus_reg): Node /soc/ddr@5A003000
simple-bus unit address format error, expected "5a003000"

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
2020-04-09 15:40:59 +02:00
911e448f37 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>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
2020-04-09 15:40:59 +02:00
300ab11be0 ARM: dts: stm32mp1: DT alignment with kernel v5.5-rc7
Device tree and binding alignment with kernel v5.5-rc7

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
2020-04-09 15:40:59 +02:00
6347ce8a21 stm32mp1: pwr: use the last binding for pwr
Update the driver to use the latest binding from kernel v5.5-rc1:
no more use syscon or regmap to access to pwr register and
only one pwr_regulators node with the compatibility "st,stm32mp1,pwr-reg"
is available.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Change-Id: Iafa23d1a290dfaa21ca489c428288d280e187f07
2020-04-09 15:40:59 +02:00
be9bb06910 ARM: dts: stm32mp1: DT alignment with kernel v5.4
Device tree and binding alignment with kernel v5.4

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
2020-04-09 15:40:59 +02:00
f947e688f5 ARM: dts: stm32: Add DH Electronics DHCOM SoM and PDK2 board
Add support for DH Electronics DHCOM SoM and PDK2 rev. 400 carrier
board. This is an SoM with STM32MP15xx and an evaluation kit. The
baseboard provides Ethernet, UART, USB, CAN and optional display.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
ac5fc73ecf ARM: dts: stm32: Add missing ETHCK clock to ethernet node
Add missing 'eth-ck' clock to the ethernet node. These clock are used to
generate external clock signal for the PHY in case 'st,eth_ref_clk_sel'
is specified.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
8b18c6a4e2 ARM: stm32: Fill in missing loadaddr
Since CONFIG_LOADADDR is not set, the default value of $loadaddr
variable is not set in the environment either. Set the default
load address to 32 MiB from the start of DRAM (same value than
kernel_addr_r).


Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
0821e5360d stm32mp1: split board and SOC support for STM32MP15x family
Split the board and SOC support for STM32MP15x family and
prepare the introduction of new boards with STM32MP15x.

This path define the 2 configurations:
- STM32MP15x: STM32MP15x soc support (new)
- TARGET_ST_STM32MP15x: STMicroelectronics board support (choice)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Change-Id: I7119404c4b124d719c8a2704e897cd4970071bbd
2020-04-09 15:40:59 +02:00
8201023680 board: stm32mp1: move CONFIG_ENV_XXX in defconfig
Move CONFIG_ENV_SECT_SIZE and CONFIG_ENV_OFFSET in stm32mp15_*_defconfig
for ST board with NOR support (STM32MP15xx-EV1 boards)
- CONFIG_SECT_SIZE values = the max supported NOR erase size (256KB)
- CONFIG_ENV_OFFSET = offset for NOR (ENV_IS_IN_SPI_FLASH)

This Patch prepares the U-Boot support of boards with STM32MP15x SOC
not provided by STMicroelectronics.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
2020-04-09 15:40:59 +02:00
4e5fea2d06 stm32mp1: move stboard command in board/st/common directory
Move the ST command in board/st/common, as this command is only used
by ST board. Prepare the support in U-Boot of boards with STM32MP15x
SOC but not STMicroelectronics.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
2020-04-09 15:40:59 +02:00
e05062ed43 stm32mp1: configs: Make all boot devices in distro boot conditional
Not all systems have all the boot devices enabled, e.g. not all systems
have MTD devices and thus do not enable UBI. Make all the boot devices
in the distro bootcmd conditional to avoid failures.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
0747991607 ARM: stm32: Allow overriding setup_mac_address()
Let board code override setup_mac_address(), which is useful e.g. if the
board derives the MAC address from another source, like an I2C EEPROM.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-09 15:40:59 +02:00
4230b101c7 stm32mp: remove redundant SYS_TEXT_BASE prompt
The main prompt for this (defined in /Kconfig) is visible at all times,
which means there's no reason to have an additional, machine-specific
prompt to set the same option.

Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
2020-04-09 15:40:59 +02:00
de18e50036 optee: Replace uninitialized return variable by proper one.
As hinted by GCC 9, there is a return statement that returns
an uninitialized variable in optee_copy_firmware_node().
This patch addresses this.

Signed-off-by: Christoph Müllner <christoph.muellner@theobroma-systems.com>
Reviewed-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Change-Id: Ic71b2f3748db3103a20879eb6156afcc34eea596
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/156356
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-04-09 15:40:59 +02:00
302358fbdd CONTRIBUTING: add contributing guide to STMicroelectronics/u-boot repository
Add contributing guide to STMicroelectronics/u-boot repository.

Signed-off-by: Bernard Puel <bernard.puel@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: Ia32afcbd025f24949fb27c7fe4db2133a47dcf5b
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/163160
Reviewed-by: CITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: CIBUILD <smet-aci-builds@lists.codex.cro.st.com>
(cherry picked from commit 41862c1b26)
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/u-boot/+/163162
2020-04-09 15:40:59 +02:00
270 changed files with 21191 additions and 5677 deletions

3
.gitignore vendored
View File

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

30
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,30 @@
# Contributing guide
This document serves as a checklist before contributing to this repository. It includes links to read up on if topics are unclear to you.
This guide mainly focuses on the proper use of Git.
## 1. Issues
STM32MPU projects do not activate "Github issues" feature for the time being. If you need to report an issue or question about this project deliverables, you can report them using [ ST Support Center ](https://my.st.com/ols#/ols/newrequest) or [ ST Community MPU Forum ](https://community.st.com/s/topic/0TO0X0000003u2AWAQ/stm32-mpus).
## 2. Pull Requests
STMicrolectronics is happy to receive contributions from the community, based on an initial Contributor License Agreement (CLA) procedure.
* If you are an individual writing original source code and you are sure **you own the intellectual property**, then you need to sign an Individual CLA (https://cla.st.com).
* If you work for a company that wants also to allow you to contribute with your work, your company needs to provide a Corporate CLA (https://cla.st.com) mentioning your GitHub account name.
* If you are not sure that a CLA (Individual or Corporate) has been signed for your GitHub account you can check here (https://cla.st.com).
Please note that:
* The Corporate CLA will always take precedence over the Individual CLA.
* One CLA submission is sufficient, for any project proposed by STMicroelectronics.
__How to proceed__
* We recommend to fork the project in your GitHub account to further develop your contribution. Please use the latest commit version.
* Please, submit one Pull Request for one new feature or proposal. This will ease the analysis and final merge if accepted.
__Note__
Merge will not be done directly in GitHub but it will need first to follow internal integration process before public deliver in a standard release. The Pull request will stay open until it is merged and delivered.

View File

@ -337,6 +337,7 @@ L: uboot-stm32@st-md-mailman.stormreply.com (moderated for non-subscribers)
T: git https://gitlab.denx.de/u-boot/custodians/u-boot-stm.git
S: Maintained
F: arch/arm/mach-stm32mp/
F: doc/board/st/
F: drivers/adc/stm32-adc*
F: drivers/clk/clk_stm32mp1.c
F: drivers/gpio/stm32_gpio.c

View File

@ -3,7 +3,7 @@
VERSION = 2020
PATCHLEVEL = 01
SUBLEVEL =
EXTRAVERSION =
EXTRAVERSION = -stm32mp-r2.2
NAME =
# *DOCUMENTATION*

View File

@ -329,6 +329,34 @@ config SYS_CACHELINE_SIZE
default 64 if SYS_CACHE_SHIFT_6
default 32 if SYS_CACHE_SHIFT_5
choice
prompt "Select the ARM data write cache policy"
default SYS_ARM_CACHE_WRITETHROUGH if TARGET_BCMCYGNUS || \
TARGET_BCMNSP || CPU_PXA || RZA1
default SYS_ARM_CACHE_WRITEBACK
config SYS_ARM_CACHE_WRITEBACK
bool "Write-back (WB)"
help
A write updates the cache only and marks the cache line as dirty.
External memory is updated only when the line is evicted or explicitly
cleaned.
config SYS_ARM_CACHE_WRITETHROUGH
bool "Write-through (WT)"
help
A write updates both the cache and the external memory system.
This does not mark the cache line as dirty.
config SYS_ARM_CACHE_WRITEALLOC
bool "Write allocation (WA)"
help
A cache line is allocated on a write miss. This means that executing a
store instruction on the processor might cause a burst read to occur.
There is a linefill to obtain the data for the cache line, before the
write is performed.
endchoice
config ARCH_CPU_INIT
bool "Enable ARCH_CPU_INIT"
help

View File

@ -823,12 +823,21 @@ dtb-$(CONFIG_ARCH_ASPEED) += ast2500-evb.dtb
dtb-$(CONFIG_ARCH_STI) += stih410-b2260.dtb
dtb-$(CONFIG_TARGET_STM32MP1) += \
stm32mp157a-dk1.dtb \
dtb-$(CONFIG_STM32MP15x) += \
stm32mp157a-avenger96.dtb \
stm32mp157a-dk1.dtb \
stm32mp157a-ed1.dtb \
stm32mp157a-ev1.dtb \
stm32mp157c-dk2.dtb \
stm32mp157c-ed1.dtb \
stm32mp157c-ev1.dtb
stm32mp157c-ev1.dtb \
stm32mp157d-dk1.dtb \
stm32mp157d-ed1.dtb \
stm32mp157d-ev1.dtb \
stm32mp157f-dk2.dtb \
stm32mp157f-ed1.dtb \
stm32mp157f-ev1.dtb \
stm32mp15xx-dhcom-pdk2.dtb
dtb-$(CONFIG_SOC_K3_AM6) += k3-am654-base-board.dtb k3-am654-r5-base-board.dtb
dtb-$(CONFIG_SOC_K3_J721E) += k3-j721e-common-proc-board.dtb \

View File

@ -5,7 +5,7 @@
/ {
soc {
ddr: ddr@5A003000 {
ddr: ddr@5a003000 {
u-boot,dm-pre-reloc;
compatible = "st,stm32mp1-ddr";
@ -31,6 +31,7 @@
st,mem-speed = <DDR_MEM_SPEED>;
st,mem-size = <DDR_MEM_SIZE>;
#ifndef CONFIG_STM32MP1_TRUSTED
st,ctl-reg = <
DDR_MSTR
DDR_MRCTRL0
@ -133,6 +134,7 @@
DDR_MR3
>;
#ifdef DDR_PHY_CAL_SKIP
st,phy-cal = <
DDR_DX0DLLCR
DDR_DX0DQTR
@ -147,6 +149,9 @@
DDR_DX3DQTR
DDR_DX3DQSTR
>;
#endif
#endif
status = "okay";
};

View File

@ -1,24 +1,23 @@
// 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
/*
* File generated by STMicroelectronics STM32CubeMX DDR Tool for MPUs
* DDR type: DDR3 / DDR3L
* DDR width: 16bits
* DDR density: 4Gb
* System frequency: 533000Khz
* Relaxed Timing Mode: false
* Address mapping type: RBC
*
* Save Date: 2020.02.20, save Time: 18:45:20
*/
#define DDR_MEM_NAME "DDR3-DDR3L 16bits 533000Khz"
#define DDR_MEM_SPEED 533000
#define DDR_MEM_SIZE 0x20000000
#define DDR_MSTR 0x00041401
#define DDR_MRCTRL0 0x00000010
@ -50,15 +49,6 @@
#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
@ -83,6 +73,15 @@
#define DDR_PCFGQOS1_1 0x00800040
#define DDR_PCFGWQOS0_1 0x01100C03
#define DDR_PCFGWQOS1_1 0x01000200
#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_PGCR 0x01442E02
#define DDR_PTR0 0x0022AA5B
#define DDR_PTR1 0x04841104

View File

@ -1,24 +1,23 @@
// 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 0 = MT41J256M16-187 / DDR3-1066 bin G
* DDR density 8
* timing mode optimized
* Scheduling/QoS options : type = 2
* address mapping : RBC
* Tc > + 85C : N
*/
#define DDR_MEM_NAME "DDR3-1066/888 bin G 2x4Gb 533MHz v1.45"
#define DDR_MEM_SPEED 533000
#define DDR_MEM_SIZE 0x40000000
/*
* File generated by STMicroelectronics STM32CubeMX DDR Tool for MPUs
* DDR type: DDR3 / DDR3L
* DDR width: 32bits
* DDR density: 8Gb
* System frequency: 533000Khz
* Relaxed Timing Mode: false
* Address mapping type: RBC
*
* Save Date: 2020.02.20, save Time: 18:49:33
*/
#define DDR_MEM_NAME "DDR3-DDR3L 32bits 533000Khz"
#define DDR_MEM_SPEED 533000
#define DDR_MEM_SIZE 0x40000000
#define DDR_MSTR 0x00040401
#define DDR_MRCTRL0 0x00000010
@ -50,15 +49,6 @@
#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
@ -83,6 +73,15 @@
#define DDR_PCFGQOS1_1 0x00800040
#define DDR_PCFGWQOS0_1 0x01100C03
#define DDR_PCFGWQOS1_1 0x01000200
#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_PGCR 0x01442E02
#define DDR_PTR0 0x0022AA5B
#define DDR_PTR1 0x04841104

View File

@ -0,0 +1,156 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2020 - All Rights Reserved
* Author: Gabriel Fernandez <gabriel.fernandez@st.com> for STMicroelectronics.
*/
/ {
clocks {
clk_hse: clk-hse {
#clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <24000000>;
};
clk_hsi: clk-hsi {
#clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <64000000>;
};
clk_lse: clk-lse {
#clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <32768>;
};
clk_lsi: clk-lsi {
#clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <32000>;
};
clk_csi: clk-csi {
#clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <4000000>;
};
};
cpus {
cpu0: cpu@0 {
clocks = <&rcc CK_MPU>;
};
cpu1: cpu@1 {
clocks = <&rcc CK_MPU>;
};
};
soc {
m_can1: can@4400e000 {
clocks = <&rcc CK_HSE>, <&rcc FDCAN_K>;
};
m_can2: can@4400f000 {
clocks = <&rcc CK_HSE>, <&rcc FDCAN_K>;
};
cryp1: cryp@54001000 {
clocks = <&rcc CRYP1>;
resets = <&rcc CRYP1_R>;
};
dsi: dsi@5a000000 {
clocks = <&rcc DSI_K>, <&clk_hse>, <&rcc DSI_PX>;
};
};
mlahb {
m4_rproc: m4@10000000 {
resets = <&rcc MCU_R>, <&rcc MCU_HOLD_BOOT_R>;
m4_system_resources {
m4_cec: cec@40016000 {
clocks = <&rcc CEC_K>, <&rcc CK_LSE>;
};
m4_m_can1: can@4400e000 {
clocks = <&rcc CK_HSE>, <&rcc FDCAN_K>;
};
m4_m_can2: can@4400f000 {
clocks = <&rcc CK_HSE>, <&rcc FDCAN_K>;
};
};
};
};
firmware {
/delete-node/ scmi-0;
/delete-node/ scmi-1;
};
/delete-node/ sram@2ffff000;
/delete-node/ mailbox-0;
/delete-node/ mailbox-1;
};
&cec {
clocks = <&rcc CEC_K>, <&clk_lse>;
};
&ddrperfm {
clocks = <&rcc DDRPERFM>, <&rcc PLL2_R>;
};
&gpioz {
clocks = <&rcc GPIOZ>;
};
&hash1 {
clocks = <&rcc HASH1>;
resets = <&rcc HASH1_R>;
};
&i2c4 {
clocks = <&rcc I2C4_K>;
resets = <&rcc I2C4_R>;
};
&i2c6 {
clocks = <&rcc I2C6_K>;
resets = <&rcc I2C6_R>;
};
&iwdg2 {
clocks = <&rcc IWDG2>, <&rcc CK_LSI>;
};
&mdma1 {
clocks = <&rcc MDMA>;
resets = <&rcc MDMA_R>;
};
&rcc {
compatible = "st,stm32mp1-rcc", "syscon";
clocks = <&clk_hse>, <&clk_hsi>, <&clk_csi>, <&clk_lse>, <&clk_lsi>;
};
&rng1 {
clocks = <&rcc RNG1_K>;
resets = <&rcc RNG1_R>;
};
&rtc {
clocks = <&rcc RTCAPB>, <&rcc RTC>;
};
&spi6 {
clocks = <&rcc SPI6_K>;
resets = <&rcc SPI6_R>;
};
&usart1 {
clocks = <&rcc USART1_K>;
};

File diff suppressed because it is too large Load Diff

View File

@ -21,45 +21,17 @@
pinctrl1 = &pinctrl_z;
};
clocks {
u-boot,dm-pre-reloc;
};
/* need PSCI for sysreset during board_f */
psci {
u-boot,dm-pre-proper;
};
reboot {
u-boot,dm-pre-reloc;
};
soc {
u-boot,dm-pre-reloc;
};
};
&bsec {
u-boot,dm-pre-proper;
};
&clk_csi {
u-boot,dm-pre-reloc;
};
&clk_hsi {
u-boot,dm-pre-reloc;
};
&clk_hse {
u-boot,dm-pre-reloc;
};
&clk_lsi {
u-boot,dm-pre-reloc;
};
&clk_lse {
u-boot,dm-pre-reloc;
};
@ -128,14 +100,58 @@
u-boot,dm-pre-reloc;
};
&pwr {
&pwr_regulators {
u-boot,dm-pre-reloc;
};
&rcc {
u-boot,dm-pre-reloc;
#address-cells = <1>;
#size-cells = <0>;
};
#ifdef CONFIG_STM32MP1_TRUSTED
&scmi0 {
u-boot,dm-pre-reloc;
};
&scmi0_clk {
u-boot,dm-pre-reloc;
};
&scmi0_mbox {
u-boot,dm-pre-reloc;
};
&scmi0_reset {
u-boot,dm-pre-reloc;
};
&scmi0_shm {
u-boot,dm-pre-reloc;
};
&scmi1 {
u-boot,dm-pre-reloc;
};
&scmi1_clk {
u-boot,dm-pre-reloc;
};
&scmi1_mbox {
u-boot,dm-pre-reloc;
};
&scmi1_shm {
u-boot,dm-pre-reloc;
};
&scmi_sram {
u-boot,dm-pre-reloc;
};
#endif
&sdmmc1 {
compatible = "st,stm32-sdmmc2", "arm,pl18x", "arm,primecell";
};
@ -148,6 +164,85 @@
compatible = "st,stm32-sdmmc2", "arm,pl18x", "arm,primecell";
};
&usbotg_hs {
compatible = "st,stm32mp1-hsotg", "snps,dwc2";
&usart1 {
resets = <&scmi0_reset RST_SCMI0_USART1>;
};
&usart2 {
resets = <&rcc USART2_R>;
};
&usart3 {
resets = <&rcc USART3_R>;
};
&uart4 {
resets = <&rcc UART4_R>;
};
&uart5 {
resets = <&rcc UART5_R>;
};
&usart6 {
resets = <&rcc USART6_R>;
};
&uart7 {
resets = <&rcc UART7_R>;
};
&uart8{
resets = <&rcc UART8_R>;
};
/* NO MORE USE SCMI SUPPORT for BASIC boot chain */
#ifndef CONFIG_STM32MP1_TRUSTED
#include "stm32mp15-no-scmi.dtsi"
/ {
clocks {
u-boot,dm-pre-reloc;
};
reboot {
u-boot,dm-pre-reloc;
};
};
&clk_hse {
u-boot,dm-pre-reloc;
};
&clk_hsi {
u-boot,dm-pre-reloc;
};
&clk_lse {
u-boot,dm-pre-reloc;
};
&clk_lsi {
u-boot,dm-pre-reloc;
};
&clk_csi {
u-boot,dm-pre-reloc;
};
&cpu0_opp_table {
u-boot,dm-spl;
opp-650000000 {
u-boot,dm-spl;
};
opp-800000000 {
u-boot,dm-spl;
};
};
&usart1 {
resets = <&rcc USART1_R>;
};
#endif /* CONFIG_STM32MP1_TRUSTED */

View File

@ -0,0 +1,54 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2019 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com> for STMicroelectronics.
*/
#include "stm32mp151.dtsi"
/ {
cpus {
cpu1: cpu@1 {
compatible = "arm,cortex-a7";
device_type = "cpu";
reg = <1>;
clocks = <&scmi0_clk CK_SCMI0_MPU>;
clock-names = "cpu";
operating-points-v2 = <&cpu0_opp_table>;
};
};
arm-pmu {
interrupts = <GIC_SPI 200 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 201 IRQ_TYPE_LEVEL_HIGH>;
interrupt-affinity = <&cpu0>, <&cpu1>;
};
soc {
m_can1: can@4400e000 {
compatible = "bosch,m_can";
reg = <0x4400e000 0x400>, <0x44011000 0x1400>;
reg-names = "m_can", "message_ram";
interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "int0", "int1";
clocks = <&scmi0_clk CK_SCMI0_HSE>, <&rcc FDCAN_K>;
clock-names = "hclk", "cclk";
bosch,mram-cfg = <0x0 0 0 32 0 0 2 2>;
status = "disabled";
};
m_can2: can@4400f000 {
compatible = "bosch,m_can";
reg = <0x4400f000 0x400>, <0x44011000 0x2800>;
reg-names = "m_can", "message_ram";
interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "int0", "int1";
clocks = <&scmi0_clk CK_SCMI0_HSE>, <&rcc FDCAN_K>;
clock-names = "hclk", "cclk";
bosch,mram-cfg = <0x1400 0 0 32 0 0 2 2>;
status = "disabled";
};
};
};

View File

@ -0,0 +1,524 @@
// 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, RSVD)>, /* I2C4_SCL */
<STM32_PINMUX('Z', 5, RSVD)>; /* I2C4_SDA */
};
};
m4_spi1_pins_a: m4-spi1-0 {
pins {
pinmux = <STM32_PINMUX('Z', 0, RSVD)>, /* SPI1_SCK */
<STM32_PINMUX('Z', 2, RSVD)>, /* SPI1_MOSI */
<STM32_PINMUX('Z', 1, RSVD)>; /* SPI1_MISO */
};
};
};

View File

@ -0,0 +1,442 @@
// 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.
*/
&m4_rproc {
m4_system_resources {
#address-cells = <1>;
#size-cells = <0>;
m4_timers2: timer@40000000 {
compatible = "rproc-srm-dev";
reg = <0x40000000 0x400>;
clocks = <&rcc TIM2_K>;
clock-names = "int";
status = "disabled";
};
m4_timers3: timer@40001000 {
compatible = "rproc-srm-dev";
reg = <0x40001000 0x400>;
clocks = <&rcc TIM3_K>;
clock-names = "int";
status = "disabled";
};
m4_timers4: timer@40002000 {
compatible = "rproc-srm-dev";
reg = <0x40002000 0x400>;
clocks = <&rcc TIM4_K>;
clock-names = "int";
status = "disabled";
};
m4_timers5: timer@40003000 {
compatible = "rproc-srm-dev";
reg = <0x40003000 0x400>;
clocks = <&rcc TIM5_K>;
clock-names = "int";
status = "disabled";
};
m4_timers6: timer@40004000 {
compatible = "rproc-srm-dev";
reg = <0x40004000 0x400>;
clocks = <&rcc TIM6_K>;
clock-names = "int";
status = "disabled";
};
m4_timers7: timer@40005000 {
compatible = "rproc-srm-dev";
reg = <0x40005000 0x400>;
clocks = <&rcc TIM7_K>;
clock-names = "int";
status = "disabled";
};
m4_timers12: timer@40006000 {
compatible = "rproc-srm-dev";
reg = <0x40006000 0x400>;
clocks = <&rcc TIM12_K>;
clock-names = "int";
status = "disabled";
};
m4_timers13: timer@40007000 {
compatible = "rproc-srm-dev";
reg = <0x40007000 0x400>;
clocks = <&rcc TIM13_K>;
clock-names = "int";
status = "disabled";
};
m4_timers14: timer@40008000 {
compatible = "rproc-srm-dev";
reg = <0x40008000 0x400>;
clocks = <&rcc TIM14_K>;
clock-names = "int";
status = "disabled";
};
m4_lptimer1: timer@40009000 {
compatible = "rproc-srm-dev";
reg = <0x40009000 0x400>;
clocks = <&rcc LPTIM1_K>;
clock-names = "mux";
status = "disabled";
};
m4_spi2: spi@4000b000 {
compatible = "rproc-srm-dev";
reg = <0x4000b000 0x400>;
clocks = <&rcc SPI2_K>;
status = "disabled";
};
m4_i2s2: audio-controller@4000b000 {
compatible = "rproc-srm-dev";
reg = <0x4000b000 0x400>;
status = "disabled";
};
m4_spi3: spi@4000c000 {
compatible = "rproc-srm-dev";
reg = <0x4000c000 0x400>;
clocks = <&rcc SPI3_K>;
status = "disabled";
};
m4_i2s3: audio-controller@4000c000 {
compatible = "rproc-srm-dev";
reg = <0x4000c000 0x400>;
status = "disabled";
};
m4_spdifrx: audio-controller@4000d000 {
compatible = "rproc-srm-dev";
reg = <0x4000d000 0x400>;
clocks = <&rcc SPDIF_K>;
clock-names = "kclk";
status = "disabled";
};
m4_usart2: serial@4000e000 {
compatible = "rproc-srm-dev";
reg = <0x4000e000 0x400>;
interrupt-parent = <&exti>;
interrupts = <27 1>;
clocks = <&rcc USART2_K>;
status = "disabled";
};
m4_usart3: serial@4000f000 {
compatible = "rproc-srm-dev";
reg = <0x4000f000 0x400>;
interrupt-parent = <&exti>;
interrupts = <28 1>;
clocks = <&rcc USART3_K>;
status = "disabled";
};
m4_uart4: serial@40010000 {
compatible = "rproc-srm-dev";
reg = <0x40010000 0x400>;
interrupt-parent = <&exti>;
interrupts = <30 1>;
clocks = <&rcc UART4_K>;
status = "disabled";
};
m4_uart5: serial@40011000 {
compatible = "rproc-srm-dev";
reg = <0x40011000 0x400>;
interrupt-parent = <&exti>;
interrupts = <31 1>;
clocks = <&rcc UART5_K>;
status = "disabled";
};
m4_i2c1: i2c@40012000 {
compatible = "rproc-srm-dev";
reg = <0x40012000 0x400>;
interrupt-parent = <&exti>;
interrupts = <21 1>;
clocks = <&rcc I2C1_K>;
status = "disabled";
};
m4_i2c2: i2c@40013000 {
compatible = "rproc-srm-dev";
reg = <0x40013000 0x400>;
interrupt-parent = <&exti>;
interrupts = <22 1>;
clocks = <&rcc I2C2_K>;
status = "disabled";
};
m4_i2c3: i2c@40014000 {
compatible = "rproc-srm-dev";
reg = <0x40014000 0x400>;
interrupt-parent = <&exti>;
interrupts = <23 1>;
clocks = <&rcc I2C3_K>;
status = "disabled";
};
m4_i2c5: i2c@40015000 {
compatible = "rproc-srm-dev";
reg = <0x40015000 0x400>;
interrupt-parent = <&exti>;
interrupts = <25 1>;
clocks = <&rcc I2C5_K>;
status = "disabled";
};
m4_cec: cec@40016000 {
compatible = "rproc-srm-dev";
reg = <0x40016000 0x400>;
interrupt-parent = <&exti>;
interrupts = <69 1>;
clocks = <&rcc CEC_K>, <&scmi0_clk CK_SCMI0_LSE>;
clock-names = "cec", "hdmi-cec";
status = "disabled";
};
m4_dac: dac@40017000 {
compatible = "rproc-srm-dev";
reg = <0x40017000 0x400>;
clocks = <&rcc DAC12>;
clock-names = "pclk";
status = "disabled";
};
m4_uart7: serial@40018000 {
compatible = "rproc-srm-dev";
reg = <0x40018000 0x400>;
interrupt-parent = <&exti>;
interrupts = <32 1>;
clocks = <&rcc UART7_K>;
status = "disabled";
};
m4_uart8: serial@40019000 {
compatible = "rproc-srm-dev";
reg = <0x40019000 0x400>;
interrupt-parent = <&exti>;
interrupts = <33 1>;
clocks = <&rcc UART8_K>;
status = "disabled";
};
m4_timers1: timer@44000000 {
compatible = "rproc-srm-dev";
reg = <0x44000000 0x400>;
clocks = <&rcc TIM1_K>;
clock-names = "int";
status = "disabled";
};
m4_timers8: timer@44001000 {
compatible = "rproc-srm-dev";
reg = <0x44001000 0x400>;
clocks = <&rcc TIM8_K>;
clock-names = "int";
status = "disabled";
};
m4_usart6: serial@44003000 {
compatible = "rproc-srm-dev";
reg = <0x44003000 0x400>;
interrupt-parent = <&exti>;
interrupts = <29 1>;
clocks = <&rcc USART6_K>;
status = "disabled";
};
m4_spi1: spi@44004000 {
compatible = "rproc-srm-dev";
reg = <0x44004000 0x400>;
clocks = <&rcc SPI1_K>;
status = "disabled";
};
m4_i2s1: audio-controller@44004000 {
compatible = "rproc-srm-dev";
reg = <0x44004000 0x400>;
status = "disabled";
};
m4_spi4: spi@44005000 {
compatible = "rproc-srm-dev";
reg = <0x44005000 0x400>;
clocks = <&rcc SPI4_K>;
status = "disabled";
};
m4_timers15: timer@44006000 {
compatible = "rproc-srm-dev";
reg = <0x44006000 0x400>;
clocks = <&rcc TIM15_K>;
clock-names = "int";
status = "disabled";
};
m4_timers16: timer@44007000 {
compatible = "rproc-srm-dev";
reg = <0x44007000 0x400>;
clocks = <&rcc TIM16_K>;
clock-names = "int";
status = "disabled";
};
m4_timers17: timer@44008000 {
compatible = "rproc-srm-dev";
reg = <0x44008000 0x400>;
clocks = <&rcc TIM17_K>;
clock-names = "int";
status = "disabled";
};
m4_spi5: spi@44009000 {
compatible = "rproc-srm-dev";
reg = <0x44009000 0x400>;
clocks = <&rcc SPI5_K>;
status = "disabled";
};
m4_sai1: sai@4400a000 {
compatible = "rproc-srm-dev";
reg = <0x4400a000 0x4>;
clocks = <&rcc SAI1_K>;
clock-names = "sai_ck";
status = "disabled";
};
m4_sai2: sai@4400b000 {
compatible = "rproc-srm-dev";
reg = <0x4400b000 0x4>;
clocks = <&rcc SAI2_K>;
clock-names = "sai_ck";
status = "disabled";
};
m4_sai3: sai@4400c000 {
compatible = "rproc-srm-dev";
reg = <0x4400c000 0x4>;
clocks = <&rcc SAI3_K>;
clock-names = "sai_ck";
status = "disabled";
};
m4_dfsdm: dfsdm@4400d000 {
compatible = "rproc-srm-dev";
reg = <0x4400d000 0x800>;
clocks = <&rcc DFSDM_K>, <&rcc ADFSDM_K>;
clock-names = "dfsdm", "audio";
status = "disabled";
};
m4_m_can1: can@4400e000 {
compatible = "rproc-srm-dev";
reg = <0x4400e000 0x400>, <0x44011000 0x2800>;
clocks = <&scmi0_clk CK_SCMI0_HSE>, <&rcc FDCAN_K>;
clock-names = "hclk", "cclk";
status = "disabled";
};
m4_m_can2: can@4400f000 {
compatible = "rproc-srm-dev";
reg = <0x4400f000 0x400>, <0x44011000 0x2800>;
clocks = <&scmi0_clk CK_SCMI0_HSE>, <&rcc FDCAN_K>;
clock-names = "hclk", "cclk";
status = "disabled";
};
m4_dma1: dma@48000000 {
compatible = "rproc-srm-dev";
reg = <0x48000000 0x400>;
clocks = <&rcc DMA1>;
status = "disabled";
};
m4_dma2: dma@48001000 {
compatible = "rproc-srm-dev";
reg = <0x48001000 0x400>;
clocks = <&rcc DMA2>;
status = "disabled";
};
m4_dmamux1: dma-router@48002000 {
compatible = "rproc-srm-dev";
reg = <0x48002000 0x1c>;
clocks = <&rcc DMAMUX>;
status = "disabled";
};
m4_adc: adc@48003000 {
compatible = "rproc-srm-dev";
reg = <0x48003000 0x400>;
clocks = <&rcc ADC12>, <&rcc ADC12_K>;
clock-names = "bus", "adc";
status = "disabled";
};
m4_sdmmc3: sdmmc@48004000 {
compatible = "rproc-srm-dev";
reg = <0x48004000 0x400>, <0x48005000 0x400>;
clocks = <&rcc SDMMC3_K>;
status = "disabled";
};
m4_usbotg_hs: usb-otg@49000000 {
compatible = "rproc-srm-dev";
reg = <0x49000000 0x10000>;
clocks = <&rcc USBO_K>;
clock-names = "otg";
status = "disabled";
};
m4_hash2: hash@4c002000 {
compatible = "rproc-srm-dev";
reg = <0x4c002000 0x400>;
clocks = <&rcc HASH2>;
status = "disabled";
};
m4_rng2: rng@4c003000 {
compatible = "rproc-srm-dev";
reg = <0x4c003000 0x400>;
clocks = <&rcc RNG2_K>;
status = "disabled";
};
m4_crc2: crc@4c004000 {
compatible = "rproc-srm-dev";
reg = <0x4c004000 0x400>;
clocks = <&rcc CRC2>;
status = "disabled";
};
m4_cryp2: cryp@4c005000 {
compatible = "rproc-srm-dev";
reg = <0x4c005000 0x400>;
clocks = <&rcc CRYP2>;
status = "disabled";
};
m4_dcmi: dcmi@4c006000 {
compatible = "rproc-srm-dev";
reg = <0x4c006000 0x400>;
clocks = <&rcc DCMI>;
clock-names = "mclk";
status = "disabled";
};
m4_lptimer2: timer@50021000 {
compatible = "rproc-srm-dev";
reg = <0x50021000 0x400>;
clocks = <&rcc LPTIM2_K>;
clock-names = "mux";
status = "disabled";
};
m4_lptimer3: timer@50022000 {
compatible = "rproc-srm-dev";
reg = <0x50022000 0x400>;
clocks = <&rcc LPTIM3_K>;
clock-names = "mux";
status = "disabled";
};
m4_lptimer4: timer@50023000 {
compatible = "rproc-srm-dev";
reg = <0x50023000 0x400>;
clocks = <&rcc LPTIM4_K>;
clock-names = "mux";
status = "disabled";
};
m4_lptimer5: timer@50024000 {
compatible = "rproc-srm-dev";
reg = <0x50024000 0x400>;
clocks = <&rcc LPTIM5_K>;
clock-names = "mux";
status = "disabled";
};
m4_sai4: sai@50027000 {
compatible = "rproc-srm-dev";
reg = <0x50027000 0x4>;
clocks = <&rcc SAI4_K>;
clock-names = "sai_ck";
status = "disabled";
};
m4_qspi: qspi@58003000 {
compatible = "rproc-srm-dev";
reg = <0x58003000 0x1000>, <0x70000000 0x10000000>;
clocks = <&rcc QSPI_K>;
status = "disabled";
};
m4_ethernet0: ethernet@5800a000 {
compatible = "rproc-srm-dev";
reg = <0x5800a000 0x2000>;
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,32 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2019 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com> for STMicroelectronics.
*/
#include "stm32mp153.dtsi"
/ {
soc {
gpu: gpu@59000000 {
compatible = "vivante,gc";
reg = <0x59000000 0x800>;
interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc GPU>, <&rcc GPU_K>;
clock-names = "bus" ,"core";
resets = <&rcc GPU_R>;
status = "disabled";
};
dsi: dsi@5a000000 {
compatible = "st,stm32-dsi";
reg = <0x5a000000 0x800>;
phy-dsi-supply = <&reg18>;
clocks = <&rcc DSI_K>, <&scmi0_clk CK_SCMI0_HSE>, <&rcc DSI_PX>;
clock-names = "pclk", "ref", "px_clk";
resets = <&rcc DSI_R>;
reset-names = "apb";
status = "disabled";
};
};
};

View File

@ -7,7 +7,7 @@
*/
#include <dt-bindings/clock/stm32mp1-clksrc.h>
#include "stm32mp157-u-boot.dtsi"
#include "stm32mp15-u-boot.dtsi"
#include "stm32mp15-ddr3-2x4Gb-1066-binG.dtsi"
/ {
@ -20,6 +20,7 @@
config {
u-boot,boot-led = "led1";
u-boot,error-led = "led4";
u-boot,mmc-env-partition = "ssbl";
};
};
@ -91,7 +92,7 @@
CLK_UART6_HSI
CLK_UART78_HSI
CLK_SPDIF_PLL4P
CLK_FDCAN_PLL4Q
CLK_FDCAN_PLL4R
CLK_SAI1_PLL3Q
CLK_SAI2_PLL3Q
CLK_SAI3_PLL3Q
@ -103,15 +104,10 @@
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 {
compatible = "st,stm32mp1-pll";
reg = <1>;
cfg = < 2 65 1 0 0 PQR(1,1,1) >;
frac = < 0x1400 >;
u-boot,dm-pre-reloc;
@ -119,6 +115,8 @@
/* VCO = 417.8 MHz => P = 209, Q = 24, R = 11 */
pll3: st,pll@2 {
compatible = "st,stm32mp1-pll";
reg = <2>;
cfg = < 1 33 1 16 36 PQR(1,1,1) >;
frac = < 0x1a04 >;
u-boot,dm-pre-reloc;
@ -126,6 +124,8 @@
/* VCO = 480.0 MHz => P = 120, Q = 40, R = 96 */
pll4: st,pll@3 {
compatible = "st,stm32mp1-pll";
reg = <3>;
cfg = < 1 39 3 11 4 PQR(1,1,1) >;
u-boot,dm-pre-reloc;
};
@ -137,14 +137,20 @@
&sdmmc1_b4_pins_a {
u-boot,dm-spl;
pins {
pins1 {
u-boot,dm-spl;
};
pins2 {
u-boot,dm-spl;
};
};
&sdmmc1_dir_pins_a {
u-boot,dm-spl;
pins {
pins1 {
u-boot,dm-spl;
};
pins2 {
u-boot,dm-spl;
};
};
@ -188,7 +194,3 @@
u-boot,force-b-session-valid;
hnp-srp-disable;
};
&v3v3 {
regulator-always-on;
};

View File

@ -6,9 +6,10 @@
/dts-v1/;
#include "stm32mp157c.dtsi"
#include "stm32mp157xac-pinctrl.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include "stm32mp157.dtsi"
#include "stm32mp15xa.dtsi"
#include "stm32mp15-pinctrl.dtsi"
#include "stm32mp15xxac-pinctrl.dtsi"
#include <dt-bindings/mfd/st,stpmic1.h>
/ {
@ -91,6 +92,9 @@
#address-cells = <1>;
#size-cells = <0>;
compatible = "snps,dwmac-mdio";
reset-gpios = <&gpioz 2 GPIO_ACTIVE_LOW>;
reset-delay-us = <1000>;
phy0: ethernet-phy@7 {
reg = <7>;
};
@ -252,14 +256,13 @@
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>;
};
};
@ -282,11 +285,9 @@
status = "okay";
};
&pwr {
pwr-regulators {
vdd-supply = <&vdd>;
vdd_3v3_usbfs-supply = <&vdd_usb>;
};
&pwr_regulators {
vdd-supply = <&vdd>;
vdd_3v3_usbfs-supply = <&vdd_usb>;
};
&rng1 {
@ -302,7 +303,7 @@
pinctrl-0 = <&sdmmc1_b4_pins_a &sdmmc1_dir_pins_a>;
pinctrl-1 = <&sdmmc1_b4_od_pins_a>;
pinctrl-2 = <&sdmmc1_b4_sleep_pins_a>;
broken-cd;
cd-gpios = <&gpioi 8 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
st,sig-dir;
st,neg-edge;
st,use-ckin;

View File

@ -4,7 +4,7 @@
*/
#include <dt-bindings/clock/stm32mp1-clksrc.h>
#include "stm32mp157-u-boot.dtsi"
#include "stm32mp15-u-boot.dtsi"
#include "stm32mp15-ddr3-1x4Gb-1066-binG.dtsi"
/ {
@ -16,10 +16,12 @@
config {
u-boot,boot-led = "heartbeat";
u-boot,error-led = "error";
u-boot,mmc-env-partition = "ssbl";
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";
@ -27,34 +29,28 @@
default-state = "off";
status = "okay";
};
};
blue {
default-state = "on";
firmware {
optee {
compatible = "linaro,optee-tz";
method = "smc";
};
};
reserved-memory {
optee@de000000 {
reg = <0xde000000 0x02000000>;
no-map;
};
};
};
&adc {
pinctrl-names = "default";
pinctrl-0 = <&adc12_usb_pwr_pins_a>;
vdd-supply = <&vdd>;
vdda-supply = <&vdd>;
vref-supply = <&vrefbuf>;
status = "okay";
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>;
/* ANA0, ANA1, USB Type-C CC1 & CC2 */
st,adc-channels = <0 1 18 19>;
status = "okay";
};
};
#ifndef CONFIG_STM32MP1_TRUSTED
&clk_hse {
st,digbypass;
};
@ -70,6 +66,10 @@
};
};
&i2s2 {
clocks = <&rcc SPI2>, <&rcc SPI2_K>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
};
&pmic {
u-boot,dm-pre-reloc;
};
@ -127,7 +127,7 @@
CLK_UART6_HSI
CLK_UART78_HSI
CLK_SPDIF_PLL4P
CLK_FDCAN_PLL4Q
CLK_FDCAN_PLL4R
CLK_SAI1_PLL3Q
CLK_SAI2_PLL3Q
CLK_SAI3_PLL3Q
@ -139,15 +139,10 @@
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 {
compatible = "st,stm32mp1-pll";
reg = <1>;
cfg = < 2 65 1 0 0 PQR(1,1,1) >;
frac = < 0x1400 >;
u-boot,dm-pre-reloc;
@ -155,6 +150,8 @@
/* VCO = 417.8 MHz => P = 209, Q = 24, R = 11 */
pll3: st,pll@2 {
compatible = "st,stm32mp1-pll";
reg = <2>;
cfg = < 1 33 1 16 36 PQR(1,1,1) >;
frac = < 0x1a04 >;
u-boot,dm-pre-reloc;
@ -162,21 +159,31 @@
/* VCO = 594.0 MHz => P = 99, Q = 74, R = 74 */
pll4: st,pll@3 {
compatible = "st,stm32mp1-pll";
reg = <3>;
cfg = < 3 98 5 7 7 PQR(1,1,1) >;
u-boot,dm-pre-reloc;
};
};
&sai2 {
clocks = <&rcc SAI2>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
};
&sdmmc1 {
u-boot,dm-spl;
};
&sdmmc1_b4_pins_a {
u-boot,dm-spl;
pins {
pins1 {
u-boot,dm-spl;
};
pins2 {
u-boot,dm-spl;
};
};
#endif
&uart4 {
u-boot,dm-pre-reloc;
@ -197,4 +204,6 @@
&usbotg_hs {
u-boot,force-b-session-valid;
hnp-srp-disable;
/* TEMP: force peripheral for USB OTG */
dr_mode = "peripheral";
};

View File

@ -6,11 +6,11 @@
/dts-v1/;
#include "stm32mp157c.dtsi"
#include "stm32mp157xac-pinctrl.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/mfd/st,stpmic1.h>
#include "stm32mp157.dtsi"
#include "stm32mp15xa.dtsi"
#include "stm32mp15-pinctrl.dtsi"
#include "stm32mp15xxac-pinctrl.dtsi"
#include "stm32mp15xx-dkx.dtsi"
/ {
model = "STMicroelectronics STM32MP157A-DK1 Discovery Board";
compatible = "st,stm32mp157a-dk1", "st,stm32mp157";
@ -18,491 +18,18 @@
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;
mcuram2: mcuram2@10000000 {
compatible = "shared-dma-pool";
reg = <0x10000000 0x40000>;
no-map;
};
vdev0vring0: vdev0vring0@10040000 {
compatible = "shared-dma-pool";
reg = <0x10040000 0x1000>;
no-map;
};
vdev0vring1: vdev0vring1@10041000 {
compatible = "shared-dma-pool";
reg = <0x10041000 0x1000>;
no-map;
};
vdev0buffer: vdev0buffer@10042000 {
compatible = "shared-dma-pool";
reg = <0x10042000 0x4000>;
no-map;
};
mcuram: mcuram@30000000 {
compatible = "shared-dma-pool";
reg = <0x30000000 0x40000>;
no-map;
};
retram: retram@38000000 {
compatible = "shared-dma-pool";
reg = <0x38000000 0x10000>;
no-map;
};
gpu_reserved: gpu@d4000000 {
reg = <0xd4000000 0x4000000>;
gpu_reserved: gpu@da000000 {
reg = <0xda000000 0x4000000>;
no-map;
};
};
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>;
status = "okay";
};
};
&cec {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&cec_pins_b>;
pinctrl-1 = <&cec_pins_sleep_b>;
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;
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>;
pinctrl-names = "default", "sleep";
pinctrl-0 = <&ltdc_pins_a>;
pinctrl-1 = <&ltdc_pins_sleep_a>;
status = "okay";
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
sii9022_in: endpoint {
remote-endpoint = <&ltdc_ep0_out>;
};
};
};
};
cs42l51: cs42l51@4a {
compatible = "cirrus,cs42l51";
reg = <0x4a>;
#sound-dai-cells = <0>;
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";
status = "okay";
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;
};
};
};
};
&i2c4 {
pinctrl-names = "default";
pinctrl-0 = <&i2c4_pins_a>;
i2c-scl-rising-time-ns = <185>;
i2c-scl-falling-time-ns = <20>;
status = "okay";
/* spare dmas for other usage */
/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 = "sink";
power-opmode = "default";
};
};
pmic: stpmic@33 {
compatible = "st,stpmic1";
reg = <0x33>;
interrupts-extended = <&gpioa 0 IRQ_TYPE_EDGE_FALLING>;
interrupt-controller;
#interrupt-cells = <2>;
status = "okay";
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 = <800000>;
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;
};
};
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";
};
&ltdc {
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>;
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>;
clocks = <&rcc SAI2_K>, <&sai2a>;
clock-names = "sai_ck", "MCLK";
status = "okay";
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";
};
&uart4 {
pinctrl-names = "default";
pinctrl-0 = <&uart4_pins_a>;
status = "okay";
};
&usbh_ehci {
phys = <&usbphyc_port0>;
phy-names = "usb";
status = "okay";
};
&usbotg_hs {
dr_mode = "peripheral";
phys = <&usbphyc_port1 0>;
phy-names = "usb2-phy";
status = "okay";
};
&usbphyc {
status = "okay";
};
&usbphyc_port0 {
phy-supply = <&vdd_usb>;
};
&usbphyc_port1 {
phy-supply = <&vdd_usb>;
};
&vrefbuf {
regulator-min-microvolt = <2500000>;
regulator-max-microvolt = <2500000>;
vdda-supply = <&vdd>;
status = "okay";
};

View File

@ -0,0 +1,221 @@
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/*
* Copyright : STMicroelectronics 2018
*/
#include <dt-bindings/clock/stm32mp1-clksrc.h>
#include "stm32mp15-u-boot.dtsi"
#include "stm32mp15-ddr3-2x4Gb-1066-binG.dtsi"
/ {
aliases {
i2c3 = &i2c4;
mmc0 = &sdmmc1;
mmc1 = &sdmmc2;
};
config {
u-boot,boot-led = "heartbeat";
u-boot,error-led = "error";
u-boot,mmc-env-partition = "ssbl";
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";
};
};
firmware {
optee {
compatible = "linaro,optee-tz";
method = "smc";
};
};
reserved-memory {
optee@fe000000 {
reg = <0xfe000000 0x02000000>;
no-map;
};
};
};
#ifndef CONFIG_STM32MP1_TRUSTED
&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 {
compatible = "st,stm32mp1-pll";
reg = <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 {
compatible = "st,stm32mp1-pll";
reg = <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 {
compatible = "st,stm32mp1-pll";
reg = <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;
};
};
&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;
pins1 {
u-boot,dm-spl;
};
pins2 {
u-boot,dm-spl;
};
};
&sdmmc2_d47_pins_a {
u-boot,dm-spl;
pins {
u-boot,dm-spl;
};
};
#endif
&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,43 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2019 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com> for STMicroelectronics.
*/
/dts-v1/;
#include "stm32mp157.dtsi"
#include "stm32mp15xa.dtsi"
#include "stm32mp15-pinctrl.dtsi"
#include "stm32mp15xxaa-pinctrl.dtsi"
#include "stm32mp157-m4-srm.dtsi"
#include "stm32mp157-m4-srm-pinctrl.dtsi"
#include "stm32mp15xx-edx.dtsi"
/ {
model = "STMicroelectronics STM32MP157A eval daughter";
compatible = "st,stm32mp157a-ed1", "st,stm32mp157";
chosen {
stdout-path = "serial0:115200n8";
};
aliases {
serial0 = &uart4;
};
reserved-memory {
gpu_reserved: gpu@f6000000 {
reg = <0xf6000000 0x8000000>;
no-map;
};
};
};
&cpu1{
cpu-supply = <&vddcore>;
};
&gpu {
contiguous-area = <&gpu_reserved>;
status = "okay";
};

View File

@ -0,0 +1,69 @@
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/*
* Copyright : STMicroelectronics 2018
*/
#include "stm32mp157c-ed1-u-boot.dtsi"
/ {
aliases {
gpio26 = &stmfx_pinctrl;
i2c1 = &i2c2;
i2c4 = &i2c5;
pinctrl2 = &stmfx_pinctrl;
spi0 = &qspi;
usb0 = &usbotg_hs;
};
};
#ifndef CONFIG_STM32MP1_TRUSTED
&flash0 {
u-boot,dm-spl;
};
&qspi {
u-boot,dm-spl;
};
&qspi_clk_pins_a {
u-boot,dm-spl;
pins {
u-boot,dm-spl;
};
};
&qspi_bk1_pins_a {
u-boot,dm-spl;
pins1 {
u-boot,dm-spl;
};
pins2 {
u-boot,dm-spl;
};
};
&qspi_bk2_pins_a {
u-boot,dm-spl;
pins1 {
u-boot,dm-spl;
};
pins2 {
u-boot,dm-spl;
};
};
&sai2 {
clocks = <&rcc SAI2>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
};
&sai4 {
clocks = <&rcc SAI4>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
};
#endif
/* TEMP: force peripheral for USB OTG */
&usbotg_hs {
dr_mode = "peripheral";
};

View File

@ -0,0 +1,86 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2019 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com> for STMicroelectronics.
*/
/dts-v1/;
#include "stm32mp157a-ed1.dts"
#include "stm32mp15xx-evx.dtsi"
#include <dt-bindings/input/input.h>
#include <dt-bindings/soc/stm32-hdp.h>
/ {
model = "STMicroelectronics STM32MP157A eval daughter on eval mother";
compatible = "st,stm32mp157a-ev1", "st,stm32mp157a-ed1", "st,stm32mp157";
chosen {
stdout-path = "serial0:115200n8";
};
aliases {
serial1 = &usart3;
ethernet0 = &ethernet0;
};
};
&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>;
backlight = <&panel_backlight>;
power-supply = <&v3v3>;
status = "okay";
port {
dsi_panel_in: endpoint {
remote-endpoint = <&dsi_out>;
};
};
};
};
&i2c2 {
gt9147: goodix_ts@5d {
compatible = "goodix,gt9147";
reg = <0x5d>;
panel = <&panel_dsi>;
pinctrl-0 = <&goodix_pins>;
pinctrl-names = "default";
status = "okay";
interrupts = <14 IRQ_TYPE_EDGE_RISING>;
interrupt-parent = <&stmfx_pinctrl>;
};
};
&m_can1 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&m_can1_pins_a>;
pinctrl-1 = <&m_can1_sleep_pins_a>;
status = "okay";
};

View File

@ -4,9 +4,3 @@
*/
#include "stm32mp157a-dk1-u-boot.dtsi"
&i2c1 {
hdmi-transmitter@39 {
reset-gpios = <&gpioa 10 GPIO_ACTIVE_LOW>;
};
};

View File

@ -6,18 +6,50 @@
/dts-v1/;
#include "stm32mp157a-dk1.dts"
#include "stm32mp157.dtsi"
#include "stm32mp15xc.dtsi"
#include "stm32mp15-pinctrl.dtsi"
#include "stm32mp15xxac-pinctrl.dtsi"
#include "stm32mp15xx-dkx.dtsi"
#include <dt-bindings/rtc/rtc-stm32.h>
/ {
model = "STMicroelectronics STM32MP157C-DK2 Discovery Board";
compatible = "st,stm32mp157c-dk2", "st,stm32mp157";
aliases {
ethernet0 = &ethernet0;
serial0 = &uart4;
serial1 = &usart3;
serial2 = &uart7;
serial3 = &usart2;
};
chosen {
stdout-path = "serial0:115200n8";
};
reserved-memory {
gpu_reserved: gpu@da000000 {
reg = <0xda000000 0x4000000>;
no-map;
};
};
wifi_pwrseq: wifi-pwrseq {
compatible = "mmc-pwrseq-simple";
reset-gpios = <&gpioh 4 GPIO_ACTIVE_LOW>;
};
};
&cryp1 {
status="okay";
};
&dsi {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
phy-dsi-supply = <&reg18>;
ports {
#address-cells = <1>;
@ -38,7 +70,7 @@
};
};
panel@0 {
panel_otm8009a: panel-otm8009a@0 {
compatible = "orisetech,otm8009a";
reg = <0>;
reset-gpios = <&gpioe 4 GPIO_ACTIVE_LOW>;
@ -53,6 +85,31 @@
};
};
&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_otm8009a>;
status = "okay";
};
touchscreen@38 {
compatible = "focaltech,ft6236";
reg = <0x38>;
interrupts = <2 2>;
interrupt-parent = <&gpiof>;
interrupt-controller;
touchscreen-size-x = <480>;
touchscreen-size-y = <800>;
panel = <&panel_otm8009a>;
status = "okay";
};
};
&ltdc {
status = "okay";
@ -66,3 +123,49 @@
};
};
};
&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_a>;
pinctrl-1 = <&sdmmc2_b4_od_pins_a>;
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>;
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>;
uart-has-rtscts;
status = "okay";
bluetooth {
shutdown-gpios = <&gpioz 6 GPIO_ACTIVE_HIGH>;
compatible = "brcm,bcm43438-bt";
max-speed = <3000000>;
vbat-supply = <&v3v3>;
vddio-supply = <&v3v3>;
};
};

View File

@ -3,204 +3,4 @@
* Copyright : STMicroelectronics 2018
*/
#include <dt-bindings/clock/stm32mp1-clksrc.h>
#include "stm32mp157-u-boot.dtsi"
#include "stm32mp15-ddr3-2x4Gb-1066-binG.dtsi"
/ {
aliases {
i2c3 = &i2c4;
mmc0 = &sdmmc1;
mmc1 = &sdmmc2;
};
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 {
red {
label = "error";
gpios = <&gpioa 13 GPIO_ACTIVE_LOW>;
default-state = "off";
status = "okay";
};
blue {
default-state = "on";
};
};
};
&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_PLL4Q
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 = 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) >;
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;
pins {
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;
pins1 {
u-boot,dm-spl;
};
pins2 {
u-boot,dm-spl;
};
};
&sdmmc2_d47_pins_a {
u-boot,dm-spl;
pins {
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;
};
};
#include "stm32mp157a-ed1-u-boot.dtsi"

View File

@ -1,14 +1,17 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2017 - All Rights Reserved
* Author: Ludovic Barre <ludovic.barre@st.com> for STMicroelectronics.
* Copyright (C) STMicroelectronics 2019 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com> for STMicroelectronics.
*/
/dts-v1/;
#include "stm32mp157c.dtsi"
#include "stm32mp157xaa-pinctrl.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/mfd/st,stpmic1.h>
#include "stm32mp157.dtsi"
#include "stm32mp15xc.dtsi"
#include "stm32mp15-pinctrl.dtsi"
#include "stm32mp15xxaa-pinctrl.dtsi"
#include "stm32mp157-m4-srm.dtsi"
#include "stm32mp157-m4-srm-pinctrl.dtsi"
#include "stm32mp15xx-edx.dtsi"
/ {
model = "STMicroelectronics STM32MP157C eval daughter";
@ -18,321 +21,27 @@
stdout-path = "serial0:115200n8";
};
memory@c0000000 {
device_type = "memory";
reg = <0xC0000000 0x40000000>;
};
reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
ranges;
mcuram2: mcuram2@10000000 {
compatible = "shared-dma-pool";
reg = <0x10000000 0x40000>;
no-map;
};
vdev0vring0: vdev0vring0@10040000 {
compatible = "shared-dma-pool";
reg = <0x10040000 0x1000>;
no-map;
};
vdev0vring1: vdev0vring1@10041000 {
compatible = "shared-dma-pool";
reg = <0x10041000 0x1000>;
no-map;
};
vdev0buffer: vdev0buffer@10042000 {
compatible = "shared-dma-pool";
reg = <0x10042000 0x4000>;
no-map;
};
mcuram: mcuram@30000000 {
compatible = "shared-dma-pool";
reg = <0x30000000 0x40000>;
no-map;
};
retram: retram@38000000 {
compatible = "shared-dma-pool";
reg = <0x38000000 0x10000>;
no-map;
};
gpu_reserved: gpu@e8000000 {
reg = <0xe8000000 0x8000000>;
no-map;
};
};
aliases {
serial0 = &uart4;
};
sd_switch: regulator-sd_switch {
compatible = "regulator-gpio";
regulator-name = "sd_switch";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <2900000>;
regulator-type = "voltage";
regulator-always-on;
gpios = <&gpiof 14 GPIO_ACTIVE_HIGH>;
gpios-states = <0>;
states = <1800000 0x1 2900000 0x0>;
reserved-memory {
gpu_reserved: gpu@f6000000 {
reg = <0xf6000000 0x8000000>;
no-map;
};
};
};
&dts {
status = "okay";
&cpu1{
cpu-supply = <&vddcore>;
};
&cryp1 {
status="okay";
};
&gpu {
contiguous-area = <&gpu_reserved>;
status = "okay";
};
&i2c4 {
pinctrl-names = "default";
pinctrl-0 = <&i2c4_pins_a>;
i2c-scl-rising-time-ns = <185>;
i2c-scl-falling-time-ns = <20>;
status = "okay";
/* spare dmas for other usage */
/delete-property/dmas;
/delete-property/dma-names;
pmic: stpmic@33 {
compatible = "st,stpmic1";
reg = <0x33>;
interrupts-extended = <&gpioa 0 IRQ_TYPE_EDGE_FALLING>;
interrupt-controller;
#interrupt-cells = <2>;
status = "okay";
regulators {
compatible = "st,stpmic1-regulators";
ldo1-supply = <&v3v3>;
ldo2-supply = <&v3v3>;
ldo3-supply = <&vdd_ddr>;
ldo5-supply = <&v3v3>;
ldo6-supply = <&v3v3>;
pwr_sw1-supply = <&bst_out>;
pwr_sw2-supply = <&bst_out>;
vddcore: buck1 {
regulator-name = "vddcore";
regulator-min-microvolt = <800000>;
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>;
};
vdda: ldo1 {
regulator-name = "vdda";
regulator-min-microvolt = <2900000>;
regulator-max-microvolt = <2900000>;
interrupts = <IT_CURLIM_LDO1 0>;
};
v2v8: ldo2 {
regulator-name = "v2v8";
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <2800000>;
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>;
};
vdd_sd: ldo5 {
regulator-name = "vdd_sd";
regulator-min-microvolt = <2900000>;
regulator-max-microvolt = <2900000>;
interrupts = <IT_CURLIM_LDO5 0>;
regulator-boot-on;
};
v1v8: ldo6 {
regulator-name = "v1v8";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
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;
};
};
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>;
status = "okay";
};
&pwr {
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,sig-dir;
st,neg-edge;
st,use-ckin;
bus-width = <4>;
vmmc-supply = <&vdd_sd>;
vqmmc-supply = <&sd_switch>;
status = "okay";
};
&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,neg-edge;
bus-width = <8>;
vmmc-supply = <&v3v3>;
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-0 = <&uart4_pins_a>;
status = "okay";
};
&usbotg_hs {
vbus-supply = <&vbus_otg>;
};
&usbphyc_port0 {
phy-supply = <&vdd_usb>;
};
&usbphyc_port1 {
phy-supply = <&vdd_usb>;
};

View File

@ -3,51 +3,4 @@
* Copyright : STMicroelectronics 2018
*/
#include "stm32mp157c-ed1-u-boot.dtsi"
/ {
aliases {
gpio26 = &stmfx_pinctrl;
i2c1 = &i2c2;
i2c4 = &i2c5;
pinctrl2 = &stmfx_pinctrl;
spi0 = &qspi;
usb0 = &usbotg_hs;
};
};
&flash0 {
u-boot,dm-spl;
};
&qspi {
u-boot,dm-spl;
};
&qspi_clk_pins_a {
u-boot,dm-spl;
pins {
u-boot,dm-spl;
};
};
&qspi_bk1_pins_a {
u-boot,dm-spl;
pins1 {
u-boot,dm-spl;
};
pins2 {
u-boot,dm-spl;
};
};
&qspi_bk2_pins_a {
u-boot,dm-spl;
pins1 {
u-boot,dm-spl;
};
pins2 {
u-boot,dm-spl;
};
};
#include "stm32mp157a-ev1-u-boot.dtsi"

View File

@ -1,13 +1,14 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2017 - All Rights Reserved
* Author: Ludovic Barre <ludovic.barre@st.com> for STMicroelectronics.
* Copyright (C) STMicroelectronics 2019 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com> for STMicroelectronics.
*/
/dts-v1/;
#include "stm32mp157c-ed1.dts"
#include <dt-bindings/gpio/gpio.h>
#include "stm32mp15xx-evx.dtsi"
#include <dt-bindings/input/input.h>
#include <dt-bindings/soc/stm32-hdp.h>
/ {
model = "STMicroelectronics STM32MP157C eval daughter on eval mother";
@ -18,90 +19,14 @@
};
aliases {
serial0 = &uart4;
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";
};
};
&cec {
pinctrl-names = "default";
pinctrl-0 = <&cec_pins_a>;
status = "okay";
};
&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>;
};
};
};
&dsi {
#address-cells = <1>;
#size-cells = <0>;
phy-dsi-supply = <&reg18>;
status = "okay";
ports {
@ -123,7 +48,7 @@
};
};
panel-dsi@0 {
panel_dsi: panel-dsi@0 {
compatible = "raydium,rm68200";
reg = <0>;
reset-gpios = <&gpiof 15 GPIO_ACTIVE_LOW>;
@ -139,122 +64,17 @@
};
};
&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@0 {
reg = <0>;
nand-on-flash-bbt;
#address-cells = <1>;
#size-cells = <1>;
};
};
&i2c2 {
pinctrl-names = "default";
pinctrl-0 = <&i2c2_pins_a>;
i2c-scl-rising-time-ns = <185>;
i2c-scl-falling-time-ns = <20>;
status = "okay";
ov5640: camera@3c {
compatible = "ovti,ov5640";
gt9147: goodix_ts@5d {
compatible = "goodix,gt9147";
reg = <0x5d>;
panel = <&panel_dsi>;
pinctrl-0 = <&goodix_pins>;
pinctrl-names = "default";
pinctrl-0 = <&ov5640_pins>;
reg = <0x3c>;
clocks = <&clk_ext_camera>;
clock-names = "xclk";
DOVDD-supply = <&v2v8>;
powerdown-gpios = <&stmfx_pinctrl 18 GPIO_ACTIVE_HIGH>;
reset-gpios = <&stmfx_pinctrl 19 GPIO_ACTIVE_LOW>;
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>;
};
};
};
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>;
joystick_pins: joystick {
pins = "gpio0", "gpio1", "gpio2", "gpio3", "gpio4";
drive-push-pull;
bias-pull-down;
};
ov5640_pins: camera {
pins = "agpio2", "agpio3"; /* stmfx pins 18 & 19 */
drive-push-pull;
output-low;
};
};
};
};
&i2c5 {
pinctrl-names = "default";
pinctrl-0 = <&i2c5_pins_a>;
i2c-scl-rising-time-ns = <185>;
i2c-scl-falling-time-ns = <20>;
status = "okay";
};
&ltdc {
status = "okay";
port {
#address-cells = <1>;
#size-cells = <0>;
ltdc_ep0_out: endpoint@0 {
reg = <0>;
remote-endpoint = <&dsi_in>;
};
interrupts = <14 IRQ_TYPE_EDGE_RISING>;
interrupt-parent = <&stmfx_pinctrl>;
};
};
@ -264,97 +84,3 @@
pinctrl-1 = <&m_can1_sleep_pins_a>;
status = "okay";
};
&qspi {
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>;
#address-cells = <1>;
#size-cells = <1>;
};
flash1: mx66l51235l@1 {
compatible = "jedec,spi-nor";
reg = <1>;
spi-rx-bus-width = <4>;
spi-max-frequency = <108000000>;
#address-cells = <1>;
#size-cells = <1>;
};
};
&spi1 {
pinctrl-names = "default";
pinctrl-0 = <&spi1_pins_a>;
status = "disabled";
};
&timers2 {
/* spare dmas for other usage (un-delete to enable pwm capture) */
/delete-property/dmas;
/delete-property/dma-names;
status = "disabled";
pwm {
pinctrl-0 = <&pwm2_pins_a>;
pinctrl-names = "default";
status = "okay";
};
timer@1 {
status = "okay";
};
};
&timers8 {
/delete-property/dmas;
/delete-property/dma-names;
status = "disabled";
pwm {
pinctrl-0 = <&pwm8_pins_a>;
pinctrl-names = "default";
status = "okay";
};
timer@7 {
status = "okay";
};
};
&timers12 {
/delete-property/dmas;
/delete-property/dma-names;
status = "disabled";
pwm {
pinctrl-0 = <&pwm12_pins_a>;
pinctrl-names = "default";
status = "okay";
};
timer@11 {
status = "okay";
};
};
&usbh_ehci {
phys = <&usbphyc_port0>;
phy-names = "usb";
status = "okay";
};
&usbotg_hs {
dr_mode = "peripheral";
phys = <&usbphyc_port1 0>;
phy-names = "usb2-phy";
status = "okay";
};
&usbphyc {
status = "okay";
};

View File

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

View File

@ -0,0 +1,35 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2019 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com> for STMicroelectronics.
*/
/dts-v1/;
#include "stm32mp157.dtsi"
#include "stm32mp15xd.dtsi"
#include "stm32mp15-pinctrl.dtsi"
#include "stm32mp15xxac-pinctrl.dtsi"
#include "stm32mp15xx-dkx.dtsi"
/ {
model = "STMicroelectronics STM32MP157D-DK1 Discovery Board";
compatible = "st,stm32mp157d-dk1", "st,stm32mp157";
aliases {
ethernet0 = &ethernet0;
serial0 = &uart4;
serial1 = &usart3;
serial2 = &uart7;
};
chosen {
stdout-path = "serial0:115200n8";
};
reserved-memory {
gpu_reserved: gpu@da000000 {
reg = <0xda000000 0x4000000>;
no-map;
};
};
};

View File

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

View File

@ -0,0 +1,43 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2019 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com> for STMicroelectronics.
*/
/dts-v1/;
#include "stm32mp157.dtsi"
#include "stm32mp15xd.dtsi"
#include "stm32mp15-pinctrl.dtsi"
#include "stm32mp15xxaa-pinctrl.dtsi"
#include "stm32mp157-m4-srm.dtsi"
#include "stm32mp157-m4-srm-pinctrl.dtsi"
#include "stm32mp15xx-edx.dtsi"
/ {
model = "STMicroelectronics STM32MP157D eval daughter";
compatible = "st,stm32mp157d-ed1", "st,stm32mp157";
chosen {
stdout-path = "serial0:115200n8";
};
aliases {
serial0 = &uart4;
};
reserved-memory {
gpu_reserved: gpu@f6000000 {
reg = <0xf6000000 0x8000000>;
no-map;
};
};
};
&cpu1{
cpu-supply = <&vddcore>;
};
&gpu {
contiguous-area = <&gpu_reserved>;
status = "okay";
};

View File

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

View File

@ -0,0 +1,86 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2019 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com> for STMicroelectronics.
*/
/dts-v1/;
#include "stm32mp157d-ed1.dts"
#include "stm32mp15xx-evx.dtsi"
#include <dt-bindings/input/input.h>
#include <dt-bindings/soc/stm32-hdp.h>
/ {
model = "STMicroelectronics STM32MP157D eval daughter on eval mother";
compatible = "st,stm32mp157d-ev1", "st,stm32mp157d-ed1", "st,stm32mp157";
chosen {
stdout-path = "serial0:115200n8";
};
aliases {
serial1 = &usart3;
ethernet0 = &ethernet0;
};
};
&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>;
backlight = <&panel_backlight>;
power-supply = <&v3v3>;
status = "okay";
port {
dsi_panel_in: endpoint {
remote-endpoint = <&dsi_out>;
};
};
};
};
&i2c2 {
gt9147: goodix_ts@5d {
compatible = "goodix,gt9147";
reg = <0x5d>;
panel = <&panel_dsi>;
pinctrl-0 = <&goodix_pins>;
pinctrl-names = "default";
status = "okay";
interrupts = <14 IRQ_TYPE_EDGE_RISING>;
interrupt-parent = <&stmfx_pinctrl>;
};
};
&m_can1 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&m_can1_pins_a>;
pinctrl-1 = <&m_can1_sleep_pins_a>;
status = "okay";
};

View File

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

View File

@ -0,0 +1,171 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2019 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com> for STMicroelectronics.
*/
/dts-v1/;
#include "stm32mp157.dtsi"
#include "stm32mp15xf.dtsi"
#include "stm32mp15-pinctrl.dtsi"
#include "stm32mp15xxac-pinctrl.dtsi"
#include "stm32mp15xx-dkx.dtsi"
#include <dt-bindings/rtc/rtc-stm32.h>
/ {
model = "STMicroelectronics STM32MP157F-DK2 Discovery Board";
compatible = "st,stm32mp157f-dk2", "st,stm32mp157";
aliases {
ethernet0 = &ethernet0;
serial0 = &uart4;
serial1 = &usart3;
serial2 = &uart7;
serial3 = &usart2;
};
chosen {
stdout-path = "serial0:115200n8";
};
reserved-memory {
gpu_reserved: gpu@da000000 {
reg = <0xda000000 0x4000000>;
no-map;
};
};
wifi_pwrseq: wifi-pwrseq {
compatible = "mmc-pwrseq-simple";
reset-gpios = <&gpioh 4 GPIO_ACTIVE_LOW>;
};
};
&cryp1 {
status="okay";
};
&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_otm8009a: panel-otm8009a@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_otm8009a>;
status = "okay";
};
touchscreen@38 {
compatible = "focaltech,ft6236";
reg = <0x38>;
interrupts = <2 2>;
interrupt-parent = <&gpiof>;
interrupt-controller;
touchscreen-size-x = <480>;
touchscreen-size-y = <800>;
panel = <&panel_otm8009a>;
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_a>;
pinctrl-1 = <&sdmmc2_b4_od_pins_a>;
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>;
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>;
uart-has-rtscts;
status = "okay";
bluetooth {
shutdown-gpios = <&gpioz 6 GPIO_ACTIVE_HIGH>;
compatible = "brcm,bcm43438-bt";
max-speed = <3000000>;
vbat-supply = <&v3v3>;
vddio-supply = <&v3v3>;
};
};

View File

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

View File

@ -0,0 +1,47 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2019 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com> for STMicroelectronics.
*/
/dts-v1/;
#include "stm32mp157.dtsi"
#include "stm32mp15xf.dtsi"
#include "stm32mp15-pinctrl.dtsi"
#include "stm32mp15xxaa-pinctrl.dtsi"
#include "stm32mp157-m4-srm.dtsi"
#include "stm32mp157-m4-srm-pinctrl.dtsi"
#include "stm32mp15xx-edx.dtsi"
/ {
model = "STMicroelectronics STM32MP157F eval daughter";
compatible = "st,stm32mp157f-ed1", "st,stm32mp157";
chosen {
stdout-path = "serial0:115200n8";
};
aliases {
serial0 = &uart4;
};
reserved-memory {
gpu_reserved: gpu@f6000000 {
reg = <0xf6000000 0x8000000>;
no-map;
};
};
};
&cpu1{
cpu-supply = <&vddcore>;
};
&cryp1 {
status="okay";
};
&gpu {
contiguous-area = <&gpu_reserved>;
status = "okay";
};

View File

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

View File

@ -0,0 +1,86 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2019 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com> for STMicroelectronics.
*/
/dts-v1/;
#include "stm32mp157f-ed1.dts"
#include "stm32mp15xx-evx.dtsi"
#include <dt-bindings/input/input.h>
#include <dt-bindings/soc/stm32-hdp.h>
/ {
model = "STMicroelectronics STM32MP157F eval daughter on eval mother";
compatible = "st,stm32mp157f-ev1", "st,stm32mp157f-ed1", "st,stm32mp157";
chosen {
stdout-path = "serial0:115200n8";
};
aliases {
serial1 = &usart3;
ethernet0 = &ethernet0;
};
};
&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>;
backlight = <&panel_backlight>;
power-supply = <&v3v3>;
status = "okay";
port {
dsi_panel_in: endpoint {
remote-endpoint = <&dsi_out>;
};
};
};
};
&i2c2 {
gt9147: goodix_ts@5d {
compatible = "goodix,gt9147";
reg = <0x5d>;
panel = <&panel_dsi>;
pinctrl-0 = <&goodix_pins>;
pinctrl-names = "default";
status = "okay";
interrupts = <14 IRQ_TYPE_EDGE_RISING>;
interrupt-parent = <&stmfx_pinctrl>;
};
};
&m_can1 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&m_can1_pins_a>;
pinctrl-1 = <&m_can1_sleep_pins_a>;
status = "okay";
};

View File

@ -1,90 +0,0 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2019 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com>
*/
#include "stm32mp157-pinctrl.dtsi"
/ {
soc {
pinctrl: pin-controller@50002000 {
st,package = <STM32MP_PKG_AA>;
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 = <STM32MP_PKG_AA>;
gpioz: gpio@54004000 {
status = "okay";
ngpios = <8>;
gpio-ranges = <&pinctrl_z 0 400 8>;
};
};
};
};

View File

@ -1,62 +0,0 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2019 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com>
*/
#include "stm32mp157-pinctrl.dtsi"
/ {
soc {
pinctrl: pin-controller@50002000 {
st,package = <STM32MP_PKG_AB>;
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

@ -1,78 +0,0 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2019 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com>
*/
#include "stm32mp157-pinctrl.dtsi"
/ {
soc {
pinctrl: pin-controller@50002000 {
st,package = <STM32MP_PKG_AC>;
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 = <STM32MP_PKG_AC>;
gpioz: gpio@54004000 {
status = "okay";
ngpios = <8>;
gpio-ranges = <&pinctrl_z 0 400 8>;
};
};
};
};

View File

@ -1,62 +0,0 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2019 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com>
*/
#include "stm32mp157-pinctrl.dtsi"
/ {
soc {
pinctrl: pin-controller@50002000 {
st,package = <STM32MP_PKG_AD>;
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,13 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2019 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com> for STMicroelectronics.
*/
&cpu0_opp_table {
opp-650000000 {
opp-hz = /bits/ 64 <650000000>;
opp-microvolt = <1200000>;
opp-supported-hw = <0x1>;
};
};

View File

@ -0,0 +1,20 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2019 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com> for STMicroelectronics.
*/
#include "stm32mp15xa.dtsi"
/ {
soc {
cryp1: cryp@54001000 {
compatible = "st,stm32mp1-cryp";
reg = <0x54001000 0x400>;
interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&scmi0_clk CK_SCMI0_CRYP1>;
resets = <&scmi0_reset RST_SCMI0_CRYP1>;
status = "disabled";
};
};
};

View File

@ -0,0 +1,42 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2019 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com> for STMicroelectronics.
*/
&cpu0_opp_table {
opp-800000000 {
opp-hz = /bits/ 64 <800000000>;
opp-microvolt = <1350000>;
opp-supported-hw = <0x2>;
};
opp-400000000 {
opp-hz = /bits/ 64 <400000000>;
opp-microvolt = <1200000>;
opp-supported-hw = <0x2>;
opp-suspend;
};
};
&cpu_thermal {
trips {
cpu-crit {
temperature = <105000>;
hysteresis = <0>;
type = "critical";
};
cpu_alert: cpu-alert {
temperature = <95000>;
hysteresis = <10000>;
type = "passive";
};
};
cooling-maps {
map0 {
trip = <&cpu_alert>;
cooling-device = <&cpu0 1 1>;
};
};
};

View File

@ -0,0 +1,20 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2019 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com> for STMicroelectronics.
*/
#include "stm32mp15xd.dtsi"
/ {
soc {
cryp1: cryp@54001000 {
compatible = "st,stm32mp1-cryp";
reg = <0x54001000 0x400>;
interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&scmi0_clk CK_SCMI0_CRYP1>;
resets = <&scmi0_reset RST_SCMI0_CRYP1>;
status = "disabled";
};
};
};

View File

@ -0,0 +1,6 @@
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/*
* Copyright (C) 2019 Marek Vasut <marex@denx.de>
*/
#include "stm32mp15xx-dhcom-u-boot.dtsi"

View File

@ -0,0 +1,88 @@
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/*
* Copyright (C) 2019 Marek Vasut <marex@denx.de>
*/
#include "stm32mp15xx-dhcom.dtsi"
/ {
model = "STMicroelectronics STM32MP15xx DHCOM Premium Developer Kit (2)";
compatible = "dh,stm32mp15xx-dhcom-pdk2", "st,stm32mp15x";
aliases {
serial0 = &uart4;
ethernet0 = &ethernet0;
};
chosen {
stdout-path = "serial0:115200n8";
};
ethernet_vio: vioregulator {
compatible = "regulator-fixed";
regulator-name = "vio";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
gpio = <&gpiog 3 GPIO_ACTIVE_LOW>;
regulator-always-on;
regulator-boot-on;
};
};
&ethernet0 {
status = "okay";
pinctrl-0 = <&ethernet0_rmii_pins_a>;
pinctrl-1 = <&ethernet0_rmii_pins_sleep_a>;
pinctrl-names = "default", "sleep";
phy-mode = "rmii";
max-speed = <100>;
phy-handle = <&phy0>;
st,eth_ref_clk_sel;
phy-reset-gpios = <&gpioh 15 GPIO_ACTIVE_LOW>;
mdio0 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "snps,dwmac-mdio";
phy0: ethernet-phy@1 {
reg = <1>;
};
};
};
&pinctrl {
ethernet0_rmii_pins_a: rmii-0 {
pins1 {
pinmux = <STM32_PINMUX('G', 13, AF11)>, /* ETH1_RMII_TXD0 */
<STM32_PINMUX('G', 14, AF11)>, /* ETH1_RMII_TXD1 */
<STM32_PINMUX('B', 11, AF11)>, /* ETH1_RMII_TX_EN */
<STM32_PINMUX('A', 1, AF0)>, /* ETH1_RMII_REF_CLK */
<STM32_PINMUX('A', 2, AF11)>, /* ETH1_MDIO */
<STM32_PINMUX('C', 1, AF11)>; /* ETH1_MDC */
bias-disable;
drive-push-pull;
slew-rate = <2>;
};
pins2 {
pinmux = <STM32_PINMUX('C', 4, AF11)>, /* ETH1_RMII_RXD0 */
<STM32_PINMUX('C', 5, AF11)>, /* ETH1_RMII_RXD1 */
<STM32_PINMUX('A', 7, AF11)>; /* ETH1_RMII_CRS_DV */
bias-disable;
};
};
ethernet0_rmii_pins_sleep_a: rmii-sleep-0 {
pins1 {
pinmux = <STM32_PINMUX('G', 13, ANALOG)>, /* ETH1_RMII_TXD0 */
<STM32_PINMUX('G', 14, ANALOG)>, /* ETH1_RMII_TXD1 */
<STM32_PINMUX('B', 11, ANALOG)>, /* ETH1_RMII_TX_EN */
<STM32_PINMUX('A', 2, ANALOG)>, /* ETH1_MDIO */
<STM32_PINMUX('C', 1, ANALOG)>, /* ETH1_MDC */
<STM32_PINMUX('C', 4, ANALOG)>, /* ETH1_RMII_RXD0 */
<STM32_PINMUX('C', 5, ANALOG)>, /* ETH1_RMII_RXD1 */
<STM32_PINMUX('A', 1, ANALOG)>, /* ETH1_RMII_REF_CLK */
<STM32_PINMUX('A', 7, ANALOG)>; /* ETH1_RMII_CRS_DV */
};
};
};

View File

@ -0,0 +1,249 @@
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/*
* Copyright (C) 2019 Marek Vasut <marex@denx.de>
*/
#include <dt-bindings/clock/stm32mp1-clksrc.h>
#include "stm32mp15-u-boot.dtsi"
#include "stm32mp15-ddr3-2x4Gb-1066-binG.dtsi"
/ {
aliases {
i2c1 = &i2c2;
i2c3 = &i2c4;
i2c4 = &i2c5;
mmc0 = &sdmmc1;
mmc1 = &sdmmc2;
spi0 = &qspi;
usb0 = &usbotg_hs;
};
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 {
red {
label = "error";
gpios = <&gpioa 13 GPIO_ACTIVE_LOW>;
default-state = "off";
status = "okay";
};
blue {
default-state = "on";
};
};
};
&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;
};
&flash0 {
u-boot,dm-spl;
};
&qspi {
u-boot,dm-spl;
};
&qspi_clk_pins_a {
u-boot,dm-spl;
pins {
u-boot,dm-spl;
};
};
&qspi_bk1_pins_a {
u-boot,dm-spl;
pins1 {
u-boot,dm-spl;
};
pins2 {
u-boot,dm-spl;
};
};
&qspi_bk2_pins_a {
u-boot,dm-spl;
pins1 {
u-boot,dm-spl;
};
pins2 {
u-boot,dm-spl;
};
};
&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_PLL4P
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 = 1300.0 MHz => P = 650 (CPU) */
pll1: st,pll@0 {
compatible = "st,stm32mp1-pll";
reg = <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 {
compatible = "st,stm32mp1-pll";
reg = <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 {
compatible = "st,stm32mp1-pll";
reg = <2>;
cfg = < 1 33 1 16 36 PQR(1,1,1) >;
frac = < 0x1a04 >;
u-boot,dm-pre-reloc;
};
/* VCO = 600.0 MHz => P = 50, Q = 50, R = 50 */
pll4: st,pll@3 {
compatible = "st,stm32mp1-pll";
reg = <3>;
cfg = < 1 49 11 11 11 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;
};
};
&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 {
u-boot,dm-spl;
};
};
&sdmmc2_d47_pins_a {
u-boot,dm-spl;
pins {
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,379 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) 2019 Marek Vasut <marex@denx.de>
*/
/dts-v1/;
#include "stm32mp157.dtsi"
#include "stm32mp15xc.dtsi"
#include "stm32mp15-pinctrl.dtsi"
#include "stm32mp15xxaa-pinctrl.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/mfd/st,stpmic1.h>
/ {
memory@c0000000 {
device_type = "memory";
reg = <0xC0000000 0x40000000>;
};
};
&cec {
pinctrl-names = "default";
pinctrl-0 = <&cec_pins_a>;
status = "okay";
};
&dcmi {
status = "okay";
pinctrl-names = "default", "sleep";
pinctrl-0 = <&dcmi_pins_a>;
pinctrl-1 = <&dcmi_sleep_pins_a>;
};
&dts {
status = "okay";
};
&i2c2 {
pinctrl-names = "default";
pinctrl-0 = <&i2c2_pins_a>;
i2c-scl-rising-time-ns = <185>;
i2c-scl-falling-time-ns = <20>;
status = "okay";
};
&i2c4 {
pinctrl-names = "default";
pinctrl-0 = <&i2c4_pins_a>;
i2c-scl-rising-time-ns = <185>;
i2c-scl-falling-time-ns = <20>;
status = "okay";
/* spare dmas for other usage */
/delete-property/dmas;
/delete-property/dma-names;
pmic: stpmic@33 {
compatible = "st,stpmic1";
reg = <0x33>;
interrupts-extended = <&gpioa 0 IRQ_TYPE_EDGE_FALLING>;
interrupt-controller;
#interrupt-cells = <2>;
status = "okay";
regulators {
compatible = "st,stpmic1-regulators";
ldo1-supply = <&v3v3>;
ldo2-supply = <&v3v3>;
ldo3-supply = <&vdd_ddr>;
ldo5-supply = <&v3v3>;
ldo6-supply = <&v3v3>;
pwr_sw1-supply = <&bst_out>;
pwr_sw2-supply = <&bst_out>;
vddcore: buck1 {
regulator-name = "vddcore";
regulator-min-microvolt = <800000>;
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>;
};
vdda: ldo1 {
regulator-name = "vdda";
regulator-min-microvolt = <2900000>;
regulator-max-microvolt = <2900000>;
interrupts = <IT_CURLIM_LDO1 0>;
};
v2v8: ldo2 {
regulator-name = "v2v8";
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <2800000>;
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>;
};
vdd_sd: ldo5 {
regulator-name = "vdd_sd";
regulator-min-microvolt = <2900000>;
regulator-max-microvolt = <2900000>;
interrupts = <IT_CURLIM_LDO5 0>;
regulator-boot-on;
};
v1v8: ldo6 {
regulator-name = "v1v8";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
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;
};
};
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";
};
};
eeprom@50 {
compatible = "atmel,24c02";
reg = <0x50>;
pagesize = <16>;
};
};
&i2c5 {
pinctrl-names = "default";
pinctrl-0 = <&i2c5_pins_a>;
i2c-scl-rising-time-ns = <185>;
i2c-scl-falling-time-ns = <20>;
status = "okay";
};
&ipcc {
status = "okay";
};
&iwdg2 {
timeout-sec = <32>;
status = "okay";
};
&m4_rproc {
mboxes = <&ipcc 0>, <&ipcc 1>, <&ipcc 2>;
mbox-names = "vq0", "vq1", "shutdown";
status = "okay";
};
&pwr_regulators {
vdd-supply = <&vdd>;
vdd_3v3_usbfs-supply = <&vdd_usb>;
};
&qspi {
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>;
#address-cells = <1>;
#size-cells = <1>;
};
flash1: mx66l51235l@1 {
compatible = "jedec,spi-nor";
reg = <1>;
spi-rx-bus-width = <4>;
spi-max-frequency = <108000000>;
#address-cells = <1>;
#size-cells = <1>;
};
};
&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,sig-dir;
st,neg-edge;
st,use-ckin;
bus-width = <4>;
vmmc-supply = <&vdd_sd>;
status = "okay";
};
&sdmmc2 {
pinctrl-names = "default";
pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_pins_a>;
non-removable;
no-sd;
no-sdio;
st,sig-dir;
st,neg-edge;
bus-width = <8>;
vmmc-supply = <&v3v3>;
status = "okay";
};
&spi1 {
pinctrl-names = "default";
pinctrl-0 = <&spi1_pins_a>;
status = "disabled";
};
&timers2 {
/* spare dmas for other usage (un-delete to enable pwm capture) */
/delete-property/dmas;
/delete-property/dma-names;
status = "disabled";
pwm {
pinctrl-0 = <&pwm2_pins_a>;
pinctrl-names = "default";
status = "okay";
};
timer@1 {
status = "okay";
};
};
&timers6 {
status = "okay";
/* spare dmas for other usage */
/delete-property/dmas;
/delete-property/dma-names;
timer@5 {
status = "okay";
};
};
&timers8 {
/delete-property/dmas;
/delete-property/dma-names;
status = "disabled";
pwm {
pinctrl-0 = <&pwm8_pins_a>;
pinctrl-names = "default";
status = "okay";
};
timer@7 {
status = "okay";
};
};
&timers12 {
/delete-property/dmas;
/delete-property/dma-names;
status = "disabled";
pwm {
pinctrl-0 = <&pwm12_pins_a>;
pinctrl-names = "default";
status = "okay";
};
timer@11 {
status = "okay";
};
};
&uart4 {
pinctrl-names = "default";
pinctrl-0 = <&uart4_pins_a>;
status = "okay";
};
&usbh_ehci {
phys = <&usbphyc_port0>;
phy-names = "usb";
status = "okay";
};
&usbotg_hs {
dr_mode = "peripheral";
phys = <&usbphyc_port1 0>;
phy-names = "usb2-phy";
vbus-supply = <&vbus_otg>;
status = "okay";
};
&usbphyc {
status = "okay";
};
&usbphyc_port0 {
phy-supply = <&vdd_usb>;
};
&usbphyc_port1 {
phy-supply = <&vdd_usb>;
};

View File

@ -0,0 +1,770 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2019 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com> for STMicroelectronics.
*/
#include "stm32mp157-m4-srm.dtsi"
#include "stm32mp157-m4-srm-pinctrl.dtsi"
#include <dt-bindings/mfd/st,stpmic1.h>
/ {
memory@c0000000 {
device_type = "memory";
reg = <0xc0000000 0x20000000>;
};
reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
ranges;
mcuram2: mcuram2@10000000 {
compatible = "shared-dma-pool";
reg = <0x10000000 0x40000>;
no-map;
};
vdev0vring0: vdev0vring0@10040000 {
compatible = "shared-dma-pool";
reg = <0x10040000 0x1000>;
no-map;
};
vdev0vring1: vdev0vring1@10041000 {
compatible = "shared-dma-pool";
reg = <0x10041000 0x1000>;
no-map;
};
vdev0buffer: vdev0buffer@10042000 {
compatible = "shared-dma-pool";
reg = <0x10042000 0x4000>;
no-map;
};
mcuram: mcuram@30000000 {
compatible = "shared-dma-pool";
reg = <0x30000000 0x40000>;
no-map;
};
retram: retram@38000000 {
compatible = "shared-dma-pool";
reg = <0x38000000 0x10000>;
no-map;
};
};
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;
};
vin: vin {
compatible = "regulator-fixed";
regulator-name = "vin";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
regulator-always-on;
};
};
&adc {
pinctrl-names = "default";
pinctrl-0 = <&adc12_ain_pins_a>, <&adc12_usb_cc_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. 5us).
*/
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, USB Type-C CC1 & CC2 */
st,adc-channels = <0 1 2 6 18 19>;
st,min-sample-time-nsecs = <5000>;
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>;
};
&crc1 {
status = "okay";
};
&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>;
nvmem-cells = <&ethernet_mac_address>;
nvmem-cell-names = "mac-address";
mdio0 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "snps,dwmac-mdio";
phy0: ethernet-phy@0 {
reg = <0>;
};
};
};
&gpu {
contiguous-area = <&gpu_reserved>;
status = "okay";
};
&hash1 {
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;
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>;
#sound-dai-cells = <0>;
status = "okay";
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
sii9022_in: endpoint {
remote-endpoint = <&ltdc_ep0_out>;
};
};
port@3 {
reg = <3>;
sii9022_tx_endpoint: endpoint {
remote-endpoint = <&i2s2_endpoint>;
};
};
};
};
cs42l51: cs42l51@4a {
compatible = "cirrus,cs42l51";
reg = <0x4a>;
#sound-dai-cells = <0>;
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";
status = "okay";
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;
};
};
};
};
&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";
/* spare dmas for other usage */
/delete-property/dmas;
/delete-property/dma-names;
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";
vdd-supply = <&vin>;
connector {
compatible = "usb-c-connector";
label = "USB-C";
power-role = "dual";
power-opmode = "default";
port {
con_usbotg_hs_ep: endpoint {
remote-endpoint = <&usbotg_hs_ep>;
};
};
};
};
pmic: stpmic@33 {
compatible = "st,stpmic1";
reg = <0x33>;
interrupts-extended = <&exti_pwr 55 IRQ_TYPE_EDGE_FALLING>;
interrupt-controller;
#interrupt-cells = <2>;
status = "okay";
regulators {
compatible = "st,stpmic1-regulators";
buck1-supply = <&vin>;
buck2-supply = <&vin>;
buck3-supply = <&vin>;
buck4-supply = <&vin>;
ldo1-supply = <&v3v3>;
ldo2-supply = <&vin>;
ldo3-supply = <&vdd_ddr>;
ldo4-supply = <&vin>;
ldo5-supply = <&vin>;
ldo6-supply = <&v3v3>;
vref_ddr-supply = <&vin>;
boost-supply = <&vin>;
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>;
regulator-always-on;
};
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>;
i2c-scl-rising-time-ns = <185>;
i2c-scl-falling-time-ns = <20>;
clock-frequency = <400000>;
/* spare dmas for other usage */
/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>;
wakeup-source;
status = "okay";
};
&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>;
clocks = <&rcc SAI2_K>, <&sai2a>;
clock-names = "sai_ck", "MCLK";
status = "okay";
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>;
cd-gpios = <&gpiob 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
disable-wp;
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";
};
&sram {
dma_pool: dma_pool@0 {
reg = <0x50000 0x10000>;
pool;
};
};
&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 {
/delete-property/dmas;
/delete-property/dma-names;
status = "disabled";
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";
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_b>;
pinctrl-1 = <&uart7_sleep_pins_b>;
pinctrl-2 = <&uart7_idle_pins_b>;
/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>;
uart-has-rtscts;
status = "disabled";
};
&usbh_ehci {
phys = <&usbphyc_port0>;
status = "okay";
};
&usbotg_hs {
phys = <&usbphyc_port1 0>;
phy-names = "usb2-phy";
usb-role-switch;
status = "okay";
port {
usbotg_hs_ep: endpoint {
remote-endpoint = <&con_usbotg_hs_ep>;
};
};
};
&usbphyc {
status = "okay";
};
&usbphyc_port0 {
phy-supply = <&vdd_usb>;
st,phy-tuning = <&usb_phy_tuning>;
};
&usbphyc_port1 {
phy-supply = <&vdd_usb>;
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,407 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2017 - All Rights Reserved
* Author: Ludovic Barre <ludovic.barre@st.com> for STMicroelectronics.
*/
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/mfd/st,stpmic1.h>
/ {
memory@c0000000 {
device_type = "memory";
reg = <0xC0000000 0x40000000>;
};
reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
ranges;
mcuram2: mcuram2@10000000 {
compatible = "shared-dma-pool";
reg = <0x10000000 0x40000>;
no-map;
};
vdev0vring0: vdev0vring0@10040000 {
compatible = "shared-dma-pool";
reg = <0x10040000 0x1000>;
no-map;
};
vdev0vring1: vdev0vring1@10041000 {
compatible = "shared-dma-pool";
reg = <0x10041000 0x1000>;
no-map;
};
vdev0buffer: vdev0buffer@10042000 {
compatible = "shared-dma-pool";
reg = <0x10042000 0x4000>;
no-map;
};
mcuram: mcuram@30000000 {
compatible = "shared-dma-pool";
reg = <0x30000000 0x40000>;
no-map;
};
retram: retram@38000000 {
compatible = "shared-dma-pool";
reg = <0x38000000 0x10000>;
no-map;
};
};
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";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <2900000>;
regulator-type = "voltage";
regulator-always-on;
gpios = <&gpiof 14 GPIO_ACTIVE_HIGH>;
gpios-states = <0>;
states = <1800000 0x1 2900000 0x0>;
};
vin: vin {
compatible = "regulator-fixed";
regulator-name = "vin";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
regulator-always-on;
};
};
&adc {
/* ANA0, ANA1 are dedicated pins and don't need pinctrl: only in6. */
pinctrl-0 = <&adc1_in6_pins_a>;
pinctrl-names = "default";
vdd-supply = <&vdd>;
vdda-supply = <&vdda>;
vref-supply = <&vdda>;
status = "disabled";
adc1: adc@0 {
st,adc-channels = <0 1 6>;
/* 16.5 ck_cycles sampling time */
st,min-sample-time-nsecs = <400>;
status = "okay";
};
};
&cpu0{
cpu-supply = <&vddcore>;
};
&crc1 {
status = "okay";
};
&dac {
pinctrl-names = "default";
pinctrl-0 = <&dac_ch1_pins_a &dac_ch2_pins_a>;
vref-supply = <&vdda>;
status = "disabled";
dac1: dac@1 {
status = "okay";
};
dac2: dac@2 {
status = "okay";
};
};
&dma1 {
sram = <&dma_pool>;
};
&dma2 {
sram = <&dma_pool>;
};
&dts {
status = "okay";
};
&hash1 {
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";
/* spare dmas for other usage */
/delete-property/dmas;
/delete-property/dma-names;
pmic: stpmic@33 {
compatible = "st,stpmic1";
reg = <0x33>;
interrupts-extended = <&exti_pwr 55 IRQ_TYPE_EDGE_FALLING>;
interrupt-controller;
#interrupt-cells = <2>;
status = "okay";
regulators {
compatible = "st,stpmic1-regulators";
buck1-supply = <&vin>;
buck2-supply = <&vin>;
buck3-supply = <&vin>;
buck4-supply = <&vin>;
ldo1-supply = <&v3v3>;
ldo2-supply = <&v3v3>;
ldo3-supply = <&vdd_ddr>;
ldo4-supply = <&vin>;
ldo5-supply = <&v3v3>;
ldo6-supply = <&v3v3>;
vref_ddr-supply = <&vin>;
boost-supply = <&vin>;
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>;
};
vdda: ldo1 {
regulator-name = "vdda";
regulator-min-microvolt = <2900000>;
regulator-max-microvolt = <2900000>;
interrupts = <IT_CURLIM_LDO1 0>;
};
v2v8: ldo2 {
regulator-name = "v2v8";
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <2800000>;
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>;
regulator-always-on;
};
vdd_sd: ldo5 {
regulator-name = "vdd_sd";
regulator-min-microvolt = <2900000>;
regulator-max-microvolt = <2900000>;
interrupts = <IT_CURLIM_LDO5 0>;
regulator-boot-on;
};
v1v8: ldo6 {
regulator-name = "v1v8";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
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";
};
};
};
&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>;
wakeup-source;
status = "okay";
};
&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>;
cd-gpios = <&gpiog 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
disable-wp;
st,sig-dir;
st,neg-edge;
st,use-ckin;
bus-width = <4>;
vmmc-supply = <&vdd_sd>;
vqmmc-supply = <&sd_switch>;
sd-uhs-sdr12;
sd-uhs-sdr25;
sd-uhs-sdr50;
sd-uhs-ddr50;
sd-uhs-sdr104;
status = "okay";
};
&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,neg-edge;
bus-width = <8>;
vmmc-supply = <&v3v3>;
vqmmc-supply = <&vdd>;
mmc-ddr-3_3v;
status = "okay";
};
&sram {
dma_pool: dma_pool@0 {
reg = <0x50000 0x10000>;
pool;
};
};
&timers6 {
status = "okay";
/* spare dmas for other usage */
/delete-property/dmas;
/delete-property/dma-names;
timer@5 {
status = "okay";
};
};
&uart4 {
pinctrl-names = "default", "sleep", "idle";
pinctrl-0 = <&uart4_pins_a>;
pinctrl-1 = <&uart4_sleep_pins_a>;
pinctrl-2 = <&uart4_idle_pins_a>;
/delete-property/dmas;
/delete-property/dma-names;
status = "okay";
};
&usbotg_hs {
vbus-supply = <&vbus_otg>;
};
&usbphyc_port0 {
phy-supply = <&vdd_usb>;
};
&usbphyc_port1 {
phy-supply = <&vdd_usb>;
};

View File

@ -0,0 +1,687 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2017 - All Rights Reserved
* Author: Ludovic Barre <ludovic.barre@st.com> for STMicroelectronics.
*/
#include <dt-bindings/input/input.h>
#include <dt-bindings/soc/stm32-hdp.h>
/ {
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 {
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>;
sound-name-prefix = "dmic0";
status = "okay";
port {
dmic0_endpoint: endpoint {
remote-endpoint = <&dfsdm_endpoint0>;
};
};
};
dmic1: dmic-1 {
compatible = "dmic-codec";
#sound-dai-cells = <1>;
sound-name-prefix = "dmic1";
status = "okay";
port {
dmic1_endpoint: endpoint {
remote-endpoint = <&dfsdm_endpoint1>;
};
};
};
dmic2: dmic-2 {
compatible = "dmic-codec";
#sound-dai-cells = <1>;
sound-name-prefix = "dmic2";
status = "okay";
port {
dmic2_endpoint: endpoint {
remote-endpoint = <&dfsdm_endpoint2>;
};
};
};
dmic3: dmic-3 {
compatible = "dmic-codec";
#sound-dai-cells = <1>;
sound-name-prefix = "dmic3";
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-0 = <&cec_pins_a>;
status = "okay";
};
&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 = <0>;
st,adc-channel-names = "dmic_u2";
st,adc-channel-types = "SPI_F";
st,adc-channel-clk-src = "CLKOUT";
st,filter-order = <3>;
st,adc-alt-channel = <1>;
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 = <2>;
st,adc-channel-names = "dmic_u3";
st,adc-channel-types = "SPI_F";
st,adc-channel-clk-src = "CLKOUT";
st,adc-alt-channel = <1>;
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>;
};
};
};
};
};
&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>;
nvmem-cells = <&ethernet_mac_address>;
nvmem-cell-names = "mac-address";
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";
nand-controller@4,0 {
status = "okay";
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", "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>;
goodix_pins: goodix {
pins = "gpio14";
bias-pull-down;
};
joystick_pins: joystick {
pins = "gpio0", "gpio1", "gpio2", "gpio3", "gpio4";
bias-pull-down;
};
};
};
};
&i2c4 {
pmic: stpmic@33 {
regulators {
v1v8: ldo6 {
regulator-enable-ramp-delay = <300000>;
};
};
};
};
&i2c5 {
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;
status = "okay";
};
&ltdc {
status = "okay";
port {
#address-cells = <1>;
#size-cells = <0>;
ltdc_ep0_out: endpoint@0 {
reg = <0>;
remote-endpoint = <&dsi_in>;
};
};
};
&qspi {
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>;
#address-cells = <1>;
#size-cells = <1>;
};
flash1: mx66l51235l@1 {
compatible = "jedec,spi-nor";
reg = <1>;
spi-rx-bus-width = <4>;
spi-max-frequency = <108000000>;
#address-cells = <1>;
#size-cells = <1>;
};
};
&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_sleep_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 {
/* spare dmas for other usage (un-delete to enable pwm capture) */
/delete-property/dmas;
/delete-property/dma-names;
status = "disabled";
pwm {
pinctrl-0 = <&pwm2_pins_a>;
pinctrl-1 = <&pwm2_sleep_pins_a>;
pinctrl-names = "default", "sleep";
status = "okay";
};
timer@1 {
status = "okay";
};
};
&timers8 {
/delete-property/dmas;
/delete-property/dma-names;
status = "disabled";
pwm {
pinctrl-0 = <&pwm8_pins_a>;
pinctrl-1 = <&pwm8_sleep_pins_a>;
pinctrl-names = "default", "sleep";
status = "okay";
};
timer@7 {
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";
};
};
&usart3 {
pinctrl-names = "default", "sleep", "idle";
pinctrl-0 = <&usart3_pins_a>;
pinctrl-1 = <&usart3_sleep_pins_a>;
pinctrl-2 = <&usart3_idle_pins_a>;
uart-has-rtscts;
status = "disabled";
};
&usbh_ehci {
phys = <&usbphyc_port0>;
status = "okay";
};
&usbotg_hs {
pinctrl-0 = <&usbotg_hs_pins_a>;
pinctrl-names = "default";
phys = <&usbphyc_port1 0>;
phy-names = "usb2-phy";
status = "okay";
};
&usbphyc {
status = "okay";
};
&usbphyc_port0 {
st,phy-tuning = <&usb_phy_tuning>;
vbus-supply = <&vbus_sw>;
};
&usbphyc_port1 {
st,phy-tuning = <&usb_phy_tuning>;
};

View File

@ -0,0 +1,85 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2019 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com>
*/
&pinctrl {
st,package = <STM32MP_PKG_AA>;
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 {
st,package = <STM32MP_PKG_AA>;
gpioz: gpio@54004000 {
status = "okay";
ngpios = <8>;
gpio-ranges = <&pinctrl_z 0 400 8>;
};
};

View File

@ -0,0 +1,57 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2019 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com>
*/
&pinctrl {
st,package = <STM32MP_PKG_AB>;
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,73 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2019 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com>
*/
&pinctrl {
st,package = <STM32MP_PKG_AC>;
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 {
st,package = <STM32MP_PKG_AC>;
gpioz: gpio@54004000 {
status = "okay";
ngpios = <8>;
gpio-ranges = <&pinctrl_z 0 400 8>;
};
};

View File

@ -0,0 +1,57 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* Copyright (C) STMicroelectronics 2019 - All Rights Reserved
* Author: Alexandre Torgue <alexandre.torgue@st.com>
*/
&pinctrl {
st,package = <STM32MP_PKG_AD>;
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

@ -10,7 +10,6 @@
/* Architecture, CPU, chip, etc */
#define CONFIG_IPROC
#define CONFIG_SYS_ARM_CACHE_WRITETHROUGH
/* Memory Info */
#define CONFIG_SYS_SDRAM_BASE 0x61000000

View File

@ -447,6 +447,7 @@ static inline void set_dacr(unsigned int val)
/* options available for data cache on each page */
enum dcache_option {
INVALID_ENTRY = 0,
DCACHE_OFF = TTB_SECT | TTB_SECT_MAIR(0) | TTB_SECT_XN_MASK,
DCACHE_WRITETHROUGH = TTB_SECT | TTB_SECT_MAIR(1),
DCACHE_WRITEBACK = TTB_SECT | TTB_SECT_MAIR(2),
@ -468,6 +469,7 @@ enum dcache_option {
/* options available for data cache on each page */
enum dcache_option {
INVALID_ENTRY = 0,
DCACHE_OFF = TTB_SECT_DOMAIN(0) | TTB_SECT_XN_MASK | TTB_SECT,
DCACHE_WRITETHROUGH = DCACHE_OFF | TTB_SECT_C_MASK,
DCACHE_WRITEBACK = DCACHE_WRITETHROUGH | TTB_SECT_B_MASK,
@ -477,6 +479,7 @@ enum dcache_option {
#define TTB_SECT_AP (3 << 10)
/* options available for data cache on each page */
enum dcache_option {
INVALID_ENTRY = 0,
DCACHE_OFF = 0x12,
DCACHE_WRITETHROUGH = 0x1a,
DCACHE_WRITEBACK = 0x1e,
@ -484,6 +487,14 @@ enum dcache_option {
};
#endif
#if defined(CONFIG_SYS_ARM_CACHE_WRITETHROUGH)
#define DCACHE_DEFAULT_OPTION DCACHE_WRITETHROUGH
#elif defined(CONFIG_SYS_ARM_CACHE_WRITEALLOC)
#define DCACHE_DEFAULT_OPTION DCACHE_WRITEALLOC
#elif defined(CONFIG_SYS_ARM_CACHE_WRITEBACK)
#define DCACHE_DEFAULT_OPTION DCACHE_WRITEBACK
#endif
/* Size of an MMU section */
enum {
#ifdef CONFIG_ARMV7_LPAE

View File

@ -74,6 +74,9 @@ void arch_lmb_reserve(struct lmb *lmb)
gd->bd->bi_dram[bank].size - 1;
if (sp > bank_end)
continue;
if (bank_end > gd->ram_top)
bank_end = gd->ram_top - 1;
lmb_reserve(lmb, sp, bank_end - sp + 1);
break;
}

View File

@ -6,6 +6,7 @@
#include <common.h>
#include <cpu_func.h>
#include <lmb.h>
#include <asm/system.h>
#include <asm/cache.h>
#include <linux/compiler.h>
@ -61,8 +62,11 @@ void mmu_set_region_dcache_behaviour(phys_addr_t start, size_t size,
unsigned long startpt, stoppt;
unsigned long upto, end;
end = ALIGN(start + size, MMU_SECTION_SIZE) >> MMU_SECTION_SHIFT;
/* div by 2 before start + size to avoid phys_addr_t overflow */
end = ALIGN((start / 2) + (size / 2), MMU_SECTION_SIZE / 2)
>> (MMU_SECTION_SHIFT - 1);
start = start >> MMU_SECTION_SHIFT;
#ifdef CONFIG_ARMV7_LPAE
debug("%s: start=%pa, size=%zu, option=%llx\n", __func__, &start, size,
option);
@ -89,20 +93,29 @@ void mmu_set_region_dcache_behaviour(phys_addr_t start, size_t size,
__weak void dram_bank_mmu_setup(int bank)
{
bd_t *bd = gd->bd;
struct lmb lmb;
int i;
/* bd->bi_dram is available only after relocation */
if ((gd->flags & GD_FLG_RELOC) == 0)
return;
/*
* don't allow cache on reserved memory tagged 'no-map' in DT
* => avoid speculative access to "secure" data
*/
lmb_init_and_reserve(&lmb, bd, (void *)gd->fdt_blob);
debug("%s: bank: %d\n", __func__, bank);
for (i = bd->bi_dram[bank].start >> MMU_SECTION_SHIFT;
i < (bd->bi_dram[bank].start >> MMU_SECTION_SHIFT) +
(bd->bi_dram[bank].size >> MMU_SECTION_SHIFT);
i++) {
#if defined(CONFIG_SYS_ARM_CACHE_WRITETHROUGH)
set_section_dcache(i, DCACHE_WRITETHROUGH);
#elif defined(CONFIG_SYS_ARM_CACHE_WRITEALLOC)
set_section_dcache(i, DCACHE_WRITEALLOC);
#else
set_section_dcache(i, DCACHE_WRITEBACK);
#endif
if (lmb_is_reserved_flags(&lmb, i << MMU_SECTION_SHIFT,
LMB_NOMAP))
set_section_dcache(i, INVALID_ENTRY);
else
set_section_dcache(i, DCACHE_DEFAULT_OPTION);
}
}

View File

@ -73,6 +73,15 @@ static unsigned long noncached_start;
static unsigned long noncached_end;
static unsigned long noncached_next;
void noncached_set_region(void)
{
#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
mmu_set_region_dcache_behaviour(noncached_start,
noncached_end - noncached_start,
DCACHE_OFF);
#endif
}
void noncached_init(void)
{
phys_addr_t start, end;
@ -89,9 +98,7 @@ void noncached_init(void)
noncached_end = end;
noncached_next = start;
#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
mmu_set_region_dcache_behaviour(noncached_start, size, DCACHE_OFF);
#endif
noncached_set_region();
}
phys_addr_t noncached_alloc(size_t size, size_t align)

View File

@ -127,8 +127,7 @@ ENTRY(_main)
ldr r0, [r9, #GD_START_ADDR_SP] /* sp = gd->start_addr_sp */
bic r0, r0, #7 /* 8-byte alignment for ABI compliance */
mov sp, r0
ldr r9, [r9, #GD_BD] /* r9 = gd->bd */
sub r9, r9, #GD_SIZE /* new GD is below bd */
ldr r9, [r9, #GD_NEW_GD] /* r9 <- gd->new_gd */
adr lr, here
ldr r0, [r9, #GD_RELOC_OFF] /* r0 = gd->reloc_off */

View File

@ -33,8 +33,8 @@ config SYS_MALLOC_LEN
config ENV_SIZE
default 0x2000
config TARGET_STM32MP1
bool "Support stm32mp1xx"
config STM32MP15x
bool "Support STMicroelectronics STM32MP15x Soc"
select ARCH_SUPPORT_PSCI if !STM32MP1_TRUSTED
select CPU_V7A
select CPU_V7_HAS_NONSEC if !STM32MP1_TRUSTED
@ -45,19 +45,47 @@ config TARGET_STM32MP1
select STM32_RESET
select STM32_SERIAL
select SYS_ARCH_TIMER
imply CMD_NVEDIT_INFO
imply SYSRESET_PSCI if STM32MP1_TRUSTED
imply SYSRESET_SYSCON if !STM32MP1_TRUSTED
help
support of STMicroelectronics SOC STM32MP15x family
STM32MP157, STM32MP153 or STM32MP151
STMicroelectronics MPU with core ARMv7
dual core A7 for STM32MP157/3, monocore for STM32MP151
target all the STMicroelectronics board with SOC STM32MP1 family
choice
prompt "STM32MP15x board select"
optional
config TARGET_ST_STM32MP15x
bool "STMicroelectronics STM32MP15x boards"
select STM32MP15x
imply BOOTCOUNT_LIMIT
imply BOOTSTAGE
imply CMD_BOOTCOUNT
imply CMD_BOOTSTAGE
imply CMD_CLS if CMD_BMP
imply DISABLE_CONSOLE
imply PRE_CONSOLE_BUFFER
imply SILENT_CONSOLE
imply SYSRESET_PSCI if STM32MP1_TRUSTED
imply SYSRESET_SYSCON if !STM32MP1_TRUSTED
imply VERSION_VARIABLE
help
target STMicroelectronics SOC STM32MP1 family
STM32MP157, STM32MP153 or STM32MP151
STMicroelectronics MPU with core ARMv7
dual core A7 for STM32MP157/3, monocore for STM32MP151
target the STMicroelectronics board with SOC STM32MP15x
managed by board/st/stm32mp1:
Evalulation board (EV1) or Discovery board (DK1 and DK2).
The difference between board are managed with devicetree
config TARGET_DH_STM32MP1_PDK2
bool "DH STM32MP1 PDK2"
select STM32MP15x
imply BOOTCOUNT_LIMIT
imply CMD_BOOTCOUNT
help
Target the DH PDK2 development kit with STM32MP15x SoM.
endchoice
config STM32MP1_TRUSTED
bool "Support trusted boot with TF-A"
@ -69,27 +97,25 @@ config STM32MP1_TRUSTED
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 OP-TEE"
depends on STM32MP1_TRUSTED
default n
help
Say Y here to enable boot with TF-A and OP-TEE
Trusted boot chain is :
BootRom => TF-A.stm32 (clock & DDR) => OP-TEE => U-Boot.stm32
OP-TEE monitor provides ST SMC to access to secure resources
config SYS_TEXT_BASE
prompt "U-Boot base address"
default 0xC0100000
help
configure the U-Boot base address
when DDR driver is used:
DDR + 1MB (0xC0100000)
config NR_DRAM_BANKS
default 1
config DDR_CACHEABLE_SIZE
hex "Size of the DDR marked cacheable in pre-reloc stage"
default 0x10000000 if TFABOOT
default 0x40000000
help
Define the size of the DDR marked as cacheable in U-Boot
pre-reloc stage.
This option can be useful to avoid speculatif access
to secured area of DDR used by TF-A or OP-TEE before U-Boot
initialization.
The areas marked "no-map" in device tree should be located
before this limit: STM32_DDR_BASE + DDR_CACHEABLE_SIZE.
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
@ -100,11 +126,28 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_MMC2
config STM32_ETZPC
bool "STM32 Extended TrustZone Protection"
depends on TARGET_STM32MP1
depends on STM32MP15x
default y
help
Say y to enable STM32 Extended TrustZone Protection
config CMD_STM32PROG
bool "command stm32prog for STM32CudeProgrammer"
select DFU
select DFU_RAM
select DFU_VIRT
select PARTITION_TYPE_GUID
imply CMD_GPT if MMC
imply CMD_MTD if MTD
imply DFU_MMC if MMC
imply DFU_MTD if MTD
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
@ -147,5 +190,6 @@ config DEBUG_UART_CLOCK
endif
source "board/st/stm32mp1/Kconfig"
source "board/dhelectronics/dh_stm32mp1/Kconfig"
endif

View File

@ -6,13 +6,15 @@
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
else
obj-y += bsec.o
obj-$(CONFIG_CMD_STM32PROG) += cmd_stm32prog/
obj-$(CONFIG_CMD_STM32KEY) += cmd_stm32key.o
obj-$(CONFIG_ARMV7_PSCI) += psci.o
obj-$(CONFIG_STM32MP1_TRUSTED) += boot_params.o
endif
obj-$(CONFIG_$(SPL_)DM_REGULATOR) += pwr_regulator.o

View File

@ -0,0 +1,45 @@
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/*
* Copyright (C) 2019, STMicroelectronics - All Rights Reserved
*/
#include <common.h>
#include <asm/sections.h>
#include <asm/system.h>
/*
* Force data-section, as .bss will not be valid
* when save_boot_params is invoked.
*/
static unsigned long nt_fw_dtb __section(".data");
/*
* Save the FDT address provided by TF-A in r2 at boot time
* This function is called from start.S
*/
void save_boot_params(unsigned long r0, unsigned long r1, unsigned long r2,
unsigned long r3)
{
nt_fw_dtb = r2;
save_boot_params_ret();
}
/*
* Use the saved FDT address provided by TF-A at boot time (NT_FW_CONFIG =
* Non Trusted Firmware configuration file) when the pointer is valid
*/
void *board_fdt_blob_setup(void)
{
debug("%s: nt_fw_dtb=%lx\n", __func__, nt_fw_dtb);
/* use external device tree only if address is valid */
if (nt_fw_dtb >= STM32_DDR_BASE) {
if (fdt_magic(nt_fw_dtb) == FDT_MAGIC)
return (void *)nt_fw_dtb;
debug("%s: DTB not found.\n", __func__);
}
debug("%s: fall back to builtin DTB, %p\n", __func__, &_end);
return (void *)&_end;
}

View File

@ -7,13 +7,12 @@
#include <dm.h>
#include <misc.h>
#include <asm/io.h>
#include <asm/arch/bsec.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) */
@ -22,11 +21,13 @@
#define BSEC_OTP_WRDATA_OFF 0x008
#define BSEC_OTP_STATUS_OFF 0x00C
#define BSEC_OTP_LOCK_OFF 0x010
#define BSEC_DENABLE_OFF 0x014
#define BSEC_DISTURBED_OFF 0x01C
#define BSEC_ERROR_OFF 0x034
#define BSEC_SPLOCK_OFF 0x064 /* Program safmem sticky lock */
#define BSEC_SWLOCK_OFF 0x07C /* write in OTP sticky lock */
#define BSEC_SRLOCK_OFF 0x094 /* shadowing sticky lock */
#define BSEC_WRLOCK_OFF 0x04C /* OTP write permananet lock */
#define BSEC_SPLOCK_OFF 0x064 /* OTP write sticky lock */
#define BSEC_SWLOCK_OFF 0x07C /* shadow write sticky lock */
#define BSEC_SRLOCK_OFF 0x094 /* shadow read sticky lock */
#define BSEC_OTP_DATA_OFF 0x200
/* BSEC_CONFIGURATION Register MASK */
@ -46,12 +47,33 @@
#define BSEC_MODE_PROGFAIL_MASK 0x10
#define BSEC_MODE_PWR_MASK 0x20
/* DENABLE Register */
#define BSEC_DENABLE_DBGSWENABLE BIT(10)
/*
* OTP Lock services definition
* Value must corresponding to the bit number in the register
*/
#define BSEC_LOCK_PROGRAM 0x04
/**
* bsec_lock() - manage lock for each type SR/SP/SW
* @address: address of bsec IP register
* @otp: otp number (0 - BSEC_OTP_MAX_VALUE)
* Return: true if locked else false
*/
static bool bsec_read_lock(u32 address, u32 otp)
{
u32 bit;
u32 bank;
bit = 1 << (otp & OTP_LOCK_MASK);
bank = ((otp >> OTP_LOCK_BANK_SHIFT) & OTP_LOCK_MASK) * sizeof(u32);
return !!(readl(address + bank) & bit);
}
#ifndef CONFIG_STM32MP1_TRUSTED
/**
* bsec_check_error() - Check status of one otp
* @base: base address of bsec IP
@ -74,23 +96,6 @@ static u32 bsec_check_error(u32 base, u32 otp)
return 0;
}
/**
* bsec_lock() - manage lock for each type SR/SP/SW
* @address: address of bsec IP register
* @otp: otp number (0 - BSEC_OTP_MAX_VALUE)
* Return: true if locked else false
*/
static bool bsec_read_lock(u32 address, u32 otp)
{
u32 bit;
u32 bank;
bit = 1 << (otp & OTP_LOCK_MASK);
bank = ((otp >> OTP_LOCK_BANK_SHIFT) & OTP_LOCK_MASK) * sizeof(u32);
return !!(readl(address + bank) & bit);
}
/**
* bsec_read_SR_lock() - read SR lock (Shadowing)
* @base: base address of bsec IP
@ -324,6 +329,16 @@ static int stm32mp_bsec_read_shadow(struct udevice *dev, u32 *val, u32 otp)
#endif
}
static int stm32mp_bsec_read_lock(struct udevice *dev, u32 *val, u32 otp)
{
struct stm32mp_bsec_platdata *plat = dev_get_platdata(dev);
/* return OTP permanent write lock status */
*val = bsec_read_lock(plat->base + BSEC_WRLOCK_OFF, otp);
return 0;
}
static int stm32mp_bsec_write_otp(struct udevice *dev, u32 val, u32 otp)
{
#ifdef CONFIG_STM32MP1_TRUSTED
@ -350,22 +365,41 @@ static int stm32mp_bsec_write_shadow(struct udevice *dev, u32 val, u32 otp)
#endif
}
static int stm32mp_bsec_write_lock(struct udevice *dev, u32 val, u32 otp)
{
#ifdef CONFIG_STM32MP1_TRUSTED
if (val == 1)
return stm32_smc_exec(STM32_SMC_BSEC,
STM32_SMC_WRLOCK_OTP,
otp, 0);
if (val == 0)
return 0; /* nothing to do */
return -EINVAL;
#else
return -ENOTSUPP;
#endif
}
static int stm32mp_bsec_read(struct udevice *dev, int offset,
void *buf, int size)
{
int ret;
int i;
bool shadow = true;
bool shadow = true, lock = false;
int nb_otp = size / sizeof(u32);
int otp;
unsigned int offs = offset;
if (offs >= STM32_BSEC_OTP_OFFSET) {
if (offs >= STM32_BSEC_LOCK_OFFSET) {
offs -= STM32_BSEC_LOCK_OFFSET;
lock = true;
} else if (offs >= STM32_BSEC_OTP_OFFSET) {
offs -= STM32_BSEC_OTP_OFFSET;
shadow = false;
}
if (offs < 0 || (offs % 4) || (size % 4))
if ((offs % 4) || (size % 4))
return -EINVAL;
otp = offs / sizeof(u32);
@ -373,7 +407,9 @@ static int stm32mp_bsec_read(struct udevice *dev, int offset,
for (i = otp; i < (otp + nb_otp) && i <= BSEC_OTP_MAX_VALUE; i++) {
u32 *addr = &((u32 *)buf)[i - otp];
if (shadow)
if (lock)
ret = stm32mp_bsec_read_lock(dev, addr, i);
else if (shadow)
ret = stm32mp_bsec_read_shadow(dev, addr, i);
else
ret = stm32mp_bsec_read_otp(dev, addr, i);
@ -392,17 +428,20 @@ static int stm32mp_bsec_write(struct udevice *dev, int offset,
{
int ret = 0;
int i;
bool shadow = true;
bool shadow = true, lock = false;
int nb_otp = size / sizeof(u32);
int otp;
unsigned int offs = offset;
if (offs >= STM32_BSEC_OTP_OFFSET) {
if (offs >= STM32_BSEC_LOCK_OFFSET) {
offs -= STM32_BSEC_LOCK_OFFSET;
lock = true;
} else if (offs >= STM32_BSEC_OTP_OFFSET) {
offs -= STM32_BSEC_OTP_OFFSET;
shadow = false;
}
if (offs < 0 || (offs % 4) || (size % 4))
if ((offs % 4) || (size % 4))
return -EINVAL;
otp = offs / sizeof(u32);
@ -410,7 +449,9 @@ static int stm32mp_bsec_write(struct udevice *dev, int offset,
for (i = otp; i < otp + nb_otp && i <= BSEC_OTP_MAX_VALUE; i++) {
u32 *val = &((u32 *)buf)[i - otp];
if (shadow)
if (lock)
ret = stm32mp_bsec_write_lock(dev, *val, i);
else if (shadow)
ret = stm32mp_bsec_write_shadow(dev, *val, i);
else
ret = stm32mp_bsec_write_otp(dev, *val, i);
@ -437,7 +478,7 @@ static int stm32mp_bsec_ofdata_to_platdata(struct udevice *dev)
return 0;
}
#ifndef CONFIG_STM32MP1_TRUSTED
#if !defined(CONFIG_STM32MP1_TRUSTED) && !defined(CONFIG_SPL_BUILD)
static int stm32mp_bsec_probe(struct udevice *dev)
{
int otp;
@ -464,7 +505,27 @@ 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,
#ifndef CONFIG_STM32MP1_TRUSTED
#if !defined(CONFIG_STM32MP1_TRUSTED) && !defined(CONFIG_SPL_BUILD)
.probe = stm32mp_bsec_probe,
#endif
};
bool bsec_dbgswenable(void)
{
struct udevice *dev;
struct stm32mp_bsec_platdata *plat;
int ret;
ret = uclass_get_device_by_driver(UCLASS_MISC,
DM_GET_DRIVER(stm32mp_bsec), &dev);
if (ret || !dev) {
pr_debug("bsec driver not available\n");
return false;
}
plat = dev_get_platdata(dev);
if (readl(plat->base + BSEC_DENABLE_OFF) & BSEC_DENABLE_DBGSWENABLE)
return true;
return false;
}

View File

@ -0,0 +1,9 @@
# SPDX-License-Identifier: GPL-2.0+
#
# Copyright (C) 2020, 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,191 @@
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/*
* Copyright (C) 2020, STMicroelectronics - All Rights Reserved
*/
#include <common.h>
#include <command.h>
#include <dfu.h>
#include <image.h>
#include <asm/arch/stm32prog.h>
#include "stm32prog.h"
struct stm32prog_data *stm32prog_data;
static void enable_vidconsole(void)
{
#ifdef CONFIG_DM_VIDEO
char *stdname;
char buf[64];
stdname = env_get("stdout");
if (!stdname || !strstr(stdname, "vidconsole")) {
if (!stdname)
snprintf(buf, sizeof(buf), "serial,vidconsole");
else
snprintf(buf, sizeof(buf), "%s,vidconsole", stdname);
env_set("stdout", buf);
}
stdname = env_get("stderr");
if (!stdname || !strstr(stdname, "vidconsole")) {
if (!stdname)
snprintf(buf, sizeof(buf), "serial,vidconsole");
else
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[])
{
ulong addr, size;
int dev, ret;
enum stm32prog_link_t link = LINK_UNDEFINED;
bool reset = false;
struct image_header_s header;
struct stm32prog_data *data;
u32 uimage, dtb;
if (argc < 3 || argc > 5)
return CMD_RET_USAGE;
if (!strcmp(argv[1], "usb"))
link = LINK_USB;
else if (!strcmp(argv[1], "serial"))
link = LINK_SERIAL;
if (link == LINK_UNDEFINED) {
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);
/* check STM32IMAGE presence */
if (size == 0 &&
!stm32prog_header_check((struct raw_header_s *)addr, &header)) {
size = header.image_length + BL_HEADER_SIZE;
/* uImage detected in STM32IMAGE, execute the script */
if (IMAGE_FORMAT_LEGACY ==
genimg_get_format((void *)(addr + BL_HEADER_SIZE)))
return source(addr + BL_HEADER_SIZE, "script@1");
}
enable_vidconsole();
data = (struct stm32prog_data *)malloc(sizeof(*data));
if (!data) {
pr_err("Alloc failed.");
return CMD_RET_FAILURE;
}
stm32prog_data = data;
ret = stm32prog_init(data, addr, size);
if (ret)
printf("Invalid or missing layout file.");
/* prepare DFU for device read/write */
ret = stm32prog_dfu_init(data);
if (ret)
goto cleanup;
switch (link) {
case LINK_SERIAL:
ret = stm32prog_serial_init(data, dev);
if (ret)
goto cleanup;
reset = stm32prog_serial_loop(data);
break;
case LINK_USB:
reset = stm32prog_usb_loop(data, dev);
break;
default:
goto cleanup;
}
uimage = data->uimage;
dtb = data->dtb;
stm32prog_clean(data);
free(stm32prog_data);
stm32prog_data = NULL;
puts("Download done\n");
if (uimage) {
char boot_addr_start[20];
char dtb_addr[20];
char *bootm_argv[5] = {
"bootm", boot_addr_start, "-", dtb_addr, NULL
};
if (!dtb)
bootm_argv[3] = env_get("fdtcontroladdr");
else
snprintf(dtb_addr, sizeof(dtb_addr) - 1,
"0x%x", dtb);
snprintf(boot_addr_start, sizeof(boot_addr_start) - 1,
"0x%x", uimage);
printf("Booting kernel at %s - %s...\n\n\n",
boot_addr_start, bootm_argv[3]);
/* Try bootm for legacy and FIT format image */
if (genimg_get_format((void *)uimage) != IMAGE_FORMAT_INVALID)
do_bootm(cmdtp, 0, 4, bootm_argv);
else if CONFIG_IS_ENABLED(CMD_BOOTZ)
do_bootz(cmdtp, 0, 4, bootm_argv);
}
if (reset) {
puts("Reset...\n");
run_command("reset", 0);
}
return CMD_RET_SUCCESS;
cleanup:
stm32prog_clean(data);
free(stm32prog_data);
stm32prog_data = NULL;
return CMD_RET_FAILURE;
}
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"
);
bool stm32prog_get_tee_partitions(void)
{
if (stm32prog_data)
return stm32prog_data->tee_detected;
return false;
}
bool stm32prog_get_fsbl_nor(void)
{
if (stm32prog_data)
return stm32prog_data->fsbl_nor_detected;
return false;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,185 @@
/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */
/*
* Copyright (C) 2020, STMicroelectronics - All Rights Reserved
*/
#ifndef _STM32PROG_H_
#define _STM32PROG_H_
/* - 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_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_target {
STM32PROG_NONE,
STM32PROG_MMC,
STM32PROG_NAND,
STM32PROG_NOR,
STM32PROG_SPI_NAND,
STM32PROG_RAM
};
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 stm32prog_target target;
char dev_id;
u32 erase_size;
struct mmc *mmc;
struct mtd_info *mtd;
/* list of partition for this device / ordered in offset */
struct list_head part_list;
bool full_update;
};
/* partition information build from FlashLayout and device */
struct stm32prog_part_t {
/* FlashLayout information */
int option;
int id;
enum stm32prog_part_type part_type;
enum stm32prog_target target;
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 */
s16 part_id; /* partition id in device */
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 */
bool tee_detected;
bool fsbl_nor_detected;
/* 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;
/* bootm information */
u32 uimage;
u32 dtb;
};
extern struct stm32prog_data *stm32prog_data;
/* 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_next_phase(struct stm32prog_data *data);
void stm32prog_do_reset(struct stm32prog_data *data);
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 */
int stm32prog_init(struct stm32prog_data *data, ulong addr, ulong size);
int stm32prog_serial_init(struct stm32prog_data *data, int link_dev);
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,993 @@
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/*
* Copyright (C) 2020, 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"
/* - 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*/
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;
struct stm32prog_part_t *part;
u32 size;
int ret, i;
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 = NULL;
/* found partition for the expected phase */
for (i = 0; i < data->part_nb; i++) {
part = &data->part_array[i];
if (part->id == phase)
dfu_entity = dfu_get_entity(part->alt_id);
}
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;
}
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, false)) {
if (!device_probe(dev))
down_serial_dev = 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);
data->buffer = memalign(CONFIG_SYS_CACHELINE_SIZE,
USART_RAM_BUFFER_SIZE);
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;
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;
return ret;
}
static u8 stm32prog_start(struct stm32prog_data *data, u32 address)
{
u8 ret = 0;
struct dfu_entity *dfu_entity;
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);
}
/* update DFU with received flashlayout */
if (data->phase == PHASE_FLASHLAYOUT)
stm32prog_dfu_init(data);
} else {
void (*entry)(void) = (void *)address;
printf("## Starting application at 0x%x ...\n", address);
(*entry)();
printf("## Application terminated\n");
ret = -ENOEXEC;
}
return ret;
}
/**
* get_address() - Get address if it is valid
*
* @tmp_xor: Current xor value to update
* @return The address area
*/
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 -----------------------------------------------*/
/**
* get_cmd_command() - Respond to Get command
*
* @data: Current command context
*/
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);
}
/**
* get_version_command() - Respond to Get Version command
*
* @data: Current command context
*/
static void get_version_command(struct stm32prog_data *data)
{
stm32prog_serial_putc(UBOOT_BL_VERSION);
stm32prog_serial_result(ACK_BYTE);
}
/**
* get_id_command() - Respond to Get ID command
*
* @data: Current command context
*/
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);
}
/**
* get_phase_command() - Respond to Get phase
*
* @data: Current command context
*/
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);
}
/**
* read_memory_command() - Read data from memory
*
* @data: Current command context
*/
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++));
}
/**
* start_command() - Respond to start command
*
* Jump to user application in RAM or partition check
*
* @data: Current command context
*/
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);
}
/**
* download_command() - Respond to download command
*
* Write data to not volatile memory, Flash
*
* @data: Current command context
*/
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;
}
}
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:
stm32prog_serial_result(result);
}
/**
* read_partition() - Respond to read command
*
* Read data from not volatile memory, Flash
*
* @data: Current command context
*/
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);
}
/* MAIN function = SERIAL LOOP ***********************************************/
/**
* stm32prog_serial_loop() - USART bootloader Loop routine
*
* @data: Current command context
* @return true if reset is needed after loop
*/
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 {
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,232 @@
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/*
* Copyright (C) 2020, STMicroelectronics - All Rights Reserved
*/
#include <common.h>
#include <dfu.h>
#include <g_dnl.h>
#include <usb.h>
#include <asm/arch/stm32prog.h>
#include <asm/arch/sys_proto.h>
#include "stm32prog.h"
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 phase */
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;
}
int stm32prog_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 stm32prog_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 stm32prog_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;
}
bool stm32prog_usb_loop(struct stm32prog_data *data, int dev)
{
int ret;
bool result;
/* USB download gadget for STM32 Programmer */
char product[128];
char name[SOC_NAME_SIZE];
get_soc_name(name);
snprintf(product, sizeof(product),
"USB download gadget@Device ID /0x%03X, @Revision ID /0x%04X, @Name /%s,",
get_cpu_dev(), get_cpu_rev(), name);
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);
g_dnl_set_product(NULL);
return result;
}
int g_dnl_get_board_bcd_device_number(int gcnum)
{
pr_debug("%s\n", __func__);
return 0x200;
}

View File

@ -9,6 +9,7 @@
#include <env.h>
#include <misc.h>
#include <asm/io.h>
#include <asm/arch/bsec.h>
#include <asm/arch/stm32.h>
#include <asm/arch/sys_proto.h>
#include <dm/device.h>
@ -35,7 +36,9 @@
#define TAMP_CR1 (STM32_TAMP_BASE + 0x00)
#define PWR_CR1 (STM32_PWR_BASE + 0x00)
#define PWR_MCUCR (STM32_PWR_BASE + 0x14)
#define PWR_CR1_DBP BIT(8)
#define PWR_MCUCR_SBF BIT(6)
/* DBGMCU register */
#define DBGMCU_IDC (STM32_DBGMCU_BASE + 0x00)
@ -59,12 +62,6 @@
#define BOOTROM_INSTANCE_MASK GENMASK(31, 16)
#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)
@ -79,6 +76,12 @@
#define PKG_SHIFT 27
#define PKG_MASK GENMASK(2, 0)
/*
* early TLB into the .data section so that it not get cleared
* with 16kB allignment (see TTBR0_BASE_ADDR_MASK)
*/
u8 early_tlb[PGTABLE_SIZE] __section(".data") __aligned(0x4000);
#if !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)
#ifndef CONFIG_STM32MP1_TRUSTED
static void security_init(void)
@ -145,12 +148,17 @@ static void security_init(void)
/*
* Debug init
*/
static void dbgmcu_init(void)
void dbgmcu_init(void)
{
setbits_le32(RCC_DBGCFGR, RCC_DBGCFGR_DBGCKEN);
/* Freeze IWDG2 if Cortex-A7 is in debug mode */
setbits_le32(DBGMCU_APB4FZ1, DBGMCU_APB4FZ1_IWDG2);
/*
* Freeze IWDG2 if Cortex-A7 is in debug mode
* done in TF-A for TRUSTED boot and
* DBGMCU access is controlled by BSEC_DENABLE.DBGSWENABLE
*/
if (!IS_ENABLED(CONFIG_STM32MP1_TRUSTED) && bsec_dbgswenable()) {
setbits_le32(RCC_DBGCFGR, RCC_DBGCFGR_DBGCKEN);
setbits_le32(DBGMCU_APB4FZ1, DBGMCU_APB4FZ1_IWDG2);
}
}
#endif /* !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD) */
@ -190,6 +198,33 @@ u32 get_bootmode(void)
TAMP_BOOT_MODE_SHIFT;
}
/*
* initialize the MMU and activate cache in SPL or in U-Boot pre-reloc stage
* MMU/TLB is updated in enable_caches() for U-Boot after relocation
* or is deactivated in U-Boot entry function start.S::cpu_init_cp15
*/
static void early_enable_caches(void)
{
/* I-cache is already enabled in start.S: cpu_init_cp15 */
if (CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
return;
gd->arch.tlb_size = PGTABLE_SIZE;
gd->arch.tlb_addr = (unsigned long)&early_tlb;
dcache_enable();
if (IS_ENABLED(CONFIG_SPL_BUILD))
mmu_set_region_dcache_behaviour(STM32_SYSRAM_BASE,
STM32_SYSRAM_SIZE,
DCACHE_DEFAULT_OPTION);
else
mmu_set_region_dcache_behaviour(STM32_DDR_BASE,
CONFIG_DDR_CACHEABLE_SIZE,
DCACHE_DEFAULT_OPTION);
}
/*
* Early system init
*/
@ -197,15 +232,21 @@ int arch_cpu_init(void)
{
u32 boot_mode;
early_enable_caches();
/* early armv7 timer init: needed for polling */
timer_init();
#if !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)
dbgmcu_init();
#ifndef CONFIG_STM32MP1_TRUSTED
security_init();
update_bootmode();
#endif
/* Reset Coprocessor state unless it wakes up from Standby power mode */
if (!(readl(PWR_MCUCR) & PWR_MCUCR_SBF)) {
writel(TAMP_COPRO_STATE_OFF, TAMP_COPRO_STATE);
writel(0, TAMP_COPRO_RSC_TBL_ADDRESS);
}
#endif
boot_mode = get_bootmode();
@ -224,15 +265,35 @@ int arch_cpu_init(void)
void enable_caches(void)
{
/* Enable D-cache. I-cache is already enabled in start.S */
/* I-cache is already enabled in start.S: icache_enable() not needed */
/* deactivate the data cache, early enabled in arch_cpu_init() */
dcache_disable();
/*
* update MMU after relocation and enable the data cache
* warning: the TLB location udpated in board_f.c::reserve_mmu
*/
dcache_enable();
}
static u32 read_idc(void)
{
setbits_le32(RCC_DBGCFGR, RCC_DBGCFGR_DBGCKEN);
/* DBGMCU access is controlled by BSEC_DENABLE.DBGSWENABLE */
if (bsec_dbgswenable()) {
setbits_le32(RCC_DBGCFGR, RCC_DBGCFGR_DBGCKEN);
return readl(DBGMCU_IDC);
return readl(DBGMCU_IDC);
}
if (CONFIG_IS_ENABLED(STM32MP15x))
return CPU_DEV_STM32MP15; /* STM32MP15x and unknown revision */
else
return 0x0;
}
u32 get_cpu_dev(void)
{
return (read_idc() & DBGMCU_IDC_DEV_ID_MASK) >> DBGMCU_IDC_DEV_ID_SHIFT;
}
u32 get_cpu_rev(void)
@ -265,11 +326,7 @@ static u32 get_cpu_rpn(void)
u32 get_cpu_type(void)
{
u32 id;
id = (read_idc() & DBGMCU_IDC_DEV_ID_MASK) >> DBGMCU_IDC_DEV_ID_SHIFT;
return (id << 16) | get_cpu_rpn();
return (get_cpu_dev() << 16) | get_cpu_rpn();
}
/* Get Package options from OTP */
@ -278,25 +335,42 @@ u32 get_cpu_package(void)
return get_otp(BSEC_OTP_PKG, PKG_SHIFT, PKG_MASK);
}
#if defined(CONFIG_DISPLAY_CPUINFO)
int print_cpuinfo(void)
void get_soc_name(char name[SOC_NAME_SIZE])
{
char *cpu_s, *cpu_r, *pkg;
/* MPUs Part Numbers */
switch (get_cpu_type()) {
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;
@ -335,12 +409,24 @@ 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 Rev.%s\n", cpu_s, pkg, cpu_r);
snprintf(name, SOC_NAME_SIZE, "STM32MP%s%s Rev.%s", cpu_s, pkg, cpu_r);
}
#if defined(CONFIG_DISPLAY_CPUINFO)
int print_cpuinfo(void)
{
char name[SOC_NAME_SIZE];
get_soc_name(name);
printf("CPU: %s\n", name);
return 0;
}
@ -405,6 +491,10 @@ static void setup_boot_mode(void)
env_set("boot_device", "nand");
env_set("boot_instance", "0");
break;
case BOOT_FLASH_SPINAND:
env_set("boot_device", "spi-nand");
env_set("boot_instance", "0");
break;
case BOOT_FLASH_NOR:
env_set("boot_device", "nor");
env_set("boot_instance", "0");
@ -449,7 +539,7 @@ static void setup_boot_mode(void)
* If there is no MAC address in the environment, then it will be initialized
* (silently) from the value in the OTP.
*/
static int setup_mac_address(void)
__weak int setup_mac_address(void)
{
#if defined(CONFIG_NET)
int ret;
@ -481,8 +571,9 @@ static int setup_mac_address(void)
return -EINVAL;
}
pr_debug("OTP MAC address = %pM\n", enetaddr);
ret = !eth_env_set_enetaddr("ethaddr", enetaddr);
if (!ret)
ret = eth_env_set_enetaddr("ethaddr", enetaddr);
if (ret)
pr_err("Failed to set mac address %pM from OTP: %d\n",
enetaddr, ret);
#endif
@ -492,13 +583,13 @@ static int setup_mac_address(void)
static int setup_serial_number(void)
{
char *serial_env;
char serial_string[25];
u32 otp[3] = {0, 0, 0 };
struct udevice *dev;
int ret;
if (env_get("serial#"))
return 0;
serial_env = env_get("serial#");
ret = uclass_get_device_by_driver(UCLASS_MISC,
DM_GET_DRIVER(stm32mp_bsec),
@ -512,6 +603,15 @@ static int setup_serial_number(void)
return ret;
sprintf(serial_string, "%08X%08X%08X", otp[0], otp[1], otp[2]);
if (serial_env) {
if (!strcmp(serial_string, serial_env))
return 0;
/* For invalid enviromnent (serial# change), reset to default */
env_set_default("serial number mismatch", 0);
}
/* save serial number */
env_set("serial#", serial_string);
return 0;
@ -519,9 +619,9 @@ static int setup_serial_number(void)
int arch_misc_init(void)
{
setup_serial_number();
setup_boot_mode();
setup_mac_address();
setup_serial_number();
return 0;
}

View File

@ -5,6 +5,7 @@
#include <common.h>
#include <dm.h>
#include <lmb.h>
#include <ram.h>
DECLARE_GLOBAL_DATA_PTR;
@ -31,3 +32,20 @@ int dram_init(void)
return 0;
}
ulong board_get_usable_ram_top(ulong total_size)
{
phys_addr_t reg;
struct lmb lmb;
/* found enough not-reserved memory to relocated U-Boot */
lmb_init(&lmb);
lmb_add(&lmb, gd->ram_base, gd->ram_size);
boot_fdt_add_mem_rsv_regions(&lmb, (void *)gd->fdt_blob);
reg = lmb_alloc(&lmb, CONFIG_SYS_MALLOC_LEN + total_size, SZ_4K);
if (reg)
return ALIGN(reg + CONFIG_SYS_MALLOC_LEN + total_size, SZ_4K);
return gd->ram_top;
}

View File

@ -1,10 +1,11 @@
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/*
* Copyright (C) 2019, STMicroelectronics - All Rights Reserved
* Copyright (C) 2019-2020, STMicroelectronics - All Rights Reserved
*/
#include <common.h>
#include <fdt_support.h>
#include <tee.h>
#include <asm/arch/sys_proto.h>
#include <dt-bindings/pinctrl/stm32-pinfunc.h>
#include <linux/io.h>
@ -23,6 +24,12 @@
#define ETZPC_RESERVED 0xffffffff
#define STM32_FDCAN_BASE 0x4400e000
#define STM32_CRYP2_BASE 0x4c005000
#define STM32_CRYP1_BASE 0x54001000
#define STM32_GPU_BASE 0x59000000
#define STM32_DSI_BASE 0x5a000000
static const u32 stm32mp1_ip_addr[] = {
0x5c008000, /* 00 stgenc */
0x54000000, /* 01 bkpsram */
@ -33,7 +40,7 @@ static const u32 stm32mp1_ip_addr[] = {
ETZPC_RESERVED, /* 06 reserved */
0x54003000, /* 07 rng1 */
0x54002000, /* 08 hash1 */
0x54001000, /* 09 cryp1 */
STM32_CRYP1_BASE, /* 09 cryp1 */
0x5a003000, /* 0A ddrctrl */
0x5a004000, /* 0B ddrphyc */
0x5c009000, /* 0C i2c6 */
@ -86,7 +93,7 @@ static const u32 stm32mp1_ip_addr[] = {
0x4400b000, /* 3B sai2 */
0x4400c000, /* 3C sai3 */
0x4400d000, /* 3D dfsdm */
0x4400e000, /* 3E tt_fdcan */
STM32_FDCAN_BASE, /* 3E tt_fdcan */
ETZPC_RESERVED, /* 3F reserved */
0x50021000, /* 40 lptim2 */
0x50022000, /* 41 lptim3 */
@ -99,7 +106,7 @@ static const u32 stm32mp1_ip_addr[] = {
0x48003000, /* 48 adc */
0x4c002000, /* 49 hash2 */
0x4c003000, /* 4A rng2 */
0x4c005000, /* 4B cryp2 */
STM32_CRYP2_BASE, /* 4B cryp2 */
ETZPC_RESERVED, /* 4C reserved */
ETZPC_RESERVED, /* 4D reserved */
ETZPC_RESERVED, /* 4E reserved */
@ -126,11 +133,13 @@ static const u32 stm32mp1_ip_addr[] = {
static bool fdt_disable_subnode_by_address(void *fdt, int offset, u32 addr)
{
int node;
fdt_addr_t regs;
for (node = fdt_first_subnode(fdt, offset);
node >= 0;
node = fdt_next_subnode(fdt, node)) {
if (addr == (u32)fdt_getprop(fdt, node, "reg", 0)) {
regs = fdtdec_get_addr(fdt, node, "reg");
if (addr == regs) {
if (fdtdec_get_is_enabled(fdt, node)) {
fdt_status_disabled(fdt, node);
@ -143,11 +152,11 @@ static bool fdt_disable_subnode_by_address(void *fdt, int offset, u32 addr)
return false;
}
static int stm32_fdt_fixup_etzpc(void *fdt)
static int stm32_fdt_fixup_etzpc(void *fdt, int soc_node)
{
const u32 *array;
int array_size, i;
int soc_node, offset, shift;
int offset, shift;
u32 addr, status, decprot[ETZPC_DECPROT_NB];
array = stm32mp1_ip_addr;
@ -156,10 +165,6 @@ static int stm32_fdt_fixup_etzpc(void *fdt)
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;
@ -180,6 +185,64 @@ static int stm32_fdt_fixup_etzpc(void *fdt)
return 0;
}
/* deactivate all the cpu except core 0 */
static void stm32_fdt_fixup_cpu(void *blob, char *name)
{
int off;
u32 reg;
off = fdt_path_offset(blob, "/cpus");
if (off < 0) {
printf("%s: couldn't find /cpus node\n", __func__);
return;
}
off = fdt_node_offset_by_prop_value(blob, -1, "device_type", "cpu", 4);
while (off != -FDT_ERR_NOTFOUND) {
reg = fdtdec_get_addr(blob, off, "reg");
if (reg != 0) {
fdt_del_node(blob, off);
printf("FDT: cpu %d node remove for %s\n", reg, name);
/* after delete we can't trust the offsets anymore */
off = -1;
}
off = fdt_node_offset_by_prop_value(blob, off,
"device_type", "cpu", 4);
}
}
static void stm32_fdt_disable(void *fdt, int offset, u32 addr,
const char *string, const char *name)
{
if (fdt_disable_subnode_by_address(fdt, offset, addr))
printf("FDT: %s@%08x node disabled for %s\n",
string, addr, name);
}
static void stm32_fdt_disable_optee(void *blob)
{
int off, node;
/* Delete "optee" firmware node */
off = fdt_node_offset_by_compatible(blob, -1, "linaro,optee-tz");
if (off >= 0 && fdtdec_get_is_enabled(blob, off))
fdt_del_node(blob, off);
/* Delete "optee@..." reserved-memory node */
off = fdt_path_offset(blob, "/reserved-memory/");
if (off < 0)
return;
for (node = fdt_first_subnode(blob, off);
node >= 0;
node = fdt_next_subnode(blob, node)) {
if (strncmp(fdt_get_name(blob, node, NULL), "optee@", 6))
continue;
if (fdt_del_node(blob, node))
printf("Failed to remove optee reserved-memory node\n");
}
}
/*
* This function is called right before the kernel is booted. "blob" is the
* device tree that will be passed to the kernel.
@ -187,14 +250,59 @@ static int stm32_fdt_fixup_etzpc(void *fdt)
int ft_system_setup(void *blob, bd_t *bd)
{
int ret = 0;
u32 pkg;
int soc;
u32 pkg, cpu;
char name[SOC_NAME_SIZE];
soc = fdt_path_offset(blob, "/soc");
if (soc < 0)
return soc;
if (CONFIG_IS_ENABLED(STM32_ETZPC)) {
ret = stm32_fdt_fixup_etzpc(blob);
ret = stm32_fdt_fixup_etzpc(blob, soc);
if (ret)
return ret;
}
/* MPUs Part Numbers and name*/
cpu = get_cpu_type();
get_soc_name(name);
switch (cpu) {
case CPU_STM32MP151Fxx:
case CPU_STM32MP151Dxx:
case CPU_STM32MP151Cxx:
case CPU_STM32MP151Axx:
stm32_fdt_fixup_cpu(blob, name);
/* after cpu delete we can't trust the soc offsets anymore */
soc = fdt_path_offset(blob, "/soc");
stm32_fdt_disable(blob, soc, STM32_FDCAN_BASE, "can", name);
/* fall through */
case CPU_STM32MP153Fxx:
case CPU_STM32MP153Dxx:
case CPU_STM32MP153Cxx:
case CPU_STM32MP153Axx:
stm32_fdt_disable(blob, soc, STM32_GPU_BASE, "gpu", name);
stm32_fdt_disable(blob, soc, STM32_DSI_BASE, "dsi", name);
break;
default:
break;
}
switch (cpu) {
case CPU_STM32MP157Dxx:
case CPU_STM32MP157Axx:
case CPU_STM32MP153Dxx:
case CPU_STM32MP153Axx:
case CPU_STM32MP151Dxx:
case CPU_STM32MP151Axx:
stm32_fdt_disable(blob, soc, STM32_CRYP1_BASE, "cryp", name);
stm32_fdt_disable(blob, soc, STM32_CRYP2_BASE, "cryp", name);
break;
default:
break;
}
switch (get_cpu_package()) {
case PKG_AA_LBGA448:
pkg = STM32MP_PKG_AA;
@ -219,5 +327,9 @@ int ft_system_setup(void *blob, bd_t *bd)
"st,package", pkg, false);
}
if (!CONFIG_IS_ENABLED(OPTEE) ||
!tee_find_device(NULL, NULL, NULL, NULL))
stm32_fdt_disable_optee(blob);
return ret;
}

View File

@ -0,0 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */
/*
* Copyright (C) 2020, STMicroelectronics - All Rights Reserved
*/
/* check self hosted debug status = BSEC_DENABLE.DBGSWENABLE */
bool bsec_dbgswenable(void);

View File

@ -9,8 +9,10 @@
/* DDR power initializations */
enum ddr_type {
STM32MP_DDR3,
STM32MP_LPDDR2,
STM32MP_LPDDR3,
STM32MP_LPDDR2_16,
STM32MP_LPDDR2_32,
STM32MP_LPDDR3_16,
STM32MP_LPDDR3_32,
};
int board_ddr_power_init(enum ddr_type ddr_type);

View File

@ -37,7 +37,6 @@
/* enumerated used to identify the SYSCON driver instance */
enum {
STM32MP_SYSCON_UNKNOWN,
STM32MP_SYSCON_PWR,
STM32MP_SYSCON_SYSCFG,
};
@ -80,15 +79,29 @@ enum boot_device {
BOOT_SERIAL_USB = 0x60,
BOOT_SERIAL_USB_OTG = 0x62,
BOOT_FLASH_SPINAND = 0x70,
BOOT_FLASH_SPINAND_1 = 0x71,
};
/* 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_COPRO_STATE TAMP_BACKUP_REGISTER(18)
#define TAMP_BOOT_CONTEXT TAMP_BACKUP_REGISTER(20)
#define TAMP_BOOTCOUNT TAMP_BACKUP_REGISTER(21)
#define TAMP_COPRO_STATE_OFF 0
#define TAMP_COPRO_STATE_INIT 1
#define TAMP_COPRO_STATE_CRUN 2
#define TAMP_COPRO_STATE_CSTOP 3
#define TAMP_COPRO_STATE_STANDBY 4
#define TAMP_COPRO_STATE_CRASH 5
#define TAMP_BOOT_MODE_MASK GENMASK(15, 8)
#define TAMP_BOOT_MODE_SHIFT 8
#define TAMP_BOOT_DEVICE_MASK GENMASK(7, 4)
@ -111,7 +124,14 @@ enum forced_boot_mode {
#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 STM32_BSEC_LOCK_OFFSET 0xC0000000
#define STM32_BSEC_LOCK(id) (STM32_BSEC_LOCK_OFFSET + (id) * 4)
/* BSEC OTP index */
#define BSEC_OTP_RPN 1
#define BSEC_OTP_SERIAL 13
#define BSEC_OTP_PKG 16
#define BSEC_OTP_MAC 57
#define BSEC_OTP_BOARD 59
#endif /* __ASSEMBLY__*/

View File

@ -8,31 +8,60 @@
#include <linux/arm-smccc.h>
/* SMC service generic return codes */
#define STM32_SMC_OK 0x00000000U
#define STM32_SMC_NOT_SUPPORTED 0xFFFFFFFFU
#define STM32_SMC_FAILED 0xFFFFFFFEU
#define STM32_SMC_INVALID_PARAMS 0xFFFFFFFDU
/*
* SMC function IDs for STM32 Service queries
* 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
* for SiP (silicon Partner).
* https://developer.arm.com/docs/den0028/latest
*/
#define STM32_SMC_VERSION 0x82000000
/* Secure Service access from Non-secure */
/*
* SMC function STM32_SMC_PWR.
*
* Argument a0: (input) SMCC ID.
* (output) Status return code.
* Argument a1: (input) Service ID (STM32_SMC_REG_xxx).
* Argument a2: (input) Register offset or physical address.
* (output) Register read value, if applicable.
* Argument a3: (input) Register target value if applicable.
*/
#define STM32_SMC_PWR 0x82001001
/*
* SMC functions STM32_SMC_BSEC.
*
* Argument a0: (input) SMCC ID.
* (output) Status return code.
* Argument a1: (input) Service ID (STM32_SMC_READ_xxx/_PROG_xxx/_WRITE_xxx).
* (output) OTP read value, if applicable.
* Argument a2: (input) OTP index.
* Argument a3: (input) OTP value if applicable.
*/
#define STM32_SMC_BSEC 0x82001003
/* Service for BSEC */
/* Service ID for STM32_SMC_PWR */
#define STM32_SMC_REG_READ 0x0
#define STM32_SMC_REG_WRITE 0x1
#define STM32_SMC_REG_SET 0x2
#define STM32_SMC_REG_CLEAR 0x3
/* Service ID for STM32_SMC_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_WRLOCK_OTP 0x07
#define stm32_smc_exec(svc, op, data1, data2) \
stm32_smc(svc, op, data1, data2, NULL)
@ -45,8 +74,8 @@ static inline u32 stm32_smc(u32 svc, u8 op, u32 data1, u32 data2, u32 *result)
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);
pr_err("%s: Failed to exec svc=%x op=%x in secure mode (err = %ld)\n",
__func__, svc, op, res.a0);
return -EINVAL;
}
if (result)

View File

@ -0,0 +1,16 @@
/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */
/*
* Copyright (C) 2020, STMicroelectronics - All Rights Reserved
*/
#define STM32PROG_VIRT_FIRST_DEV_NUM 0xF1
int stm32prog_write_medium_virt(struct dfu_entity *dfu, u64 offset,
void *buf, long *len);
int stm32prog_read_medium_virt(struct dfu_entity *dfu, u64 offset,
void *buf, long *len);
int stm32prog_get_medium_size_virt(struct dfu_entity *dfu, u64 *size);
bool stm32prog_get_tee_partitions(void);
bool stm32prog_get_fsbl_nor(void);

View File

@ -3,19 +3,31 @@
* Copyright (C) 2015-2017, STMicroelectronics - All Rights Reserved
*/
/* ID = Device Version (bit31:16) + Device Part Number (RPN) (bit15:0)*/
/* 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_STMP32MP...Xxx constants */
u32 get_cpu_type(void);
#define CPU_DEV_STM32MP15 0x500
/* return CPU_DEV constants */
u32 get_cpu_dev(void);
#define CPU_REVA 0x1000
#define CPU_REVB 0x2000
#define CPU_REVZ 0x2001
/* return CPU_REV constants */
u32 get_cpu_rev(void);
@ -28,5 +40,17 @@ u32 get_cpu_package(void);
#define PKG_AC_TFBGA361 2
#define PKG_AD_TFBGA257 1
/* Get SOC name */
#define SOC_NAME_SIZE 20
void get_soc_name(char name[SOC_NAME_SIZE]);
/* return boot mode */
u32 get_bootmode(void);
int setup_mac_address(void);
/* board power management : configure vddcore according OPP */
void board_vddcore_init(u32 voltage_mv);
int board_vddcore_set(void);
void dbgmcu_init(void);

View File

@ -30,6 +30,22 @@ u8 psci_state[STM32MP1_PSCI_NR_CPUS] __secure_data = {
PSCI_AFFINITY_LEVEL_ON,
PSCI_AFFINITY_LEVEL_OFF};
static u32 __secure_data cntfrq;
static u32 __secure cp15_read_cntfrq(void)
{
u32 frq;
asm volatile("mrc p15, 0, %0, c14, c0, 0" : "=r" (frq));
return frq;
}
static void __secure cp15_write_cntfrq(u32 frq)
{
asm volatile ("mcr p15, 0, %0, c14, c0, 0" : : "r" (frq));
}
static inline void psci_set_state(int cpu, u8 state)
{
psci_state[cpu] = state;
@ -63,6 +79,9 @@ void __secure psci_arch_cpu_entry(void)
psci_set_state(cpu, PSCI_AFFINITY_LEVEL_ON);
/* write the saved cntfrq */
cp15_write_cntfrq(cntfrq);
/* reset magic in TAMP register */
writel(0xFFFFFFFF, TAMP_BACKUP_MAGIC_NUMBER);
}
@ -130,6 +149,9 @@ s32 __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;
/* read and save cntfrq of current cpu to write on target cpu */
cntfrq = cp15_read_cntfrq();
/* reset magic in TAMP register */
if (readl(TAMP_BACKUP_MAGIC_NUMBER))
writel(0xFFFFFFFF, TAMP_BACKUP_MAGIC_NUMBER);

View File

@ -6,8 +6,9 @@
#include <common.h>
#include <dm.h>
#include <errno.h>
#include <regmap.h>
#include <syscon.h>
#include <asm/io.h>
#include <asm/arch/stm32mp1_smc.h>
#include <power/pmic.h>
#include <power/regulator.h>
@ -26,19 +27,28 @@ struct stm32mp_pwr_reg_info {
};
struct stm32mp_pwr_priv {
struct regmap *regmap;
fdt_addr_t base;
};
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;
return regmap_write(priv->regmap, STM32MP_PWR_CR3, val);
#ifdef CONFIG_STM32MP1_TRUSTED
return stm32_smc_exec(STM32_SMC_PWR, STM32_SMC_REG_WRITE,
STM32MP_PWR_CR3, val);
#else /* CONFIG_STM32MP1_TRUSTED */
writel(val, priv->base + STM32MP_PWR_CR3);
return 0;
#endif /* CONFIG_STM32MP1_TRUSTED */
}
static int stm32mp_pwr_read(struct udevice *dev, uint reg, uint8_t *buff,
@ -49,21 +59,18 @@ static int stm32mp_pwr_read(struct udevice *dev, uint reg, uint8_t *buff,
if (len != 4)
return -EINVAL;
return regmap_read(priv->regmap, STM32MP_PWR_CR3, (u32 *)buff);
*(u32 *)buff = readl(priv->base + STM32MP_PWR_CR3);
return 0;
}
static int stm32mp_pwr_ofdata_to_platdata(struct udevice *dev)
{
struct stm32mp_pwr_priv *priv = dev_get_priv(dev);
struct regmap *regmap;
regmap = syscon_get_regmap_by_driver_data(STM32MP_SYSCON_PWR);
if (IS_ERR(regmap)) {
pr_err("%s: unable to find regmap (%ld)\n", __func__,
PTR_ERR(regmap));
return PTR_ERR(regmap);
}
priv->regmap = regmap;
priv->base = dev_read_addr(dev);
if (priv->base == FDT_ADDR_T_NONE)
return -EINVAL;
return 0;
}

View File

@ -4,6 +4,7 @@
*/
#include <common.h>
#include <cpu_func.h>
#include <dm.h>
#include <spl.h>
#include <asm/io.h>
@ -38,6 +39,8 @@ u32 spl_boot_device(void)
return BOOT_DEVICE_NAND;
case BOOT_FLASH_NOR_QSPI:
return BOOT_DEVICE_SPI;
case BOOT_FLASH_SPINAND_1:
return BOOT_DEVICE_NONE; /* SPINAND not supported in SPL */
}
return BOOT_DEVICE_MMC1;
@ -75,43 +78,69 @@ void spl_display_print(void)
}
#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();
/* 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) {
printf("DRAM init failed: %d\n", ret);
hang();
}
/*
* activate cache on DDR only when DDR is fully initialized
* to avoid speculative access and issue in get_ram_size()
*/
if (!CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
mmu_set_region_dcache_behaviour(STM32_DDR_BASE,
CONFIG_DDR_CACHEABLE_SIZE,
DCACHE_DEFAULT_OPTION);
}
void spl_board_prepare_for_boot(void)
{
dcache_disable();
}
void spl_board_prepare_for_boot_linux(void)
{
dcache_disable();
}

View File

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

View File

@ -1,5 +1,8 @@
/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/gpio/sandbox-gpio.h>
/ {
model = "sandbox";
compatible = "sandbox";
@ -13,6 +16,7 @@
eth5 = &eth_5;
gpio1 = &gpio_a;
gpio2 = &gpio_b;
gpio3 = &gpio_c;
i2c0 = "/i2c@0";
mmc0 = "/mmc0";
mmc1 = "/mmc1";
@ -86,11 +90,21 @@
ping-expect = <0>;
ping-add = <0>;
u-boot,dm-pre-reloc;
test-gpios = <&gpio_a 1>, <&gpio_a 4>, <&gpio_b 5 0 3 2 1>,
test-gpios = <&gpio_a 1>, <&gpio_a 4>,
<&gpio_b 5 GPIO_ACTIVE_HIGH 3 2 1>,
<0>, <&gpio_a 12>;
test2-gpios = <&gpio_a 1>, <&gpio_a 4>, <&gpio_b 6 1 3 2 1>,
<&gpio_b 7 2 3 2 1>, <&gpio_b 8 4 3 2 1>,
<&gpio_b 9 0xc 3 2 1>;
test2-gpios = <&gpio_a 1>, <&gpio_a 4>,
<&gpio_b 6 GPIO_ACTIVE_LOW 3 2 1>,
<&gpio_b 7 GPIO_IN 3 2 1>,
<&gpio_b 8 GPIO_OUT 3 2 1>,
<&gpio_b 9 (GPIO_OUT|GPIO_OUT_ACTIVE) 3 2 1>;
test3-gpios =
<&gpio_c 0 (GPIO_OUT|GPIO_OPEN_DRAIN)>,
<&gpio_c 1 (GPIO_OUT|GPIO_OPEN_SOURCE)>,
<&gpio_c 2 GPIO_OUT>,
<&gpio_c 3 (GPIO_IN|GPIO_PULL_UP)>,
<&gpio_c 4 (GPIO_IN|GPIO_PULL_DOWN)>,
<&gpio_c 5 GPIO_IN>;
int-value = <1234>;
uint-value = <(-1234)>;
};
@ -274,20 +288,32 @@
};
};
gpio_a: base-gpios {
compatible = "sandbox,gpio";
gpio-controller;
#gpio-cells = <1>;
gpio-bank-name = "a";
sandbox,gpio-count = <20>;
};
pinctrl-gpio {
compatible = "sandbox,pinctrl-gpio";
gpio_b: extra-gpios {
compatible = "sandbox,gpio";
gpio-controller;
#gpio-cells = <5>;
gpio-bank-name = "b";
sandbox,gpio-count = <10>;
gpio_a: base-gpios {
compatible = "sandbox,gpio";
gpio-controller;
#gpio-cells = <1>;
gpio-bank-name = "a";
sandbox,gpio-count = <20>;
};
gpio_b: extra-gpios {
compatible = "sandbox,gpio";
gpio-controller;
#gpio-cells = <5>;
gpio-bank-name = "b";
sandbox,gpio-count = <10>;
};
gpio_c: pinmux-gpios {
compatible = "sandbox,gpio";
gpio-controller;
#gpio-cells = <2>;
gpio-bank-name = "c";
sandbox,gpio-count = <10>;
};
};
i2c@0 {
@ -851,6 +877,31 @@
pinctrl {
compatible = "sandbox,pinctrl";
pinctrl-names = "default";
pinctrl-0 = <&gpios>;
gpios: gpios {
gpio0 {
pins = "GPIO0";
bias-pull-up;
input-disable;
};
gpio1 {
pins = "GPIO1";
output-high;
drive-open-drain;
};
gpio2 {
pins = "GPIO2";
bias-pull-down;
input-enable;
};
gpio3 {
pins = "GPIO3";
bias-disable;
};
};
};
hwspinlock@0 {

View File

@ -42,26 +42,6 @@ int sandbox_gpio_get_value(struct udevice *dev, unsigned int offset);
*/
int sandbox_gpio_set_value(struct udevice *dev, unsigned int offset, int value);
/**
* Set or reset the simulated open drain mode of a GPIO (used only in sandbox
* test code)
*
* @param gp GPIO number
* @param value value to set (0 for enabled open drain mode, non-zero for
* disabled)
* @return -1 on error, 0 if ok
*/
int sandbox_gpio_set_open_drain(struct udevice *dev, unsigned offset, int value);
/**
* Return the state of the simulated open drain mode of a GPIO (used only in
* sandbox test code)
*
* @param gp GPIO number
* @return -1 on error, 0 if GPIO is input, >0 if output
*/
int sandbox_gpio_get_open_drain(struct udevice *dev, unsigned offset);
/**
* Return the simulated direction of a GPIO (used only in sandbox test code)
*
@ -82,4 +62,24 @@ int sandbox_gpio_get_direction(struct udevice *dev, unsigned int offset);
int sandbox_gpio_set_direction(struct udevice *dev, unsigned int offset,
int output);
/**
* Return the simulated flags of a GPIO (used only in sandbox test code)
*
* @param dev device to use
* @param offset GPIO offset within bank
* @return dir_flags: bitfield accesses by GPIOD_ defines
*/
ulong sandbox_gpio_get_dir_flags(struct udevice *dev, unsigned int offset);
/**
* Set the simulated flags of a GPIO (used only in sandbox test code)
*
* @param dev device to use
* @param offset GPIO offset within bank
* @param flags dir_flags: bitfield accesses by GPIOD_ defines
* @return -1 on error, 0 if ok
*/
int sandbox_gpio_set_dir_flags(struct udevice *dev, unsigned int offset,
ulong flags);
#endif

View File

@ -0,0 +1,22 @@
if TARGET_DH_STM32MP1_PDK2
config SYS_BOARD
default "dh_stm32mp1"
config SYS_VENDOR
default "dhelectronics"
config SYS_CONFIG_NAME
default "stm32mp1"
config ENV_SECT_SIZE
default 0x10000 if ENV_IS_IN_SPI_FLASH
config ENV_OFFSET
default 0x1E0000 if ENV_IS_IN_SPI_FLASH
config ENV_OFFSET_REDUND
default 0x1F0000 if ENV_IS_IN_SPI_FLASH
source "board/st/common/Kconfig"
endif

View File

@ -0,0 +1,7 @@
DH_STM32MP1_PDK2 BOARD
M: Marek Vasut <marex@denx.de>
S: Maintained
F: arch/arm/dts/stm32mp15xx-dhcom*
F: board/dhelectronics/dh_stm32mp1/
F: configs/stm32mp15_dhcom_basic_defconfig
F: include/configs/stm32mp1.h

View File

@ -0,0 +1,13 @@
# SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
#
# Copyright (C) 2018, STMicroelectronics - All Rights Reserved
#
ifdef CONFIG_SPL_BUILD
obj-y += ../../st/stm32mp1/spl.o
endif
obj-y += ../../st/stm32mp1/board.o board.o
obj-$(CONFIG_SYS_MTDPARTS_RUNTIME) += ../../st/common/stm32mp_mtdparts.o
obj-$(CONFIG_SET_DFU_ALT_INFO) += ../../st/common/stm32mp_dfu.o

View File

@ -0,0 +1,547 @@
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/*
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
*/
#include <common.h>
#include <adc.h>
#include <asm/arch/stm32.h>
#include <asm/arch/sys_proto.h>
#include <asm/gpio.h>
#include <asm/io.h>
#include <bootm.h>
#include <clk.h>
#include <config.h>
#include <dm.h>
#include <dm/device.h>
#include <dm/uclass.h>
#include <env.h>
#include <env_internal.h>
#include <g_dnl.h>
#include <generic-phy.h>
#include <i2c.h>
#include <i2c_eeprom.h>
#include <init.h>
#include <led.h>
#include <memalign.h>
#include <misc.h>
#include <mtd.h>
#include <mtd_node.h>
#include <netdev.h>
#include <phy.h>
#include <power/regulator.h>
#include <remoteproc.h>
#include <reset.h>
#include <syscon.h>
#include <usb.h>
#include <usb/dwc2_udc.h>
#include <watchdog.h>
/* SYSCFG registers */
#define SYSCFG_BOOTR 0x00
#define SYSCFG_PMCSETR 0x04
#define SYSCFG_IOCTRLSETR 0x18
#define SYSCFG_ICNR 0x1C
#define SYSCFG_CMPCR 0x20
#define SYSCFG_CMPENSETR 0x24
#define SYSCFG_PMCCLRR 0x44
#define SYSCFG_BOOTR_BOOT_MASK GENMASK(2, 0)
#define SYSCFG_BOOTR_BOOTPD_SHIFT 4
#define SYSCFG_IOCTRLSETR_HSLVEN_TRACE BIT(0)
#define SYSCFG_IOCTRLSETR_HSLVEN_QUADSPI BIT(1)
#define SYSCFG_IOCTRLSETR_HSLVEN_ETH BIT(2)
#define SYSCFG_IOCTRLSETR_HSLVEN_SDMMC BIT(3)
#define SYSCFG_IOCTRLSETR_HSLVEN_SPI BIT(4)
#define SYSCFG_CMPCR_SW_CTRL BIT(1)
#define SYSCFG_CMPCR_READY BIT(8)
#define SYSCFG_CMPENSETR_MPU_EN BIT(0)
#define SYSCFG_PMCSETR_ETH_CLK_SEL BIT(16)
#define SYSCFG_PMCSETR_ETH_REF_CLK_SEL BIT(17)
#define SYSCFG_PMCSETR_ETH_SELMII BIT(20)
#define SYSCFG_PMCSETR_ETH_SEL_MASK GENMASK(23, 21)
#define SYSCFG_PMCSETR_ETH_SEL_GMII_MII 0
#define SYSCFG_PMCSETR_ETH_SEL_RGMII BIT(21)
#define SYSCFG_PMCSETR_ETH_SEL_RMII BIT(23)
/*
* Get a global data pointer
*/
DECLARE_GLOBAL_DATA_PTR;
int setup_mac_address(void)
{
struct udevice *dev;
ofnode eeprom;
unsigned char enetaddr[6];
int ret;
ret = eth_env_get_enetaddr("ethaddr", enetaddr);
if (ret) /* ethaddr is already set */
return 0;
eeprom = ofnode_path("/soc/i2c@5c002000/eeprom@50");
if (!ofnode_valid(eeprom)) {
printf("Invalid hardware path to EEPROM!\n");
return -ENODEV;
}
ret = uclass_get_device_by_ofnode(UCLASS_I2C_EEPROM, eeprom, &dev);
if (ret) {
printf("Cannot find EEPROM!\n");
return ret;
}
ret = i2c_eeprom_read(dev, 0xfa, enetaddr, 0x6);
if (ret) {
printf("Error reading configuration EEPROM!\n");
return ret;
}
if (is_valid_ethaddr(enetaddr))
eth_env_set_enetaddr("ethaddr", enetaddr);
return 0;
}
int checkboard(void)
{
char *mode;
const char *fdt_compat;
int fdt_compat_len;
if (IS_ENABLED(CONFIG_STM32MP1_TRUSTED))
mode = "trusted";
else
mode = "basic";
printf("Board: stm32mp1 in %s mode", mode);
fdt_compat = fdt_getprop(gd->fdt_blob, 0, "compatible",
&fdt_compat_len);
if (fdt_compat && fdt_compat_len)
printf(" (%s)", fdt_compat);
puts("\n");
return 0;
}
static void board_key_check(void)
{
#if defined(CONFIG_FASTBOOT) || defined(CONFIG_CMD_STM32PROG)
ofnode node;
struct gpio_desc gpio;
enum forced_boot_mode boot_mode = BOOT_NORMAL;
node = ofnode_path("/config");
if (!ofnode_valid(node)) {
debug("%s: no /config node?\n", __func__);
return;
}
#ifdef CONFIG_FASTBOOT
if (gpio_request_by_name_nodev(node, "st,fastboot-gpios", 0,
&gpio, GPIOD_IS_IN)) {
debug("%s: could not find a /config/st,fastboot-gpios\n",
__func__);
} else {
if (dm_gpio_get_value(&gpio)) {
puts("Fastboot key pressed, ");
boot_mode = BOOT_FASTBOOT;
}
dm_gpio_free(NULL, &gpio);
}
#endif
#ifdef CONFIG_CMD_STM32PROG
if (gpio_request_by_name_nodev(node, "st,stm32prog-gpios", 0,
&gpio, GPIOD_IS_IN)) {
debug("%s: could not find a /config/st,stm32prog-gpios\n",
__func__);
} else {
if (dm_gpio_get_value(&gpio)) {
puts("STM32Programmer key pressed, ");
boot_mode = BOOT_STM32PROG;
}
dm_gpio_free(NULL, &gpio);
}
#endif
if (boot_mode != BOOT_NORMAL) {
puts("entering download mode...\n");
clrsetbits_le32(TAMP_BOOT_CONTEXT,
TAMP_BOOT_FORCED_MASK,
boot_mode);
}
#endif
}
#if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG)
#include <usb/dwc2_udc.h>
int g_dnl_board_usb_cable_connected(void)
{
struct udevice *dwc2_udc_otg;
int ret;
ret = uclass_get_device_by_driver(UCLASS_USB_GADGET_GENERIC,
DM_GET_DRIVER(dwc2_udc_otg),
&dwc2_udc_otg);
if (!ret)
debug("dwc2_udc_otg init failed\n");
return dwc2_udc_B_session_valid(dwc2_udc_otg);
}
#define STM32MP1_G_DNL_DFU_PRODUCT_NUM 0xdf11
#define STM32MP1_G_DNL_FASTBOOT_PRODUCT_NUM 0x0afb
int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
{
if (!strcmp(name, "usb_dnl_dfu"))
put_unaligned(STM32MP1_G_DNL_DFU_PRODUCT_NUM, &dev->idProduct);
else if (!strcmp(name, "usb_dnl_fastboot"))
put_unaligned(STM32MP1_G_DNL_FASTBOOT_PRODUCT_NUM,
&dev->idProduct);
else
put_unaligned(CONFIG_USB_GADGET_PRODUCT_NUM, &dev->idProduct);
return 0;
}
#endif /* CONFIG_USB_GADGET */
#ifdef CONFIG_LED
static int get_led(struct udevice **dev, char *led_string)
{
char *led_name;
int ret;
led_name = fdtdec_get_config_string(gd->fdt_blob, led_string);
if (!led_name) {
pr_debug("%s: could not find %s config string\n",
__func__, led_string);
return -ENOENT;
}
ret = led_get_by_label(led_name, dev);
if (ret) {
debug("%s: get=%d\n", __func__, ret);
return ret;
}
return 0;
}
static int setup_led(enum led_state_t cmd)
{
struct udevice *dev;
int ret;
ret = get_led(&dev, "u-boot,boot-led");
if (ret)
return ret;
ret = led_set_state(dev, cmd);
return ret;
}
#endif
static void __maybe_unused led_error_blink(u32 nb_blink)
{
#ifdef CONFIG_LED
int ret;
struct udevice *led;
u32 i;
#endif
if (!nb_blink)
return;
#ifdef CONFIG_LED
ret = get_led(&led, "u-boot,error-led");
if (!ret) {
/* make u-boot,error-led blinking */
/* if U32_MAX and 125ms interval, for 17.02 years */
for (i = 0; i < 2 * nb_blink; i++) {
led_set_state(led, LEDST_TOGGLE);
mdelay(125);
WATCHDOG_RESET();
}
}
#endif
/* infinite: the boot process must be stopped */
if (nb_blink == U32_MAX)
hang();
}
static void sysconf_init(void)
{
#ifndef CONFIG_STM32MP1_TRUSTED
u8 *syscfg;
#ifdef CONFIG_DM_REGULATOR
struct udevice *pwr_dev;
struct udevice *pwr_reg;
struct udevice *dev;
int ret;
u32 otp = 0;
#endif
u32 bootr;
syscfg = (u8 *)syscon_get_first_range(STM32MP_SYSCON_SYSCFG);
/* interconnect update : select master using the port 1 */
/* LTDC = AXI_M9 */
/* GPU = AXI_M8 */
/* today information is hardcoded in U-Boot */
writel(BIT(9), syscfg + SYSCFG_ICNR);
/* disable Pull-Down for boot pin connected to VDD */
bootr = readl(syscfg + SYSCFG_BOOTR);
bootr &= ~(SYSCFG_BOOTR_BOOT_MASK << SYSCFG_BOOTR_BOOTPD_SHIFT);
bootr |= (bootr & SYSCFG_BOOTR_BOOT_MASK) << SYSCFG_BOOTR_BOOTPD_SHIFT;
writel(bootr, syscfg + SYSCFG_BOOTR);
#ifdef CONFIG_DM_REGULATOR
/* High Speed Low Voltage Pad mode Enable for SPI, SDMMC, ETH, QSPI
* and TRACE. Needed above ~50MHz and conditioned by AFMUX selection.
* The customer will have to disable this for low frequencies
* or if AFMUX is selected but the function not used, typically for
* TRACE. Otherwise, impact on power consumption.
*
* WARNING:
* enabling High Speed mode while VDD>2.7V
* with the OTP product_below_2v5 (OTP 18, BIT 13)
* erroneously set to 1 can damage the IC!
* => U-Boot set the register only if VDD < 2.7V (in DT)
* but this value need to be consistent with board design
*/
ret = uclass_get_device_by_driver(UCLASS_PMIC,
DM_GET_DRIVER(stm32mp_pwr_pmic),
&pwr_dev);
if (!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;
}
ret = misc_read(dev, STM32_BSEC_SHADOW(18), &otp, 4);
if (ret > 0)
otp = otp & BIT(13);
/* get VDD = vdd-supply */
ret = device_get_supply_regulator(pwr_dev, "vdd-supply",
&pwr_reg);
/* check if VDD is Low Voltage */
if (!ret) {
if (regulator_get_value(pwr_reg) < 2700000) {
writel(SYSCFG_IOCTRLSETR_HSLVEN_TRACE |
SYSCFG_IOCTRLSETR_HSLVEN_QUADSPI |
SYSCFG_IOCTRLSETR_HSLVEN_ETH |
SYSCFG_IOCTRLSETR_HSLVEN_SDMMC |
SYSCFG_IOCTRLSETR_HSLVEN_SPI,
syscfg + SYSCFG_IOCTRLSETR);
if (!otp)
pr_err("product_below_2v5=0: HSLVEN protected by HW\n");
} else {
if (otp)
pr_err("product_below_2v5=1: HSLVEN update is destructive, no update as VDD>2.7V\n");
}
} else {
debug("VDD unknown");
}
}
#endif
/* activate automatic I/O compensation
* warning: need to ensure CSI enabled and ready in clock driver
*/
writel(SYSCFG_CMPENSETR_MPU_EN, syscfg + SYSCFG_CMPENSETR);
while (!(readl(syscfg + SYSCFG_CMPCR) & SYSCFG_CMPCR_READY))
;
clrbits_le32(syscfg + SYSCFG_CMPCR, SYSCFG_CMPCR_SW_CTRL);
#endif
}
/* board dependent setup after realloc */
int board_init(void)
{
struct udevice *dev;
/* address of boot parameters */
gd->bd->bi_boot_params = STM32_DDR_BASE + 0x100;
/* probe all PINCTRL for hog */
for (uclass_first_device(UCLASS_PINCTRL, &dev);
dev;
uclass_next_device(&dev)) {
pr_debug("probe pincontrol = %s\n", dev->name);
}
board_key_check();
#ifdef CONFIG_DM_REGULATOR
regulators_enable_boot_on(_DEBUG);
#endif
sysconf_init();
if (CONFIG_IS_ENABLED(LED))
led_default_state();
return 0;
}
int board_late_init(void)
{
char *boot_device;
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
const void *fdt_compat;
int fdt_compat_len;
fdt_compat = fdt_getprop(gd->fdt_blob, 0, "compatible",
&fdt_compat_len);
if (fdt_compat && fdt_compat_len) {
if (strncmp(fdt_compat, "st,", 3) != 0)
env_set("board_name", fdt_compat);
else
env_set("board_name", fdt_compat + 3);
}
#endif
/* Check the boot-source to disable bootdelay */
boot_device = env_get("boot_device");
if (!strcmp(boot_device, "serial") || !strcmp(boot_device, "usb"))
env_set("bootdelay", "0");
return 0;
}
void board_quiesce_devices(void)
{
#ifdef CONFIG_LED
setup_led(LEDST_OFF);
#endif
}
/* eth init function : weak called in eqos driver */
int board_interface_eth_init(struct udevice *dev,
phy_interface_t interface_type)
{
u8 *syscfg;
u32 value;
bool eth_clk_sel_reg = false;
bool eth_ref_clk_sel_reg = false;
/* Gigabit Ethernet 125MHz clock selection. */
eth_clk_sel_reg = dev_read_bool(dev, "st,eth_clk_sel");
/* Ethernet 50Mhz RMII clock selection */
eth_ref_clk_sel_reg =
dev_read_bool(dev, "st,eth_ref_clk_sel");
syscfg = (u8 *)syscon_get_first_range(STM32MP_SYSCON_SYSCFG);
if (!syscfg)
return -ENODEV;
switch (interface_type) {
case PHY_INTERFACE_MODE_MII:
value = SYSCFG_PMCSETR_ETH_SEL_GMII_MII |
SYSCFG_PMCSETR_ETH_REF_CLK_SEL;
debug("%s: PHY_INTERFACE_MODE_MII\n", __func__);
break;
case PHY_INTERFACE_MODE_GMII:
if (eth_clk_sel_reg)
value = SYSCFG_PMCSETR_ETH_SEL_GMII_MII |
SYSCFG_PMCSETR_ETH_CLK_SEL;
else
value = SYSCFG_PMCSETR_ETH_SEL_GMII_MII;
debug("%s: PHY_INTERFACE_MODE_GMII\n", __func__);
break;
case PHY_INTERFACE_MODE_RMII:
if (eth_ref_clk_sel_reg)
value = SYSCFG_PMCSETR_ETH_SEL_RMII |
SYSCFG_PMCSETR_ETH_REF_CLK_SEL;
else
value = SYSCFG_PMCSETR_ETH_SEL_RMII;
debug("%s: PHY_INTERFACE_MODE_RMII\n", __func__);
break;
case PHY_INTERFACE_MODE_RGMII:
case PHY_INTERFACE_MODE_RGMII_ID:
case PHY_INTERFACE_MODE_RGMII_RXID:
case PHY_INTERFACE_MODE_RGMII_TXID:
if (eth_clk_sel_reg)
value = SYSCFG_PMCSETR_ETH_SEL_RGMII |
SYSCFG_PMCSETR_ETH_CLK_SEL;
else
value = SYSCFG_PMCSETR_ETH_SEL_RGMII;
debug("%s: PHY_INTERFACE_MODE_RGMII\n", __func__);
break;
default:
debug("%s: Do not manage %d interface\n",
__func__, interface_type);
/* Do not manage others interfaces */
return -EINVAL;
}
/* clear and set ETH configuration bits */
writel(SYSCFG_PMCSETR_ETH_SEL_MASK | SYSCFG_PMCSETR_ETH_SELMII |
SYSCFG_PMCSETR_ETH_REF_CLK_SEL | SYSCFG_PMCSETR_ETH_CLK_SEL,
syscfg + SYSCFG_PMCCLRR);
writel(value, syscfg + SYSCFG_PMCSETR);
return 0;
}
enum env_location env_get_location(enum env_operation op, int prio)
{
if (prio)
return ENVL_UNKNOWN;
#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
return ENVL_SPI_FLASH;
#else
return ENVL_NOWHERE;
#endif
}
#if defined(CONFIG_OF_BOARD_SETUP)
int ft_board_setup(void *blob, bd_t *bd)
{
return 0;
}
#endif
static void board_copro_image_process(ulong fw_image, size_t fw_size)
{
int ret, id = 0; /* Copro id fixed to 0 as only one coproc on mp1 */
if (!rproc_is_initialized())
if (rproc_init()) {
printf("Remote Processor %d initialization failed\n",
id);
return;
}
ret = rproc_load(id, fw_image, fw_size);
printf("Load Remote Processor %d with data@addr=0x%08lx %u bytes:%s\n",
id, fw_image, fw_size, ret ? " Failed!" : " Success!");
if (!ret) {
rproc_start(id);
env_set("copro_state", "booted");
}
}
U_BOOT_FIT_LOADABLE_HANDLER(IH_TYPE_COPRO, board_copro_image_process);

71
board/st/common/Kconfig Normal file
View File

@ -0,0 +1,71 @@
config CMD_STBOARD
bool "stboard - command for OTP board information"
depends on ARCH_STM32MP
default y if TARGET_ST_STM32MP15x
help
This compile the stboard command to
read and write the board in the OTP.
config MTDPARTS_NAND0_BOOT
string "mtd boot partitions for nand0"
default "2m(fsbl),2m(ssbl1),2m(ssbl2)"
depends on SYS_MTDPARTS_RUNTIME && ARCH_STM32MP
help
This define the partitions of nand0 used to build mtparts dynamically
for boot from nand0.
Each partition need to be aligned with the device erase block size,
512KB is the max size for the NAND supported by stm32mp1 platform.
config MTDPARTS_NAND0_TEE
string "mtd tee partitions for nand0"
default "512k(teeh),512k(teed),512k(teex)"
depends on SYS_MTDPARTS_RUNTIME && ARCH_STM32MP
help
This define the tee partitions added in mtparts dynamically
when tee is supported with boot from nand0.
Each partition need to be aligned with the device erase block size,
512KB is the max size for the NAND supported by stm32mp1 platform.
config MTDPARTS_NOR0_BOOT
string "mtd boot partitions for nor0"
default "256k(fsbl1),256k(fsbl2),2m(ssbl),512k(u-boot-env)"
depends on SYS_MTDPARTS_RUNTIME && ARCH_STM32MP
help
This define the partitions of nand0 used to build mtparts dynamically
for boot from nor0.
Each partition need to be aligned with the device erase block size,
with 256KB we support all the NOR.
U-Boot env partition (512kB) use 2 erase block for redundancy.
config MTDPARTS_NOR0_TEE
string "mtd tee partitions for nor0"
default "256k(teeh),512k(teed),256k(teex)"
depends on SYS_MTDPARTS_RUNTIME && ARCH_STM32MP
help
This define the tee partitions added in mtparts dynamically
when tee is supported with boot from nor0.
config MTDPARTS_SPINAND0_BOOT
string "mtd boot partitions for spi-nand0"
default "2m(fsbl),2m(ssbl1),2m(ssbl2)"
depends on SYS_MTDPARTS_RUNTIME && ARCH_STM32MP
help
This define the partitions of nand0 used to build mtparts dynamically
for boot from spi-nand0,
512KB is the max size for the NAND supported by stm32mp1 platform.
config MTDPARTS_SPINAND0_TEE
string "mtd tee partitions for spi-nand0"
default "512k(teeh),512k(teed),512k(teex)"
depends on SYS_MTDPARTS_RUNTIME && ARCH_STM32MP
help
This define the tee partitions added in mtparts dynamically
when tee is supported with boot from spi-nand0,
512KB is the max size for the NAND supported by stm32mp1 platform.
config DFU_ALT_RAM0
string "dfu for ram0"
default "uImage ram 0xc2000000 0x2000000;devicetree.dtb ram 0xc4000000 0x100000;uramdisk.image.gz ram 0xc4400000 0x10000000"
depends on ARCH_STM32MP && SET_DFU_ALT_INFO
help
This defines the partitions of ram used to build dfu dynamically.

View File

@ -0,0 +1,6 @@
ST BOARDS
M: Patrick Delaunay <patrick.delaunay@st.com>
L: uboot-stm32@st-md-mailman.stormreply.com (moderated for non-subscribers)
T: git https://gitlab.denx.de/u-boot/custodians/u-boot-stm.git
S: Maintained
F: board/st/common/

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