mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support
@ 2022-06-09  5:59 Ahmad Fatoum
  2022-06-09  5:59 ` [PATCH v2 01/21] ARM64: asm: implement read_cpuid_id() Ahmad Fatoum
                   ` (21 more replies)
  0 siblings, 22 replies; 27+ messages in thread
From: Ahmad Fatoum @ 2022-06-09  5:59 UTC (permalink / raw)
  To: barebox

Just basic support, so we get a shell on mini-uart and SD
working and can boot a Linux kernel with all cores usable.
Needs more work for USB and Ethernet, but I'll leave that
to others now that the initial hurdle is overcome.

I tested this series on Raspberry Pi 3b (both 32-bit and newly
added 64-bit support) and Raspberry Pi 4b (both 32/64-bit).

v1 -> v2:
  - add new common barebox-raspberry-pi.img that includes all
    enabled DTs. The old approach with barebox-dt-2nd.img proved
    inadequate, because VideoCore applied overlays to barebox DT,
    when they were needed for the kernel and it made support
    for Raspberry Pi kernel (with different bindings) harder.
  - Use mailbox in PBL to determine which DT to use
  - Use compressed DTBs
  - fix breakage for existing 64-bit platforms due to
    how CPU/SYS_SUPPORTS_64BIT_KERNEL was mishandled
  - fix /env/boot/rpi for 64-bit
  - replace ns16550 driver hack with DT hack

Boot log:

  >Deep probe supported due to raspberrypi,4-model-b
  Switch to console [cs0]
  
  
  barebox 2022.05.0-00152-g628da31493e4 #14 Wed Jun 8 22:35:07 CEST 2022
  
  
  Board: Raspberry Pi 4 Model B
  Deep probe supported due to raspberrypi,4-model-b
  reserved-memory: region /memreserve 0x00000000-0x00000fff
  WARNING: dwc2 fe980000.usb@7e980000.of: dwc2_core_reset: Timeout!
  Waiting for Core Soft Reset
  ERROR: dwc2 fe980000.usb@7e980000.of: probe failed: Connection timed out
  WARNING: bcm2835_mci fe340000.mmc@7e340000.of: Failed to get 'vmmc'
  regulator (ignored).
  bcm2835_mci fe340000.mmc@7e340000.of: registered as mci0
  malloc space: 0x1d87f1e0 -> 0x3b0fe3bf (size 472.5 MiB)
  mci0: detected SD card version 2.0
  mci0: registered disk0
  environment load /boot/barebox.env: No such file or directory
  Maybe you have to create the partition.

Ahmad Fatoum (20):
  ARM64: asm: implement read_cpuid_id()
  dma: add dma_sync nop stubs for PBL
  ARM: rpi: move bcm2835_add_device_sdram() into header
  ARM: rpi: support PBL use of mbox
  ARM: rpi: split out mbox helpers to share code with PBL
  ARM: rpi: switch to ARM_USE_COMPRESSED_DTB
  ARM: rpi: add generic Raspberry Pi image
  ARM: rpi: support FDT in x0 for 64bit configurations
  serial: ns16550: rpi: remove ungating now done by proper clk driver
  ARM: cpu: prevent recursive dependencies via CPU_SUPPORTS_64BIT_KERNEL
  ARM: cpu: remove unnecessary CONFIG_SYS_SUPPORTS_64BIT_KERNEL
  ARM: cpu: remove unused SYS_SUPPORTS_32BIT_KERNEL
  ARM: rpi: add Raspberry Pi 3 64-bit build support
  ARM: rpi: rpi3: disallow MMU_EARLY && 64BIT
  clk: rpi: add Raspberry Pi 4 support
  clocksource: bcm2835: bump below architeced timer for AArch64
  ARM: rpi: add Raspberry Pi 4 support
  ARM: rpi: add debug_ll support for Raspberry Pi 4
  doc: bcm283x: reference newer firmware
  ARM: rpi: use correct kernel8.img as name for 64-bit

Uwe Kleine-König (1):
  mci: bcm2835: add bcm2711-emmc2 (Rpi4) support

 Documentation/boards/bcm2835.rst              |  17 ++-
 arch/arm/Kconfig                              |  10 +-
 arch/arm/boards/raspberry-pi/Makefile         |   1 +
 arch/arm/boards/raspberry-pi/lowlevel.c       | 129 +++++++++++++++---
 arch/arm/boards/raspberry-pi/lowlevel.h       |   5 +
 arch/arm/boards/raspberry-pi/mbox-helpers.c   |  73 ++++++++++
 arch/arm/boards/raspberry-pi/rpi-common.c     | 129 ++++++------------
 arch/arm/configs/rpi_v8a_defconfig            | 111 +++++++++++++++
 arch/arm/cpu/Kconfig                          |   7 -
 arch/arm/dts/Makefile                         |   1 +
 arch/arm/dts/bcm2711-rpi-4.dts                |  18 +++
 arch/arm/include/asm/cputype.h                |  22 ++-
 arch/arm/include/asm/system_info.h            |   6 +
 arch/arm/mach-bcm283x/Kconfig                 |  29 +++-
 arch/arm/mach-bcm283x/Makefile                |   2 +-
 arch/arm/mach-bcm283x/core.c                  |  57 ++++----
 arch/arm/mach-bcm283x/include/mach/core.h     |  23 ++--
 arch/arm/mach-bcm283x/include/mach/debug_ll.h |  26 ++++
 arch/arm/mach-bcm283x/include/mach/mbox.h     |   4 +
 arch/arm/mach-bcm283x/include/mach/platform.h |   5 +-
 arch/arm/mach-bcm283x/mbox.c                  |  26 ++--
 arch/arm/mach-imx/Kconfig                     |   2 +-
 arch/arm/mach-layerscape/Kconfig              |   2 +-
 arch/arm/mach-rockchip/Kconfig                |   2 +-
 common/Kconfig                                |   7 +
 drivers/clk/clk-rpi.c                         |  42 ++++--
 drivers/clocksource/bcm2835.c                 |   3 +-
 drivers/mci/mci-bcm2835.c                     |   4 +-
 drivers/serial/serial_ns16550.c               |   4 -
 images/Makefile.bcm283x                       |  10 ++
 include/dma.h                                 |  19 +++
 31 files changed, 593 insertions(+), 203 deletions(-)
 create mode 100644 arch/arm/boards/raspberry-pi/mbox-helpers.c
 create mode 100644 arch/arm/configs/rpi_v8a_defconfig
 create mode 100644 arch/arm/dts/bcm2711-rpi-4.dts

-- 
2.30.2


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

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

* [PATCH v2 01/21] ARM64: asm: implement read_cpuid_id()
  2022-06-09  5:59 [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support Ahmad Fatoum
@ 2022-06-09  5:59 ` Ahmad Fatoum
  2022-06-09  5:59 ` [PATCH v2 02/21] dma: add dma_sync nop stubs for PBL Ahmad Fatoum
                   ` (20 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Ahmad Fatoum @ 2022-06-09  5:59 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

We'll need to use this function in code that will be compiled for both
32-bit and 64-bit ARM, so add the 64-bit implementation.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/include/asm/cputype.h | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/cputype.h b/arch/arm/include/asm/cputype.h
index 7dc027c1741b..c3fc05765060 100644
--- a/arch/arm/include/asm/cputype.h
+++ b/arch/arm/include/asm/cputype.h
@@ -6,6 +6,23 @@
 #include <linux/stringify.h>
 #include <linux/kernel.h>
 
+#ifdef CONFIG_CPU_64v8
+
+#define CPUID_ID	midr_el1
+#define CPUID_CACHETYPE	ctr_el0
+#define CPUID_MPIDR	mpidr_el1
+
+#define read_cpuid(reg)							\
+	({								\
+		unsigned int __val;					\
+		asm("mrs	%0, " __stringify(reg)			\
+		    : "=r" (__val)					\
+		    :							\
+		    : "cc");						\
+		__val;							\
+	})
+#else
+
 #define CPUID_ID	0
 #define CPUID_CACHETYPE	1
 #define CPUID_TCM	2
@@ -27,8 +44,6 @@
 #define CPUID_EXT_ISAR4	"c2, 4"
 #define CPUID_EXT_ISAR5	"c2, 5"
 
-extern unsigned int processor_id;
-
 #define read_cpuid(reg)							\
 	({								\
 		unsigned int __val;					\
@@ -47,6 +62,9 @@ extern unsigned int processor_id;
 		    : "cc");						\
 		__val;							\
 	})
+#endif
+
+extern unsigned int processor_id;
 
 /*
  * The CPU ID never changes at run time, so we might as well tell the
-- 
2.30.2


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


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

* [PATCH v2 02/21] dma: add dma_sync nop stubs for PBL
  2022-06-09  5:59 [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support Ahmad Fatoum
  2022-06-09  5:59 ` [PATCH v2 01/21] ARM64: asm: implement read_cpuid_id() Ahmad Fatoum
@ 2022-06-09  5:59 ` Ahmad Fatoum
  2022-06-14  8:49   ` Sascha Hauer
  2022-06-09  5:59 ` [PATCH v2 03/21] ARM: rpi: move bcm2835_add_device_sdram() into header Ahmad Fatoum
                   ` (19 subsequent siblings)
  21 siblings, 1 reply; 27+ messages in thread
From: Ahmad Fatoum @ 2022-06-09  5:59 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

We can implement dma_sync functions as compiler barriers when we are
certain that the buffers are in coherent/uncached memory, e.g. because
MMU is only enabled in barebox_arm_entry which hasn't run yet.

This will come in handy when doing mailbox communication in PBL on the
Raspberry Pi.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 include/dma.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/include/dma.h b/include/dma.h
index 90f9254ea80f..aeaba7d9316d 100644
--- a/include/dma.h
+++ b/include/dma.h
@@ -8,6 +8,7 @@
 
 #include <malloc.h>
 #include <xfuncs.h>
+#include <pbl.h>
 #include <linux/kernel.h>
 
 #include <dma-dir.h>
@@ -56,12 +57,30 @@ static inline int dma_mapping_error(struct device_d *dev, dma_addr_t dma_addr)
 		(dev->dma_mask && dma_addr > dev->dma_mask);
 }
 
+#ifndef __PBL__
 /* streaming DMA - implement the below calls to support HAS_DMA */
 void dma_sync_single_for_cpu(dma_addr_t address, size_t size,
 			     enum dma_data_direction dir);
 
 void dma_sync_single_for_device(dma_addr_t address, size_t size,
 				enum dma_data_direction dir);
+#else
+/*
+ * assumes buffers are in coherent/uncached memory, e.g. because
+ * MMU is only enabled in barebox_arm_entry which hasn't run yet.
+ */
+static inline void dma_sync_single_for_cpu(dma_addr_t address, size_t size,
+			     enum dma_data_direction dir)
+{
+	barrier_data((void *)address);
+}
+
+static inline void dma_sync_single_for_device(dma_addr_t address, size_t size,
+				enum dma_data_direction dir)
+{
+	barrier_data((void *)address);
+}
+#endif
 
 void *dma_alloc_coherent(size_t size, dma_addr_t *dma_handle);
 void dma_free_coherent(void *mem, dma_addr_t dma_handle, size_t size);
-- 
2.30.2


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


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

* [PATCH v2 03/21] ARM: rpi: move bcm2835_add_device_sdram() into header
  2022-06-09  5:59 [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support Ahmad Fatoum
  2022-06-09  5:59 ` [PATCH v2 01/21] ARM64: asm: implement read_cpuid_id() Ahmad Fatoum
  2022-06-09  5:59 ` [PATCH v2 02/21] dma: add dma_sync nop stubs for PBL Ahmad Fatoum
@ 2022-06-09  5:59 ` Ahmad Fatoum
  2022-06-09  5:59 ` [PATCH v2 04/21] ARM: rpi: support PBL use of mbox Ahmad Fatoum
                   ` (18 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Ahmad Fatoum @ 2022-06-09  5:59 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

We will repurpose core.c in a later commit. It has a single function
similar in spirit to bcm2835_register_fb which lives in a header, so
move it there too.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/boards/raspberry-pi/rpi-common.c |  4 ++-
 arch/arm/mach-bcm283x/Makefile            |  2 +-
 arch/arm/mach-bcm283x/core.c              | 40 -----------------------
 arch/arm/mach-bcm283x/include/mach/core.h | 21 +++++-------
 4 files changed, 13 insertions(+), 54 deletions(-)
 delete mode 100644 arch/arm/mach-bcm283x/core.c

diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index 05d59ae6bf97..aeb7eef145cd 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -221,8 +221,10 @@ static int rpi_mem_init(void)
 	int ret;
 
 	ret = rpi_get_arm_mem(&size);
-	if (ret)
+	if (ret) {
 		printf("could not query ARM memory size\n");
+		size = get_ram_size((ulong *) BCM2835_SDRAM_BASE, SZ_128M);
+	}
 
 	bcm2835_add_device_sdram(size);
 
diff --git a/arch/arm/mach-bcm283x/Makefile b/arch/arm/mach-bcm283x/Makefile
index e5ef78af978f..d68176441322 100644
--- a/arch/arm/mach-bcm283x/Makefile
+++ b/arch/arm/mach-bcm283x/Makefile
@@ -1,3 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
-obj-y += core.o mbox.o
+obj-y += mbox.o
diff --git a/arch/arm/mach-bcm283x/core.c b/arch/arm/mach-bcm283x/core.c
deleted file mode 100644
index f2528cf1f150..000000000000
--- a/arch/arm/mach-bcm283x/core.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Author: Carlo Caione <carlo@carlocaione.org>
- *
- * Based on mach-nomadik
- * Copyright (C) 2009 Jean-Christophe PLAGNIOL-VILLARD <plagnio@jcrosoft.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <common.h>
-#include <init.h>
-
-#include <linux/clk.h>
-#include <linux/clkdev.h>
-#include <linux/err.h>
-
-#include <io.h>
-#include <asm/armlinux.h>
-#include <linux/sizes.h>
-
-#include <mach/platform.h>
-#include <mach/core.h>
-#include <linux/amba/bus.h>
-
-void bcm2835_add_device_sdram(u32 size)
-{
-	if (!size)
-		size = get_ram_size((ulong *) BCM2835_SDRAM_BASE, SZ_128M);
-
-	arm_add_mem_device("ram0", BCM2835_SDRAM_BASE, size);
-}
diff --git a/arch/arm/mach-bcm283x/include/mach/core.h b/arch/arm/mach-bcm283x/include/mach/core.h
index a1c47f915448..bd272b925df5 100644
--- a/arch/arm/mach-bcm283x/include/mach/core.h
+++ b/arch/arm/mach-bcm283x/include/mach/core.h
@@ -1,24 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2009 Carlo Caione <carlo@carlocaione.org>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
  */
 
 #ifndef __BCM2835_CORE_H__
 #define __BCM2835_CORE_H__
 
+#include <common.h>
+#include <linux/types.h>
+#include <linux/sizes.h>
+#include <asm/memory.h>
 #include <mach/platform.h>
 
-void bcm2835_add_device_sdram(u32 size);
+static void inline bcm2835_add_device_sdram(u32 size)
+{
+	arm_add_mem_device("ram0", BCM2835_SDRAM_BASE, size);
+}
 
 static void inline bcm2835_register_fb(void)
 {
-- 
2.30.2


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


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

* [PATCH v2 04/21] ARM: rpi: support PBL use of mbox
  2022-06-09  5:59 [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support Ahmad Fatoum
                   ` (2 preceding siblings ...)
  2022-06-09  5:59 ` [PATCH v2 03/21] ARM: rpi: move bcm2835_add_device_sdram() into header Ahmad Fatoum
@ 2022-06-09  5:59 ` Ahmad Fatoum
  2022-06-09  5:59 ` [PATCH v2 05/21] ARM: rpi: split out mbox helpers to share code with PBL Ahmad Fatoum
                   ` (17 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Ahmad Fatoum @ 2022-06-09  5:59 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

barebox uses DT to find out the base address of the mailbox. For the
generic image, we need to use the mailbox interface to find out which DT
to use. Resolve the chicken-egg problem by hardcoding a list of mailbox
base addresses and selecting the correct one by looking up the CPU ID
and using that to deduce the Raspberry Pi SoC type.

Note that this is incompatible with arm_peri_high=1.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/include/asm/system_info.h        |  6 +++++
 arch/arm/mach-bcm283x/Makefile            |  2 +-
 arch/arm/mach-bcm283x/core.c              | 29 +++++++++++++++++++++++
 arch/arm/mach-bcm283x/include/mach/core.h |  2 ++
 arch/arm/mach-bcm283x/mbox.c              | 24 ++++++++++++-------
 5 files changed, 54 insertions(+), 9 deletions(-)
 create mode 100644 arch/arm/mach-bcm283x/core.c

diff --git a/arch/arm/include/asm/system_info.h b/arch/arm/include/asm/system_info.h
index c7f998774812..5a84fde75b9f 100644
--- a/arch/arm/include/asm/system_info.h
+++ b/arch/arm/include/asm/system_info.h
@@ -44,6 +44,12 @@
 #define CPU_IS_CORTEX_A15	0x410fc0f0
 #define CPU_IS_CORTEX_A15_MASK	0xff0ffff0
 
+#define CPU_IS_CORTEX_A53	0x410fd030
+#define CPU_IS_CORTEX_A53_MASK	0xff0ffff0
+
+#define CPU_IS_CORTEX_A72	0x410fd080
+#define CPU_IS_CORTEX_A72_MASK	0xff0ffff0
+
 #define CPU_IS_PXA250		0x69052100
 #define CPU_IS_PXA250_MASK	0xfffff7f0
 
diff --git a/arch/arm/mach-bcm283x/Makefile b/arch/arm/mach-bcm283x/Makefile
index d68176441322..53343cec8cd6 100644
--- a/arch/arm/mach-bcm283x/Makefile
+++ b/arch/arm/mach-bcm283x/Makefile
@@ -1,3 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
-obj-y += mbox.o
+obj-pbl-y += mbox.o core.o
diff --git a/arch/arm/mach-bcm283x/core.c b/arch/arm/mach-bcm283x/core.c
new file mode 100644
index 000000000000..40882fb6d685
--- /dev/null
+++ b/arch/arm/mach-bcm283x/core.c
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#include <linux/types.h>
+#include <mach/core.h>
+#include <asm/system_info.h>
+
+void __iomem *bcm2835_get_mmio_base_by_cpuid(void)
+{
+	static u32 cpuid;
+
+	if (!cpuid) {
+		cpuid = read_cpuid_id();
+		pr_debug("ARM CPUID: %08x\n", cpuid);
+	}
+
+	/* We know ARM1167, Cortex A-7, A-53 and A-72 CPUID mask is identical */
+	switch(cpuid & CPU_IS_ARM1176_MASK) {
+	case CPU_IS_ARM1176:	/* bcm2835 */
+		return IOMEM(0x20000000);
+	case CPU_IS_CORTEX_A7:	/* bcm2836 */
+	case CPU_IS_CORTEX_A53:	/* bcm2837 */
+		return IOMEM(0x3f000000);
+	case CPU_IS_CORTEX_A72:	/* bcm2711 */
+		return IOMEM(0xfe000000);
+	}
+
+	pr_err("Couldn't determine rpi by CPUID %08x\n", cpuid);
+	return NULL;
+}
diff --git a/arch/arm/mach-bcm283x/include/mach/core.h b/arch/arm/mach-bcm283x/include/mach/core.h
index bd272b925df5..c8547351a39d 100644
--- a/arch/arm/mach-bcm283x/include/mach/core.h
+++ b/arch/arm/mach-bcm283x/include/mach/core.h
@@ -22,4 +22,6 @@ static void inline bcm2835_register_fb(void)
 	add_generic_device("bcm2835_fb", 0, NULL, 0, 0, 0, NULL);
 }
 
+void __iomem *bcm2835_get_mmio_base_by_cpuid(void);
+
 #endif
diff --git a/arch/arm/mach-bcm283x/mbox.c b/arch/arm/mach-bcm283x/mbox.c
index 4b14afcfe45b..b77065ab305f 100644
--- a/arch/arm/mach-bcm283x/mbox.c
+++ b/arch/arm/mach-bcm283x/mbox.c
@@ -14,13 +14,20 @@
 #include <init.h>
 #include <io.h>
 #include <of_address.h>
+#include <pbl.h>
 
 #include <mach/mbox.h>
+#include <mach/core.h>
 
 #define TIMEOUT (MSECOND * 1000)
 
 static void __iomem *mbox_base;
 
+#ifdef __PBL__
+#define is_timeout_non_interruptible(start, timeout) ((void)start, 0)
+#define get_time_ns() 0
+#endif
+
 static int bcm2835_mbox_call_raw(u32 chan, struct bcm2835_mbox_hdr *buffer,
 					u32 *recv)
 {
@@ -109,19 +116,20 @@ static void dump_buf(struct bcm2835_mbox_hdr *buffer)
 }
 #endif
 
-static int bcm2835_mbox_probe(void)
+static void __iomem *bcm2835_mbox_probe(void)
 {
 	struct device_node *mbox_node;
 
+	if (IN_PBL)
+		return bcm2835_get_mmio_base_by_cpuid() + 0xb880;
+
 	mbox_node = of_find_compatible_node(NULL, NULL, "brcm,bcm2835-mbox");
 	if (!mbox_node) {
 		pr_err("Missing mbox node\n");
-		return -ENOENT;
+		return NULL;
 	}
 
-	mbox_base = of_iomap(mbox_node, 0);
-
-	return 0;
+	return of_iomap(mbox_node, 0);
 }
 
 int bcm2835_mbox_call_prop(u32 chan, struct bcm2835_mbox_hdr *buffer)
@@ -132,9 +140,9 @@ int bcm2835_mbox_call_prop(u32 chan, struct bcm2835_mbox_hdr *buffer)
 	int tag_index;
 
 	if (!mbox_base) {
-		ret = bcm2835_mbox_probe();
-		if (ret)
-			return ret;
+		mbox_base = bcm2835_mbox_probe();
+		if (!mbox_base)
+			return -ENOENT;
 	}
 
 	pr_debug("mbox: TX buffer\n");
-- 
2.30.2


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


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

* [PATCH v2 05/21] ARM: rpi: split out mbox helpers to share code with PBL
  2022-06-09  5:59 [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support Ahmad Fatoum
                   ` (3 preceding siblings ...)
  2022-06-09  5:59 ` [PATCH v2 04/21] ARM: rpi: support PBL use of mbox Ahmad Fatoum
@ 2022-06-09  5:59 ` Ahmad Fatoum
  2022-06-09  5:59 ` [PATCH v2 06/21] ARM: rpi: switch to ARM_USE_COMPRESSED_DTB Ahmad Fatoum
                   ` (16 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Ahmad Fatoum @ 2022-06-09  5:59 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

We'll call some of these helpers from PBL in a later commit, so move
these into a common location.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/boards/raspberry-pi/Makefile       |   1 +
 arch/arm/boards/raspberry-pi/lowlevel.h     |   5 +
 arch/arm/boards/raspberry-pi/mbox-helpers.c |  73 +++++++++++++
 arch/arm/boards/raspberry-pi/rpi-common.c   | 108 +++++---------------
 4 files changed, 103 insertions(+), 84 deletions(-)
 create mode 100644 arch/arm/boards/raspberry-pi/mbox-helpers.c

diff --git a/arch/arm/boards/raspberry-pi/Makefile b/arch/arm/boards/raspberry-pi/Makefile
index 6f995b564017..e4f91b497965 100644
--- a/arch/arm/boards/raspberry-pi/Makefile
+++ b/arch/arm/boards/raspberry-pi/Makefile
@@ -2,4 +2,5 @@
 
 obj-$(CONFIG_MACH_RPI_COMMON) += rpi-common.o
 lwl-y += lowlevel.o
+obj-pbl-y += mbox-helpers.o
 bbenv-y += defaultenv-rpi
diff --git a/arch/arm/boards/raspberry-pi/lowlevel.h b/arch/arm/boards/raspberry-pi/lowlevel.h
index eacf973fb6fa..a29860d607f3 100644
--- a/arch/arm/boards/raspberry-pi/lowlevel.h
+++ b/arch/arm/boards/raspberry-pi/lowlevel.h
@@ -3,9 +3,14 @@
 #ifndef __ARCH_ARM_BOARDS_LOWLEVEL_H__
 #define __ARCH_ARM_BOARDS_LOWLEVEL_H__
 
+#include <linux/types.h>
 #include <linux/sizes.h>
 
 #define VIDEOCORE_FDT_SZ SZ_1M
 #define VIDEOCORE_FDT_ERROR 0xdeadfeed
 
+ssize_t rpi_get_arm_mem(void);
+int rpi_get_usbethaddr(u8 mac[6]);
+int rpi_get_board_rev(void);
+
 #endif /* __ARCH_ARM_BOARDS_LOWLEVEL_H__ */
diff --git a/arch/arm/boards/raspberry-pi/mbox-helpers.c b/arch/arm/boards/raspberry-pi/mbox-helpers.c
new file mode 100644
index 000000000000..9f252c68ff94
--- /dev/null
+++ b/arch/arm/boards/raspberry-pi/mbox-helpers.c
@@ -0,0 +1,73 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+// SPDX-FileCopyrightText: 2009 Carlo Caione <carlo@carlocaione.org>
+
+#include <mach/mbox.h>
+#include "lowlevel.h"
+
+struct msg_get_arm_mem {
+	struct bcm2835_mbox_hdr hdr;
+	struct bcm2835_mbox_tag_get_arm_mem get_arm_mem;
+	u32 end_tag;
+};
+
+struct msg_get_board_rev {
+	struct bcm2835_mbox_hdr hdr;
+	struct bcm2835_mbox_tag_get_board_rev get_board_rev;
+	u32 end_tag;
+};
+
+struct msg_get_mac_address {
+	struct bcm2835_mbox_hdr hdr;
+	struct bcm2835_mbox_tag_get_mac_address get_mac_address;
+	u32 end_tag;
+};
+
+ssize_t rpi_get_arm_mem(void)
+{
+	BCM2835_MBOX_STACK_ALIGN(struct msg_get_arm_mem, msg);
+	int ret;
+
+	BCM2835_MBOX_INIT_HDR(msg);
+	BCM2835_MBOX_INIT_TAG(&msg->get_arm_mem, GET_ARM_MEMORY);
+
+	ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg->hdr);
+	if (ret)
+		return ret;
+
+	return msg->get_arm_mem.body.resp.mem_size;
+}
+
+int rpi_get_usbethaddr(u8 mac[6])
+{
+	BCM2835_MBOX_STACK_ALIGN(struct msg_get_mac_address, msg);
+	int ret;
+
+	BCM2835_MBOX_INIT_HDR(msg);
+	BCM2835_MBOX_INIT_TAG(&msg->get_mac_address, GET_MAC_ADDRESS);
+
+	ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg->hdr);
+	if (ret) {
+		pr_info("bcm2835: Could not query MAC address\n");
+		return ret;
+	}
+
+	memcpy(mac, msg->get_mac_address.body.resp.mac, 6);
+	return 0;
+}
+
+int rpi_get_board_rev(void)
+{
+	int ret;
+
+	BCM2835_MBOX_STACK_ALIGN(struct msg_get_board_rev, msg);
+	BCM2835_MBOX_INIT_HDR(msg);
+	BCM2835_MBOX_INIT_TAG(&msg->get_board_rev, GET_BOARD_REV);
+
+	ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg->hdr);
+	if (ret) {
+		pr_err("Could not query board revision\n");
+		return ret;
+	}
+
+	return msg->get_board_rev.body.resp.rev;
+}
diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index aeb7eef145cd..49728981ea71 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -45,57 +45,14 @@ struct rpi_priv {
 	const char *name;
 };
 
-struct msg_get_arm_mem {
-	struct bcm2835_mbox_hdr hdr;
-	struct bcm2835_mbox_tag_get_arm_mem get_arm_mem;
-	u32 end_tag;
-};
-
-struct msg_get_board_rev {
-	struct bcm2835_mbox_hdr hdr;
-	struct bcm2835_mbox_tag_get_board_rev get_board_rev;
-	u32 end_tag;
-};
-
-struct msg_get_mac_address {
-	struct bcm2835_mbox_hdr hdr;
-	struct bcm2835_mbox_tag_get_mac_address get_mac_address;
-	u32 end_tag;
-};
-
-static int rpi_get_arm_mem(u32 *size)
-{
-	BCM2835_MBOX_STACK_ALIGN(struct msg_get_arm_mem, msg);
-	int ret;
-
-	BCM2835_MBOX_INIT_HDR(msg);
-	BCM2835_MBOX_INIT_TAG(&msg->get_arm_mem, GET_ARM_MEMORY);
-
-	ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg->hdr);
-	if (ret)
-		return ret;
-
-	*size = msg->get_arm_mem.body.resp.mem_size;
-
-	return 0;
-}
-
 static void rpi_set_usbethaddr(void)
 {
-	BCM2835_MBOX_STACK_ALIGN(struct msg_get_mac_address, msg);
-	int ret;
+	u8 mac[ETH_ALEN];
 
-	BCM2835_MBOX_INIT_HDR(msg);
-	BCM2835_MBOX_INIT_TAG(&msg->get_mac_address, GET_MAC_ADDRESS);
-
-	ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg->hdr);
-	if (ret) {
-		printf("bcm2835: Could not query MAC address\n");
-		/* Ignore error; not critical */
-		return;
-	}
+	if (rpi_get_usbethaddr(mac))
+		return; /* Ignore error; not critical */
 
-	eth_register_ethaddr(0, msg->get_mac_address.body.resp.mac);
+	eth_register_ethaddr(0, mac);
 }
 
 static void rpi_set_usbotg(const char *alias)
@@ -185,50 +142,19 @@ static int rpi_0_w_init(struct rpi_priv *priv)
 	return of_device_disable_by_alias("serial0");
 }
 
-static int rpi_get_board_rev(struct rpi_priv *priv)
-{
-	int ret;
-
-	BCM2835_MBOX_STACK_ALIGN(struct msg_get_board_rev, msg);
-	BCM2835_MBOX_INIT_HDR(msg);
-	BCM2835_MBOX_INIT_TAG(&msg->get_board_rev, GET_BOARD_REV);
-
-	ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg->hdr);
-	if (ret) {
-		dev_err(priv->dev, "Could not query board revision\n");
-		return ret;
-	}
-
-	/* Comments from u-boot:
-	 * For details of old-vs-new scheme, see:
-	 * https://github.com/pimoroni/RPi.version/blob/master/RPi/version.py
-	 * http://www.raspberrypi.org/forums/viewtopic.php?f=63&t=99293&p=690282
-	 * (a few posts down)
-	 *
-	 * For the RPi 1, bit 24 is the "warranty bit", so we mask off just the
-	 * lower byte to use as the board rev:
-	 * http://www.raspberrypi.org/forums/viewtopic.php?f=63&t=98367&start=250
-	 * http://www.raspberrypi.org/forums/viewtopic.php?f=31&t=20594
-	 */
-	priv->hw_id = msg->get_board_rev.body.resp.rev;
-
-	return 0;
-}
-
 static int rpi_mem_init(void)
 {
-	u32 size = 0;
-	int ret;
+	ssize_t size;
 
-	ret = rpi_get_arm_mem(&size);
-	if (ret) {
+	size = rpi_get_arm_mem();
+	if (size < 0) {
 		printf("could not query ARM memory size\n");
 		size = get_ram_size((ulong *) BCM2835_SDRAM_BASE, SZ_128M);
 	}
 
 	bcm2835_add_device_sdram(size);
 
-	return ret;
+	return 0;
 }
 mem_initcall(rpi_mem_init);
 
@@ -357,6 +283,18 @@ static const struct rpi_machine_data *rpi_get_dcfg(struct rpi_priv *priv)
 		return NULL;
 	}
 
+	/* Comments from u-boot:
+	 * For details of old-vs-new scheme, see:
+	 * https://github.com/pimoroni/RPi.version/blob/master/RPi/version.py
+	 * http://www.raspberrypi.org/forums/viewtopic.php?f=63&t=99293&p=690282
+	 * (a few posts down)
+	 *
+	 * For the RPi 1, bit 24 is the "warranty bit", so we mask off just the
+	 * lower byte to use as the board rev:
+	 * http://www.raspberrypi.org/forums/viewtopic.php?f=63&t=98367&start=250
+	 * http://www.raspberrypi.org/forums/viewtopic.php?f=31&t=20594
+	 */
+
 	for (; dcfg->hw_id != U8_MAX; dcfg++) {
 		if (priv->hw_id & 0x800000) {
 			if (dcfg->hw_id != ((priv->hw_id >> 4) & 0xff))
@@ -388,10 +326,12 @@ static int rpi_devices_probe(struct device_d *dev)
 	priv = xzalloc(sizeof(*priv));
 	priv->dev = dev;
 
-	ret = rpi_get_board_rev(priv);
-	if (ret)
+	ret = rpi_get_board_rev();
+	if (ret < 0)
 		goto free_priv;
 
+	priv->hw_id = ret;
+
 	dcfg = rpi_get_dcfg(priv);
 	if (IS_ERR(dcfg))
 		goto free_priv;
-- 
2.30.2


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


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

* [PATCH v2 06/21] ARM: rpi: switch to ARM_USE_COMPRESSED_DTB
  2022-06-09  5:59 [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support Ahmad Fatoum
                   ` (4 preceding siblings ...)
  2022-06-09  5:59 ` [PATCH v2 05/21] ARM: rpi: split out mbox helpers to share code with PBL Ahmad Fatoum
@ 2022-06-09  5:59 ` Ahmad Fatoum
  2022-06-09  5:59 ` [PATCH v2 07/21] ARM: rpi: add generic Raspberry Pi image Ahmad Fatoum
                   ` (15 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Ahmad Fatoum @ 2022-06-09  5:59 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

We'll add a generic image containing multiple DTs in a follow-up commit,
which would benefit from compressing the DTs. For uniformity, compress
the existing DTs as well to save some kilobytes there.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/boards/raspberry-pi/lowlevel.c | 17 +++++++++--------
 arch/arm/mach-bcm283x/Kconfig           |  1 +
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/arch/arm/boards/raspberry-pi/lowlevel.c b/arch/arm/boards/raspberry-pi/lowlevel.c
index 7b9809b86cb7..091bfb8f4b14 100644
--- a/arch/arm/boards/raspberry-pi/lowlevel.c
+++ b/arch/arm/boards/raspberry-pi/lowlevel.c
@@ -57,26 +57,27 @@ static inline void start_raspberry_pi(unsigned long memsize, void *fdt,
 #define RPI_ENTRY_FUNCTION(name, memsize, r2) \
 	ENTRY_FUNCTION_WITHSTACK(name, rpi_stack_top(memsize), __r0, __r1, r2)
 
-extern char __dtb_bcm2835_rpi_start[];
+extern char __dtb_z_bcm2835_rpi_start[];
+extern char __dtb_z_bcm2836_rpi_2_start[];
+extern char __dtb_z_bcm2837_rpi_3_start[];
+extern char __dtb_z_bcm2837_rpi_cm3_start[];
+
 RPI_ENTRY_FUNCTION(start_raspberry_pi1, SZ_128M, r2)
 {
-	start_raspberry_pi(SZ_128M, __dtb_bcm2835_rpi_start, (void *)r2);
+	start_raspberry_pi(SZ_128M, __dtb_z_bcm2835_rpi_start, (void *)r2);
 }
 
-extern char __dtb_bcm2836_rpi_2_start[];
 RPI_ENTRY_FUNCTION(start_raspberry_pi2, SZ_512M, r2)
 {
-	start_raspberry_pi(SZ_512M, __dtb_bcm2836_rpi_2_start, (void *)r2);
+	start_raspberry_pi(SZ_512M, __dtb_z_bcm2836_rpi_2_start, (void *)r2);
 }
 
-extern char __dtb_bcm2837_rpi_3_start[];
 RPI_ENTRY_FUNCTION(start_raspberry_pi3, SZ_512M, r2)
 {
-	start_raspberry_pi(SZ_512M, __dtb_bcm2837_rpi_3_start, (void *)r2);
+	start_raspberry_pi(SZ_512M, __dtb_z_bcm2837_rpi_3_start, (void *)r2);
 }
 
-extern char __dtb_bcm2837_rpi_cm3_start[];
 RPI_ENTRY_FUNCTION(start_raspberry_pi_cm3, SZ_512M, r2)
 {
-	start_raspberry_pi(SZ_512M, __dtb_bcm2837_rpi_cm3_start, (void *)r2);
+	start_raspberry_pi(SZ_512M, __dtb_z_bcm2837_rpi_cm3_start, (void *)r2);
 }
diff --git a/arch/arm/mach-bcm283x/Kconfig b/arch/arm/mach-bcm283x/Kconfig
index 75acee8dad56..5be236a68419 100644
--- a/arch/arm/mach-bcm283x/Kconfig
+++ b/arch/arm/mach-bcm283x/Kconfig
@@ -8,6 +8,7 @@ config ARCH_TEXT_BASE
 
 config MACH_RPI_COMMON
 	bool
+	select ARM_USE_COMPRESSED_DTB
 
 menu "select Broadcom BCM283X boards to be built"
 
-- 
2.30.2


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


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

* [PATCH v2 07/21] ARM: rpi: add generic Raspberry Pi image
  2022-06-09  5:59 [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support Ahmad Fatoum
                   ` (5 preceding siblings ...)
  2022-06-09  5:59 ` [PATCH v2 06/21] ARM: rpi: switch to ARM_USE_COMPRESSED_DTB Ahmad Fatoum
@ 2022-06-09  5:59 ` Ahmad Fatoum
  2022-06-09  5:59 ` [PATCH v2 08/21] ARM: rpi: support FDT in x0 for 64bit configurations Ahmad Fatoum
                   ` (14 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Ahmad Fatoum @ 2022-06-09  5:59 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Add a new image that can be booted on all supported boards. This work by
including DTs for all enabled boards in config and then consulting the
mailbox interface at runtime to deduce which DT to pass to barebox
proper. An alternative would have been to use the existing
barebox-dt-2nd.img with a VideoCore-supplied device tree, but that has
the drawback of requiring barebox to observe the same bindings as the
kernel that's booted later. This approach makes migration
straight-forward, because no difference in VideoCore configuration is
required.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 Documentation/boards/bcm2835.rst              |  8 +-
 arch/arm/boards/raspberry-pi/lowlevel.c       | 87 ++++++++++++++++++-
 arch/arm/mach-bcm283x/include/mach/debug_ll.h |  6 ++
 images/Makefile.bcm283x                       |  4 +
 4 files changed, 99 insertions(+), 6 deletions(-)

diff --git a/Documentation/boards/bcm2835.rst b/Documentation/boards/bcm2835.rst
index 0b5299a34078..a8eed9aec00d 100644
--- a/Documentation/boards/bcm2835.rst
+++ b/Documentation/boards/bcm2835.rst
@@ -15,14 +15,14 @@ Raspberry Pi
      - ``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)
+     - ``images/barebox-raspberry-pi.img``, which is a super set of all the other images
 
      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.
+     The ``images/barebox-raspberry-pi.img`` is expected to replace the other images
+     in the future. It contains the device trees of all supported (and enabled) variants
+     and determines at runtime what board it runs on and does the right thing.
 
   4. Create a text file ``config.txt`` on the SD card with the following content::
 
diff --git a/arch/arm/boards/raspberry-pi/lowlevel.c b/arch/arm/boards/raspberry-pi/lowlevel.c
index 091bfb8f4b14..82b51b5b1594 100644
--- a/arch/arm/boards/raspberry-pi/lowlevel.c
+++ b/arch/arm/boards/raspberry-pi/lowlevel.c
@@ -4,7 +4,10 @@
 #include <asm/cache.h>
 #include <common.h>
 #include <linux/sizes.h>
+#include <asm/unaligned.h>
 #include <mach/platform.h>
+#include <debug_ll.h>
+#include <mach/mbox.h>
 #include <of.h>
 
 #include "lowlevel.h"
@@ -45,8 +48,6 @@ static inline void start_raspberry_pi(unsigned long memsize, void *fdt,
 {
 	unsigned long endmem = rpi_stack_top(memsize);
 
-	arm_cpu_lowlevel_init();
-
 	copy_vc_fdt((void *)endmem, vc_fdt, VIDEOCORE_FDT_SZ);
 
 	fdt += get_runtime_offset();
@@ -64,20 +65,102 @@ extern char __dtb_z_bcm2837_rpi_cm3_start[];
 
 RPI_ENTRY_FUNCTION(start_raspberry_pi1, SZ_128M, r2)
 {
+	arm_cpu_lowlevel_init();
+
 	start_raspberry_pi(SZ_128M, __dtb_z_bcm2835_rpi_start, (void *)r2);
 }
 
 RPI_ENTRY_FUNCTION(start_raspberry_pi2, SZ_512M, r2)
 {
+	arm_cpu_lowlevel_init();
+
 	start_raspberry_pi(SZ_512M, __dtb_z_bcm2836_rpi_2_start, (void *)r2);
 }
 
 RPI_ENTRY_FUNCTION(start_raspberry_pi3, SZ_512M, r2)
 {
+	arm_cpu_lowlevel_init();
+
 	start_raspberry_pi(SZ_512M, __dtb_z_bcm2837_rpi_3_start, (void *)r2);
 }
 
 RPI_ENTRY_FUNCTION(start_raspberry_pi_cm3, SZ_512M, r2)
 {
+	arm_cpu_lowlevel_init();
+
 	start_raspberry_pi(SZ_512M, __dtb_z_bcm2837_rpi_cm3_start, (void *)r2);
 }
+
+#define DT_IF_ENABLED(dt, cfg) \
+	(IS_ENABLED(cfg) ? (dt) : NULL)
+
+static void *rpi_get_board_fdt(int rev)
+{
+	if (!(rev & 0x800000))
+		return DT_IF_ENABLED(__dtb_z_bcm2835_rpi_start, CONFIG_MACH_RPI);
+
+	switch (((rev >> 4) & 0xff)) {
+	case BCM2835_BOARD_REV_A:
+	case BCM2835_BOARD_REV_B:
+	case BCM2835_BOARD_REV_A_PLUS:
+	case BCM2835_BOARD_REV_B_PLUS:
+	case BCM2835_BOARD_REV_CM1:
+	case BCM2835_BOARD_REV_ZERO:
+	case BCM2835_BOARD_REV_ZERO_W:
+		return DT_IF_ENABLED(__dtb_z_bcm2835_rpi_start, CONFIG_MACH_RPI);
+
+	case BCM2836_BOARD_REV_2_B:
+		return DT_IF_ENABLED(__dtb_z_bcm2836_rpi_2_start, CONFIG_MACH_RPI2);
+
+	case BCM2837_BOARD_REV_3_B:
+	case BCM2837B0_BOARD_REV_3B_PLUS:
+	case BCM2837B0_BOARD_REV_3A_PLUS:
+	case BCM2837B0_BOARD_REV_ZERO_2:
+		return DT_IF_ENABLED(__dtb_z_bcm2837_rpi_3_start, CONFIG_MACH_RPI3);
+
+	case BCM2837_BOARD_REV_CM3:
+	case BCM2837B0_BOARD_REV_CM3_PLUS:
+		return DT_IF_ENABLED(__dtb_z_bcm2837_rpi_cm3_start, CONFIG_MACH_RPI_CM3);
+	}
+
+	return NULL;
+}
+
+RPI_ENTRY_FUNCTION(start_raspberry_pi_generic, SZ_128M, vc_fdt)
+{
+	void *fdt = NULL;
+	ssize_t memsize;
+	int rev;
+
+	arm_cpu_lowlevel_init();
+
+	debug_ll_init();
+
+	putc_ll('>');
+
+	relocate_to_current_adr();
+	setup_c();
+
+	memsize = rpi_get_arm_mem();
+	if (memsize < 0) {
+		pr_warn("mbox: failed to query ARM memory size. 128M assumed.\n");
+		memsize = SZ_128M;
+	}
+
+	rev = rpi_get_board_rev();
+	if (rev >= 0) {
+		pr_debug("Detected revision %08x\n", rev);
+		fdt = rpi_get_board_fdt(rev);
+	}
+
+	if (!fdt) {
+		fdt = (void *)vc_fdt;
+
+		pr_warn("Unknown Rpi board with rev %08x.\n", rev);
+
+		if (get_unaligned_be32(fdt) != 0xd00dfeed)
+			panic("No suitable built-in or videocore-supplied DT\n");
+	}
+
+	start_raspberry_pi(memsize, fdt, (void *)vc_fdt);
+}
diff --git a/arch/arm/mach-bcm283x/include/mach/debug_ll.h b/arch/arm/mach-bcm283x/include/mach/debug_ll.h
index 4bfa5abc7c41..db23112aa07e 100644
--- a/arch/arm/mach-bcm283x/include/mach/debug_ll.h
+++ b/arch/arm/mach-bcm283x/include/mach/debug_ll.h
@@ -66,6 +66,12 @@ static inline void debug_ll_init(void)
 	debug_ll_ns16550_init(divisor);
 }
 
+#else
+
+static inline void debug_ll_init(void)
+{
+}
+
 #endif
 
 #endif /* __MACH_BCM2835_DEBUG_LL_H__ */
diff --git a/images/Makefile.bcm283x b/images/Makefile.bcm283x
index 82787f972c2d..b591cd58f563 100644
--- a/images/Makefile.bcm283x
+++ b/images/Makefile.bcm283x
@@ -18,3 +18,7 @@ image-$(CONFIG_MACH_RPI3) += barebox-raspberry-pi-3.img
 pblb-$(CONFIG_MACH_RPI_CM3) += start_raspberry_pi_cm3
 FILE_barebox-raspberry-pi-cm3.img = start_raspberry_pi_cm3.pblb
 image-$(CONFIG_MACH_RPI_CM3) += barebox-raspberry-pi-cm3.img
+
+pblb-$(CONFIG_MACH_RPI_COMMON) += start_raspberry_pi_generic
+FILE_barebox-raspberry-pi.img = start_raspberry_pi_generic.pblb
+image-$(CONFIG_MACH_RPI_COMMON) += barebox-raspberry-pi.img
-- 
2.30.2


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


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

* [PATCH v2 08/21] ARM: rpi: support FDT in x0 for 64bit configurations
  2022-06-09  5:59 [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support Ahmad Fatoum
                   ` (6 preceding siblings ...)
  2022-06-09  5:59 ` [PATCH v2 07/21] ARM: rpi: add generic Raspberry Pi image Ahmad Fatoum
@ 2022-06-09  5:59 ` Ahmad Fatoum
  2022-06-09  5:59 ` [PATCH v2 09/21] serial: ns16550: rpi: remove ungating now done by proper clk driver Ahmad Fatoum
                   ` (13 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Ahmad Fatoum @ 2022-06-09  5:59 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

While the lowlevel Raspberry Pi entry code can now be compiled for
64-bit, it doesn't do the correct thing at runtime, because Linux boot
convention places FDT into x0, not r2. Adjust the entry points
accordingly.

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

diff --git a/arch/arm/boards/raspberry-pi/lowlevel.c b/arch/arm/boards/raspberry-pi/lowlevel.c
index 82b51b5b1594..40d36f0cff78 100644
--- a/arch/arm/boards/raspberry-pi/lowlevel.c
+++ b/arch/arm/boards/raspberry-pi/lowlevel.c
@@ -36,7 +36,7 @@ static void copy_vc_fdt(void *dest, void *src, unsigned long max_size)
 	memmove(dest, src, size);
 }
 
-/* A pointer to the FDT created by VideoCore was passed to us in r2. We
+/* A pointer to the FDT created by VideoCore was passed to us in x0/r2. We
  * reserve some memory just above the region used for Barebox and copy
  * this FDT there. We fetch it from there later in rpi_devices_init().
  */
@@ -55,40 +55,45 @@ static inline void start_raspberry_pi(unsigned long memsize, void *fdt,
 	barebox_arm_entry(BCM2835_SDRAM_BASE, endmem - BCM2835_SDRAM_BASE, fdt);
 }
 
-#define RPI_ENTRY_FUNCTION(name, memsize, r2) \
-	ENTRY_FUNCTION_WITHSTACK(name, rpi_stack_top(memsize), __r0, __r1, r2)
+#ifdef CONFIG_CPU_V8
+#define RPI_ENTRY_FUNCTION(name, memsize, fdt) \
+	ENTRY_FUNCTION_WITHSTACK(name, rpi_stack_top(memsize), fdt, __x1, __x2)
+#else
+#define RPI_ENTRY_FUNCTION(name, memsize, fdt) \
+	ENTRY_FUNCTION_WITHSTACK(name, rpi_stack_top(memsize), __r0, __r1, fdt)
+#endif
 
 extern char __dtb_z_bcm2835_rpi_start[];
 extern char __dtb_z_bcm2836_rpi_2_start[];
 extern char __dtb_z_bcm2837_rpi_3_start[];
 extern char __dtb_z_bcm2837_rpi_cm3_start[];
 
-RPI_ENTRY_FUNCTION(start_raspberry_pi1, SZ_128M, r2)
+RPI_ENTRY_FUNCTION(start_raspberry_pi1, SZ_128M, fdt)
 {
 	arm_cpu_lowlevel_init();
 
-	start_raspberry_pi(SZ_128M, __dtb_z_bcm2835_rpi_start, (void *)r2);
+	start_raspberry_pi(SZ_128M, __dtb_z_bcm2835_rpi_start, (void *)fdt);
 }
 
-RPI_ENTRY_FUNCTION(start_raspberry_pi2, SZ_512M, r2)
+RPI_ENTRY_FUNCTION(start_raspberry_pi2, SZ_512M, fdt)
 {
 	arm_cpu_lowlevel_init();
 
-	start_raspberry_pi(SZ_512M, __dtb_z_bcm2836_rpi_2_start, (void *)r2);
+	start_raspberry_pi(SZ_512M, __dtb_z_bcm2836_rpi_2_start, (void *)fdt);
 }
 
-RPI_ENTRY_FUNCTION(start_raspberry_pi3, SZ_512M, r2)
+RPI_ENTRY_FUNCTION(start_raspberry_pi3, SZ_512M, fdt)
 {
 	arm_cpu_lowlevel_init();
 
-	start_raspberry_pi(SZ_512M, __dtb_z_bcm2837_rpi_3_start, (void *)r2);
+	start_raspberry_pi(SZ_512M, __dtb_z_bcm2837_rpi_3_start, (void *)fdt);
 }
 
-RPI_ENTRY_FUNCTION(start_raspberry_pi_cm3, SZ_512M, r2)
+RPI_ENTRY_FUNCTION(start_raspberry_pi_cm3, SZ_512M, fdt)
 {
 	arm_cpu_lowlevel_init();
 
-	start_raspberry_pi(SZ_512M, __dtb_z_bcm2837_rpi_cm3_start, (void *)r2);
+	start_raspberry_pi(SZ_512M, __dtb_z_bcm2837_rpi_cm3_start, (void *)fdt);
 }
 
 #define DT_IF_ENABLED(dt, cfg) \
-- 
2.30.2


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


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

* [PATCH v2 09/21] serial: ns16550: rpi: remove ungating now done by proper clk driver
  2022-06-09  5:59 [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support Ahmad Fatoum
                   ` (7 preceding siblings ...)
  2022-06-09  5:59 ` [PATCH v2 08/21] ARM: rpi: support FDT in x0 for 64bit configurations Ahmad Fatoum
@ 2022-06-09  5:59 ` Ahmad Fatoum
  2022-06-09  5:59 ` [PATCH v2 10/21] ARM: cpu: prevent recursive dependencies via CPU_SUPPORTS_64BIT_KERNEL Ahmad Fatoum
                   ` (12 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Ahmad Fatoum @ 2022-06-09  5:59 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

We have bcm2835-aux-clk driver that will take care to ungate the clock,
so we can remove this Raspberry Pi 3 specific detail from the driver.

Tested on Raspberry Pi 3b.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/serial/serial_ns16550.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
index f93a89ab95b2..e936711bf816 100644
--- a/drivers/serial/serial_ns16550.c
+++ b/drivers/serial/serial_ns16550.c
@@ -240,14 +240,10 @@ static void ns16550_jz_init_port(struct console_device *cdev)
 	ns16550_serial_init_port(cdev);
 }
 
-#define BCM2836_AUX_CLOCK_ENB 0x3f215004 /* BCM2835 AUX Clock enable register */
-#define BCM2836_AUX_CLOCK_EN_UART BIT(0) /* Bit 0 enables the Miniuart */
-
 static void rpi_init_port(struct console_device *cdev)
 {
 	struct ns16550_priv *priv = to_ns16550_priv(cdev);
 
-	writeb(BCM2836_AUX_CLOCK_EN_UART, BCM2836_AUX_CLOCK_ENB);
 	priv->plat.shift = 2;
 	/*
 	 * We double the clock rate since the 16550 will divide by 16
-- 
2.30.2


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


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

* [PATCH v2 10/21] ARM: cpu: prevent recursive dependencies via CPU_SUPPORTS_64BIT_KERNEL
  2022-06-09  5:59 [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support Ahmad Fatoum
                   ` (8 preceding siblings ...)
  2022-06-09  5:59 ` [PATCH v2 09/21] serial: ns16550: rpi: remove ungating now done by proper clk driver Ahmad Fatoum
@ 2022-06-09  5:59 ` Ahmad Fatoum
  2022-06-09  5:59 ` [PATCH v2 11/21] ARM: cpu: remove unnecessary CONFIG_SYS_SUPPORTS_64BIT_KERNEL Ahmad Fatoum
                   ` (11 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Ahmad Fatoum @ 2022-06-09  5:59 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

For ARM, CONFIG_CPU_SUPPORTS_64BIT_KERNEL's only function, along with
CONFIG_SYS_SUPPORTS_64BIT_KERNEL is to control visibility of the 64BIT
symbol. Select it from CPU_V8 is detrimental, because subarches may
want to select CPU_SUPPORTS_64BIT_KERNEL unconditionally and select
CPU_V8 only if 64BIT was chosen. This currently leads to a recursive
dependency, so break this up. No functional change just yet.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/Kconfig                 | 2 ++
 arch/arm/cpu/Kconfig             | 1 -
 arch/arm/mach-imx/Kconfig        | 1 +
 arch/arm/mach-layerscape/Kconfig | 1 +
 arch/arm/mach-rockchip/Kconfig   | 1 +
 5 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 8a1d75c19b65..215abd19b553 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -276,6 +276,7 @@ config ARCH_ZYNQMP
 	select OFDEVICE
 	select OFTREE
 	select RELOCATABLE
+	select CPU_SUPPORTS_64BIT_KERNEL
 	select SYS_SUPPORTS_64BIT_KERNEL
 	select HAS_MACB
 
@@ -286,6 +287,7 @@ config ARCH_ARM64_VIRT
 	select OFDEVICE
 	select OFTREE
 	select RELOCATABLE
+	select CPU_SUPPORTS_64BIT_KERNEL
 	select SYS_SUPPORTS_64BIT_KERNEL
 	select ARM_AMBA
 	select BOARD_ARM_VIRT
diff --git a/arch/arm/cpu/Kconfig b/arch/arm/cpu/Kconfig
index 0a493754a418..5639d1eeffc3 100644
--- a/arch/arm/cpu/Kconfig
+++ b/arch/arm/cpu/Kconfig
@@ -87,7 +87,6 @@ config CPU_V7
 config CPU_V8
 	bool
 	select CPU_64v8
-	select CPU_SUPPORTS_64BIT_KERNEL
 	select ARM_EXCEPTIONS
 	select GENERIC_FIND_NEXT_BIT
 	select ARCH_HAS_STACK_DUMP
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 6b962dcf7e34..9b9f5a472ef9 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -177,6 +177,7 @@ config ARCH_IMX8M
 	select CPU_V8
 	select PINCTRL_IMX_IOMUX_V3
 	select OFTREE
+	select CPU_SUPPORTS_64BIT_KERNEL
 	select SYS_SUPPORTS_64BIT_KERNEL
 	select COMMON_CLK_OF_PROVIDER
 	select ARCH_HAS_FEC_IMX
diff --git a/arch/arm/mach-layerscape/Kconfig b/arch/arm/mach-layerscape/Kconfig
index bdd7d0dbfe52..9ad58eba5575 100644
--- a/arch/arm/mach-layerscape/Kconfig
+++ b/arch/arm/mach-layerscape/Kconfig
@@ -17,6 +17,7 @@ config ARCH_LAYERSCAPE_PPA
 
 config ARCH_LS1046
 	select CPU_V8
+	select CPU_SUPPORTS_64BIT_KERNEL
 	select SYS_SUPPORTS_64BIT_KERNEL
 	bool
 
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 4b6dfd2c17a9..e09c4837d59d 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -30,6 +30,7 @@ config ARCH_RK3288
 config ARCH_ROCKCHIP_V8
 	bool
 	select CPU_V8
+	select CPU_SUPPORTS_64BIT_KERNEL
 	select SYS_SUPPORTS_64BIT_KERNEL
 	select ARM_ATF
 	select RELOCATABLE
-- 
2.30.2


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


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

* [PATCH v2 11/21] ARM: cpu: remove unnecessary CONFIG_SYS_SUPPORTS_64BIT_KERNEL
  2022-06-09  5:59 [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support Ahmad Fatoum
                   ` (9 preceding siblings ...)
  2022-06-09  5:59 ` [PATCH v2 10/21] ARM: cpu: prevent recursive dependencies via CPU_SUPPORTS_64BIT_KERNEL Ahmad Fatoum
@ 2022-06-09  5:59 ` Ahmad Fatoum
  2022-06-09  5:59 ` [PATCH v2 12/21] ARM: cpu: remove unused SYS_SUPPORTS_32BIT_KERNEL Ahmad Fatoum
                   ` (10 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Ahmad Fatoum @ 2022-06-09  5:59 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

For ARM, SYS_SUPPORTS_64BIT_KERNEL is selected exclusively by symbols
that also select CPU_SUPPORTS_64BIT_KERNEL, so we can drop
SYS_SUPPORTS_64BIT_KERNEL safely.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/Kconfig                 | 4 +---
 arch/arm/cpu/Kconfig             | 3 ---
 arch/arm/mach-imx/Kconfig        | 1 -
 arch/arm/mach-layerscape/Kconfig | 1 -
 arch/arm/mach-rockchip/Kconfig   | 1 -
 5 files changed, 1 insertion(+), 9 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 215abd19b553..7c6b65ae4db6 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -277,7 +277,6 @@ config ARCH_ZYNQMP
 	select OFTREE
 	select RELOCATABLE
 	select CPU_SUPPORTS_64BIT_KERNEL
-	select SYS_SUPPORTS_64BIT_KERNEL
 	select HAS_MACB
 
 config ARCH_ARM64_VIRT
@@ -288,7 +287,6 @@ config ARCH_ARM64_VIRT
 	select OFTREE
 	select RELOCATABLE
 	select CPU_SUPPORTS_64BIT_KERNEL
-	select SYS_SUPPORTS_64BIT_KERNEL
 	select ARM_AMBA
 	select BOARD_ARM_VIRT
 	select HW_HAS_PCI
@@ -405,7 +403,7 @@ config 32BIT
 
 config 64BIT
 	bool "64-bit barebox"
-	depends on CPU_SUPPORTS_64BIT_KERNEL && SYS_SUPPORTS_64BIT_KERNEL
+	depends on CPU_SUPPORTS_64BIT_KERNEL
 	select ARCH_DMA_ADDR_T_64BIT
 	help
 	  Select this option if you want to build a 64-bit barebox.
diff --git a/arch/arm/cpu/Kconfig b/arch/arm/cpu/Kconfig
index 5639d1eeffc3..f3cf2750e9af 100644
--- a/arch/arm/cpu/Kconfig
+++ b/arch/arm/cpu/Kconfig
@@ -158,9 +158,6 @@ config CACHE_L2X0
 config SYS_SUPPORTS_32BIT_KERNEL
 	bool
 
-config SYS_SUPPORTS_64BIT_KERNEL
-	bool
-
 config CPU_SUPPORTS_32BIT_KERNEL
 	bool
 
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 9b9f5a472ef9..9ff549ac8397 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -178,7 +178,6 @@ config ARCH_IMX8M
 	select PINCTRL_IMX_IOMUX_V3
 	select OFTREE
 	select CPU_SUPPORTS_64BIT_KERNEL
-	select SYS_SUPPORTS_64BIT_KERNEL
 	select COMMON_CLK_OF_PROVIDER
 	select ARCH_HAS_FEC_IMX
 	select HW_HAS_PCI
diff --git a/arch/arm/mach-layerscape/Kconfig b/arch/arm/mach-layerscape/Kconfig
index 9ad58eba5575..943a47480830 100644
--- a/arch/arm/mach-layerscape/Kconfig
+++ b/arch/arm/mach-layerscape/Kconfig
@@ -18,7 +18,6 @@ config ARCH_LAYERSCAPE_PPA
 config ARCH_LS1046
 	select CPU_V8
 	select CPU_SUPPORTS_64BIT_KERNEL
-	select SYS_SUPPORTS_64BIT_KERNEL
 	bool
 
 config MACH_LS1046ARDB
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index e09c4837d59d..1f3ba706ee9f 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -31,7 +31,6 @@ config ARCH_ROCKCHIP_V8
 	bool
 	select CPU_V8
 	select CPU_SUPPORTS_64BIT_KERNEL
-	select SYS_SUPPORTS_64BIT_KERNEL
 	select ARM_ATF
 	select RELOCATABLE
 
-- 
2.30.2


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


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

* [PATCH v2 12/21] ARM: cpu: remove unused SYS_SUPPORTS_32BIT_KERNEL
  2022-06-09  5:59 [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support Ahmad Fatoum
                   ` (10 preceding siblings ...)
  2022-06-09  5:59 ` [PATCH v2 11/21] ARM: cpu: remove unnecessary CONFIG_SYS_SUPPORTS_64BIT_KERNEL Ahmad Fatoum
@ 2022-06-09  5:59 ` Ahmad Fatoum
  2022-06-09  5:59 ` [PATCH v2 13/21] ARM: rpi: add Raspberry Pi 3 64-bit build support Ahmad Fatoum
                   ` (9 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Ahmad Fatoum @ 2022-06-09  5:59 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

This symbol only serves hiding CONFIG_32BIT and was so far not set
anywhere, so just drop it.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/Kconfig     | 2 +-
 arch/arm/cpu/Kconfig | 3 ---
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 7c6b65ae4db6..03a7e4b6600c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -397,7 +397,7 @@ choice
 
 config 32BIT
 	bool "32-bit barebox"
-	depends on CPU_SUPPORTS_32BIT_KERNEL && SYS_SUPPORTS_32BIT_KERNEL
+	depends on CPU_SUPPORTS_32BIT_KERNEL
 	help
 	  Select this option if you want to build a 32-bit barebox.
 
diff --git a/arch/arm/cpu/Kconfig b/arch/arm/cpu/Kconfig
index f3cf2750e9af..9b5a833abfff 100644
--- a/arch/arm/cpu/Kconfig
+++ b/arch/arm/cpu/Kconfig
@@ -155,9 +155,6 @@ config CACHE_L2X0
 	bool "Enable L2x0 PrimeCell"
 	depends on MMU && ARCH_HAS_L2X0
 
-config SYS_SUPPORTS_32BIT_KERNEL
-	bool
-
 config CPU_SUPPORTS_32BIT_KERNEL
 	bool
 
-- 
2.30.2


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


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

* [PATCH v2 13/21] ARM: rpi: add Raspberry Pi 3 64-bit build support
  2022-06-09  5:59 [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support Ahmad Fatoum
                   ` (11 preceding siblings ...)
  2022-06-09  5:59 ` [PATCH v2 12/21] ARM: cpu: remove unused SYS_SUPPORTS_32BIT_KERNEL Ahmad Fatoum
@ 2022-06-09  5:59 ` Ahmad Fatoum
  2022-06-09  5:59 ` [PATCH v2 14/21] ARM: rpi: rpi3: disallow MMU_EARLY && 64BIT Ahmad Fatoum
                   ` (8 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Ahmad Fatoum @ 2022-06-09  5:59 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Have the subarch select the needed symbols to display a 32-bit/64-bit
menu and hide the boards that aren't capable of 64-bit when
CONFIG_64BIT=y. Building for 64-bit throws some warning about mismatched
type sizes, so fix those as well.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/Kconfig                              |  2 ++
 arch/arm/mach-bcm283x/Kconfig                 | 21 +++++++++++++++----
 arch/arm/mach-bcm283x/include/mach/platform.h |  4 ++--
 arch/arm/mach-bcm283x/mbox.c                  |  2 +-
 images/Makefile.bcm283x                       |  6 ++++++
 5 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 03a7e4b6600c..59fce0c601b4 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -60,6 +60,8 @@ config ARCH_BCM283X
 	select OFTREE
 	select OFDEVICE
 	select HAVE_PBL_MULTI_IMAGES
+	select CPU_SUPPORTS_32BIT_KERNEL
+	select CPU_SUPPORTS_64BIT_KERNEL
 
 config ARCH_CLPS711X
 	bool "Cirrus Logic EP711x/EP721x/EP731x"
diff --git a/arch/arm/mach-bcm283x/Kconfig b/arch/arm/mach-bcm283x/Kconfig
index 5be236a68419..af34d1c973e1 100644
--- a/arch/arm/mach-bcm283x/Kconfig
+++ b/arch/arm/mach-bcm283x/Kconfig
@@ -10,29 +10,42 @@ config MACH_RPI_COMMON
 	bool
 	select ARM_USE_COMPRESSED_DTB
 
+config MACH_RPI_AARCH_32_64
+	select MACH_RPI_COMMON
+	select CPU_V7 if 32BIT
+	select ARM_SECURE_MONITOR if 32BIT
+	select CPU_V8 if 64BIT
+	select BOARD_ARM_GENERIC_DT if 64BIT
+	bool
+	help
+	  Select this from CPUs that support both AArch32 and AArch64
+	  execution modes. barebox can be compiled for only one of
+	  these states, depending on the value of
+	  CONFIG_32BIT/CONFIG_64BIT.
+
 menu "select Broadcom BCM283X boards to be built"
 
 config MACH_RPI
 	bool "RaspberryPi (BCM2835/ARM1176JZF-S)"
+	depends on 32BIT
 	select CPU_V6
 	select MACH_RPI_COMMON
 
 config MACH_RPI2
 	bool "RaspberryPi 2 (BCM2836/CORTEX-A7)"
+	depends on 32BIT
 	select CPU_V7
 	select MACH_RPI_COMMON
 
 config MACH_RPI3
 	bool "RaspberryPi 3 (BCM2837/CORTEX-A53)"
-	select CPU_V7
+	select MACH_RPI_AARCH_32_64
 	select MACH_RPI_COMMON
-	select ARM_SECURE_MONITOR
 
 config MACH_RPI_CM3
 	bool "RaspberryPi Compute Module 3 (BCM2837/CORTEX-A53)"
-	select CPU_V7
+	select MACH_RPI_AARCH_32_64
 	select MACH_RPI_COMMON
-	select ARM_SECURE_MONITOR
 
 endmenu
 
diff --git a/arch/arm/mach-bcm283x/include/mach/platform.h b/arch/arm/mach-bcm283x/include/mach/platform.h
index 310f2463f2e5..6917e1f345d7 100644
--- a/arch/arm/mach-bcm283x/include/mach/platform.h
+++ b/arch/arm/mach-bcm283x/include/mach/platform.h
@@ -31,9 +31,9 @@
 #define BCM2835_CACHELINE_SIZE	64
 
 #define BCM2835_PL011_BASE 0x20201000
-#define BCM2836_PL011_BASE 0x3f201000
+#define BCM2836_PL011_BASE 0x3f201000UL
 #define BCM2835_MINIUART_BASE 0x20215040
-#define BCM2836_MINIUART_BASE 0x3f215040
+#define BCM2836_MINIUART_BASE 0x3f215040UL
 
 #endif
 
diff --git a/arch/arm/mach-bcm283x/mbox.c b/arch/arm/mach-bcm283x/mbox.c
index b77065ab305f..4959a1a652ec 100644
--- a/arch/arm/mach-bcm283x/mbox.c
+++ b/arch/arm/mach-bcm283x/mbox.c
@@ -151,7 +151,7 @@ int bcm2835_mbox_call_prop(u32 chan, struct bcm2835_mbox_hdr *buffer)
 	ret = bcm2835_mbox_call_raw(chan, buffer, &rbuffer);
 	if (ret)
 		return ret;
-	if (rbuffer != (u32)buffer) {
+	if (rbuffer != (uintptr_t)buffer) {
 		pr_err("mbox: Response buffer mismatch\n");
 		return -EIO;
 	}
diff --git a/images/Makefile.bcm283x b/images/Makefile.bcm283x
index b591cd58f563..f4ef7f447ccc 100644
--- a/images/Makefile.bcm283x
+++ b/images/Makefile.bcm283x
@@ -3,6 +3,10 @@
 # barebox image generation Makefile for BCM283x images
 #
 
+# New boards use board-dt-2nd.img as common binary
+# and have the videocore pass the correct DT.
+ifeq ($(CONFIG_32BIT),y)
+
 pblb-$(CONFIG_MACH_RPI) += start_raspberry_pi1
 FILE_barebox-raspberry-pi-1.img = start_raspberry_pi1.pblb
 image-$(CONFIG_MACH_RPI) += barebox-raspberry-pi-1.img
@@ -19,6 +23,8 @@ pblb-$(CONFIG_MACH_RPI_CM3) += start_raspberry_pi_cm3
 FILE_barebox-raspberry-pi-cm3.img = start_raspberry_pi_cm3.pblb
 image-$(CONFIG_MACH_RPI_CM3) += barebox-raspberry-pi-cm3.img
 
+endif
+
 pblb-$(CONFIG_MACH_RPI_COMMON) += start_raspberry_pi_generic
 FILE_barebox-raspberry-pi.img = start_raspberry_pi_generic.pblb
 image-$(CONFIG_MACH_RPI_COMMON) += barebox-raspberry-pi.img
-- 
2.30.2


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


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

* [PATCH v2 14/21] ARM: rpi: rpi3: disallow MMU_EARLY && 64BIT
  2022-06-09  5:59 [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support Ahmad Fatoum
                   ` (12 preceding siblings ...)
  2022-06-09  5:59 ` [PATCH v2 13/21] ARM: rpi: add Raspberry Pi 3 64-bit build support Ahmad Fatoum
@ 2022-06-09  5:59 ` Ahmad Fatoum
  2022-06-09  5:59 ` [PATCH v2 15/21] clk: rpi: add Raspberry Pi 4 support Ahmad Fatoum
                   ` (7 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Ahmad Fatoum @ 2022-06-09  5:59 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Early MMU setup in 64-bit Raspberry Pi 3 barebox hangs, while normal
setup concludes normally. Until this is figured out, disallow build
of 64-Bit Raspberry Pi 3 support while CONFIG_MMU_EARLY=y.

This issue doesn't affect the Raspberry Pi 4.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/mach-bcm283x/Kconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-bcm283x/Kconfig b/arch/arm/mach-bcm283x/Kconfig
index af34d1c973e1..38006424400e 100644
--- a/arch/arm/mach-bcm283x/Kconfig
+++ b/arch/arm/mach-bcm283x/Kconfig
@@ -41,11 +41,13 @@ config MACH_RPI3
 	bool "RaspberryPi 3 (BCM2837/CORTEX-A53)"
 	select MACH_RPI_AARCH_32_64
 	select MACH_RPI_COMMON
+	depends on 32BIT || (64BIT && !MMU_EARLY)
 
 config MACH_RPI_CM3
 	bool "RaspberryPi Compute Module 3 (BCM2837/CORTEX-A53)"
 	select MACH_RPI_AARCH_32_64
 	select MACH_RPI_COMMON
+	depends on 32BIT || (64BIT && !MMU_EARLY)
 
 endmenu
 
-- 
2.30.2


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


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

* [PATCH v2 15/21] clk: rpi: add Raspberry Pi 4 support
  2022-06-09  5:59 [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support Ahmad Fatoum
                   ` (13 preceding siblings ...)
  2022-06-09  5:59 ` [PATCH v2 14/21] ARM: rpi: rpi3: disallow MMU_EARLY && 64BIT Ahmad Fatoum
@ 2022-06-09  5:59 ` Ahmad Fatoum
  2022-06-09 13:58   ` Sascha Hauer
  2022-06-09  5:59 ` [PATCH v2 16/21] mci: bcm2835: add bcm2711-emmc2 (Rpi4) support Ahmad Fatoum
                   ` (6 subsequent siblings)
  21 siblings, 1 reply; 27+ messages in thread
From: Ahmad Fatoum @ 2022-06-09  5:59 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Our Raspberry Pi block driver is a hack, but it works well enough for
older Rpis and just needs one more clock to support the SD-Card on the
Raspberry Pi 4, so add that. In return, we remove bcm2835-cs, which we
won't use on Raspberry Pi 4, because we'll leverage the ARM architected
timer instead.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/mach-bcm283x/include/mach/mbox.h |  1 +
 drivers/clk/clk-rpi.c                     | 42 +++++++++++++++++------
 2 files changed, 32 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-bcm283x/include/mach/mbox.h b/arch/arm/mach-bcm283x/include/mach/mbox.h
index a9f06512bc23..46f9dfc9ea65 100644
--- a/arch/arm/mach-bcm283x/include/mach/mbox.h
+++ b/arch/arm/mach-bcm283x/include/mach/mbox.h
@@ -273,6 +273,7 @@ struct bcm2835_mbox_tag_set_power_state {
 #define BCM2835_MBOX_CLOCK_ID_SDRAM	8
 #define BCM2835_MBOX_CLOCK_ID_PIXEL	9
 #define BCM2835_MBOX_CLOCK_ID_PWM	10
+#define BCM2835_MBOX_CLOCK_ID_EMMC2	12
 
 struct bcm2835_mbox_tag_get_clock_rate {
 	struct bcm2835_mbox_tag_hdr tag_hdr;
diff --git a/drivers/clk/clk-rpi.c b/drivers/clk/clk-rpi.c
index 59ae8e59bac5..71badc04c0f0 100644
--- a/drivers/clk/clk-rpi.c
+++ b/drivers/clk/clk-rpi.c
@@ -40,10 +40,29 @@ static struct clk *rpi_register_firmware_clock(u32 clock_id, const char *name)
 	return clk_fixed(name, msg->get_clock_rate.body.resp.rate_hz);
 }
 
-static int bcm2835_cprman_probe(struct device_d *dev)
+static int bcm2835_cprman_init(struct device_d *dev)
 {
 	struct clk *clk_cs;
 
+	clk_cs = clk_fixed("bcm2835-cs", 1 * 1000 * 1000);
+	clk_register_clkdev(clk_cs, NULL, "bcm2835-cs");
+
+	return 0;
+}
+
+static int rpi_cprman_probe(struct device_d *dev)
+{
+	int (*init)(struct device_d *dev);
+
+	init = device_get_match_data(dev);
+	if (init) {
+		int ret;
+
+		ret = init(dev);
+		if (ret)
+			return ret;
+	}
+
 	clks[BCM2835_CLOCK_EMMC] =
 		rpi_register_firmware_clock(BCM2835_MBOX_CLOCK_ID_EMMC,
 					 "bcm2835_mci0");
@@ -56,12 +75,15 @@ static int bcm2835_cprman_probe(struct device_d *dev)
 	if (IS_ERR(clks[BCM2835_CLOCK_VPU]))
 		return PTR_ERR(clks[BCM2835_CLOCK_VPU]);
 
+	clks[BCM2711_CLOCK_EMMC2] =
+		rpi_register_firmware_clock(BCM2835_MBOX_CLOCK_ID_EMMC2,
+					 "bcm2711_emmc2");
+	if (IS_ERR(clks[BCM2711_CLOCK_EMMC2]))
+		return PTR_ERR(clks[BCM2711_CLOCK_EMMC2]);
+
 	clks[BCM2835_CLOCK_UART] = clk_fixed("uart0-pl0110", 48 * 1000 * 1000);
 	clk_register_clkdev(clks[BCM2835_CLOCK_UART], NULL, "uart0-pl0110");
 
-	clk_cs = clk_fixed("bcm2835-cs", 1 * 1000 * 1000);
-	clk_register_clkdev(clk_cs, NULL, "bcm2835-cs");
-
 	clk_data.clks = clks;
 	clk_data.clk_num = BCM2711_CLOCK_END;
 	of_clk_add_provider(dev->device_node, of_clk_src_onecell_get, &clk_data);
@@ -70,16 +92,14 @@ static int bcm2835_cprman_probe(struct device_d *dev)
 }
 
 static __maybe_unused struct of_device_id bcm2835_cprman_dt_ids[] = {
-	{
-		.compatible = "brcm,bcm2835-cprman",
-	}, {
-		/* sentinel */
-	}
+	{ .compatible = "brcm,bcm2835-cprman", .data = bcm2835_cprman_init },
+	{ .compatible = "brcm,bcm2711-cprman" },
+	{ /* sentinel */ }
 };
 
 static struct driver_d bcm2835_cprman_driver = {
-	.probe	= bcm2835_cprman_probe,
-	.name	= "bcm2835-cprman",
+	.probe	= rpi_cprman_probe,
+	.name	= "raspberrypi-cprman",
 	.of_compatible = DRV_OF_COMPAT(bcm2835_cprman_dt_ids),
 };
 core_platform_driver(bcm2835_cprman_driver);
-- 
2.30.2


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


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

* [PATCH v2 16/21] mci: bcm2835: add bcm2711-emmc2 (Rpi4) support
  2022-06-09  5:59 [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support Ahmad Fatoum
                   ` (14 preceding siblings ...)
  2022-06-09  5:59 ` [PATCH v2 15/21] clk: rpi: add Raspberry Pi 4 support Ahmad Fatoum
@ 2022-06-09  5:59 ` Ahmad Fatoum
  2022-06-09  5:59 ` [PATCH v2 17/21] clocksource: bcm2835: bump below architeced timer for AArch64 Ahmad Fatoum
                   ` (5 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Ahmad Fatoum @ 2022-06-09  5:59 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

While older Raspberry Pis didn't mind the POWER_CONTROL register being
0x00, the BCM2711 on the Raspberry Pi 4 does mind, so initialize it for
3.3V like we do in many other SDHCI drivers. With the compatible added,
this can access the SD-Card on the Raspberry Pi 4. Change tested on both
Raspberry Pi 3b and Raspberry Pi 4b.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/mci/mci-bcm2835.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mci/mci-bcm2835.c b/drivers/mci/mci-bcm2835.c
index 3380fa2afc18..f092156f9a83 100644
--- a/drivers/mci/mci-bcm2835.c
+++ b/drivers/mci/mci-bcm2835.c
@@ -324,7 +324,7 @@ static int bcm2835_mci_reset(struct mci_host *mci, struct device_d *mci_dev)
 
 	sdhci_write32(&host->sdhci,
 			SDHCI_HOST_CONTROL__POWER_CONTROL__BLOCK_GAP_CONTROL,
-			0x00);
+			(SDHCI_BUS_VOLTAGE_330 | SDHCI_BUS_POWER_EN) << 8);
 	sdhci_write32(&host->sdhci, SDHCI_ACMD12_ERR__HOST_CONTROL2,
 			0x00);
 	sdhci_write32(&host->sdhci,
@@ -423,6 +423,8 @@ static int bcm2835_mci_probe(struct device_d *hw_dev)
 static __maybe_unused struct of_device_id bcm2835_mci_compatible[] = {
 	{
 		.compatible = "brcm,bcm2835-sdhci",
+	}, {
+		.compatible = "brcm,bcm2711-emmc2",
 	}, {
 		/* sentinel */
 	}
-- 
2.30.2


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

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

* [PATCH v2 17/21] clocksource: bcm2835: bump below architeced timer for AArch64
  2022-06-09  5:59 [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support Ahmad Fatoum
                   ` (15 preceding siblings ...)
  2022-06-09  5:59 ` [PATCH v2 16/21] mci: bcm2835: add bcm2711-emmc2 (Rpi4) support Ahmad Fatoum
@ 2022-06-09  5:59 ` Ahmad Fatoum
  2022-06-09  5:59 ` [PATCH v2 18/21] ARM: rpi: add Raspberry Pi 4 support Ahmad Fatoum
                   ` (4 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Ahmad Fatoum @ 2022-06-09  5:59 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

We use the ARM architected timer on other ARMv8 platforms as well, so
let's do the same for the 64-bit Raspberry Pi configuration.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/clocksource/bcm2835.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clocksource/bcm2835.c b/drivers/clocksource/bcm2835.c
index d84341fc4083..d5d3e3477de3 100644
--- a/drivers/clocksource/bcm2835.c
+++ b/drivers/clocksource/bcm2835.c
@@ -28,7 +28,8 @@ static uint64_t stc_read_cycles(void)
 static struct clocksource bcm2835_stc = {
 	.read = stc_read_cycles,
 	.mask = CLOCKSOURCE_MASK(32),
-	.priority = 80,
+	/* Give the architected timer precedence on AArch64 */
+	.priority = IS_ENABLED(CONFIG_CPU_V8) ? 60 : 80,
 };
 
 static int bcm2835_cs_probe(struct device_d *dev)
-- 
2.30.2


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


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

* [PATCH v2 18/21] ARM: rpi: add Raspberry Pi 4 support
  2022-06-09  5:59 [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support Ahmad Fatoum
                   ` (16 preceding siblings ...)
  2022-06-09  5:59 ` [PATCH v2 17/21] clocksource: bcm2835: bump below architeced timer for AArch64 Ahmad Fatoum
@ 2022-06-09  5:59 ` Ahmad Fatoum
  2022-06-09  5:59 ` [PATCH v2 19/21] ARM: rpi: add debug_ll support for Raspberry Pi 4 Ahmad Fatoum
                   ` (3 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Ahmad Fatoum @ 2022-06-09  5:59 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

With basic driver support added in previous commits, add the boilerplate
to have barebox-raspberry-pi.img usable as bootloader for the Raspberry Pi 4
in 64-Bit mode. Tested peripherals:

  - SD-Card
  - pinctrl
  - clocksource
  - mini-UART

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 Documentation/boards/bcm2835.rst          |   5 +
 arch/arm/boards/raspberry-pi/lowlevel.c   |   6 ++
 arch/arm/boards/raspberry-pi/rpi-common.c |  17 ++++
 arch/arm/configs/rpi_v8a_defconfig        | 111 ++++++++++++++++++++++
 arch/arm/dts/Makefile                     |   1 +
 arch/arm/dts/bcm2711-rpi-4.dts            |  18 ++++
 arch/arm/mach-bcm283x/Kconfig             |   5 +
 arch/arm/mach-bcm283x/include/mach/mbox.h |   3 +
 8 files changed, 166 insertions(+)
 create mode 100644 arch/arm/configs/rpi_v8a_defconfig
 create mode 100644 arch/arm/dts/bcm2711-rpi-4.dts

diff --git a/Documentation/boards/bcm2835.rst b/Documentation/boards/bcm2835.rst
index a8eed9aec00d..2fa5d445d21d 100644
--- a/Documentation/boards/bcm2835.rst
+++ b/Documentation/boards/bcm2835.rst
@@ -4,6 +4,11 @@ Broadcom BCM283x
 Raspberry Pi
 ------------
 
+barebox supports has support for BCM283x-based Raspberry Pi single board
+computers. Support is most extensive for BCM283[567]. For the newer BCM2711
+used in the Raspberry Pi 4, only basic support is currently available
+(Serial Port, Pinctrl/GPIO, SD-Card).
+
   1. Prepare an SD or microSD card with a FAT filesystem of at least 30 MB in size.
 
   2. Download the `Raspberry Pi firmware`_ (120 MB), unzip it, and copy the
diff --git a/arch/arm/boards/raspberry-pi/lowlevel.c b/arch/arm/boards/raspberry-pi/lowlevel.c
index 40d36f0cff78..5ead8957676b 100644
--- a/arch/arm/boards/raspberry-pi/lowlevel.c
+++ b/arch/arm/boards/raspberry-pi/lowlevel.c
@@ -67,6 +67,7 @@ extern char __dtb_z_bcm2835_rpi_start[];
 extern char __dtb_z_bcm2836_rpi_2_start[];
 extern char __dtb_z_bcm2837_rpi_3_start[];
 extern char __dtb_z_bcm2837_rpi_cm3_start[];
+extern char __dtb_z_bcm2711_rpi_4_start[];
 
 RPI_ENTRY_FUNCTION(start_raspberry_pi1, SZ_128M, fdt)
 {
@@ -126,6 +127,11 @@ static void *rpi_get_board_fdt(int rev)
 	case BCM2837_BOARD_REV_CM3:
 	case BCM2837B0_BOARD_REV_CM3_PLUS:
 		return DT_IF_ENABLED(__dtb_z_bcm2837_rpi_cm3_start, CONFIG_MACH_RPI_CM3);
+
+	case BCM2711_BOARD_REV_4_B:
+	case BCM2711_BOARD_REV_400:
+	case BCM2711_BOARD_REV_CM4:
+		return DT_IF_ENABLED(__dtb_z_bcm2711_rpi_4_start, CONFIG_MACH_RPI4);
 	}
 
 	return NULL;
diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index 49728981ea71..2a95fac1630c 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -474,6 +474,18 @@ static const struct rpi_machine_data rpi_3_ids[] = {
 	},
 };
 
+static const struct rpi_machine_data rpi_4_ids[] = {
+	{
+		.hw_id = BCM2711_BOARD_REV_4_B,
+	}, {
+		.hw_id = BCM2711_BOARD_REV_400,
+	}, {
+		.hw_id = BCM2711_BOARD_REV_CM4,
+	}, {
+		.hw_id = U8_MAX
+	},
+};
+
 static const struct of_device_id rpi_of_match[] = {
 	/* BCM2835 based Boards */
 	{ .compatible = "raspberrypi,model-a", .data = rpi_1_ids },
@@ -498,6 +510,11 @@ static const struct of_device_id rpi_of_match[] = {
 	{ .compatible = "raspberrypi,3-compute-module", .data = rpi_3_ids },
 	{ .compatible = "raspberrypi,3-compute-module-lite", .data = rpi_3_ids },
 
+	/* BCM2711 based Boards */
+	{ .compatible = "raspberrypi,4-model-b", .data = rpi_4_ids },
+	{ .compatible = "raspberrypi,4-compute-module", .data = rpi_4_ids },
+	{ .compatible = "raspberrypi,400", .data = rpi_4_ids },
+
 	{ /* sentinel */ },
 };
 BAREBOX_DEEP_PROBE_ENABLE(rpi_of_match);
diff --git a/arch/arm/configs/rpi_v8a_defconfig b/arch/arm/configs/rpi_v8a_defconfig
new file mode 100644
index 000000000000..68cd2438b3fc
--- /dev/null
+++ b/arch/arm/configs/rpi_v8a_defconfig
@@ -0,0 +1,111 @@
+CONFIG_ARCH_BCM283X=y
+CONFIG_MACH_RPI3=y
+CONFIG_MACH_RPI_CM3=y
+CONFIG_MACH_RPI4=y
+CONFIG_64BIT=y
+CONFIG_IMAGE_COMPRESSION_NONE=y
+CONFIG_MMU=y
+# CONFIG_MMU_EARLY is not set
+CONFIG_MALLOC_SIZE=0x0
+CONFIG_MALLOC_TLSF=y
+CONFIG_KALLSYMS=y
+CONFIG_PROMPT="R-Pi> "
+CONFIG_HUSH_FANCY_PROMPT=y
+CONFIG_CMDLINE_EDITING=y
+CONFIG_AUTO_COMPLETE=y
+CONFIG_MENU=y
+CONFIG_BOOTM_SHOW_TYPE=y
+CONFIG_BOOTM_VERBOSE=y
+CONFIG_BOOTM_INITRD=y
+CONFIG_BOOTM_OFTREE=y
+CONFIG_BLSPEC=y
+CONFIG_CONSOLE_ACTIVATE_ALL=y
+CONFIG_CONSOLE_ALLOW_COLOR=y
+CONFIG_PBL_CONSOLE=y
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
+CONFIG_CMD_DMESG=y
+CONFIG_LONGHELP=y
+CONFIG_CMD_IOMEM=y
+CONFIG_CMD_IMD=y
+CONFIG_CMD_MEMINFO=y
+CONFIG_CMD_REGULATOR=y
+CONFIG_CMD_GO=y
+CONFIG_CMD_LOADB=y
+CONFIG_CMD_LOADY=y
+CONFIG_CMD_RESET=y
+CONFIG_CMD_UIMAGE=y
+CONFIG_CMD_PARTITION=y
+CONFIG_CMD_EXPORT=y
+CONFIG_CMD_DEFAULTENV=y
+CONFIG_CMD_LOADENV=y
+CONFIG_CMD_PRINTENV=y
+CONFIG_CMD_MAGICVAR=y
+CONFIG_CMD_MAGICVAR_HELP=y
+CONFIG_CMD_SAVEENV=y
+CONFIG_CMD_CMP=y
+CONFIG_CMD_FILETYPE=y
+CONFIG_CMD_LN=y
+CONFIG_CMD_MD5SUM=y
+CONFIG_CMD_SHA1SUM=y
+CONFIG_CMD_SHA256SUM=y
+CONFIG_CMD_UNCOMPRESS=y
+CONFIG_CMD_LET=y
+CONFIG_CMD_MSLEEP=y
+CONFIG_CMD_SLEEP=y
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_MIITOOL=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_ECHO_E=y
+CONFIG_CMD_EDIT=y
+CONFIG_CMD_LOGIN=y
+CONFIG_CMD_MENU=y
+CONFIG_CMD_MENU_MANAGEMENT=y
+CONFIG_CMD_PASSWD=y
+CONFIG_CMD_READLINE=y
+CONFIG_CMD_TIMEOUT=y
+CONFIG_CMD_CRC=y
+CONFIG_CMD_CRC_CMP=y
+CONFIG_CMD_MM=y
+CONFIG_CMD_CLK=y
+CONFIG_CMD_DETECT=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_LED=y
+CONFIG_CMD_LED_TRIGGER=y
+CONFIG_CMD_WD=y
+CONFIG_CMD_OF_NODE=y
+CONFIG_CMD_OF_PROPERTY=y
+CONFIG_CMD_OFTREE=y
+CONFIG_CMD_TIME=y
+CONFIG_NET=y
+CONFIG_SERIAL_AMBA_PL011=y
+CONFIG_DRIVER_SERIAL_NS16550=y
+CONFIG_NET_USB=y
+CONFIG_NET_USB_SMSC95XX=y
+CONFIG_USB_HOST=y
+CONFIG_USB_DWC2_HOST=y
+CONFIG_USB_DWC2_GADGET=y
+CONFIG_USB_GADGET=y
+# CONFIG_USB_GADGET_AUTOSTART is not set
+CONFIG_MCI=y
+CONFIG_MCI_BCM283X=y
+CONFIG_MCI_BCM283X_SDHOST=y
+CONFIG_LED=y
+CONFIG_LED_GPIO=y
+CONFIG_LED_GPIO_OF=y
+CONFIG_LED_TRIGGERS=y
+CONFIG_WATCHDOG=y
+CONFIG_WATCHDOG_BCM2835=y
+CONFIG_GPIO_RASPBERRYPI_EXP=y
+CONFIG_PINCTRL_BCM283X=y
+CONFIG_REGULATOR=y
+CONFIG_REGULATOR_FIXED=y
+CONFIG_GENERIC_PHY=y
+CONFIG_USB_NOP_XCEIV=y
+CONFIG_FS_EXT4=y
+CONFIG_FS_TFTP=y
+CONFIG_FS_NFS=y
+CONFIG_FS_FAT=y
+CONFIG_FS_FAT_WRITE=y
+CONFIG_FS_FAT_LFN=y
+CONFIG_ZLIB=y
+CONFIG_LZO_DECOMPRESS=y
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 723bd2a123e3..0c7e43e22672 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -114,6 +114,7 @@ lwl-$(CONFIG_MACH_RPI) += bcm2835-rpi.dtb.o
 lwl-$(CONFIG_MACH_RPI2) += bcm2836-rpi-2.dtb.o
 lwl-$(CONFIG_MACH_RPI3) += bcm2837-rpi-3.dtb.o
 lwl-$(CONFIG_MACH_RPI_CM3) += bcm2837-rpi-cm3.dtb.o
+lwl-$(CONFIG_MACH_RPI4) += bcm2711-rpi-4.dtb.o
 lwl-$(CONFIG_MACH_SABRELITE) += imx6q-sabrelite.dtb.o imx6dl-sabrelite.dtb.o
 lwl-$(CONFIG_MACH_SABRESD) += imx6q-sabresd.dtb.o imx6qp-sabresd.dtb.o
 lwl-$(CONFIG_MACH_FREESCALE_IMX6SX_SABRESDB) += imx6sx-sdb.dtb.o
diff --git a/arch/arm/dts/bcm2711-rpi-4.dts b/arch/arm/dts/bcm2711-rpi-4.dts
new file mode 100644
index 000000000000..3c0caa73f8f1
--- /dev/null
+++ b/arch/arm/dts/bcm2711-rpi-4.dts
@@ -0,0 +1,18 @@
+#include <arm64/broadcom/bcm2711-rpi-4-b.dts>
+
+&{/memory@0} {
+	reg = <0x0 0x0 0x0>;
+};
+
+&sdhci {
+	/* no use for SDIO WiFi in barebox */
+	status = "disabled";
+};
+
+&uart1 {
+	/* VPU core clock is reported at 200MHz, but needs to be 500Mhz
+	 * for ns16550 driver to set correct baudrate. Until that's
+	 * figured out, hardcode clock frequency to the expected value
+	 */
+	clock-frequency = <500000000>;
+};
diff --git a/arch/arm/mach-bcm283x/Kconfig b/arch/arm/mach-bcm283x/Kconfig
index 38006424400e..48209fb5c6bb 100644
--- a/arch/arm/mach-bcm283x/Kconfig
+++ b/arch/arm/mach-bcm283x/Kconfig
@@ -49,6 +49,11 @@ config MACH_RPI_CM3
 	select MACH_RPI_COMMON
 	depends on 32BIT || (64BIT && !MMU_EARLY)
 
+config MACH_RPI4
+	bool "RaspberryPi 4 (BCM2711/CORTEX-A72)"
+	select MACH_RPI_AARCH_32_64
+	select MACH_RPI_COMMON
+
 endmenu
 
 endif
diff --git a/arch/arm/mach-bcm283x/include/mach/mbox.h b/arch/arm/mach-bcm283x/include/mach/mbox.h
index 46f9dfc9ea65..92cadba62ca1 100644
--- a/arch/arm/mach-bcm283x/include/mach/mbox.h
+++ b/arch/arm/mach-bcm283x/include/mach/mbox.h
@@ -171,7 +171,10 @@ struct bcm2835_mbox_tag_hdr {
 #define BCM2837B0_BOARD_REV_3B_PLUS   	0x0d
 #define BCM2837B0_BOARD_REV_3A_PLUS   	0x0e
 #define BCM2837B0_BOARD_REV_CM3_PLUS	0x10
+#define BCM2711_BOARD_REV_4_B		0x11
 #define BCM2837B0_BOARD_REV_ZERO_2	0x12
+#define BCM2711_BOARD_REV_400		0x13
+#define BCM2711_BOARD_REV_CM4		0x14
 
 struct bcm2835_mbox_tag_get_board_rev {
 	struct bcm2835_mbox_tag_hdr tag_hdr;
-- 
2.30.2


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


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

* [PATCH v2 19/21] ARM: rpi: add debug_ll support for Raspberry Pi 4
  2022-06-09  5:59 [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support Ahmad Fatoum
                   ` (17 preceding siblings ...)
  2022-06-09  5:59 ` [PATCH v2 18/21] ARM: rpi: add Raspberry Pi 4 support Ahmad Fatoum
@ 2022-06-09  5:59 ` Ahmad Fatoum
  2022-06-09  5:59 ` [PATCH v2 20/21] doc: bcm283x: reference newer firmware Ahmad Fatoum
                   ` (2 subsequent siblings)
  21 siblings, 0 replies; 27+ messages in thread
From: Ahmad Fatoum @ 2022-06-09  5:59 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

The mini uart (Pins 8/10) is the primary UART on the Raspberry Pi 4 and
can be set up in firmware by specifying enable_uart=1 in the config.txt.

Add a DEBUG_LL implementation to use this for early debugging.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/mach-bcm283x/include/mach/debug_ll.h | 20 +++++++++++++++++++
 arch/arm/mach-bcm283x/include/mach/platform.h |  1 +
 common/Kconfig                                |  7 +++++++
 3 files changed, 28 insertions(+)

diff --git a/arch/arm/mach-bcm283x/include/mach/debug_ll.h b/arch/arm/mach-bcm283x/include/mach/debug_ll.h
index db23112aa07e..fdb63b4f5a40 100644
--- a/arch/arm/mach-bcm283x/include/mach/debug_ll.h
+++ b/arch/arm/mach-bcm283x/include/mach/debug_ll.h
@@ -18,6 +18,7 @@
 #define __MACH_BCM2835_DEBUG_LL_H__
 
 #include <mach/platform.h>
+#include <io.h>
 
 #ifdef CONFIG_DEBUG_RPI1_UART
 
@@ -66,6 +67,25 @@ static inline void debug_ll_init(void)
 	debug_ll_ns16550_init(divisor);
 }
 
+#elif defined CONFIG_DEBUG_RPI4_MINI_UART
+
+static inline uint8_t debug_ll_read_reg(int reg)
+{
+	return readb(BCM2711_MINIUART_BASE + (reg << 2));
+}
+
+static inline void debug_ll_write_reg(int reg, uint8_t val)
+{
+	writeb(val, BCM2711_MINIUART_BASE + (reg << 2));
+}
+
+#include <debug_ll/ns16550.h>
+
+static inline void debug_ll_init(void)
+{
+	/* Configured by ROM */
+}
+
 #else
 
 static inline void debug_ll_init(void)
diff --git a/arch/arm/mach-bcm283x/include/mach/platform.h b/arch/arm/mach-bcm283x/include/mach/platform.h
index 6917e1f345d7..b957ac8de35e 100644
--- a/arch/arm/mach-bcm283x/include/mach/platform.h
+++ b/arch/arm/mach-bcm283x/include/mach/platform.h
@@ -34,6 +34,7 @@
 #define BCM2836_PL011_BASE 0x3f201000UL
 #define BCM2835_MINIUART_BASE 0x20215040
 #define BCM2836_MINIUART_BASE 0x3f215040UL
+#define BCM2711_MINIUART_BASE 0xfe215040UL
 
 #endif
 
diff --git a/common/Kconfig b/common/Kconfig
index f7a6a96e877c..4054bd838dec 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1413,6 +1413,13 @@ config DEBUG_RPI3_MINI_UART
 	  Say Y here if you want low-level debugging support on
 	  RaspberryPi 3 board mini UART.
 
+config DEBUG_RPI4_MINI_UART
+	bool "RaspberryPi 4 mini UART"
+	depends on ARCH_BCM283X
+	help
+	  Say Y here if you want low-level debugging support on
+	  RaspberryPi 4 board mini UART.
+
 config DEBUG_ERIZO
 	bool "Erizo ns16550 port"
 	depends on SOC_ERIZO
-- 
2.30.2


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


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

* [PATCH v2 20/21] doc: bcm283x: reference newer firmware
  2022-06-09  5:59 [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support Ahmad Fatoum
                   ` (18 preceding siblings ...)
  2022-06-09  5:59 ` [PATCH v2 19/21] ARM: rpi: add debug_ll support for Raspberry Pi 4 Ahmad Fatoum
@ 2022-06-09  5:59 ` Ahmad Fatoum
  2022-06-09  5:59 ` [PATCH v2 21/21] ARM: rpi: use correct kernel8.img as name for 64-bit Ahmad Fatoum
  2022-06-10  8:33 ` [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support Sascha Hauer
  21 siblings, 0 replies; 27+ messages in thread
From: Ahmad Fatoum @ 2022-06-09  5:59 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

The old firmware can boot a Raspberry Pi 4 apparently, but it doesn't
contain bcm2711 device trees, so it's probably not an actually supported
configuration. Point at a newer firmware instead.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 Documentation/boards/bcm2835.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/boards/bcm2835.rst b/Documentation/boards/bcm2835.rst
index 2fa5d445d21d..f6df3e9e8064 100644
--- a/Documentation/boards/bcm2835.rst
+++ b/Documentation/boards/bcm2835.rst
@@ -11,7 +11,7 @@ used in the Raspberry Pi 4, only basic support is currently available
 
   1. Prepare an SD or microSD card with a FAT filesystem of at least 30 MB in size.
 
-  2. Download the `Raspberry Pi firmware`_ (120 MB), unzip it, and copy the
+  2. Download the `Raspberry Pi firmware`_ (195 MB), unzip it, and copy the
      contents of the ``boot/`` folder to your card.
 
   3. Use ``make rpi_defconfig; make`` to build barebox. This will create the following images:
@@ -58,5 +58,5 @@ The original command-line from VideoCore device tree is available to the Barebox
 
     global linux.bootargs.vc="$global.vc.bootargs"
 
-.. _Raspberry Pi firmware: https://codeload.github.com/raspberrypi/firmware/zip/80e1fbeb78f9df06701d28c0ed3a3060a3f557ef
+.. _Raspberry Pi firmware: https://github.com/raspberrypi/firmware/archive/refs/tags/1.20220331.zip
 .. _documentation for config.txt: https://www.raspberrypi.org/documentation/configuration/config-txt/
-- 
2.30.2


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


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

* [PATCH v2 21/21] ARM: rpi: use correct kernel8.img as name for 64-bit
  2022-06-09  5:59 [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support Ahmad Fatoum
                   ` (19 preceding siblings ...)
  2022-06-09  5:59 ` [PATCH v2 20/21] doc: bcm283x: reference newer firmware Ahmad Fatoum
@ 2022-06-09  5:59 ` Ahmad Fatoum
  2022-06-10  8:33 ` [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support Sascha Hauer
  21 siblings, 0 replies; 27+ messages in thread
From: Ahmad Fatoum @ 2022-06-09  5:59 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

This ensures boot rpi does the right thing on the Raspberry Pi 4.

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

diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index 2a95fac1630c..12a4f4a0addf 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -225,7 +225,7 @@ static int rpi_vc_fdt_bootargs(void *fdt)
 		globalvar_add_simple("vc.kernel", "kernel7.img");
 		break;
 	case CPU_ARCH_ARMv8:
-		globalvar_add_simple("vc.kernel", "kernel7l.img");
+		globalvar_add_simple("vc.kernel", "kernel8.img");
 		break;
 	}
 
-- 
2.30.2


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


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

* Re: [PATCH v2 15/21] clk: rpi: add Raspberry Pi 4 support
  2022-06-09  5:59 ` [PATCH v2 15/21] clk: rpi: add Raspberry Pi 4 support Ahmad Fatoum
@ 2022-06-09 13:58   ` Sascha Hauer
  2022-06-09 14:15     ` Ahmad Fatoum
  0 siblings, 1 reply; 27+ messages in thread
From: Sascha Hauer @ 2022-06-09 13:58 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Thu, Jun 09, 2022 at 07:59:16AM +0200, Ahmad Fatoum wrote:
> Our Raspberry Pi block driver is a hack, but it works well enough for

s/block/clock?

Sascha

> older Rpis and just needs one more clock to support the SD-Card on the
> Raspberry Pi 4, so add that. In return, we remove bcm2835-cs, which we
> won't use on Raspberry Pi 4, because we'll leverage the ARM architected
> timer instead.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  arch/arm/mach-bcm283x/include/mach/mbox.h |  1 +
>  drivers/clk/clk-rpi.c                     | 42 +++++++++++++++++------
>  2 files changed, 32 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/arm/mach-bcm283x/include/mach/mbox.h b/arch/arm/mach-bcm283x/include/mach/mbox.h
> index a9f06512bc23..46f9dfc9ea65 100644
> --- a/arch/arm/mach-bcm283x/include/mach/mbox.h
> +++ b/arch/arm/mach-bcm283x/include/mach/mbox.h
> @@ -273,6 +273,7 @@ struct bcm2835_mbox_tag_set_power_state {
>  #define BCM2835_MBOX_CLOCK_ID_SDRAM	8
>  #define BCM2835_MBOX_CLOCK_ID_PIXEL	9
>  #define BCM2835_MBOX_CLOCK_ID_PWM	10
> +#define BCM2835_MBOX_CLOCK_ID_EMMC2	12
>  
>  struct bcm2835_mbox_tag_get_clock_rate {
>  	struct bcm2835_mbox_tag_hdr tag_hdr;
> diff --git a/drivers/clk/clk-rpi.c b/drivers/clk/clk-rpi.c
> index 59ae8e59bac5..71badc04c0f0 100644
> --- a/drivers/clk/clk-rpi.c
> +++ b/drivers/clk/clk-rpi.c
> @@ -40,10 +40,29 @@ static struct clk *rpi_register_firmware_clock(u32 clock_id, const char *name)
>  	return clk_fixed(name, msg->get_clock_rate.body.resp.rate_hz);
>  }
>  
> -static int bcm2835_cprman_probe(struct device_d *dev)
> +static int bcm2835_cprman_init(struct device_d *dev)
>  {
>  	struct clk *clk_cs;
>  
> +	clk_cs = clk_fixed("bcm2835-cs", 1 * 1000 * 1000);
> +	clk_register_clkdev(clk_cs, NULL, "bcm2835-cs");
> +
> +	return 0;
> +}
> +
> +static int rpi_cprman_probe(struct device_d *dev)
> +{
> +	int (*init)(struct device_d *dev);
> +
> +	init = device_get_match_data(dev);
> +	if (init) {
> +		int ret;
> +
> +		ret = init(dev);
> +		if (ret)
> +			return ret;
> +	}
> +
>  	clks[BCM2835_CLOCK_EMMC] =
>  		rpi_register_firmware_clock(BCM2835_MBOX_CLOCK_ID_EMMC,
>  					 "bcm2835_mci0");
> @@ -56,12 +75,15 @@ static int bcm2835_cprman_probe(struct device_d *dev)
>  	if (IS_ERR(clks[BCM2835_CLOCK_VPU]))
>  		return PTR_ERR(clks[BCM2835_CLOCK_VPU]);
>  
> +	clks[BCM2711_CLOCK_EMMC2] =
> +		rpi_register_firmware_clock(BCM2835_MBOX_CLOCK_ID_EMMC2,
> +					 "bcm2711_emmc2");
> +	if (IS_ERR(clks[BCM2711_CLOCK_EMMC2]))
> +		return PTR_ERR(clks[BCM2711_CLOCK_EMMC2]);
> +
>  	clks[BCM2835_CLOCK_UART] = clk_fixed("uart0-pl0110", 48 * 1000 * 1000);
>  	clk_register_clkdev(clks[BCM2835_CLOCK_UART], NULL, "uart0-pl0110");
>  
> -	clk_cs = clk_fixed("bcm2835-cs", 1 * 1000 * 1000);
> -	clk_register_clkdev(clk_cs, NULL, "bcm2835-cs");
> -
>  	clk_data.clks = clks;
>  	clk_data.clk_num = BCM2711_CLOCK_END;
>  	of_clk_add_provider(dev->device_node, of_clk_src_onecell_get, &clk_data);
> @@ -70,16 +92,14 @@ static int bcm2835_cprman_probe(struct device_d *dev)
>  }
>  
>  static __maybe_unused struct of_device_id bcm2835_cprman_dt_ids[] = {
> -	{
> -		.compatible = "brcm,bcm2835-cprman",
> -	}, {
> -		/* sentinel */
> -	}
> +	{ .compatible = "brcm,bcm2835-cprman", .data = bcm2835_cprman_init },
> +	{ .compatible = "brcm,bcm2711-cprman" },
> +	{ /* sentinel */ }
>  };
>  
>  static struct driver_d bcm2835_cprman_driver = {
> -	.probe	= bcm2835_cprman_probe,
> -	.name	= "bcm2835-cprman",
> +	.probe	= rpi_cprman_probe,
> +	.name	= "raspberrypi-cprman",
>  	.of_compatible = DRV_OF_COMPAT(bcm2835_cprman_dt_ids),
>  };
>  core_platform_driver(bcm2835_cprman_driver);
> -- 
> 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] 27+ messages in thread

* Re: [PATCH v2 15/21] clk: rpi: add Raspberry Pi 4 support
  2022-06-09 13:58   ` Sascha Hauer
@ 2022-06-09 14:15     ` Ahmad Fatoum
  0 siblings, 0 replies; 27+ messages in thread
From: Ahmad Fatoum @ 2022-06-09 14:15 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 09.06.22 15:58, Sascha Hauer wrote:
> On Thu, Jun 09, 2022 at 07:59:16AM +0200, Ahmad Fatoum wrote:
>> Our Raspberry Pi block driver is a hack, but it works well enough for
> 
> s/block/clock?

aye.

> 
> Sascha
> 
>> older Rpis and just needs one more clock to support the SD-Card on the
>> Raspberry Pi 4, so add that. In return, we remove bcm2835-cs, which we
>> won't use on Raspberry Pi 4, because we'll leverage the ARM architected
>> timer instead.
>>
>> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
>> ---
>>  arch/arm/mach-bcm283x/include/mach/mbox.h |  1 +
>>  drivers/clk/clk-rpi.c                     | 42 +++++++++++++++++------
>>  2 files changed, 32 insertions(+), 11 deletions(-)
>>
>> diff --git a/arch/arm/mach-bcm283x/include/mach/mbox.h b/arch/arm/mach-bcm283x/include/mach/mbox.h
>> index a9f06512bc23..46f9dfc9ea65 100644
>> --- a/arch/arm/mach-bcm283x/include/mach/mbox.h
>> +++ b/arch/arm/mach-bcm283x/include/mach/mbox.h
>> @@ -273,6 +273,7 @@ struct bcm2835_mbox_tag_set_power_state {
>>  #define BCM2835_MBOX_CLOCK_ID_SDRAM	8
>>  #define BCM2835_MBOX_CLOCK_ID_PIXEL	9
>>  #define BCM2835_MBOX_CLOCK_ID_PWM	10
>> +#define BCM2835_MBOX_CLOCK_ID_EMMC2	12
>>  
>>  struct bcm2835_mbox_tag_get_clock_rate {
>>  	struct bcm2835_mbox_tag_hdr tag_hdr;
>> diff --git a/drivers/clk/clk-rpi.c b/drivers/clk/clk-rpi.c
>> index 59ae8e59bac5..71badc04c0f0 100644
>> --- a/drivers/clk/clk-rpi.c
>> +++ b/drivers/clk/clk-rpi.c
>> @@ -40,10 +40,29 @@ static struct clk *rpi_register_firmware_clock(u32 clock_id, const char *name)
>>  	return clk_fixed(name, msg->get_clock_rate.body.resp.rate_hz);
>>  }
>>  
>> -static int bcm2835_cprman_probe(struct device_d *dev)
>> +static int bcm2835_cprman_init(struct device_d *dev)
>>  {
>>  	struct clk *clk_cs;
>>  
>> +	clk_cs = clk_fixed("bcm2835-cs", 1 * 1000 * 1000);
>> +	clk_register_clkdev(clk_cs, NULL, "bcm2835-cs");
>> +
>> +	return 0;
>> +}
>> +
>> +static int rpi_cprman_probe(struct device_d *dev)
>> +{
>> +	int (*init)(struct device_d *dev);
>> +
>> +	init = device_get_match_data(dev);
>> +	if (init) {
>> +		int ret;
>> +
>> +		ret = init(dev);
>> +		if (ret)
>> +			return ret;
>> +	}
>> +
>>  	clks[BCM2835_CLOCK_EMMC] =
>>  		rpi_register_firmware_clock(BCM2835_MBOX_CLOCK_ID_EMMC,
>>  					 "bcm2835_mci0");
>> @@ -56,12 +75,15 @@ static int bcm2835_cprman_probe(struct device_d *dev)
>>  	if (IS_ERR(clks[BCM2835_CLOCK_VPU]))
>>  		return PTR_ERR(clks[BCM2835_CLOCK_VPU]);
>>  
>> +	clks[BCM2711_CLOCK_EMMC2] =
>> +		rpi_register_firmware_clock(BCM2835_MBOX_CLOCK_ID_EMMC2,
>> +					 "bcm2711_emmc2");
>> +	if (IS_ERR(clks[BCM2711_CLOCK_EMMC2]))
>> +		return PTR_ERR(clks[BCM2711_CLOCK_EMMC2]);
>> +
>>  	clks[BCM2835_CLOCK_UART] = clk_fixed("uart0-pl0110", 48 * 1000 * 1000);
>>  	clk_register_clkdev(clks[BCM2835_CLOCK_UART], NULL, "uart0-pl0110");
>>  
>> -	clk_cs = clk_fixed("bcm2835-cs", 1 * 1000 * 1000);
>> -	clk_register_clkdev(clk_cs, NULL, "bcm2835-cs");
>> -
>>  	clk_data.clks = clks;
>>  	clk_data.clk_num = BCM2711_CLOCK_END;
>>  	of_clk_add_provider(dev->device_node, of_clk_src_onecell_get, &clk_data);
>> @@ -70,16 +92,14 @@ static int bcm2835_cprman_probe(struct device_d *dev)
>>  }
>>  
>>  static __maybe_unused struct of_device_id bcm2835_cprman_dt_ids[] = {
>> -	{
>> -		.compatible = "brcm,bcm2835-cprman",
>> -	}, {
>> -		/* sentinel */
>> -	}
>> +	{ .compatible = "brcm,bcm2835-cprman", .data = bcm2835_cprman_init },
>> +	{ .compatible = "brcm,bcm2711-cprman" },
>> +	{ /* sentinel */ }
>>  };
>>  
>>  static struct driver_d bcm2835_cprman_driver = {
>> -	.probe	= bcm2835_cprman_probe,
>> -	.name	= "bcm2835-cprman",
>> +	.probe	= rpi_cprman_probe,
>> +	.name	= "raspberrypi-cprman",
>>  	.of_compatible = DRV_OF_COMPAT(bcm2835_cprman_dt_ids),
>>  };
>>  core_platform_driver(bcm2835_cprman_driver);
>> -- 
>> 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] 27+ messages in thread

* Re: [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support
  2022-06-09  5:59 [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support Ahmad Fatoum
                   ` (20 preceding siblings ...)
  2022-06-09  5:59 ` [PATCH v2 21/21] ARM: rpi: use correct kernel8.img as name for 64-bit Ahmad Fatoum
@ 2022-06-10  8:33 ` Sascha Hauer
  21 siblings, 0 replies; 27+ messages in thread
From: Sascha Hauer @ 2022-06-10  8:33 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Thu, Jun 09, 2022 at 07:59:01AM +0200, Ahmad Fatoum wrote:
> Just basic support, so we get a shell on mini-uart and SD
> working and can boot a Linux kernel with all cores usable.
> Needs more work for USB and Ethernet, but I'll leave that
> to others now that the initial hurdle is overcome.
> 
> I tested this series on Raspberry Pi 3b (both 32-bit and newly
> added 64-bit support) and Raspberry Pi 4b (both 32/64-bit).
> 
> v1 -> v2:
>   - add new common barebox-raspberry-pi.img that includes all
>     enabled DTs. The old approach with barebox-dt-2nd.img proved
>     inadequate, because VideoCore applied overlays to barebox DT,
>     when they were needed for the kernel and it made support
>     for Raspberry Pi kernel (with different bindings) harder.
>   - Use mailbox in PBL to determine which DT to use
>   - Use compressed DTBs
>   - fix breakage for existing 64-bit platforms due to
>     how CPU/SYS_SUPPORTS_64BIT_KERNEL was mishandled
>   - fix /env/boot/rpi for 64-bit
>   - replace ns16550 driver hack with DT hack

Applied, thanks

Sascha

> 
> Boot log:
> 
>   >Deep probe supported due to raspberrypi,4-model-b
>   Switch to console [cs0]
>   
>   
>   barebox 2022.05.0-00152-g628da31493e4 #14 Wed Jun 8 22:35:07 CEST 2022
>   
>   
>   Board: Raspberry Pi 4 Model B
>   Deep probe supported due to raspberrypi,4-model-b
>   reserved-memory: region /memreserve 0x00000000-0x00000fff
>   WARNING: dwc2 fe980000.usb@7e980000.of: dwc2_core_reset: Timeout!
>   Waiting for Core Soft Reset
>   ERROR: dwc2 fe980000.usb@7e980000.of: probe failed: Connection timed out
>   WARNING: bcm2835_mci fe340000.mmc@7e340000.of: Failed to get 'vmmc'
>   regulator (ignored).
>   bcm2835_mci fe340000.mmc@7e340000.of: registered as mci0
>   malloc space: 0x1d87f1e0 -> 0x3b0fe3bf (size 472.5 MiB)
>   mci0: detected SD card version 2.0
>   mci0: registered disk0
>   environment load /boot/barebox.env: No such file or directory
>   Maybe you have to create the partition.
> 
> Ahmad Fatoum (20):
>   ARM64: asm: implement read_cpuid_id()
>   dma: add dma_sync nop stubs for PBL
>   ARM: rpi: move bcm2835_add_device_sdram() into header
>   ARM: rpi: support PBL use of mbox
>   ARM: rpi: split out mbox helpers to share code with PBL
>   ARM: rpi: switch to ARM_USE_COMPRESSED_DTB
>   ARM: rpi: add generic Raspberry Pi image
>   ARM: rpi: support FDT in x0 for 64bit configurations
>   serial: ns16550: rpi: remove ungating now done by proper clk driver
>   ARM: cpu: prevent recursive dependencies via CPU_SUPPORTS_64BIT_KERNEL
>   ARM: cpu: remove unnecessary CONFIG_SYS_SUPPORTS_64BIT_KERNEL
>   ARM: cpu: remove unused SYS_SUPPORTS_32BIT_KERNEL
>   ARM: rpi: add Raspberry Pi 3 64-bit build support
>   ARM: rpi: rpi3: disallow MMU_EARLY && 64BIT
>   clk: rpi: add Raspberry Pi 4 support
>   clocksource: bcm2835: bump below architeced timer for AArch64
>   ARM: rpi: add Raspberry Pi 4 support
>   ARM: rpi: add debug_ll support for Raspberry Pi 4
>   doc: bcm283x: reference newer firmware
>   ARM: rpi: use correct kernel8.img as name for 64-bit
> 
> Uwe Kleine-König (1):
>   mci: bcm2835: add bcm2711-emmc2 (Rpi4) support
> 
>  Documentation/boards/bcm2835.rst              |  17 ++-
>  arch/arm/Kconfig                              |  10 +-
>  arch/arm/boards/raspberry-pi/Makefile         |   1 +
>  arch/arm/boards/raspberry-pi/lowlevel.c       | 129 +++++++++++++++---
>  arch/arm/boards/raspberry-pi/lowlevel.h       |   5 +
>  arch/arm/boards/raspberry-pi/mbox-helpers.c   |  73 ++++++++++
>  arch/arm/boards/raspberry-pi/rpi-common.c     | 129 ++++++------------
>  arch/arm/configs/rpi_v8a_defconfig            | 111 +++++++++++++++
>  arch/arm/cpu/Kconfig                          |   7 -
>  arch/arm/dts/Makefile                         |   1 +
>  arch/arm/dts/bcm2711-rpi-4.dts                |  18 +++
>  arch/arm/include/asm/cputype.h                |  22 ++-
>  arch/arm/include/asm/system_info.h            |   6 +
>  arch/arm/mach-bcm283x/Kconfig                 |  29 +++-
>  arch/arm/mach-bcm283x/Makefile                |   2 +-
>  arch/arm/mach-bcm283x/core.c                  |  57 ++++----
>  arch/arm/mach-bcm283x/include/mach/core.h     |  23 ++--
>  arch/arm/mach-bcm283x/include/mach/debug_ll.h |  26 ++++
>  arch/arm/mach-bcm283x/include/mach/mbox.h     |   4 +
>  arch/arm/mach-bcm283x/include/mach/platform.h |   5 +-
>  arch/arm/mach-bcm283x/mbox.c                  |  26 ++--
>  arch/arm/mach-imx/Kconfig                     |   2 +-
>  arch/arm/mach-layerscape/Kconfig              |   2 +-
>  arch/arm/mach-rockchip/Kconfig                |   2 +-
>  common/Kconfig                                |   7 +
>  drivers/clk/clk-rpi.c                         |  42 ++++--
>  drivers/clocksource/bcm2835.c                 |   3 +-
>  drivers/mci/mci-bcm2835.c                     |   4 +-
>  drivers/serial/serial_ns16550.c               |   4 -
>  images/Makefile.bcm283x                       |  10 ++
>  include/dma.h                                 |  19 +++
>  31 files changed, 593 insertions(+), 203 deletions(-)
>  create mode 100644 arch/arm/boards/raspberry-pi/mbox-helpers.c
>  create mode 100644 arch/arm/configs/rpi_v8a_defconfig
>  create mode 100644 arch/arm/dts/bcm2711-rpi-4.dts
> 
> -- 
> 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] 27+ messages in thread

* Re: [PATCH v2 02/21] dma: add dma_sync nop stubs for PBL
  2022-06-09  5:59 ` [PATCH v2 02/21] dma: add dma_sync nop stubs for PBL Ahmad Fatoum
@ 2022-06-14  8:49   ` Sascha Hauer
  2022-06-14  9:00     ` Ahmad Fatoum
  0 siblings, 1 reply; 27+ messages in thread
From: Sascha Hauer @ 2022-06-14  8:49 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Thu, Jun 09, 2022 at 07:59:03AM +0200, Ahmad Fatoum wrote:
> We can implement dma_sync functions as compiler barriers when we are
> certain that the buffers are in coherent/uncached memory, e.g. because
> MMU is only enabled in barebox_arm_entry which hasn't run yet.
> 
> This will come in handy when doing mailbox communication in PBL on the
> Raspberry Pi.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  include/dma.h | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/include/dma.h b/include/dma.h
> index 90f9254ea80f..aeaba7d9316d 100644
> --- a/include/dma.h
> +++ b/include/dma.h
> @@ -8,6 +8,7 @@
>  
>  #include <malloc.h>
>  #include <xfuncs.h>
> +#include <pbl.h>
>  #include <linux/kernel.h>
>  
>  #include <dma-dir.h>
> @@ -56,12 +57,30 @@ static inline int dma_mapping_error(struct device_d *dev, dma_addr_t dma_addr)
>  		(dev->dma_mask && dma_addr > dev->dma_mask);
>  }
>  
> +#ifndef __PBL__
>  /* streaming DMA - implement the below calls to support HAS_DMA */
>  void dma_sync_single_for_cpu(dma_addr_t address, size_t size,
>  			     enum dma_data_direction dir);
>  
>  void dma_sync_single_for_device(dma_addr_t address, size_t size,
>  				enum dma_data_direction dir);
> +#else
> +/*
> + * assumes buffers are in coherent/uncached memory, e.g. because
> + * MMU is only enabled in barebox_arm_entry which hasn't run yet.
> + */
> +static inline void dma_sync_single_for_cpu(dma_addr_t address, size_t size,
> +			     enum dma_data_direction dir)
> +{
> +	barrier_data((void *)address);
> +}
> +
> +static inline void dma_sync_single_for_device(dma_addr_t address, size_t size,
> +				enum dma_data_direction dir)
> +{
> +	barrier_data((void *)address);
> +}
> +#endif

This breaks compilation of socfpga-arria10_defconfig. We have these
stubs in arch/arm/include/asm/dma.h as well inside a #ifndef CONFIG_MMU.

Sascha

-- 
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] 27+ messages in thread

* Re: [PATCH v2 02/21] dma: add dma_sync nop stubs for PBL
  2022-06-14  8:49   ` Sascha Hauer
@ 2022-06-14  9:00     ` Ahmad Fatoum
  0 siblings, 0 replies; 27+ messages in thread
From: Ahmad Fatoum @ 2022-06-14  9:00 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 14.06.22 10:49, Sascha Hauer wrote:
> On Thu, Jun 09, 2022 at 07:59:03AM +0200, Ahmad Fatoum wrote:
>> We can implement dma_sync functions as compiler barriers when we are
>> certain that the buffers are in coherent/uncached memory, e.g. because
>> MMU is only enabled in barebox_arm_entry which hasn't run yet.
>>
>> This will come in handy when doing mailbox communication in PBL on the
>> Raspberry Pi.
>>
>> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
>> ---
>>  include/dma.h | 19 +++++++++++++++++++
>>  1 file changed, 19 insertions(+)
>>
>> diff --git a/include/dma.h b/include/dma.h
>> index 90f9254ea80f..aeaba7d9316d 100644
>> --- a/include/dma.h
>> +++ b/include/dma.h
>> @@ -8,6 +8,7 @@
>>  
>>  #include <malloc.h>
>>  #include <xfuncs.h>
>> +#include <pbl.h>
>>  #include <linux/kernel.h>
>>  
>>  #include <dma-dir.h>
>> @@ -56,12 +57,30 @@ static inline int dma_mapping_error(struct device_d *dev, dma_addr_t dma_addr)
>>  		(dev->dma_mask && dma_addr > dev->dma_mask);
>>  }
>>  
>> +#ifndef __PBL__
>>  /* streaming DMA - implement the below calls to support HAS_DMA */
>>  void dma_sync_single_for_cpu(dma_addr_t address, size_t size,
>>  			     enum dma_data_direction dir);
>>  
>>  void dma_sync_single_for_device(dma_addr_t address, size_t size,
>>  				enum dma_data_direction dir);
>> +#else
>> +/*
>> + * assumes buffers are in coherent/uncached memory, e.g. because
>> + * MMU is only enabled in barebox_arm_entry which hasn't run yet.
>> + */
>> +static inline void dma_sync_single_for_cpu(dma_addr_t address, size_t size,
>> +			     enum dma_data_direction dir)
>> +{
>> +	barrier_data((void *)address);
>> +}
>> +
>> +static inline void dma_sync_single_for_device(dma_addr_t address, size_t size,
>> +				enum dma_data_direction dir)
>> +{
>> +	barrier_data((void *)address);
>> +}
>> +#endif
> 
> This breaks compilation of socfpga-arria10_defconfig. We have these
> stubs in arch/arm/include/asm/dma.h as well inside a #ifndef CONFIG_MMU.

I am preparing a fix.

> 
> Sascha
> 


-- 
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] 27+ messages in thread

end of thread, other threads:[~2022-06-14  9:12 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-09  5:59 [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 01/21] ARM64: asm: implement read_cpuid_id() Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 02/21] dma: add dma_sync nop stubs for PBL Ahmad Fatoum
2022-06-14  8:49   ` Sascha Hauer
2022-06-14  9:00     ` Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 03/21] ARM: rpi: move bcm2835_add_device_sdram() into header Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 04/21] ARM: rpi: support PBL use of mbox Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 05/21] ARM: rpi: split out mbox helpers to share code with PBL Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 06/21] ARM: rpi: switch to ARM_USE_COMPRESSED_DTB Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 07/21] ARM: rpi: add generic Raspberry Pi image Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 08/21] ARM: rpi: support FDT in x0 for 64bit configurations Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 09/21] serial: ns16550: rpi: remove ungating now done by proper clk driver Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 10/21] ARM: cpu: prevent recursive dependencies via CPU_SUPPORTS_64BIT_KERNEL Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 11/21] ARM: cpu: remove unnecessary CONFIG_SYS_SUPPORTS_64BIT_KERNEL Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 12/21] ARM: cpu: remove unused SYS_SUPPORTS_32BIT_KERNEL Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 13/21] ARM: rpi: add Raspberry Pi 3 64-bit build support Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 14/21] ARM: rpi: rpi3: disallow MMU_EARLY && 64BIT Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 15/21] clk: rpi: add Raspberry Pi 4 support Ahmad Fatoum
2022-06-09 13:58   ` Sascha Hauer
2022-06-09 14:15     ` Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 16/21] mci: bcm2835: add bcm2711-emmc2 (Rpi4) support Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 17/21] clocksource: bcm2835: bump below architeced timer for AArch64 Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 18/21] ARM: rpi: add Raspberry Pi 4 support Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 19/21] ARM: rpi: add debug_ll support for Raspberry Pi 4 Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 20/21] doc: bcm283x: reference newer firmware Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 21/21] ARM: rpi: use correct kernel8.img as name for 64-bit Ahmad Fatoum
2022-06-10  8:33 ` [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox