All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/3] Start of MStar/SigmaStar Arm v7 SoC support
@ 2020-09-14 12:04 Daniel Palmer
  2020-09-14 12:04 ` [RFC PATCH 1/3] arm: mstar: Initial MStar/SigmaStar Armv7 " Daniel Palmer
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Daniel Palmer @ 2020-09-14 12:04 UTC (permalink / raw)
  To: u-boot

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

-- 
2.27.0

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [RFC PATCH 1/3] arm: mstar: Initial MStar/SigmaStar Armv7 SoC support
  2020-09-14 12:04 [RFC PATCH 0/3] Start of MStar/SigmaStar Arm v7 SoC support Daniel Palmer
@ 2020-09-14 12:04 ` Daniel Palmer
  2020-09-14 12:04 ` [RFC PATCH 2/3] arm: mstar: Add option for loading the SPL from the IPL Daniel Palmer
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Daniel Palmer @ 2020-09-14 12:04 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Daniel Palmer <daniel@0x0f.com>
---
 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

diff --git a/MAINTAINERS b/MAINTAINERS
index 101f4e185d..be621a614f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -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 <daniel@thingy.jp>
+S:	Maintained
+F:	arch/arm/mach-mstar/
+
 ARM NEXELL S5P4418
 M:	Stefan Bosch <stefan_b@posteo.net>
 S:	Maintained
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 80702c23d3..7a25410ede 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -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"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 28b523b37c..deeb08b989 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -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))
 
diff --git a/arch/arm/mach-mstar/Kconfig b/arch/arm/mach-mstar/Kconfig
new file mode 100644
index 0000000000..ead9e126cc
--- /dev/null
+++ b/arch/arm/mach-mstar/Kconfig
@@ -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
-- 
2.27.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [RFC PATCH 2/3] arm: mstar: Add option for loading the SPL from the IPL
  2020-09-14 12:04 [RFC PATCH 0/3] Start of MStar/SigmaStar Arm v7 SoC support Daniel Palmer
  2020-09-14 12:04 ` [RFC PATCH 1/3] arm: mstar: Initial MStar/SigmaStar Armv7 " Daniel Palmer
@ 2020-09-14 12:04 ` Daniel Palmer
  2020-09-14 12:04 ` [RFC PATCH 3/3] arm: mstar: Add boot0 header Daniel Palmer
  2020-09-14 18:56 ` [RFC PATCH 0/3] Start of MStar/SigmaStar Arm v7 SoC support Tom Rini
  3 siblings, 0 replies; 6+ messages in thread
From: Daniel Palmer @ 2020-09-14 12:04 UTC (permalink / raw)
  To: u-boot

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.

Signed-off-by: Daniel Palmer <daniel@0x0f.com>
---
 arch/arm/mach-mstar/Kconfig | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/mach-mstar/Kconfig b/arch/arm/mach-mstar/Kconfig
index ead9e126cc..a278c042e2 100644
--- a/arch/arm/mach-mstar/Kconfig
+++ b/arch/arm/mach-mstar/Kconfig
@@ -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
 
-- 
2.27.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [RFC PATCH 3/3] arm: mstar: Add boot0 header
  2020-09-14 12:04 [RFC PATCH 0/3] Start of MStar/SigmaStar Arm v7 SoC support Daniel Palmer
  2020-09-14 12:04 ` [RFC PATCH 1/3] arm: mstar: Initial MStar/SigmaStar Armv7 " Daniel Palmer
  2020-09-14 12:04 ` [RFC PATCH 2/3] arm: mstar: Add option for loading the SPL from the IPL Daniel Palmer
@ 2020-09-14 12:04 ` Daniel Palmer
  2020-09-14 18:56 ` [RFC PATCH 0/3] Start of MStar/SigmaStar Arm v7 SoC support Tom Rini
  3 siblings, 0 replies; 6+ messages in thread
From: Daniel Palmer @ 2020-09-14 12:04 UTC (permalink / raw)
  To: u-boot

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.

Signed-off-by: Daniel Palmer <daniel@0x0f.com>
---
 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

diff --git a/MAINTAINERS b/MAINTAINERS
index be621a614f..5f87ea55fd 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -297,6 +297,7 @@ ARM MSTAR/SIGMASTAR V7
 M:	Daniel Palmer <daniel@thingy.jp>
 S:	Maintained
 F:	arch/arm/mach-mstar/
+F:	arch/arm/include/asm/arch-mstarv7/
 
 ARM NEXELL S5P4418
 M:	Stefan Bosch <stefan_b@posteo.net>
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 7a25410ede..15cad7ff43 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -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
diff --git a/arch/arm/include/asm/arch-mstarv7/boot0.h b/arch/arm/include/asm/arch-mstarv7/boot0.h
new file mode 100644
index 0000000000..0db6c568fb
--- /dev/null
+++ b/arch/arm/include/asm/arch-mstarv7/boot0.h
@@ -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 <daniel@thingy.jp>.
+ */
+
+/* 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
diff --git a/arch/arm/mach-mstar/Kconfig b/arch/arm/mach-mstar/Kconfig
index a278c042e2..cc1a68b191 100644
--- a/arch/arm/mach-mstar/Kconfig
+++ b/arch/arm/mach-mstar/Kconfig
@@ -26,4 +26,7 @@ config DEBUG_UART_CLOCK
 config DEBUG_UART_SHIFT
 	default 3
 
+config SYS_SOC
+	default "mstarv7"
+
 endif
-- 
2.27.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [RFC PATCH 0/3] Start of MStar/SigmaStar Arm v7 SoC support
  2020-09-14 12:04 [RFC PATCH 0/3] Start of MStar/SigmaStar Arm v7 SoC support Daniel Palmer
                   ` (2 preceding siblings ...)
  2020-09-14 12:04 ` [RFC PATCH 3/3] arm: mstar: Add boot0 header Daniel Palmer
@ 2020-09-14 18:56 ` Tom Rini
  2020-09-15 10:14   ` Daniel Palmer
  3 siblings, 1 reply; 6+ messages in thread
From: Tom Rini @ 2020-09-14 18:56 UTC (permalink / raw)
  To: u-boot

On Mon, Sep 14, 2020 at 09:04:38PM +0900, Daniel Palmer wrote:

> 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

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!

-- 
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>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [RFC PATCH 0/3] Start of MStar/SigmaStar Arm v7 SoC support
  2020-09-14 18:56 ` [RFC PATCH 0/3] Start of MStar/SigmaStar Arm v7 SoC support Tom Rini
@ 2020-09-15 10:14   ` Daniel Palmer
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Palmer @ 2020-09-15 10:14 UTC (permalink / raw)
  To: u-boot

Hi Tom,

On Tue, 15 Sep 2020 at 03:56, Tom Rini <trini@konsulko.com> wrote:

> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-09-15 10:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-14 12:04 [RFC PATCH 0/3] Start of MStar/SigmaStar Arm v7 SoC support Daniel Palmer
2020-09-14 12:04 ` [RFC PATCH 1/3] arm: mstar: Initial MStar/SigmaStar Armv7 " Daniel Palmer
2020-09-14 12:04 ` [RFC PATCH 2/3] arm: mstar: Add option for loading the SPL from the IPL Daniel Palmer
2020-09-14 12:04 ` [RFC PATCH 3/3] arm: mstar: Add boot0 header Daniel Palmer
2020-09-14 18:56 ` [RFC PATCH 0/3] Start of MStar/SigmaStar Arm v7 SoC support Tom Rini
2020-09-15 10:14   ` Daniel Palmer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.