lan966x pci device: Add support for SFPs
Subsystems (21)
Herve Codina
maintainerv4 cover lan966x pci device: Add support for SFPs
Hi,
This series add support for SFPs ports available on the LAN966x PCI device. In order to have the SFPs supported, additional devices are needed such as clock controller and I2C.
As a reminder, the LAN966x PCI device driver use a device-tree overlay to describe devices available on the PCI board. Adding support for SFPs ports consists in adding more devices in the already existing device-tree overlay.
With those devices added, the device-tree overlay is more complex and some consumer/supplier relationship are needed in order to remove devices in correct order when the LAN966x PCI driver is removed.
Those links are typically provided by fw_devlink and we faced some issues with fw_devlink and overlays.
This series gives the big picture related to the SFPs support from fixing issues to adding new devices. Of course, it can be split if needed.
The first part of the series (patch 1, 2 and 3) fixes fw_devlink when it is used with overlay. Patches 1 and 3 were previously sent by Saravana [0]. I just rebased them on top of v6.18-rc1 and added patch 2 in order to take into account feedback received on the series sent by Saravana.
Those modification were not sufficient in our case and so, on top of that, patches 4 to 7 fix some more issues related to fw_devlink.
Patches 8 to 13 introduce and use fw_devlink_set_device() in already existing code.
Patches 14 and 15 are related also to fw_devlink but specific to PCI and the device-tree nodes created during enumeration.
Patches 16, 17 and 18 are related fw_devlink too but specific to I2C muxes. Patches purpose is to correctly set a link between an adapter supplier and its consumer. Indeed, an i2c mux adapter's parent is not the i2c mux supplier but the adapter the i2c mux is connected to. Adding a new link between the adapter supplier involved when i2c muxes are used avoid a freeze observed during device removal.
Patch 19 adds support for fw_delink on x86. fw_devlink is needed to have the consumer/supplier relationship between devices in order to ensure a correct device removal order. Adding fw_devlink support for x86 has been tried in the past but was reverted [1] because it broke some systems. Instead of enabling fw_devlink on *all* x86 system, enable it on *all* x86 except on those where it leads to issue.
Patches 20 and 21 allow to build clock and i2c controller used by the LAN966x PCI device when the LAN966x PCI device is enabled.
Patches 22 to 26 are specific to the LAN966x. They touch the current dtso, split it in dtsi/dtso files, rename the dtso and improve the driver to allow easier support for other boards.
The next patch (patch 27) update the LAN966x device-tree overlay itself to have the SPF ports and devices they depends on described.
The last two patches (patches 28 and 29) sort the existing drivers in the needed driver list available in the Kconfig help and add new drivers in this list keep the list up to date with the devices described in the device-tree overlay.
We believe some items from the above list can be merged separately, with no build dependencies. We expect:
- Patches 1 to 7 to be taken by driver core maintainers
- Patches 8 to 13 to be taken by driver core maintainers
- Patches 14 and 15 to be taken by driver core or PCI maintainers (depend on patch 8)
- Patches 16 to 18 to be taken by I2C maintainers
- Patch 19 to be taken by driver core or OF maintainers
- Patch 20 to be taken by clock maintainers
- Patch 21 to be taken by I2C maintainers
- Patches 22 to 29 to be taken by misc maintainers
Once again, this series gives the big picture and can be split if needed. Let me know.
[0] https://lore.kernel.org/lkml/[email protected]/
[1] https://lore.kernel.org/lkml/[email protected]/
Compare to previous iteration, this v4 series mainly:
- Introduce simple-platform-bus driver instead of modifying the simple-bus driver (modifying the simple-bus driver could lead to regressions).
- Use some device-tree properties to filter out x86 systems that do not support fw_devlink instead of using kconfig symbols.
- Add '{Reviewed,Acked}-by'
Best regards,
Hervé
Changes:
v3 -> v4
v3: https://lore.kernel.org/lkml/[email protected]/
- Patch 1:
No change
- Patch 2:
Update and fix conflicts. Indeed, since v3 iteration get_dev_from_fwnode() has been moved to device.h and used by pmdomain/core.c.
- Patch 3:
remove '#define get_device_from_fwnode()'
- Patch 4:
Fix conflict (rebase v6.17-rc6)
Add 'Reviewed-by: Rafael J. Wysocki'
Add 'Reviewed-by: Saravana Kannan'
- Patch 5 (new in v4):
Introduce simple-platform-bus (binding)
- Patch 6 (5 in v3):
Rework patch and introduce simple-platform-bus
- Patch 7: (new)
Use simple-platform-bus in LAN966x
- Patch 8 (6 in v3):
- No change
- Patch 9 and 10 (7 and 8 in v3):
Add 'Reviewed-by: Andy Shevchenko'
- Patch 11 and 12 (9 and 10 in v3):
Add 'Reviewed-by: Dave Jiang'
- Patch 13 (11 in v3):
Add 'Reviewed-by: Andy Shevchenko'
- Patch 12 in v3:
Patch removed.
Adding __private tag in fwnode.dev is going to be handled in a dedicated series. Indeed a test robot reported an issue and more patches are needed (I have missed fwnode.dev users in several part in the kernel).
- Patch 14 and 15 (13 and 14 in v3):
No change
- Patch 16 (14 in v3):
Add 'Reviewed-by: Andi Shyti'
- Patch 17 and 18 (16 and 17 in v3):
No change
- Patch 19 (18 in v3):
Filter out support for fw_devlink on x86 based on some device-tree properties.
Rewrite commit changelog
Remove 'Reviewed-by: Andy Shevchenko' (significant modification)
- Patch 20 (19 in v3):
Add 'Acked-by: Stephen Boyd'
- Patch 21 (20 in v3):
Fix conflict (rebase v6.18-rc1)
- Patches 22 to 24 (21 to 23 in v3):
No change
- Patch 25 (24 in v3):
Fix conflict (rebase v6.18-rc1)
Add 'Acked-by: Bjorn Helgaas'
- Patches 26 to 29 (25 to 28 in v3):
No change
v2 -> v3
v2: https://lore.kernel.org/all/[email protected]/
- Patch 1:
Add 'Acked-by: Mark Brown'
- Patch 2 and 3:
No changes
- Patch 4:
Rewrite the WARN_ON() condition to avoid an additional 'if'
- Patch 5:
Fix typos in commit log
Update a comment
Remove the unneeded check before calling of_platform_depopulate()
- Patches 6 to 11:
No changes
- Patch 12 (new in v3)
Tag the fwnode dev member as private
- Patch 13 (12 in v2)
Fix a typo in the commit log
- Patches 14 to 16 (13 to 15 in v2)
No changes
- Patch 17 (16 in v2)
Check parent_physdev for NULL
- Patch 18 (17 in v2)
Capitalize "Link:"
Add 'Reviewed-by: Andy Shevchenko'
- Patch 19 (18 in v2)
No changes
- Patch 20 (19 in v2)
Add 'Acked-by: Andi Shyti'
- Patch 21 (20 in v2)
No changes
- Patch 22 (21 in v2)
Add 'Reviewed-by: Andrew Lunn'
- Patch 23 (22 in v2)
Add 'Reviewed-by: Andrew Lunn'
- Patch 24 (new in v3)
Introduce PCI_DEVICE_ID_EFAR_LAN9662, the LAN966x PCI device ID
- Patch 25 (23 in v2)
Add 'Reviewed-by: Andrew Lunn'
Use PCI_DEVICE_DATA() with PCI_DEVICE_ID_EFAR_LAN9662 instead of PCI_VDEVICE()
- Patch 26 to 28 (24 to 26 in v2)
No changes
v1 -> v2
v1: https://lore.kernel.org/lkml/[email protected]/
- Patch 1 and 3
Remove 'From' tag from the commit log
- Patch 2
Add 'Reviewed-by: Andy Shevchenko'
Add 'Reviewed-by: Saravana Kannan'
Add 'Reviewed-by: Luca Ceresoli'
- Patch 4 and 5
No changes
- Patch 6 (new in v2)
Introduce fw_devlink_set_device()
- Patch 7 (new in v2)
Use existing device_set_node() helper.
- Patch 8 to 11 (new in v2)
Use fw_devlink_set_device() in existing code.
- Patch 12 (6 in v1)
Use fw_devlink_add_device()
- Patch 13 (7 in v1)
No changes
- Patch 14 (8 in v1)
Update commit log
Use 'physdev' instead of 'supplier'
Minor fixes in i2c_get_adapter_physdev() kdoc
- Patch 15 and 16 (9 and 10 in v1)
Use 'physdev' instead of 'supplier' (commit log, title and code)
- Patch 17 (11 in v2)
Enable fw_devlink on x86 only if PCI_DYNAMIC_OF_NODES is enabled. Rework commit log.
- Patch 18, 19 and 20 (12, 13 and 14 in v1)
No changes
- Patch 21 (new in v2)
Split dtso in dtsi/dtso
- Patch 22 (new in v2)
Rename lan966x_pci.dtso using the specific board name
- Patch 23 (new in v2)
Improve the driver introducing board specific data to ease support for other boards (avoid the direct dtbo reference in the function loading the dtbo).
- Patch 24 (15 in v1)
Refactor due to dtso split in dtsi/dtso
- Patch 25 (new in v2)
Sort exist driver list in Kconfig help
- Patch 26 (16 in v1)
Keep alphanumeric order for new drivers added in Kconfig help
Herve Codina (27):
driver core: Rename get_dev_from_fwnode() wrapper to
get_device_from_fwnode()
driver core: Avoid warning when removing a device while its supplier
is unbinding
dt-bindings: bus: Add simple-platform-bus
bus: Introduce simple-platorm-bus
misc: lan966x_pci: Use simple-platform-bus
driver core: fw_devlink: Introduce fw_devlink_set_device()
drivers: core: Use fw_devlink_set_device()
pinctrl: cs42l43: Use fw_devlink_set_device()
cxl/test: Use device_set_node()
cxl/test: Use fw_devlink_set_device()
PCI: of: Use fw_devlink_set_device()
PCI: of: Set fwnode device of newly created PCI device nodes
PCI: of: Remove fwnode_dev_initialized() call for a PCI root bridge
node
i2c: core: Introduce i2c_get_adapter_physdev()
i2c: mux: Set adapter physical device
i2c: mux: Create missing devlink between mux and adapter physical
device
of: property: Allow fw_devlink device-tree on x86
clk: lan966x: Add MCHP_LAN966X_PCI dependency
i2c: busses: at91: Add MCHP_LAN966X_PCI dependency
misc: lan966x_pci: Fix dtso nodes ordering
misc: lan966x_pci: Split dtso in dtsi/dtso
misc: lan966x_pci: Rename lan966x_pci.dtso to
lan966x_evb_lan9662_nic.dtso
PCI: Add Microchip LAN9662 PCI Device ID
misc: lan966x_pci: Introduce board specific data
misc: lan966x_pci: Add dtsi/dtso nodes in order to support SFPs
misc: lan966x_pci: Sort the drivers list in Kconfig help
misc: lan966x_pci: Add drivers needed to support SFPs in Kconfig help
Saravana Kannan (2):
Revert "treewide: Fix probing of devices in DT overlays"
of: dynamic: Fix overlayed devices not probing because of fw_devlink
.../bindings/bus/simple-platform-bus.yaml | 50 +++++ MAINTAINERS | 3 +- drivers/base/core.c | 99 +++++++--- drivers/bus/imx-weim.c | 6 - drivers/bus/simple-pm-bus.c | 37 ++++ drivers/clk/Kconfig | 2 +- drivers/i2c/busses/Kconfig | 2 +- drivers/i2c/i2c-core-base.c | 16 ++ drivers/i2c/i2c-core-of.c | 5 - drivers/i2c/i2c-mux.c | 26 +++ drivers/misc/Kconfig | 11 +- drivers/misc/Makefile | 2 +- drivers/misc/lan966x_evb_lan9662_nic.dtso | 167 +++++++++++++++++ drivers/misc/lan966x_pci.c | 30 ++- drivers/misc/lan966x_pci.dtsi | 172 +++++++++++++++++ drivers/misc/lan966x_pci.dtso | 177 ------------------ drivers/of/dynamic.c | 1 - drivers/of/overlay.c | 15 ++ drivers/of/platform.c | 5 - drivers/of/property.c | 31 ++- drivers/pci/of.c | 10 +- drivers/pci/quirks.c | 2 +- drivers/pinctrl/cirrus/pinctrl-cs42l43.c | 2 +- drivers/pmdomain/core.c | 4 +- drivers/spi/spi.c | 5 - include/linux/device.h | 2 +- include/linux/fwnode.h | 7 + include/linux/i2c.h | 3 + include/linux/pci_ids.h | 1 + tools/testing/cxl/test/cxl.c | 4 +- 30 files changed, 652 insertions(+), 245 deletions(-) create mode 100644 Documentation/devicetree/bindings/bus/simple-platform-bus.yaml create mode 100644 drivers/misc/lan966x_evb_lan9662_nic.dtso create mode 100644 drivers/misc/lan966x_pci.dtsi delete mode 100644 drivers/misc/lan966x_pci.dtso
Signature · 1 line
2.51.0
Herve Codina
maintainerPATCH v4 1/29 Revert "treewide: Fix probing of devices in DT overlays"
From: Saravana Kannan <[email protected]>
This reverts commit 1a50d9403fb90cbe4dea0ec9fd0351d2ecbd8924.
While the commit fixed fw_devlink overlay handling for one case, it broke it for another case. So revert it and redo the fix in a separate patch.
--- drivers/bus/imx-weim.c | 6 ------ drivers/i2c/i2c-core-of.c | 5 ----- drivers/of/dynamic.c | 1 - drivers/of/platform.c | 5 ----- drivers/spi/spi.c | 5 ----- 5 files changed, 22 deletions(-)
drivers/bus/imx-weim.c +0 -6
@@ -327,12 +327,6 @@ static int of_weim_notify(struct notifier_block *nb, unsigned long action, "Failed to setup timing for '%pOF'\n", rd->dn);if (!of_node_check_flag (rd->dn,OF_POPULATED )) { -/* -* Clear the flag before adding the device so that -* fw_devlink doesn't skip adding consumers to this -* device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ;if (!of_platform_device_create (rd->dn,NULL , &pdev->dev)) { dev_err(&pdev->dev, "Failed to create child device '%pOF'\n",
drivers/i2c/i2c-core-of.c +0 -5
@@ -176,11 +176,6 @@ static int of_i2c_notify(struct notifier_block *nb, unsigned long action,return NOTIFY_OK ; } -/* -* Clear the flag before adding the device so that fw_devlink -* doesn't skip adding consumers to this device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ; client =of_i2c_register_device (adap, rd->dn);if (IS_ERR (client)) { dev_err(&adap->dev, "failed to create client for '%pOF'\n",
drivers/of/dynamic.c +0 -1
@@ -225,7 +225,6 @@ static void __of_attach_node(struct device_node *np) np->sibling = np->parent->child; np->parent->child = np;of_node_clear_flag (np,OF_DETACHED ); - np->fwnode.flags |=FWNODE_FLAG_NOT_DEVICE ;raw_spin_unlock_irqrestore (&devtree_lock, flags);
drivers/of/platform.c +0 -5
@@ -739,11 +739,6 @@ static int of_platform_notify(struct notifier_block *nb,if (of_node_check_flag (rd->dn,OF_POPULATED ))return NOTIFY_OK ; -/* -* Clear the flag before adding the device so that fw_devlink -* doesn't skip adding consumers to this device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ;/* pdev_parent may be NULL when no bus platform device */ pdev_parent =of_find_device_by_node (parent); pdev = of_platform_device_create(rd->dn, NULL,
drivers/spi/spi.c +0 -5
@@ -4791,11 +4791,6 @@ static int of_spi_notify(struct notifier_block *nb, unsigned long action,return NOTIFY_OK ; } -/* -* Clear the flag before adding the device so that fw_devlink -* doesn't skip adding consumers to this device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ; spi =of_register_spi_device (ctlr, rd->dn);put_device (&ctlr->dev);
Signature · 1 line
2.51.0
Re: [PATCH v4 01/29] Revert "treewide: Fix probing of devices in DT overlays"
Quoted 92 lines · Herve Codina
From: Saravana Kannan <[email protected]>
This reverts commit
1a50d9403fb90cbe4dea0ec9fd0351d2ecbd8924.While the commit fixed
fw_devlinkoverlay handling for one case, it broke it for another case. So revert it and redo the fix in a separate patch.Fixes 1a50d9403fb9 ("treewide: Fix probing of devices in DT overlays")Reported-by Herve Codina <[email protected]>Closes https://lore.kernel.org/lkml/CAMuHMdXEnSD4rRJ-o90x4OprUacN_rJgyo8x6=9F9rZ+-KzjOg@mail.gmail.com/ open hereSigned-off-by Saravana Kannan <[email protected]>Signed-off-by Herve Codina <[email protected]>Acked-by Mark Brown <[email protected]>--- drivers/bus/imx-weim.c | 6 ------ drivers/i2c/i2c-core-of.c | 5 ----- drivers/of/dynamic.c | 1 - drivers/of/platform.c | 5 ----- drivers/spi/spi.c | 5 ----- 5 files changed, 22 deletions(-)drivers/bus/imx-weim.c +0
-6@@ -327,12 +327,6 @@ static int of_weim_notify(struct notifier_block *nb, unsigned long action, "Failed to setup timing for '%pOF'\n", rd->dn);if (!of_node_check_flag (rd->dn,OF_POPULATED )) { -/* -* Clear the flag before adding the device so that -* fw_devlink doesn't skip adding consumers to this -* device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ;if (!of_platform_device_create (rd->dn,NULL , &pdev->dev)) { dev_err(&pdev->dev, "Failed to create child device '%pOF'\n",drivers/i2c/i2c-core-of.c +0
-5@@ -176,11 +176,6 @@ static int of_i2c_notify(struct notifier_block *nb, unsigned long action,return NOTIFY_OK ; } -/* -* Clear the flag before adding the device so that fw_devlink -* doesn't skip adding consumers to this device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ; client =of_i2c_register_device (adap, rd->dn);if (IS_ERR (client)) { dev_err(&adap->dev, "failed to create client for '%pOF'\n",drivers/of/dynamic.c +0
-1@@ -225,7 +225,6 @@ static void __of_attach_node(struct device_node *np) np->sibling = np->parent->child; np->parent->child = np;of_node_clear_flag (np,OF_DETACHED ); - np->fwnode.flags |=FWNODE_FLAG_NOT_DEVICE ;raw_spin_unlock_irqrestore (&devtree_lock, flags);drivers/of/platform.c +0
-5@@ -739,11 +739,6 @@ static int of_platform_notify(struct notifier_block *nb,if (of_node_check_flag (rd->dn,OF_POPULATED ))return NOTIFY_OK ; -/* -* Clear the flag before adding the device so that fw_devlink -* doesn't skip adding consumers to this device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ;/* pdev_parent may be NULL when no bus platform device */ pdev_parent =of_find_device_by_node (parent); pdev = of_platform_device_create(rd->dn, NULL,drivers/spi/spi.c +0
-0@@ -4791,11 +4791,6 @@ static int of_spi_notify(struct notifier_block *nb, unsigned long action,return NOTIFY_OK ;
drivers/spi/spi.c static int of_spi_notify(struct notifier_block *nb, unsigned long action, · line 4796
Quoted 10 lines
drivers/spi/spi.c +0
-5} -/* -* Clear the flag before adding the device so that fw_devlink -* doesn't skip adding consumers to this device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ; spi =of_register_spi_device (ctlr, rd->dn);put_device (&ctlr->dev);
Sorry, some of you will receive this message now for second time. First message was sent to older series of patches. -
Hello,
Test system testing drivers for ROHM ICs bisected this commit to cause BD71847 drivers probe to not be called.
The devicetree blob overlay describing bd71847 enables I2C1 bus on BeagleBone Black aswell.
Probe is called when the driver is used with HW connected to I2C2 bus. I2C2 bus is enabled before overlaying devicetree blobs.
---- BD71847 Devicetree overlay source ----
/dts-v1/;
/plugin/;
/{ /* this is our device tree overlay root node */
compatible = "ti,beaglebone", "ti,beaglebone-black";
part-number = "BBB-I2C1";
version = "00A0";
fragment@0 {
target = <&am33xx_pinmux>; // this is a link to an already defined node in the device tree, so that node is overlayed with our modification
__overlay__ {
i2c1_pins: pinmux_i2c1_pins {
pinctrl-single,pins = <
0x158 0x72 /* spi0_d1.i2c1_sda */
0x15C 0x72 /* spi0_cs0.i2c1_sdl */
>;
};
};
};....
....
fragment@2 {
target = <&i2c1>;
__overlay__ {
pinctrl-0 = <&i2c1_pins>;
clock-frequency = <100000>;
status = "okay";
pmic: pmic@4b { /* the "test" defined as child of the i2c1
bus */
compatible = "rohm,bd71847";
reg = <0x4b>;
....
....
}; /* root node end */---- END OF BD71847 Devicetree overlay source ----
Reverting this patch from linux-next from last friday fixes the issue.
BR
Kalle Niemi
Rob Herring
maintainerRe: [PATCH v4 01/29] Revert "treewide: Fix probing of devices in DT overlays"
Quoted 108 lines · Kalle Niemi
Quoted 92 lines · Herve Codina
From: Saravana Kannan <[email protected]>
This reverts commit
1a50d9403fb90cbe4dea0ec9fd0351d2ecbd8924.While the commit fixed
fw_devlinkoverlay handling for one case, it broke it for another case. So revert it and redo the fix in a separate patch.Fixes 1a50d9403fb9 ("treewide: Fix probing of devices in DT overlays")Reported-by Herve Codina <[email protected]>Closes https://lore.kernel.org/lkml/CAMuHMdXEnSD4rRJ-o90x4OprUacN_rJgyo8x6=9F9rZ+-KzjOg@mail.gmail.com/ open hereSigned-off-by Saravana Kannan <[email protected]>Signed-off-by Herve Codina <[email protected]>Acked-by Mark Brown <[email protected]>--- drivers/bus/imx-weim.c | 6 ------ drivers/i2c/i2c-core-of.c | 5 ----- drivers/of/dynamic.c | 1 - drivers/of/platform.c | 5 ----- drivers/spi/spi.c | 5 ----- 5 files changed, 22 deletions(-)drivers/bus/imx-weim.c +0
-6@@ -327,12 +327,6 @@ static int of_weim_notify(struct notifier_block *nb, unsigned long action, "Failed to setup timing for '%pOF'\n", rd->dn);if (!of_node_check_flag (rd->dn,OF_POPULATED )) { -/* -* Clear the flag before adding the device so that -* fw_devlink doesn't skip adding consumers to this -* device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ;if (!of_platform_device_create (rd->dn,NULL , &pdev->dev)) { dev_err(&pdev->dev, "Failed to create child device '%pOF'\n",drivers/i2c/i2c-core-of.c +0
-5@@ -176,11 +176,6 @@ static int of_i2c_notify(struct notifier_block *nb, unsigned long action,return NOTIFY_OK ; } -/* -* Clear the flag before adding the device so that fw_devlink -* doesn't skip adding consumers to this device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ; client =of_i2c_register_device (adap, rd->dn);if (IS_ERR (client)) { dev_err(&adap->dev, "failed to create client for '%pOF'\n",drivers/of/dynamic.c +0
-1@@ -225,7 +225,6 @@ static void __of_attach_node(struct device_node *np) np->sibling = np->parent->child; np->parent->child = np;of_node_clear_flag (np,OF_DETACHED ); - np->fwnode.flags |=FWNODE_FLAG_NOT_DEVICE ;raw_spin_unlock_irqrestore (&devtree_lock, flags);drivers/of/platform.c +0
-5@@ -739,11 +739,6 @@ static int of_platform_notify(struct notifier_block *nb,if (of_node_check_flag (rd->dn,OF_POPULATED ))return NOTIFY_OK ; -/* -* Clear the flag before adding the device so that fw_devlink -* doesn't skip adding consumers to this device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ;/* pdev_parent may be NULL when no bus platform device */ pdev_parent =of_find_device_by_node (parent); pdev = of_platform_device_create(rd->dn, NULL,drivers/spi/spi.c +0
-0@@ -4791,11 +4791,6 @@ static int of_spi_notify(struct notifier_block *nb, unsigned long action,return NOTIFY_OK ;drivers/spi/spi.c static int of_spi_notify(struct notifier_block *nb, unsigned long action, · line 4796
Quoted 10 lines
drivers/spi/spi.c +0
-5} -/* -* Clear the flag before adding the device so that fw_devlink -* doesn't skip adding consumers to this device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ; spi =of_register_spi_device (ctlr, rd->dn);put_device (&ctlr->dev);Sorry, some of you will receive this message now for second time. First message was sent to older series of patches.
-
Quoted 4 lines
Hello,
Test system testing drivers for ROHM ICs bisected this commit to cause BD71847 drivers probe to not be called.
This driver (and overlay support) is in linux-next or something out of tree on top of linux-next?
Rob
Re: [PATCH v4 01/29] Revert "treewide: Fix probing of devices in DT overlays"
Quoted 108 lines · Rob Herring
Quoted 107 lines · Kalle Niemi
Quoted 92 lines · Herve Codina
From: Saravana Kannan <[email protected]>
This reverts commit
1a50d9403fb90cbe4dea0ec9fd0351d2ecbd8924.While the commit fixed
fw_devlinkoverlay handling for one case, it broke it for another case. So revert it and redo the fix in a separate patch.Fixes 1a50d9403fb9 ("treewide: Fix probing of devices in DT overlays")Reported-by Herve Codina <[email protected]>Closes https://lore.kernel.org/lkml/CAMuHMdXEnSD4rRJ-o90x4OprUacN_rJgyo8x6=9F9rZ+-KzjOg@mail.gmail.com/ open hereSigned-off-by Saravana Kannan <[email protected]>Signed-off-by Herve Codina <[email protected]>Acked-by Mark Brown <[email protected]>--- drivers/bus/imx-weim.c | 6 ------ drivers/i2c/i2c-core-of.c | 5 ----- drivers/of/dynamic.c | 1 - drivers/of/platform.c | 5 ----- drivers/spi/spi.c | 5 ----- 5 files changed, 22 deletions(-)drivers/bus/imx-weim.c +0
-6@@ -327,12 +327,6 @@ static int of_weim_notify(struct notifier_block *nb, unsigned long action, "Failed to setup timing for '%pOF'\n", rd->dn);if (!of_node_check_flag (rd->dn,OF_POPULATED )) { -/* -* Clear the flag before adding the device so that -* fw_devlink doesn't skip adding consumers to this -* device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ;if (!of_platform_device_create (rd->dn,NULL , &pdev->dev)) { dev_err(&pdev->dev, "Failed to create child device '%pOF'\n",drivers/i2c/i2c-core-of.c +0
-5@@ -176,11 +176,6 @@ static int of_i2c_notify(struct notifier_block *nb, unsigned long action,return NOTIFY_OK ; } -/* -* Clear the flag before adding the device so that fw_devlink -* doesn't skip adding consumers to this device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ; client =of_i2c_register_device (adap, rd->dn);if (IS_ERR (client)) { dev_err(&adap->dev, "failed to create client for '%pOF'\n",drivers/of/dynamic.c +0
-1@@ -225,7 +225,6 @@ static void __of_attach_node(struct device_node *np) np->sibling = np->parent->child; np->parent->child = np;of_node_clear_flag (np,OF_DETACHED ); - np->fwnode.flags |=FWNODE_FLAG_NOT_DEVICE ;raw_spin_unlock_irqrestore (&devtree_lock, flags);drivers/of/platform.c +0
-5@@ -739,11 +739,6 @@ static int of_platform_notify(struct notifier_block *nb,if (of_node_check_flag (rd->dn,OF_POPULATED ))return NOTIFY_OK ; -/* -* Clear the flag before adding the device so that fw_devlink -* doesn't skip adding consumers to this device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ;/* pdev_parent may be NULL when no bus platform device */ pdev_parent =of_find_device_by_node (parent); pdev = of_platform_device_create(rd->dn, NULL,drivers/spi/spi.c +0
-0@@ -4791,11 +4791,6 @@ static int of_spi_notify(struct notifier_block *nb, unsigned long action,return NOTIFY_OK ;drivers/spi/spi.c static int of_spi_notify(struct notifier_block *nb, unsigned long action, · line 4796
Quoted 10 lines
drivers/spi/spi.c +0
-5} -/* -* Clear the flag before adding the device so that fw_devlink -* doesn't skip adding consumers to this device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ; spi =of_register_spi_device (ctlr, rd->dn);put_device (&ctlr->dev);Sorry, some of you will receive this message now for second time. First message was sent to older series of patches.
-
Quoted 8 lines
Quoted 4 lines
Hello,
Test system testing drivers for ROHM ICs bisected this commit to cause BD71847 drivers probe to not be called.
This driver (and overlay support) is in linux-next or something out of tree on top of linux-next?
Rob
Yes the driver is in mainline linux: /drivers/mfd/rohm-bd718x7.c
Kalle
Rob Herring
maintainerRe: [PATCH v4 01/29] Revert "treewide: Fix probing of devices in DT overlays"
Quoted 113 lines · Kalle Niemi
Quoted 110 lines · Rob Herring
Quoted 109 lines · Kalle Niemi
Quoted 92 lines · Herve Codina
From: Saravana Kannan <[email protected]>
This reverts commit
1a50d9403fb90cbe4dea0ec9fd0351d2ecbd8924.While the commit fixed
fw_devlinkoverlay handling for one case, it broke it for another case. So revert it and redo the fix in a separate patch.Fixes 1a50d9403fb9 ("treewide: Fix probing of devices in DT overlays")Reported-by Herve Codina <[email protected]>Closes https://lore.kernel.org/lkml/CAMuHMdXEnSD4rRJ-o90x4OprUacN_rJgyo8x6=9F9rZ+-KzjOg@mail.gmail.com/ open hereSigned-off-by Saravana Kannan <[email protected]>Signed-off-by Herve Codina <[email protected]>Acked-by Mark Brown <[email protected]>--- drivers/bus/imx-weim.c | 6 ------ drivers/i2c/i2c-core-of.c | 5 ----- drivers/of/dynamic.c | 1 - drivers/of/platform.c | 5 ----- drivers/spi/spi.c | 5 ----- 5 files changed, 22 deletions(-)drivers/bus/imx-weim.c +0
-6@@ -327,12 +327,6 @@ static int of_weim_notify(struct notifier_block *nb, unsigned long action, "Failed to setup timing for '%pOF'\n", rd->dn);if (!of_node_check_flag (rd->dn,OF_POPULATED )) { -/* -* Clear the flag before adding the device so that -* fw_devlink doesn't skip adding consumers to this -* device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ;if (!of_platform_device_create (rd->dn,NULL , &pdev->dev)) { dev_err(&pdev->dev, "Failed to create child device '%pOF'\n",drivers/i2c/i2c-core-of.c +0
-5@@ -176,11 +176,6 @@ static int of_i2c_notify(struct notifier_block *nb, unsigned long action,return NOTIFY_OK ; } -/* -* Clear the flag before adding the device so that fw_devlink -* doesn't skip adding consumers to this device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ; client =of_i2c_register_device (adap, rd->dn);if (IS_ERR (client)) { dev_err(&adap->dev, "failed to create client for '%pOF'\n",drivers/of/dynamic.c +0
-1@@ -225,7 +225,6 @@ static void __of_attach_node(struct device_node *np) np->sibling = np->parent->child; np->parent->child = np;of_node_clear_flag (np,OF_DETACHED ); - np->fwnode.flags |=FWNODE_FLAG_NOT_DEVICE ;raw_spin_unlock_irqrestore (&devtree_lock, flags);drivers/of/platform.c +0
-5@@ -739,11 +739,6 @@ static int of_platform_notify(struct notifier_block *nb,if (of_node_check_flag (rd->dn,OF_POPULATED ))return NOTIFY_OK ; -/* -* Clear the flag before adding the device so that fw_devlink -* doesn't skip adding consumers to this device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ;/* pdev_parent may be NULL when no bus platform device */ pdev_parent =of_find_device_by_node (parent); pdev = of_platform_device_create(rd->dn, NULL,drivers/spi/spi.c +0
-0@@ -4791,11 +4791,6 @@ static int of_spi_notify(struct notifier_block *nb, unsigned long action,return NOTIFY_OK ;drivers/spi/spi.c static int of_spi_notify(struct notifier_block *nb, unsigned long action, · line 4796
Quoted 10 lines
drivers/spi/spi.c +0
-5} -/* -* Clear the flag before adding the device so that fw_devlink -* doesn't skip adding consumers to this device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ; spi =of_register_spi_device (ctlr, rd->dn);put_device (&ctlr->dev);Sorry, some of you will receive this message now for second time. First message was sent to older series of patches.
-Hello,
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Test system testing drivers for ROHM ICs bisected this commit to cause BD71847 drivers probe to not be called.
This driver (and overlay support) is in linux-next or something out of tree on top of linux-next?
Rob
Yes the driver is in mainline linux: /drivers/mfd/rohm-bd718x7.c
I don't see any support to apply overlays in that driver.
Rob
Re: [PATCH v4 01/29] Revert "treewide: Fix probing of devices in DT overlays"
Quoted 116 lines · Rob Herring
Quoted 115 lines · Kalle Niemi
Quoted 112 lines · Rob Herring
Quoted 111 lines · Kalle Niemi
Quoted 92 lines · Herve Codina
From: Saravana Kannan <[email protected]>
This reverts commit
1a50d9403fb90cbe4dea0ec9fd0351d2ecbd8924.While the commit fixed
fw_devlinkoverlay handling for one case, it broke it for another case. So revert it and redo the fix in a separate patch.Fixes 1a50d9403fb9 ("treewide: Fix probing of devices in DT overlays")Reported-by Herve Codina <[email protected]>Closes https://lore.kernel.org/lkml/CAMuHMdXEnSD4rRJ-o90x4OprUacN_rJgyo8x6=9F9rZ+-KzjOg@mail.gmail.com/ open hereSigned-off-by Saravana Kannan <[email protected]>Signed-off-by Herve Codina <[email protected]>Acked-by Mark Brown <[email protected]>--- drivers/bus/imx-weim.c | 6 ------ drivers/i2c/i2c-core-of.c | 5 ----- drivers/of/dynamic.c | 1 - drivers/of/platform.c | 5 ----- drivers/spi/spi.c | 5 ----- 5 files changed, 22 deletions(-)drivers/bus/imx-weim.c +0
-6@@ -327,12 +327,6 @@ static int of_weim_notify(struct notifier_block *nb, unsigned long action, "Failed to setup timing for '%pOF'\n", rd->dn);if (!of_node_check_flag (rd->dn,OF_POPULATED )) { -/* -* Clear the flag before adding the device so that -* fw_devlink doesn't skip adding consumers to this -* device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ;if (!of_platform_device_create (rd->dn,NULL , &pdev->dev)) { dev_err(&pdev->dev, "Failed to create child device '%pOF'\n",drivers/i2c/i2c-core-of.c +0
-5@@ -176,11 +176,6 @@ static int of_i2c_notify(struct notifier_block *nb, unsigned long action,return NOTIFY_OK ; } -/* -* Clear the flag before adding the device so that fw_devlink -* doesn't skip adding consumers to this device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ; client =of_i2c_register_device (adap, rd->dn);if (IS_ERR (client)) { dev_err(&adap->dev, "failed to create client for '%pOF'\n",drivers/of/dynamic.c +0
-1@@ -225,7 +225,6 @@ static void __of_attach_node(struct device_node *np) np->sibling = np->parent->child; np->parent->child = np;of_node_clear_flag (np,OF_DETACHED ); - np->fwnode.flags |=FWNODE_FLAG_NOT_DEVICE ;raw_spin_unlock_irqrestore (&devtree_lock, flags);drivers/of/platform.c +0
-5@@ -739,11 +739,6 @@ static int of_platform_notify(struct notifier_block *nb,if (of_node_check_flag (rd->dn,OF_POPULATED ))return NOTIFY_OK ; -/* -* Clear the flag before adding the device so that fw_devlink -* doesn't skip adding consumers to this device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ;/* pdev_parent may be NULL when no bus platform device */ pdev_parent =of_find_device_by_node (parent); pdev = of_platform_device_create(rd->dn, NULL,drivers/spi/spi.c +0
-0@@ -4791,11 +4791,6 @@ static int of_spi_notify(struct notifier_block *nb, unsigned long action,return NOTIFY_OK ;drivers/spi/spi.c static int of_spi_notify(struct notifier_block *nb, unsigned long action, · line 4796
Quoted 10 lines
drivers/spi/spi.c +0
-5} -/* -* Clear the flag before adding the device so that fw_devlink -* doesn't skip adding consumers to this device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ; spi =of_register_spi_device (ctlr, rd->dn);put_device (&ctlr->dev);Sorry, some of you will receive this message now for second time. First message was sent to older series of patches.
-Hello,
Test system testing drivers for ROHM ICs bisected this commit to cause BD71847 drivers probe to not be called.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
This driver (and overlay support) is in linux-next or something out of tree on top of linux-next?
Rob
Yes the driver is in mainline linux: /drivers/mfd/rohm-bd718x7.c
I don't see any support to apply overlays in that driver.
Ah. Sorry for the confusion peeps. I asked Kalle to report this without proper consideration. 100% my bad.
While the bd718x7 drive indeed is mainline (and tested), the actual 'glue-code' doing the overlay is part of the downstream test infrastructure. So yes, this is not a bug in upstream kernel - this falls in the category of an upstream change causing downstream things to break. So, feel free to say: "Go fix your code" :)
Now that this is sorted, if someone is still interested in helping us to get our upstream drivers tested - the downstream piece is just taking the compiled device-tree overlay at runtime (via bin-attribute file), and applying it using the of_overlay_fdt_apply(). The approach is working for our testing purposes when the device is added to I2C/SPI node which is already enabled. However, in case where we have the I2C disabled, and enable it in the same overlay where we add the new device - then the new device does not get probed.
I would be really grateful if someone had a pointer for us.
Yours,
-- Matti
Signature · 6 lines
--- Matti Vaittinen Linux kernel developer at ROHM Semiconductors Oulu Finland ~~ When things go utterly wrong vim users can always type :help! ~~
Rob Herring
maintainerRe: [PATCH v4 01/29] Revert "treewide: Fix probing of devices in DT overlays"
Quoted 145 lines · Matti Vaittinen
Quoted 116 lines · Rob Herring
Quoted 115 lines · Kalle Niemi
Quoted 112 lines · Rob Herring
Quoted 111 lines · Kalle Niemi
Quoted 92 lines · Herve Codina
From: Saravana Kannan <[email protected]>
This reverts commit
1a50d9403fb90cbe4dea0ec9fd0351d2ecbd8924.While the commit fixed
fw_devlinkoverlay handling for one case, it broke it for another case. So revert it and redo the fix in a separate patch.Fixes 1a50d9403fb9 ("treewide: Fix probing of devices in DT overlays")Reported-by Herve Codina <[email protected]>Closes https://lore.kernel.org/lkml/CAMuHMdXEnSD4rRJ-o90x4OprUacN_rJgyo8x6=9F9rZ+-KzjOg@mail.gmail.com/ open hereSigned-off-by Saravana Kannan <[email protected]>Signed-off-by Herve Codina <[email protected]>Acked-by Mark Brown <[email protected]>--- drivers/bus/imx-weim.c | 6 ------ drivers/i2c/i2c-core-of.c | 5 ----- drivers/of/dynamic.c | 1 - drivers/of/platform.c | 5 ----- drivers/spi/spi.c | 5 ----- 5 files changed, 22 deletions(-)drivers/bus/imx-weim.c +0
-6@@ -327,12 +327,6 @@ static int of_weim_notify(struct notifier_block *nb, unsigned long action, "Failed to setup timing for '%pOF'\n", rd->dn);if (!of_node_check_flag (rd->dn,OF_POPULATED )) { -/* -* Clear the flag before adding the device so that -* fw_devlink doesn't skip adding consumers to this -* device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ;if (!of_platform_device_create (rd->dn,NULL , &pdev->dev)) { dev_err(&pdev->dev, "Failed to create child device '%pOF'\n",drivers/i2c/i2c-core-of.c +0
-5@@ -176,11 +176,6 @@ static int of_i2c_notify(struct notifier_block *nb, unsigned long action,return NOTIFY_OK ; } -/* -* Clear the flag before adding the device so that fw_devlink -* doesn't skip adding consumers to this device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ; client =of_i2c_register_device (adap, rd->dn);if (IS_ERR (client)) { dev_err(&adap->dev, "failed to create client for '%pOF'\n",drivers/of/dynamic.c +0
-1@@ -225,7 +225,6 @@ static void __of_attach_node(struct device_node *np) np->sibling = np->parent->child; np->parent->child = np;of_node_clear_flag (np,OF_DETACHED ); - np->fwnode.flags |=FWNODE_FLAG_NOT_DEVICE ;raw_spin_unlock_irqrestore (&devtree_lock, flags);drivers/of/platform.c +0
-5@@ -739,11 +739,6 @@ static int of_platform_notify(struct notifier_block *nb,if (of_node_check_flag (rd->dn,OF_POPULATED ))return NOTIFY_OK ; -/* -* Clear the flag before adding the device so that fw_devlink -* doesn't skip adding consumers to this device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ;/* pdev_parent may be NULL when no bus platform device */ pdev_parent =of_find_device_by_node (parent); pdev = of_platform_device_create(rd->dn, NULL,drivers/spi/spi.c +0
-0@@ -4791,11 +4791,6 @@ static int of_spi_notify(struct notifier_block *nb, unsigned long action,return NOTIFY_OK ;drivers/spi/spi.c static int of_spi_notify(struct notifier_block *nb, unsigned long action, · line 4796
Quoted 10 lines
drivers/spi/spi.c +0
-5} -/* -* Clear the flag before adding the device so that fw_devlink -* doesn't skip adding consumers to this device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ; spi =of_register_spi_device (ctlr, rd->dn);put_device (&ctlr->dev);Sorry, some of you will receive this message now for second time. First message was sent to older series of patches.
-Hello,
Test system testing drivers for ROHM ICs bisected this commit to cause BD71847 drivers probe to not be called.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
This driver (and overlay support) is in linux-next or something out of tree on top of linux-next?
Rob
Yes the driver is in mainline linux: /drivers/mfd/rohm-bd718x7.c
I don't see any support to apply overlays in that driver.
Ah. Sorry for the confusion peeps. I asked Kalle to report this without proper consideration. 100% my bad.
While the bd718x7 drive indeed is mainline (and tested), the actual 'glue-code' doing the overlay is part of the downstream test infrastructure. So yes, this is not a bug in upstream kernel - this falls in the category of an upstream change causing downstream things to break. So, feel free to say: "Go fix your code" :)
Now that this is sorted, if someone is still interested in helping us to get our upstream drivers tested - the downstream piece is just taking the compiled device-tree overlay at runtime (via bin-attribute file), and applying it using the
of_overlay_fdt_apply(). The approach is working for our testing purposes when the device is added to I2C/SPI node which is already enabled. However, in case where we have the I2C disabled, and enable it in the same overlay where we add the new device
- then the new device does not get probed.
Quoted 1 line
I would be really grateful if someone had a pointer for us.
Seems to be fw_devlink related. I suppose if you turn it off it works? There's info about the dependencies in sysfs or maybe debugfs. I don't remember the details, but that should help to tell you why things aren't probing.
I've dropped the changes for 6.18 for now. No one really seems to be in need of them yet AFAICT.
Rob
Herve Codina
maintainerRe: [PATCH v4 01/29] Revert "treewide: Fix probing of devices in DT overlays"
Hi Matti, Rob,
...
Quoted 5 lines
Seems to be
fw_devlinkrelated. I suppose if you turn it off it works? There's info about the dependencies in sysfs or maybe debugfs. I don't remember the details, but that should help to tell you why things aren't probing.
All available links are available the /sys/class/devlink/ directory [1]. You can check them to see if each each provider/consumer are correct.
Also, for each device you can find suppliers [2] the device depends on and consumers of the device in its device directory [3].
for instance in /sys/bus/platform/devices/foo/ for the foo device.
[1] https://elixir.bootlin.com/linux/v6.18-rc7/source/Documentation/ABI/testing/sysfs-class-devlink
[2] https://elixir.bootlin.com/linux/v6.18-rc7/source/Documentation/ABI/testing/sysfs-devices-supplier
[3] https://elixir.bootlin.com/linux/v6.18-rc7/source/Documentation/ABI/testing/sysfs-devices-consumer
Quoted 3 lines
I've dropped the changes for 6.18 for now. No one really seems to be in need of them yet AFAICT.
Best regards,
Hervé
Re: [PATCH v4 01/29] Revert "treewide: Fix probing of devices in DT overlays"
In reply to Rob HerringQuoted 148 lines · Rob Herring
Quoted 140 lines · Matti Vaittinen
Quoted 113 lines · Rob Herring
Quoted 112 lines · Kalle Niemi
Quoted 110 lines · Rob Herring
Quoted 109 lines · Kalle Niemi
Quoted 92 lines · Herve Codina
From: Saravana Kannan <[email protected]>
This reverts commit
1a50d9403fb90cbe4dea0ec9fd0351d2ecbd8924.While the commit fixed
fw_devlinkoverlay handling for one case, it broke it for another case. So revert it and redo the fix in a separate patch.Fixes 1a50d9403fb9 ("treewide: Fix probing of devices in DT overlays")Reported-by Herve Codina <[email protected]>Closes https://lore.kernel.org/lkml/CAMuHMdXEnSD4rRJ-o90x4OprUacN_rJgyo8x6=9F9rZ+-KzjOg@mail.gmail.com/ open hereSigned-off-by Saravana Kannan <[email protected]>Signed-off-by Herve Codina <[email protected]>Acked-by Mark Brown <[email protected]>--- drivers/bus/imx-weim.c | 6 ------ drivers/i2c/i2c-core-of.c | 5 ----- drivers/of/dynamic.c | 1 - drivers/of/platform.c | 5 ----- drivers/spi/spi.c | 5 ----- 5 files changed, 22 deletions(-)drivers/bus/imx-weim.c +0
-6@@ -327,12 +327,6 @@ static int of_weim_notify(struct notifier_block *nb, unsigned long action, "Failed to setup timing for '%pOF'\n", rd->dn);if (!of_node_check_flag (rd->dn,OF_POPULATED )) { -/* -* Clear the flag before adding the device so that -* fw_devlink doesn't skip adding consumers to this -* device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ;if (!of_platform_device_create (rd->dn,NULL , &pdev->dev)) { dev_err(&pdev->dev, "Failed to create child device '%pOF'\n",drivers/i2c/i2c-core-of.c +0
-5@@ -176,11 +176,6 @@ static int of_i2c_notify(struct notifier_block *nb, unsigned long action,return NOTIFY_OK ; } -/* -* Clear the flag before adding the device so that fw_devlink -* doesn't skip adding consumers to this device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ; client =of_i2c_register_device (adap, rd->dn);if (IS_ERR (client)) { dev_err(&adap->dev, "failed to create client for '%pOF'\n",drivers/of/dynamic.c +0
-1@@ -225,7 +225,6 @@ static void __of_attach_node(struct device_node *np) np->sibling = np->parent->child; np->parent->child = np;of_node_clear_flag (np,OF_DETACHED ); - np->fwnode.flags |=FWNODE_FLAG_NOT_DEVICE ;raw_spin_unlock_irqrestore (&devtree_lock, flags);drivers/of/platform.c +0
-5@@ -739,11 +739,6 @@ static int of_platform_notify(struct notifier_block *nb,if (of_node_check_flag (rd->dn,OF_POPULATED ))return NOTIFY_OK ; -/* -* Clear the flag before adding the device so that fw_devlink -* doesn't skip adding consumers to this device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ;/* pdev_parent may be NULL when no bus platform device */ pdev_parent =of_find_device_by_node (parent); pdev = of_platform_device_create(rd->dn, NULL,drivers/spi/spi.c +0
-0@@ -4791,11 +4791,6 @@ static int of_spi_notify(struct notifier_block *nb, unsigned long action,return NOTIFY_OK ;drivers/spi/spi.c static int of_spi_notify(struct notifier_block *nb, unsigned long action, · line 4796
Quoted 10 lines
drivers/spi/spi.c +0
-5} -/* -* Clear the flag before adding the device so that fw_devlink -* doesn't skip adding consumers to this device. -*/ - rd->dn->fwnode.flags &= ~FWNODE_FLAG_NOT_DEVICE ; spi =of_register_spi_device (ctlr, rd->dn);put_device (&ctlr->dev);Sorry, some of you will receive this message now for second time. First message was sent to older series of patches.
-Hello,
Quoted 8 lines
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
Test system testing drivers for ROHM ICs bisected this commit to cause BD71847 drivers probe to not be called.
This driver (and overlay support) is in linux-next or something out of tree on top of linux-next?
Rob
Yes the driver is in mainline linux: /drivers/mfd/rohm-bd718x7.c
I don't see any support to apply overlays in that driver.
Ah. Sorry for the confusion peeps. I asked Kalle to report this without proper consideration. 100% my bad.
While the bd718x7 drive indeed is mainline (and tested), the actual 'glue-code' doing the overlay is part of the downstream test infrastructure. So yes, this is not a bug in upstream kernel - this falls in the category of an upstream change causing downstream things to break. So, feel free to say: "Go fix your code" :)
Now that this is sorted, if someone is still interested in helping us to get our upstream drivers tested - the downstream piece is just taking the compiled device-tree overlay at runtime (via bin-attribute file), and applying it using the
of_overlay_fdt_apply(). The approach is working for our testing purposes when the device is added to I2C/SPI node which is already enabled. However, in case where we have the I2C disabled, and enable it in the same overlay where we add the new device
- then the new device does not get probed.Quoted 1 line
I would be really grateful if someone had a pointer for us.
Seems to be
fw_devlinkrelated. I suppose if you turn it off it works? There's info about the dependencies in sysfs or maybe debugfs. I don't remember the details, but that should help to tell you why things aren't probing.
Quoted 4 lines
I've dropped the changes for 6.18 for now. No one really seems to be in need of them yet AFAICT.
Rob
Hello,
Thank you for the help. We are going to look into sysfs / debugfs as soon as we have time.
I tried with this and result was the same, BD71847 was not probed:
[ 0.000000] Kernel command line: console=ttyO0,115200n8 root=/dev/nfs rw nfsroot=192.168.255.126:/home/user01/nfs,nfsvers=3 ip=192.168.255.1:192.168.255.126::255.255.255.0:bbb1:eth0 nfsrootdebug fw_devlink=no
With todays linux-next the BD71847 got probed; I assume the changes got dropped for the moment.
Kalle
Herve Codina
maintainerRe: [PATCH v4 01/29] Revert "treewide: Fix probing of devices in DT overlays"
Hi Kalle,
On Fri, 28 Nov 2025 10:34:57 +0200
Kalle Niemi <[email protected]> wrote:
...
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 11 lines
Quoted 10 lines
Quoted 9 lines
Quoted 5 lines
Hello,
Test system testing drivers for ROHM ICs bisected this commit to cause BD71847 drivers probe to not be called.
This driver (and overlay support) is in linux-next or something out of tree on top of linux-next?
Rob
Yes the driver is in mainline linux: /drivers/mfd/rohm-bd718x7.c
I don't see any support to apply overlays in that driver.
Ah. Sorry for the confusion peeps. I asked Kalle to report this without proper consideration. 100% my bad.
While the bd718x7 drive indeed is mainline (and tested), the actual 'glue-code' doing the overlay is part of the downstream test infrastructure. So yes, this is not a bug in upstream kernel - this falls in the category of an upstream change causing downstream things to break. So, feel free to say: "Go fix your code" :)
Now that this is sorted, if someone is still interested in helping us to get our upstream drivers tested - the downstream piece is just taking the compiled device-tree overlay at runtime (via bin-attribute file), and applying it using the
of_overlay_fdt_apply(). The approach is working for our testing purposes when the device is added to I2C/SPI node which is already enabled. However, in case where we have the I2C disabled, and enable it in the same overlay where we add the new device
- then the new device does not get probed.
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
I would be really grateful if someone had a pointer for us.
Seems to be
fw_devlinkrelated. I suppose if you turn it off it works? There's info about the dependencies in sysfs or maybe debugfs. I don't remember the details, but that should help to tell you why things aren't probing.
Rob reverted patches but I plan to continue my work on it. On my side, I need the reverted patches but I fully understand that, on your side, you need a working system.
In order to move forward and find a solution for my next iteration, can you send your overlay (dtso) used in your working and non working cases?
Best regards,
Hervé
Re: [PATCH v4 01/29] Revert "treewide: Fix probing of devices in DT overlays"
Quoted 45 lines · Herve Codina
Hi Kalle,
On Fri, 28 Nov 2025 10:34:57 +0200
Kalle Niemi <[email protected]> wrote:...
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 11 lines
Quoted 10 lines
Quoted 9 lines
Quoted 5 lines
Hello,
Test system testing drivers for ROHM ICs bisected this commit to cause BD71847 drivers probe to not be called.
This driver (and overlay support) is in linux-next or something out of tree on top of linux-next?
Rob
Yes the driver is in mainline linux: /drivers/mfd/rohm-bd718x7.c
I don't see any support to apply overlays in that driver.
Ah. Sorry for the confusion peeps. I asked Kalle to report this without proper consideration. 100% my bad.
While the bd718x7 drive indeed is mainline (and tested), the actual 'glue-code' doing the overlay is part of the downstream test infrastructure. So yes, this is not a bug in upstream kernel - this falls in the category of an upstream change causing downstream things to break. So, feel free to say: "Go fix your code" :)
Now that this is sorted, if someone is still interested in helping us to get our upstream drivers tested - the downstream piece is just taking the compiled device-tree overlay at runtime (via bin-attribute file), and applying it using the
of_overlay_fdt_apply(). The approach is working for our testing purposes when the device is added to I2C/SPI node which is already enabled. However, in case where we have the I2C disabled, and enable it in the same overlay where we add the new device
- then the new device does not get probed.Quoted 5 lines
Quoted 5 lines
Quoted 1 line
I would be really grateful if someone had a pointer for us.
Seems to be
fw_devlinkrelated. I suppose if you turn it off it works? There's info about the dependencies in sysfs or maybe debugfs. I don't remember the details, but that should help to tell you why things aren't probing.Rob reverted patches but I plan to continue my work on it. On my side, I need the reverted patches but I fully understand that, on your side, you need a working system.
Quoted 5 lines
In order to move forward and find a solution for my next iteration, can you send your overlay (dtso) used in your working and non working cases?
Best regards,
Hervé
Hello Hervé,
I have attached the overlay source file: bd71847_overlay.dts
BR
Kalle
Herve Codina
maintainerRe: [PATCH v4 01/29] Revert "treewide: Fix probing of devices in DT overlays"
Hi Kalle, Matti,
Quoted 49 lines · On Tue, 2 Dec 2025 13:21:16 +0200 Kalle Niemi <[email protected]> wrote:
Quoted 48 lines · Herve Codina
Hi Kalle,
On Fri, 28 Nov 2025 10:34:57 +0200
Kalle Niemi <[email protected]> wrote:...
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 11 lines
Quoted 10 lines
Quoted 9 lines
Quoted 5 lines
Hello,
Test system testing drivers for ROHM ICs bisected this commit to cause BD71847 drivers probe to not be called.
This driver (and overlay support) is in linux-next or something out of tree on top of linux-next?
Rob
Yes the driver is in mainline linux: /drivers/mfd/rohm-bd718x7.c
I don't see any support to apply overlays in that driver.
Ah. Sorry for the confusion peeps. I asked Kalle to report this without proper consideration. 100% my bad.
While the bd718x7 drive indeed is mainline (and tested), the actual 'glue-code' doing the overlay is part of the downstream test infrastructure. So yes, this is not a bug in upstream kernel - this falls in the category of an upstream change causing downstream things to break. So, feel free to say: "Go fix your code" :)
Now that this is sorted, if someone is still interested in helping us to get our upstream drivers tested - the downstream piece is just taking the compiled device-tree overlay at runtime (via bin-attribute file), and applying it using the
of_overlay_fdt_apply(). The approach is working for our testing purposes when the device is added to I2C/SPI node which is already enabled. However, in case where we have the I2C disabled, and enable it in the same overlay where we add the new device
- then the new device does not get probed.Quoted 5 lines
Quoted 5 lines
Quoted 1 line
I would be really grateful if someone had a pointer for us.
Seems to be
fw_devlinkrelated. I suppose if you turn it off it works? There's info about the dependencies in sysfs or maybe debugfs. I don't remember the details, but that should help to tell you why things aren't probing.Rob reverted patches but I plan to continue my work on it. On my side, I need the reverted patches but I fully understand that, on your side, you need a working system.
In order to move forward and find a solution for my next iteration, can you send your overlay (dtso) used in your working and non working cases?
Quoted 6 lines
Quoted 2 lines
Best regards,
HervéHello Hervé,
I have attached the overlay source file:
bd71847_overlay.dts
Thanks a lot for your overlay.
I did an update of the reverted patches and I didn't detect any regression with the update applied on my use case but I don't have the needed code to perform tests similar to your use case. Indeed, you apply the overlay using an out of tree code.
May I ask you to perform a test of this update on your side?
First you can use the last linux-next kernel where reverted patches are present. The next-20251127 tag is a good candidate. Indeed both patches are present:
- 76841259ac092 ("of: dynamic: Fix overlayed devices not probing because of fw_devlink")
- 7d67ddc5f0148 ("Revert "treewide: Fix probing of devices in DT overlays"")
Of course, be sure to have the issue using this kernel with your overlays.
Then can you add the following modification on your faulty kernel:
---- 8< ----
drivers/of/overlay.c +14 -0
@@ -190,6 +190,20 @@ static void overlay_fw_devlink_refresh(struct overlay_changeset *ovcs)for (int i =0 ; i < ovcs->count; i++) {struct device_node *np = ovcs->fragments[i].target; +/* +* The device related to target node itself could have been +* removed and re-added. This happens when the 'status' property +* in the target node has been changed by the overlay. +* +* In that case the parent node needs to be fixed. +* +* Before fixing the target node itself, fix its parent. To keep +* things simple, fix the parent in any case. If nothing needs +* to be fixed, fw_devlink_refresh_fwnode() acts as a no-op. +*/ +if (np->parent) +fw_devlink_refresh_fwnode (of_fwnode_handle (np->parent)); +fw_devlink_refresh_fwnode (of_fwnode_handle (np)); } }
---- 8< ----
My hope is that this modification will fix your issue. If so, I will add it in my next iteration.
If you cannot perform the test on your side, can you provide me the out of tree code you use to apply the overlay?
Best regards,
Hervé
Re: [PATCH v4 01/29] Revert "treewide: Fix probing of devices in DT overlays"
Quoted 106 lines · Herve Codina
Hi Kalle, Matti,
Quoted 49 lines · On Tue, 2 Dec 2025 13:21:16 +0200 Kalle Niemi <[email protected]> wrote:
Quoted 48 lines · Herve Codina
Hi Kalle,
On Fri, 28 Nov 2025 10:34:57 +0200
Kalle Niemi <[email protected]> wrote:...
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 11 lines
Quoted 10 lines
Quoted 9 lines
Quoted 5 lines
Hello,
Test system testing drivers for ROHM ICs bisected this commit to cause BD71847 drivers probe to not be called.
This driver (and overlay support) is in linux-next or something out of tree on top of linux-next?
Rob
Yes the driver is in mainline linux: /drivers/mfd/rohm-bd718x7.c
I don't see any support to apply overlays in that driver.
Ah. Sorry for the confusion peeps. I asked Kalle to report this without proper consideration. 100% my bad.
While the bd718x7 drive indeed is mainline (and tested), the actual 'glue-code' doing the overlay is part of the downstream test infrastructure. So yes, this is not a bug in upstream kernel - this falls in the category of an upstream change causing downstream things to break. So, feel free to say: "Go fix your code" :)
Now that this is sorted, if someone is still interested in helping us to get our upstream drivers tested - the downstream piece is just taking the compiled device-tree overlay at runtime (via bin-attribute file), and applying it using the
of_overlay_fdt_apply(). The approach is working for our testing purposes when the device is added to I2C/SPI node which is already enabled. However, in case where we have the I2C disabled, and enable it in the same overlay where we add the new device
- then the new device does not get probed.Quoted 5 lines
Quoted 5 lines
Quoted 1 line
I would be really grateful if someone had a pointer for us.
Seems to be
fw_devlinkrelated. I suppose if you turn it off it works? There's info about the dependencies in sysfs or maybe debugfs. I don't remember the details, but that should help to tell you why things aren't probing.Rob reverted patches but I plan to continue my work on it. On my side, I need the reverted patches but I fully understand that, on your side, you need a working system.
In order to move forward and find a solution for my next iteration, can you send your overlay (dtso) used in your working and non working cases?
Quoted 6 lines
Quoted 2 lines
Best regards,
HervéHello Hervé,
I have attached the overlay source file:
bd71847_overlay.dtsThanks a lot for your overlay.
I did an update of the reverted patches and I didn't detect any regression with the update applied on my use case but I don't have the needed code to perform tests similar to your use case. Indeed, you apply the overlay using an out of tree code.
May I ask you to perform a test of this update on your side?
First you can use the last linux-next kernel where reverted patches are present. The next-20251127 tag is a good candidate. Indeed both patches are present:
-76841259ac092("of: dynamic: Fix overlayed devices not probing because offw_devlink")
-7d67ddc5f0148("Revert "treewide: Fix probing of devices in DT overlays"")Of course, be sure to have the issue using this kernel with your overlays.
Then can you add the following modification on your faulty kernel:
---- 8< ----drivers/of/overlay.c +14
-1@@ -190,6 +190,20 @@ static void overlay_fw_devlink_refresh(struct overlay_changeset *ovcs)for (int i =0 ; i < ovcs->count; i++) {struct device_node *np = ovcs->fragments[i].target; +/* +* The device related to target node itself could have been +* removed and re-added. This happens when the 'status' property +* in the target node has been changed by the overlay. +* +* In that case the parent node needs to be fixed. +* +* Before fixing the target node itself, fix its parent. To keep +* things simple, fix the parent in any case. If nothing needs +* to be fixed, fw_devlink_refresh_fwnode() acts as a no-op. +*/ +if (np->parent) +fw_devlink_refresh_fwnode (of_fwnode_handle (np->parent)); +fw_devlink_refresh_fwnode (of_fwnode_handle (np)); } } ---- 8< ----
Quoted 8 lines
My hope is that this modification will fix your issue. If so, I will add it in my next iteration.
If you cannot perform the test on your side, can you provide me the out of tree code you use to apply the overlay?
Best regards,
Hervé
Hello Hervé,
I tried this patch on next-20251127 by manually adding the added lines to /drivers/of/overlay.c, and it did not solve the issue. I will continue to test this.
BR
Kalle
Herve Codina
maintainerRe: [PATCH v4 01/29] Revert "treewide: Fix probing of devices in DT overlays"
Hi Kalle,
On Wed, 3 Dec 2025 12:11:45 +0200
Kalle Niemi <[email protected]> wrote:
...
Quoted 5 lines
I tried this patch on next-20251127 by manually adding the added lines to /drivers/of/overlay.c, and it did not solve the issue. I will continue to test this.
Did you observe same traces reported by Geert?
To move forward, I think I will need help.
Indeed, Kalle, Geert, I don't have your hardware, your related overlay or a similar one that could be used for test and also I don't have your out of tree code used to handle this overlay.
I know overlays and fw_devlink have issues. Links created by fw_devlink when an overlay is applied were not correct on my side.
Can you check your <supplier>--<consumer> links with 'ls /sys/class/devlinks'
On my side, without my patches some links were not correct. They linked to the parent of the supplier instead of the supplier itself. The consequence is a kernel crash, use after free, refcounting failure, ... when the supplier device is removed.
Indeed, with wrong links consumers were not removed before suppliers they used.
Looking at Geert traces:
--- 8< ---rcar_sound ec500000.sound: Failed to create device link (0x180) with supplier soc for /soc/sound@ec500000/rcar_sound,src/src-0 rcar_sound ec500000.sound: Failed to create device link (0x180) with supplier soc for /soc/sound@ec500000/rcar_sound,src/src-1 [...]
--- 8< ---
Even if it is not correct, why the soc device cannot be a provider? I don't have the answer to this question yet.
Without having the exact tree structure of the base device-tree, the overlay and the way it is applied, and so without been able to reproduce the issue on my side, investigating the issue is going to be difficult.
I hope to find some help to move forward and fix the issue.
Saravana's email (Saravana Kannan <[email protected]>) seems incorrect. Got emails delivery failure with this email address.
Best regards,
Hervé
Re: [PATCH v4 01/29] Revert "treewide: Fix probing of devices in DT overlays"
Hi Hervé,
Quoted 26 lines · Herve Codina
Indeed, Kalle, Geert, I don't have your hardware, your related overlay or a similar one that could be used for test and also I don't have your out of tree code used to handle this overlay.
I know overlays and
fw_devlinkhave issues. Links created byfw_devlinkwhen an overlay is applied were not correct on my side.Can you check your <supplier>--<consumer> links with 'ls
/sys/class/devlinks'On my side, without my patches some links were not correct. They linked to the parent of the supplier instead of the supplier itself. The consequence is a kernel crash, use after free, refcounting failure, ... when the supplier device is removed.
Indeed, with wrong links consumers were not removed before suppliers they used.
Looking at Geert traces:
--- 8< ---rcar_soundec500000.sound: Failed to create device link (0x180) with supplier soc for /soc/sound@ec500000/rcar_sound,src/src-0rcar_soundec500000.sound: Failed to create device link (0x180) with supplier soc for /soc/sound@ec500000/rcar_sound,src/src-1 [...]
--- 8< ---
Quoted 2 lines
Even if it is not correct, why the soc device cannot be a provider? I don't have the answer to this question yet.
I have no idea. These failures (sound) are also not related to the device I am adding through the overlay (SPI EEPROM).
Note that these failures appear only with your suggested fix, and are not seen with just the patch in the subject of this email thread.
Quoted 5 lines
Without having the exact tree structure of the base device-tree, the overlay and the way it is applied, and so without been able to reproduce the issue on my side, investigating the issue is going to be difficult.
I hope to find some help to move forward and fix the issue.
Base DTS is [1], overlay DTS is [2].
Applying and removing the overlay is done using OF_CONFIGFS[3], and "overlay [add|rm] 25lc040"[4].
I assume you can reproduce the issue on any board that has an SPI EEPROM, after moving the SPI bus enablement and SPI EEPROM node to an overlay. Probably even with an I2C EEPROM instead. Or even without an actual EEPROM connected, as even the SPI bus fails to appear.
Quoted 2 lines
Saravana's email (Saravana Kannan <[email protected]>) seems incorrect. Got emails delivery failure with this email address.
Yeah, he moved company.
He is still alive, I met him in the LPC Training Session yesterday ;-)
Thanks!
[1] https://web.git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git/tree/arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts
[2] https://web.git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git/tree/arch/arm64/boot/dts/renesas/r8a77990-ebisu-cn41-msiof0-25lc040.dtso?h=topic/renesas-overlays-v6.17-rc1
[3] https://web.git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git/log/?h=topic/overlays-v6.17-rc1
[4] https://elinux.org/R-Car/DT-Overlays#Helper_Script
[5] https://lore.kernel.org/CAMuHMdXEnSD4rRJ-o90x4OprUacN_rJgyo8x6=9F9rZ+-KzjOg@mail.gmail.com/
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Andy Shevchenko
reviewerRe: [PATCH v4 01/29] Revert "treewide: Fix probing of devices in DT overlays"
Quoted 1 line · Geert Uytterhoeven
On Thu, 4 Dec 2025 at 08:39, Herve Codina <[email protected]> wrote:
...
Quoted 5 lines
Quoted 2 lines
Saravana's email (Saravana Kannan <[email protected]>) seems incorrect. Got emails delivery failure with this email address.
Yeah, he moved company.
He is still alive, I met him in the LPC Training Session yesterday ;-)
Usually people update the MAINTAINERS and/or .mailcapain such a case. Can you ping him about this?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Herve Codina
maintainerRe: [PATCH v4 01/29] Revert "treewide: Fix probing of devices in DT overlays"
In reply to Geert UytterhoevenHi Geert, Kalle, Rob,
Quoted 58 lines · On Thu, 4 Dec 2025 11:49:13 +0100 Geert Uytterhoeven <[email protected]>…
Hi Hervé,
Quoted 26 lines · Herve Codina
Indeed, Kalle, Geert, I don't have your hardware, your related overlay or a similar one that could be used for test and also I don't have your out of tree code used to handle this overlay.
I know overlays and
fw_devlinkhave issues. Links created byfw_devlinkwhen an overlay is applied were not correct on my side.Can you check your <supplier>--<consumer> links with 'ls
/sys/class/devlinks'On my side, without my patches some links were not correct. They linked to the parent of the supplier instead of the supplier itself. The consequence is a kernel crash, use after free, refcounting failure, ... when the supplier device is removed.
Indeed, with wrong links consumers were not removed before suppliers they used.
Looking at Geert traces:
--- 8< ---rcar_soundec500000.sound: Failed to create device link (0x180) with supplier soc for /soc/sound@ec500000/rcar_sound,src/src-0rcar_soundec500000.sound: Failed to create device link (0x180) with supplier soc for /soc/sound@ec500000/rcar_sound,src/src-1 [...]
--- 8< ---Quoted 2 lines
Even if it is not correct, why the soc device cannot be a provider? I don't have the answer to this question yet.
I have no idea. These failures (sound) are also not related to the device I am adding through the overlay (SPI EEPROM).
Note that these failures appear only with your suggested fix, and are not seen with just the patch in the subject of this email thread.Quoted 5 lines
Without having the exact tree structure of the base device-tree, the overlay and the way it is applied, and so without been able to reproduce the issue on my side, investigating the issue is going to be difficult.
I hope to find some help to move forward and fix the issue.
Base DTS is [1], overlay DTS is [2].
Applying and removing the overlay is done using OF_CONFIGFS[3], and "overlay [add|rm] 25lc040"[4].I assume you can reproduce the issue on any board that has an SPI EEPROM, after moving the SPI bus enablement and SPI EEPROM node to an overlay. Probably even with an I2C EEPROM instead. Or even without an actual EEPROM connected, as even the SPI bus fails to appear.
Quoted 2 lines
Saravana's email (Saravana Kannan <[email protected]>) seems incorrect. Got emails delivery failure with this email address.
Yeah, he moved company.
He is still alive, I met him in the LPC Training Session yesterday ;-)
Quoted 8 lines
Thanks!
[1] https://web.git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git/tree/arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts
[2] https://web.git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git/tree/arch/arm64/boot/dts/renesas/r8a77990-ebisu-cn41-msiof0-25lc040.dtso?h=topic/renesas-overlays-v6.17-rc1
[3] https://web.git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git/log/?h=topic/overlays-v6.17-rc1
[4] https://elinux.org/R-Car/DT-Overlays#Helper_Script
[5] https://lore.kernel.org/CAMuHMdXEnSD4rRJ-o90x4OprUacN_rJgyo8x6=9F9rZ+-KzjOg@mail.gmail.com/
I did some tests with boards I have.
First I used a Marvel board based on an Armada 3720.
In my overlay, I added the pinmux related to the SPI controller, enabled this SPI controller and added a SPI flash.
It didn't work with or without culprit patches from my series applied. Indeed, the pinctrl driver used is an MFD driver an mixed pinmux definition nodes with device description (a clock) node.
When a new node is added, a new device is created. Indeed, because the driver is an MFD driver, it is a bus driver and handled by of_platform bus.
My new node is considered by devlink as a node that will have a device ready to work (driver attached and device probed). A link is created between this node and the consumers of this node (i.e. the SPI controller). devlink is waiting for this provider to be ready before allowing the its consumer to probe. This node (simple pinmux description) will never lead to a device and devlink will never see this "provider" ready.
Did a test with a Renesas RZ/N1D (r9a06g032) based board and built a similar overlay involving I2C controller pinmux, I2C controller and an EEPROM.
Here, also the overlay didn't work but the issue is different.
The pinmux definition for pinctrl (i.e. pinctrl subnodes) are looked when the pinctrl driver probes. Adding a new node later is not handled by the pinctrl driver.
Applying the overlay leads to a simple:
[ 16.934168] rzn1-pinctrl 40067000.pinctrl: unable to find group for node /soc/pinctrl@40067000/pins_i2c2
Indeed, the 'pins_i2c2' has been added by the overlay and was not present when the pinctrl probed.
Tried without adding a new pinmux node (pinctrl subnode) from the overlay and used nodes already existing in the base DT.
On my Marvell Armada 3720 board, it works with or without my patches. No regression detected due to my patches.
On my RZ/N1D board, it works also with or without my patches. Here also, no regression detected.
Also, on my Marvell Armada 3720 board, I can plug my LAN966x PCI board. The LAN966x PCI driver used an overlay to describe the LAN966x PCI board.
With the upstream patch not reverted, i.e. 1a50d9403fb9 ("treewide: Fix probing of devices in DT overlays")" applied, devlinks created for the LAN966x PCI board internal devices are incorrect and lead to crashes when the LAN966x PCI driver is removed due to wrong provider/consumer dependencies.
When this patch is reverted and replaced by "of: dynamic: Fix overlayed devices not probing because of fw_devlink", devlinks created for the LAN966x PCI board internal devices are corrects and crashes are no more present on removal.
Kalle, Geert, can you perform a test on your hardware with my patches applied and moving your pinmux definition from the overlay to the base device-tree?
The kernel you can use is for instance the kernel at the next-20251127 tag. Needed patches for test are present in this kernel:
- 76841259ac092 ("of: dynamic: Fix overlayed devices not probing because of fw_devlink")
- 7d67ddc5f0148 ("Revert "treewide: Fix probing of devices in DT overlays"")
Best regards,
Hervé
Re: [PATCH v4 01/29] Revert "treewide: Fix probing of devices in DT overlays"
Hi Dee Ho peeps,
I tried to create a minimal piece of code/dts to demonstrate the issue seem in the ROHM automated testing.
Quoted 4 lines · Herve Codina
Hi Geert, Kalle, Rob,
On Thu, 4 Dec 2025 11:49:13 +0100
Geert Uytterhoeven <[email protected]> wrote:
//snip
Quoted 2 lines
When a new node is added, a new device is created. Indeed, because the driver is an MFD driver, it is a bus driver and handled by
of_platformbus.
We do also have an MFD device - but it is not a platform device but an I2C device - thus it should be probed by the I2C bus (if I'm not mistaken). So, I guess this is not bus-specific problem.
https://elixir.bootlin.com/linux/v6.18/source/drivers/mfd/rohm-bd718x7.c#L206
Quoted 6 lines
My new node is considered by devlink as a node that will have a device ready to work (driver attached and device probed). A link is created between this node and the consumers of this node (i.e. the SPI controller). devlink is waiting for this provider to be ready before allowing the its consumer to probe. This node (simple pinmux description) will never lead to a device and devlink will never see this "provider" ready.
I believe Kalle did see the same "probe-not-called" -problem, even when disabling the fw_devlink from the kernel commandline. (It's worth mentioning that I am not sure if Kalle tried if probe was called with "previously working" kernels when fw_devlink is disabled).
Quoted 31 lines
Did a test with a Renesas RZ/N1D (r9a06g032) based board and built a similar overlay involving I2C controller pinmux, I2C controller and an EEPROM.
Here, also the overlay didn't work but the issue is different.
The pinmux definition for pinctrl (i.e. pinctrl subnodes) are looked when the pinctrl driver probes. Adding a new node later is not handled by the pinctrl driver.
Applying the overlay leads to a simple:[ 16.934168] rzn1-pinctrl 40067000.pinctrl: unable to find group for node /soc/pinctrl@40067000/pins_i2c2Indeed, the '
pins_i2c2' has been added by the overlay and was not present when the pinctrl probed.Tried without adding a new pinmux node (pinctrl subnode) from the overlay and used nodes already existing in the base DT.
On my Marvell Armada 3720 board, it works with or without my patches. No regression detected due to my patches.
On my RZ/N1D board, it works also with or without my patches. Here also, no regression detected.
Also, on my Marvell Armada 3720 board, I can plug my LAN966x PCI board. The LAN966x PCI driver used an overlay to describe the LAN966x PCI board.
With the upstream patch not reverted, i.e.
1a50d9403fb9("treewide: Fix probing of devices in DT overlays")" applied, devlinks created for the LAN966x PCI board internal devices are incorrect and lead to crashes when the LAN966x PCI driver is removed due to wrong provider/consumer dependencies.
Quoted 8 lines
When this patch is reverted and replaced by "of: dynamic: Fix overlayed devices not probing because of
fw_devlink", devlinks created for the LAN966x PCI board internal devices are corrects and crashes are no more present on removal.Kalle, Geert, can you perform a test on your hardware with my patches applied and moving your pinmux definition from the overlay to the base device-tree?
I got a bit lost regarding which patches to test :)
Quoted 5 lines
The kernel you can use is for instance the kernel at the next-20251127 tag. Needed patches for test are present in this kernel:
-76841259ac092("of: dynamic: Fix overlayed devices not probing because offw_devlink")
-7d67ddc5f0148("Revert "treewide: Fix probing of devices in DT overlays"")
I did a minimal overlay test which can be ran on beaglebone black. I assume the same can be done on any board where you have (i2c/spi/xxx)-controller node with status="disabled". Doing this on BBB requires recompiling the beaglebone black (base)device-tree with -@ though, so that the overlay target nodes are found. I'll attach the files for interested.
overlay-test.c:
Is a 'device-driver' for device added in overlay. (simply a probe() with print, extracted from the bd71847 driver).
overlay-test.dts:
Is a minimal device-tree overlay describing the 'test device' matching above overlay-test driver. When this is overlaid using next-20251121 (contains the 7d67ddc5f0148b3a03594a45bba5547e92640c89), probe in overlay-test.c is not called. When 7d67ddc5f0148b3a03594a45bba5547e92640c89 is reverted, the probe is called.
mva_overlay.c:
Is simplified 'glue-code' for adding an overlay to running kernel by feeding the compiled overlay to the bin_attribute - for example using:
dd if=/overlay-test.dtbo of=/sys/kernel/mva_overlay/overlay_add bs=4M
am335x-boneblack.dtb.dts.tmp and tps65217.dtsi:
are (intermediate) beaglebone-black device-trees which can be recompiled to a 'base device-tree' using:
dtc -O dtb -o am335x-boneblack.dtb -b 0 -@ am335x-boneblack.dtb.dts.tmp
- but I suggest you to use the dts from your kernel build. I provided
this just for the sake of the completeness.
Makefile:
Off-tree build targets to build the above DTSes and modules. Requires KERNEL_DIR and CC to be correctly set.
My findings:
The pinctrl node indeed plays a role. When the "pinctrl-0 = <&i2c1_pins>;" (and fragment0) was removed from the dts, the 'overlay-test' was probed with the "next-20251121".
With the pinctrl node, I see:
[ 104.098958] probe of 4802a000.i2c returned -517 (EPROBE_DEFER I suppose) after 50 usecs
- and the 'overlay-test' probe is not called.
Yours,
-- Matti
---
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland
~~ When things go utterly wrong vim users can always type :help! ~~
Herve Codina
maintainerRe: [PATCH v4 01/29] Revert "treewide: Fix probing of devices in DT overlays"
Hi Matti,
Quoted 70 lines · On Thu, 11 Dec 2025 10:34:46 +0200 Matti Vaittinen <[email protected]>…
Hi Dee Ho peeps,
I tried to create a minimal piece of code/dts to demonstrate the issue seem in the ROHM automated testing.
Quoted 4 lines · Herve Codina
Hi Geert, Kalle, Rob,
On Thu, 4 Dec 2025 11:49:13 +0100
Geert Uytterhoeven <[email protected]> wrote://snip
Quoted 2 lines
When a new node is added, a new device is created. Indeed, because the driver is an MFD driver, it is a bus driver and handled by
of_platformbus.We do also have an MFD device - but it is not a platform device but an I2C device - thus it should be probed by the I2C bus (if I'm not mistaken). So, I guess this is not bus-specific problem.
https://elixir.bootlin.com/linux/v6.18/source/drivers/mfd/rohm-bd718x7.c#L206Quoted 6 lines
My new node is considered by devlink as a node that will have a device ready to work (driver attached and device probed). A link is created between this node and the consumers of this node (i.e. the SPI controller). devlink is waiting for this provider to be ready before allowing the its consumer to probe. This node (simple pinmux description) will never lead to a device and devlink will never see this "provider" ready.
I believe Kalle did see the same "probe-not-called" -problem, even when disabling the
fw_devlinkfrom the kernel commandline. (It's worth mentioning that I am not sure if Kalle tried if probe was called with "previously working" kernels whenfw_devlinkis disabled).Quoted 36 lines
Did a test with a Renesas RZ/N1D (r9a06g032) based board and built a similar overlay involving I2C controller pinmux, I2C controller and an EEPROM.
Here, also the overlay didn't work but the issue is different.
The pinmux definition for pinctrl (i.e. pinctrl subnodes) are looked when the pinctrl driver probes. Adding a new node later is not handled by the pinctrl driver.
Applying the overlay leads to a simple:[ 16.934168] rzn1-pinctrl 40067000.pinctrl: unable to find group for node /soc/pinctrl@40067000/pins_i2c2Indeed, the '
pins_i2c2' has been added by the overlay and was not present when the pinctrl probed.Tried without adding a new pinmux node (pinctrl subnode) from the overlay and used nodes already existing in the base DT.
On my Marvell Armada 3720 board, it works with or without my patches. No regression detected due to my patches.
On my RZ/N1D board, it works also with or without my patches. Here also, no regression detected.
Also, on my Marvell Armada 3720 board, I can plug my LAN966x PCI board. The LAN966x PCI driver used an overlay to describe the LAN966x PCI board.
With the upstream patch not reverted, i.e.
1a50d9403fb9("treewide: Fix probing of devices in DT overlays")" applied, devlinks created for the LAN966x PCI board internal devices are incorrect and lead to crashes when the LAN966x PCI driver is removed due to wrong provider/consumer dependencies.When this patch is reverted and replaced by "of: dynamic: Fix overlayed devices not probing because of
fw_devlink", devlinks created for the LAN966x PCI board internal devices are corrects and crashes are no more present on removal.
Quoted 5 lines
Quoted 3 lines
Kalle, Geert, can you perform a test on your hardware with my patches applied and moving your pinmux definition from the overlay to the base device-tree?
I got a bit lost regarding which patches to test :)
The next-20251127 tag has every patches needed for the test. Tests you did with this kernel are perfectly valid. Many Thanks for that!
Quoted 49 lines
Quoted 6 lines
The kernel you can use is for instance the kernel at the next-20251127 tag. Needed patches for test are present in this kernel:
-76841259ac092("of: dynamic: Fix overlayed devices not probing because offw_devlink")
-7d67ddc5f0148("Revert "treewide: Fix probing of devices in DT overlays"")I did a minimal overlay test which can be ran on beaglebone black. I assume the same can be done on any board where you have (i2c/spi/xxx)-controller node with status="disabled". Doing this on BBB requires recompiling the beaglebone black (base)device-tree with -@ though, so that the overlay target nodes are found. I'll attach the files for interested.
overlay-test.c:
Is a 'device-driver' for device added in overlay. (simply aprobe()with print, extracted from the bd71847 driver).
overlay-test.dts:
Is a minimal device-tree overlay describing the 'test device' matching above overlay-test driver. When this is overlaid using next-20251121 (contains the7d67ddc5f0148b3a03594a45bba5547e92640c89), probe inoverlay-test.cis not called. When7d67ddc5f0148b3a03594a45bba5547e92640c89is reverted, the probe is called.
mva_overlay.c:
Is simplified 'glue-code' for adding an overlay to running kernel by feeding the compiled overlay to thebin_attribute- for example using:dd if=/overlay-test.dtbo of=/sys/kernel/mva_overlay/overlay_add bs=4M
am335x-boneblack.dtb.dts.tmp and
tps65217.dtsi:
are (intermediate) beaglebone-black device-trees which can be recompiled to a 'base device-tree' using:dtc -O dtb -o am335x-boneblack.dtb -b 0 -@ am335x-boneblack.dtb.dts.tmp
- but I suggest you to use the dts from your kernel build. I provided
this just for the sake of the completeness.
Makefile:
Off-tree build targets to build the above DTSes and modules. RequiresKERNEL_DIRand CC to be correctly set.My findings:
The pinctrl node indeed plays a role. When the "pinctrl-0 = <&i2c1_pins>;" (and fragment0) was removed from the dts, the 'overlay-test' was probed with the "next-20251121".
Quoted 4 lines
With the pinctrl node, I see:
[ 104.098958] probe of 4802a000.i2c returned -517 (EPROBE_DEFER Isuppose) after 50 usecs
- and the 'overlay-test' probe is not called.
Do you see the same trace with:
- "pinctrl-0 = <&i2c1_pins>;" in your overlay
- fragment0 removed from the overlay (i2c1_pins definition removed from the overlay.
- i2c1_pins node defined in your base DT.
In other word, is the issues related to adding a pinctrl sub-node (pinctrl pins definition) in the overlay or is it something else?
Best regards,
Hervé
Re: [PATCH v4 01/29] Revert "treewide: Fix probing of devices in DT overlays"
Quoted 5 lines · Herve Codina
Hi Matti,
On Thu, 11 Dec 2025 10:34:46 +0200
Matti Vaittinen <[email protected]> wrote:
/snip
Quoted 6 lines
Do you see the same trace with:
- "pinctrl-0 = <&i2c1_pins>;" in your overlay
- fragment0 removed from the overlay (i2c1_pinsdefinition removed from the overlay.
-i2c1_pinsnode defined in your base DT.
Just tested. The i2c1 appears and the test-overlay probe gets called, when the i2c1_pins is in the base-dt and not in the overlay.
Quoted 2 lines
In other word, is the issues related to adding a pinctrl sub-node (pinctrl pins definition) in the overlay or is it something else?
Seems to be related to the pinctrl.
Yours,
-- Matti
---
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland
~~ When things go utterly wrong vim users can always type :help! ~~
Herve Codina
maintainerRe: [PATCH v4 01/29] Revert "treewide: Fix probing of devices in DT overlays"
Hi Matti, Geert, all,
Quoted 9 lines · On Thu, 11 Dec 2025 15:52:28 +0200 Matti Vaittinen <[email protected]>…
Quoted 5 lines · Herve Codina
Hi Matti,
On Thu, 11 Dec 2025 10:34:46 +0200
Matti Vaittinen <[email protected]> wrote:/snip
Quoted 1 line
Quoted 8 lines
Quoted 5 lines
Do you see the same trace with:
- "pinctrl-0 = <&i2c1_pins>;" in your overlay
- fragment0 removed from the overlay (i2c1_pinsdefinition removed from the overlay.
-i2c1_pinsnode defined in your base DT.Just tested. The i2c1 appears and the test-overlay probe gets called, when the
i2c1_pinsis in the base-dt and not in the overlay.
Geert, do you expirement same results?
Quoted 6 lines
Quoted 3 lines
In other word, is the issues related to adding a pinctrl sub-node (pinctrl pins definition) in the overlay or is it something else?
Seems to be related to the pinctrl.
I don't think that the issue is related to pinctrl itself.
IMHO, I think the issue is related to overlays and fw_devlink. The distinction between "a new node is going to lead to a device" vs "a new node is just data and will never been attached to a new device" when an overlay is applied is broken.
This is broken with the upstream "treewide: Fix probing of devices in DT overlays" commit I've tried to revert. Indeed, on the LAN966x PCI device use case devlinks created are not correct with this commit applied.
I am not sure also that devlinks created with a more complex overlay will be correct. For instance, Matti, with your overlay not sure that a phandle from the oscillator node referencing the pmic node will lead to a correct provider/consumer devlink between the pmic device and the oscillator device.
On the other hand, this is broken with "of: dynamic: Fix overlayed devices not probing because of fw_devlink" works for the LAN966x PCI device use case an lead to correct devlinks but breaks your use cases.
Does anyone have an idea about how to fix those issues?
Best regards,
Hervé
Herve Codina
maintainerRe: [PATCH v4 01/29] Revert "treewide: Fix probing of devices in DT overlays"
Hi Saravana,
(+To Saravana using his new email address)
We still have issues related to devlink and overlays.
In order to move forward on the topic, I think I need your help.
Can you have a look and share any ideas to fix them?
On Thu, 11 Dec 2025 16:19:02 +0100
Herve Codina <[email protected]> wrote:
...
Quoted 15 lines
IMHO, I think the issue is related to overlays and
fw_devlink. The distinction between "a new node is going to lead to a device" vs "a new node is just data and will never been attached to a new device" when an overlay is applied is broken.This is broken with the upstream "treewide: Fix probing of devices in DT overlays" commit I've tried to revert. Indeed, on the LAN966x PCI device use case devlinks created are not correct with this commit applied.
I am not sure also that devlinks created with a more complex overlay will be correct. For instance, Matti, with your overlay not sure that a phandle from the oscillator node referencing the pmic node will lead to a correct provider/consumer devlink between the pmic device and the oscillator device.
Quoted 6 lines
On the other hand, this is broken with "of: dynamic: Fix overlayed devices not probing because of
fw_devlink" works for the LAN966x PCI device use case an lead to correct devlinks but breaks your use cases.Does anyone have an idea about how to fix those issues?
The commit "of: dynamic: Fix overlayed devices not probing because of fw_devlink" can be found in this series (patch 3)
https://lore.kernel.org/all/[email protected]/
Best regards,
Hervé
Re: [PATCH v4 01/29] Revert "treewide: Fix probing of devices in DT overlays"
In reply to Herve CodinaHi Hervé,
Revisiting his old thread (sorry for the delay)...
Quoted 11 lines · Herve Codina
Quoted 9 lines · On Thu, 11 Dec 2025 15:52:28 +0200 Matti Vaittinen <[email protected]>…
Quoted 7 lines · Herve Codina
On Thu, 11 Dec 2025 10:34:46 +0200
Matti Vaittinen <[email protected]> wrote:
Do you see the same trace with:
- "pinctrl-0 = <&i2c1_pins>;" in your overlay
- fragment0 removed from the overlay (i2c1_pinsdefinition removed from the overlay.
-i2c1_pinsnode defined in your base DT.
Quoted 4 lines
Quoted 2 lines
Just tested. The i2c1 appears and the test-overlay probe gets called, when the
i2c1_pinsis in the base-dt and not in the overlay.Geert, do you expirement same results?
Yes, after moving the pin control subnode from the overlay[1] to the base DTS, the SPI bus and FLASH work after loading the overlay for the first time.
Quoted 16 lines
Quoted 4 lines
Quoted 2 lines
In other word, is the issues related to adding a pinctrl sub-node (pinctrl pins definition) in the overlay or is it something else?
Seems to be related to the pinctrl.
I don't think that the issue is related to pinctrl itself.
IMHO, I think the issue is related to overlays and
fw_devlink. The distinction between "a new node is going to lead to a device" vs "a new node is just data and will never been attached to a new device" when an overlay is applied is broken.This is broken with the upstream "treewide: Fix probing of devices in DT overlays" commit I've tried to revert. Indeed, on the LAN966x PCI device use case devlinks created are not correct with this commit applied.
Quoted 8 lines
I am not sure also that devlinks created with a more complex overlay will be correct. For instance, Matti, with your overlay not sure that a phandle from the oscillator node referencing the pmic node will lead to a correct provider/consumer devlink between the pmic device and the oscillator device.
On the other hand, this is broken with "of: dynamic: Fix overlayed devices not probing because of
fw_devlink" works for the LAN966x PCI device use case an lead to correct devlinks but breaks your use cases.
Loading my overlay[1] causes the following changes under /sys/class/devlink/:
+ genpd_provider:ca53-cpu0--platform:e6e90000.spi ->
../../devices/virtual/devlink/genpd_provider:ca53-cpu0--platform:e6e90000.spi
+ platform:e6055000.gpio--platform:e6e90000.spi ->
../../devices/virtual/devlink/platform:e6055000.gpio--platform:e6e90000.spi
+ platform:e6060000.pinctrl--platform:e6e90000.spi ->
../../devices/virtual/devlink/platform:e6060000.pinctrl--platform:e6e90000.spi
- platform:e6060000.pinctrl--platform:keys ->
../../devices/virtual/devlink/platform:e6060000.pinctrl--platform:keys
+ platform:e6150000.clock-controller--platform:e6e90000.spi ->
../../devices/virtual/devlink/platform:e6150000.clock-controller--platform:e6e90000.spi
+ platform:soc--platform:e6e90000.spi ->
../../devices/virtual/devlink/platform:soc--platform:e6e90000.spi
Note that these changes are exactly the same in the working and the non-working case.
Removing the overlay again removes all added links, but does not restore the keys link:
- genpd_provider:ca53-cpu0--platform:e6e90000.spi ->
../../devices/virtual/devlink/genpd_provider:ca53-cpu0--platform:e6e90000.spi
- platform:e6055000.gpio--platform:e6e90000.spi ->
../../devices/virtual/devlink/platform:e6055000.gpio--platform:e6e90000.spi
- platform:e6060000.pinctrl--platform:e6e90000.spi ->
../../devices/virtual/devlink/platform:e6060000.pinctrl--platform:e6e90000.spi
- platform:e6150000.clock-controller--platform:e6e90000.spi ->
../../devices/virtual/devlink/platform:e6150000.clock-controller--platform:e6e90000.spi
- platform:soc--platform:e6e90000.spi ->
../../devices/virtual/devlink/platform:soc--platform:e6e90000.spi
Loading the overlay again causes no changes in the links, but the SPI bus and FLASH always work.
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Herve Codina
maintainerRe: [PATCH v4 01/29] Revert "treewide: Fix probing of devices in DT overlays"
Hi Geert,
Quoted 16 lines · On Wed, 21 Jan 2026 13:59:26 +0100 Geert Uytterhoeven <[email protected]>…
Hi Hervé,
Revisiting his old thread (sorry for the delay)...
Quoted 11 lines · Herve Codina
Quoted 9 lines · On Thu, 11 Dec 2025 15:52:28 +0200 Matti Vaittinen <[email protected]>…
Quoted 7 lines · Herve Codina
On Thu, 11 Dec 2025 10:34:46 +0200
Matti Vaittinen <[email protected]> wrote:
Do you see the same trace with:
- "pinctrl-0 = <&i2c1_pins>;" in your overlay
- fragment0 removed from the overlay (i2c1_pinsdefinition removed from the overlay.
-i2c1_pinsnode defined in your base DT.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Just tested. The i2c1 appears and the test-overlay probe gets called, when the
i2c1_pinsis in the base-dt and not in the overlay.Geert, do you expirement same results?
Yes, after moving the pin control subnode from the overlay[1] to the base DTS, the SPI bus and FLASH work after loading the overlay for the first time.
Ok. What I said for Matti's use-case is also valid for your use-case.
Quoted 42 lines
Quoted 17 lines
Quoted 5 lines
Quoted 3 lines
In other word, is the issues related to adding a pinctrl sub-node (pinctrl pins definition) in the overlay or is it something else?
Seems to be related to the pinctrl.
I don't think that the issue is related to pinctrl itself.
IMHO, I think the issue is related to overlays and
fw_devlink. The distinction between "a new node is going to lead to a device" vs "a new node is just data and will never been attached to a new device" when an overlay is applied is broken.This is broken with the upstream "treewide: Fix probing of devices in DT overlays" commit I've tried to revert. Indeed, on the LAN966x PCI device use case devlinks created are not correct with this commit applied.
Quoted 8 lines
I am not sure also that devlinks created with a more complex overlay will be correct. For instance, Matti, with your overlay not sure that a phandle from the oscillator node referencing the pmic node will lead to a correct provider/consumer devlink between the pmic device and the oscillator device.
On the other hand, this is broken with "of: dynamic: Fix overlayed devices not probing because of
fw_devlink" works for the LAN966x PCI device use case an lead to correct devlinks but breaks your use cases.Loading my overlay[1] causes the following changes under
/sys/class/devlink/:+ genpd_provider:ca53-cpu0--platform:e6e90000.spi ->
../../devices/virtual/devlink/genpd_provider:ca53-cpu0--platform:e6e90000.spi
+ platform:e6055000.gpio--platform:e6e90000.spi ->
../../devices/virtual/devlink/platform:e6055000.gpio--platform:e6e90000.spi
+ platform:e6060000.pinctrl--platform:e6e90000.spi ->
../../devices/virtual/devlink/platform:e6060000.pinctrl--platform:e6e90000.spi
- platform:e6060000.pinctrl--platform:keys ->
../../devices/virtual/devlink/platform:e6060000.pinctrl--platform:keys
+ platform:e6150000.clock-controller--platform:e6e90000.spi ->
../../devices/virtual/devlink/platform:e6150000.clock-controller--platform:e6e90000.spi
+ platform:soc--platform:e6e90000.spi ->
../../devices/virtual/devlink/platform:soc--platform:e6e90000.spi
Quoted 5 lines
Note that these changes are exactly the same in the working and the non-working case.
Removing the overlay again removes all added links, but does not restore the keys link:
I think you should have the exact same behavior with and without my modification.
Can you confirm?
Best regards,
Hervé
Andy Shevchenko
reviewerRe: [PATCH v4 01/29] Revert "treewide: Fix probing of devices in DT overlays"
In reply to Herve CodinaQuoted 2 lines · Herve Codina
On Wed, 3 Dec 2025 12:11:45 +0200
Kalle Niemi <[email protected]> wrote:
...
Quoted 2 lines
Saravana's email (Saravana Kannan <[email protected]>) seems incorrect. Got emails delivery failure with this email address.
According to the Git history his last activity was in August 2025 with adding (surprise) his name to one of the MAINTAINERS records.
And according to lore, his last message was in October 2025, so I dunno what's going on there.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v4 01/29] Revert "treewide: Fix probing of devices in DT overlays"
In reply to Herve CodinaHi Hervé,
Quoted 34 lines · Herve Codina
Quoted 26 lines · On Fri, 28 Nov 2025 10:34:57 +0200 Kalle Niemi <[email protected]> wrote:
Quoted 26 lines
Quoted 26 lines
Quoted 8 lines
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
Test system testing drivers for ROHM ICs bisected this commit to cause BD71847 drivers probe to not be called.
This driver (and overlay support) is in linux-next or something out of tree on top of linux-next?
Rob
Yes the driver is in mainline linux: /drivers/mfd/rohm-bd718x7.c
I don't see any support to apply overlays in that driver.
Ah. Sorry for the confusion peeps. I asked Kalle to report this without proper consideration. 100% my bad.
While the bd718x7 drive indeed is mainline (and tested), the actual 'glue-code' doing the overlay is part of the downstream test infrastructure. So yes, this is not a bug in upstream kernel - this falls in the category of an upstream change causing downstream things to break. So, feel free to say: "Go fix your code" :)
Now that this is sorted, if someone is still interested in helping us to get our upstream drivers tested - the downstream piece is just taking the compiled device-tree overlay at runtime (via bin-attribute file), and applying it using the
of_overlay_fdt_apply(). The approach is working for our testing purposes when the device is added to I2C/SPI node which is already enabled. However, in case where we have the I2C disabled, and enable it in the same overlay where we add the new device
- then the new device does not get probed.Quoted 5 lines
Quoted 5 lines
Quoted 1 line
I would be really grateful if someone had a pointer for us.
Seems to be
fw_devlinkrelated. I suppose if you turn it off it works? There's info about the dependencies in sysfs or maybe debugfs. I don't remember the details, but that should help to tell you why things aren't probing.
Quoted 6 lines
Rob reverted patches but I plan to continue my work on it. On my side, I need the reverted patches but I fully understand that, on your side, you need a working system.
In order to move forward and find a solution for my next iteration, can you send your overlay (dtso) used in your working and non working cases?
Hmm, I must have missed when Rob applied (part of) this series, as I do an overlay test (using the out-of-tree configfs) on top of every (bi-weekly) renesas-drivers release, and saw no issues during the last few months.
So I applied this series and tested loading my SPI EEPROM overlay. And it indeed breaks, with the culprit being this particular patch.
Interestingly, quoting from this patch:
"While the commit fixed fw_devlink overlay handling for one case, it
broke it for another case. So revert it and redo the fix in a separate patch."
Where is the separate patch that redid the fix? I assume it is "[PATCH v4 03/29] of: dynamic: Fix overlayed devices not probing because of fw_devlink"? Unfortunately that doesn't fix the issue for me.
Quoting more from this patch:
"Closes: https://lore.kernel.org/lkml/CAMuHMdXEnSD4rRJ-o90x4OprUacN_rJgyo8x6=9F9rZ+-KzjOg@mail.gmail.com/"
Strange that it claims to fix the issue reported there, as the failure mode I am seeing is exactly the same as documented in that report?
Do you know what is wrong? The overlay I am using is referenced in the bug report linked above.
Thanks!
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Herve Codina
maintainerRe: [PATCH v4 01/29] Revert "treewide: Fix probing of devices in DT overlays"
Hi Geert,
Quoted 64 lines · On Tue, 2 Dec 2025 17:35:35 +0100 Geert Uytterhoeven <[email protected]>…
Hi Hervé,
Quoted 34 lines · Herve Codina
Quoted 26 lines · On Fri, 28 Nov 2025 10:34:57 +0200 Kalle Niemi <[email protected]> wrote:
Quoted 26 lines
Quoted 26 lines
Quoted 8 lines
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
Test system testing drivers for ROHM ICs bisected this commit to cause BD71847 drivers probe to not be called.
This driver (and overlay support) is in linux-next or something out of tree on top of linux-next?
Rob
Yes the driver is in mainline linux: /drivers/mfd/rohm-bd718x7.c
I don't see any support to apply overlays in that driver.
Ah. Sorry for the confusion peeps. I asked Kalle to report this without proper consideration. 100% my bad.
While the bd718x7 drive indeed is mainline (and tested), the actual 'glue-code' doing the overlay is part of the downstream test infrastructure. So yes, this is not a bug in upstream kernel - this falls in the category of an upstream change causing downstream things to break. So, feel free to say: "Go fix your code" :)
Now that this is sorted, if someone is still interested in helping us to get our upstream drivers tested - the downstream piece is just taking the compiled device-tree overlay at runtime (via bin-attribute file), and applying it using the
of_overlay_fdt_apply(). The approach is working for our testing purposes when the device is added to I2C/SPI node which is already enabled. However, in case where we have the I2C disabled, and enable it in the same overlay where we add the new device
- then the new device does not get probed.Quoted 5 lines
Quoted 5 lines
Quoted 1 line
I would be really grateful if someone had a pointer for us.
Seems to be
fw_devlinkrelated. I suppose if you turn it off it works? There's info about the dependencies in sysfs or maybe debugfs. I don't remember the details, but that should help to tell you why things aren't probing.Quoted 6 lines
Rob reverted patches but I plan to continue my work on it. On my side, I need the reverted patches but I fully understand that, on your side, you need a working system.
In order to move forward and find a solution for my next iteration, can you send your overlay (dtso) used in your working and non working cases?
Hmm, I must have missed when Rob applied (part of) this series, as I do an overlay test (using the out-of-tree configfs) on top of every (bi-weekly) renesas-drivers release, and saw no issues during the last few months.
So I applied this series and tested loading my SPI EEPROM overlay. And it indeed breaks, with the culprit being this particular patch.
Interestingly, quoting from this patch:
"While the commit fixed
fw_devlinkoverlay handling for one case, it
broke it for another case. So revert it and redo the fix in a separate patch."Where is the separate patch that redid the fix? I assume it is "[PATCH v4 03/29] of: dynamic: Fix overlayed devices not probing because of
fw_devlink"? Unfortunately that doesn't fix the issue for me.Quoting more from this patch:
Quoted 7 lines
"Closes: https://lore.kernel.org/lkml/CAMuHMdXEnSD4rRJ-o90x4OprUacN_rJgyo8x6=9F9rZ+-KzjOg@mail.gmail.com/"Strange that it claims to fix the issue reported there, as the failure mode I am seeing is exactly the same as documented in that report?
Do you know what is wrong? The overlay I am using is referenced in the bug report linked above.
The first patch "Fix probing of devices in DT overlays" didn't fix all cases and so Saravana reverted this patch and proposed "of: dynamic: Fix overlayed devices not probing because of fw_devlink".
This second patch was needed to fix my use case even if more modification were needed to have my use case fully fixed (other patches in my series).
Rob applied those first patches from my series and some systems were broken. The breakage has been reported my Kalle and Matti and led to a revert of culprit patches.
I tried to understand what was wrong. I am pretty convinced that modification done in "of: dynamic: Fix overlayed devices not probing because of fw_devlink" are really better than modification available in "treewide: Fix probing of devices in DT overlays".
I proposed an update [0] and I will be glad if you can also test this update on your side and give me your feedback.
[0] https://lore.kernel.org/lkml/[email protected]/
Best regards,
Hervé
Re: [PATCH v4 01/29] Revert "treewide: Fix probing of devices in DT overlays"
Hi Hervé,
Quoted 88 lines · Herve Codina
Quoted 62 lines · On Tue, 2 Dec 2025 17:35:35 +0100 Geert Uytterhoeven <[email protected]>…
Quoted 34 lines · Herve Codina
Quoted 26 lines · On Fri, 28 Nov 2025 10:34:57 +0200 Kalle Niemi <[email protected]> wrote:
Quoted 26 lines
Quoted 26 lines
Quoted 8 lines
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
Test system testing drivers for ROHM ICs bisected this commit to cause BD71847 drivers probe to not be called.
This driver (and overlay support) is in linux-next or something out of tree on top of linux-next?
Rob
Yes the driver is in mainline linux: /drivers/mfd/rohm-bd718x7.c
I don't see any support to apply overlays in that driver.
Ah. Sorry for the confusion peeps. I asked Kalle to report this without proper consideration. 100% my bad.
While the bd718x7 drive indeed is mainline (and tested), the actual 'glue-code' doing the overlay is part of the downstream test infrastructure. So yes, this is not a bug in upstream kernel - this falls in the category of an upstream change causing downstream things to break. So, feel free to say: "Go fix your code" :)
Now that this is sorted, if someone is still interested in helping us to get our upstream drivers tested - the downstream piece is just taking the compiled device-tree overlay at runtime (via bin-attribute file), and applying it using the
of_overlay_fdt_apply(). The approach is working for our testing purposes when the device is added to I2C/SPI node which is already enabled. However, in case where we have the I2C disabled, and enable it in the same overlay where we add the new device
- then the new device does not get probed.Quoted 5 lines
Quoted 5 lines
Quoted 1 line
I would be really grateful if someone had a pointer for us.
Seems to be
fw_devlinkrelated. I suppose if you turn it off it works? There's info about the dependencies in sysfs or maybe debugfs. I don't remember the details, but that should help to tell you why things aren't probing.Quoted 6 lines
Rob reverted patches but I plan to continue my work on it. On my side, I need the reverted patches but I fully understand that, on your side, you need a working system.
In order to move forward and find a solution for my next iteration, can you send your overlay (dtso) used in your working and non working cases?
Hmm, I must have missed when Rob applied (part of) this series, as I do an overlay test (using the out-of-tree configfs) on top of every (bi-weekly) renesas-drivers release, and saw no issues during the last few months.
So I applied this series and tested loading my SPI EEPROM overlay. And it indeed breaks, with the culprit being this particular patch.
Interestingly, quoting from this patch:
"While the commit fixed
fw_devlinkoverlay handling for one case, it
broke it for another case. So revert it and redo the fix in a separate patch."Where is the separate patch that redid the fix? I assume it is "[PATCH v4 03/29] of: dynamic: Fix overlayed devices not probing because of
fw_devlink"? Unfortunately that doesn't fix the issue for me.Quoting more from this patch:
Quoted 7 lines
"Closes: https://lore.kernel.org/lkml/CAMuHMdXEnSD4rRJ-o90x4OprUacN_rJgyo8x6=9F9rZ+-KzjOg@mail.gmail.com/"Strange that it claims to fix the issue reported there, as the failure mode I am seeing is exactly the same as documented in that report?
Do you know what is wrong? The overlay I am using is referenced in the bug report linked above.
The first patch "Fix probing of devices in DT overlays" didn't fix all cases and so Saravana reverted this patch and proposed "of: dynamic: Fix overlayed devices not probing because of
fw_devlink".This second patch was needed to fix my use case even if more modification were needed to have my use case fully fixed (other patches in my series).
Rob applied those first patches from my series and some systems were broken. The breakage has been reported my Kalle and Matti and led to a revert of culprit patches.
I tried to understand what was wrong. I am pretty convinced that modification done in "of: dynamic: Fix overlayed devices not probing because of
fw_devlink" are really better than modification available in "treewide: Fix probing of devices in DT overlays".
Quoted 4 lines
I proposed an update [0] and I will be glad if you can also test this update on your side and give me your feedback.
Thank you!
Unfortunately this does not fix the problem: I still need to do an extra overlay rm/add cycle to make the SPI EEPROM work.
In addition, it triggers a bunch of new scary error messages:
rcar_sound ec500000.sound: Failed to create device link (0x180) with supplier soc for /soc/sound@ec500000/rcar_sound,src/src-0 rcar_sound ec500000.sound: Failed to create device link (0x180) with supplier soc for /soc/sound@ec500000/rcar_sound,src/src-1 [...]rcar_sound ec500000.sound: Failed to create device link (0x180) with supplier soc for /soc/sound@ec500000/rcar_sound,src/src-9 rcar_sound ec500000.sound: Failed to create device link (0x180) with supplier soc for /soc/sound@ec500000/rcar_sound,ssi/ssi-0 rcar_sound ec500000.sound: Failed to create device link (0x180) with supplier soc for /soc/sound@ec500000/rcar_sound,ssi/ssi-1 [...]rcar_sound ec500000.sound: Failed to create device link (0x180) with supplier soc for /soc/sound@ec500000/rcar_sound,ssi/ssi-9 rcar_sound ec500000.sound: Failed to create device link (0x180) with supplier soc for /soc/sound@ec500000/rcar_sound,src/src-0 rcar_sound ec500000.sound: Failed to create device link (0x180) with supplier soc for /soc/sound@ec500000/rcar_sound,src/src-1 [...]rcar_sound ec500000.sound: Failed to create device link (0x180) with supplier soc for /soc/sound@ec500000/rcar_sound,src/src-9 rcar_sound ec500000.sound: Failed to create device link (0x180) with supplier soc for /soc/sound@ec500000/rcar_sound,ssi/ssi-0 rcar_sound ec500000.sound: Failed to create device link (0x180) with supplier soc for /soc/sound@ec500000/rcar_sound,ssi/ssi-1 [...]rcar_sound ec500000.sound: Failed to create device link (0x180) with supplier soc for /soc/sound@ec500000/rcar_sound,ssi/ssi-9
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Herve Codina
maintainerPATCH v4 2/29 driver core: Rename get_dev_from_fwnode() wrapper to get_device_from_fwnode()
In reply to Herve Codinaget_dev_from_fwnode() calls get_device() and so it acquires a reference on the device returned.
In order to be more obvious that this wrapper is a get_device() variant, rename it to get_device_from_fwnode().
--- drivers/base/core.c | 18 +++++++++--------- drivers/pmdomain/core.c | 4 ++-- include/linux/device.h | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-)
drivers/base/core.c +9 -9
@@ -1888,7 +1888,7 @@ static bool fwnode_init_without_drv(struct fwnode_handle *fwnode)if (!(fwnode->flags &FWNODE_FLAG_INITIALIZED ))return false; - dev =get_dev_from_fwnode (fwnode); + dev =get_device_from_fwnode (fwnode); ret = !dev || dev->links.status ==DL_DEV_NO_DRIVER ;put_device (dev);
@@ -1957,7 +1957,7 @@ static struct device *fwnode_get_next_parent_dev(const struct fwnode_handle *fwnstruct device *dev;fwnode_for_each_parent_node (fwnode, parent) { - dev =get_dev_from_fwnode (parent); + dev =get_device_from_fwnode (parent);if (dev) {fwnode_handle_put (parent);return dev;
@@ -2013,8 +2013,8 @@ static bool __fw_devlink_relax_cycles(struct fwnode_handle *con_handle, goto out; } - sup_dev =get_dev_from_fwnode (sup_handle); - con_dev =get_dev_from_fwnode (con_handle); + sup_dev =get_device_from_fwnode (sup_handle); + con_dev =get_device_from_fwnode (con_handle);/* * If sup_dev is bound to a driver and @con hasn't started binding to a * driver, sup_dev can't be a consumer of @con. So, no need to check
@@ -2153,7 +2153,7 @@ static int fw_devlink_create_devlink(struct device *con,if (sup_handle->flags &FWNODE_FLAG_NOT_DEVICE ) sup_dev =fwnode_get_next_parent_dev (sup_handle);else - sup_dev =get_dev_from_fwnode (sup_handle); + sup_dev =get_device_from_fwnode (sup_handle);if (sup_dev) {/*
@@ -2222,7 +2222,7 @@ static void __fw_devlink_link_to_consumers(struct device *dev)bool own_link = true;int ret; - con_dev =get_dev_from_fwnode (link->consumer); + con_dev =get_device_from_fwnode (link->consumer);/* * If consumer device is not available yet, make a "proxy" * SYNC_STATE_ONLY link from the consumer's parent device to
@@ -5279,7 +5279,7 @@ void device_set_node(struct device *dev, struct fwnode_handle *fwnode)EXPORT_SYMBOL_GPL (device_set_node);/** -* get_dev_from_fwnode - Obtain a reference count of the struct device the +* get_device_from_fwnode - Obtain a reference count of the struct device the * struct fwnode_handle is associated with. * @fwnode: The pointer to the struct fwnode_handle to obtain the struct device * reference count of.
@@ -5297,11 +5297,11 @@ EXPORT_SYMBOL_GPL(device_set_node);* This is possible since struct fwnode_handle has its own reference count and * hence can out-live the struct device it is associated with. */ -struct device *get_dev_from_fwnode (struct fwnode_handle *fwnode) +struct device *get_device_from_fwnode (struct fwnode_handle *fwnode) {return get_device ((fwnode)->dev); } -EXPORT_SYMBOL_GPL (get_dev_from_fwnode); +EXPORT_SYMBOL_GPL (get_device_from_fwnode);int device_match_name (struct device *dev,const void *name) {
drivers/pmdomain/core.c +2 -2
@@ -2678,7 +2678,7 @@ int of_genpd_add_provider_simple(struct device_node *np, genpd->dev.of_node = np; fwnode =of_fwnode_handle (np); - dev =get_dev_from_fwnode (fwnode); + dev =get_device_from_fwnode (fwnode);if (!dev && !genpd_is_no_sync_state (genpd)) { genpd->sync_state =GENPD_SYNC_STATE_SIMPLE ;device_set_node (&genpd->dev, fwnode);
@@ -2753,7 +2753,7 @@ int of_genpd_add_provider_onecell(struct device_node *np, data->xlate = genpd_xlate_onecell; fwnode =of_fwnode_handle (np); - dev =get_dev_from_fwnode (fwnode); + dev =get_device_from_fwnode (fwnode);if (!dev) sync_state = true;else
include/linux/device.h +1 -1
@@ -1090,7 +1090,7 @@ void device_set_node(struct device *dev, struct fwnode_handle *fwnode);int device_add_of_node (struct device *dev,struct device_node *of_node);void device_remove_of_node (struct device *dev);void device_set_of_node_from_dev (struct device *dev,const struct device *dev2); -struct device *get_dev_from_fwnode (struct fwnode_handle *fwnode); +struct device *get_device_from_fwnode (struct fwnode_handle *fwnode);static inline struct device_node *dev_of_node (struct device *dev) {
Signature · 1 line
2.51.0
Re: [PATCH v4 02/29] driver core: Rename get_dev_from_fwnode() wrapper to get_device_from_fwnode()
Quoted 7 lines · Herve Codina
get_dev_from_fwnode()callsget_device()and so it acquires a reference on the device returned.In order to be more obvious that this wrapper is a
get_device()variant, rename it toget_device_from_fwnode().
Quoted 6 lines
Suggested-by Mark Brown <[email protected]>Link https://lore.kernel.org/lkml/CAGETcx97QjnjVR8Z5g0ndLHpK96hLd4aYSV=iEkKPNbNOccYmA@mail.gmail.com/ open hereSigned-off-by Herve Codina <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>Reviewed-by Saravana Kannan <[email protected]>Reviewed-by Luca Ceresoli <[email protected]>
Kind regards
Uffe
Quoted 118 lines
--- drivers/base/core.c | 18 +++++++++--------- drivers/pmdomain/core.c | 4 ++-- include/linux/device.h | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-)drivers/base/core.c +9
-9@@ -1888,7 +1888,7 @@ static bool fwnode_init_without_drv(struct fwnode_handle *fwnode)if (!(fwnode->flags &FWNODE_FLAG_INITIALIZED ))return false; - dev =get_dev_from_fwnode (fwnode); + dev =get_device_from_fwnode (fwnode); ret = !dev || dev->links.status ==DL_DEV_NO_DRIVER ;put_device (dev);@@ -1957,7 +1957,7 @@ static struct device *fwnode_get_next_parent_dev(const struct fwnode_handle *fwnstruct device *dev;fwnode_for_each_parent_node (fwnode, parent) { - dev =get_dev_from_fwnode (parent); + dev =get_device_from_fwnode (parent);if (dev) {fwnode_handle_put (parent);return dev;@@ -2013,8 +2013,8 @@ static bool __fw_devlink_relax_cycles(struct fwnode_handle *con_handle, goto out; } - sup_dev =get_dev_from_fwnode (sup_handle); - con_dev =get_dev_from_fwnode (con_handle); + sup_dev =get_device_from_fwnode (sup_handle); + con_dev =get_device_from_fwnode (con_handle);/* * If sup_dev is bound to a driver and @con hasn't started binding to a * driver, sup_dev can't be a consumer of @con. So, no need to check @@ -2153,7 +2153,7 @@ static int fw_devlink_create_devlink(struct device *con,if (sup_handle->flags &FWNODE_FLAG_NOT_DEVICE ) sup_dev =fwnode_get_next_parent_dev (sup_handle);else - sup_dev =get_dev_from_fwnode (sup_handle); + sup_dev =get_device_from_fwnode (sup_handle);if (sup_dev) {/* @@ -2222,7 +2222,7 @@ static void __fw_devlink_link_to_consumers(struct device *dev)bool own_link = true;int ret; - con_dev =get_dev_from_fwnode (link->consumer); + con_dev =get_device_from_fwnode (link->consumer);/* * If consumer device is not available yet, make a "proxy" * SYNC_STATE_ONLY link from the consumer's parent device to @@ -5279,7 +5279,7 @@ void device_set_node(struct device *dev, struct fwnode_handle *fwnode)EXPORT_SYMBOL_GPL (device_set_node);/** -* get_dev_from_fwnode - Obtain a reference count of the struct device the +* get_device_from_fwnode - Obtain a reference count of the struct device the * struct fwnode_handle is associated with. * @fwnode: The pointer to the struct fwnode_handle to obtain the struct device * reference count of. @@ -5297,11 +5297,11 @@ EXPORT_SYMBOL_GPL(device_set_node);* This is possible since struct fwnode_handle has its own reference count and * hence can out-live the struct device it is associated with. */ -struct device *get_dev_from_fwnode (struct fwnode_handle *fwnode) +struct device *get_device_from_fwnode (struct fwnode_handle *fwnode) {return get_device ((fwnode)->dev); } -EXPORT_SYMBOL_GPL (get_dev_from_fwnode); +EXPORT_SYMBOL_GPL (get_device_from_fwnode);int device_match_name (struct device *dev,const void *name) {drivers/pmdomain/core.c +2
-2@@ -2678,7 +2678,7 @@ int of_genpd_add_provider_simple(struct device_node *np, genpd->dev.of_node = np; fwnode =of_fwnode_handle (np); - dev =get_dev_from_fwnode (fwnode); + dev =get_device_from_fwnode (fwnode);if (!dev && !genpd_is_no_sync_state (genpd)) { genpd->sync_state =GENPD_SYNC_STATE_SIMPLE ;device_set_node (&genpd->dev, fwnode);@@ -2753,7 +2753,7 @@ int of_genpd_add_provider_onecell(struct device_node *np, data->xlate = genpd_xlate_onecell; fwnode =of_fwnode_handle (np); - dev =get_dev_from_fwnode (fwnode); + dev =get_device_from_fwnode (fwnode);if (!dev) sync_state = true;else include/linux/device.h +1
-2@@ -1090,7 +1090,7 @@ void device_set_node(struct device *dev, struct fwnode_handle *fwnode);int device_add_of_node (struct device *dev,struct device_node *of_node);void device_remove_of_node (struct device *dev);void device_set_of_node_from_dev (struct device *dev,const struct device *dev2); -struct device *get_dev_from_fwnode (struct fwnode_handle *fwnode); +struct device *get_device_from_fwnode (struct fwnode_handle *fwnode);static inline struct device_node *dev_of_node (struct device *dev) { --2.51.0
Herve Codina
maintainerPATCH v4 3/29 of: dynamic: Fix overlayed devices not probing because of fw_devlink
In reply to Herve CodinaFrom: Saravana Kannan <[email protected]>
When an overlay is applied, if the target device has already probed successfully and bound to a device, then some of the fw_devlink logic that ran when the device was probed needs to be rerun. This allows newly created dangling consumers of the overlayed device tree nodes to be moved to become consumers of the target device.
--- drivers/base/core.c | 74 +++++++++++++++++++++++++++++++++++++----- drivers/of/overlay.c | 15 +++++++++ include/linux/fwnode.h | 1 + 3 files changed, 81 insertions(+), 9 deletions(-)
drivers/base/core.c +65 -9
@@ -235,6 +235,70 @@ static void __fw_devlink_pickup_dangling_consumers(struct fwnode_handle *fwnode,__fw_devlink_pickup_dangling_consumers (child, new_sup); } +static void fw_devlink_pickup_dangling_consumers (struct device *dev) +{ +struct fwnode_handle *child; + +guard (mutex)(&fwnode_link_lock); + +fwnode_for_each_available_child_node (dev->fwnode, child) +__fw_devlink_pickup_dangling_consumers (child, dev->fwnode); +__fw_devlink_link_to_consumers (dev); +} + +/** +* fw_devlink_refresh_fwnode - Recheck the tree under this firmware node +* @fwnode: The fwnode under which the fwnode tree has changed +* +* This function is mainly meant to adjust the supplier/consumer dependencies +* after a fwnode tree overlay has occurred. +*/ +void fw_devlink_refresh_fwnode (struct fwnode_handle *fwnode) +{ +struct device *dev; + +/* +* Find the closest ancestor fwnode that has been converted to a device +* that can bind to a driver (bus device). +*/ +fwnode_handle_get (fwnode); +do { +if (fwnode->flags &FWNODE_FLAG_NOT_DEVICE ) +continue ; + + dev =get_device_from_fwnode (fwnode); +if (!dev) +continue ; + +if (dev->bus) +break ; + +put_device (dev); + }while ((fwnode =fwnode_get_next_parent (fwnode))); + +/* +* If none of the ancestor fwnodes have (yet) been converted to a device +* that can bind to a driver, there's nothing to fix up. +*/ +if (!fwnode) +return ; + +WARN (device_is_bound (dev) && dev->links.status !=DL_DEV_DRIVER_BOUND , +"Don't multithread overlaying and probing the same device!\n" ); + +/* +* If the device has already bound to a driver, then we need to redo +* some of the work that was done after the device was bound to a +* driver. If the device hasn't bound to a driver, running thing too +* soon would incorrectly pick up consumers that it shouldn't. +*/ +if (dev->links.status ==DL_DEV_DRIVER_BOUND ) +fw_devlink_pickup_dangling_consumers (dev); + +put_device (dev); +fwnode_handle_put (fwnode); +} +static DEFINE_MUTEX (device_links_lock);DEFINE_STATIC_SRCU (device_links_srcu);
@@ -1312,16 +1376,8 @@ void device_links_driver_bound(struct device *dev)* child firmware node. */ if (dev->fwnode && dev->fwnode->dev == dev) { -struct fwnode_handle *child; -fwnode_links_purge_suppliers (dev->fwnode); - -guard (mutex)(&fwnode_link_lock); - -fwnode_for_each_available_child_node (dev->fwnode, child) -__fw_devlink_pickup_dangling_consumers (child, - dev->fwnode); -__fw_devlink_link_to_consumers (dev); +fw_devlink_pickup_dangling_consumers (dev); }device_remove_file (dev, &dev_attr_waiting_for_supplier);
drivers/of/overlay.c +15 -0
@@ -185,6 +185,15 @@ static int overlay_notify(struct overlay_changeset *ovcs,return 0 ; } +static void overlay_fw_devlink_refresh (struct overlay_changeset *ovcs) +{ +for (int i =0 ; i < ovcs->count; i++) { +struct device_node *np = ovcs->fragments[i].target; + +fw_devlink_refresh_fwnode (of_fwnode_handle (np)); + } +} +/* * The values of properties in the "/__symbols__" node are paths in * the ovcs->overlay_root. When duplicating the properties, the paths
@@ -951,6 +960,12 @@ static int of_overlay_apply(struct overlay_changeset *ovcs,pr_err ("overlay apply changeset entry notify error %d\n" , ret);/* notify failure is not fatal, continue */ +/* +* Needs to happen after changeset notify to give the listeners a chance +* to finish creating all the devices they need to create. +*/ +overlay_fw_devlink_refresh (ovcs); + ret_tmp =overlay_notify (ovcs,OF_OVERLAY_POST_APPLY );if (ret_tmp)if (!ret)
include/linux/fwnode.h +1 -0
@@ -228,6 +228,7 @@ int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup, u8 flags);void fwnode_links_purge (struct fwnode_handle *fwnode);void fw_devlink_purge_absent_suppliers (struct fwnode_handle *fwnode); +void fw_devlink_refresh_fwnode (struct fwnode_handle *fwnode);bool fw_devlink_is_strict (void );#endif
Signature · 1 line
2.51.0
Herve Codina
maintainerPATCH v4 4/29 driver core: Avoid warning when removing a device while its supplier is unbinding
In reply to Herve CodinaDuring driver removal, the following warning can appear:
WARNING: CPU: 1 PID: 139 at drivers/base/core.c:1497 __device_links_no_driver+0xcc/0xfc
...
Call trace:
__device_links_no_driver+0xcc/0xfc (P)
device_links_driver_cleanup+0xa8/0xf0
device_release_driver_internal+0x208/0x23c
device_links_unbind_consumers+0xe0/0x108
device_release_driver_internal+0xec/0x23c
device_links_unbind_consumers+0xe0/0x108
device_release_driver_internal+0xec/0x23c
device_links_unbind_consumers+0xe0/0x108
device_release_driver_internal+0xec/0x23c
driver_detach+0xa0/0x12c
bus_remove_driver+0x6c/0xbc
driver_unregister+0x30/0x60
pci_unregister_driver+0x20/0x9c
lan966x_pci_driver_exit+0x18/0xa90 [lan966x_pci]This warning is triggered when a consumer is removed because the links status of its supplier is not DL_DEV_DRIVER_BOUND and the link flag DL_FLAG_SYNC_STATE_ONLY is not set.
The topology in terms of consumers/suppliers used was the following (consumer ---> supplier):
i2c -----------> OIC ----> PCI device
| ^
| |
+---> pinctrl ---+When the PCI device is removed, the OIC (interrupt controller) has to be removed. In order to remove the OIC, pinctrl and i2c need to be removed and to remove pinctrl, i2c need to be removed. The removal order is:
1) i2c
2) pinctrl
3) OIC
4) PCI device
In details, the removal sequence is the following (with 0000:01:00.0 the PCI device):
driver_detach: call device_release_driver_internal(0000:01:00.0)...
device_links_busy(0000:01:00.0):
links->status = DL_DEV_UNBINDING
device_links_unbind_consumers(0000:01:00.0):
0000:01:00.0--oic link->status = DL_STATE_SUPPLIER_UNBIND
call device_release_driver_internal(oic)...
device_links_busy(oic):
links->status = DL_DEV_UNBINDING
device_links_unbind_consumers(oic):
oic--pinctrl link->status = DL_STATE_SUPPLIER_UNBIND
call device_release_driver_internal(pinctrl)...
device_links_busy(pinctrl):
links->status = DL_DEV_UNBINDING
device_links_unbind_consumers(pinctrl):
pinctrl--i2c link->status = DL_STATE_SUPPLIER_UNBIND
call device_release_driver_internal(i2c)...
device_links_busy(i2c): links->status = DL_DEV_UNBINDING
__device_links_no_driver(i2c)...
pinctrl--i2c link->status is DL_STATE_SUPPLIER_UNBIND
oic--i2c link->status is DL_STATE_ACTIVE
oic--i2c link->supplier->links.status is DL_DEV_UNBINDINGThe warning is triggered by the i2c removal because the OIC (supplier) links status is not DL_DEV_DRIVER_BOUND. Its links status is indeed set to DL_DEV_UNBINDING.
It is perfectly legit to have the links status set to DL_DEV_UNBINDING in that case. Indeed we had started to unbind the OIC which triggered the consumer unbinding and didn't finish yet when the i2c is unbound.
Avoid the warning when the supplier links status is set to DL_DEV_UNBINDING and thus support this removal sequence without any warnings.
--- drivers/base/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/base/core.c +2 -1
@@ -1491,7 +1491,8 @@ static void __device_links_no_driver(struct device *dev)if (link->supplier->links.status ==DL_DEV_DRIVER_BOUND ) {WRITE_ONCE (link->status,DL_STATE_AVAILABLE ); }else { -WARN_ON (!device_link_test (link,DL_FLAG_SYNC_STATE_ONLY )); +WARN_ON (link->supplier->links.status !=DL_DEV_UNBINDING && + !device_link_test (link,DL_FLAG_SYNC_STATE_ONLY ));WRITE_ONCE (link->status,DL_STATE_DORMANT ); } }
Signature · 1 line
2.51.0
Herve Codina
maintainerPATCH v4 5/29 dt-bindings: bus: Add simple-platform-bus
In reply to Herve CodinaA Simple Platform Bus is a transparent bus that doesn't need a specific driver to perform operations at bus level.
Similar to simple-bus, a Simple Platform Bus allows to automatically instantiate devices connected to this bus.
Those devices are instantiated only by the Simple Platform Bus probe function itself.
--- .../bindings/bus/simple-platform-bus.yaml | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Documentation/devicetree/bindings/bus/simple-platform-bus.yaml
Documentation/devicetree/bindings/bus/simple-platform-bus.yaml new file +50 -0
@@ -0,0 +1,50 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/bus/simple-platform-bus.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Simple Platform Bus + +maintainers: + - Herve Codina <[email protected]> + +description: | + A Simple Platform Bus is a transparent bus that doesn't need a specific + driver to perform operations at bus level. + + Similar to simple-bus, a Simple Platform Bus allows to automatically + instantiate devices connected to this bus. Those devices are instantiated + only by the Simple Platform Bus probe function itself. + +properties: + $nodename: + pattern: "^bus(@[0-9a-f]+)?$" + + compatible: + const: simple-platform-bus + + '#address-cells': + enum: [ 1, 2 ] + + '#size-cells': + enum: [ 1, 2 ] + + ranges: true + +required: + - compatible + - '#address-cells' + - '#size-cells' + +additionalProperties: false + +examples: + - | + + bus { + compatible = "simple-platform-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + };
Signature · 1 line
2.51.0
Rob Herring
maintainerRe: [PATCH v4 05/29] dt-bindings: bus: Add simple-platform-bus
Quoted 8 lines · Herve Codina
A Simple Platform Bus is a transparent bus that doesn't need a specific driver to perform operations at bus level.
Similar to simple-bus, a Simple Platform Bus allows to automatically instantiate devices connected to this bus.
Those devices are instantiated only by the Simple Platform Bus probe function itself.
Don't let Greg see this... :)
I can't say I'm a fan either. "Platform bus" is a kernel thing, and the distinction here between the 2 compatibles is certainly a kernel thing.
I think this needs to be solved within the kernel.
What I previously said is define a list of compatibles to not instantiate the child devices. This would essentially be any case having a specific compatible and having its own driver. So if someone has 'compatible = "vendor,not-so-simple-bus", "simple-bus"', when and if they add a driver for "vendor,not-so-simple-bus", then they have to add the compatible to the list in the simple-pm-bus driver. I wouldn't expect this to be a large list. There's only a handful of cases where "simple-bus" has a more specific compatible. And only a few of those have a driver. A more general and complicated solution would be making linux handle 2 (or more) drivers matching a node and picking the driver with most specific match. That gets complicated with built-in vs. modules. I'm not sure we really need to solve that problem.
If we have to do something in the DT, then I think I prefer a property to control the behavior. That way we have the option to ignore it.
Rob
Herve Codina
maintainerRe: [PATCH v4 05/29] dt-bindings: bus: Add simple-platform-bus
Hi Rob,
Quoted 10 lines · On Thu, 30 Oct 2025 09:14:48 -0500 Rob Herring <[email protected]> wrote:
Quoted 8 lines · Herve Codina
A Simple Platform Bus is a transparent bus that doesn't need a specific driver to perform operations at bus level.
Similar to simple-bus, a Simple Platform Bus allows to automatically instantiate devices connected to this bus.
Those devices are instantiated only by the Simple Platform Bus probe function itself.
Quoted 6 lines
Don't let Greg see this... :)
I can't say I'm a fan either. "Platform bus" is a kernel thing, and the distinction here between the 2 compatibles is certainly a kernel thing.
I think this needs to be solved within the kernel.
I fully agree with that.
Quoted 13 lines
What I previously said is define a list of compatibles to not instantiate the child devices. This would essentially be any case having a specific compatible and having its own driver. So if someone has 'compatible = "vendor,not-so-simple-bus", "simple-bus"', when and if they add a driver for "vendor,not-so-simple-bus", then they have to add the compatible to the list in the simple-pm-bus driver. I wouldn't expect this to be a large list. There's only a handful of cases where "simple-bus" has a more specific compatible. And only a few of those have a driver. A more general and complicated solution would be making linux handle 2 (or more) drivers matching a node and picking the driver with most specific match. That gets complicated with built-in vs. modules. I'm not sure we really need to solve that problem.
Right. Let discard the "more general and complicated solution" and focus on the list of compatible to avoid child devices instantiation.
Do you mean that, for "simple-bus" compatible we should:
- Remove the recursive device instantiation from of_platform_populate().
- In simple-bus probe(), check the device we probe against the 'no_instantiate_children' list
- If it matches, do not instantiate chidren
- If it doesn't match instantiate children
Is that correct?
Best regards,
Hervé
Rob Herring
maintainerRe: [PATCH v4 05/29] dt-bindings: bus: Add simple-platform-bus
Quoted 38 lines · Herve Codina
Hi Rob,
Quoted 10 lines · On Thu, 30 Oct 2025 09:14:48 -0500 Rob Herring <[email protected]> wrote:
Quoted 8 lines · Herve Codina
A Simple Platform Bus is a transparent bus that doesn't need a specific driver to perform operations at bus level.
Similar to simple-bus, a Simple Platform Bus allows to automatically instantiate devices connected to this bus.
Those devices are instantiated only by the Simple Platform Bus probe function itself.
Quoted 6 lines
Don't let Greg see this... :)
I can't say I'm a fan either. "Platform bus" is a kernel thing, and the distinction here between the 2 compatibles is certainly a kernel thing.
I think this needs to be solved within the kernel.
I fully agree with that.
Quoted 13 lines
What I previously said is define a list of compatibles to not instantiate the child devices. This would essentially be any case having a specific compatible and having its own driver. So if someone has 'compatible = "vendor,not-so-simple-bus", "simple-bus"', when and if they add a driver for "vendor,not-so-simple-bus", then they have to add the compatible to the list in the simple-pm-bus driver. I wouldn't expect this to be a large list. There's only a handful of cases where "simple-bus" has a more specific compatible. And only a few of those have a driver. A more general and complicated solution would be making linux handle 2 (or more) drivers matching a node and picking the driver with most specific match. That gets complicated with built-in vs. modules. I'm not sure we really need to solve that problem.
Quoted 5 lines
Right. Let discard the "more general and complicated solution" and focus on the list of compatible to avoid child devices instantiation.
Do you mean that, for "simple-bus" compatible we should:
- Remove the recursive device instantiation fromof_platform_populate().
That may be a problem I hadn't considered. While we've solved most probe ordering issues, I think some may remain. Even when of_platform_populate() is called affects this. For example, I tried removing various arm32 of_platform_.*populate() calls which run earlier than the default call, but that broke some platforms. (Looking at the list of remaining ones, I fixed the at91 pinctrl/gpio drivers, but never tried to remove the calls again.)
Maybe this can be restricted to cases which are not recursively created from the root node. Not sure how we detect that. Perhaps no OF_POPULATED flag on the parent node? Or we could just enable this for OF_DYNAMIC nodes? That should be sufficient for your usecase.
I would like to solve this more generally though. So we could try it in kernelci and/or linux-next and see what happens.
Quoted 4 lines
- In simple-bus
probe(), check the device we probe against the 'no_instantiate_children' list
- If it matches, do not instantiate chidren
- If it doesn't match instantiate children
Right.
Rob
Rob Herring
maintainerRe: [PATCH v4 05/29] dt-bindings: bus: Add simple-platform-bus
Quoted 54 lines · Rob Herring
Quoted 38 lines · Herve Codina
Hi Rob,
Quoted 10 lines · On Thu, 30 Oct 2025 09:14:48 -0500 Rob Herring <[email protected]> wrote:
Quoted 8 lines · Herve Codina
A Simple Platform Bus is a transparent bus that doesn't need a specific driver to perform operations at bus level.
Similar to simple-bus, a Simple Platform Bus allows to automatically instantiate devices connected to this bus.
Those devices are instantiated only by the Simple Platform Bus probe function itself.
Quoted 6 lines
Don't let Greg see this... :)
I can't say I'm a fan either. "Platform bus" is a kernel thing, and the distinction here between the 2 compatibles is certainly a kernel thing.
I think this needs to be solved within the kernel.
I fully agree with that.
Quoted 13 lines
What I previously said is define a list of compatibles to not instantiate the child devices. This would essentially be any case having a specific compatible and having its own driver. So if someone has 'compatible = "vendor,not-so-simple-bus", "simple-bus"', when and if they add a driver for "vendor,not-so-simple-bus", then they have to add the compatible to the list in the simple-pm-bus driver. I wouldn't expect this to be a large list. There's only a handful of cases where "simple-bus" has a more specific compatible. And only a few of those have a driver. A more general and complicated solution would be making linux handle 2 (or more) drivers matching a node and picking the driver with most specific match. That gets complicated with built-in vs. modules. I'm not sure we really need to solve that problem.
Quoted 5 lines
Right. Let discard the "more general and complicated solution" and focus on the list of compatible to avoid child devices instantiation.
Do you mean that, for "simple-bus" compatible we should:
- Remove the recursive device instantiation fromof_platform_populate().That may be a problem I hadn't considered. While we've solved most probe ordering issues, I think some may remain. Even when
of_platform_populate()is called affects this. For example, I tried removing various arm32 of_platform_.*populate() calls which run earlier than the default call, but that broke some platforms. (Looking at the list of remaining ones, I fixed the at91 pinctrl/gpio drivers, but never tried to remove the calls again.)
Quoted 4 lines
Maybe this can be restricted to cases which are not recursively created from the root node. Not sure how we detect that. Perhaps no
OF_POPULATEDflag on the parent node? Or we could just enable this forOF_DYNAMICnodes? That should be sufficient for your usecase.
Thinking a bit more about this, I think you don't have to do anything. If child nodes already got populated, calling of_platform_populate() a second time is essentially a nop. And for cases you care about, that wouldn't have happened. Of course, I'd still rather there only be 1 path that devices could have been instantiated.
Rob
Herve Codina
maintainerRe: [PATCH v4 05/29] dt-bindings: bus: Add simple-platform-bus
Hi Rob,
Quoted 60 lines · On Wed, 12 Nov 2025 13:29:09 -0600 Rob Herring <[email protected]> wrote:
Quoted 54 lines · Rob Herring
Quoted 38 lines · Herve Codina
Hi Rob,
Quoted 10 lines · On Thu, 30 Oct 2025 09:14:48 -0500 Rob Herring <[email protected]> wrote:
Quoted 8 lines · Herve Codina
A Simple Platform Bus is a transparent bus that doesn't need a specific driver to perform operations at bus level.
Similar to simple-bus, a Simple Platform Bus allows to automatically instantiate devices connected to this bus.
Those devices are instantiated only by the Simple Platform Bus probe function itself.
Quoted 6 lines
Don't let Greg see this... :)
I can't say I'm a fan either. "Platform bus" is a kernel thing, and the distinction here between the 2 compatibles is certainly a kernel thing.
I think this needs to be solved within the kernel.
I fully agree with that.
Quoted 13 lines
What I previously said is define a list of compatibles to not instantiate the child devices. This would essentially be any case having a specific compatible and having its own driver. So if someone has 'compatible = "vendor,not-so-simple-bus", "simple-bus"', when and if they add a driver for "vendor,not-so-simple-bus", then they have to add the compatible to the list in the simple-pm-bus driver. I wouldn't expect this to be a large list. There's only a handful of cases where "simple-bus" has a more specific compatible. And only a few of those have a driver. A more general and complicated solution would be making linux handle 2 (or more) drivers matching a node and picking the driver with most specific match. That gets complicated with built-in vs. modules. I'm not sure we really need to solve that problem.
Quoted 5 lines
Right. Let discard the "more general and complicated solution" and focus on the list of compatible to avoid child devices instantiation.
Do you mean that, for "simple-bus" compatible we should:
- Remove the recursive device instantiation fromof_platform_populate().That may be a problem I hadn't considered. While we've solved most probe ordering issues, I think some may remain. Even when
of_platform_populate()is called affects this. For example, I tried removing various arm32 of_platform_.*populate() calls which run earlier than the default call, but that broke some platforms. (Looking at the list of remaining ones, I fixed the at91 pinctrl/gpio drivers, but never tried to remove the calls again.)Quoted 4 lines
Maybe this can be restricted to cases which are not recursively created from the root node. Not sure how we detect that. Perhaps no
OF_POPULATEDflag on the parent node? Or we could just enable this forOF_DYNAMICnodes? That should be sufficient for your usecase.
Quoted 6 lines
Thinking a bit more about this, I think you don't have to do anything. If child nodes already got populated, calling
of_platform_populate()a second time is essentially a nop. And for cases you care about, that wouldn't have happened. Of course, I'd still rather there only be 1 path that devices could have been instantiated.
Hum, if my understanding is correct, this looks like what I did in the v3 iteration [1].
The idea was:
1) Do not change anything in of_platform_.*populate()
2) Update the simple-bus driver to populate children if there is only one compatible string and this string matches the compatible string handled by the driver.
We can be more restrictive for 2) and only populate children if the only one compatible string is "simple-bus". This will keep current behavior for "simple-mfd", "isa" and "arm,amba-bus".
If you think this could be the right direction, I will bring those modification in the next iteration.
Also, do you think we should be more restrictive and populate children in the simple-bus driver only for "simple-bus" compatible?
[1] https://lore.kernel.org/lkml/[email protected]/
Best regards,
Hervé
Re: [PATCH v4 05/29] dt-bindings: bus: Add simple-platform-bus
In reply to Herve CodinaHi Hervé,
Quoted 10 lines · Herve Codina
A Simple Platform Bus is a transparent bus that doesn't need a specific driver to perform operations at bus level.
Similar to simple-bus, a Simple Platform Bus allows to automatically instantiate devices connected to this bus.
Those devices are instantiated only by the Simple Platform Bus probe function itself.
Signed-off-by Herve Codina <[email protected]>
Thanks for your patch!
Quoted 11 lines
Documentation/devicetree/bindings/bus/simple-platform-bus.yaml new file +8
-0@@ -0,0 +1,50 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/bus/simple-platform-bus.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Simple Platform Bus +
Documentation/devicetree/bindings/bus/simple-platform-bus.yaml line 18
Quoted 10 lines
Documentation/devicetree/bindings/bus/simple-platform-bus.yaml new file +10
-0+maintainers: + - Herve Codina <[email protected]> + +description: | + A Simple Platform Bus is a transparent bus that doesn't need a specific + driver to perform operations at bus level. + + Similar to simple-bus, a Simple Platform Bus allows to automatically + instantiate devices connected to this bus. Those devices are instantiated + only by the Simple Platform Bus probe function itself.
So what are the differences with simple-bus? That its children are instantiated "only by the Simple Platform Bus probe function itself"? If that is the case, in which other places are simple-bus children instantiated?
Do we need properties related to power-management (clocks, power-domains), or will we need a "simple-pm-platform-bus" later? ;-)
FTR, I still think we wouldn't have needed the distinction between "simple-bus" and "simple-pm-bus"...
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Herve Codina
maintainerRe: [PATCH v4 05/29] dt-bindings: bus: Add simple-platform-bus
Quoted 34 lines · On Fri, 31 Oct 2025 09:52:16 +0100 Geert Uytterhoeven <[email protected]>…
Hi Hervé,
Quoted 10 lines · Herve Codina
A Simple Platform Bus is a transparent bus that doesn't need a specific driver to perform operations at bus level.
Similar to simple-bus, a Simple Platform Bus allows to automatically instantiate devices connected to this bus.
Those devices are instantiated only by the Simple Platform Bus probe function itself.
Signed-off-by Herve Codina <[email protected]>Thanks for your patch!
Quoted 18 lines
Documentation/devicetree/bindings/bus/simple-platform-bus.yaml new file +15
-0@@ -0,0 +1,50 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/bus/simple-platform-bus.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Simple Platform Bus + +maintainers: + - Herve Codina <[email protected]> + +description: | + A Simple Platform Bus is a transparent bus that doesn't need a specific + driver to perform operations at bus level. +
Quoted 8 lines
Documentation/devicetree/bindings/bus/simple-platform-bus.yaml line 18
Quoted 3 lines
Documentation/devicetree/bindings/bus/simple-platform-bus.yaml new file +3
-0+ Similar to simple-bus, a Simple Platform Bus allows to automatically + instantiate devices connected to this bus. Those devices are instantiated + only by the Simple Platform Bus probe function itself.So what are the differences with simple-bus? That its children are instantiated "only by the Simple Platform Bus probe function itself"? If that is the case, in which other places are simple-bus children instantiated?
In of_platform_populate(). It call of_platform_bus_create() which is recursive:
https://elixir.bootlin.com/linux/v6.14/source/drivers/of/platform.c#L374
So children are instantiated out of the bus probe().
Quoted 6 lines
Do we need properties related to power-management (clocks, power-domains), or will we need a "simple-pm-platform-bus" later? ;-)
FTR, I still think we wouldn't have needed the distinction between "simple-bus" and "simple-pm-bus"...
I would like that. Using simple-pm-bus solves my issue but I don't have any clocks or power-domains to set. The simple-pm-bus bus requires at least one of them. Even if the driver itself solved my issue, I cannot be compliant with its binding.
Best regards,
Hervé
Herve Codina
maintainerPATCH v4 6/29 bus: Introduce simple-platorm-bus
In reply to Herve CodinaThe simple-pm-bus driver handles several simple busses. When it is used with busses other than a compatible "simple-pm-bus", it doesn't populate its child devices during its probe.
This confuses fw_devlink and results in wrong or missing devlinks.
Once a driver is bound to a device and the probe() has been called, device_links_driver_bound() is called.
This function performs operation based on the following assumption:
If a child firmware node of the bound device is not added as a device, it will never be added.
Among operations done on fw_devlinks of those "never be added" devices, device_links_driver_bound() changes their supplier.
With devices attached to a simple-bus compatible device, this change leads to wrong devlinks where supplier of devices points to the device parent (i.e. simple-bus compatible device) instead of the device itself (i.e. simple-bus child).
When the device attached to the simple-bus is removed, because devlinks are not correct, its consumers are not removed first.
In order to have correct devlinks created, make the simple-bus driver compliant with the devlink assumption and create its child devices during its probe.
Doing that leads to other issues due to the fact that simple-bus is closely related to of_platform_populate().
Indeed, of_platform_populate() can probe child devices if a simple-bus compatible node is detected. This behavior is expected by some drivers such as some MFD drivers. Those drivers perform some operations in their probe() but rely on the core (simple-mfd, simple-bus compatible) to populate child devices [1].
Avoiding recursive probing in of_platform_populate() and let the simple-bus driver probe its child devices will break some system.
For this reason, keep the current behavior of the simple-bus driver and of_platform_populate() as they are and introduce simple-platform-bus driver.
This driver doesn't interfere with of_platform_populate() and populates child devices during its probe() as expected by fw_devlink.
[1] https://lore.kernel.org/all/[email protected]/
--- drivers/bus/simple-pm-bus.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
drivers/bus/simple-pm-bus.c +37 -0
@@ -158,5 +158,42 @@ static struct platform_driver simple_pm_bus_driver = {module_platform_driver (simple_pm_bus_driver); +static int simple_platform_bus_probe (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev; +struct device_node *np = dev->of_node; + +if (np) +of_platform_populate (np,NULL ,NULL , dev); + +return 0 ; +} + +static void simple_platform_bus_remove (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev; +struct device_node *np = dev->of_node; + +if (np) +of_platform_depopulate (dev); +} + +static const struct of_device_id simple_platform_bus_of_match[] = { + { .compatible ="simple-platform-bus" , }, + {/* sentinel */ } +}; +MODULE_DEVICE_TABLE (of, simple_platform_bus_of_match); + +static struct platform_driver simple_platform_bus_driver = { + .probe = simple_platform_bus_probe, + .remove = simple_platform_bus_remove, + .driver = { + .name ="simple-platform-bus" , + .of_match_table = simple_platform_bus_of_match, + }, +}; + +module_platform_driver (simple_platform_bus_driver); +MODULE_DESCRIPTION ("Simple Power-Managed Bus Driver" );MODULE_AUTHOR ("Geert Uytterhoeven <[email protected]>" );
Signature · 1 line
2.51.0
Andy Shevchenko
reviewerRe: [PATCH v4 06/29] bus: Introduce simple-platorm-bus
Quoted 40 lines · Herve Codina
The simple-pm-bus driver handles several simple busses. When it is used with busses other than a compatible "simple-pm-bus", it doesn't populate its child devices during its probe.
This confuses
fw_devlinkand results in wrong or missing devlinks.Once a driver is bound to a device and the
probe()has been called,device_links_driver_bound()is called.This function performs operation based on the following assumption:
If a child firmware node of the bound device is not added as a device, it will never be added.Among operations done on
fw_devlinksof those "never be added" devices,device_links_driver_bound()changes their supplier.With devices attached to a simple-bus compatible device, this change leads to wrong devlinks where supplier of devices points to the device parent (i.e. simple-bus compatible device) instead of the device itself (i.e. simple-bus child).
When the device attached to the simple-bus is removed, because devlinks are not correct, its consumers are not removed first.
In order to have correct devlinks created, make the simple-bus driver compliant with the devlink assumption and create its child devices during its probe.
Doing that leads to other issues due to the fact that simple-bus is closely related to
of_platform_populate().Indeed,
of_platform_populate()can probe child devices if a simple-bus compatible node is detected. This behavior is expected by some drivers such as some MFD drivers. Those drivers perform some operations in theirprobe()but rely on the core (simple-mfd, simple-bus compatible) to populate child devices [1].Avoiding recursive probing in
of_platform_populate()and let the simple-bus driver probe its child devices will break some system.
Quoted 8 lines
For this reason, keep the current behavior of the simple-bus driver and
of_platform_populate()as they are and introduce simple-platform-bus driver.This driver doesn't interfere with
of_platform_populate()and populates child devices during itsprobe()as expected byfw_devlink.
Link tag?
...
The below is simply wrong. The luck that you got no errors is due to CONFIG_OF being bool and not tristate in Kconfig. I dunno if this driver ever gets the 'm' capability, but currently it uses tons of dead code (such as MODULE_*() macros). Disregard of that, the proposed change should go to the separate compilation unit at bare minimum.
...
Quoted 3 lines
module_platform_driver(simple_pm_bus_driver);+module_platform_driver(simple_platform_bus_driver);
^^^ WRONG!
Signature · 2 lines
With Best Regards, Andy Shevchenko
Herve Codina
maintainerPATCH v4 7/29 misc: lan966x_pci: Use simple-platform-bus
In reply to Herve CodinaThe simple-bus driver doesn't populate its child devices during its probe. This confuses fw_devlink and results in wrong or missing devlinks.
simple-platform-bus has been introduced to fix the issue.
Use this newly introduce driver instead of simple-bus.
--- drivers/misc/lan966x_pci.dtso | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/lan966x_pci.dtso +1 -1
@@ -48,7 +48,7 @@ sys_clk: clock-15625000 { }; pci-ep-bus@0 { - compatible = "simple-bus"; + compatible = "simple-platform-bus"; #address-cells = <1>; #size-cells = <1>;
Signature · 1 line
2.51.0
Herve Codina
maintainerPATCH v4 8/29 driver core: fw_devlink: Introduce fw_devlink_set_device()
In reply to Herve CodinaSetting fwnode->dev is specific to fw_devlink.
In order to avoid having a direct 'fwnode->dev = dev;' in several place in the kernel, introduce fw_devlink_set_device() helper to perform this operation.
--- include/linux/fwnode.h | 6 ++++++ 1 file changed, 6 insertions(+)
include/linux/fwnode.h +6 -0
@@ -231,4 +231,10 @@ void fw_devlink_purge_absent_suppliers(struct fwnode_handle *fwnode);void fw_devlink_refresh_fwnode (struct fwnode_handle *fwnode);bool fw_devlink_is_strict (void ); +static inline void fw_devlink_set_device (struct fwnode_handle *fwnode, +struct device *dev) +{ + fwnode->dev = dev; +} +#endif
Signature · 1 line
2.51.0
Re: [PATCH v4 08/29] driver core: fw_devlink: Introduce fw_devlink_set_device()
Quoted 8 lines · Herve Codina
Setting
fwnode->devis specific tofw_devlink.In order to avoid having a direct '
fwnode->dev= dev;' in several place in the kernel, introducefw_devlink_set_device()helper to perform this operation.Signed-off-by Herve Codina <[email protected]>
Kind regards
Uffe
Quoted 22 lines
--- include/linux/fwnode.h | 6 ++++++ 1 file changed, 6 insertions(+)include/linux/fwnode.h +6
-1@@ -231,4 +231,10 @@ void fw_devlink_purge_absent_suppliers(struct fwnode_handle *fwnode);void fw_devlink_refresh_fwnode (struct fwnode_handle *fwnode);bool fw_devlink_is_strict (void ); +static inline void fw_devlink_set_device (struct fwnode_handle *fwnode, +struct device *dev) +{ + fwnode->dev = dev; +} +#endif --2.51.0
Re: [PATCH v4 08/29] driver core: fw_devlink: Introduce fw_devlink_set_device()
In reply to Herve CodinaQuoted 5 lines · Herve Codina
Setting
fwnode->devis specific tofw_devlink.In order to avoid having a direct '
fwnode->dev= dev;' in several place in the kernel, introducefw_devlink_set_device()helper to perform this operation.
FWIW,
Signature · 2 lines
With Best Regards, Andy Shevchenko
Herve Codina
maintainerPATCH v4 9/29 drivers: core: Use fw_devlink_set_device()
In reply to Herve CodinaThe code set directly fwnode->dev field.
Use the dedicated fw_devlink_set_device() helper to perform this operation.
--- drivers/base/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/base/core.c +2 -2
@@ -3739,7 +3739,7 @@ int device_add(struct device *dev)* device and the driver sync_state callback is called for this device. */ if (dev->fwnode && !dev->fwnode->dev) { - dev->fwnode->dev = dev; +fw_devlink_set_device (dev->fwnode, dev);fw_devlink_link_device (dev); }
@@ -3899,7 +3899,7 @@ void device_del(struct device *dev)device_unlock (dev);if (dev->fwnode && dev->fwnode->dev == dev) - dev->fwnode->dev =NULL ; +fw_devlink_set_device (dev->fwnode,NULL );/* Notify clients of device removal. This call must come * before dpm_sysfs_remove().
Signature · 1 line
2.51.0
Re: [PATCH v4 09/29] drivers: core: Use fw_devlink_set_device()
Quoted 8 lines · Herve Codina
The code set directly
fwnode->devfield.Use the dedicated
fw_devlink_set_device()helper to perform this operation.Signed-off-by Herve Codina <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>
Kind regards
Uffe
Quoted 29 lines
--- drivers/base/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/base/core.c +2
-3@@ -3739,7 +3739,7 @@ int device_add(struct device *dev)* device and the driver sync_state callback is called for this device. */ if (dev->fwnode && !dev->fwnode->dev) { - dev->fwnode->dev = dev; +fw_devlink_set_device (dev->fwnode, dev);fw_devlink_link_device (dev); }@@ -3899,7 +3899,7 @@ void device_del(struct device *dev)device_unlock (dev);if (dev->fwnode && dev->fwnode->dev == dev) - dev->fwnode->dev =NULL ; +fw_devlink_set_device (dev->fwnode,NULL );/* Notify clients of device removal. This call must come * before dpm_sysfs_remove(). -- 2.51.0
Herve Codina
maintainerPATCH v4 10/29 pinctrl: cs42l43: Use fw_devlink_set_device()
In reply to Herve CodinaThe code set directly fwnode->dev field.
Use the dedicated fw_devlink_set_device() helper to perform this operation.
--- drivers/pinctrl/cirrus/pinctrl-cs42l43.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/cirrus/pinctrl-cs42l43.c +1 -1
@@ -566,7 +566,7 @@ static int cs42l43_pin_probe(struct platform_device *pdev) fwnode =fwnode_get_named_child_node (fwnode,"pinctrl" );if (fwnode && !fwnode->dev) - fwnode->dev = priv->dev; +fw_devlink_set_device (fwnode, priv->dev); } priv->gpio_chip.fwnode = fwnode;
Signature · 1 line
2.51.0
Herve Codina
maintainerPATCH v4 11/29 cxl/test: Use device_set_node()
In reply to Herve CodinaThe code set directly dev->fwnode.
Use the dedicated helper to perform this operation.
--- tools/testing/cxl/test/cxl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/cxl/test/cxl.c +1 -1
@@ -1124,7 +1124,7 @@ static void mock_companion(struct acpi_device *adev, struct device *dev) {device_initialize (&adev->dev);fwnode_init (&adev->fwnode,NULL ); - dev->fwnode = &adev->fwnode; +device_set_node (dev, &adev->fwnode); adev->fwnode.dev = dev; }
Signature · 1 line
2.51.0
Herve Codina
maintainerPATCH v4 12/29 cxl/test: Use fw_devlink_set_device()
In reply to Herve CodinaThe code set directly fwnode.dev field.
Use the dedicated fw_devlink_set_device() helper to perform this operation.
--- tools/testing/cxl/test/cxl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/cxl/test/cxl.c +1 -1
@@ -1125,7 +1125,7 @@ static void mock_companion(struct acpi_device *adev, struct device *dev)device_initialize (&adev->dev);fwnode_init (&adev->fwnode,NULL );device_set_node (dev, &adev->fwnode); - adev->fwnode.dev = dev; +fw_devlink_set_device (&adev->fwnode, dev); }#ifndef SZ_64G
Signature · 1 line
2.51.0
Herve Codina
maintainerPATCH v4 13/29 PCI: of: Use fw_devlink_set_device()
In reply to Herve CodinaThe code set directly fwnode.dev field.
Use the dedicated fw_devlink_set_device() helper to perform this operation.
--- drivers/pci/of.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/of.c +1 -1
@@ -803,7 +803,7 @@ void of_pci_make_host_bridge_node(struct pci_host_bridge *bridge)* bus. Avoid any new device creation. */ of_node_set_flag (np,OF_POPULATED ); - np->fwnode.dev = &bridge->dev; +fw_devlink_set_device (&np->fwnode, &bridge->dev);fwnode_dev_initialized (&np->fwnode, true); ret =of_changeset_apply (cset);
Signature · 1 line
2.51.0
Herve Codina
maintainerPATCH v4 14/29 PCI: of: Set fwnode device of newly created PCI device nodes
In reply to Herve CodinaDevice-tree node can be created when CONFIG_PCI_DYNAMIC_OF_NODES. Those node are created and filled based on PCI core information but the fwnode device field is not set.
When later an overlay is applied, this confuses fw_devlink. Indeed, without any device attached to the node, fw_devlink considers that this node will never become a device. When this node is pointed as a supplier, devlink looks at its ancestors in order to find a node with a device that could be used as the supplier.
In the PCI use case, this leads to links that wrongly use the PCI root bridge device as the supplier instead of the expected PCI device.
Setting the fwnode device to the device of the PCI device allows devlink to use this device as a supplier and so, correct links are created.
--- drivers/pci/of.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/pci/of.c +7 -0
@@ -709,6 +709,13 @@ void of_pci_make_dev_node(struct pci_dev *pdev)if (ret) goto out_free_node; +/* +* Set the fwnode device in order to have fw_devlink creating links +* pointing to this PCI device instead of walking up to the PCI host +* bridge. +*/ +fw_devlink_set_device (&np->fwnode, &pdev->dev); + ret =of_changeset_apply (cset);if (ret) goto out_free_node;
Signature · 1 line
2.51.0
Herve Codina
maintainerPATCH v4 15/29 PCI: of: Remove fwnode_dev_initialized() call for a PCI root bridge node
In reply to Herve CodinaDuring the instantiation of devices described by a device-tree overlay applied on a PCI device, devlink displays the following kind of debug messages instead of creating the expected links:
'Not linking xxxx - might never become dev'
Without those expected links, the device removal order cannot be correct.
Those debug traces are printed by fw_devlink_create_devlink(). In our use case, they are all printed because the supplier of the link has at least one of its ancestor with its fwnode flag FWNODE_FLAG_INITIALIZED set.
The culprit ancestor is the PCI root bridge.
The fwnode related to the PCI root bridge is created dynamically by the of_pci_make_host_bridge_node() function. During this creation fwnode_dev_initialized() is called which set the FWNODE_FLAG_INITIALIZED flag.
Calling fwnode_dev_initialized() tells devlink that the device related to this node is handled out of the driver core. This is not correct in our case. Indeed the device related to this firmware node is handled using driver core mechanisms and is fully compliant devlink expectations.
Simply remove the fwnode_dev_initialized() call. With that done, the devlink debug messages are no more displayed and links that were missing are correctly created.
--- drivers/pci/of.c | 1 - 1 file changed, 1 deletion(-)
drivers/pci/of.c +0 -1
@@ -811,7 +811,6 @@ void of_pci_make_host_bridge_node(struct pci_host_bridge *bridge)*/ of_node_set_flag (np,OF_POPULATED );fw_devlink_set_device (&np->fwnode, &bridge->dev); -fwnode_dev_initialized (&np->fwnode, true); ret =of_changeset_apply (cset);if (ret)
Signature · 1 line
2.51.0
Herve Codina
maintainerPATCH v4 16/29 i2c: core: Introduce i2c_get_adapter_physdev()
In reply to Herve CodinaThe physical device providing an I2C adapter is the device that calls i2c_add_adapter() or variants and i2c_del_adapter().
Most of the time this physical device is the parent of the adapter device.
Exceptions exist with i2c muxes. Indeed, in case of i2c muxes, the parent of the mux adapter device points to the adapter device the mux is connected to instead of the physical of this mux adapter.
Introduce i2c_get_adapter_physdev() and a new physdev field in the adapter structure in order to ease the adapter physical device retrieval.
--- drivers/i2c/i2c-core-base.c | 16 ++++++++++++++++ include/linux/i2c.h | 3 +++ 2 files changed, 19 insertions(+)
drivers/i2c/i2c-core-base.c +16 -0
@@ -1919,6 +1919,22 @@ struct i2c_adapter *i2c_get_adapter_by_fwnode(struct fwnode_handle *fwnode) }EXPORT_SYMBOL (i2c_get_adapter_by_fwnode); +/** +* i2c_get_adapter_physdev() - Get the physical device of an adapter +* @adapter: the adapter to get the physical device from +* +* Return: +* Look up and return the &struct device corresponding to the device supplying +* this @adapter. +* +* The user must call put_device() once done with the physical device returned. +*/ +struct device *i2c_get_adapter_physdev (struct i2c_adapter *adapter) +{ +return get_device (adapter->physdev ?: adapter->dev.parent); +} +EXPORT_SYMBOL (i2c_get_adapter_physdev); +static void i2c_parse_timing (struct device *dev,char *prop_name,u32 *cur_val_p,u32 def_val,bool use_def) {
include/linux/i2c.h +3 -0
@@ -744,6 +744,7 @@ struct i2c_adapter {int timeout;/* in jiffies */ int retries;struct device dev;/* the adapter device */ +struct device *physdev;/* the physical device */ unsigned long locked_flags;/* owned by the I2C core */ #define I2C_ALF_IS_SUSPENDED 0#define I2C_ALF_SUSPEND_REPORTED 1
@@ -911,6 +912,8 @@ struct i2c_adapter *i2c_get_adapter(int nr);void i2c_put_adapter (struct i2c_adapter *adap);unsigned int i2c_adapter_depth (struct i2c_adapter *adapter); +struct device *i2c_get_adapter_physdev (struct i2c_adapter *adap); +void i2c_parse_fw_timings (struct device *dev,struct i2c_timings *t,bool use_defaults);/* Return the functionality mask */
Signature · 1 line
2.51.0
Herve Codina
maintainerPATCH v4 17/29 i2c: mux: Set adapter physical device
In reply to Herve CodinaFor i2c muxes, the parent of the mux adapter device is the adapter device the mux is connected to.
This parent is not the physical device related to the mux adapter. Indeed, the physical device of the mux adapter is the mux device itself.
Fill the adap.physdev with the mux device.
--- drivers/i2c/i2c-mux.c | 1 + 1 file changed, 1 insertion(+)
drivers/i2c/i2c-mux.c +1 -0
@@ -315,6 +315,7 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc, priv->adap.algo = &priv->algo; priv->adap.algo_data = priv; priv->adap.dev.parent = &parent->dev; + priv->adap.physdev = muxc->dev; priv->adap.retries = parent->retries; priv->adap.timeout = parent->timeout; priv->adap.quirks = parent->quirks;
Signature · 1 line
2.51.0
Re: [PATCH v4 17/29] i2c: mux: Set adapter physical device
Hi Herve,
Quoted 9 lines · Herve Codina
For i2c muxes, the parent of the mux adapter device is the adapter device the mux is connected to.
This parent is not the physical device related to the mux adapter. Indeed, the physical device of the mux adapter is the mux device itself.
Fill the adap.physdev with the mux device.
Signed-off-by Herve Codina <[email protected]>
Thanks,
Andi
Herve Codina
maintainerPATCH v4 18/29 i2c: mux: Create missing devlink between mux and adapter physical device
In reply to Herve CodinaWhen removing an i2c controller device handling an i2c bus where an i2c mux is connected to, the removal process hangs and is stuck in the wait_completion() call done in i2c_del_adapter().
The i2c_del_adapter() tries to removed the i2c adapter related to the i2c controller device and the wait_completion() is waiting for the i2c adapter device release. This release is performed when the device is no more used (i.e. refcount reaches zero).
When an i2c mux is involved in an i2c path, the struct dev topology is the following:
+----------------+ +-------------------+
| i2c controller | | i2c mux |
| device | | device |
| ^ | | |
| | | | |
| dev's parent | | |
| | | | |
| i2c adapter | | i2c adapter chanX |
| device <---- dev's parent ------ device |
| (no driver) | | (no driver) |
+----------------+ +-------------------+When an i2c mux device creates an i2c adapter for its downstream channel, a reference is taken to its adapter dev's parent. This parent is the i2c mux upstream adapter device.
No relationship exists between the i2c mux device itself and the i2c controller device (physical device) in order to have the i2c mux device calling i2c_del_adapter() to remove its downtream adapters and so, release references taken to the upstream adapter.
This consumer/supplier relationship is typically a devlink relationship.
Also, i2c muxes can be chained and so, the upstream adapter can be supplied by either an i2c controller device or an other i2c mux device.
In order to get the physical device of the adapter a mux is connected to, rely on the newly introduced i2c_adapter_get_physdev() and create the missing devlink between the i2c mux device and the physical device of the adapter the mux is connected to.
With that done, the i2c mux device is removed before the device handling the upstream i2c adapter (i2c controller device or i2c mux device). All references are released and the i2c_del_adapter() call performed by driver handling the upstream adapter device is not blocking anymore.
--- drivers/i2c/i2c-mux.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
drivers/i2c/i2c-mux.c +25 -0
@@ -268,7 +268,9 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc, u32 force_nr, u32 chan_id) {struct i2c_adapter *parent = muxc->parent; +struct device *parent_physdev;struct i2c_mux_priv *priv; +struct device_link *dl;char symlink_name[20 ];int ret;
@@ -375,6 +377,29 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc,ACPI_COMPANION (muxc->dev), chan_id); +/* +* There is no relationship set between the mux device and the physical +* device handling the parent adapter. Create this missing relationship +* in order to remove the i2c mux device (consumer) and so the dowstream +* channel adapters before removing the physical device (supplier) which +* handles the i2c mux upstream adapter. +*/ + parent_physdev =i2c_get_adapter_physdev (parent); +if (!parent_physdev) { +dev_err (muxc->dev,"failed to get the parent physical device\n" ); + ret = -EINVAL ; + goto err_free_priv; + } + dl =device_link_add (muxc->dev, parent_physdev,DL_FLAG_AUTOREMOVE_CONSUMER ); +if (!dl) { +dev_err (muxc->dev,"failed to create device link to %s\n" , +dev_name (parent_physdev)); +put_device (parent_physdev); + ret = -EINVAL ; + goto err_free_priv; + } +put_device (parent_physdev); +if (force_nr) { priv->adap.nr = force_nr; ret =i2c_add_numbered_adapter (&priv->adap);
Signature · 1 line
2.51.0
Andi Shyti
maintainerRe: [PATCH v4 18/29] i2c: mux: Create missing devlink between mux and adapter physical device
Hi Herve,
...
Quoted 2 lines
When an i2c mux is involved in an i2c path, the struct dev topology is the following:
supernitpick: I'd leave blank line here.
Quoted 12 lines
+----------------+ +-------------------+
| i2c controller | | i2c mux |
| device | | device |
| ^ | | |
| | | | |
| dev's parent | | |
| | | | |
| i2c adapter | | i2c adapter chanX |
| device <---- dev's parent ------ device |
| (no driver) | | (no driver) |
+----------------+ +-------------------+...
Quoted 3 lines
No relationship exists between the i2c mux device itself and the i2c controller device (physical device) in order to have the i2c mux device calling
i2c_del_adapter()to remove its downtream adapters and so,
/downtream/downstream/
Quoted 1 line
release references taken to the upstream adapter.
...
drivers/i2c/i2c-mux.c int i2c_mux_add_adapter(struct i2c_mux_core *muxc, · line 390
Quoted 11 lines
drivers/i2c/i2c-mux.c +11
-0+/* +* There is no relationship set between the mux device and the physical +* device handling the parent adapter. Create this missing relationship +* in order to remove the i2c mux device (consumer) and so the dowstream +* channel adapters before removing the physical device (supplier) which +* handles the i2c mux upstream adapter. +*/ + parent_physdev =i2c_get_adapter_physdev (parent); +if (!parent_physdev) { +dev_err (muxc->dev,"failed to get the parent physical device\n" ); + ret = -EINVAL ;
-ENODEV?
drivers/i2c/i2c-mux.c int i2c_mux_add_adapter(struct i2c_mux_core *muxc, · line 393
Quoted 3 lines
drivers/i2c/i2c-mux.c +3
-0+ goto err_free_priv; + } + dl =device_link_add (muxc->dev, parent_physdev,DL_FLAG_AUTOREMOVE_CONSUMER );
Not to call twice put_device, I would add it once here and then check for !dl.
drivers/i2c/i2c-mux.c int i2c_mux_add_adapter(struct i2c_mux_core *muxc, · line 398
Quoted 5 lines
drivers/i2c/i2c-mux.c +5
-0+if (!dl) { +dev_err (muxc->dev,"failed to create device link to %s\n" , +dev_name (parent_physdev)); +put_device (parent_physdev); + ret = -EINVAL ;
same here, should this be -ENODEV?
Andi
Quoted 10 lines
drivers/i2c/i2c-mux.c +4
-0+ goto err_free_priv; + } +put_device (parent_physdev); +if (force_nr) { priv->adap.nr = force_nr; ret =i2c_add_numbered_adapter (&priv->adap);Signature · 1 line
2.51.0
Andy Shevchenko
reviewerRe: [PATCH v4 18/29] i2c: mux: Create missing devlink between mux and adapter physical device
On Thu, Oct 30, 2025 at 04:23:24PM +0100, Andi Shyti wrote:
...
Quoted 4 lines
drivers/i2c/i2c-mux.c int i2c_mux_add_adapter(struct i2c_mux_core *muxc, · line 393
Quoted 1 line
drivers/i2c/i2c-mux.c +1
-0+ dl =device_link_add (muxc->dev, parent_physdev,DL_FLAG_AUTOREMOVE_CONSUMER );Not to call twice
put_device, I would add it once here and then check for !dl.
I was almost commenting the same in one of the previous rounds, but...
Quoted 3 lines
drivers/i2c/i2c-mux.c int i2c_mux_add_adapter(struct i2c_mux_core *muxc, · line 396
Quoted 3 lines
drivers/i2c/i2c-mux.c +3
-0+if (!dl) { +dev_err (muxc->dev,"failed to create device link to %s\n" , +dev_name (parent_physdev));
...haven't you noticed this use? With your (and my old) suggestion this may lead to NULL / stale pointer dereference.
Quoted 5 lines
Quoted 5 lines
drivers/i2c/i2c-mux.c +5
-0+put_device (parent_physdev); + ret = -EINVAL ; + goto err_free_priv; + } +put_device (parent_physdev);
Signature · 2 lines
With Best Regards, Andy Shevchenko
Herve Codina
maintainerRe: [PATCH v4 18/29] i2c: mux: Create missing devlink between mux and adapter physical device
In reply to Andi ShytiHi Andi,
Quoted 8 lines · On Thu, 30 Oct 2025 16:23:24 +0100 Andi Shyti <[email protected]> wrote:
Hi Herve,
...
Quoted 2 lines
When an i2c mux is involved in an i2c path, the struct dev topology is the following:
supernitpick: I'd leave blank line here.
Will be added.
Quoted 14 lines
Quoted 13 lines
+----------------+ +-------------------+ | i2c controller | | i2c mux | | device | | device | | ^ | | | | | | | | | dev's parent | | | | | | | | | i2c adapter | | i2c adapter chanX | | device <---- dev's parent ------ device | | (no driver) | | (no driver) | +----------------+ +-------------------+
Quoted 7 lines
...
Quoted 3 lines
No relationship exists between the i2c mux device itself and the i2c controller device (physical device) in order to have the i2c mux device calling
i2c_del_adapter()to remove its downtream adapters and so,/downtream/downstream/
Will be fixed
Quoted 5 lines
Quoted 2 lines
release references taken to the upstream adapter.
...
Quoted 13 lines
drivers/i2c/i2c-mux.c int i2c_mux_add_adapter(struct i2c_mux_core *muxc, · line 390
Quoted 11 lines
drivers/i2c/i2c-mux.c +11
-0+/* +* There is no relationship set between the mux device and the physical +* device handling the parent adapter. Create this missing relationship +* in order to remove the i2c mux device (consumer) and so the dowstream +* channel adapters before removing the physical device (supplier) which +* handles the i2c mux upstream adapter. +*/ + parent_physdev =i2c_get_adapter_physdev (parent); +if (!parent_physdev) { +dev_err (muxc->dev,"failed to get the parent physical device\n" ); + ret = -EINVAL ;
-ENODEV?
Yes, -ENODEV makes sense here. Will be changed in the next iteration.
Quoted 7 lines
drivers/i2c/i2c-mux.c int i2c_mux_add_adapter(struct i2c_mux_core *muxc, · line 393
Quoted 4 lines
drivers/i2c/i2c-mux.c +3
-0+ goto err_free_priv; + } + dl =device_link_add (muxc->dev, parent_physdev,DL_FLAG_AUTOREMOVE_CONSUMER );Not to call twice
put_device, I would add it once here and then check for !dl.
As Andy already mentioned, we cannot do that. Indeed, dev_name(parent_physdev) is called in the error path and so the device reference has to be kept.
Quoted 8 lines
drivers/i2c/i2c-mux.c int i2c_mux_add_adapter(struct i2c_mux_core *muxc, · line 398
Quoted 6 lines
drivers/i2c/i2c-mux.c +5
-0+if (!dl) { +dev_err (muxc->dev,"failed to create device link to %s\n" , +dev_name (parent_physdev)); +put_device (parent_physdev); + ret = -EINVAL ;same here, should this be
-ENODEV?
For this one, I am not so sure.
The failure is related to the device link creation and probably due to some devlink invalid internal flags or state instead of a missing device.
That's said, if you really want the -ENODEV here, let me know.
Best regards,
Hervé
Herve Codina
maintainerPATCH v4 19/29 of: property: Allow fw_devlink device-tree on x86
In reply to Herve CodinaPCI drivers can use a device-tree overlay to describe the hardware available on the PCI board. This is the case, for instance, of the LAN966x PCI device driver.
Adding some more nodes in the device-tree overlay adds some more consumer/supplier relationship between devices instantiated from this overlay.
Those fw_node consumer/supplier relationships are handled by fw_devlink and are created based on the device-tree parsing done by the of_fwnode_add_links() function.
Those consumer/supplier links are needed in order to ensure a correct PM runtime management and a correct removal order between devices.
For instance, without those links a supplier can be removed before its consumers is removed leading to all kind of issue if this consumer still want the use the already removed supplier.
The support for the usage of an overlay from a PCI driver has been added on x86 systems in commit 1f340724419ed ("PCI: of: Create device tree PCI host bridge node").
In the past, support for fw_devlink on x86 had been tried but this support has been removed in commit 4a48b66b3f52 ("of: property: Disable fw_devlink DT support for X86"). Indeed, this support was breaking some x86 systems such as OLPC system and the regression was reported in [0].
Instead of disabling this support for all x86 system, use a finer grain and disable this support only for the possible problematic subset of x86 systems (at least OLPC and CE4100).
Those systems use a device-tree to describe their hardware. Identify those systems using key properties in the device-tree.
--- drivers/of/property.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-)
drivers/of/property.c +30 -1
@@ -1600,12 +1600,41 @@ static int of_fwnode_irq_get(const struct fwnode_handle *fwnode,return of_irq_get (to_of_node (fwnode), index); } +static int match_property_by_path (const char *node_path,const char *prop_name, +const char *value) +{ + struct device_node *np __free(device_node) = of_find_node_by_path(node_path); + +return of_property_match_string (np, prop_name, value); +} + +static bool of_is_fwnode_add_links_supported (void ) +{ +static int is_supported =-1 ; + +if (is_supported !=-1 ) +return !!is_supported; + +if (match_property_by_path ("/soc" ,"compatible" ,"intel,ce4100-cp" ) >=0 ) + goto not_supported; + +if (match_property_by_path ("/" ,"architecture" ,"OLPC" ) >=0 ) + goto not_supported; + + is_supported =1 ; +return !!is_supported; + +not_supported: + is_supported =0 ; +return !!is_supported; +} +static int of_fwnode_add_links (struct fwnode_handle *fwnode) {const struct property *p;struct device_node *con_np =to_of_node (fwnode); -if (IS_ENABLED (CONFIG_X86 )) +if (IS_ENABLED (CONFIG_X86 ) && !of_is_fwnode_add_links_supported ())return 0 ;if (!con_np)
Signature · 1 line
2.51.0
Rob Herring
maintainerRe: [PATCH v4 19/29] of: property: Allow fw_devlink device-tree on x86
Quoted 54 lines · Herve Codina
PCI drivers can use a device-tree overlay to describe the hardware available on the PCI board. This is the case, for instance, of the LAN966x PCI device driver.
Adding some more nodes in the device-tree overlay adds some more consumer/supplier relationship between devices instantiated from this overlay.
Those
fw_nodeconsumer/supplier relationships are handled byfw_devlinkand are created based on the device-tree parsing done by theof_fwnode_add_links()function.Those consumer/supplier links are needed in order to ensure a correct PM runtime management and a correct removal order between devices.
For instance, without those links a supplier can be removed before its consumers is removed leading to all kind of issue if this consumer still want the use the already removed supplier.
The support for the usage of an overlay from a PCI driver has been added on x86 systems in commit
1f340724419ed("PCI: of: Create device tree PCI host bridge node").In the past, support for
fw_devlinkon x86 had been tried but this support has been removed in commit4a48b66b3f52("of: property: Disablefw_devlinkDT support for X86"). Indeed, this support was breaking some x86 systems such as OLPC system and the regression was reported in [0].Instead of disabling this support for all x86 system, use a finer grain and disable this support only for the possible problematic subset of x86 systems (at least OLPC and CE4100).
Those systems use a device-tree to describe their hardware. Identify those systems using key properties in the device-tree.
Signed-off-by Herve Codina <[email protected]>--- drivers/of/property.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-)drivers/of/property.c +5
-0@@ -1600,12 +1600,41 @@ static int of_fwnode_irq_get(const struct fwnode_handle *fwnode,return of_irq_get (to_of_node (fwnode), index); } +static int match_property_by_path (const char *node_path,const char *prop_name, +const char *value) +{ + struct device_node *np __free(device_node) = of_find_node_by_path(node_path); +
drivers/of/property.c static int of_fwnode_irq_get(const struct fwnode_handle *fwnode, · line 1617
Quoted 10 lines
drivers/of/property.c +10
-0+return of_property_match_string (np, prop_name, value); +} + +static bool of_is_fwnode_add_links_supported (void ) +{ +static int is_supported =-1 ; + +if (is_supported !=-1 ) +return !!is_supported; +
All of this:
drivers/of/property.c static int of_fwnode_irq_get(const struct fwnode_handle *fwnode, · line 1628
Quoted 11 lines
drivers/of/property.c +11
-0+if (match_property_by_path ("/soc" ,"compatible" ,"intel,ce4100-cp" ) >=0 ) + goto not_supported; + +if (match_property_by_path ("/" ,"architecture" ,"OLPC" ) >=0 ) + goto not_supported; + + is_supported =1 ; +return !!is_supported; + +not_supported: + is_supported =0 ;
can be simplified to:
is_supported = !((match_property_by_path("/soc", "compatible", "intel,ce4100-cp") >= 0) ||
(match_property_by_path("/", "architecture", "OLPC") >= 0));drivers/of/property.c static int of_fwnode_irq_get(const struct fwnode_handle *fwnode, · line 1637
Quoted 10 lines
drivers/of/property.c +4
-1+return !!is_supported; +} +static int of_fwnode_add_links (struct fwnode_handle *fwnode) {const struct property *p;struct device_node *con_np =to_of_node (fwnode); -if (IS_ENABLED (CONFIG_X86 )) +if (IS_ENABLED (CONFIG_X86 ) && !of_is_fwnode_add_links_supported ())
I would move the IS_ENABLED() check toof_is_fwnode_add_links_supported().
Rob
Herve Codina
maintainerPATCH v4 20/29 clk: lan966x: Add MCHP_LAN966X_PCI dependency
In reply to Herve CodinaThe lan966x clock controller depends on the LAN969x architecture or the LAN966x SoC.
This clock controller can be used by the LAN966x PCI device and so it needs to be available when the LAN966x PCI device is enabled.
--- drivers/clk/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/Kconfig +1 -1
@@ -278,7 +278,7 @@ config COMMON_CLK_LAN966X tristate "Generic Clock Controller driver for LAN966X SoC" depends on HAS_IOMEM depends on OF - depends on SOC_LAN966 || ARCH_LAN969X || COMPILE_TEST + depends on SOC_LAN966 || ARCH_LAN969X || MCHP_LAN966X_PCI || COMPILE_TEST help This driver provides support for Generic Clock Controller(GCK) on LAN966X SoC. GCK generates and supplies clock to various peripherals
Signature · 1 line
2.51.0
Herve Codina
maintainerPATCH v4 21/29 i2c: busses: at91: Add MCHP_LAN966X_PCI dependency
In reply to Herve CodinaThe AT91 I2C driver depends on ARCH_MICROCHIP.
This I2C controller can be used by the LAN966x PCI device and so it needs to be available when the LAN966x PCI device is enabled.
--- drivers/i2c/busses/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/Kconfig +1 -1
@@ -415,7 +415,7 @@ config I2C_ASPEED config I2C_AT91 tristate "Atmel AT91 I2C Two-Wire interface (TWI)" - depends on ARCH_MICROCHIP || COMPILE_TEST + depends on ARCH_MICROCHIP || MCHP_LAN966X_PCI || COMPILE_TEST help This supports the use of the I2C interface on Atmel AT91 processors.
Signature · 1 line
2.51.0
Herve Codina
maintainerPATCH v4 22/29 misc: lan966x_pci: Fix dtso nodes ordering
In reply to Herve CodinaNodes available in the dtso are not ordered by their unit address.
Fix that re-ordering them according to their unit address.
--- drivers/misc/lan966x_pci.dtso | 99 +++++++++++++++++------------------ 1 file changed, 49 insertions(+), 50 deletions(-)
drivers/misc/lan966x_pci.dtso +49 -50
@@ -59,6 +59,50 @@ pci-ep-bus@0 { ranges = <0xe2000000 0x00 0x00 0x00 0x2000000 0xe0000000 0x01 0x00 0x00 0x1000000>; + switch: switch@e0000000 { + compatible = "microchip,lan966x-switch"; + reg = <0xe0000000 0x0100000>, + <0xe2000000 0x0800000>; + reg-names = "cpu", "gcb"; + + interrupt-parent = <&oic>; + interrupts = <12 IRQ_TYPE_LEVEL_HIGH>, + <9 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "xtr", "ana"; + + resets = <&reset 0>; + reset-names = "switch"; + + pinctrl-names = "default"; + pinctrl-0 = <&tod_pins>; + + ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + + port0: port@0 { + phy-handle = <&lan966x_phy0>; + + reg = <0>; + phy-mode = "gmii"; + phys = <&serdes 0 CU(0)>; + }; + + port1: port@1 { + phy-handle = <&lan966x_phy1>; + + reg = <1>; + phy-mode = "gmii"; + phys = <&serdes 1 CU(1)>; + }; + }; + }; + + cpu_ctrl: syscon@e00c0000 { + compatible = "microchip,lan966x-cpu-syscon", "syscon"; + reg = <0xe00c0000 0xa8>; + }; + oic: oic@e00c0120 { compatible = "microchip,lan966x-oic"; #interrupt-cells = <2>;
@@ -67,11 +111,6 @@ oic: oic@e00c0120 { reg = <0xe00c0120 0x190>; }; - cpu_ctrl: syscon@e00c0000 { - compatible = "microchip,lan966x-cpu-syscon", "syscon"; - reg = <0xe00c0000 0xa8>; - }; - reset: reset@e200400c { compatible = "microchip,lan966x-switch-reset"; reg = <0xe200400c 0x4>, <0xe00c0000 0xa8>;
@@ -104,14 +143,6 @@ fc0_a_pins: fcb4-i2c-pins { pins = "GPIO_9", "GPIO_10"; function = "fc0_a"; }; - - }; - - serdes: serdes@e202c000 { - compatible = "microchip,lan966x-serdes"; - reg = <0xe202c000 0x9c>, - <0xe2004010 0x4>; - #phy-cells = <2>; }; mdio1: mdio@e200413c {
@@ -133,43 +164,11 @@ lan966x_phy1: ethernet-lan966x_phy@2 { }; }; - switch: switch@e0000000 { - compatible = "microchip,lan966x-switch"; - reg = <0xe0000000 0x0100000>, - <0xe2000000 0x0800000>; - reg-names = "cpu", "gcb"; - - interrupt-parent = <&oic>; - interrupts = <12 IRQ_TYPE_LEVEL_HIGH>, - <9 IRQ_TYPE_LEVEL_HIGH>; - interrupt-names = "xtr", "ana"; - - resets = <&reset 0>; - reset-names = "switch"; - - pinctrl-names = "default"; - pinctrl-0 = <&tod_pins>; - - ethernet-ports { - #address-cells = <1>; - #size-cells = <0>; - - port0: port@0 { - phy-handle = <&lan966x_phy0>; - - reg = <0>; - phy-mode = "gmii"; - phys = <&serdes 0 CU(0)>; - }; - - port1: port@1 { - phy-handle = <&lan966x_phy1>; - - reg = <1>; - phy-mode = "gmii"; - phys = <&serdes 1 CU(1)>; - }; - }; + serdes: serdes@e202c000 { + compatible = "microchip,lan966x-serdes"; + reg = <0xe202c000 0x9c>, + <0xe2004010 0x4>; + #phy-cells = <2>; }; }; };
Signature · 1 line
2.51.0
Herve Codina
maintainerPATCH v4 23/29 misc: lan966x_pci: Split dtso in dtsi/dtso
In reply to Herve CodinaThe lan966x_pci.dtso file contains descriptions related to both the LAN966x PCI device chip and the LAN966x PCI device board where the chip is soldered.
Split the file in order to have:
- lan966x_pci.dtsi
The description related to the PCI chip.
- lan966x_pci.dtso
The description of the PCI board.
--- MAINTAINERS | 1 + drivers/misc/lan966x_pci.dtsi | 130 +++++++++++++++++++++++++ drivers/misc/lan966x_pci.dtso | 175 +++++++--------------------------- 3 files changed, 166 insertions(+), 140 deletions(-) create mode 100644 drivers/misc/lan966x_pci.dtsi
MAINTAINERS +1 -0
@@ -16877,6 +16877,7 @@ MICROCHIP LAN966X PCI DRIVER M: Herve Codina <[email protected]> S: Maintained F: drivers/misc/lan966x_pci.c +F: drivers/misc/lan966x_pci.dtsi F: drivers/misc/lan966x_pci.dtso MICROCHIP LAN969X ETHERNET DRIVER
drivers/misc/lan966x_pci.dtsi new file +130 -0
130 lines not on this page · raw message
drivers/misc/lan966x_pci.dtso +35 -140
193 lines not on this page · raw message
Signature · 1 line
2.51.0
Herve Codina
maintainerPATCH v4 24/29 misc: lan966x_pci: Rename lan966x_pci.dtso to lan966x_evb_lan9662_nic.dtso
In reply to Herve CodinaThe lan966x_pci.dtso describes the Microchip EVB-LAN9662-NIC board [0]
This PCI board embeds a LAN9962 PCI device chip, part of the LAN966x family.
Rename the lan966x_pci.dtso accordingly.
---
MAINTAINERS | 2 +-
drivers/misc/Makefile | 2 +-
.../{lan966x_pci.dtso => lan966x_evb_lan9662_nic.dtso} | 0
drivers/misc/lan966x_pci.c | 8 ++++----
4 files changed, 6 insertions(+), 6 deletions(-)
rename drivers/misc/{lan966x_pci.dtso => lan966x_evb_lan9662_nic.dtso} (100%)MAINTAINERS +1 -1
@@ -16876,9 +16876,9 @@ F: drivers/irqchip/irq-lan966x-oic.c MICROCHIP LAN966X PCI DRIVER M: Herve Codina <[email protected]> S: Maintained +F: drivers/misc/lan966x_evb_lan9662_nic.dtso F: drivers/misc/lan966x_pci.c F: drivers/misc/lan966x_pci.dtsi -F: drivers/misc/lan966x_pci.dtso MICROCHIP LAN969X ETHERNET DRIVER M: Daniel Machon <[email protected]>
drivers/misc/Makefile +1 -1
@@ -70,7 +70,7 @@ obj-$(CONFIG_TPS6594_PFSM) += tps6594-pfsm.o obj-$(CONFIG_NSM) += nsm.o obj-$(CONFIG_MARVELL_CN10K_DPI) += mrvl_cn10k_dpi.o lan966x-pci-objs := lan966x_pci.o -lan966x-pci-objs += lan966x_pci.dtbo.o +lan966x-pci-objs += lan966x_evb_lan9662_nic.dtbo.o obj-$(CONFIG_MCHP_LAN966X_PCI) += lan966x-pci.o obj-y += keba/ obj-y += amd-sbi/
drivers/misc/lan966x_evb_lan9662_nic.dtso renamed from drivers/misc/lan966x_pci.dtso +0 -0
drivers/misc/lan966x_pci.c +4 -4
@@ -19,8 +19,8 @@#include <linux/slab.h> /* Embedded dtbo symbols created by cmd_wrap_S_dtb in scripts/Makefile.lib */ -extern char __dtbo_lan966x_pci_begin[]; -extern char __dtbo_lan966x_pci_end[]; +extern char __dtbo_lan966x_evb_lan9662_nic_begin[]; +extern char __dtbo_lan966x_evb_lan9662_nic_end[];struct pci_dev_intr_ctrl {struct pci_dev *pci_dev;
@@ -125,8 +125,8 @@ struct lan966x_pci {static int lan966x_pci_load_overlay (struct lan966x_pci *data) { -u32 dtbo_size = __dtbo_lan966x_pci_end - __dtbo_lan966x_pci_begin; -void *dtbo_start = __dtbo_lan966x_pci_begin; +u32 dtbo_size = __dtbo_lan966x_evb_lan9662_nic_end - __dtbo_lan966x_evb_lan9662_nic_begin; +void *dtbo_start = __dtbo_lan966x_evb_lan9662_nic_begin;return of_overlay_fdt_apply (dtbo_start, dtbo_size, &data->ovcs_id,dev_of_node (data->dev)); }
Signature · 1 line
2.51.0
Herve Codina
maintainerPATCH v4 25/29 PCI: Add Microchip LAN9662 PCI Device ID
In reply to Herve CodinaExisting code uses the 0x9660 value (LAN9662 PCI Device ID) in several places.
Avoid this direct use of the 0x9660 value replacing it by defined PCI Device ID.
--- drivers/misc/lan966x_pci.c | 2 +- drivers/pci/quirks.c | 2 +- include/linux/pci_ids.h | 1 + 3 files changed, 3 insertions(+), 2 deletions(-)
drivers/misc/lan966x_pci.c +1 -1
@@ -197,7 +197,7 @@ static void lan966x_pci_remove(struct pci_dev *pdev) }static struct pci_device_id lan966x_pci_ids[] = { - {PCI_DEVICE (PCI_VENDOR_ID_EFAR ,0x9660 ) }, + {PCI_DEVICE (PCI_VENDOR_ID_EFAR ,PCI_DEVICE_ID_EFAR_LAN9662 ) }, { } };MODULE_DEVICE_TABLE (pci, lan966x_pci_ids);
drivers/pci/quirks.c +1 -1
@@ -6316,7 +6316,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0xa76e, dpc_log_size);DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_XILINX ,0x5020 , of_pci_make_dev_node);DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_XILINX ,0x5021 , of_pci_make_dev_node);DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_REDHAT ,0x0005 , of_pci_make_dev_node); -DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_EFAR ,0x9660 , of_pci_make_dev_node); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_EFAR ,PCI_DEVICE_ID_EFAR_LAN9662 , of_pci_make_dev_node);DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_RPI ,PCI_DEVICE_ID_RPI_RP1_C0 , of_pci_make_dev_node);/*
include/linux/pci_ids.h +1 -0
@@ -934,6 +934,7 @@#define PCI_VENDOR_ID_EFAR 0x1055#define PCI_DEVICE_ID_EFAR_SLC90E66_1 0x9130#define PCI_DEVICE_ID_EFAR_SLC90E66_3 0x9463 +#define PCI_DEVICE_ID_EFAR_LAN9662 0x9660#define PCI_VENDOR_ID_MOTOROLA 0x1057#define PCI_DEVICE_ID_MOTOROLA_MPC105 0x0001
Signature · 1 line
2.51.0
Herve Codina
maintainerPATCH v4 26/29 misc: lan966x_pci: Introduce board specific data
In reply to Herve CodinaOnly one device-tree overlay (lan966x_evb_lan9662_nic.dtbo) is handled and this overlay is directly referenced in lan966x_pci_load_overlay().
This avoid to use the code for an other board.
In order to be more generic and to allow support for other boards (PCI Vendor/Device IDs), introduce the lan966x_pci_info structure and attach it to PCI Vendor/Device IDs handled by the driver.
This structure contains information related to the PCI board such as information related to the dtbo describing the board we have to load.
--- drivers/misc/lan966x_pci.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-)
drivers/misc/lan966x_pci.c +22 -8
@@ -18,10 +18,6 @@#include <linux/pci_ids.h> #include <linux/slab.h> -/* Embedded dtbo symbols created by cmd_wrap_S_dtb in scripts/Makefile.lib */ -extern char __dtbo_lan966x_evb_lan9662_nic_begin[]; -extern char __dtbo_lan966x_evb_lan9662_nic_end[]; -struct pci_dev_intr_ctrl {struct pci_dev *pci_dev;struct irq_domain *irq_domain;
@@ -118,17 +114,23 @@ static int devm_pci_dev_create_intr_ctrl(struct pci_dev *pdev)return devm_add_action_or_reset (&pdev->dev, devm_pci_dev_remove_intr_ctrl, intr_ctrl); } +struct lan966x_pci_info { +void *dtbo_begin; +void *dtbo_end; +}; +struct lan966x_pci {struct device *dev;int ovcs_id; +const struct lan966x_pci_info *info; };static int lan966x_pci_load_overlay (struct lan966x_pci *data) { -u32 dtbo_size = __dtbo_lan966x_evb_lan9662_nic_end - __dtbo_lan966x_evb_lan9662_nic_begin; -void *dtbo_start = __dtbo_lan966x_evb_lan9662_nic_begin; +const struct lan966x_pci_info *info = data->info; -return of_overlay_fdt_apply (dtbo_start, dtbo_size, &data->ovcs_id,dev_of_node (data->dev)); +return of_overlay_fdt_apply (info->dtbo_begin, info->dtbo_end - info->dtbo_begin, + &data->ovcs_id,dev_of_node (data->dev)); }static void lan966x_pci_unload_overlay (struct lan966x_pci *data)
@@ -169,6 +171,9 @@ static int lan966x_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ipci_set_drvdata (pdev, data); data->dev = dev; + data->info = (const struct lan966x_pci_info *)id->driver_data; +if (!data->info) +return -EINVAL ; ret =lan966x_pci_load_overlay (data);if (ret)
@@ -196,8 +201,17 @@ static void lan966x_pci_remove(struct pci_dev *pdev)lan966x_pci_unload_overlay (data); } +/* Embedded dtbo symbols created by cmd_wrap_S_dtb in scripts/Makefile.lib */ +extern char __dtbo_lan966x_evb_lan9662_nic_begin[]; +extern char __dtbo_lan966x_evb_lan9662_nic_end[]; + +static struct lan966x_pci_info evb_lan9662_nic_info = { + .dtbo_begin = __dtbo_lan966x_evb_lan9662_nic_begin, + .dtbo_end = __dtbo_lan966x_evb_lan9662_nic_end, +}; +static struct pci_device_id lan966x_pci_ids[] = { - {PCI_DEVICE (PCI_VENDOR_ID_EFAR ,PCI_DEVICE_ID_EFAR_LAN9662 ) }, + {PCI_DEVICE_DATA (EFAR ,LAN9662 , &evb_lan9662_nic_info) }, { } };MODULE_DEVICE_TABLE (pci, lan966x_pci_ids);
Signature · 1 line
2.51.0
Herve Codina
maintainerPATCH v4 27/29 misc: lan966x_pci: Add dtsi/dtso nodes in order to support SFPs
In reply to Herve CodinaAdd device-tree nodes needed to support SFPs. Those nodes are:
- the clock controller
- the i2c controller
- the i2c mux
- the SFPs themselves and their related ports in the switch
--- drivers/misc/lan966x_evb_lan9662_nic.dtso | 96 +++++++++++++++++++++++ drivers/misc/lan966x_pci.dtsi | 42 ++++++++++ 2 files changed, 138 insertions(+)
drivers/misc/lan966x_evb_lan9662_nic.dtso +96 -0
@@ -4,6 +4,7 @@ */ #include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/mfd/atmel-flexcom.h> #include <dt-bindings/phy/phy-lan966x-serdes.h> /dts-v1/;
@@ -27,15 +28,94 @@ __overlay__ { #size-cells = <2>; #include "lan966x_pci.dtsi" + + i2c0_emux: i2c0-emux { + compatible = "i2c-mux-pinctrl"; + #address-cells = <1>; + #size-cells = <0>; + i2c-parent = <&i2c0>; + pinctrl-names = "i2c102", "i2c103", "idle"; + pinctrl-0 = <&i2cmux_0>; + pinctrl-1 = <&i2cmux_1>; + pinctrl-2 = <&i2cmux_pins>; + + i2c102: i2c@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + }; + + i2c103: i2c@1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + }; + }; + + sfp2: sfp2 { + compatible = "sff,sfp"; + i2c-bus = <&i2c102>; + tx-disable-gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; + los-gpios = <&gpio 25 GPIO_ACTIVE_HIGH>; + mod-def0-gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + tx-fault-gpios = <&gpio 2 GPIO_ACTIVE_HIGH>; + }; + + sfp3: sfp3 { + compatible = "sff,sfp"; + i2c-bus = <&i2c103>; + tx-disable-gpios = <&gpio 1 GPIO_ACTIVE_HIGH>; + los-gpios = <&gpio 26 GPIO_ACTIVE_HIGH>; + mod-def0-gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + tx-fault-gpios = <&gpio 3 GPIO_ACTIVE_HIGH>; + }; }; }; }; +&flx0 { + atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_TWI>; + status = "okay"; +}; + +&i2c0 { + pinctrl-0 = <&fc0_a_pins>; + pinctrl-names = "default"; + i2c-analog-filter; + i2c-digital-filter; + i2c-digital-filter-width-ns = <35>; + status = "okay"; +}; + &gpio { tod_pins: tod_pins { pins = "GPIO_36"; function = "ptpsync_1"; }; + + fc0_a_pins: fcb4-i2c-pins { + /* RXD, TXD */ + pins = "GPIO_9", "GPIO_10"; + function = "fc0_a"; + }; + + i2cmux_pins: i2cmux-pins { + pins = "GPIO_76", "GPIO_77"; + function = "twi_slc_gate"; + output-low; + }; + + i2cmux_0: i2cmux-0 { + pins = "GPIO_76"; + function = "twi_slc_gate"; + output-high; + }; + + i2cmux_1: i2cmux-1 { + pins = "GPIO_77"; + function = "twi_slc_gate"; + output-high; + }; }; &lan966x_phy0 {
@@ -64,6 +144,22 @@ &port1 { status = "okay"; }; +&port2 { + phy-mode = "sgmii"; + phys = <&serdes 2 SERDES6G(0)>; + sfp = <&sfp2>; + managed = "in-band-status"; + status = "okay"; +}; + +&port3 { + phy-mode = "sgmii"; + phys = <&serdes 3 SERDES6G(1)>; + sfp = <&sfp3>; + managed = "in-band-status"; + status = "okay"; +}; + &switch { pinctrl-names = "default"; pinctrl-0 = <&tod_pins>;
drivers/misc/lan966x_pci.dtsi +42 -0
60 lines not on this page · raw message
Signature · 1 line
2.51.0
Herve Codina
maintainerPATCH v4 28/29 misc: lan966x_pci: Sort the drivers list in Kconfig help
In reply to Herve CodinaThe LAN966X Kconfig help section mentions drivers related to devices.
Sort this list alphabetically.
--- drivers/misc/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/misc/Kconfig +3 -3
@@ -636,13 +636,13 @@ config MCHP_LAN966X_PCI Even if this driver does not depend on those other drivers, in order to have a fully functional board, the following drivers are needed: - fixed-clock (COMMON_CLK) - - lan966x-oic (LAN966X_OIC) - lan966x-cpu-syscon (MFD_SYSCON) - - lan966x-switch-reset (RESET_MCHP_SPARX5) + - lan966x-miim (MDIO_MSCC_MIIM) + - lan966x-oic (LAN966X_OIC) - lan966x-pinctrl (PINCTRL_OCELOT) - lan966x-serdes (PHY_LAN966X_SERDES) - - lan966x-miim (MDIO_MSCC_MIIM) - lan966x-switch (LAN966X_SWITCH) + - lan966x-switch-reset (RESET_MCHP_SPARX5) source "drivers/misc/c2port/Kconfig" source "drivers/misc/eeprom/Kconfig"
Signature · 1 line
2.51.0
Herve Codina
maintainerPATCH v4 29/29 misc: lan966x_pci: Add drivers needed to support SFPs in Kconfig help
In reply to Herve CodinaRecently, new device-tree nodes were added in the overlay to add support for SFPs on LAN966x PCI device.
The LAN966X Kconfig help section mentions drivers related to devices added based on the overlay description.
Add drivers related to devices described by those new nodes in the already existing driver list.
--- drivers/misc/Kconfig | 5 +++++ 1 file changed, 5 insertions(+)
drivers/misc/Kconfig +5 -0
@@ -636,13 +636,18 @@ config MCHP_LAN966X_PCI Even if this driver does not depend on those other drivers, in order to have a fully functional board, the following drivers are needed: - fixed-clock (COMMON_CLK) + - i2c-mux-pinctrl (I2C_MUX_PINCTRL) - lan966x-cpu-syscon (MFD_SYSCON) + - lan966x-gck (COMMON_CLK_LAN966X) - lan966x-miim (MDIO_MSCC_MIIM) - lan966x-oic (LAN966X_OIC) - lan966x-pinctrl (PINCTRL_OCELOT) - lan966x-serdes (PHY_LAN966X_SERDES) - lan966x-switch (LAN966X_SWITCH) - lan966x-switch-reset (RESET_MCHP_SPARX5) + - sam9x60-i2c (I2C_AT91) + - sama5d2-flexcom (MFD_ATMEL_FLEXCOM) + - sfp (SFP) source "drivers/misc/c2port/Kconfig" source "drivers/misc/eeprom/Kconfig"
Signature · 1 line
2.51.0
Rob Herring
maintainerQuoted 77 lines · Herve Codina
Hi,
This series add support for SFPs ports available on the LAN966x PCI device. In order to have the SFPs supported, additional devices are needed such as clock controller and I2C.
As a reminder, the LAN966x PCI device driver use a device-tree overlay to describe devices available on the PCI board. Adding support for SFPs ports consists in adding more devices in the already existing device-tree overlay.
With those devices added, the device-tree overlay is more complex and some consumer/supplier relationship are needed in order to remove devices in correct order when the LAN966x PCI driver is removed.
Those links are typically provided by
fw_devlinkand we faced some issues withfw_devlinkand overlays.This series gives the big picture related to the SFPs support from fixing issues to adding new devices. Of course, it can be split if needed.
The first part of the series (patch 1, 2 and 3) fixes
fw_devlinkwhen it is used with overlay. Patches 1 and 3 were previously sent by Saravana [0]. I just rebased them on top of v6.18-rc1 and added patch 2 in order to take into account feedback received on the series sent by Saravana.Those modification were not sufficient in our case and so, on top of that, patches 4 to 7 fix some more issues related to
fw_devlink.Patches 8 to 13 introduce and use
fw_devlink_set_device()in already existing code.Patches 14 and 15 are related also to
fw_devlinkbut specific to PCI and the device-tree nodes created during enumeration.Patches 16, 17 and 18 are related
fw_devlinktoo but specific to I2C muxes. Patches purpose is to correctly set a link between an adapter supplier and its consumer. Indeed, an i2c mux adapter's parent is not the i2c mux supplier but the adapter the i2c mux is connected to. Adding a new link between the adapter supplier involved when i2c muxes are used avoid a freeze observed during device removal.Patch 19 adds support for
fw_delinkon x86.fw_devlinkis needed to have the consumer/supplier relationship between devices in order to ensure a correct device removal order. Addingfw_devlinksupport for x86 has been tried in the past but was reverted [1] because it broke some systems. Instead of enablingfw_devlinkon *all* x86 system, enable it on *all* x86 except on those where it leads to issue.Patches 20 and 21 allow to build clock and i2c controller used by the LAN966x PCI device when the LAN966x PCI device is enabled.
Patches 22 to 26 are specific to the LAN966x. They touch the current dtso, split it in dtsi/dtso files, rename the dtso and improve the driver to allow easier support for other boards.
The next patch (patch 27) update the LAN966x device-tree overlay itself to have the SPF ports and devices they depends on described.
The last two patches (patches 28 and 29) sort the existing drivers in the needed driver list available in the
Kconfighelp and add new drivers in this list keep the list up to date with the devices described in the device-tree overlay.We believe some items from the above list can be merged separately, with no build dependencies. We expect:
- Patches 1 to 7 to be taken by driver core maintainers
- Patches 8 to 13 to be taken by driver core maintainers
- Patches 14 and 15 to be taken by driver core or PCI maintainers (depend on patch 8)
- Patches 16 to 18 to be taken by I2C maintainers
Quoted 7 lines
- Patch 19 to be taken by driver core or OF maintainers
- Patch 20 to be taken by clock maintainers
- Patch 21 to be taken by I2C maintainers
- Patches 22 to 29 to be taken by misc maintainers
I don't think this is going to land in 6.19, so I've applied patches 1 and 3.
Rob