Skip to contentSkip to conversation

Start of MStar/SigmaStar Arm v7 SoC support

RFC PATCH New Daniel Palmer 2 participants 6 messages Sep 14, 2020 – Sep 15, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Start of MStar/SigmaStar Arm v7 SoC support

The initial very basic support for MStar/SigmaStar's Arm v7 SoCs should land in Linux 5.9 so I want to start the ball rolling on the u-boot side of things.

This series does almost nothing aside from define the header needed for the binaries to boot.

In my tree everything is working to the point that booting from SPI NOR, ethernet, SD etc work and for one chip it's even possible to have a completely u-boot boot flow.

I'm working on cleaning those patches up but I'm not sure how much I need for this very first series. So I've put the bare minimum here and will pull more parts in based on feedback.

Daniel Palmer (3):
arm: mstar: Initial MStar/SigmaStar Armv7 SoC support
arm: mstar: Add option for loading the SPL from the IPL
arm: mstar: Add boot0 header

 MAINTAINERS                               |  6 +++++
 arch/arm/Kconfig                          |  9 +++++++
 arch/arm/Makefile                         |  1 +
 arch/arm/include/asm/arch-mstarv7/boot0.h | 29 ++++++++++++++++++++
 arch/arm/mach-mstar/Kconfig               | 32 +++++++++++++++++++++++
 5 files changed, 77 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-mstarv7/boot0.h
 create mode 100644 arch/arm/mach-mstar/Kconfig
Signature · 1 line
2.27.0
#1 lore raw

RFC PATCH 1/3 arm: mstar: Initial MStar/SigmaStar Armv7 SoC support

The patch adds a very basic skeleton for the MStar/SigmaStar Armv7 SoC to go into. It doesn't do anything yet.

---
 MAINTAINERS                 |  5 +++++
 arch/arm/Kconfig            |  8 ++++++++
 arch/arm/Makefile           |  1 +
 arch/arm/mach-mstar/Kconfig | 17 +++++++++++++++++
 4 files changed, 31 insertions(+)
 create mode 100644 arch/arm/mach-mstar/Kconfig
MAINTAINERS +5 -0
index 101f4e185d..be621a614f 100644
@@ -293,6 +293,11 @@ F:	arch/arm/mach-at91/
 F:	board/atmel/
 F:	drivers/misc/microchip_flexcom.c
 
+ARM MSTAR/SIGMASTAR V7
+M:	Daniel Palmer <[email protected]>
+S:	Maintained
+F:	arch/arm/mach-mstar/
+
 ARM NEXELL S5P4418
 M:	Stefan Bosch <[email protected]>
 S:	Maintained
arch/arm/Kconfig +8 -0
index 80702c23d3..7a25410ede 100644
@@ -1166,6 +1166,12 @@ config ARCH_ZYNQMP
 	imply MP
 	imply DM_USB_GADGET
 
+config ARCH_MSTARV7
+	bool "MStar/SigmaStar ARM v7 SoCs"
+	select CPU_V7A
+	select SYS_NS16550
+	imply SUPPORT_SPL
+
 config ARCH_TEGRA
 	bool "NVIDIA Tegra"
 	imply DISTRO_DEFAULTS
@@ -1927,6 +1933,8 @@ source "arch/arm/mach-versal/Kconfig"
 
 source "arch/arm/mach-zynqmp-r5/Kconfig"
 
+source "arch/arm/mach-mstar/Kconfig"
+
 source "arch/arm/cpu/armv7/Kconfig"
 
 source "arch/arm/cpu/armv8/Kconfig"
arch/arm/Makefile +1 -0
index 28b523b37c..deeb08b989 100644
@@ -87,6 +87,7 @@ machine-$(CONFIG_ARCH_VERSAL)		+= versal
 machine-$(CONFIG_ARCH_ZYNQ)		+= zynq
 machine-$(CONFIG_ARCH_ZYNQMP)		+= zynqmp
 machine-$(CONFIG_ARCH_ZYNQMP_R5)	+= zynqmp-r5
+machine-$(CONFIG_ARCH_MSTARV7)		+= mstar
 
 machdirs := $(patsubst %,arch/arm/mach-%/,$(machine-y))
 
arch/arm/mach-mstar/Kconfig new file +17 -0
new file mode 100644
index 0000000000..ead9e126cc
@@ -0,0 +1,17 @@
+menu "MStar/SigmaStar v7 options"
+	depends on ARCH_MSTARV7
+
+endmenu
+
+if ARCH_MSTARV7
+
+config DEBUG_UART_BASE
+	default 0x1f221000
+
+config DEBUG_UART_CLOCK
+	default 172000000
+
+config DEBUG_UART_SHIFT
+	default 3
+
+endif
Signature · 1 line
2.27.0
#2 lore raw

RFC PATCH 2/3 arm: mstar: Add option for loading the SPL from the IPL

In reply to Daniel Palmer

The boot process for MStar/Sigmastar Arm v7 SoCs involves a small boot rom, then an "IPL" which does hardware setup and loads another loader called "IPL Cust" that does more customer specific setup and that then finally loads maybe u-boot, Linux or an RTOS kernel.

At the moment DDR init isn't implemented in our SPL so we need to let the boot rom run the standard IPL to do that for us and then have it load the SPL so we can take over.

We probably can't just load u-boot proper from the IPL because we are limited to loading ~48KB.

This option will be used by boot0 to add the right magic string that the IPL expects for IPL Cust instead of the IPL string the boot rom wants so we can use the IPL until u-boot gets DDR init support.

---
 arch/arm/mach-mstar/Kconfig | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm/mach-mstar/Kconfig +12 -0
index ead9e126cc..a278c042e2 100644
@@ -1,10 +1,22 @@
 menu "MStar/SigmaStar v7 options"
 	depends on ARCH_MSTARV7
 
+config MSTAR_IPL
+	bool "u-boot is being loaded by the vendor IPL"
+	help
+	  Say y here if you are loading u-boot via the vendor
+	  IPL. Note that the image can only be 48KB or less
+	  for the IPL to load it so this only really applies
+	  to a SPL/TPL.
+
 endmenu
 
 if ARCH_MSTARV7
 
+config SPL_TEXT_BASE
+	default 0x23c00000 if MSTAR_IPL
+	default 0xa0000000
+
 config DEBUG_UART_BASE
 	default 0x1f221000
 
Signature · 1 line
2.27.0
#3 lore raw

RFC PATCH 3/3 arm: mstar: Add boot0 header

In reply to Daniel Palmer

The Mstar/SigmaStar v7 boot rom and IPL second stage loader use the same header for the stage coming after them except for a slightly different magic string in the header.

This patch adds the header and sets up the right string depending on if the SPL is going to be loaded by the boot rom or by an IPL.

---
 MAINTAINERS                               |  1 +
 arch/arm/Kconfig                          |  1 +
 arch/arm/include/asm/arch-mstarv7/boot0.h | 29 +++++++++++++++++++++++
 arch/arm/mach-mstar/Kconfig               |  3 +++
 4 files changed, 34 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-mstarv7/boot0.h
MAINTAINERS +1 -0
index be621a614f..5f87ea55fd 100644
@@ -297,6 +297,7 @@ ARM MSTAR/SIGMASTAR V7
 M:	Daniel Palmer <[email protected]>
 S:	Maintained
 F:	arch/arm/mach-mstar/
+F:	arch/arm/include/asm/arch-mstarv7/
 
 ARM NEXELL S5P4418
 M:	Stefan Bosch <[email protected]>
arch/arm/Kconfig +1 -0
index 7a25410ede..15cad7ff43 100644
@@ -1170,6 +1170,7 @@ config ARCH_MSTARV7
 	bool "MStar/SigmaStar ARM v7 SoCs"
 	select CPU_V7A
 	select SYS_NS16550
+	select ENABLE_ARM_SOC_BOOT0_HOOK
 	imply SUPPORT_SPL
 
 config ARCH_TEGRA
arch/arm/include/asm/arch-mstarv7/boot0.h new file +29 -0
new file mode 100644
index 0000000000..0db6c568fb
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Second stage (after bootrom) and Third stage (After IPL)
+ * header for MStar/SigmaStar Arm v7 SoCs.
+ *
+ * Copyright (c) 2020 Daniel Palmer <[email protected]>.
+ */
+
+/* The first 4 bytes should be an instruction */
+	b reset
+
+#ifdef CONFIG_MSTAR_IPL
+	/* this is needed for the IPL to jump into our image */
+	.ascii	"IPLC"
+#else
+	/* this is needed for the bootrom to jump into our image */
+	.ascii	"IPL_"
+#endif
+	/* this is the size of the image to load */
+	.2byte	0x0000
+
+	/* this seems to be the chip id */
+	.byte	0x0
+
+	/* this is something to do with authentication */
+	.byte	0x0
+
+	/* this is a checksum, doesn't always need to be right */
+	.long	0x0000
arch/arm/mach-mstar/Kconfig +3 -0
index a278c042e2..cc1a68b191 100644
@@ -26,4 +26,7 @@ config DEBUG_UART_CLOCK
 config DEBUG_UART_SHIFT
 	default 3
 
+config SYS_SOC
+	default "mstarv7"
+
 endif
Signature · 1 line
2.27.0
#4 lore raw

cover Start of MStar/SigmaStar Arm v7 SoC support

In reply to Daniel Palmer
Quoted 20 lines · Daniel Palmer

The initial very basic support for MStar/SigmaStar's Arm v7 SoCs should land in Linux 5.9 so I want to start the ball rolling on the u-boot side of things.

This series does almost nothing aside from define the header needed for the binaries to boot.

In my tree everything is working to the point that booting from SPI NOR, ethernet, SD etc work and for one chip it's even possible to have a completely u-boot boot flow.

I'm working on cleaning those patches up but I'm not sure how much I need for this very first series. So I've put the bare minimum here and will pull more parts in based on feedback.

Daniel Palmer (3):
arm: mstar: Initial MStar/SigmaStar Armv7 SoC support
arm: mstar: Add option for loading the SPL from the IPL
arm: mstar: Add boot0 header

Quoted 8 lines
 MAINTAINERS                               |  6 +++++
 arch/arm/Kconfig                          |  9 +++++++
 arch/arm/Makefile                         |  1 +
 arch/arm/include/asm/arch-mstarv7/boot0.h | 29 ++++++++++++++++++++
 arch/arm/mach-mstar/Kconfig               | 32 +++++++++++++++++++++++
 5 files changed, 77 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-mstarv7/boot0.h
 create mode 100644 arch/arm/mach-mstar/Kconfig

What I see in the code so far is fine. This is a bit too little of a first series as there's nothing building. I would suggest aiming for a "boots to hush prompt on serial" for the first series as the goal and adding follow up series to add in IO. Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200914/25946bc0/attachment.sig>
#5 lore raw

cover Start of MStar/SigmaStar Arm v7 SoC support

Hi Tom,

Quoted 4 lines · Tom Rini

What I see in the code so far is fine. This is a bit too little of a first series as there's nothing building. I would suggest aiming for a "boots to hush prompt on serial" for the first series as the goal and adding follow up series to add in IO. Thanks!

Thanks for taking a look. Originally I was intended to get to a prompt after loading from the SPL via ymodem for this first series but it was getting pretty big at about 20 patches and I didn't think that would be easy to review.

Anyhow I'll extend the series to actually build something. :)

Thanks,

Daniel