[PATCH] MAINTAINERS: add RaspberryPi co-maintainer
From: Matthias Brugger Peter accpeted to step up as a co-maintainer for the RPis. Reflect that in the corresponding MAINTAINERS files. Signed-off-by: Matthias Brugger --- MAINTAINERS | 1 + board/raspberrypi/rpi/MAINTAINERS | 1 + 2 files changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index bc9081b62a9..f9f4eeda1c2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -192,6 +192,7 @@ N: aspeed ARM BROADCOM BCM283X / BCM27XX M: Matthias Brugger +M: Peter Robinson S: Maintained F: arch/arm/dts/bcm283* F: arch/arm/mach-bcm283x/ diff --git a/board/raspberrypi/rpi/MAINTAINERS b/board/raspberrypi/rpi/MAINTAINERS index 4f1b23efc8e..98935119f0a 100644 --- a/board/raspberrypi/rpi/MAINTAINERS +++ b/board/raspberrypi/rpi/MAINTAINERS @@ -1,5 +1,6 @@ RPI BOARD M: Matthias Brugger +M: Peter Robinson S: Maintained F: board/raspberrypi/rpi/ F: include/configs/rpi.h -- 2.38.1
[PATCH] doc: board: raspberrypi: Add documentation
From: Matthias Brugger Add documentation about the different configuration files for the RaspberryPi board family. Signed-off-by: Matthias Brugger --- doc/board/raspberrypi/index.rst | 10 + doc/board/raspberrypi/raspberrypi.rst | 53 +++ 2 files changed, 63 insertions(+) create mode 100644 doc/board/raspberrypi/index.rst create mode 100644 doc/board/raspberrypi/raspberrypi.rst diff --git a/doc/board/raspberrypi/index.rst b/doc/board/raspberrypi/index.rst new file mode 100644 index 00..7a283d81af --- /dev/null +++ b/doc/board/raspberrypi/index.rst @@ -0,0 +1,10 @@ +.. SPDX-License-Identifier: GPL-2.0+ +.. Copyright (C) 2022 Matthias Brugger + +Raspberry Pi + + +.. toctree:: + :maxdepth: 2 + + raspberrypi diff --git a/doc/board/raspberrypi/raspberrypi.rst b/doc/board/raspberrypi/raspberrypi.rst new file mode 100644 index 00..219a780e15 --- /dev/null +++ b/doc/board/raspberrypi/raspberrypi.rst @@ -0,0 +1,53 @@ +.. SPDX-License-Identifier: GPL-2.0+ +.. Copyright (C) 2022 Matthias Brugger + +RASPBERRY PI + + +About this +-- + +This document describes the information about Raspberry PI boards +and it's usage steps. + +Raspberry Pi boards +--- + +List of mainline supported Rasbperry Pi boards through the following configs: + +32-bits: + + +* rpi_defconfig + - Raspberry Pi +* rpi_0_w_defconfig + - Raspberry Pi 1 + - Raspberry Pi zero +* rpi_2_defconfig + - Raspberry Pi 2 +* rpi_3_32b_defconfig + - Raspberry Pi 3b +* rpi_4_32b_defconfig + - Raspberry Pi 4b + +64-bits: + + +* rpi_3_defconfig + - Raspberry Pi 3b +* rpi_3_b_plus_defconfig + - Raspberry Pi 3b+ +* rpi_4_defconfig + - Raspberry Pi 4b +* rpi_arm64_defconfig + - Raspberry Pi 3b + - Raspberry Pi 3b+ + - Raspberry Pi 4b + - Raspberry Pi 400 + - Raspberry Pi CM 3 + - Raspberry Pi CM 3+ + - Raspberry Pi CM 4 + - Raspberry Pi zero 2 w + +Config rpi_arm64_defconfig uses the DTB proviede by the firmware instead of using the embedded one. It allows to actually boot the same U-Boot binary of different boards. + -- 2.34.1
[PATCH v2 2/2] configs: rpi: Enable SMBIOS sysinfo driver
From: Matthias Brugger Enable this driver to allow U-Boot to get SMBIOS table information from a device tree node. Signed-off-by: Matthias Brugger Acked-by: Fabian Vogt --- Changes in v2: - fix typo in commit message configs/rpi_0_w_defconfig | 2 ++ configs/rpi_2_defconfig| 2 ++ configs/rpi_3_32b_defconfig| 2 ++ configs/rpi_3_b_plus_defconfig | 2 ++ configs/rpi_3_defconfig| 2 ++ configs/rpi_4_32b_defconfig| 2 ++ configs/rpi_4_defconfig| 2 ++ configs/rpi_arm64_defconfig| 2 ++ configs/rpi_defconfig | 2 ++ 9 files changed, 18 insertions(+) diff --git a/configs/rpi_0_w_defconfig b/configs/rpi_0_w_defconfig index c0a9b6c788..206be1590c 100644 --- a/configs/rpi_0_w_defconfig +++ b/configs/rpi_0_w_defconfig @@ -28,6 +28,8 @@ CONFIG_DM_ETH=y CONFIG_PINCTRL=y # CONFIG_PINCTRL_GENERIC is not set # CONFIG_REQUIRE_SERIAL_CONSOLE is not set +CONFIG_SYSINFO=y +CONFIG_SYSINFO_SMBIOS=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_DWC2=y diff --git a/configs/rpi_2_defconfig b/configs/rpi_2_defconfig index 33e0ef6989..d3d62f3028 100644 --- a/configs/rpi_2_defconfig +++ b/configs/rpi_2_defconfig @@ -28,6 +28,8 @@ CONFIG_DM_ETH=y CONFIG_PINCTRL=y # CONFIG_PINCTRL_GENERIC is not set # CONFIG_REQUIRE_SERIAL_CONSOLE is not set +CONFIG_SYSINFO=y +CONFIG_SYSINFO_SMBIOS=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_DWC2=y diff --git a/configs/rpi_3_32b_defconfig b/configs/rpi_3_32b_defconfig index 15c62adc69..b69bc05833 100644 --- a/configs/rpi_3_32b_defconfig +++ b/configs/rpi_3_32b_defconfig @@ -30,6 +30,8 @@ CONFIG_DM_ETH=y CONFIG_PINCTRL=y # CONFIG_PINCTRL_GENERIC is not set # CONFIG_REQUIRE_SERIAL_CONSOLE is not set +CONFIG_SYSINFO=y +CONFIG_SYSINFO_SMBIOS=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_DWC2=y diff --git a/configs/rpi_3_b_plus_defconfig b/configs/rpi_3_b_plus_defconfig index ebab0b4f86..8316a43116 100644 --- a/configs/rpi_3_b_plus_defconfig +++ b/configs/rpi_3_b_plus_defconfig @@ -30,6 +30,8 @@ CONFIG_DM_ETH=y CONFIG_PINCTRL=y # CONFIG_PINCTRL_GENERIC is not set # CONFIG_REQUIRE_SERIAL_CONSOLE is not set +CONFIG_SYSINFO=y +CONFIG_SYSINFO_SMBIOS=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_DWC2=y diff --git a/configs/rpi_3_defconfig b/configs/rpi_3_defconfig index daeb6d1b64..bdfac3f31a 100644 --- a/configs/rpi_3_defconfig +++ b/configs/rpi_3_defconfig @@ -30,6 +30,8 @@ CONFIG_DM_ETH=y CONFIG_PINCTRL=y # CONFIG_PINCTRL_GENERIC is not set # CONFIG_REQUIRE_SERIAL_CONSOLE is not set +CONFIG_SYSINFO=y +CONFIG_SYSINFO_SMBIOS=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_DWC2=y diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig index 0cbdd5fee1..7a10d4b0d4 100644 --- a/configs/rpi_4_32b_defconfig +++ b/configs/rpi_4_32b_defconfig @@ -39,6 +39,8 @@ CONFIG_DM_RESET=y CONFIG_DM_RNG=y CONFIG_RNG_IPROC200=y # CONFIG_REQUIRE_SERIAL_CONSOLE is not set +CONFIG_SYSINFO=y +CONFIG_SYSINFO_SMBIOS=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_DM_USB_GADGET=y diff --git a/configs/rpi_4_defconfig b/configs/rpi_4_defconfig index 3f21f99edb..5d889df794 100644 --- a/configs/rpi_4_defconfig +++ b/configs/rpi_4_defconfig @@ -39,6 +39,8 @@ CONFIG_DM_RESET=y CONFIG_DM_RNG=y CONFIG_RNG_IPROC200=y # CONFIG_REQUIRE_SERIAL_CONSOLE is not set +CONFIG_SYSINFO=y +CONFIG_SYSINFO_SMBIOS=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_DM_USB_GADGET=y diff --git a/configs/rpi_arm64_defconfig b/configs/rpi_arm64_defconfig index d282d509ce..af45178962 100644 --- a/configs/rpi_arm64_defconfig +++ b/configs/rpi_arm64_defconfig @@ -36,6 +36,8 @@ CONFIG_DM_RESET=y CONFIG_DM_RNG=y CONFIG_RNG_IPROC200=y # CONFIG_REQUIRE_SERIAL_CONSOLE is not set +CONFIG_SYSINFO=y +CONFIG_SYSINFO_SMBIOS=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_XHCI_HCD=y diff --git a/configs/rpi_defconfig b/configs/rpi_defconfig index 06b390d907..af084c8505 100644 --- a/configs/rpi_defconfig +++ b/configs/rpi_defconfig @@ -28,6 +28,8 @@ CONFIG_DM_ETH=y CONFIG_PINCTRL=y # CONFIG_PINCTRL_GENERIC is not set # CONFIG_REQUIRE_SERIAL_CONSOLE is not set +CONFIG_SYSINFO=y +CONFIG_SYSINFO_SMBIOS=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_DWC2=y -- 2.30.2
[PATCH v2 1/2] arm: dts: bcm283x: Add minimal smbios information
From: Matthias Brugger At present SMBIOS tables are empty, which breaks some use-cases that rely on that. Add some minimal information to fulfill this. Signed-off-by: Matthias Brugger --- Changes in v2: - drop product from chassi - fix typo in commit message arch/arm/dts/bcm283x-u-boot.dtsi | 19 +++ 1 file changed, 19 insertions(+) diff --git a/arch/arm/dts/bcm283x-u-boot.dtsi b/arch/arm/dts/bcm283x-u-boot.dtsi index 68d03627f4..22c67c4218 100644 --- a/arch/arm/dts/bcm283x-u-boot.dtsi +++ b/arch/arm/dts/bcm283x-u-boot.dtsi @@ -6,6 +6,25 @@ * (C) Copyright 2016 Fabian Vogt */ +/ { + smbios { + compatible = "u-boot,sysinfo-smbios"; + smbios { + system { + manufacturer = "raspberrypi"; + product = "rpi"; + }; + baseboard { + manufacturer = "raspberrypi"; + product = "rpi"; + }; + chassis { + manufacturer = "raspberrypi"; + }; + }; + }; +}; + { skip-init; u-boot,dm-pre-reloc; -- 2.30.2
[PATCH 2/2] configs: rpi: Enable SMBIOS sysinfo driver
From: Matthias Brugger Enalbe this driver to allow U-Boot to get SMBIOS table information from a device tree node. Signed-off-by: Matthias Brugger --- configs/rpi_0_w_defconfig | 2 ++ configs/rpi_2_defconfig| 2 ++ configs/rpi_3_32b_defconfig| 2 ++ configs/rpi_3_b_plus_defconfig | 2 ++ configs/rpi_3_defconfig| 2 ++ configs/rpi_4_32b_defconfig| 2 ++ configs/rpi_4_defconfig| 2 ++ configs/rpi_arm64_defconfig| 2 ++ configs/rpi_defconfig | 2 ++ 9 files changed, 18 insertions(+) diff --git a/configs/rpi_0_w_defconfig b/configs/rpi_0_w_defconfig index c0a9b6c788..206be1590c 100644 --- a/configs/rpi_0_w_defconfig +++ b/configs/rpi_0_w_defconfig @@ -28,6 +28,8 @@ CONFIG_DM_ETH=y CONFIG_PINCTRL=y # CONFIG_PINCTRL_GENERIC is not set # CONFIG_REQUIRE_SERIAL_CONSOLE is not set +CONFIG_SYSINFO=y +CONFIG_SYSINFO_SMBIOS=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_DWC2=y diff --git a/configs/rpi_2_defconfig b/configs/rpi_2_defconfig index 33e0ef6989..d3d62f3028 100644 --- a/configs/rpi_2_defconfig +++ b/configs/rpi_2_defconfig @@ -28,6 +28,8 @@ CONFIG_DM_ETH=y CONFIG_PINCTRL=y # CONFIG_PINCTRL_GENERIC is not set # CONFIG_REQUIRE_SERIAL_CONSOLE is not set +CONFIG_SYSINFO=y +CONFIG_SYSINFO_SMBIOS=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_DWC2=y diff --git a/configs/rpi_3_32b_defconfig b/configs/rpi_3_32b_defconfig index 15c62adc69..b69bc05833 100644 --- a/configs/rpi_3_32b_defconfig +++ b/configs/rpi_3_32b_defconfig @@ -30,6 +30,8 @@ CONFIG_DM_ETH=y CONFIG_PINCTRL=y # CONFIG_PINCTRL_GENERIC is not set # CONFIG_REQUIRE_SERIAL_CONSOLE is not set +CONFIG_SYSINFO=y +CONFIG_SYSINFO_SMBIOS=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_DWC2=y diff --git a/configs/rpi_3_b_plus_defconfig b/configs/rpi_3_b_plus_defconfig index ebab0b4f86..8316a43116 100644 --- a/configs/rpi_3_b_plus_defconfig +++ b/configs/rpi_3_b_plus_defconfig @@ -30,6 +30,8 @@ CONFIG_DM_ETH=y CONFIG_PINCTRL=y # CONFIG_PINCTRL_GENERIC is not set # CONFIG_REQUIRE_SERIAL_CONSOLE is not set +CONFIG_SYSINFO=y +CONFIG_SYSINFO_SMBIOS=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_DWC2=y diff --git a/configs/rpi_3_defconfig b/configs/rpi_3_defconfig index daeb6d1b64..bdfac3f31a 100644 --- a/configs/rpi_3_defconfig +++ b/configs/rpi_3_defconfig @@ -30,6 +30,8 @@ CONFIG_DM_ETH=y CONFIG_PINCTRL=y # CONFIG_PINCTRL_GENERIC is not set # CONFIG_REQUIRE_SERIAL_CONSOLE is not set +CONFIG_SYSINFO=y +CONFIG_SYSINFO_SMBIOS=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_DWC2=y diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig index 0cbdd5fee1..7a10d4b0d4 100644 --- a/configs/rpi_4_32b_defconfig +++ b/configs/rpi_4_32b_defconfig @@ -39,6 +39,8 @@ CONFIG_DM_RESET=y CONFIG_DM_RNG=y CONFIG_RNG_IPROC200=y # CONFIG_REQUIRE_SERIAL_CONSOLE is not set +CONFIG_SYSINFO=y +CONFIG_SYSINFO_SMBIOS=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_DM_USB_GADGET=y diff --git a/configs/rpi_4_defconfig b/configs/rpi_4_defconfig index 3f21f99edb..5d889df794 100644 --- a/configs/rpi_4_defconfig +++ b/configs/rpi_4_defconfig @@ -39,6 +39,8 @@ CONFIG_DM_RESET=y CONFIG_DM_RNG=y CONFIG_RNG_IPROC200=y # CONFIG_REQUIRE_SERIAL_CONSOLE is not set +CONFIG_SYSINFO=y +CONFIG_SYSINFO_SMBIOS=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_DM_USB_GADGET=y diff --git a/configs/rpi_arm64_defconfig b/configs/rpi_arm64_defconfig index d282d509ce..af45178962 100644 --- a/configs/rpi_arm64_defconfig +++ b/configs/rpi_arm64_defconfig @@ -36,6 +36,8 @@ CONFIG_DM_RESET=y CONFIG_DM_RNG=y CONFIG_RNG_IPROC200=y # CONFIG_REQUIRE_SERIAL_CONSOLE is not set +CONFIG_SYSINFO=y +CONFIG_SYSINFO_SMBIOS=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_XHCI_HCD=y diff --git a/configs/rpi_defconfig b/configs/rpi_defconfig index 06b390d907..af084c8505 100644 --- a/configs/rpi_defconfig +++ b/configs/rpi_defconfig @@ -28,6 +28,8 @@ CONFIG_DM_ETH=y CONFIG_PINCTRL=y # CONFIG_PINCTRL_GENERIC is not set # CONFIG_REQUIRE_SERIAL_CONSOLE is not set +CONFIG_SYSINFO=y +CONFIG_SYSINFO_SMBIOS=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_DWC2=y -- 2.30.2
[PATCH 1/2] arm: dts: bcm283x: Add minimal smbios information
From: Matthias Brugger At present SMBIOS tables are emtpy, which breaks some use-cases that rely on that. Add some minimal information to fullfill this. Signed-off-by: Matthias Brugger --- arch/arm/dts/bcm283x-u-boot.dtsi | 20 1 file changed, 20 insertions(+) diff --git a/arch/arm/dts/bcm283x-u-boot.dtsi b/arch/arm/dts/bcm283x-u-boot.dtsi index 68d03627f4..f5235cb083 100644 --- a/arch/arm/dts/bcm283x-u-boot.dtsi +++ b/arch/arm/dts/bcm283x-u-boot.dtsi @@ -6,6 +6,26 @@ * (C) Copyright 2016 Fabian Vogt */ +/ { + smbios { + compatible = "u-boot,sysinfo-smbios"; + smbios { + system { + manufacturer = "raspberrypi"; + product = "rpi"; + }; + baseboard { + manufacturer = "raspberrypi"; + product = "rpi"; + }; + chassis { + manufacturer = "raspberrypi"; + product = "rpi"; + }; + }; + }; +}; + { skip-init; u-boot,dm-pre-reloc; -- 2.30.2
[PATCH v2] smbios: Fix table when no string is present
From: Matthias Brugger When no string is present in a table, next_ptr points to the same location as eos. When calculating the string table length, we would only reserve one \0. By spec a SMBIOS table has to end with two \0\0 when no strings a present. Signed-off-by: Matthias Brugger --- Changes in v2: - check in smbios_string_table_len if no string present and return value accordingly lib/smbios.c | 4 1 file changed, 4 insertions(+) diff --git a/lib/smbios.c b/lib/smbios.c index 9eb226ec9f..fd57d8694f 100644 --- a/lib/smbios.c +++ b/lib/smbios.c @@ -191,6 +191,10 @@ int smbios_update_version(const char *version) */ static int smbios_string_table_len(const struct smbios_ctx *ctx) { + /* In case no string is defined we have to return two \0 */ + if (ctx->next_ptr == ctx->eos) + return 2; + /* Allow for the final \0 after all strings */ return (ctx->next_ptr + 1) - ctx->eos; } -- 2.30.2
[PATCH] smbios: Fix table when no string is present
From: Matthias Brugger When no string is present in a table, next_ptr points to the same location as eos. When calculating the string table length, we would only reserve one \0. By spec a SMBIOS table has to end with two \0\0 when no strings a present. Signed-off-by: Matthias Brugger --- lib/smbios.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/smbios.c b/lib/smbios.c index 7d463c84a9..d21d37cdac 100644 --- a/lib/smbios.c +++ b/lib/smbios.c @@ -153,7 +153,7 @@ static int smbios_add_prop(struct smbios_ctx *ctx, const char *prop) static void smbios_set_eos(struct smbios_ctx *ctx, char *eos) { ctx->eos = eos; - ctx->next_ptr = eos; + ctx->next_ptr = eos + 1; ctx->last_str = NULL; } -- 2.30.2
[PATCH 2/2] configs: rpi4_32: Enable iProc RNG200
From: Matthias Brugger Enable the RNG driver for RPi4 with 32 bit. Signed-off-by: Matthias Brugger --- configs/rpi_4_32b_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig index 0a5d3ff8cd..91eeb3cd32 100644 --- a/configs/rpi_4_32b_defconfig +++ b/configs/rpi_4_32b_defconfig @@ -37,6 +37,8 @@ CONFIG_PCI_BRCMSTB=y CONFIG_PINCTRL=y # CONFIG_PINCTRL_GENERIC is not set CONFIG_DM_RESET=y +CONFIG_DM_RNG=y +CONFIG_RNG_IPROC200=y # CONFIG_REQUIRE_SERIAL_CONSOLE is not set CONFIG_USB=y CONFIG_DM_USB=y -- 2.30.0
[PATCH 1/2] rng: iproc_rng200: Enable support for RPi4 armv7
From: Matthias Brugger On the RPi4 armv7 build we have the situationt that we use physical addresses of 64 bit, while the virtual addresses are 32 bit. Remap the base address in this scenario via map_physmem(). Signed-off-by: Matthias Brugger --- drivers/rng/iproc_rng200.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/rng/iproc_rng200.c b/drivers/rng/iproc_rng200.c index 1126bbd797..85ac15bf9c 100644 --- a/drivers/rng/iproc_rng200.c +++ b/drivers/rng/iproc_rng200.c @@ -34,12 +34,12 @@ #define RNG_FIFO_COUNT_RNG_FIFO_COUNT_MASK 0x00FF struct iproc_rng200_plat { - fdt_addr_t base; + void __iomem *base; }; static void iproc_rng200_enable(struct iproc_rng200_plat *pdata, bool enable) { - fdt_addr_t rng_base = pdata->base; + void __iomem *rng_base = pdata->base; u32 val; val = readl(rng_base + RNG_CTRL_OFFSET); @@ -54,7 +54,7 @@ static void iproc_rng200_enable(struct iproc_rng200_plat *pdata, bool enable) static void iproc_rng200_restart(struct iproc_rng200_plat *pdata) { - fdt_addr_t rng_base = pdata->base; + void __iomem *rng_base = pdata->base; u32 val; iproc_rng200_enable(pdata, false); @@ -156,7 +156,7 @@ static int iproc_rng200_of_to_plat(struct udevice *dev) { struct iproc_rng200_plat *pdata = dev_get_plat(dev); - pdata->base = dev_read_addr(dev); + pdata->base = devfdt_map_physmem(dev, sizeof(void *)); if (!pdata->base) return -ENODEV; -- 2.30.0
[PATCH] MAINTAINERS: Update info for Raspberry Pi
From: Matthias Brugger Add RPi config files and custodian repository. Signed-off-by: Matthias Brugger --- MAINTAINERS | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index b82b7adbeb..15929bf4ee 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -160,7 +160,7 @@ F: drivers/clk/aspeed/ F: drivers/pinctrl/aspeed/ N: aspeed -ARM BROADCOM BCM283X +ARM BROADCOM BCM283X / BCM27XX M: Matthias Brugger S: Maintained F: arch/arm/dts/bcm283* @@ -175,6 +175,8 @@ F: drivers/video/bcm2835.c F: include/dm/platform_data/serial_bcm283x_mu.h F: include/dt-bindings/pinctrl/bcm2835.h F: drivers/pinctrl/broadcom/ +F: configs/rpi_* +T: git https://source.denx.de/u-boot/custodians/u-boot-arm.git ARM BROADCOM BCMSTB M: Thomas Fitzsimmons -- 2.30.0
[PATCH 2/2] configs: RPi2: Disable EFI Grub workaround
From: Matthias Brugger The EFI Grub workaround isn't needed with Grub version 2.04 or higher. This version was published over a year ago, so disable the workaround to reduce boot time. Signed-off-by: Matthias Brugger --- configs/rpi_2_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/rpi_2_defconfig b/configs/rpi_2_defconfig index 33f27cf09f..a0f36e1a93 100644 --- a/configs/rpi_2_defconfig +++ b/configs/rpi_2_defconfig @@ -42,3 +42,4 @@ CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_CONSOLE_SCROLL_LINES=10 CONFIG_PHYS_TO_BUS=y CONFIG_OF_LIBFDT_OVERLAY=y +# CONFIG_EFI_GRUB_ARM32_WORKAROUND is not set -- 2.30.0
[PATCH 1/2] configs: BPI-R2: Disable EFI Grub workaround
From: Matthias Brugger The EFI Grub workaround on BananaPi R2 slows down the boot process to the point, that the watchdog will trigger a reboot before the kernel can reset it. Fix this by disabeling the workaround. Signed-off-by: Matthias Brugger --- configs/mt7623n_bpir2_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/mt7623n_bpir2_defconfig b/configs/mt7623n_bpir2_defconfig index d36ff560cf..fb20cb1832 100644 --- a/configs/mt7623n_bpir2_defconfig +++ b/configs/mt7623n_bpir2_defconfig @@ -53,3 +53,4 @@ CONFIG_TIMER=y CONFIG_MTK_TIMER=y CONFIG_WDT_MTK=y CONFIG_LZMA=y +# CONFIG_EFI_GRUB_ARM32_WORKAROUND is not set -- 2.30.0
[RFC PATCH] efi_loader: disable GRUB workaround by default
From: Matthias Brugger GRUB version 2.04 was published over a year ago. We should expect that distros use this version now. So disable the workaround by default. As we know that i.MX6 CPUs lack proper handling of caches, enable the workaround on these only. Signed-off-by: Matthias Brugger --- configs/imx6dl_icore_nand_defconfig | 1 + configs/imx6dl_mamoj_defconfig | 1 + configs/imx6q_icore_nand_defconfig | 1 + configs/imx6q_logic_defconfig| 1 + configs/imx6qdl_icore_mipi_defconfig | 1 + configs/imx6qdl_icore_mmc_defconfig | 1 + configs/imx6qdl_icore_nand_defconfig | 1 + configs/imx6qdl_icore_rqs_defconfig | 1 + configs/imx6ul_geam_mmc_defconfig| 1 + configs/imx6ul_geam_nand_defconfig | 1 + configs/imx6ul_isiot_emmc_defconfig | 1 + configs/imx6ul_isiot_nand_defconfig | 1 + lib/efi_loader/Kconfig | 2 +- 13 files changed, 13 insertions(+), 1 deletion(-) diff --git a/configs/imx6dl_icore_nand_defconfig b/configs/imx6dl_icore_nand_defconfig index 06005c4288..44fbbe6bd1 100644 --- a/configs/imx6dl_icore_nand_defconfig +++ b/configs/imx6dl_icore_nand_defconfig @@ -68,3 +68,4 @@ CONFIG_SPLASH_SCREEN=y CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_VIDEO_BMP_RLE8=y CONFIG_BMP_16BPP=y +CONFIG_EFI_GRUB_ARM32_WORKAROUND=y diff --git a/configs/imx6dl_mamoj_defconfig b/configs/imx6dl_mamoj_defconfig index fa2adaf47d..7ebbb5830b 100644 --- a/configs/imx6dl_mamoj_defconfig +++ b/configs/imx6dl_mamoj_defconfig @@ -57,3 +57,4 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y +CONFIG_EFI_GRUB_ARM32_WORKAROUND=y diff --git a/configs/imx6q_icore_nand_defconfig b/configs/imx6q_icore_nand_defconfig index f38b06dab9..cef5f3448d 100644 --- a/configs/imx6q_icore_nand_defconfig +++ b/configs/imx6q_icore_nand_defconfig @@ -69,3 +69,4 @@ CONFIG_SPLASH_SCREEN=y CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_VIDEO_BMP_RLE8=y CONFIG_BMP_16BPP=y +CONFIG_EFI_GRUB_ARM32_WORKAROUND=y diff --git a/configs/imx6q_logic_defconfig b/configs/imx6q_logic_defconfig index 36dc24d080..b5a4d3d24d 100644 --- a/configs/imx6q_logic_defconfig +++ b/configs/imx6q_logic_defconfig @@ -103,3 +103,4 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y CONFIG_USB_GADGET_DOWNLOAD=y +CONFIG_EFI_GRUB_ARM32_WORKAROUND=y diff --git a/configs/imx6qdl_icore_mipi_defconfig b/configs/imx6qdl_icore_mipi_defconfig index f1b5389470..1d9e021844 100644 --- a/configs/imx6qdl_icore_mipi_defconfig +++ b/configs/imx6qdl_icore_mipi_defconfig @@ -63,3 +63,4 @@ CONFIG_PINCTRL=y CONFIG_PINCTRL_IMX6=y CONFIG_MXC_UART=y CONFIG_IMX_THERMAL=y +CONFIG_EFI_GRUB_ARM32_WORKAROUND=y diff --git a/configs/imx6qdl_icore_mmc_defconfig b/configs/imx6qdl_icore_mmc_defconfig index a32ae6a75d..b46d19ad88 100644 --- a/configs/imx6qdl_icore_mmc_defconfig +++ b/configs/imx6qdl_icore_mmc_defconfig @@ -86,3 +86,4 @@ CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_VIDEO_BMP_RLE8=y CONFIG_BMP_16BPP=y CONFIG_IMX_WATCHDOG=y +CONFIG_EFI_GRUB_ARM32_WORKAROUND=y diff --git a/configs/imx6qdl_icore_nand_defconfig b/configs/imx6qdl_icore_nand_defconfig index f38b06dab9..cef5f3448d 100644 --- a/configs/imx6qdl_icore_nand_defconfig +++ b/configs/imx6qdl_icore_nand_defconfig @@ -69,3 +69,4 @@ CONFIG_SPLASH_SCREEN=y CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_VIDEO_BMP_RLE8=y CONFIG_BMP_16BPP=y +CONFIG_EFI_GRUB_ARM32_WORKAROUND=y diff --git a/configs/imx6qdl_icore_rqs_defconfig b/configs/imx6qdl_icore_rqs_defconfig index 34e3250f95..db439255a5 100644 --- a/configs/imx6qdl_icore_rqs_defconfig +++ b/configs/imx6qdl_icore_rqs_defconfig @@ -60,3 +60,4 @@ CONFIG_MII=y CONFIG_PINCTRL=y CONFIG_PINCTRL_IMX6=y CONFIG_MXC_UART=y +CONFIG_EFI_GRUB_ARM32_WORKAROUND=y diff --git a/configs/imx6ul_geam_mmc_defconfig b/configs/imx6ul_geam_mmc_defconfig index 4b47e196f3..ae83d35a53 100644 --- a/configs/imx6ul_geam_mmc_defconfig +++ b/configs/imx6ul_geam_mmc_defconfig @@ -55,3 +55,4 @@ CONFIG_PINCTRL=y CONFIG_PINCTRL_IMX6=y CONFIG_MXC_UART=y CONFIG_IMX_THERMAL=y +CONFIG_EFI_GRUB_ARM32_WORKAROUND=y diff --git a/configs/imx6ul_geam_nand_defconfig b/configs/imx6ul_geam_nand_defconfig index 9870612edf..8bffdab9c8 100644 --- a/configs/imx6ul_geam_nand_defconfig +++ b/configs/imx6ul_geam_nand_defconfig @@ -60,3 +60,4 @@ CONFIG_PINCTRL=y CONFIG_PINCTRL_IMX6=y CONFIG_MXC_UART=y CONFIG_IMX_THERMAL=y +CONFIG_EFI_GRUB_ARM32_WORKAROUND=y diff --git a/configs/imx6ul_isiot_emmc_defconfig b/configs/imx6ul_isiot_emmc_defconfig index 2e33db21d8..f8614b23c9 100644 --- a/configs/imx6ul_isiot_emmc_defconfig +++ b/configs/imx6ul_isiot_emmc_defconfig @@ -55,3 +55,4 @@ CONFIG_PINCTRL=y CONFIG_PINCTRL_IMX6=y CONFIG_MXC_UART=y CONFIG_IMX_THERMAL=y +CONFIG_EFI_GRUB_ARM32_WORKAROUND=y diff --git a/configs/imx6ul_isiot_nand_defconfig b/configs/imx6ul_isiot_nand_defconfig index 9c4f742135..aec4563837 100644 --- a/configs/imx6ul_isiot_nand_defconfig +++
[PATCH] fs: btrfs: Select SHA256 in Kconfig
From: Matthias Brugger Since commit 565a4147d17a ("fs: btrfs: Add more checksum algorithms") btrfs uses the sha256 checksum algorithm. But Kconfig lacks to select it. This leads to compilation errors: fs/built-in.o: In function `hash_sha256': fs/btrfs/crypto/hash.c:25: undefined reference to `sha256_starts' fs/btrfs/crypto/hash.c:26: undefined reference to `sha256_update' fs/btrfs/crypto/hash.c:27: undefined reference to `sha256_finish' Signed-off-by: Matthias Brugger --- fs/btrfs/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/btrfs/Kconfig b/fs/btrfs/Kconfig index f302b1fbef..2a32f42ad1 100644 --- a/fs/btrfs/Kconfig +++ b/fs/btrfs/Kconfig @@ -4,6 +4,7 @@ config FS_BTRFS select LZO select ZSTD select RBTREE + select SHA256 help This provides a single-device read-only BTRFS support. BTRFS is a next-generation Linux file system based on the copy-on-write -- 2.30.0
[PATCH] board: mediatek: disable watchdog on BananaPi R2
From: Matthias Brugger Watchdog timeout comes in before we are able to load the kernel and reset the watchdog. Disable the watchdog late in the boot process to be able to boot the board. Signed-off-by: Matthias Brugger --- board/mediatek/mt7623/mt7623_rfb.c | 8 configs/mt7623n_bpir2_defconfig| 1 + 2 files changed, 9 insertions(+) diff --git a/board/mediatek/mt7623/mt7623_rfb.c b/board/mediatek/mt7623/mt7623_rfb.c index 984e75ccaf..22120be412 100644 --- a/board/mediatek/mt7623/mt7623_rfb.c +++ b/board/mediatek/mt7623/mt7623_rfb.c @@ -5,6 +5,7 @@ #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -40,3 +41,10 @@ int mmc_get_env_dev(void) return mmc_get_boot_dev(); } #endif + +#ifdef CONFIG_BOARD_LATE_INIT +int board_late_init(void) +{ + wdt_stop(gd->watchdog_dev); +} +#endif diff --git a/configs/mt7623n_bpir2_defconfig b/configs/mt7623n_bpir2_defconfig index 9177c17dff..fe0b6259dd 100644 --- a/configs/mt7623n_bpir2_defconfig +++ b/configs/mt7623n_bpir2_defconfig @@ -14,6 +14,7 @@ CONFIG_FIT_VERBOSE=y CONFIG_BOOTDELAY=3 CONFIG_SYS_CONSOLE_IS_IN_ENV=y CONFIG_DEFAULT_FDT_FILE="mt7623n-bananapi-bpi-r2.dtb" +CONFIG_BOARD_LATE_INIT=y # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_SYS_PROMPT="U-Boot> " CONFIG_CMD_BOOTMENU=y -- 2.29.2
[PATCH v3 2/2] net: Use NDRNG device in srand_mac()
From: Matthias Brugger When calling srand_mac we use a weak seed dependent on the mac address. If present, use a RNG device instead to incerase entropy. Signed-off-by: Matthias Brugger --- Changes in v3: - use IS_ENABLED instead of #if Changes in v2: - fix dm_rng_read() parameters - add missing include file net/net_rand.h | 19 ++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/net/net_rand.h b/net/net_rand.h index 4bf9bd817e..6a52cda85e 100644 --- a/net/net_rand.h +++ b/net/net_rand.h @@ -10,6 +10,8 @@ #define __NET_RAND_H__ #include +#include +#include /* * Return a seed for the PRNG derived from the eth0 MAC address. @@ -37,7 +39,22 @@ static inline unsigned int seed_mac(void) */ static inline void srand_mac(void) { - srand(seed_mac()); + int ret; + struct udevice *devp; + u32 randv = 0; + + if (IS_ENABLED(CONFIG_DM_RNG)) { + ret = uclass_get_device(UCLASS_RNG, 0, ); + if (ret) { + ret = dm_rng_read(devp, , sizeof(randv)); + if (ret < 0) + randv = 0; + } + } + if (randv) + srand(randv); + else + srand(seed_mac()); } #endif /* __NET_RAND_H__ */ -- 2.29.2
[PATCH v3 1/2] lib: uuid: use RNG device if present
From: Matthias Brugger When calculating a random UUID we use a weak seed. Use a RNG device if present to increase entropy. Signed-off-by: Matthias Brugger --- Changes in v3: - use IS_ENABLED instead of #if - use 4 byte for entropy Changes in v2: - fix dm_rng_read() parameters - add missing include lib/uuid.c | 21 ++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/uuid.c b/lib/uuid.c index e62d5ca264..23af2b4800 100644 --- a/lib/uuid.c +++ b/lib/uuid.c @@ -15,6 +15,8 @@ #include #include #include +#include +#include /* * UUID - Universally Unique IDentifier - 128 bits unique number. @@ -249,9 +251,22 @@ void gen_rand_uuid(unsigned char *uuid_bin) { u32 ptr[4]; struct uuid *uuid = (struct uuid *)ptr; - int i; - - srand(get_ticks() + rand()); + int i, ret; + struct udevice *devp; + u32 randv = 0; + + if (IS_ENABLED(CONFIG_DM_RNG)) { + ret = uclass_get_device(UCLASS_RNG, 0, ); + if (ret) { + ret = dm_rng_read(devp, , sizeof(randv)); + if (ret < 0) + randv = 0; + } + } + if (randv) + srand(randv); + else + srand(get_ticks() + rand()); /* Set all fields randomly */ for (i = 0; i < 4; i++) -- 2.29.2
[PATCH v3 0/2] Use RNG to get random behaviour
From: Matthias Brugger For now bootp and uuid code use a weak seed for generating random data. U-Boot as support for RNG devices now, so we should change to code to use them if they are present. This will help mitigate issues like seen in CVE-2019-11690. Changes in v3: - use IS_ENABLED instead of #if - use 4 byte for entropy - use IS_ENABLED instead of #if Changes in v2: - fix dm_rng_read() parameters - add missing include - fix dm_rng_read() parameters - add missing include file Matthias Brugger (2): lib: uuid: use RNG device if present net: Use NDRNG device in srand_mac() lib/uuid.c | 21 ++--- net/net_rand.h | 19 ++- 2 files changed, 36 insertions(+), 4 deletions(-) -- 2.29.2
[PATCH v2 2/2] net: Use NDRNG device in srand_mac()
From: Matthias Brugger When calling srand_mac we use a weak seed dependent on the mac address. If present, use a RNG device instead to incerase entropy. Signed-off-by: Matthias Brugger --- Changes in v2: - fix dm_rng_read() parameters - add missing include file net/net_rand.h | 19 ++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/net/net_rand.h b/net/net_rand.h index 4bf9bd817e..e7299973a3 100644 --- a/net/net_rand.h +++ b/net/net_rand.h @@ -10,6 +10,8 @@ #define __NET_RAND_H__ #include +#include +#include /* * Return a seed for the PRNG derived from the eth0 MAC address. @@ -37,7 +39,22 @@ static inline unsigned int seed_mac(void) */ static inline void srand_mac(void) { - srand(seed_mac()); +#if defined(CONFIG_DM_RNG) + int ret; + struct udevice *devp; + u32 randv = 0; + + ret = uclass_get_device(UCLASS_RNG, 0, ); + if (ret) { + ret = dm_rng_read(devp, , sizeof(randv)); + if (ret < 0) + randv = 0; + } + if (randv) + srand(randv); + else +#endif + srand(seed_mac()); } #endif /* __NET_RAND_H__ */ -- 2.29.2
[PATCH v2 1/2] lib: uuid: use RNG device if present
From: Matthias Brugger When calculating a random UUID we use a weak seed. Use a RNG device if present to increase entropy. Signed-off-by: Matthias Brugger --- Changes in v2: - fix dm_rng_read() parameters - add missing include lib/uuid.c | 21 ++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/uuid.c b/lib/uuid.c index e62d5ca264..e3487380c3 100644 --- a/lib/uuid.c +++ b/lib/uuid.c @@ -15,6 +15,8 @@ #include #include #include +#include +#include /* * UUID - Universally Unique IDentifier - 128 bits unique number. @@ -249,9 +251,22 @@ void gen_rand_uuid(unsigned char *uuid_bin) { u32 ptr[4]; struct uuid *uuid = (struct uuid *)ptr; - int i; - - srand(get_ticks() + rand()); + int i, ret; + struct udevice *devp; + u8 randv = 0; + +#if defined(CONFIG_DM_RNG) + ret = uclass_get_device(UCLASS_RNG, 0, ); + if (ret) { + ret = dm_rng_read(devp, , sizeof(randv)); + if (ret < 0) + randv = 0; + } + if (randv) + srand(randv); + else +#endif + srand(get_ticks() + rand()); /* Set all fields randomly */ for (i = 0; i < 4; i++) -- 2.29.2
[PATCH v2 0/2] Use RNG to get random behaviour
From: Matthias Brugger For now bootp and uuid code use a weak seed for generating random data. U-Boot as support for RNG devices now, so we should change to code to use them if they are present. This will help mitigate issues like seen in CVE-2019-11690. Changes in v2: - fix dm_rng_read() parameters - add missing include - fix dm_rng_read() parameters - add missing include file Matthias Brugger (2): lib: uuid: use RNG device if present net: Use NDRNG device in srand_mac() lib/uuid.c | 21 ++--- net/net_rand.h | 19 ++- 2 files changed, 36 insertions(+), 4 deletions(-) -- 2.29.2
[PATCH 2/2] net: Use NDRNG device in srand_mac()
From: Matthias Brugger When calling srand_mac we use a weak seed dependent on the mac address. If present, use a RNG device instead to incerase entropy. Signed-off-by: Matthias Brugger --- net/net_rand.h | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/net/net_rand.h b/net/net_rand.h index 4bf9bd817e..600c3d825e 100644 --- a/net/net_rand.h +++ b/net/net_rand.h @@ -10,6 +10,7 @@ #define __NET_RAND_H__ #include +#include /* * Return a seed for the PRNG derived from the eth0 MAC address. @@ -37,7 +38,22 @@ static inline unsigned int seed_mac(void) */ static inline void srand_mac(void) { - srand(seed_mac()); +#if defined(CONFIG_DM_RNG) + int ret; + struct udevice *devp; + u32 randv = 0; + + ret = uclass_get_device(UCLASS_RNG, 0, ); + if (ret) { + ret = dm_rng_read(dev, randv, sizeof(randv)); + if (ret < 0) + randv = 0; + } + if (randv) + srand(randv); + else +#endif + srand(seed_mac()); } #endif /* __NET_RAND_H__ */ -- 2.29.2
[PATCH 1/2] lib: uuid: use RNG device if present
From: Matthias Brugger When calculating a random UUID we use a weak seed. Use a RNG device if present to increase entropy. Signed-off-by: Matthias Brugger --- lib/uuid.c | 20 +--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/lib/uuid.c b/lib/uuid.c index e62d5ca264..219d4b7767 100644 --- a/lib/uuid.c +++ b/lib/uuid.c @@ -15,6 +15,7 @@ #include #include #include +#include /* * UUID - Universally Unique IDentifier - 128 bits unique number. @@ -249,9 +250,22 @@ void gen_rand_uuid(unsigned char *uuid_bin) { u32 ptr[4]; struct uuid *uuid = (struct uuid *)ptr; - int i; - - srand(get_ticks() + rand()); + int i, ret; + struct udevice *devp; + u8 randv = 0; + +#if defined(CONFIG_DM_RNG) + ret = uclass_get_device(UCLASS_RNG, 0, ); + if (ret) { + ret = dm_rng_read(dev, randv, sizeof(randv)); + if (ret < 0) + randv = 0; + } + if (randv) + srand(randv); + else +#endif + srand(get_ticks() + rand()); /* Set all fields randomly */ for (i = 0; i < 4; i++) -- 2.29.2
[PATCH 0/2] Use RNG to get random behaviour
From: Matthias Brugger For now bootp and uuid code use a weak seed for generating random data. U-Boot as support for RNG devices now, so we should change to code to use them if they are present. This will help mitigate issues like seen in CVE-2019-11690. Matthias Brugger (2): lib: uuid: use RNG device if present net: Use NDRNG device in srand_mac() lib/uuid.c | 20 +--- net/net_rand.h | 18 +- 2 files changed, 34 insertions(+), 4 deletions(-) -- 2.29.2
[PATCH v2 2/2] config: Enable iProc RNG200 driver in RPi4 configs
From: Matthias Brugger We find the iProc RNG200 in the Raspberry Pi 4. Add it to all it's config so that it can be used. Signed-off-by: Matthias Brugger --- Changes in v2: - fix defconfigs using savedefconfig (Heinrich) configs/rpi_4_32b_defconfig | 2 ++ configs/rpi_4_defconfig | 2 ++ configs/rpi_arm64_defconfig | 2 ++ drivers/rng/iproc_rng200.c | 1 - 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig index 5ddd838fd5..4039e46c81 100644 --- a/configs/rpi_4_32b_defconfig +++ b/configs/rpi_4_32b_defconfig @@ -36,6 +36,8 @@ CONFIG_PCI_BRCMSTB=y CONFIG_PINCTRL=y # CONFIG_PINCTRL_GENERIC is not set CONFIG_DM_RESET=y +CONFIG_DM_RNG=y +CONFIG_RNG_IPROC200=y # CONFIG_REQUIRE_SERIAL_CONSOLE is not set CONFIG_USB=y CONFIG_DM_USB=y diff --git a/configs/rpi_4_defconfig b/configs/rpi_4_defconfig index 2590d0a696..46b6cc3046 100644 --- a/configs/rpi_4_defconfig +++ b/configs/rpi_4_defconfig @@ -36,6 +36,8 @@ CONFIG_PCI_BRCMSTB=y CONFIG_PINCTRL=y # CONFIG_PINCTRL_GENERIC is not set CONFIG_DM_RESET=y +CONFIG_DM_RNG=y +CONFIG_RNG_IPROC200=y # CONFIG_REQUIRE_SERIAL_CONSOLE is not set CONFIG_USB=y CONFIG_DM_USB=y diff --git a/configs/rpi_arm64_defconfig b/configs/rpi_arm64_defconfig index 2639219a1a..b75144036d 100644 --- a/configs/rpi_arm64_defconfig +++ b/configs/rpi_arm64_defconfig @@ -33,6 +33,8 @@ CONFIG_PCI_BRCMSTB=y CONFIG_PINCTRL=y # CONFIG_PINCTRL_GENERIC is not set CONFIG_DM_RESET=y +CONFIG_DM_RNG=y +CONFIG_RNG_IPROC200=y # CONFIG_REQUIRE_SERIAL_CONSOLE is not set CONFIG_USB=y CONFIG_DM_USB=y diff --git a/drivers/rng/iproc_rng200.c b/drivers/rng/iproc_rng200.c index 1063f43953..378f6cf48d 100644 --- a/drivers/rng/iproc_rng200.c +++ b/drivers/rng/iproc_rng200.c @@ -50,7 +50,6 @@ static void iproc_rng200_enable(struct iproc_rng200_platdata *pdata, bool enable val &= ~RNG_CTRL_RNG_RBGEN_ENABLE; writel(val, rng_base + RNG_CTRL_OFFSET); - } static void iproc_rng200_restart(struct iproc_rng200_platdata *pdata) -- 2.29.2
[PATCH v2 1/2] rng: Add iProc RNG200 driver
From: Matthias Brugger Add support for random number generator RNG200. This is for example found on RPi4. Signed-off-by: Matthias Brugger --- Changes in v2: None drivers/rng/Kconfig| 6 ++ drivers/rng/Makefile | 1 + drivers/rng/iproc_rng200.c | 186 + 3 files changed, 193 insertions(+) create mode 100644 drivers/rng/iproc_rng200.c diff --git a/drivers/rng/Kconfig b/drivers/rng/Kconfig index 11001c8ae7..94915d45b3 100644 --- a/drivers/rng/Kconfig +++ b/drivers/rng/Kconfig @@ -46,4 +46,10 @@ config RNG_ROCKCHIP Enable random number generator for rockchip.This driver is support rng module of crypto v1 and crypto v2. +config RNG_IPROC200 + bool "Broadcom iProc RNG200 random number generator" + depends on DM_RNG + default n + help + Enable random number generator for RPI4. endif diff --git a/drivers/rng/Makefile b/drivers/rng/Makefile index 8953406882..39f7ee3f03 100644 --- a/drivers/rng/Makefile +++ b/drivers/rng/Makefile @@ -9,3 +9,4 @@ obj-$(CONFIG_RNG_SANDBOX) += sandbox_rng.o obj-$(CONFIG_RNG_MSM) += msm_rng.o obj-$(CONFIG_RNG_STM32MP1) += stm32mp1_rng.o obj-$(CONFIG_RNG_ROCKCHIP) += rockchip_rng.o +obj-$(CONFIG_RNG_IPROC200) += iproc_rng200.o diff --git a/drivers/rng/iproc_rng200.c b/drivers/rng/iproc_rng200.c new file mode 100644 index 00..1063f43953 --- /dev/null +++ b/drivers/rng/iproc_rng200.c @@ -0,0 +1,186 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright 2020, Matthias Brugger + * + * Driver for Raspberry Pi hardware random number generator + */ + +#include +#include +#include +#include +#include + +#define usleep_range(a, b) udelay((b)) + +#define RNG_CTRL_OFFSET0x00 +#define RNG_CTRL_RNG_RBGEN_MASK0x1FFF +#define RNG_CTRL_RNG_RBGEN_ENABLE 0x0001 +#define RNG_CTRL_RNG_RBGEN_DISABLE 0x + +#define RNG_SOFT_RESET_OFFSET 0x04 +#define RNG_SOFT_RESET 0x0001 + +#define RBG_SOFT_RESET_OFFSET 0x08 +#define RBG_SOFT_RESET 0x0001 + +#define RNG_INT_STATUS_OFFSET 0x18 +#define RNG_INT_STATUS_MASTER_FAIL_LOCKOUT_IRQ_MASK0x8000 +#define RNG_INT_STATUS_NIST_FAIL_IRQ_MASK 0x0020 + +#define RNG_FIFO_DATA_OFFSET 0x20 + +#define RNG_FIFO_COUNT_OFFSET 0x24 +#define RNG_FIFO_COUNT_RNG_FIFO_COUNT_MASK 0x00FF + +struct iproc_rng200_platdata { + fdt_addr_t base; +}; + +static void iproc_rng200_enable(struct iproc_rng200_platdata *pdata, bool enable) +{ + fdt_addr_t rng_base = pdata->base; + u32 val; + + val = readl(rng_base + RNG_CTRL_OFFSET); + val &= ~RNG_CTRL_RNG_RBGEN_MASK; + if (enable) + val |= RNG_CTRL_RNG_RBGEN_ENABLE; + else + val &= ~RNG_CTRL_RNG_RBGEN_ENABLE; + + writel(val, rng_base + RNG_CTRL_OFFSET); + +} + +static void iproc_rng200_restart(struct iproc_rng200_platdata *pdata) +{ + fdt_addr_t rng_base = pdata->base; + u32 val; + + iproc_rng200_enable(pdata, false); + + /* Clear all interrupt status */ + writel(0xUL, rng_base + RNG_INT_STATUS_OFFSET); + + /* Reset RNG and RBG */ + val = readl(rng_base + RBG_SOFT_RESET_OFFSET); + val |= RBG_SOFT_RESET; + writel(val, rng_base + RBG_SOFT_RESET_OFFSET); + + val = readl(rng_base + RNG_SOFT_RESET_OFFSET); + val |= RNG_SOFT_RESET; + writel(val, rng_base + RNG_SOFT_RESET_OFFSET); + + val = readl(rng_base + RNG_SOFT_RESET_OFFSET); + val &= ~RNG_SOFT_RESET; + writel(val, rng_base + RNG_SOFT_RESET_OFFSET); + + val = readl(rng_base + RBG_SOFT_RESET_OFFSET); + val &= ~RBG_SOFT_RESET; + writel(val, rng_base + RBG_SOFT_RESET_OFFSET); + + iproc_rng200_enable(pdata, true); +} + +static int iproc_rng200_read(struct udevice *dev, void *data, size_t len) +{ + struct iproc_rng200_platdata *priv = dev_get_platdata(dev); + char *buf = (char *)data; + u32 num_remaining = len; + u32 status; + + #define MAX_RESETS_PER_READ 1 + u32 num_resets = 0; + + while (num_remaining > 0) { + + /* Is RNG sane? If not, reset it. */ + status = readl(priv->base + RNG_INT_STATUS_OFFSET); + if ((status & (RNG_INT_STATUS_MASTER_FAIL_LOCKOUT_IRQ_MASK | + RNG_INT_STATUS_NIST_FAIL_IRQ_MASK)) != 0) { + + if (num_resets >= MAX_RESETS_PER_READ) + return len - num_remaining; + + iproc_rng200_restart(priv); + num_resets++; + } + + /* Are there any random numbers available?
[PATCH 2/2] config: Enable iProc RNG200 driver in RPi4 configs
From: Matthias Brugger We find the iProc RNG200 in the Raspberry Pi 4. Add it to all it's config so that it can be used. Signed-off-by: Matthias Brugger --- configs/rpi_4_32b_defconfig | 1 + configs/rpi_4_defconfig | 1 + configs/rpi_arm64_defconfig | 1 + drivers/rng/iproc_rng200.c | 1 - 4 files changed, 3 insertions(+), 1 deletion(-) diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig index 5ddd838fd5..b8cd0acf2d 100644 --- a/configs/rpi_4_32b_defconfig +++ b/configs/rpi_4_32b_defconfig @@ -58,3 +58,4 @@ CONFIG_PHYS_TO_BUS=y CONFIG_ADDR_MAP=y CONFIG_SYS_NUM_ADDR_MAP=2 CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_RNG_IPROC200=y diff --git a/configs/rpi_4_defconfig b/configs/rpi_4_defconfig index 2590d0a696..9bde5b43d8 100644 --- a/configs/rpi_4_defconfig +++ b/configs/rpi_4_defconfig @@ -56,3 +56,4 @@ CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_CONSOLE_SCROLL_LINES=10 CONFIG_PHYS_TO_BUS=y CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_RNG_IPROC200=y diff --git a/configs/rpi_arm64_defconfig b/configs/rpi_arm64_defconfig index 2639219a1a..42b7ec33c7 100644 --- a/configs/rpi_arm64_defconfig +++ b/configs/rpi_arm64_defconfig @@ -50,3 +50,4 @@ CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_CONSOLE_SCROLL_LINES=10 CONFIG_PHYS_TO_BUS=y CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_RNG_IPROC200=y diff --git a/drivers/rng/iproc_rng200.c b/drivers/rng/iproc_rng200.c index 1063f43953..378f6cf48d 100644 --- a/drivers/rng/iproc_rng200.c +++ b/drivers/rng/iproc_rng200.c @@ -50,7 +50,6 @@ static void iproc_rng200_enable(struct iproc_rng200_platdata *pdata, bool enable val &= ~RNG_CTRL_RNG_RBGEN_ENABLE; writel(val, rng_base + RNG_CTRL_OFFSET); - } static void iproc_rng200_restart(struct iproc_rng200_platdata *pdata) -- 2.29.2
[PATCH 1/2] rng: Add iProc RNG200 driver
From: Matthias Brugger Add support for random number generator RNG200. This is for example found on RPi4. Signed-off-by: Matthias Brugger --- drivers/rng/Kconfig| 6 ++ drivers/rng/Makefile | 1 + drivers/rng/iproc_rng200.c | 186 + 3 files changed, 193 insertions(+) create mode 100644 drivers/rng/iproc_rng200.c diff --git a/drivers/rng/Kconfig b/drivers/rng/Kconfig index 11001c8ae7..94915d45b3 100644 --- a/drivers/rng/Kconfig +++ b/drivers/rng/Kconfig @@ -46,4 +46,10 @@ config RNG_ROCKCHIP Enable random number generator for rockchip.This driver is support rng module of crypto v1 and crypto v2. +config RNG_IPROC200 + bool "Broadcom iProc RNG200 random number generator" + depends on DM_RNG + default n + help + Enable random number generator for RPI4. endif diff --git a/drivers/rng/Makefile b/drivers/rng/Makefile index 8953406882..39f7ee3f03 100644 --- a/drivers/rng/Makefile +++ b/drivers/rng/Makefile @@ -9,3 +9,4 @@ obj-$(CONFIG_RNG_SANDBOX) += sandbox_rng.o obj-$(CONFIG_RNG_MSM) += msm_rng.o obj-$(CONFIG_RNG_STM32MP1) += stm32mp1_rng.o obj-$(CONFIG_RNG_ROCKCHIP) += rockchip_rng.o +obj-$(CONFIG_RNG_IPROC200) += iproc_rng200.o diff --git a/drivers/rng/iproc_rng200.c b/drivers/rng/iproc_rng200.c new file mode 100644 index 00..1063f43953 --- /dev/null +++ b/drivers/rng/iproc_rng200.c @@ -0,0 +1,186 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright 2020, Matthias Brugger + * + * Driver for Raspberry Pi hardware random number generator + */ + +#include +#include +#include +#include +#include + +#define usleep_range(a, b) udelay((b)) + +#define RNG_CTRL_OFFSET0x00 +#define RNG_CTRL_RNG_RBGEN_MASK0x1FFF +#define RNG_CTRL_RNG_RBGEN_ENABLE 0x0001 +#define RNG_CTRL_RNG_RBGEN_DISABLE 0x + +#define RNG_SOFT_RESET_OFFSET 0x04 +#define RNG_SOFT_RESET 0x0001 + +#define RBG_SOFT_RESET_OFFSET 0x08 +#define RBG_SOFT_RESET 0x0001 + +#define RNG_INT_STATUS_OFFSET 0x18 +#define RNG_INT_STATUS_MASTER_FAIL_LOCKOUT_IRQ_MASK0x8000 +#define RNG_INT_STATUS_NIST_FAIL_IRQ_MASK 0x0020 + +#define RNG_FIFO_DATA_OFFSET 0x20 + +#define RNG_FIFO_COUNT_OFFSET 0x24 +#define RNG_FIFO_COUNT_RNG_FIFO_COUNT_MASK 0x00FF + +struct iproc_rng200_platdata { + fdt_addr_t base; +}; + +static void iproc_rng200_enable(struct iproc_rng200_platdata *pdata, bool enable) +{ + fdt_addr_t rng_base = pdata->base; + u32 val; + + val = readl(rng_base + RNG_CTRL_OFFSET); + val &= ~RNG_CTRL_RNG_RBGEN_MASK; + if (enable) + val |= RNG_CTRL_RNG_RBGEN_ENABLE; + else + val &= ~RNG_CTRL_RNG_RBGEN_ENABLE; + + writel(val, rng_base + RNG_CTRL_OFFSET); + +} + +static void iproc_rng200_restart(struct iproc_rng200_platdata *pdata) +{ + fdt_addr_t rng_base = pdata->base; + u32 val; + + iproc_rng200_enable(pdata, false); + + /* Clear all interrupt status */ + writel(0xUL, rng_base + RNG_INT_STATUS_OFFSET); + + /* Reset RNG and RBG */ + val = readl(rng_base + RBG_SOFT_RESET_OFFSET); + val |= RBG_SOFT_RESET; + writel(val, rng_base + RBG_SOFT_RESET_OFFSET); + + val = readl(rng_base + RNG_SOFT_RESET_OFFSET); + val |= RNG_SOFT_RESET; + writel(val, rng_base + RNG_SOFT_RESET_OFFSET); + + val = readl(rng_base + RNG_SOFT_RESET_OFFSET); + val &= ~RNG_SOFT_RESET; + writel(val, rng_base + RNG_SOFT_RESET_OFFSET); + + val = readl(rng_base + RBG_SOFT_RESET_OFFSET); + val &= ~RBG_SOFT_RESET; + writel(val, rng_base + RBG_SOFT_RESET_OFFSET); + + iproc_rng200_enable(pdata, true); +} + +static int iproc_rng200_read(struct udevice *dev, void *data, size_t len) +{ + struct iproc_rng200_platdata *priv = dev_get_platdata(dev); + char *buf = (char *)data; + u32 num_remaining = len; + u32 status; + + #define MAX_RESETS_PER_READ 1 + u32 num_resets = 0; + + while (num_remaining > 0) { + + /* Is RNG sane? If not, reset it. */ + status = readl(priv->base + RNG_INT_STATUS_OFFSET); + if ((status & (RNG_INT_STATUS_MASTER_FAIL_LOCKOUT_IRQ_MASK | + RNG_INT_STATUS_NIST_FAIL_IRQ_MASK)) != 0) { + + if (num_resets >= MAX_RESETS_PER_READ) + return len - num_remaining; + + iproc_rng200_restart(priv); + num_resets++; + } + + /* Are there any random numbers available? */ +
[PATCH] config: Enable USB Keyboard suuport on RPi4 32 bit
From: Matthias Brugger Supporting USB keyboards out of the box is both handy for development and production. Notably if u-boot is used to boot into GRUB. This patch adds USB keyboard support for 32 bit RPi4 config. Signed-off-by: Matthias Brugger --- configs/rpi_4_32b_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig index db7b781976..4a88448e9d 100644 --- a/configs/rpi_4_32b_defconfig +++ b/configs/rpi_4_32b_defconfig @@ -42,6 +42,7 @@ CONFIG_DM_USB=y CONFIG_DM_USB_GADGET=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_PCI=y +CONFIG_USB_KEYBOARD=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_MANUFACTURER="FSL" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 -- 2.27.0
[PATCH] configs: rpi: set NR_DRAM_BANKS to four
From: Matthias Brugger With the new RPi4 which has 8 GB of RAM, we can have up to four DRAM banks. Bump up the configuration files to detect all the memory in U-Boot. Signed-off-by: Matthias Brugger --- configs/rpi_4_32b_defconfig | 2 +- configs/rpi_4_defconfig | 2 +- configs/rpi_arm64_defconfig | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig index b22316cbcb..f369bb93bd 100644 --- a/configs/rpi_4_32b_defconfig +++ b/configs/rpi_4_32b_defconfig @@ -4,7 +4,7 @@ CONFIG_SYS_TEXT_BASE=0x8000 CONFIG_TARGET_RPI_4_32B=y CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_ENV_SIZE=0x4000 -CONFIG_NR_DRAM_BANKS=2 +CONFIG_NR_DRAM_BANKS=4 CONFIG_DISTRO_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y CONFIG_ARCH_FIXUP_FDT_MEMORY=y diff --git a/configs/rpi_4_defconfig b/configs/rpi_4_defconfig index 165e166bbd..9b90790f06 100644 --- a/configs/rpi_4_defconfig +++ b/configs/rpi_4_defconfig @@ -4,7 +4,7 @@ CONFIG_SYS_TEXT_BASE=0x0008 CONFIG_TARGET_RPI_4=y CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_ENV_SIZE=0x4000 -CONFIG_NR_DRAM_BANKS=2 +CONFIG_NR_DRAM_BANKS=4 CONFIG_DISTRO_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y CONFIG_ARCH_FIXUP_FDT_MEMORY=y diff --git a/configs/rpi_arm64_defconfig b/configs/rpi_arm64_defconfig index 0cc4efad70..db375eeba7 100644 --- a/configs/rpi_arm64_defconfig +++ b/configs/rpi_arm64_defconfig @@ -4,7 +4,7 @@ CONFIG_SYS_TEXT_BASE=0x0008 CONFIG_TARGET_RPI_ARM64=y CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_ENV_SIZE=0x4000 -CONFIG_NR_DRAM_BANKS=2 +CONFIG_NR_DRAM_BANKS=4 CONFIG_DISTRO_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y CONFIG_USE_PREBOOT=y -- 2.26.2
[PATCH 1/2] mmc: sdhci: Use debug for not supported SDMA info message
From: Matthias Brugger If CONFIG_MMC_SDHCI_SDMA is enabled but the HW could not support it, we no longer error out. Instead we do not enable it in the host. Change the output from printf to debug as this isn't an error but only additional information now. Signed-off-by: Matthias Brugger --- drivers/mmc/sdhci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index 6e8f6e3d17..8bb4393ce1 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c @@ -744,8 +744,8 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host, if ((caps & SDHCI_CAN_DO_SDMA)) { host->flags |= USE_SDMA; } else { - printf("%s: Your controller doesn't support SDMA!!\n", - __func__); + debug("%s: Your controller doesn't support SDMA!!\n", + __func__); } #endif #if CONFIG_IS_ENABLED(MMC_SDHCI_ADMA) -- 2.26.2
[PATCH 2/2] configs: rpi_arm64: enable SDHCI SDMA support
From: Matthias Brugger RPi4 supports SDMA on it's SDHCI controller. Enable to option for the combine RPi3/4 config. Signed-off-by: Matthias Brugger --- configs/rpi_arm64_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/rpi_arm64_defconfig b/configs/rpi_arm64_defconfig index b9bb083a1d..66c4a5368c 100644 --- a/configs/rpi_arm64_defconfig +++ b/configs/rpi_arm64_defconfig @@ -23,6 +23,7 @@ CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_DM_KEYBOARD=y CONFIG_DM_MMC=y CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_SDMA=y CONFIG_MMC_SDHCI_BCM2835=y CONFIG_DM_ETH=y CONFIG_BCMGENET=y -- 2.26.2
[PATCH v1 2/3] watchdog MediaTek add upstream compatible
From: Matthias Brugger The upstream compatible is called mt6589-wdt. Add this compatible to the driver. Signed-off-by: Matthias Brugger --- drivers/watchdog/mtk_wdt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c index 669a32320d..b3c597e1d0 100644 --- a/drivers/watchdog/mtk_wdt.c +++ b/drivers/watchdog/mtk_wdt.c @@ -143,6 +143,7 @@ static const struct wdt_ops mtk_wdt_ops = { static const struct udevice_id mtk_wdt_ids[] = { { .compatible = "mediatek,wdt"}, + { .compatible = "mediatek,mt6589-wdt"}, {} }; -- 2.26.0
[PATCH v1 3/3] arm: enable distro boot for bananapi-r2
From: Matthias Brugger This patch enables distro boot for the bananapi-r2, based on a MediaTek mt7623n. Signed-off-by: Matthias Brugger --- configs/mt7623n_bpir2_defconfig | 3 ++- include/configs/mt7623.h| 24 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/configs/mt7623n_bpir2_defconfig b/configs/mt7623n_bpir2_defconfig index 07ddade76a..fe28f37b9e 100644 --- a/configs/mt7623n_bpir2_defconfig +++ b/configs/mt7623n_bpir2_defconfig @@ -7,6 +7,7 @@ CONFIG_ENV_SIZE=0x1000 CONFIG_ENV_OFFSET=0x10 CONFIG_TARGET_MT7623=y CONFIG_NR_DRAM_BANKS=1 +CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y CONFIG_FIT_VERBOSE=y CONFIG_BOOTDELAY=3 @@ -56,4 +57,4 @@ CONFIG_TIMER=y CONFIG_MTK_TIMER=y CONFIG_WDT_MTK=y CONFIG_LZMA=y -# CONFIG_EFI_LOADER is not set +CONFIG_EFI_LOADER=y diff --git a/include/configs/mt7623.h b/include/configs/mt7623.h index faab0913fc..fe436cca38 100644 --- a/include/configs/mt7623.h +++ b/include/configs/mt7623.h @@ -45,11 +45,13 @@ #define CONFIG_SYS_SDRAM_BASE 0x8000 /* This is needed for kernel booting */ -#define FDT_HIGH "fdt_high=0xac00\0" +#define FDT_HIGH "0xac00" -/* Extra environment variables */ -#define CONFIG_EXTRA_ENV_SETTINGS \ - FDT_HIGH +#define ENV_MEM_LAYOUT_SETTINGS\ + "fdt_high=" FDT_HIGH "\0" \ + "kernel_addr_r=0x8400\0"\ + "fdt_addr_r=" FDT_HIGH "\0" \ + "fdtfile=mt7623n-bananapi-bpi-r2.dtb" "\0" /* Ethernet */ #define CONFIG_IPADDR 192.168.1.1 @@ -57,4 +59,18 @@ #define CONFIG_SYS_MMC_ENV_DEV 0 +#ifdef CONFIG_DISTRO_DEFAULTS + +#define BOOT_TARGET_DEVICES(func) \ + func(MMC, mmc, 1) + +#include + +/* Extra environment variables */ +#define CONFIG_EXTRA_ENV_SETTINGS \ + ENV_MEM_LAYOUT_SETTINGS \ + BOOTENV + +#endif /* ifdef CONFIG_DISTRO_DEFAULTS*/ + #endif -- 2.26.0
[PATCH v1 1/3] timer MediaTek use upstream compatible
From: Matthias Brugger The timers compatible string in upstream is called mt6577-timer. Add this compatible to the driver. Signed-off-by: Matthias Brugger --- drivers/timer/mtk_timer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/timer/mtk_timer.c b/drivers/timer/mtk_timer.c index b5e76bd358..e99135e5be 100644 --- a/drivers/timer/mtk_timer.c +++ b/drivers/timer/mtk_timer.c @@ -71,6 +71,7 @@ static const struct timer_ops mtk_timer_ops = { static const struct udevice_id mtk_timer_ids[] = { { .compatible = "mediatek,timer" }, + { .compatible = "mediatek,mt6577-timer" }, { } }; -- 2.26.0
[PATCH 0/2] Reading size-cells and address-cells from a node should walk up the
From: Matthias Brugger parent stack to find the property. This is reflected through comments in the code, but actually not implemented. This leads to the fact that some DTBs worked by accident. Fix this by walking the tree when reading this properties. After fixing the default size-cells returned when the property is not present this problem was made visible. When adding flash devices in qemu for arm64, the size-cells was wrongly inpterpreted and broke access to the second flash bank. Matthias Brugger (2): libfdt: Make fdt_cells function accessible dm: core: Walk the tree to find address- and size-cells properties drivers/core/ofnode.c | 8 +++ include/dm/ofnode.h| 36 ++ include/dm/read.h | 6 ++--- scripts/dtc/libfdt/fdt_addresses.c | 2 +- scripts/dtc/libfdt/libfdt.h| 2 ++ 5 files changed, 45 insertions(+), 9 deletions(-) -- 2.26.0
[PATCH 2/2] dm: core: Walk the tree to find address- and size-cells properties
From: Matthias Brugger Walk the tree when reading size-cells or address-cells properties. Reported-by: Robin Randhawa Signed-off-by: Matthias Brugger --- drivers/core/ofnode.c | 8 include/dm/ofnode.h | 36 include/dm/read.h | 6 ++ 3 files changed, 42 insertions(+), 8 deletions(-) diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index 96a5dd20bd..5f23826b70 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -697,16 +697,16 @@ int ofnode_read_addr_cells(ofnode node) { if (ofnode_is_np(node)) return of_n_addr_cells(ofnode_to_np(node)); - else /* NOTE: this call should walk up the parent stack */ - return fdt_address_cells(gd->fdt_blob, ofnode_to_offset(node)); + else + return __ofnode_read_address_cells(node); } int ofnode_read_size_cells(ofnode node) { if (ofnode_is_np(node)) return of_n_size_cells(ofnode_to_np(node)); - else /* NOTE: this call should walk up the parent stack */ - return fdt_size_cells(gd->fdt_blob, ofnode_to_offset(node)); + else + return __ofnode_read_size_cells(node); } int ofnode_read_simple_addr_cells(ofnode node) diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index b5a50e8849..c6b768763d 100644 --- a/include/dm/ofnode.h +++ b/include/dm/ofnode.h @@ -660,6 +660,24 @@ int ofnode_read_pci_vendev(ofnode node, u16 *vendor, u16 *device); */ int ofnode_read_addr_cells(ofnode node); +static inline int __ofnode_read_address_cells(ofnode node) +{ + /* NOTE: this call walks up the parent stack */ + int val = -FDT_ERR_NOTFOUND; + ofnode nd = node; + + while (val == -FDT_ERR_NOTFOUND) { + val = fdt_cells(gd->fdt_blob, ofnode_to_offset(nd), + "#address-cells"); + nd = ofnode_get_parent(nd); + } + + if (val == -FDT_ERR_NOTFOUND) + return OF_ROOT_NODE_ADDR_CELLS_DEFAULT; + else + return val; +} + /** * ofnode_read_size_cells() - Get the number of size cells for a node * @@ -671,6 +689,24 @@ int ofnode_read_addr_cells(ofnode node); */ int ofnode_read_size_cells(ofnode node); +static inline int __ofnode_read_size_cells(ofnode node) +{ + /* NOTE: this call walks up the parent stack */ + int val = -FDT_ERR_NOTFOUND; + ofnode nd = node; + + while (val == -FDT_ERR_NOTFOUND) { + val = fdt_cells(gd->fdt_blob, ofnode_to_offset(nd), + "#size-cells"); + nd = ofnode_get_parent(nd); + } + + if (val == -FDT_ERR_NOTFOUND) + return OF_ROOT_NODE_SIZE_CELLS_DEFAULT; + else + return val; +} + /** * ofnode_read_simple_addr_cells() - Get the address cells property in a node * diff --git a/include/dm/read.h b/include/dm/read.h index da8c7f25e7..0302c7bffb 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -789,14 +789,12 @@ static inline int dev_count_phandle_with_args(const struct udevice *dev, static inline int dev_read_addr_cells(const struct udevice *dev) { - /* NOTE: this call should walk up the parent stack */ - return fdt_address_cells(gd->fdt_blob, dev_of_offset(dev)); + return __ofnode_read_address_cells(dev_ofnode(dev)); } static inline int dev_read_size_cells(const struct udevice *dev) { - /* NOTE: this call should walk up the parent stack */ - return fdt_size_cells(gd->fdt_blob, dev_of_offset(dev)); + return __ofnode_read_size_cells(dev_ofnode(dev)); } static inline int dev_read_simple_addr_cells(const struct udevice *dev) -- 2.26.0
[PATCH 1/2] libfdt: Make fdt_cells function accessible
From: Matthias Brugger For reading address-cells and size-cells, the libfdt only provides functions which do not return in case the node does not provide the property. For traversing the DT to find the parent node which provides this property we will need to know that. Make fdt_cells accessible from outside of libfdt so that we can detect not present size- and address-cells properties in a node. Signed-off-by: Matthias Brugger --- scripts/dtc/libfdt/fdt_addresses.c | 2 +- scripts/dtc/libfdt/libfdt.h| 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/dtc/libfdt/fdt_addresses.c b/scripts/dtc/libfdt/fdt_addresses.c index 9a82cd0ba2..ead9460e95 100644 --- a/scripts/dtc/libfdt/fdt_addresses.c +++ b/scripts/dtc/libfdt/fdt_addresses.c @@ -11,7 +11,7 @@ #include "libfdt_internal.h" -static int fdt_cells(const void *fdt, int nodeoffset, const char *name) +int fdt_cells(const void *fdt, int nodeoffset, const char *name) { const fdt32_t *c; uint32_t val; diff --git a/scripts/dtc/libfdt/libfdt.h b/scripts/dtc/libfdt/libfdt.h index fa63fffe28..b0eca12491 100644 --- a/scripts/dtc/libfdt/libfdt.h +++ b/scripts/dtc/libfdt/libfdt.h @@ -1121,6 +1121,8 @@ const char *fdt_stringlist_get(const void *fdt, int nodeoffset, */ #define FDT_MAX_NCELLS 4 +int fdt_cells(const void *fdt, int nodeoffset, const char *name); + /** * fdt_address_cells - retrieve address size for a bus represented in the tree * @fdt: pointer to the device tree blob -- 2.26.0
[PATCH] configs: rpi: Set phy auto negotiation
From: Matthias Brugger Lower timeout for PHY auto negotiation as otherwise we have to wait for far too long. Signed-off-by: Matthias Brugger --- include/configs/rpi.h | 8 1 file changed, 8 insertions(+) diff --git a/include/configs/rpi.h b/include/configs/rpi.h index 83e258a6b9..18b817a001 100644 --- a/include/configs/rpi.h +++ b/include/configs/rpi.h @@ -74,6 +74,14 @@ #define CONFIG_TFTP_TSIZE #endif +/* + * RPi4 genet uses the generic phy support, set the + * timeout for auto-negotiation of the PHY in 50 ms units + */ +#ifdef PHYLIB +#define PHY_ANEG_TIMEOUT20 +#endif + /* Console configuration */ #define CONFIG_SYS_CBSIZE 1024 -- 2.24.1
[PATCH v4 1/2] Kconfig: add btrfs to distro boot
From: Matthias Brugger Some distributions use btrfs as the default file system. Enable btrfs support by default when using distro boot for all architectures but riscv, as it breaks compilation due to size problems. Signed-off-by: Matthias Brugger --- Changes in v4: - do not build for MIPS either Changes in v3: - use imply instead of select Changes in v2: - disable default btrfs support riscv Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/Kconfig b/Kconfig index d9be0daf23..f96f785c55 100644 --- a/Kconfig +++ b/Kconfig @@ -93,6 +93,7 @@ config DISTRO_DEFAULTS select HUSH_PARSER select SUPPORT_RAW_INITRD select SYS_LONGHELP + imply CMD_BTRFS if !RISCV && !MIPS imply CMD_MII if NET imply USB_STORAGE imply USE_BOOTCOMMAND -- 2.24.0
[PATCH v4 2/2] configs: Re-sync with CONFIG_DISTRO_DEFAULTS
From: Matthias Brugger CONFIG_DISTRO_DEFAULTS now enables CMD_BTRFS by default, we can delete the config option in the corresponding default configs. Other boards won't build with btrfs enabled so disable the support by default. Signed-off-by: Matthias Brugger --- Changes in v4: - disable for some boards Changes in v3: None Changes in v2: None configs/am335x_evm_defconfig | 2 ++ configs/sandbox64_defconfig | 1 - configs/sandbox_defconfig | 1 - configs/socfpga_arria10_defconfig | 2 ++ configs/turris_mox_defconfig | 1 - configs/turris_omnia_defconfig| 1 - 6 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/am335x_evm_defconfig b/configs/am335x_evm_defconfig index 335aa8cfa1..bae0571ed7 100644 --- a/configs/am335x_evm_defconfig +++ b/configs/am335x_evm_defconfig @@ -80,3 +80,5 @@ CONFIG_DYNAMIC_CRC_TABLE=y CONFIG_RSA=y CONFIG_LZO=y # CONFIG_OF_LIBFDT_OVERLAY is not set +# CONFIG_CMD_BTRFS is not set +# CONFIG_FS_BTRFS is not set diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index 64d1d3102f..0826c06aa9 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -63,7 +63,6 @@ CONFIG_CMD_REGULATOR=y CONFIG_CMD_AES=y CONFIG_CMD_TPM=y CONFIG_CMD_TPM_TEST=y -CONFIG_CMD_BTRFS=y CONFIG_CMD_CBFS=y CONFIG_CMD_CRAMFS=y CONFIG_CMD_EXT4_WRITE=y diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index d8d8645425..f2d5572f99 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -71,7 +71,6 @@ CONFIG_CMD_REGULATOR=y CONFIG_CMD_AES=y CONFIG_CMD_TPM=y CONFIG_CMD_TPM_TEST=y -CONFIG_CMD_BTRFS=y CONFIG_CMD_CBFS=y CONFIG_CMD_CRAMFS=y CONFIG_CMD_EXT4_WRITE=y diff --git a/configs/socfpga_arria10_defconfig b/configs/socfpga_arria10_defconfig index b4826548eb..fa7a5681ec 100644 --- a/configs/socfpga_arria10_defconfig +++ b/configs/socfpga_arria10_defconfig @@ -50,3 +50,5 @@ CONFIG_TIMER=y CONFIG_SPL_TIMER=y CONFIG_DESIGNWARE_APB_TIMER=y # CONFIG_SPL_WDT is not set +# CONFIG_CMD_BTRFS is not set +# CONFIG_FS_BTRFS is not set diff --git a/configs/turris_mox_defconfig b/configs/turris_mox_defconfig index b88cc4b842..89a1c73957 100644 --- a/configs/turris_mox_defconfig +++ b/configs/turris_mox_defconfig @@ -32,7 +32,6 @@ CONFIG_CMD_TFTPPUT=y CONFIG_CMD_CACHE=y CONFIG_CMD_TIME=y CONFIG_CMD_MVEBU_BUBT=y -CONFIG_CMD_BTRFS=y CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y CONFIG_OF_BOARD_FIXUP=y diff --git a/configs/turris_omnia_defconfig b/configs/turris_omnia_defconfig index b6cb9a5f9d..160f1de656 100644 --- a/configs/turris_omnia_defconfig +++ b/configs/turris_omnia_defconfig @@ -49,7 +49,6 @@ CONFIG_CMD_CACHE=y CONFIG_CMD_TIME=y CONFIG_CMD_AES=y CONFIG_CMD_HASH=y -CONFIG_CMD_BTRFS=y # CONFIG_SPL_PARTITION_UUIDS is not set CONFIG_DEFAULT_DEVICE_TREE="armada-385-turris-omnia" CONFIG_ENV_IS_IN_SPI_FLASH=y -- 2.24.0
[PATCH] buildman: Enable buildman on aarch64 hosts
From: Matthias Brugger At kernel.org aarch64 toolchains are published in folder arm64. Fix the URL for that case, so that we can fetch toolchains on aarch64 machines. Signed-off-by: Matthias Brugger --- tools/buildman/toolchain.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py index 4f39bfd0ce..89c54d688a 100644 --- a/tools/buildman/toolchain.py +++ b/tools/buildman/toolchain.py @@ -487,6 +487,8 @@ class Toolchains: URL containing this toolchain, if avaialble, else None """ arch = command.OutputOneLine('uname', '-m') +if arch == 'aarch64': +arch = 'arm64' base = 'https://www.kernel.org/pub/tools/crosstool/files/bin' versions = ['7.3.0', '6.4.0', '4.9.4'] links = [] -- 2.24.0
[PATCH v3 2/2] configs: Re-sync with CONFIG_DISTRO_DEFAULTS
From: Matthias Brugger CONFIG_DISTRO_DEFAULTS now enables CMD_BTRFS by default, we can delete the config option in the corresponding default configs. Signed-off-by: Matthias Brugger --- Changes in v3: None Changes in v2: None configs/sandbox64_defconfig| 1 - configs/sandbox_defconfig | 1 - configs/turris_mox_defconfig | 1 - configs/turris_omnia_defconfig | 1 - 4 files changed, 4 deletions(-) diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index 64d1d3102f..0826c06aa9 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -63,7 +63,6 @@ CONFIG_CMD_REGULATOR=y CONFIG_CMD_AES=y CONFIG_CMD_TPM=y CONFIG_CMD_TPM_TEST=y -CONFIG_CMD_BTRFS=y CONFIG_CMD_CBFS=y CONFIG_CMD_CRAMFS=y CONFIG_CMD_EXT4_WRITE=y diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index d8d8645425..f2d5572f99 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -71,7 +71,6 @@ CONFIG_CMD_REGULATOR=y CONFIG_CMD_AES=y CONFIG_CMD_TPM=y CONFIG_CMD_TPM_TEST=y -CONFIG_CMD_BTRFS=y CONFIG_CMD_CBFS=y CONFIG_CMD_CRAMFS=y CONFIG_CMD_EXT4_WRITE=y diff --git a/configs/turris_mox_defconfig b/configs/turris_mox_defconfig index b88cc4b842..89a1c73957 100644 --- a/configs/turris_mox_defconfig +++ b/configs/turris_mox_defconfig @@ -32,7 +32,6 @@ CONFIG_CMD_TFTPPUT=y CONFIG_CMD_CACHE=y CONFIG_CMD_TIME=y CONFIG_CMD_MVEBU_BUBT=y -CONFIG_CMD_BTRFS=y CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y CONFIG_OF_BOARD_FIXUP=y diff --git a/configs/turris_omnia_defconfig b/configs/turris_omnia_defconfig index b6cb9a5f9d..160f1de656 100644 --- a/configs/turris_omnia_defconfig +++ b/configs/turris_omnia_defconfig @@ -49,7 +49,6 @@ CONFIG_CMD_CACHE=y CONFIG_CMD_TIME=y CONFIG_CMD_AES=y CONFIG_CMD_HASH=y -CONFIG_CMD_BTRFS=y # CONFIG_SPL_PARTITION_UUIDS is not set CONFIG_DEFAULT_DEVICE_TREE="armada-385-turris-omnia" CONFIG_ENV_IS_IN_SPI_FLASH=y -- 2.24.0
[PATCH v3 1/2] Kconfig: add btrfs to distro boot
From: Matthias Brugger Some distributions use btrfs as the default file system. Enable btrfs support by default when using distro boot for all architectures but riscv, as it breaks compilation due to size problems. Signed-off-by: Matthias Brugger --- Changes in v3: - use imply instead of select Changes in v2: - disable default btrfs support riscv Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/Kconfig b/Kconfig index 99cc56f3c2..9c942c673d 100644 --- a/Kconfig +++ b/Kconfig @@ -93,6 +93,7 @@ config DISTRO_DEFAULTS select HUSH_PARSER select SUPPORT_RAW_INITRD select SYS_LONGHELP + imply CMD_BTRFS if !RISCV imply CMD_MII if NET imply USB_STORAGE imply USE_BOOTCOMMAND -- 2.24.0
[PATCH v2 1/2] Kconfig: add btrfs to distro boot
From: Matthias Brugger Some distributions use btrfs as the default file system. Enable btrfs support by default when using distro boot for all architectures but riscv, as it breaks compilation due to size problems. Signed-off-by: Matthias Brugger --- Changes in v2: - disable default btrfs support riscv Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/Kconfig b/Kconfig index 99cc56f3c2..f0abf91e99 100644 --- a/Kconfig +++ b/Kconfig @@ -79,6 +79,7 @@ config DISTRO_DEFAULTS select CMDLINE_EDITING select CMD_BOOTI if ARM64 select CMD_BOOTZ if ARM && !ARM64 + select CMD_BTRFS if !RISCV select CMD_DHCP if CMD_NET select CMD_ENV_EXISTS select CMD_EXT2 -- 2.24.0
[PATCH v2 2/2] configs: Re-sync with CONFIG_DISTRO_DEFAULTS
From: Matthias Brugger CONFIG_DISTRO_DEFAULTS now enables CMD_BTRFS by default, we can delete the config option in the corresponding default configs. Signed-off-by: Matthias Brugger --- Changes in v2: None configs/sandbox64_defconfig| 1 - configs/sandbox_defconfig | 1 - configs/turris_mox_defconfig | 1 - configs/turris_omnia_defconfig | 1 - 4 files changed, 4 deletions(-) diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index 64d1d3102f..0826c06aa9 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -63,7 +63,6 @@ CONFIG_CMD_REGULATOR=y CONFIG_CMD_AES=y CONFIG_CMD_TPM=y CONFIG_CMD_TPM_TEST=y -CONFIG_CMD_BTRFS=y CONFIG_CMD_CBFS=y CONFIG_CMD_CRAMFS=y CONFIG_CMD_EXT4_WRITE=y diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index d8d8645425..f2d5572f99 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -71,7 +71,6 @@ CONFIG_CMD_REGULATOR=y CONFIG_CMD_AES=y CONFIG_CMD_TPM=y CONFIG_CMD_TPM_TEST=y -CONFIG_CMD_BTRFS=y CONFIG_CMD_CBFS=y CONFIG_CMD_CRAMFS=y CONFIG_CMD_EXT4_WRITE=y diff --git a/configs/turris_mox_defconfig b/configs/turris_mox_defconfig index b88cc4b842..89a1c73957 100644 --- a/configs/turris_mox_defconfig +++ b/configs/turris_mox_defconfig @@ -32,7 +32,6 @@ CONFIG_CMD_TFTPPUT=y CONFIG_CMD_CACHE=y CONFIG_CMD_TIME=y CONFIG_CMD_MVEBU_BUBT=y -CONFIG_CMD_BTRFS=y CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y CONFIG_OF_BOARD_FIXUP=y diff --git a/configs/turris_omnia_defconfig b/configs/turris_omnia_defconfig index b6cb9a5f9d..160f1de656 100644 --- a/configs/turris_omnia_defconfig +++ b/configs/turris_omnia_defconfig @@ -49,7 +49,6 @@ CONFIG_CMD_CACHE=y CONFIG_CMD_TIME=y CONFIG_CMD_AES=y CONFIG_CMD_HASH=y -CONFIG_CMD_BTRFS=y # CONFIG_SPL_PARTITION_UUIDS is not set CONFIG_DEFAULT_DEVICE_TREE="armada-385-turris-omnia" CONFIG_ENV_IS_IN_SPI_FLASH=y -- 2.24.0
[PATCH 2/2] configs: Re-sync with CONFIG_DISTRO_DEFAULTS
From: Matthias Brugger CONFIG_DISTRO_DEFAULTS now enables CMD_BTRFS by default, we can delete the config option in the corresponding default configs. Signed-off-by: Matthias Brugger --- configs/sandbox64_defconfig| 1 - configs/sandbox_defconfig | 1 - configs/turris_mox_defconfig | 1 - configs/turris_omnia_defconfig | 1 - 4 files changed, 4 deletions(-) diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index b06ffcec3a..c50b5782c8 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -63,7 +63,6 @@ CONFIG_CMD_REGULATOR=y CONFIG_CMD_AES=y CONFIG_CMD_TPM=y CONFIG_CMD_TPM_TEST=y -CONFIG_CMD_BTRFS=y CONFIG_CMD_CBFS=y CONFIG_CMD_CRAMFS=y CONFIG_CMD_EXT4_WRITE=y diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index 858ad04b10..20524bc68b 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -71,7 +71,6 @@ CONFIG_CMD_REGULATOR=y CONFIG_CMD_AES=y CONFIG_CMD_TPM=y CONFIG_CMD_TPM_TEST=y -CONFIG_CMD_BTRFS=y CONFIG_CMD_CBFS=y CONFIG_CMD_CRAMFS=y CONFIG_CMD_EXT4_WRITE=y diff --git a/configs/turris_mox_defconfig b/configs/turris_mox_defconfig index b88cc4b842..89a1c73957 100644 --- a/configs/turris_mox_defconfig +++ b/configs/turris_mox_defconfig @@ -32,7 +32,6 @@ CONFIG_CMD_TFTPPUT=y CONFIG_CMD_CACHE=y CONFIG_CMD_TIME=y CONFIG_CMD_MVEBU_BUBT=y -CONFIG_CMD_BTRFS=y CONFIG_CMD_EXT4_WRITE=y CONFIG_MAC_PARTITION=y CONFIG_OF_BOARD_FIXUP=y diff --git a/configs/turris_omnia_defconfig b/configs/turris_omnia_defconfig index b6cb9a5f9d..160f1de656 100644 --- a/configs/turris_omnia_defconfig +++ b/configs/turris_omnia_defconfig @@ -49,7 +49,6 @@ CONFIG_CMD_CACHE=y CONFIG_CMD_TIME=y CONFIG_CMD_AES=y CONFIG_CMD_HASH=y -CONFIG_CMD_BTRFS=y # CONFIG_SPL_PARTITION_UUIDS is not set CONFIG_DEFAULT_DEVICE_TREE="armada-385-turris-omnia" CONFIG_ENV_IS_IN_SPI_FLASH=y -- 2.24.0
[PATCH 1/2] Kconfig: add btrfs to distro boot
From: Matthias Brugger Some distributions use btrfs as the default file system. Enable btrfs support by default when using distro boot. Signed-off-by: Matthias Brugger --- Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/Kconfig b/Kconfig index 99cc56f3c2..ced0e3021e 100644 --- a/Kconfig +++ b/Kconfig @@ -79,6 +79,7 @@ config DISTRO_DEFAULTS select CMDLINE_EDITING select CMD_BOOTI if ARM64 select CMD_BOOTZ if ARM && !ARM64 + select CMD_BTRFS select CMD_DHCP if CMD_NET select CMD_ENV_EXISTS select CMD_EXT2 -- 2.24.0
[PATCH v2 1/3] rpi: fix dram bank initialization
From: Matthias Brugger To update the dram bank information from device-tree we use fdtdec_decode_ram_size() which expectes the the size-cells and address-cells to be defined in the memory node. For normal system RAM these values are defined in the root node. When the values differ from the default values defined in the spec, we can end up with wrong RAM bank information. Switch to the "standard" way to update the RAM bank information to avoid this. Fixes: 9de5b89e4c ("rpi4: enable dram bank initialization") Signed-off-by: Matthias Brugger --- Changes in v2: None board/raspberrypi/rpi/rpi.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index 5f120ea9c2..e19610f40f 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -275,8 +275,13 @@ int dram_init(void) #ifdef CONFIG_BCM2711 int dram_init_banksize(void) { - return fdtdec_decode_ram_size(gd->fdt_blob, NULL, 0, NULL, -(phys_size_t *)>ram_size, gd->bd); + int ret; + + ret = fdtdec_setup_memory_banksize(); + if (ret) + return ret; + + return fdtdec_setup_mem_size_base(); } #endif #endif -- 2.24.0
[PATCH v2 2/3] rpi: Enable DRAM bank initialization on arm64
From: Matthias Brugger Up to now we only update the DRAM banks when we are define CONFIG_BCM2711. But our one binary approach uses a config that supports BCM2837 and BCM2711. As a result we only see one gibibyte of RAM on Raspberry Pi 4, even if it has more RAM. Fix this by calling dram_init_banksize. Fixes: 5694090670 ("ARM: defconfig: add unified config for RPi3 and RPi4") Signed-off-by: Matthias Brugger --- Changes in v2: - fix commit message - call dram_init_banksize independent of ARM64 board/raspberrypi/rpi/rpi.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index e19610f40f..e367ba3092 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -272,7 +272,6 @@ int dram_init(void) } #ifdef CONFIG_OF_BOARD -#ifdef CONFIG_BCM2711 int dram_init_banksize(void) { int ret; @@ -284,7 +283,6 @@ int dram_init_banksize(void) return fdtdec_setup_mem_size_base(); } #endif -#endif static void set_fdtfile(void) { -- 2.24.0
[PATCH v2 3/3] ARM: defconfig: Fix 32bit config for RPi4
From: Matthias Brugger The rpi_4_32b_defconfig states that only one DRAM bank is present. This leads to a wrong configuration of the available DRAM. Fix this by setting the DRAM bank config accordingly. Fixes: 193279d784 ("RPI: Add defconfigs for rpi4 (32/64)") Signed-off-by: Matthias Brugger --- Changes in v2: - fix rpi_4_32b_defconfig configs/rpi_4_32b_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig index 7ff390cd24..ce729df2a0 100644 --- a/configs/rpi_4_32b_defconfig +++ b/configs/rpi_4_32b_defconfig @@ -4,7 +4,7 @@ CONFIG_SYS_TEXT_BASE=0x8000 CONFIG_TARGET_RPI_4_32B=y CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_ENV_SIZE=0x4000 -CONFIG_NR_DRAM_BANKS=1 +CONFIG_NR_DRAM_BANKS=2 CONFIG_DISTRO_DEFAULTS=y CONFIG_OF_BOARD_SETUP=y # CONFIG_ARCH_FIXUP_FDT_MEMORY is not set -- 2.24.0
[PATCH 1/2] rpi: fix dram bank initialization
From: Matthias Brugger To update the dram bank information from device-tree we use fdtdec_decode_ram_size() which expectes the the size-cells and address-cells to be defined in the memory node. For normal system RAM these values are defined in the root node. When the values differ from the default values defined in the spec, we can end up with wrong RAM bank information. Switch to the "standard" way to update the RAM bank information to avoid this. Fixes: 9de5b89e4c ("rpi4: enable dram bank initialization") Signed-off-by: Matthias Brugger --- board/raspberrypi/rpi/rpi.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index 3d4afaf653..76f1c55b65 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -274,8 +274,13 @@ int dram_init(void) #ifdef CONFIG_BCM2711 int dram_init_banksize(void) { - return fdtdec_decode_ram_size(gd->fdt_blob, NULL, 0, NULL, -(phys_size_t *)>ram_size, gd->bd); + int ret; + + ret = fdtdec_setup_memory_banksize(); + if (ret) + return ret; + + return fdtdec_setup_mem_size_base(); } #endif #endif -- 2.24.0
[PATCH 2/2] rpi: Enable DRAM bank initialization on arm64
From: Matthias Brugger Up to now we only update the DRAM banks when we are define CONFIG_BCM2711. But our one binary approach uses a config that supports BCM2837 and BCM2711. As a result we only see one gigabyte of RAM on Raspberry Pi 4, although it has more RAM. Fix this by calling dram_init_banksize when we are booting a U-Boot build for arm64. Fixes: 5694090670 ("ARM: defconfig: add unified config for RPi3 and RPi4") Signed-off-by: Matthias Brugger --- board/raspberrypi/rpi/rpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index 76f1c55b65..35fcef2b56 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -271,7 +271,7 @@ int dram_init(void) } #ifdef CONFIG_OF_BOARD -#ifdef CONFIG_BCM2711 +#ifdef CONFIG_ARM64 int dram_init_banksize(void) { int ret; -- 2.24.0
[U-Boot] [PATCH v1] MAINTAINERS: Add info for bcm283x
From: Matthias Brugger The bcm283x has grown in files, which was not reflected in the MAINTAINERS file. Fix this by adding the missing entries. Signed-off-by: Matthias Brugger --- MAINTAINERS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 332fd9d74c..8d588b7d64 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -150,7 +150,9 @@ N: meson ARM BROADCOM BCM283X M: Matthias Brugger S: Maintained +F: arch/arm/dts/bcm283* F: arch/arm/mach-bcm283x/ +F: board/raspberrypi/ F: drivers/gpio/bcm2835_gpio.c F: drivers/mmc/bcm2835_sdhci.c F: drivers/mmc/bcm2835_sdhost.c @@ -158,6 +160,7 @@ F: drivers/serial/serial_bcm283x_mu.c F: drivers/serial/serial_bcm283x_pl011.c F: drivers/video/bcm2835.c F: include/dm/platform_data/serial_bcm283x_mu.h +F: include/dt-bindings/pinctrl/bcm2835.h F: drivers/pinctrl/broadcom/ ARM BROADCOM BCMSTB -- 2.24.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 2/4] ARM: bcm283x: Move BCM283x_BASE to a global variable
From: Matthias Brugger We move the per SOC define BCM283x_BASE to a global variable. This is a first step to provide a single binary for several bcm283x SoCs. Signed-off-by: Matthias Brugger --- Changes in v4: None Changes in v3: None Changes in v2: - fix register access in reset_cpu() arch/arm/mach-bcm283x/include/mach/base.h | 11 +++ arch/arm/mach-bcm283x/include/mach/mbox.h | 4 +++- arch/arm/mach-bcm283x/include/mach/sdhci.h | 5 - arch/arm/mach-bcm283x/include/mach/timer.h | 7 ++- arch/arm/mach-bcm283x/include/mach/wdog.h | 5 - arch/arm/mach-bcm283x/init.c | 8 arch/arm/mach-bcm283x/mbox.c | 1 + arch/arm/mach-bcm283x/reset.c | 20 +++- include/configs/rpi.h | 4 9 files changed, 56 insertions(+), 9 deletions(-) create mode 100644 arch/arm/mach-bcm283x/include/mach/base.h diff --git a/arch/arm/mach-bcm283x/include/mach/base.h b/arch/arm/mach-bcm283x/include/mach/base.h new file mode 100644 index 00..c4ae39852f --- /dev/null +++ b/arch/arm/mach-bcm283x/include/mach/base.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * (C) Copyright 2019 Matthias Brugger + */ + +#ifndef _BCM283x_BASE_H_ +#define _BCM283x_BASE_H_ + +extern unsigned long rpi_bcm283x_base; + +#endif diff --git a/arch/arm/mach-bcm283x/include/mach/mbox.h b/arch/arm/mach-bcm283x/include/mach/mbox.h index 0b6c2543d5..60e226ce1d 100644 --- a/arch/arm/mach-bcm283x/include/mach/mbox.h +++ b/arch/arm/mach-bcm283x/include/mach/mbox.h @@ -7,6 +7,7 @@ #define _BCM2835_MBOX_H #include +#include /* * The BCM2835 SoC contains (at least) two CPUs; the VideoCore (a/k/a "GPU") @@ -37,7 +38,8 @@ /* Raw mailbox HW */ -#define BCM2835_MBOX_PHYSADDR (CONFIG_BCM283x_BASE + 0xb880) +#define BCM2835_MBOX_PHYSADDR ({ BUG_ON(!rpi_bcm283x_base); \ +rpi_bcm283x_base + 0xb880; }) struct bcm2835_mbox_regs { u32 read; diff --git a/arch/arm/mach-bcm283x/include/mach/sdhci.h b/arch/arm/mach-bcm283x/include/mach/sdhci.h index b443c379d8..7323690687 100644 --- a/arch/arm/mach-bcm283x/include/mach/sdhci.h +++ b/arch/arm/mach-bcm283x/include/mach/sdhci.h @@ -6,7 +6,10 @@ #ifndef _BCM2835_SDHCI_H_ #define _BCM2835_SDHCI_H_ -#define BCM2835_SDHCI_BASE (CONFIG_BCM283x_BASE + 0x0030) +#include + +#define BCM2835_SDHCI_PHYSADDR ({ BUG_ON(!rpi_bcm283x_base); \ + rpi_bcm283x_base + 0x0030; }) int bcm2835_sdhci_init(u32 regbase, u32 emmc_freq); diff --git a/arch/arm/mach-bcm283x/include/mach/timer.h b/arch/arm/mach-bcm283x/include/mach/timer.h index 61beb1aba1..01c0ebad64 100644 --- a/arch/arm/mach-bcm283x/include/mach/timer.h +++ b/arch/arm/mach-bcm283x/include/mach/timer.h @@ -6,7 +6,12 @@ #ifndef _BCM2835_TIMER_H #define _BCM2835_TIMER_H -#define BCM2835_TIMER_PHYSADDR (CONFIG_BCM283x_BASE + 0x3000) +#ifndef __ASSEMBLY__ +#include +#endif + +#define BCM2835_TIMER_PHYSADDR ({ BUG_ON(!rpi_bcm283x_base); \ + rpi_bcm283x_base + 0x3000; }) #define BCM2835_TIMER_CS_M3(1 << 3) #define BCM2835_TIMER_CS_M2(1 << 2) diff --git a/arch/arm/mach-bcm283x/include/mach/wdog.h b/arch/arm/mach-bcm283x/include/mach/wdog.h index 8292b3cf1f..9942666720 100644 --- a/arch/arm/mach-bcm283x/include/mach/wdog.h +++ b/arch/arm/mach-bcm283x/include/mach/wdog.h @@ -6,7 +6,10 @@ #ifndef _BCM2835_WDOG_H #define _BCM2835_WDOG_H -#define BCM2835_WDOG_PHYSADDR (CONFIG_BCM283x_BASE + 0x0010) +#include + +#define BCM2835_WDOG_PHYSADDR ({ BUG_ON(!rpi_bcm283x_base); \ +rpi_bcm283x_base + 0x0010; }) struct bcm2835_wdog_regs { u32 unknown0[7]; diff --git a/arch/arm/mach-bcm283x/init.c b/arch/arm/mach-bcm283x/init.c index 97414415a6..d36017e823 100644 --- a/arch/arm/mach-bcm283x/init.c +++ b/arch/arm/mach-bcm283x/init.c @@ -8,6 +8,8 @@ #include +unsigned long rpi_bcm283x_base; + int arch_cpu_init(void) { icache_enable(); @@ -15,6 +17,12 @@ int arch_cpu_init(void) return 0; } +int mach_cpu_init(void) +{ + rpi_bcm283x_base = CONFIG_BCM283x_BASE; + + return 0; +} #ifdef CONFIG_ARMV7_LPAE void enable_caches(void) { diff --git a/arch/arm/mach-bcm283x/mbox.c b/arch/arm/mach-bcm283x/mbox.c index 3c67f68c17..467d0d5fba 100644 --- a/arch/arm/mach-bcm283x/mbox.c +++ b/arch/arm/mach-bcm283x/mbox.c @@ -5,6 +5,7 @@ #include #include +#include #include #include diff --git a/arch/arm/mach-bcm283x/reset.c b/arch/arm/mach-bcm283x/reset.c index b3da0c7cd6..cd8138d702 100644 --- a/arch/arm/mach-bcm283x/reset.c +++ b/arch/arm/mach-bcm283x/reset.c @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -25,10 +26,10 @@ void hw_watchdog_disable(void) {} -__efi_runtime_data struct bcm2835_wdog_regs *wdog_regs = - (struct bcm2835_wdog_regs *)BCM2835_WDOG_PHYSADDR;
[U-Boot] [PATCH v4 3/4] ARM: bcm283x: Set rpi_bcm283x_base at run-time
From: Matthias Brugger As part of the effort to create one binary for several bcm83x SoCs we read the IO base address from device-tree. Signed-off-by: Matthias Brugger --- Changes in v4: - read IO base from device-tree Changes in v3: None Changes in v2: - rename BCM2838 to BCM2711 in the correct patch - push rpi_bcm283x_base into the .data section arch/arm/mach-bcm283x/Kconfig | 6 -- arch/arm/mach-bcm283x/init.c | 20 ++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-bcm283x/Kconfig b/arch/arm/mach-bcm283x/Kconfig index b08275f598..e8e0ff0eb4 100644 --- a/arch/arm/mach-bcm283x/Kconfig +++ b/arch/arm/mach-bcm283x/Kconfig @@ -202,10 +202,4 @@ config SYS_SOC config SYS_CONFIG_NAME default "rpi" -config BCM283x_BASE - hex - default "0x2000" if BCM2835 - default "0x3f00" if BCM2836 || BCM2837 - default "0xfe00" if BCM2711 - endmenu diff --git a/arch/arm/mach-bcm283x/init.c b/arch/arm/mach-bcm283x/init.c index d36017e823..b3f3dfabea 100644 --- a/arch/arm/mach-bcm283x/init.c +++ b/arch/arm/mach-bcm283x/init.c @@ -7,8 +7,10 @@ */ #include +#include +#include -unsigned long rpi_bcm283x_base; +unsigned long rpi_bcm283x_base = 0x3f00; int arch_cpu_init(void) { @@ -19,10 +21,24 @@ int arch_cpu_init(void) int mach_cpu_init(void) { - rpi_bcm283x_base = CONFIG_BCM283x_BASE; + int ret, soc_offset; + u64 io_base, size; + + /* Get IO base from device tree */ + soc_offset = fdt_path_offset(gd->fdt_blob, "/soc"); + if (soc_offset < 0) + return soc_offset; + + ret = fdt_read_range((void *)gd->fdt_blob, soc_offset, 0, NULL, + _base, ); + if (ret) + return ret; + + rpi_bcm283x_base = io_base; return 0; } + #ifdef CONFIG_ARMV7_LPAE void enable_caches(void) { -- 2.24.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 4/4] ARM: bcm283x: Set memory map at run-time
From: Matthias Brugger For bcm283x based on arm64 we also have to change the mm_region. Add assign this in mach_cpu_init() so we can create now one binary for RPi3 and RPi4. Signed-off-by: Matthias Brugger --- Changes in v4: - call rpi_update_mem_map only for ARM64 - get rid of struct pdata Changes in v3: None Changes in v2: - Move mem_map out of assembly file - push mem_map into the .data section - update the members of mem_map instead of the pointer arch/arm/mach-bcm283x/init.c | 92 board/raspberrypi/rpi/rpi.c | 45 -- 2 files changed, 92 insertions(+), 45 deletions(-) diff --git a/arch/arm/mach-bcm283x/init.c b/arch/arm/mach-bcm283x/init.c index b3f3dfabea..6fb41a99b2 100644 --- a/arch/arm/mach-bcm283x/init.c +++ b/arch/arm/mach-bcm283x/init.c @@ -10,6 +10,96 @@ #include #include +#ifdef CONFIG_ARM64 +#include + +static struct mm_region bcm283x_mem_map[] = { + { + .virt = 0xUL, + .phys = 0xUL, + .size = 0x3f00UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | +PTE_BLOCK_INNER_SHARE + }, { + .virt = 0x3f00UL, + .phys = 0x3f00UL, + .size = 0x0100UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | +PTE_BLOCK_NON_SHARE | +PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* List terminator */ + 0, + } +}; + +static struct mm_region bcm2711_mem_map[] = { + { + .virt = 0xUL, + .phys = 0xUL, + .size = 0xfe00UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | +PTE_BLOCK_INNER_SHARE + }, { + .virt = 0xfe00UL, + .phys = 0xfe00UL, + .size = 0x0180UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | +PTE_BLOCK_NON_SHARE | +PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* List terminator */ + 0, + } +}; + +struct mm_region *mem_map = bcm283x_mem_map; + +/* + * I/O address space varies on different chip versions. + * We set the base address by inspecting the DTB. + */ +static const struct udevice_id board_ids[] = { + { .compatible = "brcm,bcm2837", .data = (ulong)_mem_map}, + { .compatible = "brcm,bcm2838", .data = (ulong)_mem_map}, + { .compatible = "brcm,bcm2711", .data = (ulong)_mem_map}, + { }, +}; + +static void _rpi_update_mem_map(struct mm_region *pd) +{ + int i; + + for (i = 0; i < 2; i++) { + mem_map[i].virt = pd[i].virt; + mem_map[i].phys = pd[i].phys; + mem_map[i].size = pd[i].size; + mem_map[i].attrs = pd[i].attrs; + } +} + +static void rpi_update_mem_map(void) +{ + int ret; + struct mm_region *mm; + const struct udevice_id *of_match = board_ids; + + while (of_match->compatible) { + ret = fdt_node_check_compatible(gd->fdt_blob, 0, + of_match->compatible); + if (!ret) { + mm = (struct mm_region *)of_match->data; + _rpi_update_mem_map(mm); + break; + } + + of_match++; + } +} +#else +static void rpi_update_mem_map(void) {} +#endif + unsigned long rpi_bcm283x_base = 0x3f00; int arch_cpu_init(void) @@ -24,6 +114,8 @@ int mach_cpu_init(void) int ret, soc_offset; u64 io_base, size; + rpi_update_mem_map(); + /* Get IO base from device tree */ soc_offset = fdt_path_offset(gd->fdt_blob, "/soc"); if (soc_offset < 0) diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index e84a1db14a..3d4afaf653 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -251,51 +251,6 @@ static uint32_t rev_scheme; static uint32_t rev_type; static const struct rpi_model *model; -#ifdef CONFIG_ARM64 -#ifndef CONFIG_BCM2711 -static struct mm_region bcm283x_mem_map[] = { - { - .virt = 0xUL, - .phys = 0xUL, - .size = 0x3f00UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | -PTE_BLOCK_INNER_SHARE - }, { - .virt = 0x3f00UL, - .phys = 0x3f00UL, - .size = 0x0100UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | -PTE_BLOCK_NON_SHARE | -PTE_BLOCK_PXN | PTE_BLOCK_UXN - }, { - /* List terminator */ - 0, - } -}; -#else -static struct mm_region bcm283x_mem_map[] = { - { - .virt = 0xUL, -
[U-Boot] [PATCH v4 1/4] rpi: push fw_dtb_pointer in the .data section
From: Matthias Brugger The fw_dtb_pointer was defined in the assembly code, which makes him live in section .text_rest Put that's not necessary, we can push the variable in the .data section. This will prevent relocation errors like: board/raspberrypi/rpi/rpi.c:317:(.text.board_get_usable_ram_top+0x8): relocation truncated to fit: R_AARCH64_LDST64_ABS_LO12_NC against symbol `fw_dtb_pointer' defined in .text section in board/raspberrypi/rpi/built-in.o Signed-off-by: Matthias Brugger --- Changes in v4: - use gcc attribute instead of random assignment Changes in v3: - fix armv7 build Changes in v2: - push fw_dtb_pointer into the .data section board/raspberrypi/rpi/lowlevel_init.S | 12 ++-- board/raspberrypi/rpi/rpi.c | 7 +-- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/board/raspberrypi/rpi/lowlevel_init.S b/board/raspberrypi/rpi/lowlevel_init.S index 435eed521f..8c39b3e12e 100644 --- a/board/raspberrypi/rpi/lowlevel_init.S +++ b/board/raspberrypi/rpi/lowlevel_init.S @@ -6,15 +6,6 @@ #include -.align 8 -.global fw_dtb_pointer -fw_dtb_pointer: -#ifdef CONFIG_ARM64 - .dword 0x0 -#else - .word 0x0 -#endif - /* * Routine: save_boot_params (called after reset from start.S) * Description: save ATAG/FDT address provided by the firmware at boot time @@ -28,7 +19,8 @@ save_boot_params: adr x8, fw_dtb_pointer str x0, [x8] #else - str r2, fw_dtb_pointer + ldr r8, =fw_dtb_pointer + str r2, [r8] #endif /* Returns */ diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index 9e0abdda31..e84a1db14a 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -27,8 +27,11 @@ DECLARE_GLOBAL_DATA_PTR; -/* From lowlevel_init.S */ -extern unsigned long fw_dtb_pointer; +/* Assigned in lowlevel_init.S + * Push the variable into the .data section so that it + * does not get cleared later. + */ +unsigned long __section(".data") fw_dtb_pointer; /* TODO(s...@chromium.org): Move these to the msg.c file */ struct msg_get_arm_mem { -- 2.24.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 0/4] RPi one binary for RPi3/4 and RPi1/2
From: Matthias Brugger In this series we prepare the RaspberryPi source code to be able to build one binary for RPi[3,4] and one for RPi[1,2]. To achieve this we need to set the IO base address on runtime. Apart from that, for arm64 we also need to set memory region correctly. This patches fix this stuff. With this we could create one binary for each armv7 and armv8 based RPis. There is still some work to do to create a unified config, which will be done in a later patch series. Changes in v4: - use gcc attribute instead of random assignment - read IO base from device-tree - call rpi_update_mem_map only for ARM64 - get rid of struct pdata Changes in v3: - fix armv7 build Changes in v2: - push fw_dtb_pointer into the .data section - fix register access in reset_cpu() - rename BCM2838 to BCM2711 in the correct patch - push rpi_bcm283x_base into the .data section - Move mem_map out of assembly file - push mem_map into the .data section - update the members of mem_map instead of the pointer Matthias Brugger (4): rpi: push fw_dtb_pointer in the .data section ARM: bcm283x: Move BCM283x_BASE to a global variable ARM: bcm283x: Set rpi_bcm283x_base at run-time ARM: bcm283x: Set memory map at run-time arch/arm/mach-bcm283x/Kconfig | 6 -- arch/arm/mach-bcm283x/include/mach/base.h | 11 ++ arch/arm/mach-bcm283x/include/mach/mbox.h | 4 +- arch/arm/mach-bcm283x/include/mach/sdhci.h | 5 +- arch/arm/mach-bcm283x/include/mach/timer.h | 7 +- arch/arm/mach-bcm283x/include/mach/wdog.h | 5 +- arch/arm/mach-bcm283x/init.c | 116 + arch/arm/mach-bcm283x/mbox.c | 1 + arch/arm/mach-bcm283x/reset.c | 20 +++- board/raspberrypi/rpi/lowlevel_init.S | 12 +-- board/raspberrypi/rpi/rpi.c| 52 + include/configs/rpi.h | 4 + 12 files changed, 171 insertions(+), 72 deletions(-) create mode 100644 arch/arm/mach-bcm283x/include/mach/base.h -- 2.24.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 3/4] ARM: bcm283x: Set rpi_bcm283x_base at run-time
From: Matthias Brugger As part of the effort to create one binary for several bcm83x SoCs we use the SoC compatible to decide which IO base address we use. Signed-off-by: Matthias Brugger --- Changes in v3: None Changes in v2: - rename BCM2838 to BCM2711 in the correct patch - push rpi_bcm283x_base into the .data section arch/arm/mach-bcm283x/Kconfig | 6 arch/arm/mach-bcm283x/init.c | 62 +-- 2 files changed, 60 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-bcm283x/Kconfig b/arch/arm/mach-bcm283x/Kconfig index b08275f598..e8e0ff0eb4 100644 --- a/arch/arm/mach-bcm283x/Kconfig +++ b/arch/arm/mach-bcm283x/Kconfig @@ -202,10 +202,4 @@ config SYS_SOC config SYS_CONFIG_NAME default "rpi" -config BCM283x_BASE - hex - default "0x2000" if BCM2835 - default "0x3f00" if BCM2836 || BCM2837 - default "0xfe00" if BCM2711 - endmenu diff --git a/arch/arm/mach-bcm283x/init.c b/arch/arm/mach-bcm283x/init.c index d36017e823..d374fb60ba 100644 --- a/arch/arm/mach-bcm283x/init.c +++ b/arch/arm/mach-bcm283x/init.c @@ -7,8 +7,48 @@ */ #include +#include -unsigned long rpi_bcm283x_base; +#define PDATA_BCM2835 0 +#define PDATA_BCM2836 1 +#define PDATA_BCM2837 2 +#define PDATA_BCM2711 3 + +unsigned long rpi_bcm283x_base = 0x3f00; + +struct bcm283x_pdata { + unsigned long io_base; +}; + +struct bcm283x_pdata pdata_bcm283x[] = { + [PDATA_BCM2835] = { + .io_base = 0x2000, + }, + [PDATA_BCM2836] = { + .io_base = 0x3f00, + }, +#ifdef CONFIG_ARM64 + [PDATA_BCM2837] = { + .io_base = 0x3f00, + }, + [PDATA_BCM2711] = { + .io_base = 0xfe00, + }, +#endif +}; + +/* + * I/O address space varies on different chip versions. + * We set the base address by inspecting the DTB. + */ +static const struct udevice_id board_ids[] = { + { .compatible = "brcm,bcm2835", .data = PDATA_BCM2835}, + { .compatible = "brcm,bcm2836", .data = PDATA_BCM2836}, + { .compatible = "brcm,bcm2837", .data = PDATA_BCM2837}, + { .compatible = "brcm,bcm2838", .data = PDATA_BCM2711}, + { .compatible = "brcm,bcm2711", .data = PDATA_BCM2711}, + { }, +}; int arch_cpu_init(void) { @@ -19,10 +59,28 @@ int arch_cpu_init(void) int mach_cpu_init(void) { - rpi_bcm283x_base = CONFIG_BCM283x_BASE; + const struct udevice_id *of_match = board_ids; + int ret; + + rpi_bcm283x_base = 0; + + while (of_match->compatible) { + struct bcm283x_pdata pdat; + + ret = fdt_node_check_compatible(gd->fdt_blob, 0, + of_match->compatible); + if (!ret) { + pdat = pdata_bcm283x[of_match->data]; + rpi_bcm283x_base = pdat.io_base; + break; + } + + of_match++; + } return 0; } + #ifdef CONFIG_ARMV7_LPAE void enable_caches(void) { -- 2.24.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 4/4] ARM: bcm283x: Set memory map at run-time
From: Matthias Brugger For bcm283x based on arm64 we also have to change the mm_region. Add assign this in mach_cpu_init() so we can create now one binary for RPi3 and RPi4. Signed-off-by: Matthias Brugger --- Changes in v3: None Changes in v2: - Move mem_map out of assembly file - push mem_map into the .data section - update the members of mem_map inestead of the pointer arch/arm/mach-bcm283x/init.c | 74 board/raspberrypi/rpi/rpi.c | 45 -- 2 files changed, 74 insertions(+), 45 deletions(-) diff --git a/arch/arm/mach-bcm283x/init.c b/arch/arm/mach-bcm283x/init.c index d374fb60ba..639a5cf975 100644 --- a/arch/arm/mach-bcm283x/init.c +++ b/arch/arm/mach-bcm283x/init.c @@ -8,6 +8,9 @@ #include #include +#ifdef CONFIG_ARM64 +#include +#endif #define PDATA_BCM2835 0 #define PDATA_BCM2836 1 @@ -16,23 +19,77 @@ unsigned long rpi_bcm283x_base = 0x3f00; +#ifdef CONFIG_ARM64 +static struct mm_region bcm283x_mem_map[] = { + { + .virt = 0xUL, + .phys = 0xUL, + .size = 0x3f00UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | +PTE_BLOCK_INNER_SHARE + }, { + .virt = 0x3f00UL, + .phys = 0x3f00UL, + .size = 0x0100UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | +PTE_BLOCK_NON_SHARE | +PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* List terminator */ + 0, + } +}; + +static struct mm_region bcm2711_mem_map[] = { + { + .virt = 0xUL, + .phys = 0xUL, + .size = 0xfe00UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | +PTE_BLOCK_INNER_SHARE + }, { + .virt = 0xfe00UL, + .phys = 0xfe00UL, + .size = 0x0180UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | +PTE_BLOCK_NON_SHARE | +PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* List terminator */ + 0, + } +}; + +struct mm_region *mem_map = bcm283x_mem_map; + +#else +struct mm_region { + /* dummy struct */ +}; +#endif + struct bcm283x_pdata { unsigned long io_base; + struct mm_region *m_map; }; struct bcm283x_pdata pdata_bcm283x[] = { [PDATA_BCM2835] = { .io_base = 0x2000, + .m_map = NULL, }, [PDATA_BCM2836] = { .io_base = 0x3f00, + .m_map = NULL, }, #ifdef CONFIG_ARM64 [PDATA_BCM2837] = { .io_base = 0x3f00, + .m_map = bcm283x_mem_map, }, [PDATA_BCM2711] = { .io_base = 0xfe00, + .m_map = bcm2711_mem_map }, #endif }; @@ -57,6 +114,22 @@ int arch_cpu_init(void) return 0; } +#ifdef CONFIG_ARM64 +static void rpi_updated_mem_map(struct mm_region *pd) +{ + int i; + + for (i = 0; i < 2; i++) { + mem_map[i].virt = pd[i].virt; + mem_map[i].phys = pd[i].phys; + mem_map[i].size = pd[i].size; + mem_map[i].attrs = pd[i].attrs; + } +} +#else +static void rpi_updated_mem_map(struct mm_region *pd) {} +#endif + int mach_cpu_init(void) { const struct udevice_id *of_match = board_ids; @@ -72,6 +145,7 @@ int mach_cpu_init(void) if (!ret) { pdat = pdata_bcm283x[of_match->data]; rpi_bcm283x_base = pdat.io_base; + rpi_updated_mem_map(pdat.m_map); break; } diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index 0e05d59e1f..248d04bfd2 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -248,51 +248,6 @@ static uint32_t rev_scheme; static uint32_t rev_type; static const struct rpi_model *model; -#ifdef CONFIG_ARM64 -#ifndef CONFIG_BCM2711 -static struct mm_region bcm283x_mem_map[] = { - { - .virt = 0xUL, - .phys = 0xUL, - .size = 0x3f00UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | -PTE_BLOCK_INNER_SHARE - }, { - .virt = 0x3f00UL, - .phys = 0x3f00UL, - .size = 0x0100UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | -PTE_BLOCK_NON_SHARE | -PTE_BLOCK_PXN | PTE_BLOCK_UXN - }, { - /* List terminator */ - 0, - } -}; -#else -static struct mm_region bcm283x_mem_map[] = { - { - .virt = 0xUL, - .phys = 0xUL, -
[U-Boot] [PATCH v3 2/4] ARM: bcm283x: Move BCM283x_BASE to a global variable
From: Matthias Brugger We move the per SOC define BCM283x_BASE to a global variable. This is a first step to provide a single binary for several bcm283x SoCs. Signed-off-by: Matthias Brugger --- Changes in v3: None Changes in v2: - fix register access in reset_cpu() arch/arm/mach-bcm283x/include/mach/base.h | 11 +++ arch/arm/mach-bcm283x/include/mach/mbox.h | 4 +++- arch/arm/mach-bcm283x/include/mach/sdhci.h | 5 - arch/arm/mach-bcm283x/include/mach/timer.h | 7 ++- arch/arm/mach-bcm283x/include/mach/wdog.h | 5 - arch/arm/mach-bcm283x/init.c | 8 arch/arm/mach-bcm283x/mbox.c | 1 + arch/arm/mach-bcm283x/reset.c | 20 +++- include/configs/rpi.h | 4 9 files changed, 56 insertions(+), 9 deletions(-) create mode 100644 arch/arm/mach-bcm283x/include/mach/base.h diff --git a/arch/arm/mach-bcm283x/include/mach/base.h b/arch/arm/mach-bcm283x/include/mach/base.h new file mode 100644 index 00..c4ae39852f --- /dev/null +++ b/arch/arm/mach-bcm283x/include/mach/base.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * (C) Copyright 2019 Matthias Brugger + */ + +#ifndef _BCM283x_BASE_H_ +#define _BCM283x_BASE_H_ + +extern unsigned long rpi_bcm283x_base; + +#endif diff --git a/arch/arm/mach-bcm283x/include/mach/mbox.h b/arch/arm/mach-bcm283x/include/mach/mbox.h index 0b6c2543d5..60e226ce1d 100644 --- a/arch/arm/mach-bcm283x/include/mach/mbox.h +++ b/arch/arm/mach-bcm283x/include/mach/mbox.h @@ -7,6 +7,7 @@ #define _BCM2835_MBOX_H #include +#include /* * The BCM2835 SoC contains (at least) two CPUs; the VideoCore (a/k/a "GPU") @@ -37,7 +38,8 @@ /* Raw mailbox HW */ -#define BCM2835_MBOX_PHYSADDR (CONFIG_BCM283x_BASE + 0xb880) +#define BCM2835_MBOX_PHYSADDR ({ BUG_ON(!rpi_bcm283x_base); \ +rpi_bcm283x_base + 0xb880; }) struct bcm2835_mbox_regs { u32 read; diff --git a/arch/arm/mach-bcm283x/include/mach/sdhci.h b/arch/arm/mach-bcm283x/include/mach/sdhci.h index b443c379d8..7323690687 100644 --- a/arch/arm/mach-bcm283x/include/mach/sdhci.h +++ b/arch/arm/mach-bcm283x/include/mach/sdhci.h @@ -6,7 +6,10 @@ #ifndef _BCM2835_SDHCI_H_ #define _BCM2835_SDHCI_H_ -#define BCM2835_SDHCI_BASE (CONFIG_BCM283x_BASE + 0x0030) +#include + +#define BCM2835_SDHCI_PHYSADDR ({ BUG_ON(!rpi_bcm283x_base); \ + rpi_bcm283x_base + 0x0030; }) int bcm2835_sdhci_init(u32 regbase, u32 emmc_freq); diff --git a/arch/arm/mach-bcm283x/include/mach/timer.h b/arch/arm/mach-bcm283x/include/mach/timer.h index 61beb1aba1..01c0ebad64 100644 --- a/arch/arm/mach-bcm283x/include/mach/timer.h +++ b/arch/arm/mach-bcm283x/include/mach/timer.h @@ -6,7 +6,12 @@ #ifndef _BCM2835_TIMER_H #define _BCM2835_TIMER_H -#define BCM2835_TIMER_PHYSADDR (CONFIG_BCM283x_BASE + 0x3000) +#ifndef __ASSEMBLY__ +#include +#endif + +#define BCM2835_TIMER_PHYSADDR ({ BUG_ON(!rpi_bcm283x_base); \ + rpi_bcm283x_base + 0x3000; }) #define BCM2835_TIMER_CS_M3(1 << 3) #define BCM2835_TIMER_CS_M2(1 << 2) diff --git a/arch/arm/mach-bcm283x/include/mach/wdog.h b/arch/arm/mach-bcm283x/include/mach/wdog.h index 8292b3cf1f..9942666720 100644 --- a/arch/arm/mach-bcm283x/include/mach/wdog.h +++ b/arch/arm/mach-bcm283x/include/mach/wdog.h @@ -6,7 +6,10 @@ #ifndef _BCM2835_WDOG_H #define _BCM2835_WDOG_H -#define BCM2835_WDOG_PHYSADDR (CONFIG_BCM283x_BASE + 0x0010) +#include + +#define BCM2835_WDOG_PHYSADDR ({ BUG_ON(!rpi_bcm283x_base); \ +rpi_bcm283x_base + 0x0010; }) struct bcm2835_wdog_regs { u32 unknown0[7]; diff --git a/arch/arm/mach-bcm283x/init.c b/arch/arm/mach-bcm283x/init.c index 97414415a6..d36017e823 100644 --- a/arch/arm/mach-bcm283x/init.c +++ b/arch/arm/mach-bcm283x/init.c @@ -8,6 +8,8 @@ #include +unsigned long rpi_bcm283x_base; + int arch_cpu_init(void) { icache_enable(); @@ -15,6 +17,12 @@ int arch_cpu_init(void) return 0; } +int mach_cpu_init(void) +{ + rpi_bcm283x_base = CONFIG_BCM283x_BASE; + + return 0; +} #ifdef CONFIG_ARMV7_LPAE void enable_caches(void) { diff --git a/arch/arm/mach-bcm283x/mbox.c b/arch/arm/mach-bcm283x/mbox.c index 3c67f68c17..467d0d5fba 100644 --- a/arch/arm/mach-bcm283x/mbox.c +++ b/arch/arm/mach-bcm283x/mbox.c @@ -5,6 +5,7 @@ #include #include +#include #include #include diff --git a/arch/arm/mach-bcm283x/reset.c b/arch/arm/mach-bcm283x/reset.c index b3da0c7cd6..cd8138d702 100644 --- a/arch/arm/mach-bcm283x/reset.c +++ b/arch/arm/mach-bcm283x/reset.c @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -25,10 +26,10 @@ void hw_watchdog_disable(void) {} -__efi_runtime_data struct bcm2835_wdog_regs *wdog_regs = - (struct bcm2835_wdog_regs *)BCM2835_WDOG_PHYSADDR; +__efi_runtime_data
[U-Boot] [PATCH v3 0/4] RPi one binary for RPi3/4 and RPi1/2
From: Matthias Brugger In this series we prepare the RaspberryPi source code to be able to build one binary for RPi[3,4] and one for RPi[1,2]. To achieve this we need to set the IO base address on runtime. Apart from that, for arm64 we also need to set memory region correctly. This patches fix this stuff. With this we could create one binary for each armv7 and armv8 based RPis. There is still some work to do to create a unified config, which will be done in a later patch series. Changes in v3: - fix armv7 build Changes in v2: - push fw_dtb_pointer into the .data section - fix register access in reset_cpu() - rename BCM2838 to BCM2711 in the correct patch - push rpi_bcm283x_base into the .data section - Move mem_map out of assembly file - push mem_map into the .data section - update the members of mem_map inestead of the pointer Matthias Brugger (4): rpi: push fw_dtb_pointer in the .data section ARM: bcm283x: Move BCM283x_BASE to a global variable ARM: bcm283x: Set rpi_bcm283x_base at run-time ARM: bcm283x: Set memory map at run-time arch/arm/mach-bcm283x/Kconfig | 6 - arch/arm/mach-bcm283x/include/mach/base.h | 11 ++ arch/arm/mach-bcm283x/include/mach/mbox.h | 4 +- arch/arm/mach-bcm283x/include/mach/sdhci.h | 5 +- arch/arm/mach-bcm283x/include/mach/timer.h | 7 +- arch/arm/mach-bcm283x/include/mach/wdog.h | 5 +- arch/arm/mach-bcm283x/init.c | 140 + arch/arm/mach-bcm283x/mbox.c | 1 + arch/arm/mach-bcm283x/reset.c | 20 ++- board/raspberrypi/rpi/lowlevel_init.S | 12 +- board/raspberrypi/rpi/rpi.c| 49 +--- include/configs/rpi.h | 4 + 12 files changed, 192 insertions(+), 72 deletions(-) create mode 100644 arch/arm/mach-bcm283x/include/mach/base.h -- 2.24.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 1/4] rpi: push fw_dtb_pointer in the .data section
From: Matthias Brugger The fw_dtb_pointer was defined in the assembly code, which makes him live in section .text_rest Put that's not necessary, we can push the variable in the .data section. This will prevent relocation errors like: board/raspberrypi/rpi/rpi.c:317:(.text.board_get_usable_ram_top+0x8): relocation truncated to fit: R_AARCH64_LDST64_ABS_LO12_NC against symbol `fw_dtb_pointer' defined in .text section in board/raspberrypi/rpi/built-in.o Signed-off-by: Matthias Brugger --- Changes in v3: - fix armv7 build Changes in v2: - push fw_dtb_pointer into the .data section board/raspberrypi/rpi/lowlevel_init.S | 12 ++-- board/raspberrypi/rpi/rpi.c | 4 ++-- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/board/raspberrypi/rpi/lowlevel_init.S b/board/raspberrypi/rpi/lowlevel_init.S index 435eed521f..8c39b3e12e 100644 --- a/board/raspberrypi/rpi/lowlevel_init.S +++ b/board/raspberrypi/rpi/lowlevel_init.S @@ -6,15 +6,6 @@ #include -.align 8 -.global fw_dtb_pointer -fw_dtb_pointer: -#ifdef CONFIG_ARM64 - .dword 0x0 -#else - .word 0x0 -#endif - /* * Routine: save_boot_params (called after reset from start.S) * Description: save ATAG/FDT address provided by the firmware at boot time @@ -28,7 +19,8 @@ save_boot_params: adr x8, fw_dtb_pointer str x0, [x8] #else - str r2, fw_dtb_pointer + ldr r8, =fw_dtb_pointer + str r2, [r8] #endif /* Returns */ diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index 9e0abdda31..0e05d59e1f 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -27,8 +27,8 @@ DECLARE_GLOBAL_DATA_PTR; -/* From lowlevel_init.S */ -extern unsigned long fw_dtb_pointer; +/* Assigned in lowlevel_init.S */ +unsigned long fw_dtb_pointer = 0x1; /* TODO(s...@chromium.org): Move these to the msg.c file */ struct msg_get_arm_mem { -- 2.24.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 3/3] drivers: bcm283x: Set pre-location flag for OF_BOARD
From: Matthias Brugger U-Boot support on Raspberry Pi 4 relies on the device-tree provided by the firmware. The blob does not contain the U-Boot specific pre-loc-rel properties. The result is, that the U-Boot banner is not printed. We fix this by setting the DM_FLAG_PRE_RELOC flag in the driver, if we rely on a device-tree provided by the firmware. Reported-by: Heinrich Schuchardt Signed-off-by: Matthias Brugger --- Changes in v4: None Changes in v3: None Changes in v2: - add DM_FLAG_PRE_RELOC for RPi4 case drivers/pinctrl/broadcom/pinctrl-bcm283x.c | 2 +- drivers/serial/serial_bcm283x_mu.c | 2 +- drivers/serial/serial_bcm283x_pl011.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/pinctrl/broadcom/pinctrl-bcm283x.c b/drivers/pinctrl/broadcom/pinctrl-bcm283x.c index 3be080d29e..1bb91d6eed 100644 --- a/drivers/pinctrl/broadcom/pinctrl-bcm283x.c +++ b/drivers/pinctrl/broadcom/pinctrl-bcm283x.c @@ -148,7 +148,7 @@ U_BOOT_DRIVER(pinctrl_bcm283x) = { .priv_auto_alloc_size = sizeof(struct bcm283x_pinctrl_priv), .ops= _pinctrl_ops, .probe = bcm283x_pinctl_probe, -#if !CONFIG_IS_ENABLED(OF_CONTROL) +#if !CONFIG_IS_ENABLED(OF_CONTROL) || CONFIG_IS_ENABLED(OF_BOARD) .flags = DM_FLAG_PRE_RELOC, #endif }; diff --git a/drivers/serial/serial_bcm283x_mu.c b/drivers/serial/serial_bcm283x_mu.c index bd1d89ec83..a6ffc84b96 100644 --- a/drivers/serial/serial_bcm283x_mu.c +++ b/drivers/serial/serial_bcm283x_mu.c @@ -199,7 +199,7 @@ U_BOOT_DRIVER(serial_bcm283x_mu) = { .platdata_auto_alloc_size = sizeof(struct bcm283x_mu_serial_platdata), .probe = bcm283x_mu_serial_probe, .ops = _mu_serial_ops, -#if !CONFIG_IS_ENABLED(OF_CONTROL) +#if !CONFIG_IS_ENABLED(OF_CONTROL) || CONFIG_IS_ENABLED(OF_BOARD) .flags = DM_FLAG_PRE_RELOC, #endif .priv_auto_alloc_size = sizeof(struct bcm283x_mu_priv), diff --git a/drivers/serial/serial_bcm283x_pl011.c b/drivers/serial/serial_bcm283x_pl011.c index 2527bb8b1c..7d8ab7b716 100644 --- a/drivers/serial/serial_bcm283x_pl011.c +++ b/drivers/serial/serial_bcm283x_pl011.c @@ -90,7 +90,7 @@ U_BOOT_DRIVER(bcm283x_pl011_uart) = { .platdata_auto_alloc_size = sizeof(struct pl01x_serial_platdata), .probe = pl01x_serial_probe, .ops= _pl011_serial_ops, -#if !CONFIG_IS_ENABLED(OF_CONTROL) +#if !CONFIG_IS_ENABLED(OF_CONTROL) || CONFIG_IS_ENABLED(OF_BOARD) .flags = DM_FLAG_PRE_RELOC, #endif .priv_auto_alloc_size = sizeof(struct pl01x_priv), -- 2.23.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 1/3] fdt: fix bcm283x dm-pre-reloc definitions
From: Matthias Brugger In commmit 143256b353 ("fdt: update bcm283x device tree sources to Linux 5.1-rc6 state") we deleted the label for the node soc from bcm283x.dtsi As we don't need to add the property dm-pre-reloc to the soc node, we can delete it from bcm283x-uboot.dtsi Tested-by: Tom Rini [RPi 3, 32b and 64b modes] Signed-off-by: Matthias Brugger --- Changes in v4: - fix commit message Changes in v3: - add tested-by tag Changes in v2: - node soc, does not need a label - dm-pre-reloc not needed for node soc arch/arm/dts/bcm283x-uboot.dtsi | 4 1 file changed, 4 deletions(-) diff --git a/arch/arm/dts/bcm283x-uboot.dtsi b/arch/arm/dts/bcm283x-uboot.dtsi index 6cc1aa3f93..36548dad62 100644 --- a/arch/arm/dts/bcm283x-uboot.dtsi +++ b/arch/arm/dts/bcm283x-uboot.dtsi @@ -6,10 +6,6 @@ * (C) Copyright 2016 Fabian Vogt */ - { - u-boot,dm-pre-reloc; -}; - { skip-init; u-boot,dm-pre-reloc; -- 2.23.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 2/3] arm: dts: bcm283x: Rename U-Boot file
From: Matthias Brugger Rename the file bcm283x-uboot.dtsi so that it get automatically include through the scripts/Makefile.lib using $(CONFIG_SYS_SOC))-u-boot.dtsi Without this uarts and pincontroller miss the property dm-pre-reloc and the first call to bcm283x_mu_serial_ofdata_to_platdata() fails as the pins are not set correctly. As a result the U-Boot banner isn't shown on boot. Before commmit 143256b353 ("fdt: update bcm283x device tree sources to Linux 5.1-rc6 state") we included bcm283x-uboot.dtsi directly in the device-tree file. Which got deleted by the metioned commit. This is a much robuster solution. Reported-by: Tom Rini Reported-by: Heinrich Schuchardt Tested-by: Tom Rini [RPi 3, 32b and 64b modes] Signed-off-by: Matthias Brugger --- Changes in v4: None Changes in v3: - add tested-by tag Changes in v2: None arch/arm/dts/{bcm283x-uboot.dtsi => bcm283x-u-boot.dtsi} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename arch/arm/dts/{bcm283x-uboot.dtsi => bcm283x-u-boot.dtsi} (100%) diff --git a/arch/arm/dts/bcm283x-uboot.dtsi b/arch/arm/dts/bcm283x-u-boot.dtsi similarity index 100% rename from arch/arm/dts/bcm283x-uboot.dtsi rename to arch/arm/dts/bcm283x-u-boot.dtsi -- 2.23.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 3/3] drivers: bcm283x: Set pre-location flag for OF_BOARD
From: Matthias Brugger U-Boot support on Raspberry Pi 4 relies on the device-tree provided by the firmware. The blob does not contain the U-Boot specific pre-loc-rel properties. The result is, that the U-Boot banner is not printed. We fix this by setting the DM_FLAG_PRE_RELOC flag in the driver, if we rely on a device-tree provided by the firmware. Reported-by: Heinrich Schuchardt Signed-off-by: Matthias Brugger --- Changes in v3: None Changes in v2: - add DM_FLAG_PRE_RELOC for RPi4 case drivers/pinctrl/broadcom/pinctrl-bcm283x.c | 2 +- drivers/serial/serial_bcm283x_mu.c | 2 +- drivers/serial/serial_bcm283x_pl011.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/pinctrl/broadcom/pinctrl-bcm283x.c b/drivers/pinctrl/broadcom/pinctrl-bcm283x.c index 3be080d29e..1bb91d6eed 100644 --- a/drivers/pinctrl/broadcom/pinctrl-bcm283x.c +++ b/drivers/pinctrl/broadcom/pinctrl-bcm283x.c @@ -148,7 +148,7 @@ U_BOOT_DRIVER(pinctrl_bcm283x) = { .priv_auto_alloc_size = sizeof(struct bcm283x_pinctrl_priv), .ops= _pinctrl_ops, .probe = bcm283x_pinctl_probe, -#if !CONFIG_IS_ENABLED(OF_CONTROL) +#if !CONFIG_IS_ENABLED(OF_CONTROL) || CONFIG_IS_ENABLED(OF_BOARD) .flags = DM_FLAG_PRE_RELOC, #endif }; diff --git a/drivers/serial/serial_bcm283x_mu.c b/drivers/serial/serial_bcm283x_mu.c index bd1d89ec83..a6ffc84b96 100644 --- a/drivers/serial/serial_bcm283x_mu.c +++ b/drivers/serial/serial_bcm283x_mu.c @@ -199,7 +199,7 @@ U_BOOT_DRIVER(serial_bcm283x_mu) = { .platdata_auto_alloc_size = sizeof(struct bcm283x_mu_serial_platdata), .probe = bcm283x_mu_serial_probe, .ops = _mu_serial_ops, -#if !CONFIG_IS_ENABLED(OF_CONTROL) +#if !CONFIG_IS_ENABLED(OF_CONTROL) || CONFIG_IS_ENABLED(OF_BOARD) .flags = DM_FLAG_PRE_RELOC, #endif .priv_auto_alloc_size = sizeof(struct bcm283x_mu_priv), diff --git a/drivers/serial/serial_bcm283x_pl011.c b/drivers/serial/serial_bcm283x_pl011.c index 2527bb8b1c..7d8ab7b716 100644 --- a/drivers/serial/serial_bcm283x_pl011.c +++ b/drivers/serial/serial_bcm283x_pl011.c @@ -90,7 +90,7 @@ U_BOOT_DRIVER(bcm283x_pl011_uart) = { .platdata_auto_alloc_size = sizeof(struct pl01x_serial_platdata), .probe = pl01x_serial_probe, .ops= _pl011_serial_ops, -#if !CONFIG_IS_ENABLED(OF_CONTROL) +#if !CONFIG_IS_ENABLED(OF_CONTROL) || CONFIG_IS_ENABLED(OF_BOARD) .flags = DM_FLAG_PRE_RELOC, #endif .priv_auto_alloc_size = sizeof(struct pl01x_priv), -- 2.23.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 1/3] fdt: fix bcm283x dm-pre-reloc definitions
From: Matthias Brugger In commmit 143256b353 ("fdt: update bcm283x device tree sources to Linux 5.1-rc6 state") we delete the label for the node soc. As we don't need the to add the property dm-pre-reloc to this node, we can delete it fomr bcm283x-uboot.dtsi Tested-by: Tom Rini [RPi 3, 32b and 64b modes] Signed-off-by: Matthias Brugger --- Changes in v3: - add tested-by tag Changes in v2: - node soc, does not need a label - dm-pre-reloc not needed for node soc arch/arm/dts/bcm283x-uboot.dtsi | 4 1 file changed, 4 deletions(-) diff --git a/arch/arm/dts/bcm283x-uboot.dtsi b/arch/arm/dts/bcm283x-uboot.dtsi index 6cc1aa3f93..36548dad62 100644 --- a/arch/arm/dts/bcm283x-uboot.dtsi +++ b/arch/arm/dts/bcm283x-uboot.dtsi @@ -6,10 +6,6 @@ * (C) Copyright 2016 Fabian Vogt */ - { - u-boot,dm-pre-reloc; -}; - { skip-init; u-boot,dm-pre-reloc; -- 2.23.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 3/3] drivers: bcm283x: Set pre-location flag for OF_BOARD
From: Matthias Brugger U-Boot support on Raspberry Pi 4 relies on the device-tree provided by the firmware. The blob does not contain the U-Boot specific pre-loc-rel properties. The result is, that the U-Boot banner is not printed. We fix this by setting the DM_FLAG_PRE_RELOC flag in the driver, if we rely on a device-tree provided by the firmware. Signed-off-by: Matthias Brugger --- Changes in v2: - add DM_FLAG_PRE_RELOC for RPi4 case drivers/pinctrl/broadcom/pinctrl-bcm283x.c | 2 +- drivers/serial/serial_bcm283x_mu.c | 2 +- drivers/serial/serial_bcm283x_pl011.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/pinctrl/broadcom/pinctrl-bcm283x.c b/drivers/pinctrl/broadcom/pinctrl-bcm283x.c index 3be080d29e..1bb91d6eed 100644 --- a/drivers/pinctrl/broadcom/pinctrl-bcm283x.c +++ b/drivers/pinctrl/broadcom/pinctrl-bcm283x.c @@ -148,7 +148,7 @@ U_BOOT_DRIVER(pinctrl_bcm283x) = { .priv_auto_alloc_size = sizeof(struct bcm283x_pinctrl_priv), .ops= _pinctrl_ops, .probe = bcm283x_pinctl_probe, -#if !CONFIG_IS_ENABLED(OF_CONTROL) +#if !CONFIG_IS_ENABLED(OF_CONTROL) || CONFIG_IS_ENABLED(OF_BOARD) .flags = DM_FLAG_PRE_RELOC, #endif }; diff --git a/drivers/serial/serial_bcm283x_mu.c b/drivers/serial/serial_bcm283x_mu.c index bd1d89ec83..a6ffc84b96 100644 --- a/drivers/serial/serial_bcm283x_mu.c +++ b/drivers/serial/serial_bcm283x_mu.c @@ -199,7 +199,7 @@ U_BOOT_DRIVER(serial_bcm283x_mu) = { .platdata_auto_alloc_size = sizeof(struct bcm283x_mu_serial_platdata), .probe = bcm283x_mu_serial_probe, .ops = _mu_serial_ops, -#if !CONFIG_IS_ENABLED(OF_CONTROL) +#if !CONFIG_IS_ENABLED(OF_CONTROL) || CONFIG_IS_ENABLED(OF_BOARD) .flags = DM_FLAG_PRE_RELOC, #endif .priv_auto_alloc_size = sizeof(struct bcm283x_mu_priv), diff --git a/drivers/serial/serial_bcm283x_pl011.c b/drivers/serial/serial_bcm283x_pl011.c index 2527bb8b1c..7d8ab7b716 100644 --- a/drivers/serial/serial_bcm283x_pl011.c +++ b/drivers/serial/serial_bcm283x_pl011.c @@ -90,7 +90,7 @@ U_BOOT_DRIVER(bcm283x_pl011_uart) = { .platdata_auto_alloc_size = sizeof(struct pl01x_serial_platdata), .probe = pl01x_serial_probe, .ops= _pl011_serial_ops, -#if !CONFIG_IS_ENABLED(OF_CONTROL) +#if !CONFIG_IS_ENABLED(OF_CONTROL) || CONFIG_IS_ENABLED(OF_BOARD) .flags = DM_FLAG_PRE_RELOC, #endif .priv_auto_alloc_size = sizeof(struct pl01x_priv), -- 2.23.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 1/3] fdt: fix bcm283x dm-pre-reloc definitions
From: Matthias Brugger In commmit 143256b353 ("fdt: update bcm283x device tree sources to Linux 5.1-rc6 state") we delete the label for the node soc. As we don't need the to add the property dm-pre-reloc to this node, we can delete it fomr bcm283x-uboot.dtsi Signed-off-by: Matthias Brugger --- Changes in v2: - node soc, does not need a label - dm-pre-reloc not needed for node soc arch/arm/dts/bcm283x-uboot.dtsi | 4 1 file changed, 4 deletions(-) diff --git a/arch/arm/dts/bcm283x-uboot.dtsi b/arch/arm/dts/bcm283x-uboot.dtsi index 6cc1aa3f93..36548dad62 100644 --- a/arch/arm/dts/bcm283x-uboot.dtsi +++ b/arch/arm/dts/bcm283x-uboot.dtsi @@ -6,10 +6,6 @@ * (C) Copyright 2016 Fabian Vogt */ - { - u-boot,dm-pre-reloc; -}; - { skip-init; u-boot,dm-pre-reloc; -- 2.23.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] fdt: fix bcm283x dm-pre-reloc definitions
From: Matthias Brugger In commmit 143256b353 ("fdt: update bcm283x device tree sources to Linux 5.1-rc6 state") we accidently deleted the inclution of bcm283x-uboot.dtsi which marks, soc, uarts and pincontroller as dm-pre-reloc Without this definitions the first call to bcm283x_mu_serial_ofdata_to_platdata() fails as the pins are not set correctly. As a result the U-Boot banner isn't shown on boot. Reported-by: Tom Rini Reported-by: Heinrich Schuchardt Signed-off-by: Matthias Brugger --- arch/arm/dts/bcm283x.dtsi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm/dts/bcm283x.dtsi b/arch/arm/dts/bcm283x.dtsi index 9777644c6c..39d7bd600e 100644 --- a/arch/arm/dts/bcm283x.dtsi +++ b/arch/arm/dts/bcm283x.dtsi @@ -51,7 +51,7 @@ }; }; - soc { + soc: soc { compatible = "simple-bus"; #address-cells = <1>; #size-cells = <1>; @@ -675,3 +675,5 @@ #phy-cells = <0>; }; }; + +#include "bcm283x-uboot.dtsi" -- 2.23.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] ARM: defconfig: add unified config for RPi3 and RPi4
From: Matthias Brugger Provide a defconfig which allows us to boot Raspberrry Pi 4 and Raspberry Pi 3 Model B/B+ Instead of using the embedded DTB as done in RPi3 we use the devicetree provided by the firmware. Signed-off-by: Matthias Brugger --- This patch is based on the series to enable one binary for RPi3 and RPi4: https://patchwork.ozlabs.org/project/uboot/list/?series=140696 arch/arm/mach-bcm283x/Kconfig | 7 ++ configs/rpi_arm64_defconfig | 45 +++ 2 files changed, 52 insertions(+) create mode 100644 configs/rpi_arm64_defconfig diff --git a/arch/arm/mach-bcm283x/Kconfig b/arch/arm/mach-bcm283x/Kconfig index e8e0ff0eb4..00419bf254 100644 --- a/arch/arm/mach-bcm283x/Kconfig +++ b/arch/arm/mach-bcm283x/Kconfig @@ -188,6 +188,13 @@ config TARGET_RPI_4 This option creates a build targeting the ARMv8/AArch64 ISA. select BCM2711_64B +config TARGET_RPI_ARM64 + bool "Raspberry Pi one binary 64-bit build" + help + Support for all armv8 based Raspberry Pi variants, such as + the RPi 4 model B, in AArch64 (64-bit) mode. + select ARM64 + endchoice config SYS_BOARD diff --git a/configs/rpi_arm64_defconfig b/configs/rpi_arm64_defconfig new file mode 100644 index 00..f4e113f58c --- /dev/null +++ b/configs/rpi_arm64_defconfig @@ -0,0 +1,45 @@ +CONFIG_ARM=y +CONFIG_ARM64=y +CONFIG_TARGET_RPI_ARM64=y +CONFIG_ARCH_BCM283X=y +CONFIG_SYS_TEXT_BASE=0x0008 +CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_DISTRO_DEFAULTS=y +CONFIG_NR_DRAM_BANKS=2 +CONFIG_OF_BOARD_SETUP=y +CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="usb start" +CONFIG_MISC_INIT_R=y +# CONFIG_DISPLAY_CPUINFO is not set +# CONFIG_DISPLAY_BOARDINFO is not set +CONFIG_SYS_PROMPT="U-Boot> " +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_GPIO=y +CONFIG_CMD_MMC=y +CONFIG_CMD_USB=y +CONFIG_CMD_FS_UUID=y +CONFIG_OF_BOARD=y +CONFIG_ENV_FAT_INTERFACE="mmc" +CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" +CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y +CONFIG_DM_KEYBOARD=y +CONFIG_DM_MMC=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_BCM2835=y +CONFIG_PHYLIB=y +CONFIG_DM_ETH=y +CONFIG_PINCTRL=y +# CONFIG_PINCTRL_GENERIC is not set +# CONFIG_REQUIRE_SERIAL_CONSOLE is not set +CONFIG_USB=y +CONFIG_DM_USB=y +CONFIG_USB_DWC2=y +CONFIG_USB_KEYBOARD=y +CONFIG_USB_HOST_ETHER=y +CONFIG_USB_ETHER_LAN78XX=y +CONFIG_USB_ETHER_SMSC95XX=y +CONFIG_DM_VIDEO=y +CONFIG_SYS_WHITE_ON_BLACK=y +CONFIG_CONSOLE_SCROLL_LINES=10 +CONFIG_PHYS_TO_BUS=y +CONFIG_OF_LIBFDT_OVERLAY=y -- 2.23.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] pinctrl: bcm283x: Add compatible for RPi4
From: Matthias Brugger The Raspberry Pi 4 upstream kernel device tree instroduces a new compatible for the pinctroller. Add this to the driver so that we can boot with the upstream kernel DT. Signed-off-by: Matthias Brugger --- drivers/pinctrl/broadcom/pinctrl-bcm283x.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pinctrl/broadcom/pinctrl-bcm283x.c b/drivers/pinctrl/broadcom/pinctrl-bcm283x.c index 3be080d29e..8d9074e0c1 100644 --- a/drivers/pinctrl/broadcom/pinctrl-bcm283x.c +++ b/drivers/pinctrl/broadcom/pinctrl-bcm283x.c @@ -99,6 +99,7 @@ static int bcm283x_pinctrl_get_gpio_mux(struct udevice *dev, int banknum, static const struct udevice_id bcm2835_pinctrl_id[] = { {.compatible = "brcm,bcm2835-gpio"}, + {.compatible = "brcm,bcm2711-gpio"}, {} }; -- 2.23.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 4/4] ARM: bcm283x: Set memory map at run-time
From: Matthias Brugger For bcm283x based on arm64 we also have to change the mm_region. Add assign this in mach_cpu_init() so we can create now one binary for RPi3 and RPi4. Signed-off-by: Matthias Brugger --- Changes in v2: - Move mem_map out of assembly file - push mem_map into the .data section - update the members of mem_map inestead of the pointer arch/arm/mach-bcm283x/init.c | 74 board/raspberrypi/rpi/rpi.c | 45 -- 2 files changed, 74 insertions(+), 45 deletions(-) diff --git a/arch/arm/mach-bcm283x/init.c b/arch/arm/mach-bcm283x/init.c index d374fb60ba..639a5cf975 100644 --- a/arch/arm/mach-bcm283x/init.c +++ b/arch/arm/mach-bcm283x/init.c @@ -8,6 +8,9 @@ #include #include +#ifdef CONFIG_ARM64 +#include +#endif #define PDATA_BCM2835 0 #define PDATA_BCM2836 1 @@ -16,23 +19,77 @@ unsigned long rpi_bcm283x_base = 0x3f00; +#ifdef CONFIG_ARM64 +static struct mm_region bcm283x_mem_map[] = { + { + .virt = 0xUL, + .phys = 0xUL, + .size = 0x3f00UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | +PTE_BLOCK_INNER_SHARE + }, { + .virt = 0x3f00UL, + .phys = 0x3f00UL, + .size = 0x0100UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | +PTE_BLOCK_NON_SHARE | +PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* List terminator */ + 0, + } +}; + +static struct mm_region bcm2711_mem_map[] = { + { + .virt = 0xUL, + .phys = 0xUL, + .size = 0xfe00UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | +PTE_BLOCK_INNER_SHARE + }, { + .virt = 0xfe00UL, + .phys = 0xfe00UL, + .size = 0x0180UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | +PTE_BLOCK_NON_SHARE | +PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* List terminator */ + 0, + } +}; + +struct mm_region *mem_map = bcm283x_mem_map; + +#else +struct mm_region { + /* dummy struct */ +}; +#endif + struct bcm283x_pdata { unsigned long io_base; + struct mm_region *m_map; }; struct bcm283x_pdata pdata_bcm283x[] = { [PDATA_BCM2835] = { .io_base = 0x2000, + .m_map = NULL, }, [PDATA_BCM2836] = { .io_base = 0x3f00, + .m_map = NULL, }, #ifdef CONFIG_ARM64 [PDATA_BCM2837] = { .io_base = 0x3f00, + .m_map = bcm283x_mem_map, }, [PDATA_BCM2711] = { .io_base = 0xfe00, + .m_map = bcm2711_mem_map }, #endif }; @@ -57,6 +114,22 @@ int arch_cpu_init(void) return 0; } +#ifdef CONFIG_ARM64 +static void rpi_updated_mem_map(struct mm_region *pd) +{ + int i; + + for (i = 0; i < 2; i++) { + mem_map[i].virt = pd[i].virt; + mem_map[i].phys = pd[i].phys; + mem_map[i].size = pd[i].size; + mem_map[i].attrs = pd[i].attrs; + } +} +#else +static void rpi_updated_mem_map(struct mm_region *pd) {} +#endif + int mach_cpu_init(void) { const struct udevice_id *of_match = board_ids; @@ -72,6 +145,7 @@ int mach_cpu_init(void) if (!ret) { pdat = pdata_bcm283x[of_match->data]; rpi_bcm283x_base = pdat.io_base; + rpi_updated_mem_map(pdat.m_map); break; } diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index 0e05d59e1f..248d04bfd2 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -248,51 +248,6 @@ static uint32_t rev_scheme; static uint32_t rev_type; static const struct rpi_model *model; -#ifdef CONFIG_ARM64 -#ifndef CONFIG_BCM2711 -static struct mm_region bcm283x_mem_map[] = { - { - .virt = 0xUL, - .phys = 0xUL, - .size = 0x3f00UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | -PTE_BLOCK_INNER_SHARE - }, { - .virt = 0x3f00UL, - .phys = 0x3f00UL, - .size = 0x0100UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | -PTE_BLOCK_NON_SHARE | -PTE_BLOCK_PXN | PTE_BLOCK_UXN - }, { - /* List terminator */ - 0, - } -}; -#else -static struct mm_region bcm283x_mem_map[] = { - { - .virt = 0xUL, - .phys = 0xUL, - .size =
[U-Boot] [PATCH v2 3/4] ARM: bcm283x: Set rpi_bcm283x_base at run-time
From: Matthias Brugger As part of the effort to create one binary for several bcm83x SoCs we use the SoC compatible to decide which IO base address we use. Signed-off-by: Matthias Brugger --- Changes in v2: - rename BCM2838 to BCM2711 in the correct patch - push rpi_bcm283x_base into the .data section arch/arm/mach-bcm283x/Kconfig | 6 arch/arm/mach-bcm283x/init.c | 62 +-- 2 files changed, 60 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-bcm283x/Kconfig b/arch/arm/mach-bcm283x/Kconfig index d9808609e2..00419bf254 100644 --- a/arch/arm/mach-bcm283x/Kconfig +++ b/arch/arm/mach-bcm283x/Kconfig @@ -209,10 +209,4 @@ config SYS_SOC config SYS_CONFIG_NAME default "rpi" -config BCM283x_BASE - hex - default "0x2000" if BCM2835 - default "0x3f00" if BCM2836 || BCM2837 - default "0xfe00" if BCM2711 - endmenu diff --git a/arch/arm/mach-bcm283x/init.c b/arch/arm/mach-bcm283x/init.c index d36017e823..d374fb60ba 100644 --- a/arch/arm/mach-bcm283x/init.c +++ b/arch/arm/mach-bcm283x/init.c @@ -7,8 +7,48 @@ */ #include +#include -unsigned long rpi_bcm283x_base; +#define PDATA_BCM2835 0 +#define PDATA_BCM2836 1 +#define PDATA_BCM2837 2 +#define PDATA_BCM2711 3 + +unsigned long rpi_bcm283x_base = 0x3f00; + +struct bcm283x_pdata { + unsigned long io_base; +}; + +struct bcm283x_pdata pdata_bcm283x[] = { + [PDATA_BCM2835] = { + .io_base = 0x2000, + }, + [PDATA_BCM2836] = { + .io_base = 0x3f00, + }, +#ifdef CONFIG_ARM64 + [PDATA_BCM2837] = { + .io_base = 0x3f00, + }, + [PDATA_BCM2711] = { + .io_base = 0xfe00, + }, +#endif +}; + +/* + * I/O address space varies on different chip versions. + * We set the base address by inspecting the DTB. + */ +static const struct udevice_id board_ids[] = { + { .compatible = "brcm,bcm2835", .data = PDATA_BCM2835}, + { .compatible = "brcm,bcm2836", .data = PDATA_BCM2836}, + { .compatible = "brcm,bcm2837", .data = PDATA_BCM2837}, + { .compatible = "brcm,bcm2838", .data = PDATA_BCM2711}, + { .compatible = "brcm,bcm2711", .data = PDATA_BCM2711}, + { }, +}; int arch_cpu_init(void) { @@ -19,10 +59,28 @@ int arch_cpu_init(void) int mach_cpu_init(void) { - rpi_bcm283x_base = CONFIG_BCM283x_BASE; + const struct udevice_id *of_match = board_ids; + int ret; + + rpi_bcm283x_base = 0; + + while (of_match->compatible) { + struct bcm283x_pdata pdat; + + ret = fdt_node_check_compatible(gd->fdt_blob, 0, + of_match->compatible); + if (!ret) { + pdat = pdata_bcm283x[of_match->data]; + rpi_bcm283x_base = pdat.io_base; + break; + } + + of_match++; + } return 0; } + #ifdef CONFIG_ARMV7_LPAE void enable_caches(void) { -- 2.23.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 1/4] rpi: push fw_dtb_pointer in the .data section
From: Matthias Brugger The fw_dtb_pointer was defined in the assembly code, which makes him live in section .text_rest Put that's not necessary, we can push the variable in the .data section. This will prevent relocation errors like: board/raspberrypi/rpi/rpi.c:317:(.text.board_get_usable_ram_top+0x8): relocation truncated to fit: R_AARCH64_LDST64_ABS_LO12_NC against symbol `fw_dtb_pointer' defined in .text section in board/raspberrypi/rpi/built-in.o Signed-off-by: Matthias Brugger --- Changes in v2: - push fw_dtb_pointer into the .data section board/raspberrypi/rpi/lowlevel_init.S | 9 - board/raspberrypi/rpi/rpi.c | 4 ++-- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/board/raspberrypi/rpi/lowlevel_init.S b/board/raspberrypi/rpi/lowlevel_init.S index 435eed521f..2913143911 100644 --- a/board/raspberrypi/rpi/lowlevel_init.S +++ b/board/raspberrypi/rpi/lowlevel_init.S @@ -6,15 +6,6 @@ #include -.align 8 -.global fw_dtb_pointer -fw_dtb_pointer: -#ifdef CONFIG_ARM64 - .dword 0x0 -#else - .word 0x0 -#endif - /* * Routine: save_boot_params (called after reset from start.S) * Description: save ATAG/FDT address provided by the firmware at boot time diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index 9e0abdda31..0e05d59e1f 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -27,8 +27,8 @@ DECLARE_GLOBAL_DATA_PTR; -/* From lowlevel_init.S */ -extern unsigned long fw_dtb_pointer; +/* Assigned in lowlevel_init.S */ +unsigned long fw_dtb_pointer = 0x1; /* TODO(s...@chromium.org): Move these to the msg.c file */ struct msg_get_arm_mem { -- 2.23.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 0/4] RPi one binary for RPi3/4 and RPi1/2
From: Matthias Brugger In this series we prepare the RaspberryPi source code to be able to build one binary for RPi[3,4] and one for RPi[1,2]. To achieve this we need to set the IO base address on runtime. Apart from that, for arm64 we also need to set memory region correctly. This patches fix this stuff. With this we could create one binary for each armv7 and armv8 based RPis. There is still some work to do to create a unified config, which will be done in a later patch series. Changes in v2: - push fw_dtb_pointer into the .data section - fix register access in reset_cpu() - rename BCM2838 to BCM2711 in the correct patch - push rpi_bcm283x_base into the .data section - Move mem_map out of assembly file - push mem_map into the .data section - update the members of mem_map inestead of the pointer Matthias Brugger (4): rpi: push fw_dtb_pointer in the .data section ARM: bcm283x: Move BCM283x_BASE to a global variable ARM: bcm283x: Set rpi_bcm283x_base at run-time ARM: bcm283x: Set memory map at run-time arch/arm/mach-bcm283x/Kconfig | 6 - arch/arm/mach-bcm283x/include/mach/base.h | 11 ++ arch/arm/mach-bcm283x/include/mach/mbox.h | 4 +- arch/arm/mach-bcm283x/include/mach/sdhci.h | 5 +- arch/arm/mach-bcm283x/include/mach/timer.h | 7 +- arch/arm/mach-bcm283x/include/mach/wdog.h | 5 +- arch/arm/mach-bcm283x/init.c | 140 + arch/arm/mach-bcm283x/mbox.c | 1 + arch/arm/mach-bcm283x/reset.c | 20 ++- board/raspberrypi/rpi/lowlevel_init.S | 9 -- board/raspberrypi/rpi/rpi.c| 49 +--- include/configs/rpi.h | 4 + 12 files changed, 190 insertions(+), 71 deletions(-) create mode 100644 arch/arm/mach-bcm283x/include/mach/base.h -- 2.23.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 2/4] ARM: bcm283x: Move BCM283x_BASE to a global variable
From: Matthias Brugger We move the per SOC define BCM283x_BASE to a global variable. This is a first step to provide a single binary for several bcm283x SoCs. Signed-off-by: Matthias Brugger --- Changes in v2: - fix register access in reset_cpu() arch/arm/mach-bcm283x/include/mach/base.h | 11 +++ arch/arm/mach-bcm283x/include/mach/mbox.h | 4 +++- arch/arm/mach-bcm283x/include/mach/sdhci.h | 5 - arch/arm/mach-bcm283x/include/mach/timer.h | 7 ++- arch/arm/mach-bcm283x/include/mach/wdog.h | 5 - arch/arm/mach-bcm283x/init.c | 8 arch/arm/mach-bcm283x/mbox.c | 1 + arch/arm/mach-bcm283x/reset.c | 20 +++- include/configs/rpi.h | 4 9 files changed, 56 insertions(+), 9 deletions(-) create mode 100644 arch/arm/mach-bcm283x/include/mach/base.h diff --git a/arch/arm/mach-bcm283x/include/mach/base.h b/arch/arm/mach-bcm283x/include/mach/base.h new file mode 100644 index 00..c4ae39852f --- /dev/null +++ b/arch/arm/mach-bcm283x/include/mach/base.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * (C) Copyright 2019 Matthias Brugger + */ + +#ifndef _BCM283x_BASE_H_ +#define _BCM283x_BASE_H_ + +extern unsigned long rpi_bcm283x_base; + +#endif diff --git a/arch/arm/mach-bcm283x/include/mach/mbox.h b/arch/arm/mach-bcm283x/include/mach/mbox.h index 0b6c2543d5..60e226ce1d 100644 --- a/arch/arm/mach-bcm283x/include/mach/mbox.h +++ b/arch/arm/mach-bcm283x/include/mach/mbox.h @@ -7,6 +7,7 @@ #define _BCM2835_MBOX_H #include +#include /* * The BCM2835 SoC contains (at least) two CPUs; the VideoCore (a/k/a "GPU") @@ -37,7 +38,8 @@ /* Raw mailbox HW */ -#define BCM2835_MBOX_PHYSADDR (CONFIG_BCM283x_BASE + 0xb880) +#define BCM2835_MBOX_PHYSADDR ({ BUG_ON(!rpi_bcm283x_base); \ +rpi_bcm283x_base + 0xb880; }) struct bcm2835_mbox_regs { u32 read; diff --git a/arch/arm/mach-bcm283x/include/mach/sdhci.h b/arch/arm/mach-bcm283x/include/mach/sdhci.h index b443c379d8..7323690687 100644 --- a/arch/arm/mach-bcm283x/include/mach/sdhci.h +++ b/arch/arm/mach-bcm283x/include/mach/sdhci.h @@ -6,7 +6,10 @@ #ifndef _BCM2835_SDHCI_H_ #define _BCM2835_SDHCI_H_ -#define BCM2835_SDHCI_BASE (CONFIG_BCM283x_BASE + 0x0030) +#include + +#define BCM2835_SDHCI_PHYSADDR ({ BUG_ON(!rpi_bcm283x_base); \ + rpi_bcm283x_base + 0x0030; }) int bcm2835_sdhci_init(u32 regbase, u32 emmc_freq); diff --git a/arch/arm/mach-bcm283x/include/mach/timer.h b/arch/arm/mach-bcm283x/include/mach/timer.h index 014355e759..54f733a956 100644 --- a/arch/arm/mach-bcm283x/include/mach/timer.h +++ b/arch/arm/mach-bcm283x/include/mach/timer.h @@ -6,7 +6,12 @@ #ifndef _BCM2835_TIMER_H #define _BCM2835_TIMER_H -#define BCM2835_TIMER_PHYSADDR (CONFIG_BCM283x_BASE + 0x3000) +#ifndef __ASSEMBLY__ +#include +#endif + +#define BCM2835_TIMER_PHYSADDR ({ BUG_ON(!rpi_bcm283x_base); \ + rpi_bcm283x_base + 0x3000; }) #define BCM2835_TIMER_CS_M3(1 << 3) #define BCM2835_TIMER_CS_M2(1 << 2) diff --git a/arch/arm/mach-bcm283x/include/mach/wdog.h b/arch/arm/mach-bcm283x/include/mach/wdog.h index 8292b3cf1f..9942666720 100644 --- a/arch/arm/mach-bcm283x/include/mach/wdog.h +++ b/arch/arm/mach-bcm283x/include/mach/wdog.h @@ -6,7 +6,10 @@ #ifndef _BCM2835_WDOG_H #define _BCM2835_WDOG_H -#define BCM2835_WDOG_PHYSADDR (CONFIG_BCM283x_BASE + 0x0010) +#include + +#define BCM2835_WDOG_PHYSADDR ({ BUG_ON(!rpi_bcm283x_base); \ +rpi_bcm283x_base + 0x0010; }) struct bcm2835_wdog_regs { u32 unknown0[7]; diff --git a/arch/arm/mach-bcm283x/init.c b/arch/arm/mach-bcm283x/init.c index 97414415a6..d36017e823 100644 --- a/arch/arm/mach-bcm283x/init.c +++ b/arch/arm/mach-bcm283x/init.c @@ -8,6 +8,8 @@ #include +unsigned long rpi_bcm283x_base; + int arch_cpu_init(void) { icache_enable(); @@ -15,6 +17,12 @@ int arch_cpu_init(void) return 0; } +int mach_cpu_init(void) +{ + rpi_bcm283x_base = CONFIG_BCM283x_BASE; + + return 0; +} #ifdef CONFIG_ARMV7_LPAE void enable_caches(void) { diff --git a/arch/arm/mach-bcm283x/mbox.c b/arch/arm/mach-bcm283x/mbox.c index 3c67f68c17..467d0d5fba 100644 --- a/arch/arm/mach-bcm283x/mbox.c +++ b/arch/arm/mach-bcm283x/mbox.c @@ -5,6 +5,7 @@ #include #include +#include #include #include diff --git a/arch/arm/mach-bcm283x/reset.c b/arch/arm/mach-bcm283x/reset.c index b3da0c7cd6..cd8138d702 100644 --- a/arch/arm/mach-bcm283x/reset.c +++ b/arch/arm/mach-bcm283x/reset.c @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -25,10 +26,10 @@ void hw_watchdog_disable(void) {} -__efi_runtime_data struct bcm2835_wdog_regs *wdog_regs = - (struct bcm2835_wdog_regs *)BCM2835_WDOG_PHYSADDR; +__efi_runtime_data struct
[U-Boot] [PATCH 3/3] ARM: bcm283x: Set memory map at run-time
From: Matthias Brugger For bcm283x based on arm64 we also have to change the mm_region. Add assign this in mach_cpu_init() so we can create now one binary for RPi3 and RPi4. Signed-off-by: Matthias Brugger --- arch/arm/mach-bcm283x/init.c | 65 +-- board/raspberrypi/rpi/lowlevel_init.S | 6 +++ board/raspberrypi/rpi/rpi.c | 45 --- 3 files changed, 67 insertions(+), 49 deletions(-) diff --git a/arch/arm/mach-bcm283x/init.c b/arch/arm/mach-bcm283x/init.c index 214e1078eb..f6c2946922 100644 --- a/arch/arm/mach-bcm283x/init.c +++ b/arch/arm/mach-bcm283x/init.c @@ -8,16 +8,68 @@ #include #include +#ifdef CONFIG_ARM64 +#include +#endif #define PDATA_BCM2835 0 #define PDATA_BCM2836 1 #define PDATA_BCM2837 2 -#define PDATA_BCM2838 3 +#define PDATA_BCM2711 3 extern unsigned long rpi_bcm283x_base; +#ifdef CONFIG_ARM64 +extern struct mm_region *mem_map; + +static struct mm_region bcm283x_mem_map[] = { + { + .virt = 0xUL, + .phys = 0xUL, + .size = 0x3f00UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | +PTE_BLOCK_INNER_SHARE + }, { + .virt = 0x3f00UL, + .phys = 0x3f00UL, + .size = 0x0100UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | +PTE_BLOCK_NON_SHARE | +PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* List terminator */ + 0, + } +}; + +static struct mm_region bcm2711_mem_map[] = { + { + .virt = 0xUL, + .phys = 0xUL, + .size = 0xfe00UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | +PTE_BLOCK_INNER_SHARE + }, { + .virt = 0xfe00UL, + .phys = 0xfe00UL, + .size = 0x0180UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | +PTE_BLOCK_NON_SHARE | +PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { + /* List terminator */ + 0, + } +}; +#else +struct mm_region { + /* dummy struct */ +}; +#endif + struct bcm283x_pdata { unsigned long io_base; + struct mm_region *m_map; }; struct bcm283x_pdata pdata_bcm283x[] = { @@ -30,9 +82,11 @@ struct bcm283x_pdata pdata_bcm283x[] = { #ifdef CONFIG_ARM64 [PDATA_BCM2837] = { .io_base = 0x3f00, + .m_map = bcm283x_mem_map, }, - [PDATA_BCM2838] = { + [PDATA_BCM2711] = { .io_base = 0xfe00, + .m_map = bcm2711_mem_map }, #endif }; @@ -45,8 +99,8 @@ static const struct udevice_id board_ids[] = { { .compatible = "brcm,bcm2835", .data = PDATA_BCM2835}, { .compatible = "brcm,bcm2836", .data = PDATA_BCM2836}, { .compatible = "brcm,bcm2837", .data = PDATA_BCM2837}, - { .compatible = "brcm,bcm2838", .data = PDATA_BCM2838}, - { .compatible = "brcm,bcm2711", .data = PDATA_BCM2838}, + { .compatible = "brcm,bcm2838", .data = PDATA_BCM2711}, + { .compatible = "brcm,bcm2711", .data = PDATA_BCM2711}, { }, }; @@ -72,6 +126,9 @@ int mach_cpu_init(void) if (!ret) { pdat = pdata_bcm283x[of_match->data]; rpi_bcm283x_base = pdat.io_base; +#ifdef CONFIG_ARM64 + mem_map = pdat.m_map; +#endif break; } diff --git a/board/raspberrypi/rpi/lowlevel_init.S b/board/raspberrypi/rpi/lowlevel_init.S index fcb99ebef7..9786a5a4b3 100644 --- a/board/raspberrypi/rpi/lowlevel_init.S +++ b/board/raspberrypi/rpi/lowlevel_init.S @@ -23,6 +23,12 @@ fw_dtb_pointer: .word 0x0 #endif +#ifdef CONFIG_ARM64 +.global mem_map +mem_map: + .dword 0x0 +#endif + /* * Routine: save_boot_params (called after reset from start.S) * Description: save ATAG/FDT address provided by the firmware at boot time diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index 9e0abdda31..cf1666ce5f 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -248,51 +248,6 @@ static uint32_t rev_scheme; static uint32_t rev_type; static const struct rpi_model *model; -#ifdef CONFIG_ARM64 -#ifndef CONFIG_BCM2711 -static struct mm_region bcm283x_mem_map[] = { - { - .virt = 0xUL, - .phys = 0xUL, - .size = 0x3f00UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | -PTE_BLOCK_INNER_SHARE - }, { - .virt = 0x3f00UL, - .phys = 0x3f00UL, - .size = 0x0100UL, - .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | -
[U-Boot] [PATCH 2/3] ARM: bcm283x: Set rpi_bcm283x_base at run-time
From: Matthias Brugger As part of the effort to create one binary for several bcm83x SoCs we use the SoC compatible to decide which IO base address we use. Signed-off-by: Matthias Brugger --- arch/arm/mach-bcm283x/Kconfig | 6 arch/arm/mach-bcm283x/init.c | 60 ++- 2 files changed, 59 insertions(+), 7 deletions(-) diff --git a/arch/arm/mach-bcm283x/Kconfig b/arch/arm/mach-bcm283x/Kconfig index b08275f598..e8e0ff0eb4 100644 --- a/arch/arm/mach-bcm283x/Kconfig +++ b/arch/arm/mach-bcm283x/Kconfig @@ -202,10 +202,4 @@ config SYS_SOC config SYS_CONFIG_NAME default "rpi" -config BCM283x_BASE - hex - default "0x2000" if BCM2835 - default "0x3f00" if BCM2836 || BCM2837 - default "0xfe00" if BCM2711 - endmenu diff --git a/arch/arm/mach-bcm283x/init.c b/arch/arm/mach-bcm283x/init.c index 9dcc96ba2e..214e1078eb 100644 --- a/arch/arm/mach-bcm283x/init.c +++ b/arch/arm/mach-bcm283x/init.c @@ -7,9 +7,49 @@ */ #include +#include + +#define PDATA_BCM2835 0 +#define PDATA_BCM2836 1 +#define PDATA_BCM2837 2 +#define PDATA_BCM2838 3 extern unsigned long rpi_bcm283x_base; +struct bcm283x_pdata { + unsigned long io_base; +}; + +struct bcm283x_pdata pdata_bcm283x[] = { + [PDATA_BCM2835] = { + .io_base = 0x2000, + }, + [PDATA_BCM2836] = { + .io_base = 0x3f00, + }, +#ifdef CONFIG_ARM64 + [PDATA_BCM2837] = { + .io_base = 0x3f00, + }, + [PDATA_BCM2838] = { + .io_base = 0xfe00, + }, +#endif +}; + +/* + * I/O address space varies on different chip versions. + * We set the base address by inspecting the DTB. + */ +static const struct udevice_id board_ids[] = { + { .compatible = "brcm,bcm2835", .data = PDATA_BCM2835}, + { .compatible = "brcm,bcm2836", .data = PDATA_BCM2836}, + { .compatible = "brcm,bcm2837", .data = PDATA_BCM2837}, + { .compatible = "brcm,bcm2838", .data = PDATA_BCM2838}, + { .compatible = "brcm,bcm2711", .data = PDATA_BCM2838}, + { }, +}; + int arch_cpu_init(void) { icache_enable(); @@ -19,10 +59,28 @@ int arch_cpu_init(void) int mach_cpu_init(void) { - rpi_bcm283x_base = CONFIG_BCM283x_BASE; + const struct udevice_id *of_match = board_ids; + int ret; + + rpi_bcm283x_base = 0; + + while (of_match->compatible) { + struct bcm283x_pdata pdat; + + ret = fdt_node_check_compatible(gd->fdt_blob, 0, + of_match->compatible); + if (!ret) { + pdat = pdata_bcm283x[of_match->data]; + rpi_bcm283x_base = pdat.io_base; + break; + } + + of_match++; + } return 0; } + #ifdef CONFIG_ARMV7_LPAE void enable_caches(void) { -- 2.22.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/3] ARM: bcm283x: Move BCM283x_BASE to a global variable
From: Matthias Brugger We move the per SOC define BCM283x_BASE to a global variable. This is a first step to provide a single binary for several bcm283x SoCs. Signed-off-by: Matthias Brugger --- arch/arm/mach-bcm283x/include/mach/base.h | 11 +++ arch/arm/mach-bcm283x/include/mach/mbox.h | 2 +- arch/arm/mach-bcm283x/include/mach/sdhci.h | 2 +- arch/arm/mach-bcm283x/include/mach/timer.h | 2 +- arch/arm/mach-bcm283x/include/mach/wdog.h | 2 +- arch/arm/mach-bcm283x/init.c | 8 arch/arm/mach-bcm283x/mbox.c | 8 ++-- arch/arm/mach-bcm283x/reset.c | 7 +-- board/raspberrypi/rpi/lowlevel_init.S | 8 include/configs/rpi.h | 7 ++- 10 files changed, 48 insertions(+), 9 deletions(-) create mode 100644 arch/arm/mach-bcm283x/include/mach/base.h diff --git a/arch/arm/mach-bcm283x/include/mach/base.h b/arch/arm/mach-bcm283x/include/mach/base.h new file mode 100644 index 00..c4ae39852f --- /dev/null +++ b/arch/arm/mach-bcm283x/include/mach/base.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * (C) Copyright 2019 Matthias Brugger + */ + +#ifndef _BCM283x_BASE_H_ +#define _BCM283x_BASE_H_ + +extern unsigned long rpi_bcm283x_base; + +#endif diff --git a/arch/arm/mach-bcm283x/include/mach/mbox.h b/arch/arm/mach-bcm283x/include/mach/mbox.h index 0b6c2543d5..39cf2cf9d5 100644 --- a/arch/arm/mach-bcm283x/include/mach/mbox.h +++ b/arch/arm/mach-bcm283x/include/mach/mbox.h @@ -37,7 +37,7 @@ /* Raw mailbox HW */ -#define BCM2835_MBOX_PHYSADDR (CONFIG_BCM283x_BASE + 0xb880) +#define BCM2835_MBOX_OFFSET 0xb880 struct bcm2835_mbox_regs { u32 read; diff --git a/arch/arm/mach-bcm283x/include/mach/sdhci.h b/arch/arm/mach-bcm283x/include/mach/sdhci.h index b443c379d8..16af5787c2 100644 --- a/arch/arm/mach-bcm283x/include/mach/sdhci.h +++ b/arch/arm/mach-bcm283x/include/mach/sdhci.h @@ -6,7 +6,7 @@ #ifndef _BCM2835_SDHCI_H_ #define _BCM2835_SDHCI_H_ -#define BCM2835_SDHCI_BASE (CONFIG_BCM283x_BASE + 0x0030) +#define BCM2835_SDHCI_OFFSET 0x0030 int bcm2835_sdhci_init(u32 regbase, u32 emmc_freq); diff --git a/arch/arm/mach-bcm283x/include/mach/timer.h b/arch/arm/mach-bcm283x/include/mach/timer.h index 014355e759..c789e188be 100644 --- a/arch/arm/mach-bcm283x/include/mach/timer.h +++ b/arch/arm/mach-bcm283x/include/mach/timer.h @@ -6,7 +6,7 @@ #ifndef _BCM2835_TIMER_H #define _BCM2835_TIMER_H -#define BCM2835_TIMER_PHYSADDR (CONFIG_BCM283x_BASE + 0x3000) +#define BCM2835_TIMER_OFFSET 0x3000 #define BCM2835_TIMER_CS_M3(1 << 3) #define BCM2835_TIMER_CS_M2(1 << 2) diff --git a/arch/arm/mach-bcm283x/include/mach/wdog.h b/arch/arm/mach-bcm283x/include/mach/wdog.h index 8292b3cf1f..2ca0e8c035 100644 --- a/arch/arm/mach-bcm283x/include/mach/wdog.h +++ b/arch/arm/mach-bcm283x/include/mach/wdog.h @@ -6,7 +6,7 @@ #ifndef _BCM2835_WDOG_H #define _BCM2835_WDOG_H -#define BCM2835_WDOG_PHYSADDR (CONFIG_BCM283x_BASE + 0x0010) +#define BCM2835_WDOG_OFFSET0x0010 struct bcm2835_wdog_regs { u32 unknown0[7]; diff --git a/arch/arm/mach-bcm283x/init.c b/arch/arm/mach-bcm283x/init.c index 97414415a6..9dcc96ba2e 100644 --- a/arch/arm/mach-bcm283x/init.c +++ b/arch/arm/mach-bcm283x/init.c @@ -8,6 +8,8 @@ #include +extern unsigned long rpi_bcm283x_base; + int arch_cpu_init(void) { icache_enable(); @@ -15,6 +17,12 @@ int arch_cpu_init(void) return 0; } +int mach_cpu_init(void) +{ + rpi_bcm283x_base = CONFIG_BCM283x_BASE; + + return 0; +} #ifdef CONFIG_ARMV7_LPAE void enable_caches(void) { diff --git a/arch/arm/mach-bcm283x/mbox.c b/arch/arm/mach-bcm283x/mbox.c index 3c67f68c17..21a7ce113d 100644 --- a/arch/arm/mach-bcm283x/mbox.c +++ b/arch/arm/mach-bcm283x/mbox.c @@ -10,13 +10,17 @@ #define TIMEOUT 1000 /* ms */ +extern unsigned long rpi_bcm283x_base; + int bcm2835_mbox_call_raw(u32 chan, u32 send, u32 *recv) { - struct bcm2835_mbox_regs *regs = - (struct bcm2835_mbox_regs *)BCM2835_MBOX_PHYSADDR; + struct bcm2835_mbox_regs *regs; ulong endtime = get_timer(0) + TIMEOUT; u32 val; + regs = (struct bcm2835_mbox_regs *)(rpi_bcm283x_base + + BCM2835_MBOX_OFFSET); + debug("time: %lu timeout: %lu\n", get_timer(0), endtime); if (send & BCM2835_CHAN_MASK) { diff --git a/arch/arm/mach-bcm283x/reset.c b/arch/arm/mach-bcm283x/reset.c index b3da0c7cd6..aff894b3c6 100644 --- a/arch/arm/mach-bcm283x/reset.c +++ b/arch/arm/mach-bcm283x/reset.c @@ -11,6 +11,8 @@ #include #include +extern unsigned long rpi_bcm283x_base; + #define RESET_TIMEOUT 10 /* @@ -25,8 +27,7 @@ void hw_watchdog_disable(void) {} -__efi_runtime_data struct bcm2835_wdog_regs *wdog_regs = - (struct bcm2835_wdog_regs *)BCM2835_WDOG_PHYSADDR; +__efi_runtime_data struct bcm2835_wdog_regs
[U-Boot] [PATCH 0/3] RPi one binary for RPi3/4 and RPi1/2
From: Matthias Brugger In this series we prepare the RaspberryPi source code to be able to build one binary for RPi[3,4] and one for RPi[1,2]. To achieve this we need to set the IO base address on runtime. Apart from that, for arm64 we also need to set memory region correctly. This patches fix this stuff. With this we could create one binary for each armv7 and armv8 based RPis. There is still some work to do to create a unified config, which will be done in a later patch series. Matthias Brugger (3): ARM: bcm283x: Move BCM283x_BASE to a global variable ARM: bcm283x: Set rpi_bcm283x_base at run-time ARM: bcm283x: Set memory map at run-time arch/arm/mach-bcm283x/Kconfig | 6 - arch/arm/mach-bcm283x/include/mach/base.h | 11 ++ arch/arm/mach-bcm283x/include/mach/mbox.h | 2 +- arch/arm/mach-bcm283x/include/mach/sdhci.h | 2 +- arch/arm/mach-bcm283x/include/mach/timer.h | 2 +- arch/arm/mach-bcm283x/include/mach/wdog.h | 2 +- arch/arm/mach-bcm283x/init.c | 123 + arch/arm/mach-bcm283x/mbox.c | 8 +- arch/arm/mach-bcm283x/reset.c | 7 +- board/raspberrypi/rpi/lowlevel_init.S | 14 +++ board/raspberrypi/rpi/rpi.c| 45 include/configs/rpi.h | 7 +- 12 files changed, 169 insertions(+), 60 deletions(-) create mode 100644 arch/arm/mach-bcm283x/include/mach/base.h -- 2.22.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2] rpi4: enable dram bank initialization
From: Matthias Brugger When booting through the efi stub, the memory map get's created by reading the dram bank information. Depending on the version of the RPi4 this information changes. Read the device tree to initialize the dram bank data structure. This way the kernel is able to access the whole range of available memory. Signed-off-by: Matthias Brugger --- This patch is based on basic RPi4 support implemented by series: https://www.mail-archive.com/u-boot@lists.denx.de/msg335667.html which is part of v2019.10-rc4 To actually work correctly we need the series that fixes the libftd: https://patchwork.ozlabs.org/cover/1158304/ Changes in v2: - don't call dram_init_banksize if OF_BOARD is not used board/raspberrypi/rpi/rpi.c | 10 ++ configs/rpi_4_defconfig | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index fa57d50c95..9e0abdda31 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -312,6 +312,16 @@ int dram_init(void) return 0; } +#ifdef CONFIG_OF_BOARD +#ifdef CONFIG_BCM2711 +int dram_init_banksize(void) +{ + return fdtdec_decode_ram_size(gd->fdt_blob, NULL, 0, NULL, +(phys_size_t *)>ram_size, gd->bd); +} +#endif +#endif + static void set_fdtfile(void) { const char *fdtfile; diff --git a/configs/rpi_4_defconfig b/configs/rpi_4_defconfig index da8c960a2a..c639ac93de 100644 --- a/configs/rpi_4_defconfig +++ b/configs/rpi_4_defconfig @@ -4,7 +4,7 @@ CONFIG_SYS_TEXT_BASE=0x0008 CONFIG_TARGET_RPI_4=y CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_DISTRO_DEFAULTS=y -CONFIG_NR_DRAM_BANKS=1 +CONFIG_NR_DRAM_BANKS=2 # CONFIG_ARCH_FIXUP_FDT_MEMORY is not set CONFIG_OF_BOARD=y CONFIG_OF_BOARD_SETUP=y -- 2.22.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] rpi4: enable dram bank initialization
From: Matthias Brugger When booting through the efi stub, the memory map get's created by reading the dram bank information. Depending on the version of the RPi4 this information changes. Read the device tree to initialize the dram bank data structure. This way the kernel is able to access the whole range of available memory. Signed-off-by: Matthias Brugger --- This patch is based on basic RPi4 support implemented by series: https://www.mail-archive.com/u-boot@lists.denx.de/msg335667.html To actually work correctly we need the series that fixes the libftd: https://patchwork.ozlabs.org/cover/1158304/ board/raspberrypi/rpi/rpi.c | 8 configs/rpi_4_defconfig | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index fa57d50c95..eea8a69551 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -312,6 +312,14 @@ int dram_init(void) return 0; } +#ifdef CONFIG_BCM2711 +int dram_init_banksize(void) +{ + return fdtdec_decode_ram_size(gd->fdt_blob, NULL, 0, NULL, +(phys_size_t *)>ram_size, gd->bd); +} +#endif + static void set_fdtfile(void) { const char *fdtfile; diff --git a/configs/rpi_4_defconfig b/configs/rpi_4_defconfig index da8c960a2a..c639ac93de 100644 --- a/configs/rpi_4_defconfig +++ b/configs/rpi_4_defconfig @@ -4,7 +4,7 @@ CONFIG_SYS_TEXT_BASE=0x0008 CONFIG_TARGET_RPI_4=y CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_DISTRO_DEFAULTS=y -CONFIG_NR_DRAM_BANKS=1 +CONFIG_NR_DRAM_BANKS=2 # CONFIG_ARCH_FIXUP_FDT_MEMORY is not set CONFIG_OF_BOARD=y CONFIG_OF_BOARD_SETUP=y -- 2.22.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 0/4] Fix default values for address and size cells
From: Matthias Brugger The libftd implementation of U-Boot is outdated with the upstream project. Especially the default number of size-cells was wrong. This series fixes this by backporting the corresponding patches from the upstream project. Changes since v1: - fix spelling of U-Boot (patch 1 + 2 /4) - add Reviewed-by tag (patch 1/4) - fix the case of size-cells == 0 (patch 3/4) - fix default address cells for livetree (patch 4/4) v1 can be found here: https://patchwork.ozlabs.org/patch/1137331/ https://patchwork.ozlabs.org/patch/1137330/ Matthias Brugger (4): libfdt: fdt_address_cells() and fdt_size_cells() libfdt: return correct value if #size-cells property is not present libfdt: Allow #size-cells of 0 dm: Fix default address cells return value include/dm/of.h| 2 +- scripts/dtc/libfdt/fdt_addresses.c | 45 -- scripts/dtc/libfdt/libfdt.h| 2 +- 3 files changed, 26 insertions(+), 23 deletions(-) -- 2.22.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 4/4] dm: Fix default address cells return value
From: Matthias Brugger Default address cells value on the livetree access function returns the wrong value. Fix this so that the value returned corresponds to the device tree specification. Signed-off-by: Matthias Brugger --- include/dm/of.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/dm/of.h b/include/dm/of.h index 461e25aa19..6bef73b441 100644 --- a/include/dm/of.h +++ b/include/dm/of.h @@ -111,7 +111,7 @@ static inline const char *of_node_full_name(const struct device_node *np) /* Default #address and #size cells */ #if !defined(OF_ROOT_NODE_ADDR_CELLS_DEFAULT) -#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 1 +#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 2 #define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1 #endif -- 2.22.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 2/4] libfdt: return correct value if #size-cells property is not present
From: Matthias Brugger According to the device tree specification, the default value for was not present. This patch also makes fdt_address_cells() and fdt_size_cells() conform to the behaviour documented in libfdt.h. The defaults are only returned if fdt_getprop() returns -FDT_ERR_NOTFOUND, otherwise the actual error is returned. This is based on upstream commit: aa7254d ("libfdt: return correct value if #size-cells property is not present") but misses the test case part, as we don't implement them in U-Boot. Signed-off-by: Matthias Brugger --- scripts/dtc/libfdt/fdt_addresses.c | 16 +--- scripts/dtc/libfdt/libfdt.h| 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/dtc/libfdt/fdt_addresses.c b/scripts/dtc/libfdt/fdt_addresses.c index 49537b578d..f13a87dfa0 100644 --- a/scripts/dtc/libfdt/fdt_addresses.c +++ b/scripts/dtc/libfdt/fdt_addresses.c @@ -64,7 +64,7 @@ static int fdt_cells(const void *fdt, int nodeoffset, const char *name) c = fdt_getprop(fdt, nodeoffset, name, ); if (!c) - return 2; + return len; if (len != sizeof(*c)) return -FDT_ERR_BADNCELLS; @@ -78,10 +78,20 @@ static int fdt_cells(const void *fdt, int nodeoffset, const char *name) int fdt_address_cells(const void *fdt, int nodeoffset) { - return fdt_cells(fdt, nodeoffset, "#address-cells"); + int val; + + val = fdt_cells(fdt, nodeoffset, "#address-cells"); + if (val == -FDT_ERR_NOTFOUND) + return 2; + return val; } int fdt_size_cells(const void *fdt, int nodeoffset) { - return fdt_cells(fdt, nodeoffset, "#size-cells"); + int val; + + val = fdt_cells(fdt, nodeoffset, "#size-cells"); + if (val == -FDT_ERR_NOTFOUND) + return 1; + return val; } diff --git a/scripts/dtc/libfdt/libfdt.h b/scripts/dtc/libfdt/libfdt.h index 66f01fec53..5c778b115b 100644 --- a/scripts/dtc/libfdt/libfdt.h +++ b/scripts/dtc/libfdt/libfdt.h @@ -1109,7 +1109,7 @@ int fdt_address_cells(const void *fdt, int nodeoffset); * * returns: * 0 <= n < FDT_MAX_NCELLS, on success - * 2, if the node has no #size-cells property + * 1, if the node has no #size-cells property * -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid * #size-cells property * -FDT_ERR_BADMAGIC, -- 2.22.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 3/4] libfdt: Allow #size-cells of 0
From: Matthias Brugger The commit "libfdt: fdt_address_cells() and fdt_size_cells()" introduced a bug as it consolidated code between the helpers for getting be 0, and is frequently found so in practice for /cpus. IEEE1275 only requires implementations to handle 1..4 for #address-cells, although one could make a case for #address-cells == #size-cells == 0 being used to represent a bridge with a single port. While we're there, it's not totally obvious that the existing implicit cast of a u32 to int will give the correct results according to strict C, although it does work in practice. Straighten that up to cast only after we've made our range checks. This is based on upstream commit: b8d6eca ("libfdt: Allow #size-cells of 0") but misses the test cases,as we don't implement them in U-Boot. Signed-off-by: Matthias Brugger --- scripts/dtc/libfdt/fdt_addresses.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/dtc/libfdt/fdt_addresses.c b/scripts/dtc/libfdt/fdt_addresses.c index f13a87dfa0..788c143113 100644 --- a/scripts/dtc/libfdt/fdt_addresses.c +++ b/scripts/dtc/libfdt/fdt_addresses.c @@ -59,7 +59,7 @@ static int fdt_cells(const void *fdt, int nodeoffset, const char *name) { const fdt32_t *c; - int val; + uint32_t val; int len; c = fdt_getprop(fdt, nodeoffset, name, ); @@ -70,10 +70,10 @@ static int fdt_cells(const void *fdt, int nodeoffset, const char *name) return -FDT_ERR_BADNCELLS; val = fdt32_to_cpu(*c); - if ((val <= 0) || (val > FDT_MAX_NCELLS)) + if (val > FDT_MAX_NCELLS) return -FDT_ERR_BADNCELLS; - return val; + return (int)val; } int fdt_address_cells(const void *fdt, int nodeoffset) @@ -81,6 +81,8 @@ int fdt_address_cells(const void *fdt, int nodeoffset) int val; val = fdt_cells(fdt, nodeoffset, "#address-cells"); + if (val == 0) + return -FDT_ERR_BADNCELLS; if (val == -FDT_ERR_NOTFOUND) return 2; return val; -- 2.22.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 1/4] libfdt: fdt_address_cells() and fdt_size_cells()
From: Matthias Brugger Add internal fdt_cells() to avoid copy and paste. Fix typo in fdt_size_cells() documentation comment. This is based in upstream commit: c12b2b0 ("libfdt: fdt_address_cells() and fdt_size_cells()") but misses the test cases, as we don't implement them in U-Boot. Signed-off-by: Matthias Brugger Reviewed-by: Simon Glass --- scripts/dtc/libfdt/fdt_addresses.c | 35 +++--- scripts/dtc/libfdt/libfdt.h| 2 +- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/scripts/dtc/libfdt/fdt_addresses.c b/scripts/dtc/libfdt/fdt_addresses.c index eff4dbcc72..49537b578d 100644 --- a/scripts/dtc/libfdt/fdt_addresses.c +++ b/scripts/dtc/libfdt/fdt_addresses.c @@ -1,6 +1,7 @@ /* * libfdt - Flat Device Tree manipulation * Copyright (C) 2014 David Gibson + * Copyright (C) 2018 embedded brains GmbH * * libfdt is dual licensed: you can use it either under the terms of * the GPL, or the BSD license, at your option. @@ -55,42 +56,32 @@ #include "libfdt_internal.h" -int fdt_address_cells(const void *fdt, int nodeoffset) +static int fdt_cells(const void *fdt, int nodeoffset, const char *name) { - const fdt32_t *ac; + const fdt32_t *c; int val; int len; - ac = fdt_getprop(fdt, nodeoffset, "#address-cells", ); - if (!ac) + c = fdt_getprop(fdt, nodeoffset, name, ); + if (!c) return 2; - if (len != sizeof(*ac)) + if (len != sizeof(*c)) return -FDT_ERR_BADNCELLS; - val = fdt32_to_cpu(*ac); + val = fdt32_to_cpu(*c); if ((val <= 0) || (val > FDT_MAX_NCELLS)) return -FDT_ERR_BADNCELLS; return val; } -int fdt_size_cells(const void *fdt, int nodeoffset) +int fdt_address_cells(const void *fdt, int nodeoffset) { - const fdt32_t *sc; - int val; - int len; - - sc = fdt_getprop(fdt, nodeoffset, "#size-cells", ); - if (!sc) - return 2; - - if (len != sizeof(*sc)) - return -FDT_ERR_BADNCELLS; - - val = fdt32_to_cpu(*sc); - if ((val < 0) || (val > FDT_MAX_NCELLS)) - return -FDT_ERR_BADNCELLS; + return fdt_cells(fdt, nodeoffset, "#address-cells"); +} - return val; +int fdt_size_cells(const void *fdt, int nodeoffset) +{ + return fdt_cells(fdt, nodeoffset, "#size-cells"); } diff --git a/scripts/dtc/libfdt/libfdt.h b/scripts/dtc/libfdt/libfdt.h index cf86ddba88..66f01fec53 100644 --- a/scripts/dtc/libfdt/libfdt.h +++ b/scripts/dtc/libfdt/libfdt.h @@ -1109,7 +1109,7 @@ int fdt_address_cells(const void *fdt, int nodeoffset); * * returns: * 0 <= n < FDT_MAX_NCELLS, on success - * 2, if the node has no #address-cells property + * 2, if the node has no #size-cells property * -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid * #size-cells property * -FDT_ERR_BADMAGIC, -- 2.22.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/2] libfdt: fdt_address_cells() and fdt_size_cells()
From: Matthias Brugger Add internal fdt_cells() to avoid copy and paste. Fix typo in fdt_size_cells() documentation comment. This is based in upstream commit: c12b2b0 ("libfdt: fdt_address_cells() and fdt_size_cells()") but misses the test cases, as we don't implement them in u-boot. Signed-off-by: Matthias Brugger --- scripts/dtc/libfdt/fdt_addresses.c | 35 +++--- scripts/dtc/libfdt/libfdt.h| 2 +- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/scripts/dtc/libfdt/fdt_addresses.c b/scripts/dtc/libfdt/fdt_addresses.c index eff4dbcc72..49537b578d 100644 --- a/scripts/dtc/libfdt/fdt_addresses.c +++ b/scripts/dtc/libfdt/fdt_addresses.c @@ -1,6 +1,7 @@ /* * libfdt - Flat Device Tree manipulation * Copyright (C) 2014 David Gibson + * Copyright (C) 2018 embedded brains GmbH * * libfdt is dual licensed: you can use it either under the terms of * the GPL, or the BSD license, at your option. @@ -55,42 +56,32 @@ #include "libfdt_internal.h" -int fdt_address_cells(const void *fdt, int nodeoffset) +static int fdt_cells(const void *fdt, int nodeoffset, const char *name) { - const fdt32_t *ac; + const fdt32_t *c; int val; int len; - ac = fdt_getprop(fdt, nodeoffset, "#address-cells", ); - if (!ac) + c = fdt_getprop(fdt, nodeoffset, name, ); + if (!c) return 2; - if (len != sizeof(*ac)) + if (len != sizeof(*c)) return -FDT_ERR_BADNCELLS; - val = fdt32_to_cpu(*ac); + val = fdt32_to_cpu(*c); if ((val <= 0) || (val > FDT_MAX_NCELLS)) return -FDT_ERR_BADNCELLS; return val; } -int fdt_size_cells(const void *fdt, int nodeoffset) +int fdt_address_cells(const void *fdt, int nodeoffset) { - const fdt32_t *sc; - int val; - int len; - - sc = fdt_getprop(fdt, nodeoffset, "#size-cells", ); - if (!sc) - return 2; - - if (len != sizeof(*sc)) - return -FDT_ERR_BADNCELLS; - - val = fdt32_to_cpu(*sc); - if ((val < 0) || (val > FDT_MAX_NCELLS)) - return -FDT_ERR_BADNCELLS; + return fdt_cells(fdt, nodeoffset, "#address-cells"); +} - return val; +int fdt_size_cells(const void *fdt, int nodeoffset) +{ + return fdt_cells(fdt, nodeoffset, "#size-cells"); } diff --git a/scripts/dtc/libfdt/libfdt.h b/scripts/dtc/libfdt/libfdt.h index cf86ddba88..66f01fec53 100644 --- a/scripts/dtc/libfdt/libfdt.h +++ b/scripts/dtc/libfdt/libfdt.h @@ -1109,7 +1109,7 @@ int fdt_address_cells(const void *fdt, int nodeoffset); * * returns: * 0 <= n < FDT_MAX_NCELLS, on success - * 2, if the node has no #address-cells property + * 2, if the node has no #size-cells property * -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid * #size-cells property * -FDT_ERR_BADMAGIC, -- 2.21.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 2/2] libfdt: return correct value if #size-cells property is not present
From: Matthias Brugger According to the device tree specification, the default value for was not present. This patch also makes fdt_address_cells() and fdt_size_cells() conform to the behaviour documented in libfdt.h. The defaults are only returned if fdt_getprop() returns -FDT_ERR_NOTFOUND, otherwise the actual error is returned. This is based on upstream commit: aa7254d ("libfdt: return correct value if #size-cells property is not present") but misses the test case part, as we don't implement them in u-boot. Signed-off-by: Matthias Brugger --- scripts/dtc/libfdt/fdt_addresses.c | 16 +--- scripts/dtc/libfdt/libfdt.h| 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/dtc/libfdt/fdt_addresses.c b/scripts/dtc/libfdt/fdt_addresses.c index 49537b578d..f13a87dfa0 100644 --- a/scripts/dtc/libfdt/fdt_addresses.c +++ b/scripts/dtc/libfdt/fdt_addresses.c @@ -64,7 +64,7 @@ static int fdt_cells(const void *fdt, int nodeoffset, const char *name) c = fdt_getprop(fdt, nodeoffset, name, ); if (!c) - return 2; + return len; if (len != sizeof(*c)) return -FDT_ERR_BADNCELLS; @@ -78,10 +78,20 @@ static int fdt_cells(const void *fdt, int nodeoffset, const char *name) int fdt_address_cells(const void *fdt, int nodeoffset) { - return fdt_cells(fdt, nodeoffset, "#address-cells"); + int val; + + val = fdt_cells(fdt, nodeoffset, "#address-cells"); + if (val == -FDT_ERR_NOTFOUND) + return 2; + return val; } int fdt_size_cells(const void *fdt, int nodeoffset) { - return fdt_cells(fdt, nodeoffset, "#size-cells"); + int val; + + val = fdt_cells(fdt, nodeoffset, "#size-cells"); + if (val == -FDT_ERR_NOTFOUND) + return 1; + return val; } diff --git a/scripts/dtc/libfdt/libfdt.h b/scripts/dtc/libfdt/libfdt.h index 66f01fec53..5c778b115b 100644 --- a/scripts/dtc/libfdt/libfdt.h +++ b/scripts/dtc/libfdt/libfdt.h @@ -1109,7 +1109,7 @@ int fdt_address_cells(const void *fdt, int nodeoffset); * * returns: * 0 <= n < FDT_MAX_NCELLS, on success - * 2, if the node has no #size-cells property + * 1, if the node has no #size-cells property * -FDT_ERR_BADNCELLS, if the node has a badly formatted or invalid * #size-cells property * -FDT_ERR_BADMAGIC, -- 2.21.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] ARM: bcm283x mbox: Fix send status register
From: Fabian Vogt Before we can send a message to the mailbox we have to check that there is space to do so. Therefore we poll the status register. But up to now the wrong status register, the one of mailbox 0, was checked. Fix this by polling the status regiser of mailbox 1. Signed-off-by: Fabian Vogt [mb: rename registers and update commit message] Signed-off-by: Matthias Brugger --- arch/arm/mach-bcm283x/include/mach/mbox.h | 7 +-- arch/arm/mach-bcm283x/mbox.c | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-bcm283x/include/mach/mbox.h b/arch/arm/mach-bcm283x/include/mach/mbox.h index e3a893e49c..f892803558 100644 --- a/arch/arm/mach-bcm283x/include/mach/mbox.h +++ b/arch/arm/mach-bcm283x/include/mach/mbox.h @@ -46,9 +46,12 @@ struct bcm2835_mbox_regs { u32 read; u32 rsvd0[5]; - u32 status; - u32 config; + u32 mail0_status; + u32 mail0_config; u32 write; + u32 rsvd1[5]; + u32 mail1_status; + u32 mail1_config; }; #define BCM2835_MBOX_STATUS_WR_FULL0x8000 diff --git a/arch/arm/mach-bcm283x/mbox.c b/arch/arm/mach-bcm283x/mbox.c index 1642ebd103..3c67f68c17 100644 --- a/arch/arm/mach-bcm283x/mbox.c +++ b/arch/arm/mach-bcm283x/mbox.c @@ -27,7 +27,7 @@ int bcm2835_mbox_call_raw(u32 chan, u32 send, u32 *recv) /* Drain any stale responses */ for (;;) { - val = readl(>status); + val = readl(>mail0_status); if (val & BCM2835_MBOX_STATUS_RD_EMPTY) break; if (get_timer(0) >= endtime) { @@ -40,7 +40,7 @@ int bcm2835_mbox_call_raw(u32 chan, u32 send, u32 *recv) /* Wait for space to send */ for (;;) { - val = readl(>status); + val = readl(>mail1_status); if (!(val & BCM2835_MBOX_STATUS_WR_FULL)) break; if (get_timer(0) >= endtime) { @@ -58,7 +58,7 @@ int bcm2835_mbox_call_raw(u32 chan, u32 send, u32 *recv) /* Wait for the response */ for (;;) { - val = readl(>status); + val = readl(>mail0_status); if (!(val & BCM2835_MBOX_STATUS_RD_EMPTY)) break; if (get_timer(0) >= endtime) { -- 2.21.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] video: arm: rpi: Bail out early if querying video information fails
From: Fabian Vogt When probing we query for the width and hight of the display. If the firmware does not report any connected display the system will crash. See https://github.com/raspberrypi/firmware/issues/1157 for details. Signed-off-by: Fabian Vogt [mb: update commit message] Signed-off-by: Matthias Brugger --- drivers/video/bcm2835.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/video/bcm2835.c b/drivers/video/bcm2835.c index bc41090aed..1d2eda084c 100644 --- a/drivers/video/bcm2835.c +++ b/drivers/video/bcm2835.c @@ -19,13 +19,15 @@ static int bcm2835_video_probe(struct udevice *dev) debug("bcm2835: Query resolution...\n"); ret = bcm2835_get_video_size(, ); - if (ret) + if (ret || w == 0 || h == 0) return -EIO; debug("bcm2835: Setting up display for %d x %d\n", w, h); ret = bcm2835_set_video_params(, , 32, BCM2835_MBOX_PIXEL_ORDER_RGB, BCM2835_MBOX_ALPHA_MODE_IGNORED, _base, _size, ); + if (ret) + return -EIO; debug("bcm2835: Final resolution is %d x %d\n", w, h); -- 2.21.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] RPi: Add mbrugger as board maintainer
From: Matthias Brugger I took over maintainership from Alex Graf with commit 3157bbfa18 ("rpi: Make Matthias maintainer") But I forgot to update the board maintainer file. This patch adds myself to the game. Signed-off-by: Matthias Brugger --- board/raspberrypi/rpi/MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/raspberrypi/rpi/MAINTAINERS b/board/raspberrypi/rpi/MAINTAINERS index cce1a7ad76..4f1b23efc8 100644 --- a/board/raspberrypi/rpi/MAINTAINERS +++ b/board/raspberrypi/rpi/MAINTAINERS @@ -1,5 +1,5 @@ RPI BOARD -M: Alexander Graf +M: Matthias Brugger S: Maintained F: board/raspberrypi/rpi/ F: include/configs/rpi.h -- 2.20.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 1/2] efi_loader: Fix serial console size detection
From: Matthias Brugger Function term_read_reply tries to read from the serial console until the end_char was read. This can hang forever if we are, for some reason, not be able to read the full response (e.g. serial buffer too small, frame error). This patch moves the timeout detection into term_read_reply to assure we will make progress. Fixes: 6bb591f704 ("efi_loader: query serial console size reliably") Signed-off-by: Matthias Brugger --- Changes in v2: - move timeout into term_get_char lib/efi_loader/efi_console.c | 60 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c index 66c33a551d..1133674faf 100644 --- a/lib/efi_loader/efi_console.c +++ b/lib/efi_loader/efi_console.c @@ -62,6 +62,21 @@ static struct simple_text_output_mode efi_con_mode = { .cursor_visible = 1, }; +static int term_get_char(char *c) +{ + u64 timeout; + + /* Wait up to 100 ms for a character */ + timeout = timer_get_us() + 10; + + while (!tstc()) + if (timer_get_us() > timeout) + return 1; + + *c = getc(); + return 0; +} + /* * Receive and parse a reply from the terminal. * @@ -75,31 +90,31 @@ static int term_read_reply(int *n, int num, char end_char) char c; int i = 0; - c = getc(); - if (c != cESC) + if (term_get_char() || c != cESC) return -1; - c = getc(); - if (c != '[') + + if (term_get_char() || c != '[') return -1; n[0] = 0; while (1) { - c = getc(); - if (c == ';') { - i++; - if (i >= num) + if (!term_get_char()) { + if (c == ';') { + i++; + if (i >= num) + return -1; + n[i] = 0; + continue; + } else if (c == end_char) { + break; + } else if (c > '9' || c < '0') { return -1; - n[i] = 0; - continue; - } else if (c == end_char) { - break; - } else if (c > '9' || c < '0') { - return -1; - } + } - /* Read one more decimal position */ - n[i] *= 10; - n[i] += c - '0'; + /* Read one more decimal position */ + n[i] *= 10; + n[i] += c - '0'; + } } if (i != num - 1) return -1; @@ -196,7 +211,6 @@ static int query_console_serial(int *rows, int *cols) { int ret = 0; int n[2]; - u64 timeout; /* Empty input buffer */ while (tstc()) @@ -216,14 +230,6 @@ static int query_console_serial(int *rows, int *cols) ESC "[999;999H" /* Move to bottom right corner */ ESC "[6n"); /* Query cursor position */ - /* Allow up to one second for a response */ - timeout = timer_get_us() + 100; - while (!tstc()) - if (timer_get_us() > timeout) { - ret = -1; - goto out; - } - /* Read {rows,cols} */ if (term_read_reply(n, 2, 'R')) { ret = 1; -- 2.20.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 2/2] efi_loader: Fix possible starving in efi_cin_read_key
From: Matthias Brugger The function efi_cin_read_key can be affected by a loss of a character which will make u-boot to wait forever. Fix this by calling term_get_char instead. Signed-off-by: Matthias Brugger --- Changes in v2: None lib/efi_loader/efi_console.c | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c index 1133674faf..558aaed109 100644 --- a/lib/efi_loader/efi_console.c +++ b/lib/efi_loader/efi_console.c @@ -493,13 +493,14 @@ static int analyze_modifiers(struct efi_key_state *key_state) { int c, mod = 0, ret = 0; - c = getc(); + if (!term_get_char()) + goto out; if (c != ';') { ret = c; if (c == '~') goto out; - c = getc(); + term_get_char(); } for (;;) { switch (c) { @@ -508,7 +509,7 @@ static int analyze_modifiers(struct efi_key_state *key_state) mod += c - '0'; /* fall through */ case ';': - c = getc(); + term_get_char(); break; default: goto out; @@ -551,7 +552,9 @@ static efi_status_t efi_cin_read_key(struct efi_key_data *key) * Xterm Control Sequences * https://www.xfree86.org/4.8.0/ctlseqs.html */ - ch = getc(); + if (!term_get_char()) + return EFI_NOT_READY; + switch (ch) { case cESC: /* ESC */ pressed_key.scan_code = 23; @@ -561,12 +564,15 @@ static efi_status_t efi_cin_read_key(struct efi_key_data *key) /* consider modifiers */ if (ch < 'P') { set_shift_mask(ch - '0', >key_state); - ch = getc(); + if (!term_get_char()) + return EFI_NOT_READY; } pressed_key.scan_code = ch - 'P' + 11; break; case '[': - ch = getc(); + if (!term_get_char()) + return EFI_NOT_READY; + switch (ch) { case 'A'...'D': /* up, down right, left */ pressed_key.scan_code = ch - 'A' + 1; -- 2.20.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [RFC] drivers: serial: Check only input buffers in pending
From: Matthias Brugger Serial device function pending allows to check the state of the input and output buffers. But in fact only a check for the input buffers is used in the device model. There are even some driver which discard a check on the output buffers. So delete the check for the output buffers to reflect that fact in the function definition. Signed-off-by: Matthias Brugger --- drivers/serial/altera_jtag_uart.c | 7 ++- drivers/serial/altera_uart.c | 7 ++- drivers/serial/arm_dcc.c | 8 ++-- drivers/serial/atmel_usart.c | 7 ++- drivers/serial/lpc32xx_hsuart.c| 11 +++ drivers/serial/mcfuart.c | 9 ++--- drivers/serial/ns16550.c | 7 ++- drivers/serial/sandbox.c | 7 ++- drivers/serial/serial-uclass.c | 2 +- drivers/serial/serial_ar933x.c | 8 +++- drivers/serial/serial_arc.c| 7 ++- drivers/serial/serial_bcm283x_mu.c | 10 +++--- drivers/serial/serial_bcm6345.c| 7 ++- drivers/serial/serial_efi.c| 6 +- drivers/serial/serial_linflexuart.c| 7 ++- drivers/serial/serial_lpuart.c | 14 +++--- drivers/serial/serial_meson.c | 7 ++- drivers/serial/serial_mpc8xx.c | 5 + drivers/serial/serial_msm.c| 8 +++- drivers/serial/serial_mtk.c| 9 +++-- drivers/serial/serial_mvebu_a3700.c| 2 +- drivers/serial/serial_mxc.c| 7 ++- drivers/serial/serial_nulldev.c| 2 +- drivers/serial/serial_owl.c| 7 ++- drivers/serial/serial_pic32.c | 7 ++- drivers/serial/serial_pl01x.c | 7 ++- drivers/serial/serial_pl01x_internal.h | 2 +- drivers/serial/serial_pxa.c| 9 ++--- drivers/serial/serial_s5p.c| 7 ++- drivers/serial/serial_sh.c | 2 +- drivers/serial/serial_sifive.c | 14 +- drivers/serial/serial_sti_asc.c| 11 --- drivers/serial/serial_stm32.c | 10 +++--- drivers/serial/serial_uniphier.c | 7 ++- drivers/serial/serial_xuartlite.c | 7 ++- drivers/serial/serial_zynq.c | 7 ++- include/serial.h | 4 ++-- 37 files changed, 83 insertions(+), 182 deletions(-) diff --git a/drivers/serial/altera_jtag_uart.c b/drivers/serial/altera_jtag_uart.c index 86c3de4e45..7f52399312 100644 --- a/drivers/serial/altera_jtag_uart.c +++ b/drivers/serial/altera_jtag_uart.c @@ -53,16 +53,13 @@ static int altera_jtaguart_putc(struct udevice *dev, const char ch) return 0; } -static int altera_jtaguart_pending(struct udevice *dev, bool input) +static int altera_jtaguart_pending(struct udevice *dev) { struct altera_jtaguart_platdata *plat = dev->platdata; struct altera_jtaguart_regs *const regs = plat->regs; u32 st = readl(>control); - if (input) - return st & ALTERA_JTAG_RRDY ? 1 : 0; - else - return !(ALTERA_JTAG_WSPACE(st) == ALTERA_JTAG_WRITE_DEPTH); + return st & ALTERA_JTAG_RRDY ? 1 : 0; } static int altera_jtaguart_getc(struct udevice *dev) diff --git a/drivers/serial/altera_uart.c b/drivers/serial/altera_uart.c index 67d47199aa..f3f8d908bf 100644 --- a/drivers/serial/altera_uart.c +++ b/drivers/serial/altera_uart.c @@ -56,16 +56,13 @@ static int altera_uart_putc(struct udevice *dev, const char ch) return 0; } -static int altera_uart_pending(struct udevice *dev, bool input) +static int altera_uart_pending(struct udevice *dev) { struct altera_uart_platdata *plat = dev->platdata; struct altera_uart_regs *const regs = plat->regs; u32 st = readl(>status); - if (input) - return st & ALTERA_UART_RRDY ? 1 : 0; - else - return !(st & ALTERA_UART_TMT); + return st & ALTERA_UART_RRDY ? 1 : 0; } static int altera_uart_getc(struct udevice *dev) diff --git a/drivers/serial/arm_dcc.c b/drivers/serial/arm_dcc.c index dfcb6fd698..0771f90e7c 100644 --- a/drivers/serial/arm_dcc.c +++ b/drivers/serial/arm_dcc.c @@ -126,15 +126,11 @@ static int arm_dcc_putc(struct udevice *dev, char ch) return 0; } -static int arm_dcc_pending(struct udevice *dev, bool input) +static int arm_dcc_pending(struct udevice *dev) { register unsigned int reg; - if (input) { - can_read_dcc(reg); - } else { - can_write_dcc(reg); - } + can_read_dcc(reg); return reg; } diff --git a/drivers/serial/atmel_usart.c b/drivers/serial/atmel_usart.c index aa8cdff840..fdde966da2 100644 --- a/drivers/serial/atmel_usart.c +++ b/drivers/serial/atmel_usart.c @@ -200,15 +200,12 @@ static int atmel_serial_putc(struct udevice *dev, const char ch) return 0; } -static int atmel_serial_pending(struct
[U-Boot] [PATCH] efi_loader: Fix serial console size detection
From: Matthias Brugger Function term_read_reply tries to read from the serial console until the end_char was read. This can hang forever if we are, for some reason, not be able to read the full response (e.g. serial buffer too small, frame error). This patch moves the timeout detection into term_read_reply to assure we will make progress. Fixes: 6bb591f704 ("efi_loader: query serial console size reliably") Signed-off-by: Matthias Brugger --- lib/efi_loader/efi_console.c | 63 +--- 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c index 66c33a551d..817220455f 100644 --- a/lib/efi_loader/efi_console.c +++ b/lib/efi_loader/efi_console.c @@ -62,6 +62,16 @@ static struct simple_text_output_mode efi_con_mode = { .cursor_visible = 1, }; +static int term_get_char(char *c) +{ + if (tstc()) { + *c = getc(); + return 0; + } + + return 1; +} + /* * Receive and parse a reply from the terminal. * @@ -74,32 +84,42 @@ static int term_read_reply(int *n, int num, char end_char) { char c; int i = 0; + u64 timeout; - c = getc(); - if (c != cESC) + /* Allow up to one second for the response */ + timeout = timer_get_us() + 100; + while (!tstc()) + if (timer_get_us() > timeout) + return -1; + + if (term_get_char() || c != cESC) return -1; - c = getc(); - if (c != '[') + + if (term_get_char() || c != '[') return -1; n[0] = 0; while (1) { - c = getc(); - if (c == ';') { - i++; - if (i >= num) + if (!term_get_char()) { + if (c == ';') { + i++; + if (i >= num) + return -1; + n[i] = 0; + continue; + } else if (c == end_char) { + break; + } else if (c > '9' || c < '0') { return -1; - n[i] = 0; - continue; - } else if (c == end_char) { - break; - } else if (c > '9' || c < '0') { - return -1; + } + + /* Read one more decimal position */ + n[i] *= 10; + n[i] += c - '0'; } - /* Read one more decimal position */ - n[i] *= 10; - n[i] += c - '0'; + if (timer_get_us() > timeout) + return -1; } if (i != num - 1) return -1; @@ -196,7 +216,6 @@ static int query_console_serial(int *rows, int *cols) { int ret = 0; int n[2]; - u64 timeout; /* Empty input buffer */ while (tstc()) @@ -216,14 +235,6 @@ static int query_console_serial(int *rows, int *cols) ESC "[999;999H" /* Move to bottom right corner */ ESC "[6n"); /* Query cursor position */ - /* Allow up to one second for a response */ - timeout = timer_get_us() + 100; - while (!tstc()) - if (timer_get_us() > timeout) { - ret = -1; - goto out; - } - /* Read {rows,cols} */ if (term_read_reply(n, 2, 'R')) { ret = 1; -- 2.20.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot