Introduce support for Raspberry PI 5.
Subsystems (13)
cover Introduce support for Raspberry PI 5.
This patch series provides generic support for Raspberry PI 5 in U-Boot with additional hardware drivers.
The following features were implemented:
1) add generic board config for Raspberry PI5 including device-tree files;
2) add support for RP1 chip with additional hardware;
3) add support for rp1-clock driver with dt-bindings update;
4) PCIE BRCMSTB driver support for Raspberry PI 5;
5) add clock/reset/gpio drivers;
6) add ethernet support in u-boot.
This patch-series introducing the basic set of supported drivers in U-Boot which allows using such features as tftp and\or NFS.
I've posted this patch series as RFC because of the following commit:e51ca0d221 (HACK: drivers: mfd: set bar configuration for RP1 driver, 2024-05-21)
It includes HACK for rp1 driver in u-boot. This HACK is setting bar address in the correct order because RP1 driver in Linux Kernel rely on the pci BAR configuration which initializes BARs based on BAR size. This results the Linux set BARs in the same order on each boot. U-boot does initialization without any sorting so the configuration may be different from the Linux kernel.
BAR address configuration is set to match the Linux Kernel order to avoid fails on address translation.
This should be changed after upstreaming RP1 driver to the Linux kernel mainline.
Probably somebody from Raspberry will post an advise about how this can be properly done.
U-Boot support for Raspberry PI 5 was added in terms of the following
project: https://github.com/xen-troops/meta-xt-prod-devel-rpi5
This is xen-based dom0less system on the Raspberry PI 5 with Zephyr as Control Domain and Linux is Driver Domain.
It is Yocto-based so it will be easy to build it on your side. Please visit link for the details.
Oleksii Moisieiev (17):
include: dt-bindings: clk: introduce bindings for rp1 clock
include: dt-bindings: mfd: introduce bindings for RP1 driver
arch: arm: mach-bcm283x: add pcie memory region to BCM2712 memmap
arch: arm: mach-bcm283x: add BCM2712 board support
drivers: net: macb: do not include arch/clk.h when clocks enabled
drivers: core: of_addr: fix of_get_dma_range translation
board: raspberrypi: rpi: save board_type to the global_data
drivers: pci: add BCM2712 support for pcie_brcmstb driver
drivers: mfd: introduce RP1 chip driver for RPI5
drivers: gpio: add support of RP1 GPIO for Raspberry PI 5
drivers: reset: introduce reset drivers for brcmstb
drivers: clk: introduce clock driver for RP1
drivers: net: macb: introduce ePCI connection support for macb
configs: add support for the Raspberrypi 5 board to default config
HACK: drivers: mfd: set bar configuration for RP1 driver
drivers: pci: pcie_brcmstb: use bus_base to config PCI device
drivers: pci: pcie_brcmstb: set correct reset state on pcie_remove
Volodymyr Babchuk (3):
drivers: pci: take into account that ofnode_read_pci_vendev can fail
board: raspberrypi: rpi: request RP1 in late_init
bcm2712: enable linux kernel image header
arch/arm/mach-bcm283x/Kconfig | 8 + arch/arm/mach-bcm283x/init.c | 10 +- board/raspberrypi/rpi/rpi.c | 28 ++ configs/rpi_arm64_defconfig | 19 ++ drivers/clk/Kconfig | 7 + drivers/clk/Makefile | 1 + drivers/clk/clk-rp1.c | 280 ++++++++++++++++++++ drivers/core/of_addr.c | 8 +- drivers/gpio/Kconfig | 7 + drivers/gpio/Makefile | 1 + drivers/gpio/rp1_gpio.c | 374 +++++++++++++++++++++++++++ drivers/mfd/Kconfig | 10 + drivers/mfd/Makefile | 1 + drivers/mfd/rp1.c | 134 ++++++++++ drivers/net/Kconfig | 1 + drivers/net/macb.c | 156 ++++++++--- drivers/net/macb.h | 16 ++ drivers/pci/pci-uclass.c | 9 +- drivers/pci/pcie_brcmstb.c | 328 +++++++++++++++++++++-- drivers/reset/Kconfig | 14 + drivers/reset/Makefile | 2 + drivers/reset/reset-brcmstb-rescal.c | 103 ++++++++ drivers/reset/reset-brcmstb.c | 97 +++++++ include/broadcom/bcm_board_types.h | 25 ++ include/dt-bindings/clk/rp1.h | 56 ++++ include/dt-bindings/mfd/rp1.h | 239 +++++++++++++++++ include/pci_ids.h | 3 + 27 files changed, 1882 insertions(+), 55 deletions(-) create mode 100644 drivers/clk/clk-rp1.c create mode 100644 drivers/gpio/rp1_gpio.c create mode 100644 drivers/mfd/rp1.c create mode 100644 drivers/reset/reset-brcmstb-rescal.c create mode 100644 drivers/reset/reset-brcmstb.c create mode 100644 include/broadcom/bcm_board_types.h create mode 100644 include/dt-bindings/clk/rp1.h create mode 100644 include/dt-bindings/mfd/rp1.h
Signature · 1 line
2.34.1
RFC PATCH 1/20 include: dt-bindings: clk: introduce bindings for rp1 clock
Introducing device-tree bindings for the RP1 clocks.
---
include/dt-bindings/clk/rp1.h | 56 +++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 include/dt-bindings/clk/rp1.h
include/dt-bindings/clk/rp1.h new file +56 -0
@@ -0,0 +1,56 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2021 Raspberry Pi Ltd. +*/ + +#define RP1_PLL_SYS_CORE 0 +#define RP1_PLL_AUDIO_CORE 1 +#define RP1_PLL_VIDEO_CORE 2 + +#define RP1_PLL_SYS 3 +#define RP1_PLL_AUDIO 4 +#define RP1_PLL_VIDEO 5 + +#define RP1_PLL_SYS_PRI_PH 6 +#define RP1_PLL_SYS_SEC_PH 7 +#define RP1_PLL_AUDIO_PRI_PH 8 + +#define RP1_PLL_SYS_SEC 9 +#define RP1_PLL_AUDIO_SEC 10 +#define RP1_PLL_VIDEO_SEC 11 + +#define RP1_CLK_SYS 12 +#define RP1_CLK_SLOW_SYS 13 +#define RP1_CLK_DMA 14 +#define RP1_CLK_UART 15 +#define RP1_CLK_ETH 16 +#define RP1_CLK_PWM0 17 +#define RP1_CLK_PWM1 18 +#define RP1_CLK_AUDIO_IN 19 +#define RP1_CLK_AUDIO_OUT 20 +#define RP1_CLK_I2S 21 +#define RP1_CLK_MIPI0_CFG 22 +#define RP1_CLK_MIPI1_CFG 23 +#define RP1_CLK_PCIE_AUX 24 +#define RP1_CLK_USBH0_MICROFRAME 25 +#define RP1_CLK_USBH1_MICROFRAME 26 +#define RP1_CLK_USBH0_SUSPEND 27 +#define RP1_CLK_USBH1_SUSPEND 28 +#define RP1_CLK_ETH_TSU 29 +#define RP1_CLK_ADC 30 +#define RP1_CLK_SDIO_TIMER 31 +#define RP1_CLK_SDIO_ALT_SRC 32 +#define RP1_CLK_GP0 33 +#define RP1_CLK_GP1 34 +#define RP1_CLK_GP2 35 +#define RP1_CLK_GP3 36 +#define RP1_CLK_GP4 37 +#define RP1_CLK_GP5 38 +#define RP1_CLK_VEC 39 +#define RP1_CLK_DPI 40 +#define RP1_CLK_MIPI0_DPI 41 +#define RP1_CLK_MIPI1_DPI 42 + +/* Extra PLL output channels - RP1B0 only */ +#define RP1_PLL_VIDEO_PRI_PH 43 +#define RP1_PLL_AUDIO_TERN 44
Signature · 1 line
2.34.1
Re: [RFC PATCH v1 01/20] include: dt-bindings: clk: introduce bindings for rp1 clock
Quoted 9 lines · Oleksii Moisieiev
Introducing device-tree bindings for the RP1 clocks.
Signed-off-by Oleksii Moisieiev <[email protected]>Reviewed-by Volodymyr Babchuk <[email protected]>---
include/dt-bindings/clk/rp1.h | 56 +++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 include/dt-bindings/clk/rp1.h
Has upstream Pi sent these bindings upstream themselves, or are we stuck in a bad spot here? Thanks!
Signature · 1 line
Tom
Re: [RFC PATCH v1 01/20] include: dt-bindings: clk: introduce bindings for rp1 clock
Hi Tom,
As far as I know they did not. And I'm not sure they will.
That's why I've posted this as RFC.
Another problem is that RP1 driver in RPI kernel is still to be finished.
I was hoping that somebody from Raspberry will be interested in this patch series and share some plans.
--
Oleksii
Quoted 14 lines · Tom Rini
Quoted 9 lines · Oleksii Moisieiev
Introducing device-tree bindings for the RP1 clocks.
Signed-off-by Oleksii Moisieiev <[email protected]>Reviewed-by Volodymyr Babchuk <[email protected]>---
include/dt-bindings/clk/rp1.h | 56 +++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+)create mode 100644
include/dt-bindings/clk/rp1.hHas upstream Pi sent these bindings upstream themselves, or are we stuck in a bad spot here? Thanks!
RFC PATCH 2/20 include: dt-bindings: mfd: introduce bindings for RP1 driver
In reply to Oleksii MoisieievHeader includes all needed defines to be used in the device-tree bindings.
---
include/dt-bindings/mfd/rp1.h | 239 ++++++++++++++++++++++++++++++++++ 1 file changed, 239 insertions(+) create mode 100644 include/dt-bindings/mfd/rp1.h
include/dt-bindings/mfd/rp1.h new file +239 -0
@@ -0,0 +1,239 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* This header provides constants for the PY MFD. +* +* Copyright (c) 2024 EPAM Systems +* +* Derived from linux rp1.h. +*/ + +#ifndef _RP1_H +#define _RP1_H + +/* Address map */ +#define RP1_SYSINFO_BASE 0x000000 +#define RP1_TBMAN_BASE 0x004000 +#define RP1_SYSCFG_BASE 0x008000 +#define RP1_OTP_BASE 0x00c000 +#define RP1_POWER_BASE 0x010000 +#define RP1_RESETS_BASE 0x014000 +#define RP1_CLOCKS_BANK_DEFAULT_BASE 0x018000 +#define RP1_CLOCKS_BANK_VIDEO_BASE 0x01c000 +#define RP1_PLL_SYS_BASE 0x020000 +#define RP1_PLL_AUDIO_BASE 0x024000 +#define RP1_PLL_VIDEO_BASE 0x028000 +#define RP1_UART0_BASE 0x030000 +#define RP1_UART1_BASE 0x034000 +#define RP1_UART2_BASE 0x038000 +#define RP1_UART3_BASE 0x03c000 +#define RP1_UART4_BASE 0x040000 +#define RP1_UART5_BASE 0x044000 +#define RP1_SPI8_BASE 0x04c000 +#define RP1_SPI0_BASE 0x050000 +#define RP1_SPI1_BASE 0x054000 +#define RP1_SPI2_BASE 0x058000 +#define RP1_SPI3_BASE 0x05c000 +#define RP1_SPI4_BASE 0x060000 +#define RP1_SPI5_BASE 0x064000 +#define RP1_SPI6_BASE 0x068000 +#define RP1_SPI7_BASE 0x06c000 +#define RP1_I2C0_BASE 0x070000 +#define RP1_I2C1_BASE 0x074000 +#define RP1_I2C2_BASE 0x078000 +#define RP1_I2C3_BASE 0x07c000 +#define RP1_I2C4_BASE 0x080000 +#define RP1_I2C5_BASE 0x084000 +#define RP1_I2C6_BASE 0x088000 +#define RP1_AUDIO_IN_BASE 0x090000 +#define RP1_AUDIO_OUT_BASE 0x094000 +#define RP1_PWM0_BASE 0x098000 +#define RP1_PWM1_BASE 0x09c000 +#define RP1_I2S0_BASE 0x0a0000 +#define RP1_I2S1_BASE 0x0a4000 +#define RP1_I2S2_BASE 0x0a8000 +#define RP1_TIMER_BASE 0x0ac000 +#define RP1_SDIO0_APBS_BASE 0x0b0000 +#define RP1_SDIO1_APBS_BASE 0x0b4000 +#define RP1_BUSFABRIC_MONITOR_BASE 0x0c0000 +#define RP1_BUSFABRIC_AXISHIM_BASE 0x0c4000 +#define RP1_ADC_BASE 0x0c8000 +#define RP1_IO_BANK0_BASE 0x0d0000 +#define RP1_IO_BANK1_BASE 0x0d4000 +#define RP1_IO_BANK2_BASE 0x0d8000 +#define RP1_SYS_RIO0_BASE 0x0e0000 +#define RP1_SYS_RIO1_BASE 0x0e4000 +#define RP1_SYS_RIO2_BASE 0x0e8000 +#define RP1_PADS_BANK0_BASE 0x0f0000 +#define RP1_PADS_BANK1_BASE 0x0f4000 +#define RP1_PADS_BANK2_BASE 0x0f8000 +#define RP1_PADS_ETH_BASE 0x0fc000 +#define RP1_ETH_IP_BASE 0x100000 +#define RP1_ETH_CFG_BASE 0x104000 +#define RP1_PCIE_APBS_BASE 0x108000 +#define RP1_MIPI0_CSIDMA_BASE 0x110000 +#define RP1_MIPI0_CSIHOST_BASE 0x114000 +#define RP1_MIPI0_DSIDMA_BASE 0x118000 +#define RP1_MIPI0_DSIHOST_BASE 0x11c000 +#define RP1_MIPI0_MIPICFG_BASE 0x120000 +#define RP1_MIPI0_ISP_BASE 0x124000 +#define RP1_MIPI1_CSIDMA_BASE 0x128000 +#define RP1_MIPI1_CSIHOST_BASE 0x12c000 +#define RP1_MIPI1_DSIDMA_BASE 0x130000 +#define RP1_MIPI1_DSIHOST_BASE 0x134000 +#define RP1_MIPI1_MIPICFG_BASE 0x138000 +#define RP1_MIPI1_ISP_BASE 0x13c000 +#define RP1_VIDEO_OUT_CFG_BASE 0x140000 +#define RP1_VIDEO_OUT_VEC_BASE 0x144000 +#define RP1_VIDEO_OUT_DPI_BASE 0x148000 +#define RP1_XOSC_BASE 0x150000 +#define RP1_WATCHDOG_BASE 0x154000 +#define RP1_DMA_TICK_BASE 0x158000 +#define RP1_SDIO_CLOCKS_BASE 0x15c000 +#define RP1_USBHOST0_APBS_BASE 0x160000 +#define RP1_USBHOST1_APBS_BASE 0x164000 +#define RP1_ROSC0_BASE 0x168000 +#define RP1_ROSC1_BASE 0x16c000 +#define RP1_VBUSCTRL_BASE 0x170000 +#define RP1_TICKS_BASE 0x174000 +#define RP1_PIO_APBS_BASE 0x178000 +#define RP1_SDIO0_AHBLS_BASE 0x180000 +#define RP1_SDIO1_AHBLS_BASE 0x184000 +#define RP1_DMA_BASE 0x188000 +#define RP1_RAM_BASE 0x1c0000 +#define RP1_RAM_SIZE 0x020000 +#define RP1_USBHOST0_AXIS_BASE 0x200000 +#define RP1_USBHOST1_AXIS_BASE 0x300000 +#define RP1_EXAC_BASE 0x400000 + +/* Interrupts */ + +#define RP1_INT_IO_BANK0 0 +#define RP1_INT_IO_BANK1 1 +#define RP1_INT_IO_BANK2 2 +#define RP1_INT_AUDIO_IN 3 +#define RP1_INT_AUDIO_OUT 4 +#define RP1_INT_PWM0 5 +#define RP1_INT_ETH 6 +#define RP1_INT_I2C0 7 +#define RP1_INT_I2C1 8 +#define RP1_INT_I2C2 9 +#define RP1_INT_I2C3 10 +#define RP1_INT_I2C4 11 +#define RP1_INT_I2C5 12 +#define RP1_INT_I2C6 13 +#define RP1_INT_I2S0 14 +#define RP1_INT_I2S1 15 +#define RP1_INT_I2S2 16 +#define RP1_INT_SDIO0 17 +#define RP1_INT_SDIO1 18 +#define RP1_INT_SPI0 19 +#define RP1_INT_SPI1 20 +#define RP1_INT_SPI2 21 +#define RP1_INT_SPI3 22 +#define RP1_INT_SPI4 23 +#define RP1_INT_SPI5 24 +#define RP1_INT_UART0 25 +#define RP1_INT_TIMER_0 26 +#define RP1_INT_TIMER_1 27 +#define RP1_INT_TIMER_2 28 +#define RP1_INT_TIMER_3 29 +#define RP1_INT_USBHOST0 30 +#define RP1_INT_USBHOST0_0 31 +#define RP1_INT_USBHOST0_1 32 +#define RP1_INT_USBHOST0_2 33 +#define RP1_INT_USBHOST0_3 34 +#define RP1_INT_USBHOST1 35 +#define RP1_INT_USBHOST1_0 36 +#define RP1_INT_USBHOST1_1 37 +#define RP1_INT_USBHOST1_2 38 +#define RP1_INT_USBHOST1_3 39 +#define RP1_INT_DMA 40 +#define RP1_INT_PWM1 41 +#define RP1_INT_UART1 42 +#define RP1_INT_UART2 43 +#define RP1_INT_UART3 44 +#define RP1_INT_UART4 45 +#define RP1_INT_UART5 46 +#define RP1_INT_MIPI0 47 +#define RP1_INT_MIPI1 48 +#define RP1_INT_VIDEO_OUT 49 +#define RP1_INT_PIO_0 50 +#define RP1_INT_PIO_1 51 +#define RP1_INT_ADC_FIFO 52 +#define RP1_INT_PCIE_OUT 53 +#define RP1_INT_SPI6 54 +#define RP1_INT_SPI7 55 +#define RP1_INT_SPI8 56 +#define RP1_INT_SYSCFG 58 +#define RP1_INT_CLOCKS_DEFAULT 59 +#define RP1_INT_VBUSCTRL 60 +#define RP1_INT_PROC_MISC 57 +#define RP1_INT_END 61 + +/* DMA peripherals (for pacing) */ +#define RP1_DMA_I2C0_RX 0x0 +#define RP1_DMA_I2C0_TX 0x1 +#define RP1_DMA_I2C1_RX 0x2 +#define RP1_DMA_I2C1_TX 0x3 +#define RP1_DMA_I2C2_RX 0x4 +#define RP1_DMA_I2C2_TX 0x5 +#define RP1_DMA_I2C3_RX 0x6 +#define RP1_DMA_I2C3_TX 0x7 +#define RP1_DMA_I2C4_RX 0x8 +#define RP1_DMA_I2C4_TX 0x9 +#define RP1_DMA_I2C5_RX 0xa +#define RP1_DMA_I2C5_TX 0xb +#define RP1_DMA_SPI0_RX 0xc +#define RP1_DMA_SPI0_TX 0xd +#define RP1_DMA_SPI1_RX 0xe +#define RP1_DMA_SPI1_TX 0xf +#define RP1_DMA_SPI2_RX 0x10 +#define RP1_DMA_SPI2_TX 0x11 +#define RP1_DMA_SPI3_RX 0x12 +#define RP1_DMA_SPI3_TX 0x13 +#define RP1_DMA_SPI4_RX 0x14 +#define RP1_DMA_SPI4_TX 0x15 +#define RP1_DMA_SPI5_RX 0x16 +#define RP1_DMA_SPI5_TX 0x17 +#define RP1_DMA_PWM0 0x18 +#define RP1_DMA_UART0_RX 0x19 +#define RP1_DMA_UART0_TX 0x1a +#define RP1_DMA_AUDIO_IN_CH0 0x1b +#define RP1_DMA_AUDIO_IN_CH1 0x1c +#define RP1_DMA_AUDIO_OUT 0x1d +#define RP1_DMA_PWM1 0x1e +#define RP1_DMA_I2S0_RX 0x1f +#define RP1_DMA_I2S0_TX 0x20 +#define RP1_DMA_I2S1_RX 0x21 +#define RP1_DMA_I2S1_TX 0x22 +#define RP1_DMA_I2S2_RX 0x23 +#define RP1_DMA_I2S2_TX 0x24 +#define RP1_DMA_UART1_RX 0x25 +#define RP1_DMA_UART1_TX 0x26 +#define RP1_DMA_UART2_RX 0x27 +#define RP1_DMA_UART2_TX 0x28 +#define RP1_DMA_UART3_RX 0x29 +#define RP1_DMA_UART3_TX 0x2a +#define RP1_DMA_UART4_RX 0x2b +#define RP1_DMA_UART4_TX 0x2c +#define RP1_DMA_UART5_RX 0x2d +#define RP1_DMA_UART5_TX 0x2e +#define RP1_DMA_ADC 0x2f +#define RP1_DMA_DMA_TICK_TICK0 0x30 +#define RP1_DMA_DMA_TICK_TICK1 0x31 +#define RP1_DMA_SPI6_RX 0x32 +#define RP1_DMA_SPI6_TX 0x33 +#define RP1_DMA_SPI7_RX 0x34 +#define RP1_DMA_SPI7_TX 0x35 +#define RP1_DMA_SPI8_RX 0x36 +#define RP1_DMA_SPI8_TX 0x37 +#define RP1_DMA_PIO_CH0_TX 0x38 +#define RP1_DMA_PIO_CH0_RX 0x39 +#define RP1_DMA_PIO_CH1_TX 0x3a +#define RP1_DMA_PIO_CH1_RX 0x3b +#define RP1_DMA_PIO_CH2_TX 0x3c +#define RP1_DMA_PIO_CH2_RX 0x3d +#define RP1_DMA_PIO_CH3_TX 0x3e +#define RP1_DMA_PIO_CH3_RX 0x3f + +#endif
Signature · 1 line
2.34.1
RFC PATCH 3/20 arch: arm: mach-bcm283x: add pcie memory region to BCM2712 memmap
In reply to Oleksii MoisieievUpdate initial memory map for the BCM2712 board. Add PCIe memory regions.
---
arch/arm/mach-bcm283x/init.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
arch/arm/mach-bcm283x/init.c +9 -1
@@ -19,7 +19,7 @@ #ifdef CONFIG_ARM64 #include <asm/armv8/mmu.h> -#define MEM_MAP_MAX_ENTRIES (4) +#define MEM_MAP_MAX_ENTRIES (5) static struct mm_region bcm283x_mem_map[MEM_MAP_MAX_ENTRIES] = { {
@@ -84,6 +84,14 @@ static struct mm_region bcm2712_mem_map[MEM_MAP_MAX_ENTRIES] = { .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | PTE_BLOCK_NON_SHARE | PTE_BLOCK_PXN | PTE_BLOCK_UXN + }, { +/* Beginning of PCIe section */ + .virt = 0x1f00000000UL, + .phys = 0x1f00000000UL, + .size = 0x0002000000UL, + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | + PTE_BLOCK_NON_SHARE | + PTE_BLOCK_PXN | PTE_BLOCK_UXN }, {/* SoC bus */ .virt = 0x107c000000UL,
Signature · 1 line
2.34.1
RFC PATCH 4/20 arch: arm: mach-bcm283x: add BCM2712 board support
In reply to Oleksii MoisieievAdd BCM2712 board support to U-Boot.
---
arch/arm/mach-bcm283x/Kconfig | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/mach-bcm283x/Kconfig +4 -0
@@ -44,6 +44,10 @@ config BCM2711_64B select BCM2711 select ARM64 +config BCM2712 + bool "Broadcom BCM2712 SoC support" + depends on ARCH_BCM283X + menu "Broadcom BCM283X family" depends on ARCH_BCM283X
Signature · 1 line
2.34.1
RFC PATCH 5/20 drivers: net: macb: do not include arch/clk.h when clocks enabled
In reply to Oleksii MoisieievDuring initialization MACB should request clock rates to work properly. If CONFIG_CLK is not set then it uses special arch call
named: 'get_macb_pclk_rate'
This function is arch specific and should return fixed rate for macb clock even if clock subsystem was disabled.
When CONFIG_CLK is enabled there is no need to include arch specific code and no need to declare 'get_macb_pclk_rate' call. Added conditional to include arch/clk.h only if clock subsystem is disabled.
---
drivers/net/macb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/macb.c +2 -0
@@ -39,7 +39,9 @@#include <linux/mii.h> #include <asm/io.h> #include <linux/dma-mapping.h> +#if !defined(CONFIG_CLK )#include <asm/arch/clk.h> +#endif #include <linux/errno.h> #include "macb.h"
Signature · 1 line
2.34.1
RFC PATCH 6/20 drivers: pci: take into account that ofnode_read_pci_vendev can fail
In reply to Oleksii MoisieievFrom: Volodymyr Babchuk <[email protected]>
Prior to this fix devfn was set to 0, which lead to funny consequences because PCI subsystem tried to use RP1 driver as a host bridge driver.
---
drivers/pci/pci-uclass.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/pci/pci-uclass.c +8 -1
@@ -1187,6 +1187,7 @@ static int pci_uclass_post_probe(struct udevice *bus)static int pci_uclass_child_post_bind (struct udevice *dev) {struct pci_child_plat *pplat; +int err;if (!dev_has_ofnode (dev))return 0 ;
@@ -1194,7 +1195,13 @@ static int pci_uclass_child_post_bind(struct udevice *dev) pplat =dev_get_parent_plat (dev);/* Extract vendor id and device id if available */ -ofnode_read_pci_vendev (dev_ofnode (dev), &pplat->vendor, &pplat->device); + err =ofnode_read_pci_vendev (dev_ofnode (dev), &pplat->vendor, + &pplat->device); +if (err) { +/* Set invalid devfn if OF node describes not a PCI device */ + pplat->devfn =-1 ; +return 0 ; + }/* Extract the devfn from fdt_pci_addr */ pplat->devfn =pci_get_devfn (dev);
Signature · 1 line
2.34.1
RFC PATCH 7/20 drivers: core: of_addr: fix of_get_dma_range translation
In reply to Oleksii MoisieievAccording to the Section 2.3.9 of the Device Tree specification [0] the format of the value of the dma-ranges property is an arbitrary number of triplets of (child-bus-address, parent-bus-address, length).
Where:
* The child-bus-address is a physical address within the child bus’ address space. The number of cells to represent the address depends on the bus and can be determined from the #address-cells of this node (the node in which the dma-ranges property appears).
* The parent-bus-address is a physical address within the parent bus’ address space. The number of cells to represent the parent address is bus dependent and can be determined from the #address-cells property of the node that defines the parent’s address space.
* The length specifies the size of the range in the child’s address space. The number of cells to represent the size can be determined from the #size-cells of this node (the node in which the dma-ranges property appears)
This description matches comments in the of_addr source code. But actual implementation do not match the specification. 'of_match_bus' call returns address-cells and size-cells of the parent device. That's why the following calls were used to receive addr_cells and size_cells of the current device:
- of_simple_addr_cells
- of_simple_size_cells
This fix was tested on RPI5 board with both device types: directly connected (e.g Serial) and connected over PCIe (e.g ethernet).
For example when dma_ranges are parsing the following device tree structure:
/ {
pcie2: {
#address-cells = <3>;
#size-cells = <2>;
// 64GB system RAM space at PCIe 10_00000000
dma-ranges =
<0x02000000 0x00 0x00000000
0x1f 0x00000000
0x00 0x00400000>,
<0x43000000 0x10 0x00000000
0x00 0x00000000
0x10 0x00000000>;
rp1: {
#address-cells = <2>;
#size-cells = <2>;
dma-ranges =
// inbound RP1 1x_xxxxxxxx -> PCIe 1x_xxxxxxxx
<0x10 0x00000000
0x43000000 0x10 0x00000000
0x10 0x00000000>,
// inbound RP1 c0_40xxxxxx -> PCIe 00_00xxxxxx
<0xc0 0x40000000
0x02000000 0x0 0x00000000
0x0 0x00400000>,
// inbound RP1 0x_xxxxxxxx -> PCIe 1x_xxxxxxxx
<0x00 0x00000000
0x02000000 0x10 0x00000000
0x10 0x00000000>;
};
};
};So when we parse ranges on rp1 - #address-cells of the rp1 node should be taken into account.
In the provided example we have the following format:
pcie2:
#addres-cells = <0x3>;
#size-cells = <0x2>;
dma-ranges = < addr_hi addr_mid addr_lo
trans_addr_hi trans_addr_lo size_hi size_lo>;
rp1:
#addres-cells = <0x2>;
#size-cells = <0x2>;
dma-ranges = < addr_hi addr_lo
trans_addr_hi trans_addr_mid trans_addr_lo size_hi size_lo>;
of_get_dma_range searches for the first dev with dma_ranges and then executes of_match_bus which follows by count_cells call for both device and parent.
count_cells callback returns #address-cells for the parent device to the caller.
So in the provided example address cells should be returned 2 for rp1, but we get 3 when using count_cells callback.
This breaks address translation and was fixed in the provided patch by using of_simple_addr_cells call. Which will return correct address-cells for the node. This matches the requirements of the device-tree specification.
[0] https://readthedocs.org/projects/devicetree-specification/downloads/pdf/latest/
---
drivers/core/of_addr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/core/of_addr.c +4 -4
@@ -374,16 +374,16 @@ int of_get_dma_range(const struct device_node *dev, phys_addr_t *cpu, }/* Get the address sizes both for the bus and its parent */ - bus_node =of_match_bus ((struct device_node *)dev); - bus_node->count_cells (dev, &na, &ns); + na =of_simple_addr_cells (dev); + ns =of_simple_size_cells (dev);if (!OF_CHECK_COUNTS (na, ns)) {printf ("Bad cell count for %s\n" ,of_node_full_name (dev)); ret = -EINVAL ; goto out_parent; } - bus_node =of_match_bus (parent); - bus_node->count_cells (parent, &pna, &pns); + bus_node =of_match_bus ((struct device_node *)dev); + bus_node->count_cells (dev, &pna, &pns);if (!OF_CHECK_COUNTS (pna, pns)) {printf ("Bad cell count for %s\n" ,of_node_full_name (parent)); ret = -EINVAL ;
Signature · 1 line
2.34.1
RFC PATCH 8/20 board: raspberrypi: rpi: save board_type to the global_data
In reply to Oleksii MoisieievSave board_type retrieved from the BCM board firmware to the global data. This information can be accessed by using gd_board_type() call to determine the type of currently used board.
---
board/raspberrypi/rpi/rpi.c | 5 +++++ include/broadcom/bcm_board_types.h | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 include/broadcom/bcm_board_types.h
board/raspberrypi/rpi/rpi.c +5 -0
@@ -19,6 +19,8 @@#include <asm/arch/sdhci.h> #include <asm/global_data.h> #include <dm/platform_data/serial_bcm283x_mu.h> +#include <broadcom/bcm_board_types.h> +#ifdef CONFIG_ARM64 #include <asm/armv8/mmu.h> #endif
@@ -489,6 +491,9 @@ static void get_board_revision(void) model = &models[rev_type]; } +if (IS_ENABLED (CONFIG_BOARD_TYPES )) + gd->board_type = rev_type; +printf ("RPI %s (0x%x)\n" , model->name, revision); }
include/broadcom/bcm_board_types.h new file +25 -0
@@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* This header defines BCM board types. +* +* Copyright (c) 2024 EPAM Systems +* +*/ +#ifndef _BCM_BOARD_TYPES_H_ +#define _BCM_BOARD_TYPES_H_ + +/* +* TODO: This enumerator defines the main BCM types. +* These types are defined by the BCM firmware and requested +* via mbox. Currently only one board type was added. +* This is needed to determine whether current board is bcm2712 +* or other to control the behaviour of the following drivers: +* macb and pcie_brcmstb. New board enumerators can be added here +* if needed. +* See https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#raspberry-pi-revision-codes +*/ +typedef enum { +BCM2712_RPI_5_B_NEW =0x17 , +}bcm_board_type_t ; + +#endif /* _BCM_BOARD_TYPES_H_ */
Signature · 1 line
2.34.1
RFC PATCH 9/20 drivers: pci: add BCM2712 support for pcie_brcmstb driver
In reply to Oleksii MoisieievIntroducing pcie support for BCM2712 on example of the RPI5 board. This driver initializes PCIe driver on start and provides access to the peripheral, connected to PCIe.
---
drivers/pci/pcie_brcmstb.c | 314 ++++++++++++++++++++++++++++++++++--- 1 file changed, 296 insertions(+), 18 deletions(-)
drivers/pci/pcie_brcmstb.c +296 -18
@@ -21,6 +21,7 @@#include <linux/bitfield.h> #include <linux/log2.h> #include <linux/iopoll.h> +#include <reset.h> /* Offset of the mandatory PCIe capability config registers */ #define BRCM_PCIE_CAP_REGS 0x00ac
@@ -45,6 +46,7 @@#define MISC_CTRL_CFG_READ_UR_MODE_MASK 0x2000#define MISC_CTRL_MAX_BURST_SIZE_MASK 0x300000#define MISC_CTRL_MAX_BURST_SIZE_128 0x0 +#define MISC_CTRL_MAX_BURST_SIZE_128_2712 0x100000#define MISC_CTRL_SCB0_SIZE_MASK 0xf8000000#define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LO 0x400c
@@ -65,6 +67,9 @@#define PCIE_MISC_RC_BAR3_CONFIG_LO 0x403c#define RC_BAR3_CONFIG_LO_SIZE_MASK 0x1f +#define PCIE_MISC_PCIE_CTRL 0x4064 +#define PCIE_MISC_PCIE_CTRL_PCIE_PERSTB_MASK 0x4 +#define PCIE_MISC_PCIE_STATUS 0x4068#define STATUS_PCIE_PORT_MASK 0x80#define STATUS_PCIE_PORT_SHIFT 7
@@ -90,18 +95,23 @@#define PCIE_MEM_WIN0_LIMIT_HI (win) \ PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LIMIT_HI + ((win) * 8) -#define PCIE_MISC_HARD_PCIE_HARD_DEBUG 0x4204 +#define PCIE_MISC_HARD_PCIE_HARD_DEBUG (pcie) \ + ((pcie)->pcie_cfg->offsets[PCIE_HARD_DEBUG])#define PCIE_HARD_DEBUG_SERDES_IDDQ_MASK 0x08000000#define PCIE_MSI_INTR2_CLR 0x4508#define PCIE_MSI_INTR2_MASK_SET 0x4510 -#define PCIE_EXT_CFG_DATA 0x8000 +#define PCIE_EXT_CFG_DATA (pcie) \ + ((pcie)->pcie_cfg->offsets[EXT_CFG_DATA]) -#define PCIE_EXT_CFG_INDEX 0x9000 +#define PCIE_EXT_CFG_INDEX (pcie) \ + ((pcie)->pcie_cfg->offsets[EXT_CFG_INDEX]) -#define PCIE_RGR1_SW_INIT_1 0x9210 +#define PCIE_RGR1_SW_INIT_1 (pcie) \ + ((pcie)->pcie_cfg->offsets[RGR1_SW_INIT_1])#define RGR1_SW_INIT_1_PERST_MASK 0x1 +#define RGR1_SW_INIT_1_PERSTB_MASK 0x4#define RGR1_SW_INIT_1_INIT_MASK 0x2/* PCIe parameters */
@@ -131,6 +141,52 @@#define SSC_STATUS_PLL_LOCK_MASK 0x800#define SSC_STATUS_PLL_LOCK_SHIFT 11 +#define PCIE_RC_PL_PHY_CTL_15 0x184c +#define PCIE_RC_PL_PHY_CTL_15_DIS_PLL_PD_MASK 0x400000 +#define PCIE_RC_PL_PHY_CTL_15_PM_CLK_PERIOD_MASK 0xff + +#define PCIE_MISC_UBUS_CTRL 0x40a4 +#define PCIE_MISC_UBUS_CTRL_UBUS_PCIE_REPLY_ERR_DIS_MASK BIT(13) +#define PCIE_MISC_UBUS_CTRL_UBUS_PCIE_REPLY_DECERR_DIS_MASK BIT(19) +#define PCIE_MISC_AXI_READ_ERROR_DATA 0x4170 +#define PCIE_MISC_UBUS_TIMEOUT 0x40A8 +#define PCIE_MISC_RC_CONFIG_RETRY_TIMEOUT 0x405c +#define PCIE_MISC_RC_BAR4_CONFIG_LO 0x40d4 +#define PCIE_MISC_RC_BAR4_CONFIG_HI 0x40d8 +#define PCIE_MISC_UBUS_BAR_CONFIG_REMAP_HI_MASK 0xff +#define PCIE_MISC_UBUS_BAR4_CONFIG_REMAP_HI 0x4110 +#define PCIE_MISC_UBUS_BAR_CONFIG_REMAP_ENABLE 0x1 +#define PCIE_MISC_UBUS_BAR_CONFIG_REMAP_LO_MASK 0xfffff000 +#define PCIE_MISC_UBUS_BAR4_CONFIG_REMAP_LO 0x410c + +#define PCIE_MISC_UBUS_BAR2_CONFIG_REMAP 0x40b4 +#define PCIE_MISC_UBUS_BAR2_CONFIG_REMAP_ACCESS_ENABLE_MASK BIT(0) +#define MISC_CTRL_PCIE_RCB_MPS_MODE_MASK 0x400 + +#define PCIE_LINK_STATE_L1 BIT(1) + +enum { +RGR1_SW_INIT_1 , +EXT_CFG_INDEX , +EXT_CFG_DATA , +PCIE_HARD_DEBUG , +}; + +enum brcm_pcie_type { +BCM2711 , +BCM2712 +}; + +struct brcm_pcie ; + +struct brcm_pcie_cfg_data { +const int *offsets; +const enum brcm_pcie_type type; +void (*perst_set)(struct brcm_pcie *pcie,u32 val); +void (*bridge_sw_init_set)(struct brcm_pcie *pcie,u32 val); +bool (*rc_mode)(struct brcm_pcie *pcie); +}; +/** * struct brcm_pcie - the PCIe controller state * @base: Base address of memory mapped IO registers of the controller
@@ -143,6 +199,9 @@ struct brcm_pcie {int gen;bool ssc; +struct reset_ctl rescal; +struct reset_ctl bridge_reset; +const struct brcm_pcie_cfg_data *pcie_cfg; };/**
@@ -186,6 +245,44 @@ static bool brcm_pcie_rc_mode(struct brcm_pcie *pcie)return (val &STATUS_PCIE_PORT_MASK ) >>STATUS_PCIE_PORT_SHIFT ; } +static void brcm_pcie_perst_set_generic (struct brcm_pcie *pcie,u32 val) +{ +if (val) +setbits_le32 (pcie->base +PCIE_RGR1_SW_INIT_1 (pcie), +RGR1_SW_INIT_1_PERST_MASK ); +else +clrbits_le32 (pcie->base +PCIE_RGR1_SW_INIT_1 (pcie), +RGR1_SW_INIT_1_PERST_MASK ); +} + +static void brcm_pcie_perst_set_2712 (struct brcm_pcie *pcie,u32 val) +{ +u32 tmp; + +/* Perst bit has moved and assert value is 0 */ + tmp =readl (pcie->base +PCIE_MISC_PCIE_CTRL ); +u32p_replace_bits (&tmp, !val,RGR1_SW_INIT_1_PERSTB_MASK ); +writel (tmp, pcie->base +PCIE_MISC_PCIE_CTRL ); +} + +static void brcm_pcie_bridge_sw_init_set_generic (struct brcm_pcie *pcie,u32 val) +{ +if (val) +setbits_le32 (pcie->base +PCIE_RGR1_SW_INIT_1 (pcie), +RGR1_SW_INIT_1_INIT_MASK ); +else +clrbits_le32 (pcie->base +PCIE_RGR1_SW_INIT_1 (pcie), +RGR1_SW_INIT_1_INIT_MASK ); +} + +static void brcm_pcie_bridge_sw_init_set_2712 (struct brcm_pcie *pcie,u32 val) +{ +if (val) +reset_assert (&pcie->bridge_reset); +else +reset_deassert (&pcie->bridge_reset); +} +/** * brcm_pcie_link_up() - Check whether the PCIe link is up * @pcie: Pointer to the PCIe controller state
@@ -232,8 +329,8 @@ static int brcm_pcie_config_address(const struct udevice *dev, pci_dev_t bdf,/* For devices, write to the config space index register */ idx =PCIE_ECAM_OFFSET (pci_bus, pci_dev, pci_func,0 ); -writel (idx, pcie->base +PCIE_EXT_CFG_INDEX ); - *paddress = pcie->base +PCIE_EXT_CFG_DATA + offset; +writel (idx, pcie->base +PCIE_EXT_CFG_INDEX (pcie)); + *paddress = pcie->base +PCIE_EXT_CFG_DATA (pcie) + offset;return 0 ; }
@@ -427,6 +524,98 @@ static void brcm_pcie_set_outbound_win(struct brcm_pcie *pcie,writel (tmp, base +PCIE_MEM_WIN0_LIMIT_HI (win)); } +static void brcm_pcie_get_resets_dt (struct udevice *dev) +{ +struct brcm_pcie *pcie =dev_get_priv (dev); +int ret; + + ret =reset_get_by_name (dev,"rescal" , &pcie->rescal); +if (ret) { +printf ("Unable to get rescal reset\n" ); +return ; + } + + ret =reset_get_by_name (dev,"bridge" , &pcie->bridge_reset); +if (ret) { +printf ("Unable to get bridge reset\n" ); +return ; + } +} + +static void brcm_pcie_do_reset (struct udevice *dev) +{ +struct brcm_pcie *pcie =dev_get_priv (dev); +int ret; + + ret =reset_deassert (&pcie->rescal); +if (ret) +printf ("failed to deassert 'rescal'\n" ); +} + +static void brcm_pcie_munge_pll (struct brcm_pcie *pcie) +{ +u32 tmp; +int ret, i; +u8 regs[] = {0x16 ,0x17 ,0x18 ,0x19 ,0x1b ,0x1c ,0x1e }; +u16 data[] = {0x50b9 ,0xbda1 ,0x0094 ,0x97b4 ,0x5030 ,0x5030 ,0x0007 }; + + ret =brcm_pcie_mdio_write (pcie->base,MDIO_PORT0 ,SET_ADDR_OFFSET , +0x1600 ); +for (i =0 ; i <ARRAY_SIZE (regs); i++) { +brcm_pcie_mdio_read (pcie->base,MDIO_PORT0 , regs[i], &tmp); +debug ("PCIE MDIO pre_refclk 0x%02x = 0x%04x\n" , + regs[i], tmp); + } +for (i =0 ; i <ARRAY_SIZE (regs); i++) { +brcm_pcie_mdio_write (pcie->base,MDIO_PORT0 , regs[i], data[i]); +brcm_pcie_mdio_read (pcie->base,MDIO_PORT0 , regs[i], &tmp); +debug ("PCIE MDIO post_refclk 0x%02x = 0x%04x\n" , + regs[i], tmp); + } + +udelay (200 ); +} + +static void brcm_pcie_window_prog (struct udevice *dev) +{ +struct brcm_pcie *pcie =dev_get_priv (dev); +void __iomem *base = pcie->base; +int i, ret; +u32 tmp; + +if (pcie->pcie_cfg->type !=BCM2712 ) +return ; + +/* program additional inbound windows (RC_BAR4..RC_BAR10) */ +for (i =0 ; i <7 ; i++) { +u64 bar_cpu, bar_size, bar_pci; +struct pci_region region; + + ret =pci_get_dma_regions (dev, ®ion, i +1 ); +if (ret) +break ; + + bar_pci = region.bus_start; + bar_cpu = region.phys_start; + bar_size = region.size; + tmp =lower_32_bits (bar_pci); +u32p_replace_bits (&tmp,brcm_pcie_encode_ibar_size (bar_size), +RC_BAR2_CONFIG_LO_SIZE_MASK ); +writel (tmp, base +PCIE_MISC_RC_BAR4_CONFIG_LO + i *8 ); +writel (upper_32_bits (bar_pci), + base +PCIE_MISC_RC_BAR4_CONFIG_HI + i *8 ); + + tmp =upper_32_bits (bar_cpu) & +PCIE_MISC_UBUS_BAR_CONFIG_REMAP_HI_MASK ; +writel (tmp, + base +PCIE_MISC_UBUS_BAR4_CONFIG_REMAP_HI + i *8 ); + tmp =lower_32_bits (bar_cpu) & +PCIE_MISC_UBUS_BAR_CONFIG_REMAP_LO_MASK ; +writel (tmp |PCIE_MISC_UBUS_BAR_CONFIG_REMAP_ENABLE , + base +PCIE_MISC_UBUS_BAR4_CONFIG_REMAP_LO + i *8 ); + } +} +static int brcm_pcie_probe (struct udevice *dev) {struct udevice *ctlr =pci_get_controller (dev);
@@ -442,13 +631,21 @@ static int brcm_pcie_probe(struct udevice *dev)u16 nlw, cls, lnksta;u32 tmp; +/* +* Deassert rescal reset for BCM2712. +*/ +if (pcie->pcie_cfg->type ==BCM2712 ) +brcm_pcie_do_reset (dev); +/* * Reset the bridge, assert the fundamental reset. Note for some SoCs, * e.g. BCM7278, the fundamental reset should not be asserted here. * This will need to be changed when support for other SoCs is added. */ -setbits_le32 (base +PCIE_RGR1_SW_INIT_1 , -RGR1_SW_INIT_1_INIT_MASK |RGR1_SW_INIT_1_PERST_MASK ); + pcie->pcie_cfg->bridge_sw_init_set (pcie,1 ); +if (pcie->pcie_cfg->type !=BCM2712 ) + pcie->pcie_cfg->perst_set (pcie,1 ); +/* * The delay is a safety precaution to preclude the reset signal * from looking like a glitch.
@@ -456,20 +653,35 @@ static int brcm_pcie_probe(struct udevice *dev)udelay (100 );/* Take the bridge out of reset */ -clrbits_le32 (base +PCIE_RGR1_SW_INIT_1 ,RGR1_SW_INIT_1_INIT_MASK ); + pcie->pcie_cfg->bridge_sw_init_set (pcie,0 ); -clrbits_le32 (base +PCIE_MISC_HARD_PCIE_HARD_DEBUG , +clrbits_le32 (base +PCIE_MISC_HARD_PCIE_HARD_DEBUG (pcie),PCIE_HARD_DEBUG_SERDES_IDDQ_MASK );/* Wait for SerDes to be stable */ udelay (100 ); +if (pcie->pcie_cfg->type ==BCM2712 ) { +/* Allow a 54MHz (xosc) refclk source */ +brcm_pcie_munge_pll (pcie); +/* Fix for L1SS errata */ + tmp =readl (base +PCIE_RC_PL_PHY_CTL_15 ); + tmp &= ~PCIE_RC_PL_PHY_CTL_15_PM_CLK_PERIOD_MASK ; +/* PM clock period is 18.52ns (round down) */ + tmp |=0x12 ; +writel (tmp, base +PCIE_RC_PL_PHY_CTL_15 ); + } + + tmp = (pcie->pcie_cfg->type ==BCM2712 ) ? +MISC_CTRL_MAX_BURST_SIZE_128_2712 : +MISC_CTRL_MAX_BURST_SIZE_128 ;/* Set SCB_MAX_BURST_SIZE, CFG_READ_UR_MODE, SCB_ACCESS_EN */ clrsetbits_le32 (base +PCIE_MISC_MISC_CTRL ,MISC_CTRL_MAX_BURST_SIZE_MASK ,MISC_CTRL_SCB_ACCESS_EN_MASK |MISC_CTRL_CFG_READ_UR_MODE_MASK | -MISC_CTRL_MAX_BURST_SIZE_128 ); +MISC_CTRL_PCIE_RCB_MPS_MODE_MASK | + tmp);pci_get_dma_regions (dev, ®ion,0 ); rc_bar2_offset = region.bus_start - region.phys_start;
@@ -482,6 +694,12 @@ static int brcm_pcie_probe(struct udevice *dev)writel (upper_32_bits (rc_bar2_offset), base +PCIE_MISC_RC_BAR2_CONFIG_HI ); +if (pcie->pcie_cfg->type ==BCM2712 ) { + tmp =readl (base +PCIE_MISC_UBUS_BAR2_CONFIG_REMAP ); +u32p_replace_bits (&tmp,1 ,PCIE_MISC_UBUS_BAR2_CONFIG_REMAP_ACCESS_ENABLE_MASK ); +writel (tmp, base +PCIE_MISC_UBUS_BAR2_CONFIG_REMAP ); + } + scb_size_val = rc_bar2_size ?ilog2 (rc_bar2_size) -15 :0xf ;/* 0xf is 1GB */
@@ -490,6 +708,29 @@ static int brcm_pcie_probe(struct udevice *dev) MISC_CTRL_SCB0_SIZE_MASK);writel (tmp, base +PCIE_MISC_MISC_CTRL ); +if (pcie->pcie_cfg->type ==BCM2712 ) { +/* Suppress AXI error responses and return 1s for read failures */ + tmp =readl (base +PCIE_MISC_UBUS_CTRL ); +u32p_replace_bits (&tmp,1 ,PCIE_MISC_UBUS_CTRL_UBUS_PCIE_REPLY_ERR_DIS_MASK ); +u32p_replace_bits (&tmp,1 ,PCIE_MISC_UBUS_CTRL_UBUS_PCIE_REPLY_DECERR_DIS_MASK ); +writel (tmp, base +PCIE_MISC_UBUS_CTRL ); +writel (0xffffffff , base +PCIE_MISC_AXI_READ_ERROR_DATA ); + +/* +* Adjust timeouts. The UBUS timeout also affects CRS +* completion retries, as the request will get terminated if +* either timeout expires, so both have to be a large value +* (in clocks of 750MHz). +* Set UBUS timeout to 250ms, then set RC config retry timeout +* to be ~240ms. +* +* Setting CRSVis=1 will stop the core from blocking on a CRS +* response, but does require the device to be well-behaved... +*/ +writel (0xB2D0000 , base +PCIE_MISC_UBUS_TIMEOUT ); +writel (0xABA0000 , base +PCIE_MISC_RC_CONFIG_RETRY_TIMEOUT ); + } +/* Disable the PCIe->GISB memory window (RC_BAR1) */ clrbits_le32 (base +PCIE_MISC_RC_BAR1_CONFIG_LO ,RC_BAR1_CONFIG_LO_SIZE_MASK );
@@ -504,12 +745,13 @@ static int brcm_pcie_probe(struct udevice *dev)/* Clear any interrupts we find on boot */ writel (0xffffffff , base +PCIE_MSI_INTR2_CLR ); +brcm_pcie_window_prog (dev); +if (pcie->gen)brcm_pcie_set_gen (pcie, pcie->gen);/* Unassert the fundamental reset */ -clrbits_le32 (pcie->base +PCIE_RGR1_SW_INIT_1 , -RGR1_SW_INIT_1_PERST_MASK ); + pcie->pcie_cfg->perst_set (pcie,0 );/* * Wait for 100ms after PERST# deassertion; see PCIe CEM specification
@@ -528,7 +770,7 @@ static int brcm_pcie_probe(struct udevice *dev)return -EINVAL ; } -if (!brcm_pcie_rc_mode (pcie)) { +if (!pcie->pcie_cfg->rc_mode (pcie)) {printf ("PCIe misconfigured; is in EP mode\n" );return -EINVAL ; }
@@ -596,14 +838,14 @@ static int brcm_pcie_remove(struct udevice *dev)void __iomem *base = pcie->base;/* Assert fundamental reset */ -setbits_le32 (base +PCIE_RGR1_SW_INIT_1 ,RGR1_SW_INIT_1_PERST_MASK ); + pcie->pcie_cfg->perst_set (pcie,1 );/* Turn off SerDes */ -setbits_le32 (base +PCIE_MISC_HARD_PCIE_HARD_DEBUG , +setbits_le32 (base +PCIE_MISC_HARD_PCIE_HARD_DEBUG (pcie),PCIE_HARD_DEBUG_SERDES_IDDQ_MASK );/* Shutdown bridge */ -setbits_le32 (base +PCIE_RGR1_SW_INIT_1 ,RGR1_SW_INIT_1_INIT_MASK ); + pcie->pcie_cfg->bridge_sw_init_set (pcie,1 );return 0 ; }
@@ -628,6 +870,11 @@ static int brcm_pcie_of_to_plat(struct udevice *dev)else pcie->gen = max_link_speed; + pcie->pcie_cfg = (const struct brcm_pcie_cfg_data *)dev_get_driver_data (dev); + +if (pcie->pcie_cfg->type ==BCM2712 ) +brcm_pcie_get_resets_dt (dev); +return 0 ; }
@@ -636,8 +883,39 @@ static const struct dm_pci_ops brcm_pcie_ops = { .write_config = brcm_pcie_write_config, }; +static const int pcie_offsets[] = { + [RGR1_SW_INIT_1 ] =0x9210 , + [EXT_CFG_INDEX ] =0x9000 , + [EXT_CFG_DATA ] =0x8000 , + [PCIE_HARD_DEBUG ] =0x4204 , +}; + +static const struct brcm_pcie_cfg_data bcm2711_cfg = { + .offsets = pcie_offsets, + .type =BCM2711 , + .perst_set = brcm_pcie_perst_set_generic, + .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_generic, + .rc_mode = brcm_pcie_rc_mode, +}; + +static const int pcie_offsets_bcm2712[] = { + [RGR1_SW_INIT_1 ] =0x0 , + [EXT_CFG_INDEX ] =0x9000 , + [EXT_CFG_DATA ] =0x8000 , + [PCIE_HARD_DEBUG ] =0x4304 , +}; + +static const struct brcm_pcie_cfg_data bcm2712_cfg = { + .offsets = pcie_offsets_bcm2712, + .type =BCM2712 , + .perst_set = brcm_pcie_perst_set_2712, + .bridge_sw_init_set = brcm_pcie_bridge_sw_init_set_2712, + .rc_mode = brcm_pcie_rc_mode, +}; +static const struct udevice_id brcm_pcie_ids[] = { - { .compatible ="brcm,bcm2711-pcie" }, + { .compatible ="brcm,bcm2711-pcie" , .data = (ulong)&bcm2711_cfg }, + { .compatible ="brcm,bcm2712-pcie" , .data = (ulong)&bcm2712_cfg }, { } };
Signature · 1 line
2.34.1
RFC PATCH 10/20 drivers: mfd: introduce RP1 chip driver for RPI5
In reply to Oleksii MoisieievRaspberry PI 5 has RP1 chip connected over PCIE and working as a bridge to different hardware.
This driver implementation was inspired by MFD RP1 driver in the Linux Kernel.
---
drivers/mfd/Kconfig | 10 ++++ drivers/mfd/Makefile | 1 + drivers/mfd/rp1.c | 120 +++++++++++++++++++++++++++++++++++++++++++ include/pci_ids.h | 3 ++ 4 files changed, 134 insertions(+) create mode 100644 drivers/mfd/rp1.c
drivers/mfd/Kconfig +10 -0
@@ -2,3 +2,13 @@ config MFD_ATMEL_SMC bool "Atmel Static Memory Controller driver" help Say yes here to support Atmel Static Memory Controller driver. + +config MFD_RP1 + tristate "RP1 MFD driver" + depends on PCI + help + Support for the RP1 peripheral chip. + + This driver provides support for the Raspberry Pi RP1 peripheral chip. + It is responsible for enabling the Device Tree node once the PCIe endpoint + has been configureds.
drivers/mfd/Makefile +1 -0
@@ -1 +1,2 @@ obj-$(CONFIG_MFD_ATMEL_SMC) += atmel-smc.o +obj-$(CONFIG_MFD_RP1) += rp1.o
drivers/mfd/rp1.c new file +120 -0
120 lines not on this page · raw message
include/pci_ids.h +3 -0
@@ -2556,6 +2556,9 @@#define PCI_VENDOR_ID_TEKRAM 0x1de1#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29 +#define PCI_VENDOR_ID_RPI 0x1de4 +#define PCI_DEVICE_ID_RP1_C0 0x0001 +#define PCI_VENDOR_ID_TEHUTI 0x1fc9#define PCI_DEVICE_ID_TEHUTI_3009 0x3009#define PCI_DEVICE_ID_TEHUTI_3010 0x3010
Signature · 1 line
2.34.1
RFC PATCH 11/20 drivers: gpio: add support of RP1 GPIO for Raspberry PI 5
In reply to Oleksii MoisieievRaspberry PI5 has an external chip RP1 installed which provides it's own GPIO controller. This driver implements GPIO support for RP1 GPIO controller.
---
drivers/gpio/Kconfig | 7 + drivers/gpio/Makefile | 1 + drivers/gpio/rp1_gpio.c | 374 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 382 insertions(+) create mode 100644 drivers/gpio/rp1_gpio.c
drivers/gpio/Kconfig +7 -0
@@ -340,6 +340,13 @@ config RCAR_GPIO help This driver supports the GPIO banks on Renesas RCar SoCs. +config RP1_GPIO + bool "Raspberry PR1 GPIO driver" + help + This driver supports the GPIO banks on Raspberry RP1 chip. + Raspberry PI5 has an external chip RP1 installed, which + provides it's own GPIO controller. + config RZA1_GPIO bool "Renesas RZ/A1 GPIO driver" depends on DM_GPIO && RZA1
drivers/gpio/Makefile +1 -0
@@ -30,6 +30,7 @@ obj-$(CONFIG_NPCM_GPIO) += npcm_gpio.o obj-$(CONFIG_PCA953X) += pca953x.o obj-$(CONFIG_ROCKCHIP_GPIO) += rk_gpio.o obj-$(CONFIG_RCAR_GPIO) += gpio-rcar.o +obj-$(CONFIG_RP1_GPIO) += rp1_gpio.o obj-$(CONFIG_RZA1_GPIO) += gpio-rza1.o obj-$(CONFIG_S5P) += s5p_gpio.o obj-$(CONFIG_SANDBOX_GPIO) += sandbox.o sandbox_test.o
drivers/gpio/rp1_gpio.c new file +374 -0
374 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [RFC PATCH v1 11/20] drivers: gpio: add support of RP1 GPIO for Raspberry PI 5
On Wed, Feb 05, 2025 at 10:15:45AM +0000, Oleksii Moisieiev wrote:
...
drivers/gpio/rp1_gpio.c line 110
Quoted 10 lines
drivers/gpio/rp1_gpio.c new file +10
-0+#define RP1_PAD_DRIVE_LSB 4 +#define RP1_PAD_IN_ENABLE_MASK 0x00000040 +#define RP1_PAD_IN_ENABLE_LSB 6 +#define RP1_PAD_OUT_DISABLE_MASK 0x00000080 +#define RP1_PAD_OUT_DISABLE_LSB 7 + +#define RP1_PAD_DRIVE_2MA 0x00000000 +#define RP1_PAD_DRIVE_4MA 0x00000010 +#define RP1_PAD_DRIVE_8MA 0x00000020 +#define RP1_PAD_DRIVE_12MA 0x00000030
Can we use enumerator for these, instead of preprocessor macros?
Also in addition to BI(), can we use GENMASK() and FIELD_PREP_CONST(), i.e.:
enum {
...
RP1_PAD_DRIVE_MASK = GENMASK(7, 4),
RP1_PAD_DRIVE_2MA = FIELD_PREP_CONST(RP1_PAD_DRIVE_MASK, 0),
RP1_PAD_DRIVE_4MA = FIELD_PREP_CONST(RP1_PAD_DRIVE_MASK, 1),
RP1_PAD_DRIVE_8MA = FIELD_PREP_CONST(RP1_PAD_DRIVE_MASK, 2),
RP1_PAD_DRIVE_12MA = FIELD_PREP_CONST(RP1_PAD_DRIVE_MASK, 3),
...
};You need to import FIELD_PREP_CONST() into include/linux/bitfield.h, from Linux sources, since we don't have it in U-Boot yet.
drivers/gpio/rp1_gpio.c line 113
Quoted 2 lines
drivers/gpio/rp1_gpio.c new file +2
-0+#define FLD_GET (r, f) (((r) & (f ## _MASK)) >> (f ## _LSB)) +#define FLD_SET (r, f, v) r = (((r) & ~(f ## _MASK)) | ((v) << (f ## _LSB)))
Use FIELD_GET and FIELD_SET.
...
drivers/gpio/rp1_gpio.c line 172
Quoted 9 lines
drivers/gpio/rp1_gpio.c new file +9
-0+static void rp1_pad_update (struct rp1_pin_info *pin,u32 clr,u32 set) +{ +u32 padctrl =readl (pin->pad); + + padctrl &= ~clr; + padctrl |= set; + +writel (padctrl, pin->pad); +}
Instead of implementing your own function, you can just use clrsetbits_le32() ...
...
drivers/gpio/rp1_gpio.c line 206
Quoted 9 lines
drivers/gpio/rp1_gpio.c new file +9
-0+static void rp1_set_fsel (struct rp1_pin_info *pin,u32 fsel) +{ +u32 ctrl =readl (pin->gpio +RP1_GPIO_CTRL ); + +if (fsel >=RP1_FSEL_COUNT ) + fsel =RP1_FSEL_NONE_HW ; + +rp1_input_enable (pin,1 ); +rp1_output_enable (pin,1 );
Shouldn't this be done with one read-modify-write? It seems to be doing two read-modify-writes to one register.
Quoted 6 lines
drivers/gpio/rp1_gpio.c new file +6
-0+ +if (fsel ==RP1_FSEL_NONE ) { +FLD_SET (ctrl,RP1_GPIO_CTRL_OEOVER ,RP1_OEOVER_DISABLE ); + }else { +FLD_SET (ctrl,RP1_GPIO_CTRL_OUTOVER ,RP1_OUTOVER_PERI ); +FLD_SET (ctrl,RP1_GPIO_CTRL_OEOVER ,RP1_OEOVER_PERI );
drivers/gpio/rp1_gpio.c line 222
Quoted 10 lines
drivers/gpio/rp1_gpio.c new file +10
-0+ } +FLD_SET (ctrl,RP1_GPIO_CTRL_FUNCSEL , fsel); + +writel (ctrl, pin->gpio +RP1_GPIO_CTRL ); +} + +static int rp1_get_dir (struct rp1_pin_info *pin) +{ +return !(readl (pin->rio +RP1_RIO_OE ) & (1 << pin->offset)) ? +RP1_DIR_INPUT :RP1_DIR_OUTPUT ;
Why use own constants (RP1_DIR_INPUT/OUTPUT) ?
1 << pin->offset should be BIT(pin->offset). This happens more time in the subsequent code.
drivers/gpio/rp1_gpio.c line 227
Quoted 5 lines
drivers/gpio/rp1_gpio.c new file +5
-0+} + +static void rp1_set_dir (struct rp1_pin_info *pin,bool is_input) +{ +int offset = is_input ?RP1_CLR_OFFSET :RP1_SET_OFFSET ;
size_t offset
Quoted 4 lines
drivers/gpio/rp1_gpio.c new file +4
-0+ +writel (1 << pin->offset, pin->rio +RP1_RIO_OE + offset); +} +
drivers/gpio/rp1_gpio.c line 241
Quoted 10 lines
drivers/gpio/rp1_gpio.c new file +10
-0+static int rp1_get_value (struct rp1_pin_info *pin) +{ +return !!(readl (pin->rio +RP1_RIO_IN ) & (1 << pin->offset)); +} + +static void rp1_set_value (struct rp1_pin_info *pin,int value) +{ +/* Assume the pin is already an output */ +writel (1 << pin->offset, + pin->rio +RP1_RIO_OUT + (value ?RP1_SET_OFFSET :RP1_CLR_OFFSET ));
In rp1_set_dir() you have helper variable offset, why not here?
drivers/gpio/rp1_gpio.c line 253
Quoted 12 lines
drivers/gpio/rp1_gpio.c new file +12
-0+} + +static int rp1_gpio_get (struct udevice *dev,unsigned int offset) +{ +struct rp1_pin_info *pin =rp1_get_pin (dev, offset); +int ret; + +if (!pin) +return -EINVAL ; + + ret =rp1_get_value (pin); +return ret;
return rp1_get_value(pin); ? And you can drop the ret variable and save two lines.
drivers/gpio/rp1_gpio.c line 261
Quoted 8 lines
drivers/gpio/rp1_gpio.c new file +8
-0+} + +static int rp1_gpio_set (struct udevice *dev,unsigned int offset,int value) +{ +struct rp1_pin_info *pin =rp1_get_pin (dev, offset); + +if (pin) +rp1_set_value (pin, value);
Shouldn't this return some error if pin is NULL?
drivers/gpio/rp1_gpio.c line 274
Quoted 12 lines
drivers/gpio/rp1_gpio.c new file +12
-0+return 0 ; +} + +static int rp1_gpio_direction_input (struct udevice *dev,unsigned int offset) +{ +struct rp1_pin_info *pin =rp1_get_pin (dev, offset); + +if (!pin) +return -EINVAL ; + +rp1_set_dir (pin,RP1_DIR_INPUT ); +rp1_set_fsel (pin,RP1_FSEL_GPIO );
Empty line before return.
drivers/gpio/rp1_gpio.c line 287
Quoted 13 lines
drivers/gpio/rp1_gpio.c new file +13
-0+return 0 ; +} + +static int rp1_gpio_direction_output (struct udevice *dev,unsigned int offset,int value) +{ +struct rp1_pin_info *pin =rp1_get_pin (dev, offset); + +if (!pin) +return -EINVAL ; + +rp1_set_value (pin, value); +rp1_set_dir (pin,RP1_DIR_OUTPUT ); +rp1_set_fsel (pin,RP1_FSEL_GPIO );
Empty line before return.
Quoted 8 lines
drivers/gpio/rp1_gpio.c new file +8
-0+return 0 ; +} + +static int rp1_gpio_get_direction (struct udevice *dev,unsigned int offset) +{ +struct rp1_pin_info *pin =rp1_get_pin (dev, offset); +u32 fsel; +
drivers/gpio/rp1_gpio.c line 305
Quoted 10 lines
drivers/gpio/rp1_gpio.c new file +10
-0+if (!pin) +return -EINVAL ; + + fsel =rp1_get_fsel (pin); +if (fsel !=RP1_FSEL_GPIO ) +return -EINVAL ; + +return (rp1_get_dir (pin) ==RP1_DIR_OUTPUT ) ? +GPIOF_OUTPUT : +GPIOF_INPUT ;
rp1_get_dir() could have already returned GPIOF_INPUT/OUTPUT instead of the custom constants.
drivers/gpio/rp1_gpio.c line 314
Quoted 9 lines
drivers/gpio/rp1_gpio.c new file +9
-0+} + +static const struct dm_gpio_ops rp1_gpio_ops = { + .direction_input = rp1_gpio_direction_input, + .direction_output = rp1_gpio_direction_output, + .get_value = rp1_gpio_get, + .set_value = rp1_gpio_set, + .get_function = rp1_gpio_get_direction, +};
Align the '=' with tabs.
drivers/gpio/rp1_gpio.c line 320
Quoted 6 lines
drivers/gpio/rp1_gpio.c new file +6
-0+ +static int rp1_gpio_probe (struct udevice *dev) +{ +int i; +struct gpio_dev_priv *uc_priv =dev_get_uclass_priv (dev); +struct rp1_gpio_priv *priv =dev_get_priv (dev);
Reverse christmas tree variables declaration if possible:
struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); struct rp1_gpio_priv *priv = dev_get_priv(dev); int i;
But you don't need declaring i here, see below.
Quoted 7 lines
drivers/gpio/rp1_gpio.c new file +7
-0+ + priv->gpio_base =dev_remap_addr_index (dev,0 ); +if (!priv->gpio_base) +return -EINVAL ; + + priv->rio_base =dev_remap_addr_index (dev,1 ); +if (!priv->rio_base)
drivers/gpio/rp1_gpio.c line 337
Quoted 10 lines
drivers/gpio/rp1_gpio.c new file +10
-0+return -EINVAL ; + + priv->pads_base =dev_remap_addr_index (dev,2 ); +if (!priv->pads_base) +return -EINVAL ; + + uc_priv->gpio_count =RP1_NUM_GPIOS ; + uc_priv->bank_name = dev->name; + +for (i =0 ; i <RP1_NUM_BANKS ; i++) {
for (int i = 0; ...)
drivers/gpio/rp1_gpio.c line 341
Quoted 4 lines
drivers/gpio/rp1_gpio.c new file +4
-0+const struct rp1_iobank_desc *bank = &rp1_iobanks[i]; +int j; + +for (j =0 ; j < bank->num_gpios; j++) {
for (int j = 0; ...)
Quoted 13 lines
drivers/gpio/rp1_gpio.c new file +13
-0+struct rp1_pin_info *pin = + &priv->pins[bank->min_gpio + j]; + + pin->num = bank->min_gpio + j; + pin->bank = i; + pin->offset = j; + + pin->gpio = priv->gpio_base + bank->gpio_offset + + j *sizeof (u32) *2 ; + pin->inte = priv->gpio_base + bank->inte_offset; + pin->ints = priv->gpio_base + bank->ints_offset; + pin->rio = priv->rio_base + bank->rio_offset; + pin->pad = priv->pads_base + bank->pads_offset +
drivers/gpio/rp1_gpio.c line 364
Quoted 10 lines
drivers/gpio/rp1_gpio.c new file +10
-0+ j * sizeof(u32); + } + } + +return 0 ; +} + +static const struct udevice_id rp1_gpio_ids[] = { + { .compatible ="raspberrypi,rp1-gpio" }, + {/* sentinel */ }
No need to write the sentinel comment. IMO we should drop this from all drivers that use it.
drivers/gpio/rp1_gpio.c line 373
Quoted 9 lines
drivers/gpio/rp1_gpio.c new file +9
-0+}; + +U_BOOT_DRIVER (rp1_gpio) = { + .name ="rp1-gpio" , + .id =UCLASS_GPIO , + .of_match = rp1_gpio_ids, + .ops = &rp1_gpio_ops, + .priv_auto =sizeof (struct rp1_gpio_priv ), + .probe = rp1_gpio_probe,
Align '=' with tabs.
Marek
Re: [RFC PATCH v1 11/20] drivers: gpio: add support of RP1 GPIO for Raspberry PI 5
Quoted 4 lines · Marek Behún
drivers/gpio/rp1_gpio.c line 113
Quoted 2 lines
drivers/gpio/rp1_gpio.c new file +2
-0+#define FLD_GET (r, f) (((r) & (f ## _MASK)) >> (f ## _LSB)) +#define FLD_SET (r, f, v) r = (((r) & ~(f ## _MASK)) | ((v) << (f ## _LSB)))Use
FIELD_GETandFIELD_SET.
Sorry, FIELD_GET and FIELD_PREP.
RFC PATCH 12/20 drivers: reset: introduce reset drivers for brcmstb
In reply to Oleksii MoisieievIntroducing Generic Reset controller and Generic RESCAL drivers for Broadcom boards.
---
drivers/reset/Kconfig | 14 ++++ drivers/reset/Makefile | 2 + drivers/reset/reset-brcmstb-rescal.c | 103 +++++++++++++++++++++++++++ drivers/reset/reset-brcmstb.c | 97 +++++++++++++++++++++++++ 4 files changed, 216 insertions(+) create mode 100644 drivers/reset/reset-brcmstb-rescal.c create mode 100644 drivers/reset/reset-brcmstb.c
drivers/reset/Kconfig +14 -0
@@ -63,6 +63,20 @@ config RESET_BCM6345 help Support reset controller on BCM6345. +config RESET_BRCMSTB + bool "Generic Reset controller driver for Broadcom" + help + This enables reset controller for Broadcom devices. + If you wish to use reset resources managed by the Broadcom + Reset Controller, say Y here. Otherwise, say N. + +config RESET_BRCMSTB_RESCAL + bool "Generic Rescal Reset controller driver for Broadcom" + help + Support rescal reset controller on Broadcom. + If you wish to use reset resources managed by the Broadcom + Reset Controller, say Y here. Otherwise, say N. + config RESET_UNIPHIER bool "Reset controller driver for UniPhier SoCs" depends on ARCH_UNIPHIER
drivers/reset/Makefile +2 -0
@@ -13,6 +13,8 @@ obj-$(CONFIG_TEGRA186_RESET) += tegra186-reset.o obj-$(CONFIG_RESET_TI_SCI) += reset-ti-sci.o obj-$(CONFIG_RESET_HSDK) += reset-hsdk.o obj-$(CONFIG_RESET_BCM6345) += reset-bcm6345.o +obj-$(CONFIG_RESET_BRCMSTB) += reset-brcmstb.o +obj-$(CONFIG_RESET_BRCMSTB_RESCAL) += reset-brcmstb-rescal.o obj-$(CONFIG_RESET_UNIPHIER) += reset-uniphier.o obj-$(CONFIG_RESET_AST2500) += reset-ast2500.o obj-$(CONFIG_RESET_AST2600) += reset-ast2600.o
drivers/reset/reset-brcmstb-rescal.c new file +103 -0
103 lines not on this page · raw message
drivers/reset/reset-brcmstb.c new file +97 -0
97 lines not on this page · raw message
Signature · 1 line
2.34.1
RFC PATCH 13/20 drivers: clk: introduce clock driver for RP1
In reply to Oleksii MoisieievIntroduce clock driver for RPI5 RP1 chip. It is intended to work with a clock controller connected to the RP1 chip of RPI5. Current implementation supports only RP1_CLK_ETH_TSU clock. Additional clock could be added to the rp1_data array if needed.
---
drivers/clk/Kconfig | 7 ++ drivers/clk/Makefile | 1 + drivers/clk/clk-rp1.c | 280 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 288 insertions(+) create mode 100644 drivers/clk/clk-rp1.c
drivers/clk/Kconfig +7 -0
@@ -163,6 +163,13 @@ config CLK_OCTEON help Enable this to support the clocks on Octeon MIPS platforms. +config CLK_RP1 + bool "Raspberry Pi RP1-based clock support" + depends on PCI && CLK + help + Enable common clock framework support for Raspberry Pi RP1 + support. + config SANDBOX_CLK_CCF bool "Sandbox Common Clock Framework [CCF] support " depends on SANDBOX
drivers/clk/Makefile +1 -0
@@ -56,3 +56,4 @@ obj-$(CONFIG_MACH_PIC32) += clk_pic32.o obj-$(CONFIG_SANDBOX_CLK_CCF) += clk_sandbox_ccf.o obj-$(CONFIG_SANDBOX) += clk_sandbox.o obj-$(CONFIG_SANDBOX) += clk_sandbox_test.o +obj-$(CONFIG_CLK_RP1) += clk-rp1.o
drivers/clk/clk-rp1.c new file +280 -0
280 lines not on this page · raw message
Signature · 1 line
2.34.1
RFC PATCH 14/20 drivers: net: macb: introduce ePCI connection support for macb
In reply to Oleksii MoisieievOn BCM2712 connected devices, such as RPI5 has an external chip called RP1 connected to the main SOC over ePCI. Macb is connectet to the RP1 chip and should be transparent to the SOC. Introduced changes are intended to solve mapping issues and implement full support for the macb driver.
---
drivers/net/Kconfig | 1 + drivers/net/macb.c | 154 +++++++++++++++++++++++++++++++++++--------- drivers/net/macb.h | 16 +++++ 3 files changed, 140 insertions(+), 31 deletions(-)
drivers/net/Kconfig +1 -0
@@ -525,6 +525,7 @@ config MVPP2 config MACB bool "Cadence MACB/GEM Ethernet Interface" select PHYLIB + select DM_GPIO help The Cadence MACB ethernet interface is found on many Atmel AT91 and SAMA5 parts. This driver also supports the Cadence
drivers/net/macb.c +123 -31
306 lines not on this page · raw message
drivers/net/macb.h +16 -0
@@ -69,6 +69,7 @@#define GEM_USRIO 0x000c/* User IO */ #define GEM_DMACFG 0x0010/* DMA Configuration */ #define GEM_JML 0x0048/* Jumbo Max Length */ +#define GEM_AMP 0x0054/* AXI Max Pipeline */ #define GEM_HRB 0x0080/* Hash Bottom */ #define GEM_HRT 0x0084/* Hash Top */ #define GEM_SA1B 0x0088/* Specific1 Bottom */
@@ -764,6 +765,21 @@#define GEM_RX_CSUM_IP_TCP 2#define GEM_RX_CSUM_IP_UDP 3 +/* Bitfields in AMP */ +/* Maximum number of outstanding AXI read requests */ +#define GEM_AR2R_MAX_PIPE_OFFSET 0 +#define GEM_AR2R_MAX_PIPE_SIZE 8 +/* Maximum number of outstanding AXI write requests */ +#define GEM_AW2W_MAX_PIPE_OFFSET 8 +#define GEM_AW2W_MAX_PIPE_SIZE 8 +/* Select whether the max AW2W transactions operates between: */ +#define GEM_AW2B_FILL_OFFSET 16 +/* 0: the AW to W AXI channel */ +#define GEM_AW2B_FILL_AW2W 0 +/* 1: AW to B channel */ +#define GEM_AW2B_FILL_AW2B 1 +#define GEM_AW2B_FILL_SIZE 1 +/* limit RX checksum offload to TCP and UDP packets */ #define GEM_RX_CSUM_CHECKED_MASK 2#define gem_writel_queue_TBQP (port, value, queue_num) \
Signature · 1 line
2.34.1
RFC PATCH 15/20 configs: add support for the Raspberrypi 5 board to default config
In reply to Oleksii MoisieievAdd the default configuration file for RPI5 board.
To build u-boot for Raspberrypi 5 the following command should be used:
Quoted 1 line
make
rpi_arm64_defconfigCROSS_COMPILE=aarch64-linux-gnu-
---
configs/rpi_arm64_defconfig | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
configs/rpi_arm64_defconfig +19 -0
@@ -1,6 +1,7 @@ CONFIG_ARM=y CONFIG_POSITION_INDEPENDENT=y CONFIG_ARCH_BCM283X=y +CONFIG_BCM2712=y CONFIG_TARGET_RPI_ARM64=y CONFIG_ENV_SIZE=0x4000 CONFIG_DEFAULT_DEVICE_TREE="bcm2711-rpi-4-b"
@@ -56,3 +57,21 @@ CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_VIDEO_BCM2835=y CONFIG_CONSOLE_SCROLL_LINES=10 CONFIG_PHYS_TO_BUS=y + +CONFIG_RESET_BRCMSTB=y +CONFIG_MFD_RP1=y + +CONFIG_PCI_PNP=y + +CONFIG_RESET_RASPBERRYPI=y +CONFIG_RESET_BRCMSTB_RESCAL=y + +CONFIG_MACB=y + +CONFIG_CLK=y +CONFIG_CLK_RP1=y +CONFIG_OF_REAL=y + +CONFIG_RP1_GPIO=y +CONFIG_BOARD_LATE_INIT=y +CONFIG_BOARD_TYPES=y
Signature · 1 line
2.34.1
RFC PATCH 16/20 board: raspberrypi: rpi: request RP1 in late_init
In reply to Oleksii MoisieievFrom: Volodymyr Babchuk <[email protected]>
RP1 chip is the PCIe device which should provide transparent access to the peripheral connected to it for the main Soc.
Current RP1 device tree node structure and RP1 driver implementation don't allow PCIe subsystem to make a proper initialization of RP1 device with child nodes. So RP1 probe should be called after all initializations were done.
---
board/raspberrypi/rpi/rpi.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
board/raspberrypi/rpi/rpi.c +23 -0
@@ -593,3 +593,26 @@ int ft_board_setup(void *blob, struct bd_info *bd)return 0 ; } + +/* TODO: Using late_init to initialize pci device with ID_RP1. +* RP1 pci device should be initialized by the PCI subsystem because +* it is under develop right now and depends from the final device-tree +* format from the Linux Kernel. Current device-tree format violates +* pci driver model. So this should be changed after upstreaming RP1 +* to the Linux Kernel source code. +* This initialization should be done only for RPI5 board. +*/ +#ifdef CONFIG_BCM2712 +int board_late_init (void ) +{ +struct udevice *dev; +int err; + + err =dm_pci_find_device (PCI_VENDOR_ID_RPI ,PCI_DEVICE_ID_RP1_C0 , +0 , &dev); +if (err) +printf ("RPI: RP1 device not found\n" ); + +return 0 ; +} +#endif
Signature · 1 line
2.34.1
RFC PATCH 17/20 HACK: drivers: mfd: set bar configuration for RP1 driver
In reply to Oleksii MoisieievSet bar address in the correct order. RP1 driver in Linux Kernel rely on the pci BAR configuration which initializes BARs based on BAR size. This results the Linux set BARs in the same order on each boot. U-boot does initialization without any sorting so the configuration may be different from the Linux kernel.
Here BAR address configuration is set to match the Linux Kernel order to avoid fails on address translation.
This should be changed after upstreaming RP1 driver to the Linux kernel mainline.
---
drivers/mfd/rp1.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/mfd/rp1.c +14 -0
@@ -63,6 +63,20 @@ static int rp1_probe(struct udevice *dev)/* Turn on bus-mastering */ dm_pci_clrset_config16 (dev,PCI_COMMAND ,0 ,PCI_COMMAND_MASTER |PCI_COMMAND_MEMORY ); +/* +* HACK: Set bar address in the correct order. RP1 driver in Linux Kernel rely on +* the pci BAR configuration which initializes BARs based on BAR size. +* This results the Linux set BARs in the same order on each boot. +* U-boot does initialization without any sorting so the configuration +* may be different from the Linux kernel. +* Here BAR address configuration is set to match the Linux Kernel order +* to avoid fails on address translation. +* This should be changed after upstreaming RP1 driver to the Linux kernel +* mainline. +*/ +dm_pci_write_config32 (dev,PCI_BASE_ADDRESS_1 ,0 ); +dm_pci_write_config32 (dev,PCI_BASE_ADDRESS_0 ,0x40000 ); + ret =rp1_get_bar_region (dev, &rp1->bar_start);if (ret)return ret;
Signature · 1 line
2.34.1
RFC PATCH 18/20 drivers: pci: pcie_brcmstb: use bus_base to config PCI device
In reply to Oleksii MoisieievBRCM PCIe controller has different means of accessing to its own config space and to device's config space. To support this quirk, its driver uses simple heuristic:
when PCI subsystem probes Bus 0, the driver assumes
that the subsystem tries to accesses PCIe controller config space, when PCI subsystem probes other busses, the driver uses mechanism for device config space access. This heuristic works well when there is only one PCIe controller in the system.
But U-Boot does not support concept of "PCI Segment", so when there are more than one PCI controller:
- first one gets Bus address 0,
- second one - Bus address 2 and so on.
This breaks the brcm driver, because it tries to access second PCIe controller config space as if it is device. To fix this, we introduce additional property bus_base that holds a PCIe controller own Bus address.
We use this property to calculate "real" Bus address for underlying devices.
Please note that this fix may not support a case when we have PCI-to-PCI bridges behind the second PCIe controller.
---
drivers/pci/pcie_brcmstb.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/pci/pcie_brcmstb.c +4 -0
@@ -202,6 +202,7 @@ struct brcm_pcie {struct reset_ctl rescal;struct reset_ctl bridge_reset;const struct brcm_pcie_cfg_data *pcie_cfg; +uint16_t bus_base; };/**
@@ -313,6 +314,7 @@ static int brcm_pcie_config_address(const struct udevice *dev, pci_dev_t bdf,* Busses 0 (host PCIe bridge) and 1 (its immediate child) * are limited to a single device each */ + pci_bus -= pcie->bus_base;if (pci_bus <2 && pci_dev >0 )return -EINVAL ;
@@ -631,6 +633,8 @@ static int brcm_pcie_probe(struct udevice *dev)u16 nlw, cls, lnksta;u32 tmp; + pcie->bus_base = hose->first_busno; +/* * Deassert rescal reset for BCM2712. */
Signature · 1 line
2.34.1
RFC PATCH 19/20 drivers: pci: pcie_brcmstb: set correct reset state on pcie_remove
In reply to Oleksii MoisieievFor the controllers that are utilizing reset for bridge sw init, such as BCM2712, reset should be deasserted after assertion. Leaving it in asserted state may lead to unexpected hangs in the Linux Kernel driver because it do not perform reset initialization and start accessing the device memory.
We've met this issue on the Raspberry PI5 kernel and got the following log:
[ 1.842953] brcm-pcie 1000110000.pcie: host bridge /axi/pcie@110000 ranges: [ 1.849953] brcm-pcie 1000110000.pcie: No bus range found for /axi/pcie@110000, using [bus 00-ff] [ 1.859104] brcm-pcie 1000110000.pcie: MEM 0x1b00000000..0x1bfffffffb -> 0x0000000000 [ 1.867407] brcm-pcie 1000110000.pcie: MEM 0x1800000000..0x1affffffff -> 0x0400000000 [ 1.875707] brcm-pcie 1000110000.pcie: IB MEM 0x0000000000..0x0fffffffff -> 0x1000000000nc
After that system reports a context switch error after 120 sec timeout.
---
drivers/pci/pcie_brcmstb.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/pci/pcie_brcmstb.c +10 -0
@@ -851,6 +851,16 @@ static int brcm_pcie_remove(struct udevice *dev)/* Shutdown bridge */ pcie->pcie_cfg->bridge_sw_init_set (pcie,1 ); +/* +* For the controllers that are utilizing reset for bridge Sw init, +* such as BCM2712, reset should be deasserted after assertion. +* Leaving it in asserted state may lead to unexpected hangs in +* the Linux Kernel driver because it do not perform reset initialization +* and start accessing device memory. +*/ +if (pcie->pcie_cfg->type ==BCM2712 ) + pcie->pcie_cfg->bridge_sw_init_set (pcie,0 ); +return 0 ; }
Signature · 1 line
2.34.1
RFC PATCH 20/20 bcm2712: enable linux kernel image header
In reply to Oleksii MoisieievFrom: Volodymyr Babchuk <[email protected]>
This change is needed to make OP-TEE operable on RPI5.
This is somewhat convoluted, but in the essence, OP-TEE image is being loaded at address 0x80000 and we can't change that. Problem is that last versions (like 2024/06/05) of RPI5 firmware tries to load non-kernel images to the same address 0x80000, thus, overwriting OP-TEE image.
This patch enables Linux kernel image for U-Boot, so firmware will treat U-Boot as a kernel image, placing it at different address, namely at 0x200000.
---
arch/arm/mach-bcm283x/Kconfig | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/mach-bcm283x/Kconfig +4 -0
@@ -46,8 +46,12 @@ config BCM2711_64B config BCM2712 bool "Broadcom BCM2712 SoC support" + select LINUX_KERNEL_IMAGE_HEADER depends on ARCH_BCM283X +config LNX_KRNL_IMG_TEXT_OFFSET_BASE + default TEXT_BASE + menu "Broadcom BCM283X family" depends on ARCH_BCM283X
Signature · 1 line
2.34.1
Hi Oleksii,
Quoted 12 lines · Oleksii Moisieiev
This patch series provides generic support for Raspberry PI 5 in U-Boot with additional hardware drivers.
The following features were implemented:
1) add generic board config for Raspberry PI5 including device-tree files;
2) add support for RP1 chip with additional hardware;
3) add support for rp1-clock driver with dt-bindings update;
4) PCIE BRCMSTB driver support for Raspberry PI 5;
5) add clock/reset/gpio drivers;
6) add ethernet support in u-boot.
Quoted 4 lines
This patch-series introducing the basic set of supported drivers in U-Boot which allows using such features as tftp and\or NFS.
I've posted this patch series as RFC because of the following commit:e51ca0d221(HACK: drivers: mfd: set bar configuration for RP1 driver, 2024-05-21)
Where is that commit?
Quoted 10 lines
It includes HACK for rp1 driver in u-boot. This HACK is setting bar address in the correct order because RP1 driver in Linux Kernel rely on the pci BAR configuration which initializes BARs based on BAR size. This results the Linux set BARs in the same order on each boot. U-boot does initialization without any sorting so the configuration may be different from the Linux kernel.
BAR address configuration is set to match the Linux Kernel order to avoid fails on address translation.
Quoted 5 lines
This should be changed after upstreaming RP1 driver to the Linux kernel mainline.
Probably somebody from Raspberry will post an advise about how this can be properly done.
+1
Quoted 7 lines
U-Boot support for Raspberry PI 5 was added in terms of the following
project: https://github.com/xen-troops/meta-xt-prod-devel-rpi5
This is xen-based dom0less system on the Raspberry PI 5 with Zephyr as Control Domain and Linux is Driver Domain.It is Yocto-based so it will be easy to build it on your side. Please visit link for the details.
I tried to apply this but I get a lot of conflicts. Can you please advise what tree it is based on?
Regards,
Simon
Hi Simon.
Please see below.
-- Oleski
Quoted 15 lines · Simon Glass
Hi Oleksii,
Quoted 11 lines · Oleksii Moisieiev
This patch series provides generic support for Raspberry PI 5 in U-Boot with additional hardware drivers.
The following features were implemented:
1) add generic board config for Raspberry PI5 including device-tree files;
2) add support for RP1 chip with additional hardware;
3) add support for rp1-clock driver with dt-bindings update;
4) PCIE BRCMSTB driver support for Raspberry PI 5;
5) add clock/reset/gpio drivers;
6) add ethernet support in u-boot.
Quoted 5 lines
Quoted 4 lines
This patch-series introducing the basic set of supported drivers in U-Boot which allows using such features as tftp and\or NFS.
I've posted this patch series as RFC because of the following commit:e51ca0d221(HACK: drivers: mfd: set bar configuration for RP1 driver, 2024-05-21)Where is that commit?
This commit is part of the patch series. Here is direct link:
https://lore.kernel.org/u-boot/[email protected]/T/#m21cf23989fb08cb655e25b1a2d082632b6f865c9
Quoted 21 lines
Quoted 9 lines
It includes HACK for rp1 driver in u-boot. This HACK is setting bar address in the correct order because RP1 driver in Linux Kernel rely on the pci BAR configuration which initializes BARs based on BAR size. This results the Linux set BARs in the same order on each boot. U-boot does initialization without any sorting so the configuration may be different from the Linux kernel.
BAR address configuration is set to match the Linux Kernel order to avoid fails on address translation.Quoted 5 lines
This should be changed after upstreaming RP1 driver to the Linux kernel mainline.
Probably somebody from Raspberry will post an advise about how this can be properly done.
+1
Quoted 5 lines
U-Boot support for Raspberry PI 5 was added in terms of the following
project: https://github.com/xen-troops/meta-xt-prod-devel-rpi5
This is xen-based dom0less system on the Raspberry PI 5 with Zephyr as Control Domain and Linux is Driver Domain.
Quoted 4 lines
Quoted 2 lines
It is Yocto-based so it will be easy to build it on your side. Please visit link for the details.
I tried to apply this but I get a lot of conflicts. Can you please advise what tree it is based on?
Yocto build using the following repo:
https://github.com/xen-troops/u-boot/tree/rpi5-2024.04-xt
It is based on the 7-8 month old master. I didn't do any rebase on the top because
it's unclear if these changes will go to upstream.
So I've posted RFC before making significant changes.
Quoted 3 lines
Regards,
Simon
Hi Oleksii,
Quoted 61 lines · Oleksii Moisieiev
Hi Simon.
Please see below.
-- Oleski
Quoted 15 lines · Simon Glass
Hi Oleksii,
Quoted 11 lines · Oleksii Moisieiev
This patch series provides generic support for Raspberry PI 5 in U-Boot with additional hardware drivers.
The following features were implemented:
1) add generic board config for Raspberry PI5 including device-tree files;
2) add support for RP1 chip with additional hardware;
3) add support for rp1-clock driver with dt-bindings update;
4) PCIE BRCMSTB driver support for Raspberry PI 5;
5) add clock/reset/gpio drivers;
6) add ethernet support in u-boot.Quoted 5 lines
Quoted 4 lines
This patch-series introducing the basic set of supported drivers in U-Boot which allows using such features as tftp and\or NFS.
I've posted this patch series as RFC because of the following commit:e51ca0d221(HACK: drivers: mfd: set bar configuration for RP1 driver, 2024-05-21)Where is that commit?
This commit is part of the patch series. Here is direct link:
https://lore.kernel.org/u-boot/[email protected]/T/#m21cf23989fb08cb655e25b1a2d082632b6f865c9
Quoted 21 lines
Quoted 9 lines
It includes HACK for rp1 driver in u-boot. This HACK is setting bar address in the correct order because RP1 driver in Linux Kernel rely on the pci BAR configuration which initializes BARs based on BAR size. This results the Linux set BARs in the same order on each boot. U-boot does initialization without any sorting so the configuration may be different from the Linux kernel.
BAR address configuration is set to match the Linux Kernel order to avoid fails on address translation.Quoted 5 lines
This should be changed after upstreaming RP1 driver to the Linux kernel mainline.
Probably somebody from Raspberry will post an advise about how this can be properly done.
+1
Quoted 5 lines
U-Boot support for Raspberry PI 5 was added in terms of the following
project: https://github.com/xen-troops/meta-xt-prod-devel-rpi5
This is xen-based dom0less system on the Raspberry PI 5 with Zephyr as Control Domain and Linux is Driver Domain.Quoted 4 lines
Quoted 2 lines
It is Yocto-based so it will be easy to build it on your side. Please visit link for the details.
I tried to apply this but I get a lot of conflicts. Can you please advise what tree it is based on?
Yocto build using the following repo:
Quoted 8 lines
https://github.com/xen-troops/u-boot/tree/rpi5-2024.04-xt
It is based on the 7-8 month old master. I didn't do any rebase on the top because
it's unclear if these changes will go to upstream.
So I've posted RFC before making significant changes.
If these add more support for rpi5 your patches would definitely be welcome.
I tried out your tree, but did not see USB for the two sticks I put in:
$ ub-int rpi5 Building U-Boot in sourcedir for rpi_arm64 Bootstrapping U-Boot from dir /tmp/b/rpi_arm64 Writing U-Boot using method rpi5 cat: /sys/class/block/sdf1/size: No such file or directory cat: /sys/class/block/sdf1/size: No such file or directory cat: /sys/class/block/sdf1/size: No such file or directory cat: /sys/class/block/sdf1/size: No such file or directory
4.28 RPi: BOOTSYS release VERSION:6fe0b091 DATE: 2024/06/05 TIME: 16:41:49 4.32 BOOTMODE: 0x06 partition 0 build-ts BUILD_TIMESTAMP=1717602109
serial 648a6bdf boardrev b04170 stc 4532726
4.42 AON_RESET: 00000003 PM_RSTS 00001000
4.50 RP1_BOOT chip ID: 0x20001927
4.52 PM_RSTS: 0x00001000
4.53 part 00000000 reset_info 00000000
4.56 PMIC reset-event 00000000 rtc 00000004 alarm 00000000 enabled 0 4.63 uSD voltage 3.3V
4.82 Initialising SDRAM 'Micron' 16Gb x1 total-size: 16 Gbit 4267 4.85 DDR 4267 0 0 16 152
5.26 OTP boardrev b04170 bootrom a a
5.27 Customer key hash
0000000000000000000000000000000000000000000000000000000000000000
5.34 VC-JTAG unlocked
5.57 RP1_BOOT chip ID: 0x20001927
6.62 RP1_BOOT chip ID: 0x20001927
6.63 RP1_BOOT: fw size 25992
6.18 PCI2 init
6.18 PCI2 reset
6.63 PCIe scan 00001de4:00000001
6.63 RP1_CHIP_INFO 20001927
6.66 RPi: BOOTLOADER release VERSION:6fe0b091 DATE: 2024/06/05 TIME: 16:41:49 6.73 BOOTMODE: 0x06 partition 0 build-ts BUILD_TIMESTAMP=1717602109
serial 648a6bdf boardrev b04170 stc 6873270
6.83 AON_RESET: 00000003 PM_RSTS 00001000
6.87 PCIEx1: PWR 0 DET_WAKE 0
6.90 M.2 PCIe HAT not detected.
6.14 usb_pd_init status 1
6.18 XHCI-STOP
6.18 xHC0 ver: 272 HCS: 03000440 140000f1 07ff000a HCC: 0240fe6d 6.22 USBSTS 1
6.25 xHC0 ver: 272 HCS: 03000440 140000f1 07ff000a HCC: 0240fe6d 6.30 xHC0 ports 3 slots 64 intrs 4
6.42 XHCI-STOP
6.42 xHC1 ver: 272 HCS: 03000440 140000f1 07ff000a HCC: 0240fe6d 6.46 USBSTS 1
6.49 xHC1 ver: 272 HCS: 03000440 140000f1 07ff000a HCC: 0240fe6d 6.54 xHC1 ports 3 slots 64 intrs 4
6.62 Boot mode: SD (01) order f4
7.00 USB3[3] 00021203 connected enabled
7.00 USB3 root HUB port 3 init
7.05 DEV [01:00] 3.32 000000:03 class 0 VID 0781 PID 5581
7.09 MSD device [01:00] 3.32 000000:03 conf 0 iface 0 ep 81#1024 02#1024 7.16 MSD [01:00] 3.32 000000:03 register MSD
7.52 USB2[2] 000206e1 connected
7.02 USB2[2] 00200e03 connected enabled
7.03 USB2 root HUB port 2 init
7.09 DEV [01:00] 2.16 000000:02 class 0 VID 090c PID 1000
7.11 MSD device [01:00] 2.16 000000:02 conf 0 iface 0 ep 82#512 01#512 7.19 MSD [01:00] 2.16 000000:02 register MSD
7.76 SD HOST: 200000000 CTL0: 0x00800000 BUS: 400000 Hz actual:
390625 HZ div: 512 (256) status: 0x1fff0000 delay: 276
7.87 SD HOST: 200000000 CTL0: 0x00800f00 BUS: 400000 Hz actual:
390625 HZ div: 512 (256) status: 0x1fff0000 delay: 276
7.21 OCR c0ff8000 [40]
CID: 0027504853443332476075149214017b
CSD: 400e00325b590000e6e97f800a400000
7.29 SD: bus-width: 4 spec: 2 SCR: 0x02858083 0x00000000
7.37 SD HOST: 200000000 CTL0: 0x00800f04 BUS: 50000000 Hz actual:
50000000 HZ div: 4 (2) status: 0x1fff0000 delay: 2
7.46 MBR: 0x00000800, 1048576 type: 0x0c
7.48 MBR: 0x00100800,17020996 type: 0x83
7.52 MBR: 0x00000000, 0 type: 0x00
7.56 MBR: 0x00000000, 0 type: 0x00
7.60 Trying partition: 0
7.63 type: 32 lba: 2048 'mkfs.fat' ' system-boot' clusters 1032412 (1) 7.69 rsc 32 fat-sectors 8066 root dir cluster 2 sectors 0 entries 0 7.75 FAT32 clusters 1032412
7.81 [sdcard] autoboot.txt not found
7.82 Select partition rsts 0 C(boot_partition) 0 EEPROM config 0 result 0 7.89 Trying partition: 0
7.92 type: 32 lba: 2048 'mkfs.fat' ' system-boot' clusters 1032408 (1) 7.98 rsc 32 fat-sectors 8066 root dir cluster 2 sectors 0 entries 0 7.04 FAT32 clusters 1032408
7.11 Read config.txt bytes 1680 hnd 0x2fc7d
7.14 [sdcard] pieeprom.upd not found
7.16 usb_max_current_enable default 0 max-current 900
7.28 Read bcm2712-rpi-5-b.dtb bytes 80206 hnd 0x352
7.30 dt-match: compatible: raspberrypi,5-model-b match: brcm,bcm2712 7.37 dt-match: compatible: brcm,bcm2712 match: brcm,bcm2712
7.43 Selecting USB low current limit
NOTICE: BL31: v2.6(release):v2.6-239-g2a9ede0bd NOTICE: BL31: Built : 14:26:57, Jun 22 2023
U-Boot 2024.04-00714-gb81bc374c35 (Feb 06 2025 - 08:56:18 -0700)
DRAM: 1020 MiB (effective 2 GiB)
RPI 5 Model B (0xb04170)
Core: 54 devices, 15 uclasses, devicetree: board MMC: mmc@fff000: 0, mmc@1100000: 1 Loading Environment from FAT... Unable to read "uboot.env" from mmc0:1... In: serial,usbkbd Out: serial,vidconsole Err: serial,vidconsole mbox: Header response code invalid bcm2835: Could not query MAC address PCIe BRCM: link up, 5.0 Gbps x4 (!SSC) Net: eth0: ethernet@100000
starting USB...
Bus usb@480000: USB DWC2
scanning bus usb@480000 for devices... 1 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot: 0
U-Boot> dm tree
Class Index Probed Driver Name
-----------------------------------------------------------
root 0 [ + ] root_driver root_driver clk 0 [ ] fixed_clock |-- clk-27M clk 1 [ ] fixed_clock |-- clk-108M simple_bus 0 [ + ] simple_bus |-- soc serial 0 [ + ] serial_pl01x | |-- serial@7d001000 rng 0 [ ] iproc_rng200-rng | |-- rng@7d208000 simple_bus 1 [ ] simple_bus | |-- avs-monitor@7d542000 simple_bus 2 [ ] simple_bus | |-- firmware reset 0 [ ] raspberrypi-reset | | `-- reset simple_bus 3 [ ] simple_bus | `-- nvmem simple_bus 4 [ + ] simple_bus |-- axi reset 1 [ + ] brcmstb-reset-rescal | |-- reset-controller@119500 pci 0 [ + ] pcie_brcm | |-- pcie@120000 simple_bus 5 [ + ] simple_bus | | |-- rp1 clk 2 [ + ] rp1-clk | | | |-- clocks@18000 gpio 0 [ + ] rp1-gpio | | | |-- gpio@d0000 ethernet 0 [ + ] eth_macb | | | `-- ethernet@100000 bootdev 0 [ ] eth_bootdev | | | `-- [email protected] pci 1 [ + ] pci_bridge_drv | | `-- pci_0:0.0 pci_generi 0 [ + ] rp1 | | `-- rp1 simple_bus 6 [ ] simple_bus | |-- syscon@400018 usb 0 [ + ] dwc2_usb | |-- usb@480000 usb_hub 0 [ + ] usb_hub | | `-- usb_hub mmc 0 [ + ] sdhci-bcmstb | |-- mmc@fff000 blk 0 [ + ] mmc_blk | | |-- [email protected] partition 0 [ + ] blk_partition | | | |-- [email protected]:1 partition 1 [ + ] blk_partition | | | `-- [email protected]:2 bootdev 1 [ ] mmc_bootdev | | `-- [email protected] mmc 1 [ + ] sdhci-bcmstb | |-- mmc@1100000 blk 1 [ ] mmc_blk | | |-- [email protected] bootdev 2 [ ] mmc_bootdev | | `-- [email protected] reset 2 [ + ] brcmstb-reset | `-- reset-controller@1504318 simple_bus 7 [ + ] simple_bus |-- clocks clk 3 [ ] fixed_clock | |-- clk-osc clk 4 [ + ] fixed_clock | |-- clk-usb clk 5 [ ] fixed_clock | |-- clk_vpu clk 6 [ + ] fixed_clock | |-- clk_uart clk 7 [ ] fixed_clock | |-- clk_emmc2 clk 8 [ ] fixed_clock | |-- clk_xosc clk 9 [ + ] fixed_clock | |-- macb_pclk clk 10 [ + ] fixed_clock | |-- macb_hclk clk 11 [ ] fixed_clock | |-- sdio_src clk 12 [ ] fixed_clock | `-- sdhci_core clk 13 [ ] fixed_clock |-- clk-osc clk 14 [ ] fixed_clock |-- clk-usb clk 15 [ ] fixed_clock |-- clk_vpu clk 16 [ ] fixed_clock |-- clk_uart clk 17 [ ] fixed_clock |-- clk_emmc2 clk 18 [ ] fixed_clock |-- clk_xosc clk 19 [ ] fixed_clock |-- macb_pclk clk 20 [ ] fixed_clock |-- macb_hclk clk 21 [ ] fixed_clock |-- sdio_src clk 22 [ ] fixed_clock |-- sdhci_core bootstd 0 [ ] bootstd_drv `-- bootstd bootmeth 0 [ ] bootmeth_extlinux |-- extlinux bootmeth 1 [ ] bootmeth_script |-- script bootmeth 2 [ ] bootmeth_efi_mgr |-- efi_mgr bootmeth 3 [ ] bootmeth_efi |-- efi bootmeth 4 [ ] bootmeth_pxe `-- pxe
U-Boot>
Regards,
Simon
Hi Simon,
Please see below.
Quoted 64 lines · Simon Glass
Hi Oleksii,
Quoted 60 lines · Oleksii Moisieiev
Hi Simon.
Please see below.
-- Oleski
Quoted 15 lines · Simon Glass
Hi Oleksii,
Quoted 11 lines · Oleksii Moisieiev
This patch series provides generic support for Raspberry PI 5 in U-Boot with additional hardware drivers.
The following features were implemented:
1) add generic board config for Raspberry PI5 including device-tree files;
2) add support for RP1 chip with additional hardware;
3) add support for rp1-clock driver with dt-bindings update;
4) PCIE BRCMSTB driver support for Raspberry PI 5;
5) add clock/reset/gpio drivers;
6) add ethernet support in u-boot.Quoted 5 lines
Quoted 4 lines
This patch-series introducing the basic set of supported drivers in U-Boot which allows using such features as tftp and\or NFS.
I've posted this patch series as RFC because of the following commit:e51ca0d221(HACK: drivers: mfd: set bar configuration for RP1 driver, 2024-05-21)Where is that commit?
This commit is part of the patch series. Here is direct link:
https://lore.kernel.org/u-boot/[email protected]/T/#m21cf23989fb08cb655e25b1a2d082632b6f865c9
Quoted 21 lines
Quoted 9 lines
It includes HACK for rp1 driver in u-boot. This HACK is setting bar address in the correct order because RP1 driver in Linux Kernel rely on the pci BAR configuration which initializes BARs based on BAR size. This results the Linux set BARs in the same order on each boot. U-boot does initialization without any sorting so the configuration may be different from the Linux kernel.
BAR address configuration is set to match the Linux Kernel order to avoid fails on address translation.Quoted 5 lines
This should be changed after upstreaming RP1 driver to the Linux kernel mainline.
Probably somebody from Raspberry will post an advise about how this can be properly done.
+1
Quoted 5 lines
U-Boot support for Raspberry PI 5 was added in terms of the following
project: https://github.com/xen-troops/meta-xt-prod-devel-rpi5
This is xen-based dom0less system on the Raspberry PI 5 with Zephyr as Control Domain and Linux is Driver Domain.Quoted 4 lines
Quoted 2 lines
It is Yocto-based so it will be easy to build it on your side. Please visit link for the details.
I tried to apply this but I get a lot of conflicts. Can you please advise what tree it is based on?
Yocto build using the following repo:
Quoted 7 lines
Quoted 6 lines
It is based on the 7-8 month old master. I didn't do any rebase on the top because
it's unclear if these changes will go to upstream.
So I've posted RFC before making significant changes.
If these add more support for rpi5 your patches would definitely be welcome.
If community accepting it I will proceed with rebase to the latest master and post
v2. But there are still questions about "HACK" and regarding device-tree bindings which
still weren't upstreamed by Raspberry to the Linux kernel. So I'm asking the community if
dt-bindings that could be completely changed in future are acceptable at least for now.
Quoted 183 lines
I tried out your tree, but did not see USB for the two sticks I put in:
$ ub-int rpi5 Building U-Boot in sourcedir for rpi_arm64 Bootstrapping U-Boot from dir /tmp/b/rpi_arm64 Writing U-Boot using method rpi5 cat: /sys/class/block/sdf1/size: No such file or directory cat: /sys/class/block/sdf1/size: No such file or directory cat: /sys/class/block/sdf1/size: No such file or directory cat: /sys/class/block/sdf1/size: No such file or directory4.28 RPi: BOOTSYS release VERSION:6fe0b091 DATE: 2024/06/05 TIME: 16:41:49 4.32 BOOTMODE: 0x06 partition 0 build-ts BUILD_TIMESTAMP=1717602109serial
648a6bdfboardrev b04170 stc 4532726
4.42AON_RESET: 00000003PM_RSTS00001000
4.50RP1_BOOTchip ID:0x20001927
4.52PM_RSTS:0x00001000
4.53 part 00000000reset_info00000000
4.56 PMIC reset-event 00000000 rtc 00000004 alarm 00000000 enabled 0 4.63 uSD voltage 3.3V
4.82 Initialising SDRAM 'Micron' 16Gb x1 total-size: 16 Gbit 4267 4.85 DDR 4267 0 0 16 152
5.26 OTP boardrev b04170 bootrom a a
5.27 Customer key hash
0000000000000000000000000000000000000000000000000000000000000000
5.34 VC-JTAG unlocked
5.57RP1_BOOTchip ID:0x200019276.62 RP1_BOOT chip ID: 0x20001927 6.63 RP1_BOOT: fw size 25992 6.18 PCI2 init 6.18 PCI2 reset 6.63 PCIe scan 00001de4:00000001 6.63 RP1_CHIP_INFO 20001927 6.66 RPi: BOOTLOADER release VERSION:6fe0b091 DATE: 2024/06/05 TIME: 16:41:49 6.73 BOOTMODE: 0x06 partition 0 build-ts BUILD_TIMESTAMP=1717602109serial
648a6bdfboardrev b04170 stc 6873270
6.83AON_RESET: 00000003PM_RSTS00001000
6.87 PCIEx1: PWR 0DET_WAKE0
6.90 M.2 PCIe HAT not detected.
6.14usb_pd_initstatus 1
6.18 XHCI-STOP
6.18 xHC0 ver: 272 HCS: 03000440140000f107ff000aHCC:0240fe6d6.22 USBSTS 1
6.25 xHC0 ver: 272 HCS: 03000440140000f107ff000aHCC:0240fe6d6.30 xHC0 ports 3 slots 64 intrs 4
6.42 XHCI-STOP
6.42 xHC1 ver: 272 HCS: 03000440140000f107ff000aHCC:0240fe6d6.46 USBSTS 1
6.49 xHC1 ver: 272 HCS: 03000440140000f107ff000aHCC:0240fe6d6.54 xHC1 ports 3 slots 64 intrs 4
6.62 Boot mode: SD (01) order f4
7.00 USB3[3] 00021203 connected enabled
7.00 USB3 root HUB port 3 init
7.05 DEV [01:00] 3.32 000000:03 class 0 VID 0781 PID 5581 7.09 MSD device [01:00] 3.32 000000:03 conf 0 iface 0 ep 81#1024 02#1024 7.16 MSD [01:00] 3.32 000000:03 register MSD
7.52 USB2[2]000206e1connected
7.02 USB2[2]00200e03connected enabled
7.03 USB2 root HUB port 2 init
7.09 DEV [01:00] 2.16 000000:02 class 0 VID 090c PID 1000 7.11 MSD device [01:00] 2.16 000000:02 conf 0 iface 0 ep 82#512 01#512 7.19 MSD [01:00] 2.16 000000:02 register MSD
7.76 SD HOST: 200000000 CTL0:0x00800000BUS: 400000 Hz actual:
390625 HZ div: 512 (256) status:0x1fff0000delay: 276
7.87 SD HOST: 200000000 CTL0:0x00800f00BUS: 400000 Hz actual:
390625 HZ div: 512 (256) status:0x1fff0000delay: 276
7.21 OCRc0ff8000[40]
CID:0027504853443332476075149214017b
CSD:400e00325b590000e6e97f800a400000
7.29 SD: bus-width: 4 spec: 2 SCR:0x028580830x00000000
7.37 SD HOST: 200000000 CTL0:0x00800f04BUS: 50000000 Hz actual:
50000000 HZ div: 4 (2) status:0x1fff0000delay: 2
7.46 MBR:0x00000800, 1048576 type:0x0c
7.48 MBR: 0x00100800,17020996 type:0x83
7.52 MBR:0x00000000, 0 type:0x00
7.56 MBR:0x00000000, 0 type:0x00
7.60 Trying partition: 0
7.63 type: 32 lba: 2048 'mkfs.fat' ' system-boot' clusters 1032412 (1) 7.69 rsc 32 fat-sectors 8066 root dir cluster 2 sectors 0 entries 0 7.75 FAT32 clusters 1032412
7.81 [sdcard] autoboot.txt not found
7.82 Select partition rsts 0C(boot_partition)0 EEPROM config 0 result 0 7.89 Trying partition: 0
7.92 type: 32 lba: 2048 'mkfs.fat' ' system-boot' clusters 1032408 (1) 7.98 rsc 32 fat-sectors 8066 root dir cluster 2 sectors 0 entries 0 7.04 FAT32 clusters 1032408
7.11 Read config.txt bytes 1680 hnd0x2fc7d
7.14 [sdcard] pieeprom.upd not found
7.16usb_max_current_enabledefault 0 max-current 900
7.28 Read bcm2712-rpi-5-b.dtb bytes 80206 hnd0x352
7.30 dt-match: compatible: raspberrypi,5-model-b match: brcm,bcm2712 7.37 dt-match: compatible: brcm,bcm2712 match: brcm,bcm2712 7.43 Selecting USB low current limitNOTICE: BL31: v2.6(release):v2.6-239-g2a9ede0bd NOTICE: BL31: Built : 14:26:57, Jun 22 2023U-Boot 2024.04-00714-gb81bc374c35 (Feb 06 2025 - 08:56:18 -0700)
DRAM: 1020 MiB (effective 2 GiB)
RPI 5 Model B (0xb04170)Core: 54 devices, 15 uclasses, devicetree: board MMC: mmc@fff000: 0, mmc@1100000: 1 Loading Environment from FAT... Unable to read "uboot.env" from mmc0:1... In: serial,usbkbd Out: serial,vidconsole Err: serial,vidconsole mbox: Header response code invalid bcm2835: Could not query MAC address PCIe BRCM: link up, 5.0 Gbps x4 (!SSC) Net: eth0: ethernet@100000starting USB...
Bus usb@480000: USB DWC2
scanning bus usb@480000 for devices... 1 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot: 0
U-Boot> dm tree
Class Index Probed Driver Name
-----------------------------------------------------------root 0 [ + ] root_driver root_driver clk 0 [ ] fixed_clock |-- clk-27M clk 1 [ ] fixed_clock |-- clk-108M simple_bus 0 [ + ] simple_bus |-- soc serial 0 [ + ] serial_pl01x | |-- serial@7d001000 rng 0 [ ] iproc_rng200-rng | |-- rng@7d208000 simple_bus 1 [ ] simple_bus | |-- avs-monitor@7d542000 simple_bus 2 [ ] simple_bus | |-- firmware reset 0 [ ] raspberrypi-reset | | `-- reset simple_bus 3 [ ] simple_bus | `-- nvmem simple_bus 4 [ + ] simple_bus |-- axi reset 1 [ + ] brcmstb-reset-rescal | |-- reset-controller@119500 pci 0 [ + ] pcie_brcm | |-- pcie@120000 simple_bus 5 [ + ] simple_bus | | |-- rp1 clk 2 [ + ] rp1-clk | | | |-- clocks@18000 gpio 0 [ + ] rp1-gpio | | | |-- gpio@d0000 ethernet 0 [ + ] eth_macb | | | `-- ethernet@100000 bootdev 0 [ ] eth_bootdev | | | `-- [email protected] pci 1 [ + ] pci_bridge_drv | | `-- pci_0:0.0 pci_generi 0 [ + ] rp1 | | `-- rp1 simple_bus 6 [ ] simple_bus | |-- syscon@400018 usb 0 [ + ] dwc2_usb | |-- usb@480000 usb_hub 0 [ + ] usb_hub | | `-- usb_hub mmc 0 [ + ] sdhci-bcmstb | |-- mmc@fff000 blk 0 [ + ] mmc_blk | | |-- [email protected] partition 0 [ + ] blk_partition | | | |-- [email protected]:1 partition 1 [ + ] blk_partition | | | `-- [email protected]:2 bootdev 1 [ ] mmc_bootdev | | `-- [email protected] mmc 1 [ + ] sdhci-bcmstb | |-- mmc@1100000 blk 1 [ ] mmc_blk | | |-- [email protected] bootdev 2 [ ] mmc_bootdev | | `-- [email protected] reset 2 [ + ] brcmstb-reset | `-- reset-controller@1504318 simple_bus 7 [ + ] simple_bus |-- clocks clk 3 [ ] fixed_clock | |-- clk-osc clk 4 [ + ] fixed_clock | |-- clk-usb clk 5 [ ] fixed_clock | |-- clk_vpu clk 6 [ + ] fixed_clock | |-- clk_uart clk 7 [ ] fixed_clock | |-- clk_emmc2 clk 8 [ ] fixed_clock | |-- clk_xosc clk 9 [ + ] fixed_clock | |-- macb_pclk clk 10 [ + ] fixed_clock | |-- macb_hclk clk 11 [ ] fixed_clock | |-- sdio_src clk 12 [ ] fixed_clock | `-- sdhci_core clk 13 [ ] fixed_clock |-- clk-osc clk 14 [ ] fixed_clock |-- clk-usb clk 15 [ ] fixed_clock |-- clk_vpu clk 16 [ ] fixed_clock |-- clk_uart clk 17 [ ] fixed_clock |-- clk_emmc2 clk 18 [ ] fixed_clock |-- clk_xosc clk 19 [ ] fixed_clock |-- macb_pclk clk 20 [ ] fixed_clock |-- macb_hclk clk 21 [ ] fixed_clock |-- sdio_src clk 22 [ ] fixed_clock |-- sdhci_core bootstd 0 [ ] bootstd_drv `-- bootstd bootmeth 0 [ ] bootmeth_extlinux |-- extlinux bootmeth 1 [ ] bootmeth_script |-- script bootmeth 2 [ ] bootmeth_efi_mgr |-- efi_mgr bootmeth 3 [ ] bootmeth_efi |-- efi bootmeth 4 [ ] bootmeth_pxe `-- pxe
Quoted 1 line
U-Boot>
Many thanks for testing this out. I see pci and rp1 driver were initialized. To be honest we haven't tested USB
in u-boot. Mostly rely on SDCard. As I can see that 1 USB Device was found so I suppose that device-tree should be fixed.
Anyway, USB support is not in the scope of this patch-series.
Quoted 2 lines
Regards,
Simon
Quoted 81 lines · Oleksii Moisieiev
Hi Simon,
Please see below.
Quoted 64 lines · Simon Glass
Hi Oleksii,
Quoted 60 lines · Oleksii Moisieiev
Hi Simon.
Please see below.
-- Oleski
Quoted 15 lines · Simon Glass
Hi Oleksii,
Quoted 11 lines · Oleksii Moisieiev
This patch series provides generic support for Raspberry PI 5 in U-Boot with additional hardware drivers.
The following features were implemented:
1) add generic board config for Raspberry PI5 including device-tree files;
2) add support for RP1 chip with additional hardware;
3) add support for rp1-clock driver with dt-bindings update;
4) PCIE BRCMSTB driver support for Raspberry PI 5;
5) add clock/reset/gpio drivers;
6) add ethernet support in u-boot.Quoted 5 lines
Quoted 4 lines
This patch-series introducing the basic set of supported drivers in U-Boot which allows using such features as tftp and\or NFS.
I've posted this patch series as RFC because of the following commit:e51ca0d221(HACK: drivers: mfd: set bar configuration for RP1 driver, 2024-05-21)Where is that commit?
This commit is part of the patch series. Here is direct link:
https://lore.kernel.org/u-boot/[email protected]/T/#m21cf23989fb08cb655e25b1a2d082632b6f865c9
Quoted 21 lines
Quoted 9 lines
It includes HACK for rp1 driver in u-boot. This HACK is setting bar address in the correct order because RP1 driver in Linux Kernel rely on the pci BAR configuration which initializes BARs based on BAR size. This results the Linux set BARs in the same order on each boot. U-boot does initialization without any sorting so the configuration may be different from the Linux kernel.
BAR address configuration is set to match the Linux Kernel order to avoid fails on address translation.Quoted 5 lines
This should be changed after upstreaming RP1 driver to the Linux kernel mainline.
Probably somebody from Raspberry will post an advise about how this can be properly done.
+1
Quoted 5 lines
U-Boot support for Raspberry PI 5 was added in terms of the following
project: https://github.com/xen-troops/meta-xt-prod-devel-rpi5
This is xen-based dom0less system on the Raspberry PI 5 with Zephyr as Control Domain and Linux is Driver Domain.Quoted 4 lines
Quoted 2 lines
It is Yocto-based so it will be easy to build it on your side. Please visit link for the details.
I tried to apply this but I get a lot of conflicts. Can you please advise what tree it is based on?
Yocto build using the following repo:
Quoted 7 lines
Quoted 6 lines
It is based on the 7-8 month old master. I didn't do any rebase on the top because
it's unclear if these changes will go to upstream.
So I've posted RFC before making significant changes.
If these add more support for rpi5 your patches would definitely be welcome.
If community accepting it I will proceed with rebase to the latest master and post
Quoted 8 lines
v2. But there are still questions about "HACK" and regarding device-tree bindings which
still weren't upstreamed by Raspberry to the Linux kernel. So I'm asking the community if
dt-bindings that could be completely changed in future are acceptable at least for now.
So long as you're willing to update the bindings when upstream Pi properly upstreams them, yes. Thanks.
Signature · 1 line
Tom
Quoted 84 lines · Tom Rini
Quoted 83 lines · Oleksii Moisieiev
Hi Simon,
Please see below.
Quoted 64 lines · Simon Glass
Hi Oleksii,
Quoted 60 lines · Oleksii Moisieiev
Hi Simon.
Please see below.
-- Oleski
Quoted 15 lines · Simon Glass
Hi Oleksii,
Quoted 11 lines · Oleksii Moisieiev
This patch series provides generic support for Raspberry PI 5 in U-Boot with additional hardware drivers.
The following features were implemented:
1) add generic board config for Raspberry PI5 including device-tree files;
2) add support for RP1 chip with additional hardware;
3) add support for rp1-clock driver with dt-bindings update;
4) PCIE BRCMSTB driver support for Raspberry PI 5;
5) add clock/reset/gpio drivers;
6) add ethernet support in u-boot.Quoted 5 lines
Quoted 4 lines
This patch-series introducing the basic set of supported drivers in U-Boot which allows using such features as tftp and\or NFS.
I've posted this patch series as RFC because of the following commit:e51ca0d221(HACK: drivers: mfd: set bar configuration for RP1 driver, 2024-05-21)Where is that commit?
This commit is part of the patch series. Here is direct link:
https://lore.kernel.org/u-boot/[email protected]/T/#m21cf23989fb08cb655e25b1a2d082632b6f865c9
Quoted 21 lines
Quoted 9 lines
It includes HACK for rp1 driver in u-boot. This HACK is setting bar address in the correct order because RP1 driver in Linux Kernel rely on the pci BAR configuration which initializes BARs based on BAR size. This results the Linux set BARs in the same order on each boot. U-boot does initialization without any sorting so the configuration may be different from the Linux kernel.
BAR address configuration is set to match the Linux Kernel order to avoid fails on address translation.Quoted 5 lines
This should be changed after upstreaming RP1 driver to the Linux kernel mainline.
Probably somebody from Raspberry will post an advise about how this can be properly done.
+1
Quoted 5 lines
U-Boot support for Raspberry PI 5 was added in terms of the following
project: https://github.com/xen-troops/meta-xt-prod-devel-rpi5
This is xen-based dom0less system on the Raspberry PI 5 with Zephyr as Control Domain and Linux is Driver Domain.Quoted 4 lines
Quoted 2 lines
It is Yocto-based so it will be easy to build it on your side. Please visit link for the details.
I tried to apply this but I get a lot of conflicts. Can you please advise what tree it is based on?
Yocto build using the following repo:
Quoted 7 lines
Quoted 6 lines
It is based on the 7-8 month old master. I didn't do any rebase on the top because
it's unclear if these changes will go to upstream.
So I've posted RFC before making significant changes.
If these add more support for rpi5 your patches would definitely be welcome.
If community accepting it I will proceed with rebase to the latest master and post
v2. But there are still questions about "HACK" and regarding device-tree bindings which
Quoted 8 lines
Quoted 5 lines
still weren't upstreamed by Raspberry to the Linux kernel. So I'm asking the community if
dt-bindings that could be completely changed in future are acceptable at least for now.
So long as you're willing to update the bindings when upstream Pi properly upstreams them, yes. Thanks.
Hi Tom,
I've expected that. Hoping that somebody from Raspberry will appear.
Anyway I think this series is the good base to start discussions.
Oleksii.
Hi Tom,
Quoted 84 lines · Tom Rini
Quoted 83 lines · Oleksii Moisieiev
Hi Simon,
Please see below.
Quoted 64 lines · Simon Glass
Hi Oleksii,
Quoted 60 lines · Oleksii Moisieiev
Hi Simon.
Please see below.
-- Oleski
Quoted 15 lines · Simon Glass
Hi Oleksii,
Quoted 11 lines · Oleksii Moisieiev
This patch series provides generic support for Raspberry PI 5 in U-Boot with additional hardware drivers.
The following features were implemented:
1) add generic board config for Raspberry PI5 including device-tree files;
2) add support for RP1 chip with additional hardware;
3) add support for rp1-clock driver with dt-bindings update;
4) PCIE BRCMSTB driver support for Raspberry PI 5;
5) add clock/reset/gpio drivers;
6) add ethernet support in u-boot.Quoted 5 lines
Quoted 4 lines
This patch-series introducing the basic set of supported drivers in U-Boot which allows using such features as tftp and\or NFS.
I've posted this patch series as RFC because of the following commit:e51ca0d221(HACK: drivers: mfd: set bar configuration for RP1 driver, 2024-05-21)Where is that commit?
This commit is part of the patch series. Here is direct link:
https://lore.kernel.org/u-boot/[email protected]/T/#m21cf23989fb08cb655e25b1a2d082632b6f865c9
Quoted 21 lines
Quoted 9 lines
It includes HACK for rp1 driver in u-boot. This HACK is setting bar address in the correct order because RP1 driver in Linux Kernel rely on the pci BAR configuration which initializes BARs based on BAR size. This results the Linux set BARs in the same order on each boot. U-boot does initialization without any sorting so the configuration may be different from the Linux kernel.
BAR address configuration is set to match the Linux Kernel order to avoid fails on address translation.Quoted 5 lines
This should be changed after upstreaming RP1 driver to the Linux kernel mainline.
Probably somebody from Raspberry will post an advise about how this can be properly done.
+1
Quoted 5 lines
U-Boot support for Raspberry PI 5 was added in terms of the following
project: https://github.com/xen-troops/meta-xt-prod-devel-rpi5
This is xen-based dom0less system on the Raspberry PI 5 with Zephyr as Control Domain and Linux is Driver Domain.Quoted 4 lines
Quoted 2 lines
It is Yocto-based so it will be easy to build it on your side. Please visit link for the details.
I tried to apply this but I get a lot of conflicts. Can you please advise what tree it is based on?
Yocto build using the following repo:
Quoted 7 lines
Quoted 6 lines
It is based on the 7-8 month old master. I didn't do any rebase on the top because
it's unclear if these changes will go to upstream.
So I've posted RFC before making significant changes.
If these add more support for rpi5 your patches would definitely be welcome.
If community accepting it I will proceed with rebase to the latest master and post
v2. But there are still questions about "HACK" and regarding device-tree bindings which
Quoted 8 lines
Quoted 5 lines
still weren't upstreamed by Raspberry to the Linux kernel. So I'm asking the community if
dt-bindings that could be completely changed in future are acceptable at least for now.
So long as you're willing to update the bindings when upstream Pi properly upstreams them, yes. Thanks.
I've reached to the Raspberry team. They are working on upstream.
--
Oleksii
Le 05/02/2025 à 11:15, Oleksii Moisieiev a écrit :
Quoted 11 lines
This patch series provides generic support for Raspberry PI 5 in U-Boot with additional hardware drivers.
The following features were implemented:
1) add generic board config for Raspberry PI5 including device-tree files;
2) add support for RP1 chip with additional hardware;
3) add support for rp1-clock driver with dt-bindings update;
4) PCIE BRCMSTB driver support for Raspberry PI 5;
5) add clock/reset/gpio drivers;
6) add ethernet support in u-boot.
Quoted 1 line
[...]
I applied the patch on commit 6e316e3f397b5e01e98c5dd56cdbaab961daeedf (April 15, 2024) and used it for network booting a Raspberry Pi 5 in a WALT platform [1].
Our boot procedure is quite convoluted and in this specific case it involves two network transfers (a small u-boot script first, which is then executed and triggers the download of a FIT image) but I have not noticed any problems. I hope the remaining questions will be quickly sorted out by linux kernel maintainers. Great work Oleksii!
Thanks
Etienne
[1]: https://walt-project.liglab.fr/
Signature · 5 lines
Etienne Dublé CNRS / LIG - Bâtiment IMAG 150 place du Torrent 38400 St Martin d'Hères Bureau 426 - Tel 0457421431
Hi Etienne,
Quoted 2 lines · Etienne Dublé
Quoted 1 line · Oleksii Moisieiev
This patch series provides generic support for Raspberry PI 5 in
[snip]
Quoted 12 lines
Tested-by Etienne Dublé <[email protected]>I applied the patch on commit
6e316e3f397b5e01e98c5dd56cdbaab961daeedf(April 15, 2024) and used it for network booting a Raspberry Pi 5 in a WALT platform [1].
Our boot procedure is quite convoluted and in this specific case it involves two network transfers (a small u-boot script first, which is then executed and triggers the download of a FIT image) but I have not noticed any problems. I hope the remaining questions will be quickly sorted out by linux kernel maintainers. Great work Oleksii!
Quoted 6 lines
Thanks
Etienne
Many thanks for testing this out. I'm waiting for the Raspberry team to finish upstreaming dt bindings and then update this patch series.
Took a brief look on WALT platform - pretty neat solution BTW.
Oleksii.
Hi Oleksii,
I've started to look at this.
Quoted 6 lines · Oleksii Moisieiev
This patch series provides generic support for Raspberry PI 5 in U-Boot with additional hardware drivers.
The following features were implemented:
1) add generic board config for Raspberry PI5 including device-tree files;
We already have basic support for the RPi5 since Jan last year, you can see the patches [1]. This serious should build on that rather than add new duplicated bits. It supports basic serial and mSD support.
Quoted 6 lines
2) add support for RP1 chip with additional hardware;
3) add support for rp1-clock driver with dt-bindings update;
4) PCIE BRCMSTB driver support for Raspberry PI 5;
5) add clock/reset/gpio drivers;
6) add ethernet support in u-boot.
I'll review and test the rest in the context of the existing support.
[1] https://lists.denx.de/pipermail/u-boot/2024-January/543011.html
Quoted 94 lines
This patch-series introducing the basic set of supported drivers in U-Boot which allows using such features as tftp and\or NFS. I've posted this patch series as RFC because of the following commit:
e51ca0d221(HACK: drivers: mfd: set bar configuration for RP1 driver, 2024-05-21)It includes HACK for rp1 driver in u-boot. This HACK is setting bar address in the correct order because RP1 driver in Linux Kernel rely on the pci BAR configuration which initializes BARs based on BAR size. This results the Linux set BARs in the same order on each boot. U-boot does initialization without any sorting so the configuration may be different from the Linux kernel.
BAR address configuration is set to match the Linux Kernel order to avoid fails on address translation.This should be changed after upstreaming RP1 driver to the Linux kernel mainline.
Probably somebody from Raspberry will post an advise about how this can be properly done.
U-Boot support for Raspberry PI 5 was added in terms of the following
project: https://github.com/xen-troops/meta-xt-prod-devel-rpi5
This is xen-based dom0less system on the Raspberry PI 5 with Zephyr as Control Domain and Linux is Driver Domain.It is Yocto-based so it will be easy to build it on your side. Please visit link for the details.
Oleksii Moisieiev (17):
include: dt-bindings: clk: introduce bindings for rp1 clock
include: dt-bindings: mfd: introduce bindings for RP1 driver
arch: arm: mach-bcm283x: add pcie memory region to BCM2712 memmap
arch: arm: mach-bcm283x: add BCM2712 board support
drivers: net: macb: do not includearch/clk.hwhen clocks enabled
drivers: core:of_addr: fixof_get_dma_rangetranslation
board: raspberrypi: rpi: saveboard_typeto theglobal_data
drivers: pci: add BCM2712 support forpcie_brcmstbdriver
drivers: mfd: introduce RP1 chip driver for RPI5
drivers: gpio: add support of RP1 GPIO for Raspberry PI 5
drivers: reset: introduce reset drivers for brcmstb
drivers: clk: introduce clock driver for RP1
drivers: net: macb: introduce ePCI connection support for macb
configs: add support for the Raspberrypi 5 board to default config
HACK: drivers: mfd: set bar configuration for RP1 driver
drivers: pci:pcie_brcmstb: usebus_baseto config PCI device
drivers: pci:pcie_brcmstb: set correct reset state onpcie_removeVolodymyr Babchuk (3):
drivers: pci: take into account thatofnode_read_pci_vendevcan fail
board: raspberrypi: rpi: request RP1 inlate_init
bcm2712: enable linux kernel image headerarch/arm/mach-bcm283x/Kconfig | 8 + arch/arm/mach-bcm283x/init.c | 10 +- board/raspberrypi/rpi/rpi.c | 28 ++ configs/rpi_arm64_defconfig | 19 ++ drivers/clk/Kconfig | 7 + drivers/clk/Makefile | 1 + drivers/clk/clk-rp1.c | 280 ++++++++++++++++++++ drivers/core/of_addr.c | 8 +- drivers/gpio/Kconfig | 7 + drivers/gpio/Makefile | 1 + drivers/gpio/rp1_gpio.c | 374 +++++++++++++++++++++++++++ drivers/mfd/Kconfig | 10 + drivers/mfd/Makefile | 1 + drivers/mfd/rp1.c | 134 ++++++++++ drivers/net/Kconfig | 1 + drivers/net/macb.c | 156 ++++++++--- drivers/net/macb.h | 16 ++ drivers/pci/pci-uclass.c | 9 +- drivers/pci/pcie_brcmstb.c | 328 +++++++++++++++++++++-- drivers/reset/Kconfig | 14 + drivers/reset/Makefile | 2 + drivers/reset/reset-brcmstb-rescal.c | 103 ++++++++ drivers/reset/reset-brcmstb.c | 97 +++++++ include/broadcom/bcm_board_types.h | 25 ++ include/dt-bindings/clk/rp1.h | 56 ++++ include/dt-bindings/mfd/rp1.h | 239 +++++++++++++++++ include/pci_ids.h | 3 + 27 files changed, 1882 insertions(+), 55 deletions(-) create mode 100644 drivers/clk/clk-rp1.c create mode 100644 drivers/gpio/rp1_gpio.c create mode 100644 drivers/mfd/rp1.c create mode 100644 drivers/reset/reset-brcmstb-rescal.c create mode 100644 drivers/reset/reset-brcmstb.c create mode 100644 include/broadcom/bcm_board_types.h create mode 100644 include/dt-bindings/clk/rp1.h create mode 100644 include/dt-bindings/mfd/rp1.h--
2.34.1
Hi Peter,
Quoted 14 lines · Peter Robinson
Hi Oleksii,
I've started to look at this.
On Wed, 5 Feb 2025 at 10:15, Oleksii Moisieiev
<[email protected]> wrote:This patch series provides generic support for Raspberry PI 5 in U-Boot with additional hardware drivers.
The following features were implemented:
1) add generic board config for Raspberry PI5 including device-tree files;
Quoted 3 lines
We already have basic support for the RPi5 since Jan last year, you can see the patches [1]. This serious should build on that rather than add new duplicated bits. It supports basic serial and mSD support.
Thanks mentioning. I will do full rebase after upstreaming of the dt-bindings to the Linux Kernel.
Oleksii
Quoted 17 lines · Oleksii Moisieiev
Hi Peter,
Quoted 14 lines · Peter Robinson
Hi Oleksii,
I've started to look at this.
On Wed, 5 Feb 2025 at 10:15, Oleksii Moisieiev
<[email protected]> wrote:This patch series provides generic support for Raspberry PI 5 in U-Boot with additional hardware drivers.
The following features were implemented:
1) add generic board config for Raspberry PI5 including device-tree files;
Quoted 6 lines
Quoted 3 lines
We already have basic support for the RPi5 since Jan last year, you can see the patches [1]. This serious should build on that rather than add new duplicated bits. It supports basic serial and mSD support.
Thanks mentioning. I will do full rebase after upstreaming of the dt-bindings to the Linux Kernel.
Awesome, thanks.
Quoted 17 lines · Oleksii Moisieiev
Hi Peter,
Quoted 14 lines · Peter Robinson
Hi Oleksii,
I've started to look at this.
On Wed, 5 Feb 2025 at 10:15, Oleksii Moisieiev
<[email protected]> wrote:This patch series provides generic support for Raspberry PI 5 in U-Boot with additional hardware drivers.
The following features were implemented:
1) add generic board config for Raspberry PI5 including device-tree files;
Quoted 7 lines
Quoted 3 lines
We already have basic support for the RPi5 since Jan last year, you can see the patches [1]. This serious should build on that rather than add new duplicated bits. It supports basic serial and mSD support.
Thanks mentioning. I will do full rebase after upstreaming of the dt-bindings to the Linux Kernel.
Oleksii
Thanks Oleksii!
With RP1 (seemingly) coming for 6.17 does this mean we can start testing a V2 in the near(ish) future?
Gijs Peskens
Quoted 22 lines · Gijs Peskens
Quoted 20 lines · Oleksii Moisieiev
Hi Peter,
Quoted 17 lines · Peter Robinson
Hi Oleksii,
I've started to look at this.
On Wed, 5 Feb 2025 at 10:15, Oleksii Moisieiev
<[email protected]> wrote:This patch series provides generic support for Raspberry PI 5 in U-Boot with additional hardware drivers.
The following features were implemented:
1) add generic board config for Raspberry PI5 including device-tree files;We already have basic support for the RPi5 since Jan last year, you can see the patches [1]. This serious should build on that rather than add new duplicated bits. It supports basic serial and mSD support.
Quoted 8 lines
Quoted 4 lines
Thanks mentioning. I will do full rebase after upstreaming of the dt-bindings to the Linux Kernel.
Oleksii
Thanks Oleksii!
With RP1 (seemingly) coming for 6.17 does this mean we can start testing a V2 in he near(ish) future?
It will be at least 6.18, but there's no reason patches can't come in, also they can be broken down into smaller series, thinks like reset and pcie can land before the rest.
Quoted 11 lines · Oleksii Moisieiev
This patch series provides generic support for Raspberry PI 5 in U-Boot with additional hardware drivers.
The following features were implemented:
1) add generic board config for Raspberry PI5 including device-tree files;
2) add support for RP1 chip with additional hardware;
3) add support for rp1-clock driver with dt-bindings update;
4) PCIE BRCMSTB driver support for Raspberry PI 5;
5) add clock/reset/gpio drivers;
6) add ethernet support in u-boot.
Is it possible to get these patches updated for the latest master branch? I'm having trouble with at least patch 9 and 11.
Jonas
Hi Jonas,
I haven't updated the U-Boot patches yet. Currently waiting for RP1 bindings to come into the Linux Kernel.
I see that the brcm-pci driver was updated in the latest revisions, so it should be carefully rebased.
Other patches, including board_late_init, seem not to be a problem.
I will try to do the rebase on master when I have time.
BR,
Oleksii.
Quoted 18 lines · Jonas Kvinge
[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
Quoted 11 lines · Oleksii Moisieiev
This patch series provides generic support for Raspberry PI 5 in U-Boot with additional hardware drivers.
The following features were implemented:
1) add generic board config for Raspberry PI5 including device-tree files;
2) add support for RP1 chip with additional hardware;
3) add support for rp1-clock driver with dt-bindings update;
4) PCIE BRCMSTB driver support for Raspberry PI 5;
5) add clock/reset/gpio drivers;
6) add ethernet support in u-boot.Is it possible to get these patches updated for the latest master branch? I'm having trouble with at least patch 9 and 11.
Jonas
Hi Jonas,
I see that rp1 bindings are already merged so we have started rebase process.
Once we'll done we will send another version on top of the latest master.
Quoted 18 lines · Jonas Kvinge
[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
Quoted 11 lines · Oleksii Moisieiev
This patch series provides generic support for Raspberry PI 5 in U-Boot with additional hardware drivers.
The following features were implemented:
1) add generic board config for Raspberry PI5 including device-tree files;
2) add support for RP1 chip with additional hardware;
3) add support for rp1-clock driver with dt-bindings update;
4) PCIE BRCMSTB driver support for Raspberry PI 5;
5) add clock/reset/gpio drivers;
6) add ethernet support in u-boot.Is it possible to get these patches updated for the latest master branch? I'm having trouble with at least patch 9 and 11.
Jonas
Quoted 6 lines · Oleksii Moisieiev
Hi Jonas,
I see that rp1 bindings are already merged so we have started rebase process.
Once we'll done we will send another version on top of the latest master.
Please also take into account the feedback I have already provided.
Quoted 19 lines · Jonas Kvinge
Quoted 18 lines
[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
Quoted 11 lines · Oleksii Moisieiev
This patch series provides generic support for Raspberry PI 5 in U-Boot with additional hardware drivers.
The following features were implemented:
1) add generic board config for Raspberry PI5 including device-tree files;
2) add support for RP1 chip with additional hardware;
3) add support for rp1-clock driver with dt-bindings update;
4) PCIE BRCMSTB driver support for Raspberry PI 5;
5) add clock/reset/gpio drivers;
6) add ethernet support in u-boot.Is it possible to get these patches updated for the latest master branch? I'm having trouble with at least patch 9 and 11.
Jonas