mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/4] ARM: rpi: enable single entry point for all
@ 2022-04-25  6:28 Ahmad Fatoum
  2022-04-25  6:28 ` [PATCH 1/4] ARM: cpu: board-dt-2nd: call arm_cpu_lowlevel_init Ahmad Fatoum
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Ahmad Fatoum @ 2022-04-25  6:28 UTC (permalink / raw)
  To: barebox; +Cc: ore

VideoCore can boot kernel directly and will pass appropriate DT
according to kernel boot convention. If we do arm_cpu_lowlevel_init() in
the ARM board-dt-2nd, we can have this generic image act as second stage
on all Raspberry Pi variants.

Ahmad Fatoum (4):
  ARM: cpu: board-dt-2nd: call arm_cpu_lowlevel_init
  ARM: rpi: don't warn about lack of videocore fdt
  ARM: rpi: remove outdated comment after stack setup rework
  ARM: configs: rpi: add and document single barebox-dt-2nd bootloader

 Documentation/boards/bcm2835.rst          | 6 ++++++
 arch/arm/boards/raspberry-pi/lowlevel.c   | 1 -
 arch/arm/boards/raspberry-pi/rpi-common.c | 4 +---
 arch/arm/configs/rpi_defconfig            | 1 +
 arch/arm/cpu/board-dt-2nd.c               | 4 ++++
 5 files changed, 12 insertions(+), 4 deletions(-)

-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

* [PATCH 1/4] ARM: cpu: board-dt-2nd: call arm_cpu_lowlevel_init
  2022-04-25  6:28 [PATCH 0/4] ARM: rpi: enable single entry point for all Ahmad Fatoum
@ 2022-04-25  6:28 ` Ahmad Fatoum
  2022-04-25  6:28 ` [PATCH 2/4] ARM: rpi: don't warn about lack of videocore fdt Ahmad Fatoum
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Ahmad Fatoum @ 2022-04-25  6:28 UTC (permalink / raw)
  To: barebox; +Cc: ore, Ahmad Fatoum

The generic DT image could be started by boot firmware that doesn't do
all the initialization that we do in arm_cpu_lowlevel_init(), so call it
always for good measure. This enables using the generic image as second
stage to the Raspberry Pi videocore.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/cpu/board-dt-2nd.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/cpu/board-dt-2nd.c b/arch/arm/cpu/board-dt-2nd.c
index 0731aecd1a51..6f4a6f26a8c7 100644
--- a/arch/arm/cpu/board-dt-2nd.c
+++ b/arch/arm/cpu/board-dt-2nd.c
@@ -21,6 +21,8 @@ void dt_2nd_aarch64(void *fdt)
 
 	/* entry point already set up stack */
 
+	arm_cpu_lowlevel_init();
+
 	relocate_to_current_adr();
 	setup_c();
 
@@ -50,6 +52,8 @@ ENTRY_FUNCTION(start_dt_2nd, r0, r1, r2)
 {
 	unsigned long image_start = (unsigned long)_text + global_variable_offset();
 
+	arm_cpu_lowlevel_init();
+
 	arm_setup_stack(image_start);
 
 	relocate_to_current_adr();
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

* [PATCH 2/4] ARM: rpi: don't warn about lack of videocore fdt
  2022-04-25  6:28 [PATCH 0/4] ARM: rpi: enable single entry point for all Ahmad Fatoum
  2022-04-25  6:28 ` [PATCH 1/4] ARM: cpu: board-dt-2nd: call arm_cpu_lowlevel_init Ahmad Fatoum
@ 2022-04-25  6:28 ` Ahmad Fatoum
  2022-04-25  6:28 ` [PATCH 3/4] ARM: rpi: remove outdated comment after stack setup rework Ahmad Fatoum
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Ahmad Fatoum @ 2022-04-25  6:28 UTC (permalink / raw)
  To: barebox; +Cc: ore, Ahmad Fatoum

When barebox is booted as generic second stage DT image, it will throw
an annoying but harmless error that the videocore FDT saved in PBL has
invalid magic. This is expected because the generic code doesn't store
the device tree, instead it passes it to barebox proper to probe from.
Storing the DT in /vd.dtb would thus just be duplication.

Remove the error message in this case.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/boards/raspberry-pi/rpi-common.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index 9aa150de5680..82da4d646482 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -328,10 +328,8 @@ static void rpi_vc_fdt(void)
 		return;
 	}
 
-	if (magic != FDT_MAGIC) {
-		pr_err("videocore fdt saved in pbl has invalid magic\n");
+	if (magic != FDT_MAGIC)
 		return;
-	}
 
 	size = be32_to_cpu(oftree->totalsize);
 	if (write_file("/vc.dtb", saved_vc_fdt, size)) {
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

* [PATCH 3/4] ARM: rpi: remove outdated comment after stack setup rework
  2022-04-25  6:28 [PATCH 0/4] ARM: rpi: enable single entry point for all Ahmad Fatoum
  2022-04-25  6:28 ` [PATCH 1/4] ARM: cpu: board-dt-2nd: call arm_cpu_lowlevel_init Ahmad Fatoum
  2022-04-25  6:28 ` [PATCH 2/4] ARM: rpi: don't warn about lack of videocore fdt Ahmad Fatoum
@ 2022-04-25  6:28 ` Ahmad Fatoum
  2022-04-25  6:28 ` [PATCH 4/4] ARM: configs: rpi: add and document single barebox-dt-2nd bootloader Ahmad Fatoum
  2022-04-25 10:43 ` [PATCH 0/4] ARM: rpi: enable single entry point for all Sascha Hauer
  4 siblings, 0 replies; 6+ messages in thread
From: Ahmad Fatoum @ 2022-04-25  6:28 UTC (permalink / raw)
  To: barebox; +Cc: ore, Ahmad Fatoum

Stack is now set up with ENTRY_FUNCTION_WITH_STACK, so board code need
not concern itself with what is allowed in C code and what isn't before
stack is setup.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/boards/raspberry-pi/lowlevel.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/boards/raspberry-pi/lowlevel.c b/arch/arm/boards/raspberry-pi/lowlevel.c
index e9314fb27b25..7b9809b86cb7 100644
--- a/arch/arm/boards/raspberry-pi/lowlevel.c
+++ b/arch/arm/boards/raspberry-pi/lowlevel.c
@@ -40,7 +40,6 @@ static void copy_vc_fdt(void *dest, void *src, unsigned long max_size)
 #define rpi_stack_top(memsize) \
 	arm_mem_stack_top(BCM2835_SDRAM_BASE, BCM2835_SDRAM_BASE + memsize - VIDEOCORE_FDT_SZ)
 
-/* Must be inline since stack isn't setup yet. */
 static inline void start_raspberry_pi(unsigned long memsize, void *fdt,
 								void *vc_fdt)
 {
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

* [PATCH 4/4] ARM: configs: rpi: add and document single barebox-dt-2nd bootloader
  2022-04-25  6:28 [PATCH 0/4] ARM: rpi: enable single entry point for all Ahmad Fatoum
                   ` (2 preceding siblings ...)
  2022-04-25  6:28 ` [PATCH 3/4] ARM: rpi: remove outdated comment after stack setup rework Ahmad Fatoum
@ 2022-04-25  6:28 ` Ahmad Fatoum
  2022-04-25 10:43 ` [PATCH 0/4] ARM: rpi: enable single entry point for all Sascha Hauer
  4 siblings, 0 replies; 6+ messages in thread
From: Ahmad Fatoum @ 2022-04-25  6:28 UTC (permalink / raw)
  To: barebox; +Cc: ore, Ahmad Fatoum

With recent rework, we can install barebox along with all supported
Raspberry Pi device trees to the boot partition and let the VideoCore
take core of passing the correct device tree to barebox. Enable the
relevant option in config and document this briefly.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 Documentation/boards/bcm2835.rst | 6 ++++++
 arch/arm/configs/rpi_defconfig   | 1 +
 2 files changed, 7 insertions(+)

diff --git a/Documentation/boards/bcm2835.rst b/Documentation/boards/bcm2835.rst
index 8af6a09c13db..0b5299a34078 100644
--- a/Documentation/boards/bcm2835.rst
+++ b/Documentation/boards/bcm2835.rst
@@ -14,10 +14,16 @@ Raspberry Pi
      - ``images/barebox-raspberry-pi-1.img`` for the BCM2835/ARM1176JZF-S (Raspberry Pi 1, Raspberry Pi Zero)
      - ``images/barebox-raspberry-pi-2.img`` for the BCM2836/CORTEX-A7 (Raspberry Pi 2)
      - ``images/barebox-raspberry-pi-3.img`` for the BCM2837/CORTEX-A53 (Raspberry Pi 3)
+     - ``images/barebox-raspberry-pi-cm3.img`` for the BCM2837/CORTEX-A53 (Raspberry Pi CM3)
 
      Copy the respective image for your model to your SD card and name it
      ``barebox.img``.
 
+     Alternatively, ``images/barebox-dt-2nd.img`` can be used as single bootloader for all
+     supported 32-bit boards. In this case the device tree supplied by the video core
+     is directly used by barebox to probe. The device trees in ``arch/arm/dts/*.dtb``
+     will need to be renamed for alignment with the naming scheme expected by the videocore.
+
   4. Create a text file ``config.txt`` on the SD card with the following content::
 
          kernel=barebox.img
diff --git a/arch/arm/configs/rpi_defconfig b/arch/arm/configs/rpi_defconfig
index b823a9a3d09b..e0e1497481dc 100644
--- a/arch/arm/configs/rpi_defconfig
+++ b/arch/arm/configs/rpi_defconfig
@@ -3,6 +3,7 @@ CONFIG_MACH_RPI=y
 CONFIG_MACH_RPI2=y
 CONFIG_MACH_RPI3=y
 CONFIG_MACH_RPI_CM3=y
+CONFIG_BOARD_ARM_GENERIC_DT=y
 CONFIG_AEABI=y
 CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
 CONFIG_ARM_UNWIND=y
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

* Re: [PATCH 0/4] ARM: rpi: enable single entry point for all
  2022-04-25  6:28 [PATCH 0/4] ARM: rpi: enable single entry point for all Ahmad Fatoum
                   ` (3 preceding siblings ...)
  2022-04-25  6:28 ` [PATCH 4/4] ARM: configs: rpi: add and document single barebox-dt-2nd bootloader Ahmad Fatoum
@ 2022-04-25 10:43 ` Sascha Hauer
  4 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2022-04-25 10:43 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox, ore

On Mon, Apr 25, 2022 at 08:28:45AM +0200, Ahmad Fatoum wrote:
> VideoCore can boot kernel directly and will pass appropriate DT
> according to kernel boot convention. If we do arm_cpu_lowlevel_init() in
> the ARM board-dt-2nd, we can have this generic image act as second stage
> on all Raspberry Pi variants.

I just chatted with Ahmad and we both agreed that we'll go into the
direction that we'll remove the individual images after a few releases
and fully go to using the board-dt-2nd image for rpi. We'll leave the
individual images here for now until we are sure the generic image
works.

Applied, thanks

Sascha

> 
> Ahmad Fatoum (4):
>   ARM: cpu: board-dt-2nd: call arm_cpu_lowlevel_init
>   ARM: rpi: don't warn about lack of videocore fdt
>   ARM: rpi: remove outdated comment after stack setup rework
>   ARM: configs: rpi: add and document single barebox-dt-2nd bootloader
> 
>  Documentation/boards/bcm2835.rst          | 6 ++++++
>  arch/arm/boards/raspberry-pi/lowlevel.c   | 1 -
>  arch/arm/boards/raspberry-pi/rpi-common.c | 4 +---
>  arch/arm/configs/rpi_defconfig            | 1 +
>  arch/arm/cpu/board-dt-2nd.c               | 4 ++++
>  5 files changed, 12 insertions(+), 4 deletions(-)
> 
> -- 
> 2.30.2
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

end of thread, other threads:[~2022-04-25 10:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-25  6:28 [PATCH 0/4] ARM: rpi: enable single entry point for all Ahmad Fatoum
2022-04-25  6:28 ` [PATCH 1/4] ARM: cpu: board-dt-2nd: call arm_cpu_lowlevel_init Ahmad Fatoum
2022-04-25  6:28 ` [PATCH 2/4] ARM: rpi: don't warn about lack of videocore fdt Ahmad Fatoum
2022-04-25  6:28 ` [PATCH 3/4] ARM: rpi: remove outdated comment after stack setup rework Ahmad Fatoum
2022-04-25  6:28 ` [PATCH 4/4] ARM: configs: rpi: add and document single barebox-dt-2nd bootloader Ahmad Fatoum
2022-04-25 10:43 ` [PATCH 0/4] ARM: rpi: enable single entry point for all Sascha Hauer

mail archive of the barebox mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://lore.barebox.org/barebox/0 barebox/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 barebox barebox/ https://lore.barebox.org/barebox \
		barebox@lists.infradead.org barebox@lists.infradead.org
	public-inbox-index barebox

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git