[U-Boot] [PATCH 4/6] stm32mp1: add support for stm32mp157c-ev1 board

Patrick Delaunay patrick.delaunay at st.com
Mon Jul 9 13:17:22 UTC 2018


Add support of stm32mp157c-ev1, the evaluation board with pmic stpmu1
(ev1 = mother board + daughter ed1) with device tree.
EV1 is the selected board by default in basic defconfig.

PS: CONFIG_PINCTRL_FULL activation avoid to increase
    SYS_MALLOC_F_LEN (Early malloc usage: 2034)

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

 arch/arm/dts/Makefile                    |   3 +-
 arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi |  62 +++++++++++++++++++
 arch/arm/dts/stm32mp157c-ev1.dts         | 101 +++++++++++++++++++++++++++++++
 board/st/stm32mp1/README                 |  53 ++++++++++++++--
 configs/stm32mp15_basic_defconfig        |   3 +-
 5 files changed, 215 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi
 create mode 100644 arch/arm/dts/stm32mp157c-ev1.dts

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 64f6d21..2d74d3a 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -533,7 +533,8 @@ dtb-$(CONFIG_ARCH_ASPEED) += ast2500-evb.dtb
 dtb-$(CONFIG_ARCH_STI) += stih410-b2260.dtb
 
 dtb-$(CONFIG_TARGET_STM32MP1) += \
-	stm32mp157c-ed1.dtb
+	stm32mp157c-ed1.dtb \
+	stm32mp157c-ev1.dtb
 
 targets += $(dtb-y)
 
diff --git a/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi b/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi
new file mode 100644
index 0000000..2f4de3a
--- /dev/null
+++ b/arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi
@@ -0,0 +1,62 @@
+// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
+/*
+ * Copyright : STMicroelectronics 2018
+ */
+
+#include "stm32mp157c-ed1-u-boot.dtsi"
+
+/ {
+	aliases {
+		spi0 = &qspi;
+		i2c1 = &i2c2;
+		i2c4 = &i2c5;
+	};
+};
+
+&flash0 {
+	compatible = "spi-flash";
+};
+
+&flash1 {
+	compatible = "spi-flash";
+};
+
+&v3v3 {
+	regulator-always-on;
+};
+
+/* SPL part **************************************/
+&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;
+	};
+};
+
+&flash0 {
+	u-boot,dm-spl;
+};
diff --git a/arch/arm/dts/stm32mp157c-ev1.dts b/arch/arm/dts/stm32mp157c-ev1.dts
new file mode 100644
index 0000000..d6934f7
--- /dev/null
+++ b/arch/arm/dts/stm32mp157c-ev1.dts
@@ -0,0 +1,101 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+/*
+ * Copyright (C) STMicroelectronics 2017 - All Rights Reserved
+ * Author: Ludovic Barre <ludovic.barre at st.com> for STMicroelectronics.
+ */
+/dts-v1/;
+
+#include "stm32mp157c-ed1.dts"
+
+/ {
+	model = "STMicroelectronics STM32MP157C eval daughter on eval mother";
+	compatible = "st,stm32mp157c-ev1", "st,stm32mp157c-ed1", "st,stm32mp157";
+
+};
+
+&cec {
+	pinctrl-names = "default";
+	pinctrl-0 = <&cec_pins_a>;
+	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";
+};
+
+&i2c5 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2c5_pins_a>;
+	i2c-scl-rising-time-ns = <185>;
+	i2c-scl-falling-time-ns = <20>;
+	status = "okay";
+};
+
+&qspi {
+	pinctrl-names = "default";
+	pinctrl-0 = <&qspi_clk_pins_a &qspi_bk1_pins_a &qspi_bk2_pins_a>;
+	reg = <0x58003000 0x1000>, <0x70000000 0x4000000>;
+	#address-cells = <1>;
+	#size-cells = <0>;
+	status = "okay";
+
+	flash0: mx66l51235l at 0 {
+		reg = <0>;
+		spi-rx-bus-width = <4>;
+		spi-max-frequency = <108000000>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+	};
+
+	flash1: mx66l51235l at 1 {
+		reg = <1>;
+		spi-rx-bus-width = <4>;
+		spi-max-frequency = <108000000>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+	};
+};
+
+&timers2 {
+	status = "disabled";
+	pwm {
+		pinctrl-0 = <&pwm2_pins_a>;
+		pinctrl-names = "default";
+		status = "okay";
+	};
+	timer at 1 {
+		status = "okay";
+	};
+};
+
+&timers8 {
+	status = "disabled";
+	pwm {
+		pinctrl-0 = <&pwm8_pins_a>;
+		pinctrl-names = "default";
+		status = "okay";
+	};
+	timer at 7 {
+		status = "okay";
+	};
+};
+
+&timers12 {
+	status = "disabled";
+	pwm {
+		pinctrl-0 = <&pwm12_pins_a>;
+		pinctrl-names = "default";
+		status = "okay";
+	};
+	timer at 11 {
+		status = "okay";
+	};
+};
+
+&usbphyc {
+	status = "okay";
+};
diff --git a/board/st/stm32mp1/README b/board/st/stm32mp1/README
index 7d7ad8b..174e6db 100644
--- a/board/st/stm32mp1/README
+++ b/board/st/stm32mp1/README
@@ -29,9 +29,12 @@ Everything is supported in Linux but U-Boot is limited to:
 And the necessary drivers
 1. I2C
 2. STPMU1
-3. Clock, Reset
+2. STPMU1 (PMIC and regulator)
+3. Clock, Reset, Sysreset
+4. Fuse
 
 Currently the following boards are supported:
++ stm32mp157c-ev1
 + stm32mp157c-ed1
 
 3. Boot Sequences
@@ -61,6 +64,9 @@ Each board is configurated only with the associated device tree.
 You need to select the appropriate device tree for your board,
 the supported device trees for stm32mp157 are:
 
++ ev1: eval board with pmic stpmu1 (ev1 = mother board + daughter ed1)
+  dts: stm32mp157c-ev1
+
 + ed1: daughter board with pmic stpmu1
   dts: stm32mp157c-ed1
 
@@ -98,6 +104,11 @@ the supported device trees for stm32mp157 are:
 
 
   example:
+     basic boot on ev1
+	# export KBUILD_OUTPUT=stm32mp15_basic
+	# make stm32mp15_basic_defconfig
+	# make DEVICE_TREE=stm32mp157c-ev1 all
+
      basic boot on ed1
 	# export KBUILD_OUTPUT=stm32mp15_basic
 	# make stm32mp15_basic_defconfig
@@ -105,7 +116,7 @@ the supported device trees for stm32mp157 are:
 
 6. Output files
 
-  BootRom and ATF expect binaries with STM32 image header
+  BootRom and TF-A expect binaries with STM32 image header
   SPL expects file with U-Boot uImage header
 
   So in the output directory (selected by KBUILD_OUTPUT),
@@ -150,8 +161,8 @@ Then the minimal GPT partition is:
    ----- ------- --------- -------------
   | Num | Name  | Size    |  Content    |
    ----- ------- -------- --------------
-  |  1  | fsbl1 | 256 KiB |  ATF or SPL |
-  |  2  | fsbl2 | 256 KiB |  ATF or SPL |
+  |  1  | fsbl1 | 256 KiB |  TF-A or SPL |
+  |  2  | fsbl2 | 256 KiB |  TF-A or SPL |
   |  3  | ssbl  | enought |  U-Boot     |
   |  *  |  -    |  -      |  Boot/Rootfs|
    ----- ------- --------- -------------
@@ -176,7 +187,9 @@ for example: with gpt table with 128 entries
 		-n 3:1058:5153		-c 3:ssbl \
 		-p /dev/<SDCard dev>
 
-	you can add other partition for kernel (rootfs for example)
+	you can add other partitions for kernel
+	one partition rootfs for example:
+		-n 3:5154:		-c 4:rootfs
 
   c) copy the FSBL (2 times) and SSBL file on the correct partition.
      in this example in partition 1 to 3
@@ -223,3 +236,33 @@ b) copy U-Boot in first GPT partition of eMMC
 	# mmc write ${fileaddr} ${partstart} ${partsize}
 
 To boot from eMMC, select BootPinMode = 0 1 0 and reset.
+
+9. MAC Address
+==============
+
+Please read doc/README.enetaddr for the implementation guidelines for mac id
+usage. Basically, environment has precedence over board specific storage.
+
+Mac id storage and retrieval in stm32mp otp :
+- OTP_57[31:0] = MAC_ADDR[31:0]
+- OTP_58[15:0] = MAC_ADDR[47:32]
+
+To program a MAC address on virgin OTP words above, you can use the fuse command
+on bank 0 to access to internal OTP:
+
+    example to set mac address "12:34:56:78:9a:bc"
+
+    1- Write OTP
+       STM32MP> fuse prog -y 0 57 0x78563412 0x0000bc9a
+
+    2- Read OTP
+       STM32MP> fuse sense 0 57 2
+       Sensing bank 0:
+       Word 0x00000039: 78563412 0000bc9a
+
+    3- next REBOOT :
+       ### Setting environment from OTP MAC address = "12:34:56:78:9a:bc"
+
+    4 check env update
+       STM32MP> print ethaddr
+       ethaddr=12:34:56:78:9a:bc
diff --git a/configs/stm32mp15_basic_defconfig b/configs/stm32mp15_basic_defconfig
index 3a94db5..87f60be 100644
--- a/configs/stm32mp15_basic_defconfig
+++ b/configs/stm32mp15_basic_defconfig
@@ -4,7 +4,7 @@ CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_SPL_MMC_SUPPORT=y
 CONFIG_SPL=y
 CONFIG_TARGET_STM32MP1=y
-CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ed1"
+CONFIG_DEFAULT_DEVICE_TREE="stm32mp157c-ev1"
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=3
@@ -31,6 +31,7 @@ CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_STM32F7=y
 CONFIG_DM_MMC=y
 CONFIG_STM32_SDMMC2=y
+# CONFIG_PINCTRL_FULL is not set
 # CONFIG_SPL_PINCTRL_FULL is not set
 CONFIG_DM_PMIC=y
 # CONFIG_SPL_PMIC_CHILDREN is not set
-- 
2.7.4



More information about the U-Boot mailing list