From 4dc6908c60bf1289718c8c5f062c0b7054baecf4 Mon Sep 17 00:00:00 2001
From: Etienne Carriere <etienne.carriere@linaro.org>
Date: Thu, 8 Apr 2021 12:41:11 +0200
Subject: [PATCH] stm32mp1: define STM32MP15C-ED1

STM32MP15C-ED1 is the child board plugged on EV1 mother board. ED1 can
be used without its mother board with some interface restrictions
(I.e. no USB-C). This change defines the platform flavor. The several
components (optee_os, tf-a, u-boot, linux) already support ED1 DTS file
identifier.

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Acked-by: Jerome Forissier <jerome@forissier.org>
---
 .../stm32mp1-tz/genimage-STM32MP157C-ED1.cfg  | 48 +++++++++++++++++++
 .../boot/extlinux/extlinux.conf               |  6 +++
 stm32mp1.mk                                   |  3 ++
 3 files changed, 57 insertions(+)
 create mode 100644 br-ext/board/stmicroelectronics/stm32mp1-tz/genimage-STM32MP157C-ED1.cfg
 create mode 100644 br-ext/board/stmicroelectronics/stm32mp1-tz/overlay-STM32MP157C-ED1/boot/extlinux/extlinux.conf

diff --git a/br-ext/board/stmicroelectronics/stm32mp1-tz/genimage-STM32MP157C-ED1.cfg b/br-ext/board/stmicroelectronics/stm32mp1-tz/genimage-STM32MP157C-ED1.cfg
new file mode 100644
index 0000000..1d10fcb
--- /dev/null
+++ b/br-ext/board/stmicroelectronics/stm32mp1-tz/genimage-STM32MP157C-ED1.cfg
@@ -0,0 +1,48 @@
+image sdcard.img {
+	hdimage {
+		gpt = "true"
+	}
+
+	partition fsbl1 {
+		image = "tf-a-stm32mp157c-ed1.stm32"
+		size = 256K
+	}
+
+	partition fsbl2 {
+		image = "tf-a-stm32mp157c-ed1.stm32"
+		size = 256K
+	}
+
+	partition ssbl {
+		image = "u-boot.stm32"
+		size = 2M
+	}
+
+	partition teeh {
+		image = "tee-header_v2.stm32"
+		size = 32K
+	}
+
+	partition teed {
+		image = "tee-pageable_v2.stm32"
+		size = 2M
+	}
+
+	partition teex {
+		image = "tee-pager_v2.stm32"
+		size = 2M
+	}
+
+	partition bootfs {
+		image = "bootfs.ext2"
+		partition-type-uuid = L
+		size = 32M
+		bootable = "yes"
+	}
+
+	partition rootfs {
+		image = "rootfs.ext2"
+		partition-type-uuid = L
+		size = 100M
+	}
+}
diff --git a/br-ext/board/stmicroelectronics/stm32mp1-tz/overlay-STM32MP157C-ED1/boot/extlinux/extlinux.conf b/br-ext/board/stmicroelectronics/stm32mp1-tz/overlay-STM32MP157C-ED1/boot/extlinux/extlinux.conf
new file mode 100644
index 0000000..2c7f84f
--- /dev/null
+++ b/br-ext/board/stmicroelectronics/stm32mp1-tz/overlay-STM32MP157C-ED1/boot/extlinux/extlinux.conf
@@ -0,0 +1,6 @@
+TIMEOUT 20
+DEFAULT stm32mp15-buildroot
+LABEL stm32mp15-buildroot
+  kernel /boot/uImage
+  devicetree /boot/stm32mp157c-ev1.dtb
+  append root=/dev/mmcblk0p8 rootwait rw console=ttySTM0,115200
diff --git a/stm32mp1.mk b/stm32mp1.mk
index 193230e..7995ef8 100644
--- a/stm32mp1.mk
+++ b/stm32mp1.mk
@@ -22,6 +22,9 @@ STM32MP1_DTS_BASENAME	= stm32mp157c-dk2
 else ifeq ($(PLATFORM),stm32mp1-157C_EV1)
 BREXT_FLAVOR		= STM32MP157C-EV1
 STM32MP1_DTS_BASENAME	= stm32mp157c-ev1
+else ifeq ($(PLATFORM),stm32mp1-157C_ED1)
+BREXT_FLAVOR		= STM32MP157C-ED1
+STM32MP1_DTS_BASENAME	= stm32mp157c-ed1
 else
 $(error Unknown PLATFORM $(PLATFORM))
 endif
-- 
GitLab