core: skip parent device nodes without a DT reference when looking for dma-ranges
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Torsten,
Quoted 1 line · Torsten Duwe
core: skip parent device nodes without a DT reference when looking for dma-ranges
How about 'dm: core: walk up to the first DT-associated parent for dma-ranges' ?
Quoted 24 lines
If a device node got created dynamically, there is no guarantee that the parent node has an associated device tree node which could specify dma constraints. Especially PCI(e) enumeration adds intermediate "bus nodes", also dynamically.
Try harder to find the correct configuration by walking up the tree until a DT association is found.
Suggested-by Neil Armstrong <[email protected]>Signed-off-by Torsten Duwe <[email protected]>Reviewed-by Peter Robinson <[email protected]>Tested-by Peter Robinson <[email protected]>
drivers/core/device.c| 14 +++++++++++++-1 file changed, 13 insertions(+), 1 deletion(-)drivers/core/device.c +4
-1@@ -459,7 +459,19 @@ static int device_get_dma_constraints(struct udevice *dev) -if (!CONFIG_IS_ENABLED (DM_DMA ) || !parent || !dev_has_ofnode (parent)) +if (!CONFIG_IS_ENABLED (DM_DMA ) || !parent) +return 0 ; + +/* Look for the first node in the parent chain */
drivers/core/device.c static int device_get_dma_constraints(struct udevice *dev) · line 472
Quoted 10 lines
drivers/core/device.c +9
-0+while (parent) { +if (dev_has_ofnode (parent)) +break ; + + parent =dev_get_parent (parent); + } + +/* No parents have a node, bail out */ +if (!parent)return 0 ;
The comment 'Look for the first node in the parent chain' reads as if the loop finds any node - please make it explicit, e.g. 'Walk up until we find a parent that has a DT node'. The loop itself can drop the break:
while (parent && !dev_has_ofnode(parent))
parent = dev_get_parent(parent);The existing comment immediately below says 'We start parsing for dma-ranges from the device's bus node. This is specially important on nested buses.' When we skip past dynamically-created intermediate buses we are no longer starting at the immediate bus node. I think that is fine because those nodes cannot carry a dma-ranges property anyway, but please spell that out in the commit message.
Regards,
Simon
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 103 lines · Torsten Duwe
Dear maintainers,
(PCI in particular, but also RPi5 folks)
This problem is real, and I have exhaustively searched for solutions.
Recap: device tree descriptions often stop at a bridge device node. PCI enumeration then finds a device hanging off that bridge. It will create a "bus node" named "pci@0,0" or the like, and connect the found device to it. If the bridge has a non-zero offset for inbound accesses,
dev_phys_to_bus, whose job it is to return this offset, will fail to do so in these cases, because it looks only 1 level up. One level up is the bus node, no DT association, so no DMA constraints.I found 3 possible ways to fix this.
Solution A:
search up the tree further than only one level, as patch 1Quoted 33 lines · On Fri, 25 Sep 2026 12:56:15 +0200 (CEST) [email protected] (Torsten Duwe) wrote:
From: Torsten Duwe <[email protected]>
If a device node got created dynamically, there is no guarantee that the parent node has an associated device tree node which could specify dma constraints. Especially PCI(e) enumeration adds intermediate "bus nodes", also dynamically.
Try harder to find the correct configuration by walking up the tree until a DT association is found.
Suggested-by Neil Armstrong <[email protected]>Signed-off-by Torsten Duwe <[email protected]>Reviewed-by Peter Robinson <[email protected]>Tested-by Peter Robinson <[email protected]>--- drivers/core/device.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)drivers/core/device.c +6
-1@@ -459,7 +459,19 @@ static int device_get_dma_constraints(struct udevice *dev)u64 size =0 ;int ret; -if (!CONFIG_IS_ENABLED (DM_DMA ) || !parent || !dev_has_ofnode (parent)) +if (!CONFIG_IS_ENABLED (DM_DMA ) || !parent) +return 0 ; + +/* Look for the first node in the parent chain */ +while (parent) { +if (dev_has_ofnode (parent))drivers/core/device.c static int device_get_dma_constraints(struct udevice *dev) · line 477
Quoted 10 lines
drivers/core/device.c +7
-0+break ; + + parent =dev_get_parent (parent); + } + +/* No parents have a node, bail out */ +if (!parent)return 0 ;/* Solution B:
clone/link the bridge's DT node on bus node creation:drivers/pci/pci-uclass.c +11
-1@@ -780,8 +780,18 @@ static int pci_find_and_bind_driver(struct udevice *parent, find_id->vendor, find_id->device);/* Determine optional OF node */ -if (ofnode_valid (dev_ofnode (parent))) +if (ofnode_valid (dev_ofnode (parent))) {pci_dev_find_ofnode (parent, bdf, &node); +/* +* For devices enumerated dynamically without a matching DT +* entry (e.g. an NVMe or a PCI-to-PCI bridge below a bridge), +* reuse the parent's OF node so the device still has one. This +* lets device_get_dma_constraints() reach the grandparent's +* dma-ranges for dynamically-enumerated devices. +*/ +if (!ofnode_valid (node)) + node =dev_ofnode (parent); + }if (ofnode_valid (node) && !ofnode_is_enabled (node)) {debug ("%s: Ignoring disabled device\n" , __func__);or
Solution C:demand device tree providers always correctly add the bus node, maybe using an overlay file or EEPROM.
Solution A seems to be the least problematic one; it enhances U-Boot's capabilities.
Quoted 7 lines
Solution B is more like the Linux kernel does it, but without allocating its own node, which makes it look a bit hacky.
Solution C would be for an ideal world [TM] ;)
Nonetheless we could at least for the RPi5 craft a DT overlay and send it upstream.What do you think? Who is going to decide on this?
Is there a case where some other platform (and their DT, and not just a convoluted counter-example) would only work with solution B and not solution A? Otherwise, I think A unless Neil or Peter has strong opinions.
Signature · 1 line
Tom
Hi Torsten,
Quoted 5 lines · Torsten Duwe
Solution A seems to be the least problematic one; it enhances U-Boot's capabilities.
Solution B is more like the Linux kernel does it, but without allocating its own node, which makes it look a bit hacky.
I agree with Tom - solution A looks best. The appeal of B is that any later code which asks the dynamic device for its ofnode gets a plausible answer, but that answer is a lie: dev_has_ofnode() would then return true on a device whose properties, compatible string, reg etc. actually belong to an ancestor bridge. Any future caller that assumes 'ofnode present => describes this device' would quietly misread, and the breakage would be far from this file. Keeping the fake-ofnode trick out of the core and localising the walk to device_get_dma_constraints() seems much safer.
Quoted 2 lines
Solution C would be for an ideal world [TM] ;)
Nonetheless we could at least for the RPi5 craft a DT overlay and send it upstream.
An RPi5 overlay would be nice to have regardless, but it does not help the general case where U-Boot enumerates past the last described node, so it is not a substitute for A. I would land A now and treat the overlay as an independent clean-up.
Regards,
Simon
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 2/8] test: add dma-ranges UT for dynamically created nodes
Hi Torsten,
Quoted 12 lines · Torsten Duwe
test: add dma-ranges UT for dynamically created nodes
When devices were found using PCI(e) autoprobing, there is usually a connecting bus node as parent, and the device node itself, both created dynamically without a corresponding device tree node. If the device needs to do inbound PCI transfers, DM looks up the DMA mapping ("dma-ranges") in the parent's DT node; but in this case there is none. Test whether DM is able to find the property on the grandparent node.
Signed-off-by Torsten Duwe <[email protected]>
Quoted 8 lines
arch/sandbox/dts/test.dts| 9 +++++++++test/dm/ofnode.c | 4 ++-- test/dm/phys2bus.c | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 2 deletions(-)When devices were found using PCI(e) autoprobing, there is usually a connecting bus node as parent, and the device node itself, both created dynamically without a corresponding device tree node.
I read this as your discovering something in previous testing, but I think you mean 'When devices are found'
test/dm/phys2bus.c static int dm_test_phys_to_bus(struct unit_test_state *uts) · line 37
Quoted 9 lines
test/dm/phys2bus.c +7
-0@@ -31,6 +31,38 @@ static int dm_test_phys_to_bus(struct unit_test_state *uts) +#if CONFIG_IS_ENABLED (OF_REAL ) +if (uts->of_live) { +/* DMA-ranges are to be found on the grandparent bus node, +* DT nodes neither here nor at parent. +*/ +struct udevice *pdev; +ofnode psave, nsave;
Thanks for the test. I'd rather see this as a separate DM_TEST (e.g. dm_test_phys_to_bus_dyn) - the test name then describes what it does, and the of_live guard becomes a single ut_skip_on() at the top instead of wrapping the whole body. It also avoids the #if in the middle of a function.
test/dm/phys2bus.c static int dm_test_phys_to_bus(struct unit_test_state *uts) · line 33
Quoted 5 lines
test/dm/phys2bus.c +3
-0@@ -31,6 +31,38 @@ static int dm_test_phys_to_bus(struct unit_test_state *uts) +/* pretend the devices were discovered dynamically and have no DT node */ + psave = pdev->node_; + pdev->node_.np =NULL ;
Please don't reach into dev->node_ directly - the struct comment says 'do not access outside driver model'. Use dev_ofnode() to save and dev_set_ofnode(dev, ofnode_null()) to clear; that also stops the test from silently assuming the live-tree representation of ofnode.
test/dm/phys2bus.c static int dm_test_phys_to_bus(struct unit_test_state *uts) · line 33
Quoted 5 lines
test/dm/phys2bus.c +3
-0@@ -31,6 +31,38 @@ static int dm_test_phys_to_bus(struct unit_test_state *uts) +/* DMA-ranges are to be found on the grandparent bus node, +* DT nodes neither here nor at parent. +*/
Multi-line block comment should use kernel style with the opening /* on its own line.
arch/sandbox/dts/test.dts line 666
Quoted 5 lines
arch/sandbox/dts/test.dts +3
-0@@ -664,6 +664,15 @@ + subnode@8 { + compatible = "denx,u-boot-fdt-test"; + };
Stray extra spaces before 'compatible' - the rest of the file uses a single tab of extra indent.
Regards,
Simon
A message that is not in the archive (sent off-list or not yet received): [email protected]
Simon Glass
Reviewed-byRe: [PATCH 3/8] configs: enable NVMe on RPi4 and RPi5
Quoted 10 lines · Torsten Duwe
configs: enable NVMe on RPi4 and RPi5
Enable NVMe in the Raspberry Pi 64-Bit default config and scan for devices.
Signed-off-by Torsten Duwe <[email protected]>Reviewed-by Peter Robinson <[email protected]>Tested-by Peter Robinson <[email protected]>configs/rpi_arm64_defconfig | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 4/8] clk: add support for RPi5 RP1 chip clk
Hi Torsten,
Quoted 8 lines · Torsten Duwe
clk: add support for RPi5 RP1 chip clk
Add a driver for the clocks in RP1, starting with
ETH_TSU. Derived from Linuxdrivers/clk/clk-rp1.c.Signed-off-by Torsten Duwe <[email protected]>Co-authored-by Oleksii Moisieiev <[email protected]>
Quoted 6 lines
configs/rpi_arm64_defconfig | 2 +
drivers/clk/Kconfig | 7 ++ drivers/clk/Makefile | 1 + drivers/clk/clk-rp1.c | 280 ++++++++++++++++++++++++++++++++++++++++++ include/dt-bindings/clk/rp1.h | 56 +++++++++ 5 files changed, 346 insertions(+)
Please expand the commit message to explain the motivation - which downstream driver in this series needs the ETH_TSU clock and why the other RP1 clocks are deliberately left as stubs. A one-line summary and a "derived from Linux" line does not really tell reviewers what to expect.
drivers/clk/clk-rp1.c line 9
Quoted 11 lines
drivers/clk/clk-rp1.c +9
-0@@ -0,0 +1,280 @@ +struct rp1_pll_core_data { +const char *name; +u32 cs_reg; +u32 pwr_reg; +u32 fbdiv_int_reg; +u32 fbdiv_frac_reg; +unsigned long flags; +u32 fc0_src; +};
None of rp1_pll_core_data, rp1_pll_data, rp1_pll_ph_data, rp1_pll_divider_data, rp1_pll_core, rp1_pll, rp1_pll_ph, rp1_clk_change or rp1_clk_chg_tree[3] are referenced anywhere in the driver. Please drop the dead scaffolding - a follow-up patch can add these back when the corresponding clock support is actually implemented.
drivers/clk/clk-rp1.c line 6
Quoted 8 lines
drivers/clk/clk-rp1.c +6
-0@@ -0,0 +1,280 @@ +struct rp1_clk_change { +struct clk *hw; +unsigned long new_rate; +}; + +struct rp1_clk_change rp1_clk_chg_tree[3 ];
Non-static global - if this were needed it would need to be static, but as noted above it is unused and should just be removed.
drivers/clk/clk-rp1.c line 8
Quoted 10 lines
drivers/clk/clk-rp1.c +8
-0@@ -0,0 +1,280 @@ +static ulong rp1_clock_set_rate (struct clk *hw,unsigned long rate) +{ +struct rp1_clockman *clockman =dev_get_priv (hw->dev); +const struct rp1_clock_data *data = &rp1_data[hw->id]; +u32 div =rp1_clock_choose_div (rate,0x2faf080 , data); + +if (hw->id !=RP1_CLK_ETH_TSU ) +return 0 ;
Two problems - &rp1_data[hw->id] happens before the id check, and rp1_data[] only has one initialised entry (index RP1_CLK_ETH_TSU = 29), so any other id is an out-of-bounds read. Please bounds-check first, then bail out with -ENOTSUPP for unsupported clocks rather than silently returning success.
Also, 0x2faf080 is 50 MHz, right? Please give it a #define with a descriptive name, and ideally read the parent rate from the clock framework rather than hard-coding it.
drivers/clk/clk-rp1.c line 4
Quoted 6 lines
drivers/clk/clk-rp1.c +4
-0@@ -0,0 +1,280 @@ +if (hw->id !=RP1_CLK_ETH_TSU ) +return 0 ; + +WARN (rate >4000000000ll ,"rate is -ve (%d)\n" , (int )rate);
Technically, rate is an unsigned long so it can never be negative - the "rate is -ve" message and the cast to (int) are misleading. Please fix the message or drop the WARN.
drivers/clk/clk-rp1.c line 8
Quoted 10 lines
drivers/clk/clk-rp1.c +8
-0@@ -0,0 +1,280 @@ +clockman_write (clockman, data->div_int_reg, div >>CLK_DIV_FRAC_BITS ); +if (data->div_frac_reg) +clockman_write (clockman, data->div_frac_reg, div << (32 -CLK_DIV_FRAC_BITS )); + +spin_unlock (&clockman->regs_lock); + +return 0 ; +}
set_rate() should return the newly set rate on success, not 0 - otherwise callers using clk_set_rate() to check what they got will be confused. Please return the computed rate.
Regards,
Simon
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 5/8] gpio: add support for RPi5 RP1 chip GPIO
Hi Torsten,
Quoted 17 lines · Torsten Duwe
gpio: add support for RPi5 RP1 chip GPIO
RP1 GPIO driver, derived from Linux
drivers/pinctrl/pinctrl-rp1.c; mainly stripped the pins' alternate function handling and fine-grained driving current controls.Signed-off-by Torsten Duwe <[email protected]>Co-authored-by Oleksii Moisieiev <[email protected]>configs/rpi_arm64_defconfig | 1 +
drivers/gpio/Kconfig | 7 + drivers/gpio/Makefile | 1 + drivers/gpio/rp1_gpio.c | 374 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 383 insertions(+)
drivers/gpio/Kconfig config RCAR_GPIO · line 419
Quoted 7 lines
drivers/gpio/Kconfig +7
-0@@ -413,6 +413,13 @@ config RCAR_GPIO +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. +
Two typos in the help text: 'Raspberry PR1' should be 'Raspberry RP1', and 'it's own' should be 'its own'. Please also add 'depends on DM_GPIO' as the neighbouring GPIO entries do - the driver will not build without it.
drivers/gpio/rp1_gpio.c line 6
Quoted 8 lines
drivers/gpio/rp1_gpio.c +6
-0@@ -0,0 +1,374 @@ +const struct rp1_iobank_desc rp1_iobanks[RP1_NUM_BANKS ] = { +/* gpio inte ints rio pads */ + {0 ,28 ,0x0000 ,0x011c ,0x0124 ,0x0000 ,0x0004 }, + {28 ,6 ,0x4000 ,0x411c ,0x4124 ,0x4000 ,0x4004 }, + {34 ,20 ,0x8000 ,0x811c ,0x8124 ,0x8000 ,0x8004 }, +};
Please make this 'static const' - it is only used within this translation unit.
drivers/gpio/rp1_gpio.c line 9
Quoted 11 lines
drivers/gpio/rp1_gpio.c +9
-0@@ -0,0 +1,374 @@ +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); + +return 0 ; +}
Silently returning 0 on a bad offset is inconsistent with the direction_input/direction_output ops, which return -EINVAL. Please return -EINVAL here too.
Quoted 8 lines
drivers/gpio/rp1_gpio.c +6
-0@@ -0,0 +1,374 @@ +static int rp1_gpio_get_direction (struct udevice *dev,unsigned int offset) +{ +struct rp1_pin_info *pin =rp1_get_pin (dev, offset); +u32 fsel; + +if (!pin)
drivers/gpio/rp1_gpio.c line 16
Quoted 10 lines
drivers/gpio/rp1_gpio.c +10
-0+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 ; +}
This is wired up as .get_function, so it must return one of the GPIOF_* values, not an errno. When fsel != RP1_FSEL_GPIO the pin is in an alternate function - please return GPIOF_FUNC to match intel_gpio/at91_gpio/stm32_gpio. Otherwise 'gpio status' will report a stray error for every non-GPIO pin.
Quoted 4 lines
drivers/gpio/rp1_gpio.c +2
-0@@ -0,0 +1,374 @@ +struct rp1_pin_info { +u8 num;
drivers/gpio/rp1_gpio.c line 12
Quoted 10 lines
drivers/gpio/rp1_gpio.c +10
-0+u8 bank; +u8 offset; +u8 fsel; + +void __iomem *gpio; +void __iomem *rio; +void __iomem *inte; +void __iomem *ints; +void __iomem *pad; +};
num, fsel, inte and ints are populated in probe but never read - the IRQ paths from the Linux driver were dropped. How about dropping the dead fields?
Regards,
Simon
A message that is not in the archive (sent off-list or not yet received): [email protected]
Simon Glass
Tested-byRe: [PATCH 6/8] mfd: add support for RPi5 RP1 chip MFD
Hi Torsten,
Quoted 18 lines · Torsten Duwe
mfd: add support for RPi5 RP1 chip MFD
MFD base driver for the RP1 chip, similar to Linux'
drivers/misc/rp1/rp1_pci.cSigned-off-by Torsten Duwe <[email protected]>Co-authored-by Oleksii Moisieiev <[email protected]>configs/rpi_arm64_defconfig | 1 +
drivers/mfd/Kconfig | 10 ++ drivers/mfd/Makefile | 1 + drivers/mfd/rp1.c | 127 ++++++++++++++++++++++ include/dt-bindings/mfd/rp1.h | 239 ++++++++++++++++++++++++++++++++++++++++++ include/pci_ids.h | 3 + 6 files changed, 381 insertions(+)
drivers/mfd/Kconfig config MFD_ATMEL_SMC · line 10
Quoted 9 lines
drivers/mfd/Kconfig +9
-0@@ -2,3 +2,13 @@ config MFD_ATMEL_SMC +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.
Please use 'bool' rather than 'tristate' - U-Boot does not build loadable modules, and the surrounding entries are all bool. Also 'configureds' should be 'configured'.
drivers/mfd/rp1.c line 9
Quoted 11 lines
drivers/mfd/rp1.c +9
-0@@ -0,0 +1,127 @@ +#define RP1_B0_CHIP_ID 0x10001927 +#define RP1_C0_CHIP_ID 0x20001927 + +#define RP1_PLATFORM_ASIC BIT(1) +#define RP1_PLATFORM_FPGA BIT(0) + +#define RP1_DRIVER_NAME "rp1" + +#define PCI_DEVICE_REV_RP1_C0 2
RP1_B0_CHIP_ID, RP1_PLATFORM_ASIC and PCI_DEVICE_REV_RP1_C0 are all unused - please drop them, or actually use them (e.g. accept the B0 variant, or check the revision).
drivers/mfd/rp1.c line 9
Quoted 11 lines
drivers/mfd/rp1.c +9
-0@@ -0,0 +1,127 @@ +static u32 rp1_reg_read (struct rp1_dev *rp1,unsigned int base_addr,u32 offset) +{ +resource_size_t phys =rp1_io_to_phys (rp1, base_addr); +void __iomem *regblock =ioremap (phys,0x1000 ); +u32 value =readl (regblock + offset); + +iounmap (regblock); +return value; +}
Please map the BAR once in probe (store the virtual address in struct rp1_dev) and just do readl() here. ioremap()/iounmap() around every register access is unnecessary, and there is no check that ioremap() succeeded before the readl().
drivers/mfd/rp1.c line 6
Quoted 8 lines
drivers/mfd/rp1.c +6
-0@@ -0,0 +1,127 @@ +static int rp1_get_bar_region (struct udevice *dev,phys_addr_t *bar_start) +{ + *bar_start = (phys_addr_t )dm_pci_map_bar (dev,PCI_BASE_ADDRESS_1 ,0 ,0 , +PCI_REGION_TYPE ,PCI_REGION_MEM ); +return 0 ; +}
This wrapper adds nothing and always returns 0 without checking whether dm_pci_map_bar() succeeded. Either fold it into rp1_probe() and check the result, or make it return an actual error when the map fails.
drivers/mfd/rp1.c line 6
Quoted 8 lines
drivers/mfd/rp1.c +6
-0@@ -0,0 +1,127 @@ +/* +* HACK: Set bar address in the correct order. +* Required for correct U-Boot operation. +*/ +dm_pci_write_config32 (dev,PCI_BASE_ADDRESS_1 ,0 ); +dm_pci_write_config32 (dev,PCI_BASE_ADDRESS_0 ,0x40000 );
A driver shouldn't need to poke BARs by hand - the PCI core is meant to assign them. Please explain in the comment (and in the commit message) why auto-assignment does the wrong thing here, and whether the underlying issue in the PCI core / RC driver can be fixed instead of open-coding it. 'HACK' with no reference to the root cause makes it hard for something to understand / fix this later.
drivers/mfd/rp1.c line 11
Quoted 13 lines
drivers/mfd/rp1.c +11
-0@@ -0,0 +1,127 @@ +static int rp1_pcie_read_config (const struct udevice *bus,pci_dev_t bdf, +uint offset,ulong *valuep,enum pci_size_t size) +{ +/* +* Leaving this call because pci subsystem calls for read_config +* and produces error then this callback is not set. +* Just return 0 here.s +*/ + *valuep =0 ; +return 0 ; +}
A leaf UCLASS_PCI_GENERIC device shouldn't need dm_pci_ops at all - those are for PCI controllers. If the core is complaining, that looks like a real bug in the PCI uclass rather than something to paper over with a stub that silently returns 0 for every config read. Please investigate and fix the root cause. Also: typo 'here.s', and 'then' should be 'when'.
drivers/mfd/rp1.c line 5
Quoted 7 lines
drivers/mfd/rp1.c +5
-0@@ -0,0 +1,127 @@ +static int rp1_bind (struct udevice *dev) +{ +device_set_name (dev,RP1_DRIVER_NAME ); +return 0 ; +}
Is renaming the device really needed? The bound name normally comes from the driver / DT node, and having every RP1 instance use the fixed string 'rp1' will collide if more than one is ever probed. If this is only cosmetic, please drop the bind hook.
include/dt-bindings/mfd/rp1.h line 7
Quoted 9 lines
include/dt-bindings/mfd/rp1.h +7
-0@@ -0,0 +1,239 @@ +/* +* This header provides constants for the PY MFD. +* +* Copyright (c) 2024 EPAM Systems +* +* Derived from linux rp1.h. +*/
How about 'RP1 MFD' instead of 'PY MFD' ?
include/pci_ids.h line 2556
Quoted 4 lines
include/pci_ids.h +2
-0@@ -2555,6 +2555,9 @@ +#define PCI_VENDOR_ID_RPI 0x1de4 +#define PCI_DEVICE_ID_RPI_RP1_C0 0x0001
The extra tab on PCI_DEVICE_ID_RPI_RP1_C0 misaligns it with the surrounding block - please drop it.
Regards,
Simon
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 7/8] board: raspberrypi: use board_late_init to probe RP1 chip
Hi Torsten,
Quoted 8 lines · Torsten Duwe
board: raspberrypi: use
board_late_initto probe RP1 chipDuring device tree parsing, u-boot finds the PCIe root complexes. Thereafter, a pci scan finds the RP1 chip, but does not really deal with it properly, while the device tree probably holds the description for the RP1 "nexus" or similar. Use
board_late_initto attach any such FDT fragments to the RP1 found.
Quoted 6 lines
Signed-off-by Torsten Duwe <[email protected]>Co-authored-by Volodymyr Babchuk <[email protected]>
board/raspberrypi/rpi/rpi.c| 15 +++++++++++++++configs/rpi_arm64_defconfig | 1 + 2 files changed, 16 insertions(+)
Please tighten the commit message. 'u-boot' should be 'U-Boot', and the description is hand-wavy ('probably holds', 'or similar', 'does not really deal with it properly'). State it concretely: the RP1 has a DT node with child nodes (clk, gpio, mfd) but because it is discovered via PCI enumeration the PCI-generic bind path does not walk those child nodes, so dm_scan_fdt_dev() is used to bind them.
Quoted 6 lines
board/raspberrypi/rpi/rpi.c +4
-0@@ -566,6 +566,21 @@ int board_init(void) +int board_late_init (void ) +{ +struct udevice *dev; +int err;
board/raspberrypi/rpi/rpi.c int board_init(void) · line 579
Quoted 10 lines
board/raspberrypi/rpi/rpi.c +10
-0+ + err =dm_pci_find_device (PCI_VENDOR_ID_RPI ,PCI_DEVICE_ID_RPI_RP1_C0 , +0 , &dev); +if (err) +printf ("RPI: RP1 device not found\n" ); +else +dm_scan_fdt_dev (dev); + +return 0 ; +}
This defconfig covers RPi4 too, doesn't it? So we should gate the lookup on the actual model (get_board_rev()/rpi_model) or demote the message to log_debug() / drop it when the device is simply absent.
board/raspberrypi/rpi/rpi.c int board_init(void) · line 567
Quoted 4 lines
board/raspberrypi/rpi/rpi.c +2
-0@@ -566,6 +566,21 @@ int board_init(void) +else +dm_scan_fdt_dev (dev);
The return value from dm_scan_fdt_dev() is ignored; if it fails the user gets no clue why no RP1 children came up. Please check it and log something useful / return the error.
board/raspberrypi/rpi/rpi.c int board_init(void) · line 576
Quoted 13 lines
board/raspberrypi/rpi/rpi.c +11
-0@@ -566,6 +566,21 @@ int board_init(void) +int board_late_init (void ) +{ +struct udevice *dev; +int err; + + err =dm_pci_find_device (PCI_VENDOR_ID_RPI ,PCI_DEVICE_ID_RPI_RP1_C0 , +0 , &dev); +if (err) +printf ("RPI: RP1 device not found\n" ); +else +dm_scan_fdt_dev (dev);
More fundamentally, I think this belongs in the rp1 MFD driver rather than in board code - the driver already binds via PCI_DEVICE(PCI_VENDOR_ID_RPI, PCI_DEVICE_ID_RPI_RP1_C0), so calling dm_scan_fdt_dev(dev) from rp1_probe() (or a post_bind hook) would achieve the same effect without any board glue and without needing BOARD_LATE_INIT. Other PCI-attached bridges bind their DT children from the driver, not from board_late_init(). What do you think?
Regards,
Simon
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 8/8] configs: enable DWC3 on RPi5
Quoted 9 lines · Torsten Duwe
configs: enable DWC3 on RPi5
The RP1 chip contains 2 DWC3 blocks. Now that we can access the RP1, enable the drivers. No further patches or glue code required.
Signed-off-by Torsten Duwe <[email protected]>configs/rpi_arm64_defconfig | 2 ++
1 file changed, 2 insertions(+)
Re: [0/8] Almost complete Raspberry Pi 5 support
In reply to a message not in the archiveHi Torsten,
Quoted 6 lines · Torsten Duwe
The next three patches are simply the RP1 components for their respective subsystems; and then I pick up Volodymyr's idea to use
board_late_initto stitch RP1 and PCIe together. In the long run, it might turn out necessary to enhance U-Boot's probing architecture to handle alternating cycles of device tree and PCI probed devices in general.
Thanks for putting this together! I'm really looking forward to having U-Boot fully functional on this board. When I run it on rpi5 I see:
...
PCIe BRCM: link down
PCIe BRCM: link up, 5.0 Gbps x4 (!SSC)
Net: No ethernet found.
PCIe BRCM: link down
starting USB...
USB XHCI 1.10
USB XHCI 1.10
USB DWC2
Resetting EP 0...
Resetting EP 3...
WARN endpoint is halted
Resetting EP 2...
WARN endpoint is halted
Resetting EP 3...
WARN endpoint is halted
Resetting EP 0...
Resetting EP 3...
WARN endpoint is halted
Resetting EP 2...
WARN endpoint is halted
Resetting EP 3...
WARN endpoint is halted
Resetting EP 0...
Resetting EP 3...
WARN endpoint is halted
Resetting EP 2...
WARN endpoint is halted
Resetting EP 3...
WARN endpoint is halted
Resetting EP 0...
Resetting EP 3...
WARN endpoint is halted
Resetting EP 2...
WARN endpoint is halted
Resetting EP 3...
WARN endpoint is halted
Resetting EP 0...
Resetting EP 3...
WARN endpoint is halted
Resetting EP 2...
WARN endpoint is halted
Resetting EP 3...
WARN endpoint is halted
** fs_devread read error - block
Bus usb@200000: 2 USB Device(s) found
Bus usb@300000: 2 USB Device(s) found
Bus usb@480000: 1 USB Device(s) found
scanning usb for storage devices... 2 Storage Device(s) found
Hit any key to stop autoboot: 0
U-Boot> nvme scan
U-Boot> nvme detail
U-Boot> usb stor
Device 0: Vendor: USB Rev: 1100 Prod: Flash Disk
Type: Removable Hard Disk
Capacity: 30720.0 MB = 30.0 GB (62914560 x 512)
Device 1: Vendor: USB Rev: 1.00 Prod: SanDisk 3.2Gen1
Type: Removable Hard Disk
Capacity: 29358.0 MB = 28.6 GB (60125184 x 512)
U-Boot>
So it seems that my S2Pi + NVMw is not detected? Which board are you using here?
Also, I'm not sure if you see the warnings/resetting messages above?
Quoted 1 line
mfd: add support for RPi5 RP1 chip MFD
The patch order feels backwards - the MFD is the parent that carries the PCI IDs and instantiates the clk and gpio children, yet it lands as patch 6, after its children in patches 4 and 5. Please reorder so the MFD comes first, followed by clk and gpio, then the board_late_init glue if needed. That also makes each intermediate state easier to bisect.
Also it would be good to mention in doc/board/broadcom/raspberrypi.rst mentions that NVMe, RP1 GPIO and USB now work on RPi5, or what is still missing (network boot).
Regards,
Simon
PATCH 1/1 board: raspberrypi: rpi: add nvme to boot_targets
In reply to a message not in the archivebootstd only scans the labels listed in boot_targets. The NVMe bootdev is created by "nvme scan", but automatic boot never considers it because the board environment only lists mmc, usb, pxe, and dhcp.
Add nvme after mmc and usb so the existing SD/USB boot order is preserved and NVMe is tried when neither produces a bootflow. This makes an NVMe-only system boot without an SD card while keeping the SD card as a fallback.
Tested on a Raspberry Pi 5 (4 GB) with a BIWIN CE430T5D100-512G NVMe:
with no SD card, U-Boot 2026.10 scans NVMe and boots extlinux from the NVMe ext4 partition; with the installer SD inserted, it still boots the SD first.
--- board/raspberrypi/rpi/rpi.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
board/raspberrypi/rpi/rpi.env +1 -1
@@ -77,4 +77,4 @@ pxefile_addr_r=0x05500000 fdt_addr_r=0x05600000 ramdisk_addr_r=0x05700000 -boot_targets=mmc usb pxe dhcp +boot_targets=mmc usb nvme pxe dhcp
Signature · 1 line
2.54.0
Re: [PATCH] board: raspberrypi: rpi: add nvme to boot_targets
Hi Peter,
Quoted 23 lines · Peter Esselius
board: raspberrypi: rpi: add nvme to
boot_targetsbootstd only scans the labels listed in
boot_targets. The NVMe bootdev is created by "nvme scan", but automatic boot never considers it because the board environment only lists mmc, usb, pxe, and dhcp.Add nvme after mmc and usb so the existing SD/USB boot order is preserved and NVMe is tried when neither produces a bootflow. This makes an NVMe-only system boot without an SD card while keeping the SD card as a fallback.
Tested on a Raspberry Pi 5 (4 GB) with a BIWIN CE430T5D100-512G NVMe:
with no SD card, U-Boot 2026.10 scans NVMe and boots extlinux from the NVMe ext4 partition; with the installer SD inserted, it still boots the SD first.Signed-off-by Peter Esselius <[email protected]>board/raspberrypi/rpi/rpi.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
board/raspberrypi/rpi/rpi.env pxefile_addr_r=0x05500000 · line 77
Quoted 2 lines
board/raspberrypi/rpi/rpi.env +1
-1@@ -77,4 +77,4 @@ pxefile_addr_r=0x05500000 -boot_targets=mmc usb pxe dhcp +boot_targets=mmc usb nvme pxe dhcp
The other option might be to remove this altogether, so bootstd uses its default approach of scanning from slowest to fastest device. I would argue that NVMe should come before USB (which takes ages to enumerate).
Regards,
Simon
Peter Esselius
Tested-byRe: [PATCH 0/8] Almost complete Raspberry Pi 5 support
In reply to a message not in the archiveHi Torsten,
I tested the NVMe-relevant subset (patches 1-3) on a Raspberry Pi 5 (4 GB, Rev 1.0) with a BIWIN CE430T5D100-512G NVMe, using U-Boot 2026.10 plus those patches and a one-line boot_targets follow-up.
Hardware/software:
- Pi 5 4 GB, non-HAT+ M.2 HAT, EEPROM 2026-05-26
- EEPROM: BOOT_ORDER=0xf416, PCIE_PROBE=1
- config.txt: dtparam=pciex1
- U-Boot 2026.10 with:
- [1/8] core: skip parent device nodes without a DT reference
- [2/8] test: add dma-ranges UT for dynamically created nodes
- [3/8] configs: enable NVMe on RPi4 and RPi5
- follow-up: boot_targets=mmc usb nvme pxe dhcp
- SD card removed for the NVMe-only test
Results:
- nvme scan finds the BIWIN NVMe.
- bootflow scan finds the NVMe ext4 partition and boots extlinux:
** Booting bootflow 'nvme#0.blk#1.bootdev.part_2' with extlinux
- The NVMe system booted; serial console and SSH work.
- With an SD card inserted, U-Boot still boots the SD first (mmc before nvme), preserving the existing fallback:
** Booting bootflow '[email protected]_2' with extlinux
Removing the SD again and rebooting returned to the NVMe-only system.
- The boot_targets line is required for automatic boot: without it, nvme scan creates the bootdev but bootstd never scans it. I have sent a one-line follow-up patch separately; would you prefer it folded into the series or kept separate?
Thanks,
Peter