[PATCH 2/2] ARM: stm32mp: add board support for STM32MP135F-DK

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Feb 21 02:36:25 PST 2022


We already have the needed drivers in place to support the upcoming
STM32MP131. Linux already has a basic DT for the DK board. Add a barebox
board that leverages it. To try it out modify the existing FIP with:

  fiptool update --nt-fw build/images/barebox-stm32mp-generic-bl33.img \
                 --hw-config build/arch/arm/dts/stm32mp135f-dk.dtb \
		 mmcblk0p3

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 Documentation/boards/stm32mp.rst          |  1 +
 arch/arm/boards/Makefile                  |  1 +
 arch/arm/boards/stm32mp13xx-dk/Makefile   |  2 ++
 arch/arm/boards/stm32mp13xx-dk/lowlevel.c | 19 +++++++++++++++++++
 arch/arm/dts/Makefile                     |  1 +
 arch/arm/dts/stm32mp131.dtsi              | 14 ++++++++++++++
 arch/arm/dts/stm32mp135f-dk.dts           | 12 ++++++++++++
 arch/arm/mach-stm32mp/Kconfig             |  8 ++++++++
 images/Makefile.stm32mp                   |  1 +
 9 files changed, 59 insertions(+)
 create mode 100644 arch/arm/boards/stm32mp13xx-dk/Makefile
 create mode 100644 arch/arm/boards/stm32mp13xx-dk/lowlevel.c
 create mode 100644 arch/arm/dts/stm32mp131.dtsi
 create mode 100644 arch/arm/dts/stm32mp135f-dk.dts

diff --git a/Documentation/boards/stm32mp.rst b/Documentation/boards/stm32mp.rst
index 55bdafe78579..6f4b14049ad4 100644
--- a/Documentation/boards/stm32mp.rst
+++ b/Documentation/boards/stm32mp.rst
@@ -33,6 +33,7 @@ There's a single ``stm32mp_defconfig`` for all STM32MP boards::
 The resulting images will be placed under ``images/``::
 
   barebox-stm32mp-generic-bl33.img
+  barebox-stm32mp13xx-dk.stm32
   barebox-stm32mp15xx-dkx.stm32
   barebox-stm32mp15x-ev1.stm32
   barebox-stm32mp157c-lxa-mc1.stm32
diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index a15963c775ce..8557e1dca8c6 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -139,6 +139,7 @@ obj-$(CONFIG_MACH_SOCFPGA_TERASIC_SOCKIT)	+= terasic-sockit/
 obj-$(CONFIG_MACH_SOLIDRUN_CUBOX)		+= solidrun-cubox/
 obj-$(CONFIG_MACH_SOLIDRUN_MICROSOM)		+= solidrun-microsom/
 obj-$(CONFIG_MACH_STM32MP15XX_DKX)		+= stm32mp15xx-dkx/
+obj-$(CONFIG_MACH_STM32MP13XX_DK)		+= stm32mp13xx-dk/
 obj-$(CONFIG_MACH_LXA_MC1)			+= lxa-mc1/
 obj-$(CONFIG_MACH_STM32MP15X_EV1)		+= stm32mp15x-ev1/
 obj-$(CONFIG_MACH_TECHNEXION_PICO_HOBBIT)	+= technexion-pico-hobbit/
diff --git a/arch/arm/boards/stm32mp13xx-dk/Makefile b/arch/arm/boards/stm32mp13xx-dk/Makefile
new file mode 100644
index 000000000000..9961af02a3ea
--- /dev/null
+++ b/arch/arm/boards/stm32mp13xx-dk/Makefile
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
+lwl-y += lowlevel.o
diff --git a/arch/arm/boards/stm32mp13xx-dk/lowlevel.c b/arch/arm/boards/stm32mp13xx-dk/lowlevel.c
new file mode 100644
index 000000000000..ac4fa40e1960
--- /dev/null
+++ b/arch/arm/boards/stm32mp13xx-dk/lowlevel.c
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include <mach/entry.h>
+#include <debug_ll.h>
+
+extern char __dtb_z_stm32mp135f_dk_start[];
+
+ENTRY_FUNCTION(start_stm32mp13xx_dk, r0, r1, r2)
+{
+	void *fdt;
+
+	stm32mp_cpu_lowlevel_init();
+
+	putc_ll('>');
+
+	fdt = __dtb_z_stm32mp135f_dk_start  + get_runtime_offset();
+
+	stm32mp1_barebox_entry(fdt);
+}
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index d419e8394d53..e0bb66580f38 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -127,6 +127,7 @@ lwl-$(CONFIG_MACH_SKOV_IMX6) += imx6s-skov-imx6.dtb.o imx6dl-skov-imx6.dtb.o imx
 lwl-$(CONFIG_MACH_SKOV_ARM9CPU) += at91-skov-arm9cpu.dtb.o
 lwl-$(CONFIG_MACH_SEEED_ODYSSEY) += stm32mp157c-odyssey.dtb.o
 lwl-$(CONFIG_MACH_STM32MP15XX_DKX) += stm32mp157c-dk2.dtb.o stm32mp157a-dk1.dtb.o
+lwl-$(CONFIG_MACH_STM32MP13XX_DK) += stm32mp135f-dk.dtb.o
 lwl-$(CONFIG_MACH_LXA_MC1) += stm32mp157c-lxa-mc1.dtb.o
 lwl-$(CONFIG_MACH_STM32MP15X_EV1) += stm32mp157c-ev1.dtb.o
 lwl-$(CONFIG_MACH_SCB9328) += imx1-scb9328.dtb.o
diff --git a/arch/arm/dts/stm32mp131.dtsi b/arch/arm/dts/stm32mp131.dtsi
new file mode 100644
index 000000000000..2ecad85f086e
--- /dev/null
+++ b/arch/arm/dts/stm32mp131.dtsi
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+/ {
+	aliases {
+		mmc0 = &sdmmc1;
+	};
+};
+
+&{/soc} {
+	memory-controller at 5a003000 {
+		compatible = "st,stm32mp13-ddr";
+		reg = <0x5a003000 0x1000>;
+	};
+};
diff --git a/arch/arm/dts/stm32mp135f-dk.dts b/arch/arm/dts/stm32mp135f-dk.dts
new file mode 100644
index 000000000000..104886e8af88
--- /dev/null
+++ b/arch/arm/dts/stm32mp135f-dk.dts
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+
+#include <arm/stm32mp135f-dk.dts>
+#include "stm32mp131.dtsi"
+
+/ {
+	model = "STM32MP153F-DK";
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+};
diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig
index 38c1a44770c9..57c1691591e7 100644
--- a/arch/arm/mach-stm32mp/Kconfig
+++ b/arch/arm/mach-stm32mp/Kconfig
@@ -6,10 +6,18 @@ config ARCH_NR_GPIO
 	int
 	default 416
 
+config ARCH_STM32MP13
+	select ARM_PSCI_CLIENT
+	bool
+
 config ARCH_STM32MP157
 	select ARM_PSCI_CLIENT
 	bool
 
+config MACH_STM32MP13XX_DK
+	select ARCH_STM32MP13
+	bool "STM32MP137F DK board"
+
 config MACH_STM32MP15XX_DKX
 	select ARCH_STM32MP157
 	bool "STM32MP157 DK1 and DK2 boards"
diff --git a/images/Makefile.stm32mp b/images/Makefile.stm32mp
index fa79e09f952f..abe70a6a5037 100644
--- a/images/Makefile.stm32mp
+++ b/images/Makefile.stm32mp
@@ -30,6 +30,7 @@ pblb-$(CONFIG_ARCH_STM32MP) += start_stm32mp_bl33
 FILE_barebox-stm32mp-generic-bl33.img  = start_stm32mp_bl33.pblb
 image-$(CONFIG_ARCH_STM32MP) += barebox-stm32mp-generic-bl33.img
 
+$(call build_stm32mp_image, CONFIG_MACH_STM32MP13XX_DK, start_stm32mp13xx_dk, stm32mp13xx-dk)
 $(call build_stm32mp_image, CONFIG_MACH_STM32MP15XX_DKX, start_stm32mp15xx_dkx, stm32mp15xx-dkx)
 $(call build_stm32mp_image, CONFIG_MACH_STM32MP15X_EV1, start_stm32mp15x_ev1, stm32mp15x-ev1)
 
-- 
2.30.2




More information about the barebox mailing list