Just basic support, so we get a shell on mini-uart and SD working. 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). @Oleksij, could you give this a test on Raspberry Pi 2 as well? barebox-dt-2nd.img is the image to use for all configurations. barebox didn't start up (or at least serial was silent) with Daily built Debian raspi_4_bullseye.img. Worked fine though with firmware in 2022-04-04-raspios-bullseye-arm64-lite.img. If in doubt, use firmware described in barebox documentation. Boot log: barebox 2022.04.0-00101-g5fea3e8979b2 #205 Tue May 3 09:33:54 CEST 2022 Board: Raspberry Pi 4 Model B Rev 1.1 Deep probe supported due to raspberrypi,4-model-b bcm2835_mci fe300000.mmc@7e300000.of: registered as mci0 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 mci1 ERROR: translation of DMA address(400000000) to CPU address failed node(pcie@7d500000) malloc space: 0x1d8fc800 -> 0x3b1f8fff (size 473 MiB) mci1: detected SD card version 2.0 mci1: registered disk0 environment load /boot/barebox.env: No such file or directory Maybe you have to create the partition. Ahmad Fatoum (13): PBL: fdt: fix /memory parsing when #address-cells != #size-cells serial: ns16550: rpi: remove ungating now done by proper clk driver ARM: cpu: prevent recursive dependencies via CPU_SUPPORTS_64BIT_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 serial: ns16550: rpi: skip baudrate changes for bcm2711 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 ARM: rpi: add heuristic for skipping detection of SDIO card doc: bcm283x: add initial docs for Raspberry Pi 4 support doc: bcm283x: reference newer firmware Uwe Kleine-König (2): of: address: fix printing of OF node name in error message mci: bcm2835: add bcm2711-emmc2 (Rpi4) support Documentation/boards/bcm2835.rst | 65 ++++++++-- arch/arm/Kconfig | 4 + arch/arm/boards/raspberry-pi/rpi-common.c | 51 +++++++- arch/arm/configs/rpi_v8a_defconfig | 111 ++++++++++++++++++ arch/arm/cpu/Kconfig | 1 - arch/arm/dts/Makefile | 1 + arch/arm/dts/bcm2711-rpi-4-b.dts | 1 + arch/arm/mach-bcm283x/Kconfig | 28 ++++- arch/arm/mach-bcm283x/include/mach/debug_ll.h | 21 ++++ arch/arm/mach-bcm283x/include/mach/mbox.h | 4 + arch/arm/mach-bcm283x/include/mach/platform.h | 5 +- arch/arm/mach-bcm283x/mbox.c | 2 +- common/Kconfig | 7 ++ drivers/clk/clk-rpi.c | 42 +++++-- drivers/clocksource/bcm2835.c | 3 +- drivers/mci/mci-bcm2835.c | 4 +- drivers/of/address.c | 4 +- drivers/serial/serial_ns16550.c | 18 ++- images/Makefile.bcm283x | 6 + pbl/fdt.c | 2 +- 20 files changed, 341 insertions(+), 39 deletions(-) create mode 100644 arch/arm/configs/rpi_v8a_defconfig create mode 100644 arch/arm/dts/bcm2711-rpi-4-b.dts -- 2.30.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Due to a typo, this code assumed so far ignored #size-cells and assumed it to be equal to #address-cells. This breaks using the barebox-dt-2nd.img with some 64-bit device trees like the Raspberry Pi's. Fixes: ffb0344b7410 ("ARM: Add generic device tree 2nd stage support") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- pbl/fdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pbl/fdt.c b/pbl/fdt.c index 51719698f269..8e4d1295074a 100644 --- a/pbl/fdt.c +++ b/pbl/fdt.c @@ -47,7 +47,7 @@ void fdt_find_mem(const void *fdt, unsigned long *membase, unsigned long *memsiz pr_err("Cannot find #size-cells property"); goto err; } - ns = fdt32_to_cpu(*nap); + ns = fdt32_to_cpu(*nsp); /* Find the memory range */ node = fdt_node_offset_by_prop_value(fdt, -1, "device_type", -- 2.30.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> barebox has no %pOF. Open code this instance to yield a better error message. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- drivers/of/address.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/of/address.c b/drivers/of/address.c index 67e8062f5d17..bcee7d5d9bc2 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c @@ -670,8 +670,8 @@ int of_dma_get_range(struct device_node *np, u64 *dma_addr, u64 *paddr, u64 *siz dmaaddr = of_read_number(ranges, naddr); *paddr = of_translate_dma_address(node, ranges + naddr); if (*paddr == OF_BAD_ADDR) { - pr_err("translation of DMA address(%llx) to CPU address failed node(%pOF)\n", - dmaaddr, np); + pr_err("translation of DMA address(%llx) to CPU address failed node(%s)\n", + dmaaddr, np->name); ret = -EINVAL; goto out; } -- 2.30.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
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
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. It thus makes no sense to select it from CPU_V8 and it's actually 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/cpu/Kconfig | 1 - 1 file changed, 1 deletion(-) 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 -- 2.30.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
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 | 4 ++++ 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, 30 insertions(+), 7 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 299e0ab08049..ff970e537aec 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -60,6 +60,10 @@ config ARCH_BCM283X select OFTREE select OFDEVICE select HAVE_PBL_MULTI_IMAGES + select CPU_SUPPORTS_64BIT_KERNEL + select SYS_SUPPORTS_64BIT_KERNEL + select CPU_SUPPORTS_32BIT_KERNEL + select SYS_SUPPORTS_32BIT_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 75acee8dad56..4ffaef694d2f 100644 --- a/arch/arm/mach-bcm283x/Kconfig +++ b/arch/arm/mach-bcm283x/Kconfig @@ -9,29 +9,42 @@ config ARCH_TEXT_BASE config MACH_RPI_COMMON bool +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 4b14afcfe45b..3a029b8eb33f 100644 --- a/arch/arm/mach-bcm283x/mbox.c +++ b/arch/arm/mach-bcm283x/mbox.c @@ -143,7 +143,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 82787f972c2d..4c04133bc571 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 @@ -18,3 +22,5 @@ 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 + +endif -- 2.30.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
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 4ffaef694d2f..535af3300fe2 100644 --- a/arch/arm/mach-bcm283x/Kconfig +++ b/arch/arm/mach-bcm283x/Kconfig @@ -40,11 +40,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
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
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
Current state of the driver leads to garbled output after divisor configuration, likely due to wrong clock rate. We so far blissfully ignored proper clock handling in barebox instead relying on firmware and fixed clocks. As the VideoCore firmware can already setup the mini-uart, we can continue wearing the blinders and just disable baudrate changes for the BCM2711 for now to fix console on the Raspberry Pi 4. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- drivers/serial/serial_ns16550.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c index e936711bf816..82acb76793cb 100644 --- a/drivers/serial/serial_ns16550.c +++ b/drivers/serial/serial_ns16550.c @@ -153,6 +153,12 @@ static void ns16550_write(struct console_device *cdev, uint32_t val, priv->write_reg(priv, val, off << plat->shift); } +static bool ns16550_has_fixed_brg(struct console_device *cdev) +{ + /* We don't yet support baudrate switching on Rpi 4 */ + return IS_ENABLED(CONFIG_MACH_RPI_COMMON) && of_machine_is_compatible("brcm,bcm2711"); +} + /** * @brief Compute the divisor for a baud rate * @@ -250,7 +256,9 @@ static void rpi_init_port(struct console_device *cdev) * (instead of 8 required by the BCM2835 peripheral manual) */ priv->plat.clock = priv->plat.clock*2; - ns16550_serial_init_port(cdev); + + if (!ns16550_has_fixed_brg(cdev)) + ns16550_serial_init_port(cdev); } /*********** Exposed Functions **********************************/ @@ -490,10 +498,12 @@ static int ns16550_probe(struct device_d *dev) cdev->tstc = ns16550_tstc; cdev->putc = ns16550_putc; cdev->getc = ns16550_getc; - cdev->setbrg = ns16550_setbaudrate; cdev->flush = ns16550_flush; cdev->linux_console_name = devtype->linux_console_name; + if (!ns16550_has_fixed_brg(cdev)) + cdev->setbrg = ns16550_setbaudrate; + priv->fcrval = FCRVAL; devtype->init_port(cdev); -- 2.30.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
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
With basic driver support added in previous commits, add the boilerplate to have barebox-dt-2nd.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> --- arch/arm/boards/raspberry-pi/rpi-common.c | 29 ++++++ arch/arm/configs/rpi_v8a_defconfig | 111 ++++++++++++++++++++++ arch/arm/dts/Makefile | 1 + arch/arm/dts/bcm2711-rpi-4-b.dts | 1 + arch/arm/mach-bcm283x/Kconfig | 5 + arch/arm/mach-bcm283x/include/mach/mbox.h | 3 + 6 files changed, 150 insertions(+) create mode 100644 arch/arm/configs/rpi_v8a_defconfig create mode 100644 arch/arm/dts/bcm2711-rpi-4-b.dts diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c index 41ef7d16773e..0db03098e564 100644 --- a/arch/arm/boards/raspberry-pi/rpi-common.c +++ b/arch/arm/boards/raspberry-pi/rpi-common.c @@ -604,6 +604,30 @@ static const struct rpi_machine_data rpi_model_zero_2_w[] = { }, }; +static const struct rpi_machine_data rpi_4_model_b[] = { + { + .hw_id = BCM2711_BOARD_REV_4_B, + }, { + .hw_id = U8_MAX + }, +}; + +static const struct rpi_machine_data rpi_400[] = { + { + .hw_id = BCM2711_BOARD_REV_400, + }, { + .hw_id = U8_MAX + }, +}; + +static const struct rpi_machine_data rpi_compute_module_4[] = { + { + .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_model_a }, @@ -628,6 +652,11 @@ static const struct of_device_id rpi_of_match[] = { { .compatible = "raspberrypi,3-compute-module", .data = rpi_compute_module_3 }, { .compatible = "raspberrypi,3-compute-module-lite", .data = rpi_compute_module_3 }, + /* BCM2711 based Boards */ + { .compatible = "raspberrypi,4-model-b", .data = rpi_4_model_b }, + { .compatible = "raspberrypi,4-compute-module", .data = rpi_compute_module_4 }, + { .compatible = "raspberrypi,400", .data = rpi_400 }, + { /* 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 e0177d84e4e2..a2fa45d3441b 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -111,6 +111,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-b.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-b.dts b/arch/arm/dts/bcm2711-rpi-4-b.dts new file mode 100644 index 000000000000..73b3330313db --- /dev/null +++ b/arch/arm/dts/bcm2711-rpi-4-b.dts @@ -0,0 +1 @@ +#include <arm64/broadcom/bcm2711-rpi-4-b.dts> diff --git a/arch/arm/mach-bcm283x/Kconfig b/arch/arm/mach-bcm283x/Kconfig index 535af3300fe2..e297f1ff9c2b 100644 --- a/arch/arm/mach-bcm283x/Kconfig +++ b/arch/arm/mach-bcm283x/Kconfig @@ -48,6 +48,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
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 | 21 +++++++++++++++++++ arch/arm/mach-bcm283x/include/mach/platform.h | 1 + common/Kconfig | 7 +++++++ 3 files changed, 29 insertions(+) diff --git a/arch/arm/mach-bcm283x/include/mach/debug_ll.h b/arch/arm/mach-bcm283x/include/mach/debug_ll.h index 4bfa5abc7c41..e4274e5279a5 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,26 @@ 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 */ +} + #endif #endif /* __MACH_BCM2835_DEBUG_LL_H__ */ 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
mci0 is normally the WiFi while mci1 is the SD-Card on the Raspberry Pi 4. The proper way would be to use aliases, but as we accept device trees from outside, we can apply a simple heuristic to disfavor the SDIO controller: The SDIO controller tends to have a child node. If this is not the case, use mci0 as before. As probing the SDIO in barebox leads to many annoying error messages, disable its detection, so device_detect_all done by ifup -a (which doesn't find the Ethernet controller yet), doesn't spam the console. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- arch/arm/boards/raspberry-pi/rpi-common.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c index 0db03098e564..efa3157d61b9 100644 --- a/arch/arm/boards/raspberry-pi/rpi-common.c +++ b/arch/arm/boards/raspberry-pi/rpi-common.c @@ -230,13 +230,31 @@ static int rpi_mem_init(void) } mem_initcall(rpi_mem_init); +static bool mci_hwdev_has_child(struct device_d *dev) +{ + return dev && dev->parent && dev->parent->device_node && + of_get_next_available_child(dev->parent->device_node, NULL); +} + static int rpi_env_init(void) { struct stat s; const char *diskdev = "/dev/disk0.0"; - int ret; + int ret = -ENODEV; - device_detect_by_name("mci0"); + struct device_d *mci0dev = get_device_by_name("mci0"); + if (mci0dev) { + struct device_d *mci1dev = get_device_by_name("mci1"); + + if (mci_hwdev_has_child(mci0dev) && mci1dev && + !mci_hwdev_has_child(mci1dev)) + ret = device_detect(mci1dev); + + if (ret) + device_detect(mci0dev); + else + mci0dev->detect = mci0dev->parent->detect = NULL; + } ret = stat(diskdev, &s); if (ret) { -- 2.30.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Separate out the barebox-dt-2nd documentation. There's much duplication that way, but as we intend to remove the board-specific raspberry pi images, this is ok for now. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- Documentation/boards/bcm2835.rst | 61 +++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 5 deletions(-) diff --git a/Documentation/boards/bcm2835.rst b/Documentation/boards/bcm2835.rst index 0b5299a34078..b27c6f34a50b 100644 --- a/Documentation/boards/bcm2835.rst +++ b/Documentation/boards/bcm2835.rst @@ -4,6 +4,17 @@ Broadcom BCM283x Raspberry Pi ------------ +barebox supports has support for BCM283x-based Raspberry Pi single board +computers. Support is most extensive for BCM283[567]. Forthe newer BCM2711 +used in the Raspberry Pi 4, only basic support is available currently +(Serial Port @115200 Baud, Pinctrl, SD-Card). + +Legacy Raspberry Pi Images +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This format will be eventually phased out in favor of using the generic +``barebox-dt-2nd.img`` binary for all configurations. + 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 @@ -19,11 +30,6 @@ Raspberry Pi Copy the respective image for your model to your SD card and name it ``barebox.img``. - Alternatively, ``images/barebox-dt-2nd.img`` can be used as single bootloader for all - supported 32-bit boards. In this case the device tree supplied by the video core - is directly used by barebox to probe. The device trees in ``arch/arm/dts/*.dtb`` - will need to be renamed for alignment with the naming scheme expected by the videocore. - 4. Create a text file ``config.txt`` on the SD card with the following content:: kernel=barebox.img @@ -53,5 +59,50 @@ The original command-line from VideoCore device tree is available to the Barebox global linux.bootargs.vc="$global.vc.bootargs" +Generic DT image +~~~~~~~~~~~~~~~~ + + 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 + contents of the ``boot/`` folder to your card. + + 3. Use ``make rpi_defconfig; make`` to build barebox for 32-Bit or ``make rpi_v8a_defconfig; make`` to build it for 64-Bit + + This will create ``images/barebox-dt-2nd.img``, which can be used as single bootloader + for all supported 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. + (left is name in FAT, right is name used by barebox, here in genimage syntax):: + + file bcm2836-rpi-2-b.dtb { image = bcm2836-rpi-2.dtb } + file bcm2836-rpi-2-b.dtb { image = bcm2836-rpi-2.dtb } + file bcm2837-rpi-3-b.dtb { image = bcm2837-rpi-3.dtb } + file bcm2837-rpi-3-a-plus.dtb { image = bcm2837-rpi-3.dtb } + file bcm2837-rpi-3-b-plus.dtb { image = bcm2837-rpi-3.dtb } + file bcm2837-rpi-cm3-io3.dtb { image = bcm2837-rpi-cm3.dtb } + file bcm2711-rpi-4-b.dtb { image = bcm2711-rpi-4-b.dtb } + + 4. Create a text file ``config.txt`` on the SD card with the following content:: + + kernel=barebox-dt-2nd.img + arm_64bit=1 # remove for 32-bit mode + upstream_kernel=1 # use upstream DT file names + enable_uart=1 + + If you want to use the mini-uart instead of the PL011, you may need to additionally set:: + + uart_2ndstage=1 + + This is required on boards, like the Raspberry Pi Zero W, that use the mini-uart as the + primary UART. It is needed on boards like the CM3 as well if the mini-uart is to be used. + + (For more information, refer to the `documentation for config.txt`_.) + + 5. Connect to board's UART (115200 8N1); + Use PIN6 (GND), PIN8 (UART_TX), PIN10 (UART_RX) pins. + + 6. Turn board's power on. + .. _Raspberry Pi firmware: https://codeload.github.com/raspberrypi/firmware/zip/80e1fbeb78f9df06701d28c0ed3a3060a3f557ef .. _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
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 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/boards/bcm2835.rst b/Documentation/boards/bcm2835.rst index b27c6f34a50b..d082e35618ec 100644 --- a/Documentation/boards/bcm2835.rst +++ b/Documentation/boards/bcm2835.rst @@ -17,7 +17,7 @@ This format will be eventually phased out in favor of using the generic 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: @@ -64,7 +64,7 @@ Generic DT image 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 for 32-Bit or ``make rpi_v8a_defconfig; make`` to build it for 64-Bit @@ -104,5 +104,5 @@ Generic DT image 6. Turn board's power on. -.. _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
Hi, On 05.05.22 10:01, Ahmad Fatoum wrote: > Just basic support, so we get a shell on mini-uart and SD > working. 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). > > @Oleksij, could you give this a test on Raspberry Pi 2 as well? > > barebox-dt-2nd.img is the image to use for all configurations. > barebox didn't start up (or at least serial was silent) with > Daily built Debian raspi_4_bullseye.img. Worked fine though > with firmware in 2022-04-04-raspios-bullseye-arm64-lite.img. > If in doubt, use firmware described in barebox documentation. We discussed this on the mailing list a bit and I see now that barebox-dt-2nd.img may not be the best way forward for Raspberry Pi: Many users are depending on the VideoCore to apply overlays and the VideoCore has special magic when applying specific overlays, e.g. turning on USB PHY for dwc2 when applying dwc2 overlay. While we could apply overlays in barebox, this would add extra complexity (e.g. parse config.txt) and using same device tree for kernel and barebox may not be feasible, because of differing bindings, e.g. when using the Raspberry Pi kernel instead of mainline. I'll instead build a new raspberry pi specific image with multiple device trees embedded for v2. This may allow removing some quirky stuff in this series too. Cheers, Ahmad > > Boot log: > > barebox 2022.04.0-00101-g5fea3e8979b2 #205 Tue May 3 09:33:54 CEST 2022 > > > Board: Raspberry Pi 4 Model B Rev 1.1 > Deep probe supported due to raspberrypi,4-model-b > bcm2835_mci fe300000.mmc@7e300000.of: registered as mci0 > 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 mci1 > ERROR: translation of DMA address(400000000) to CPU address failed node(pcie@7d500000) > malloc space: 0x1d8fc800 -> 0x3b1f8fff (size 473 MiB) > mci1: detected SD card version 2.0 > mci1: registered disk0 > environment load /boot/barebox.env: No such file or directory > Maybe you have to create the partition. > > Ahmad Fatoum (13): > PBL: fdt: fix /memory parsing when #address-cells != #size-cells > serial: ns16550: rpi: remove ungating now done by proper clk driver > ARM: cpu: prevent recursive dependencies via CPU_SUPPORTS_64BIT_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 > serial: ns16550: rpi: skip baudrate changes for bcm2711 > 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 > ARM: rpi: add heuristic for skipping detection of SDIO card > doc: bcm283x: add initial docs for Raspberry Pi 4 support > doc: bcm283x: reference newer firmware > > Uwe Kleine-König (2): > of: address: fix printing of OF node name in error message > mci: bcm2835: add bcm2711-emmc2 (Rpi4) support > > Documentation/boards/bcm2835.rst | 65 ++++++++-- > arch/arm/Kconfig | 4 + > arch/arm/boards/raspberry-pi/rpi-common.c | 51 +++++++- > arch/arm/configs/rpi_v8a_defconfig | 111 ++++++++++++++++++ > arch/arm/cpu/Kconfig | 1 - > arch/arm/dts/Makefile | 1 + > arch/arm/dts/bcm2711-rpi-4-b.dts | 1 + > arch/arm/mach-bcm283x/Kconfig | 28 ++++- > arch/arm/mach-bcm283x/include/mach/debug_ll.h | 21 ++++ > arch/arm/mach-bcm283x/include/mach/mbox.h | 4 + > arch/arm/mach-bcm283x/include/mach/platform.h | 5 +- > arch/arm/mach-bcm283x/mbox.c | 2 +- > common/Kconfig | 7 ++ > drivers/clk/clk-rpi.c | 42 +++++-- > drivers/clocksource/bcm2835.c | 3 +- > drivers/mci/mci-bcm2835.c | 4 +- > drivers/of/address.c | 4 +- > drivers/serial/serial_ns16550.c | 18 ++- > images/Makefile.bcm283x | 6 + > pbl/fdt.c | 2 +- > 20 files changed, 341 insertions(+), 39 deletions(-) > create mode 100644 arch/arm/configs/rpi_v8a_defconfig > create mode 100644 arch/arm/dts/bcm2711-rpi-4-b.dts > -- 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