Fix Arm Ltd board node name collisions
Rob Herring
maintainercover Fix Arm Ltd board node name collisions
The node name changes in commits 25b892b583cc ("ARM: dts: arm: Update register-bit-led nodes 'reg' and node names") and 2d3de197a818 ("ARM:
dts: arm: Update ICST clock nodes 'reg' and node names") caused name collisions with the kernel's handling of ICST clock names and platform device names. This series fixes the kernel side to handle the DT changes.
This does break DT ABI compatibility which is partially mitigated if these changes are backported to stable. The alternative is reverting the referenced DT changes and coming up with different node names without unit-addresses. Ultimately, ABI issues are platform maintainers' decision, not mine.
Rob
Rob Herring (2):
of: Support using 'mask' in making device bus id
clk: versatile: clk-icst: Ensure clock names are unique
drivers/clk/versatile/clk-icst.c | 6 ++++-- drivers/of/platform.c | 10 ++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-)
Signature · 1 line
2.32.0
Rob Herring
maintainerPATCH 1/2 of: Support using 'mask' in making device bus id
Commit 25b892b583cc ("ARM: dts: arm: Update register-bit-led nodes 'reg' and node names") added a 'reg' property to nodes. This change has the side effect of changing how the kernel generates the device name. The assumption was a translatable 'reg' address is unique. However, in the case of the register-bit-led binding (and a few others) that is not the case. The 'mask' property must also be used in this case to make a unique device name.
---
This should be applied to stable to minimize DT ABI breakage.
--- drivers/of/platform.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/of/platform.c +8 -2
@@ -76,6 +76,7 @@ static void of_device_make_bus_id(struct device *dev)struct device_node *node = dev->of_node;const __be32 *reg;u64 addr; +u32 mask;/* Construct the name, using parent nodes if necessary to ensure uniqueness */ while (node->parent) {
@@ -85,8 +86,13 @@ static void of_device_make_bus_id(struct device *dev)*/ reg =of_get_property (node,"reg" ,NULL );if (reg && (addr =of_translate_address (node, reg)) !=OF_BAD_ADDR ) { -dev_set_name (dev,dev_name (dev) ?"%llx.%pOFn:%s" :"%llx.%pOFn" , - addr, node,dev_name (dev)); +if (!of_property_read_u32 (node,"mask" , &mask)) +dev_set_name (dev,dev_name (dev) ?"%llx.%x.%pOFn:%s" :"%llx.%x.%pOFn" , + addr,ffs (mask) -1 , node,dev_name (dev)); + +else +dev_set_name (dev,dev_name (dev) ?"%llx.%pOFn:%s" :"%llx.%pOFn" , + addr, node,dev_name (dev));return ; }
Signature · 1 line
2.32.0
Re: [PATCH 1/2] of: Support using 'mask' in making device bus id
Quoted 8 lines · Rob Herring
Commit
25b892b583cc("ARM: dts: arm: Update register-bit-led nodes 'reg' and node names") added a 'reg' property to nodes. This change has the side effect of changing how the kernel generates the device name. The assumption was a translatable 'reg' address is unique. However, in the case of the register-bit-led binding (and a few others) that is not the case. The 'mask' property must also be used in this case to make a unique device name.
Quoted 6 lines
Fixes 25b892b583cc ("ARM: dts: arm: Update register-bit-led nodes 'reg' and node names")Reported-by Guenter Roeck <[email protected]>Cc Frank Rowand <[email protected]>Cc Linus Walleij <[email protected]>Signed-off-by Rob Herring <[email protected]>
Yours,
Linus Walleij
Rob Herring
maintainerPATCH 2/2 clk: versatile: clk-icst: Ensure clock names are unique
In reply to Rob HerringCommit 2d3de197a818 ("ARM: dts: arm: Update ICST clock nodes 'reg' and node names") moved to using generic node names. That results in trying to register multiple clocks with the same name. Fix this by including the unit-address in the clock name.
---
This should be applied to stable to minimize DT ABI breakage.
--- drivers/clk/versatile/clk-icst.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/clk/versatile/clk-icst.c +4 -2
@@ -484,7 +484,7 @@ static void __init of_syscon_icst_setup(struct device_node *np)struct device_node *parent;struct regmap *map;struct clk_icst_desc icst_desc; -const char *name = np->name; +const char *name;const char *parent_name;struct clk *regclk;enum icst_control_type ctype;
@@ -533,15 +533,17 @@ static void __init of_syscon_icst_setup(struct device_node *np) icst_desc.params = &icst525_apcp_cm_params; ctype =ICST_INTEGRATOR_CP_CM_MEM ; }else { -pr_err ("unknown ICST clock %s\n" , name); +pr_err ("unknown ICST clock %pOF\n" , np);return ; }/* Parent clock name is not the same as node parent */ parent_name =of_clk_get_parent_name (np,0 ); + name =kasprintf (GFP_KERNEL ,"%pOFP" , np); regclk =icst_clk_setup (NULL , &icst_desc, name, parent_name, map, ctype);if (IS_ERR (regclk)) { +kfree (name);pr_err ("error setting up syscon ICST clock %s\n" , name);return ; }
Signature · 1 line
2.32.0
Re: [PATCH 2/2] clk: versatile: clk-icst: Ensure clock names are unique
Quoted 5 lines · Rob Herring
Commit
2d3de197a818("ARM: dts: arm: Update ICST clock nodes 'reg' and node names") moved to using generic node names. That results in trying to register multiple clocks with the same name. Fix this by including the unit-address in the clock name.
Quoted 7 lines
Fixes 2d3de197a818 ("ARM: dts: arm: Update ICST clock nodes 'reg' and node names")Cc Linus Walleij <[email protected]>Cc Stephen Boyd <[email protected]>Signed-off-by Rob Herring <[email protected]>
Yours,
Linus Walleij
Re: [PATCH 2/2] clk: versatile: clk-icst: Ensure clock names are unique
In reply to Rob HerringQuoting Rob Herring (2021-11-09 08:46:50)
Quoted 5 lines
Commit
2d3de197a818("ARM: dts: arm: Update ICST clock nodes 'reg' and node names") moved to using generic node names. That results in trying to register multiple clocks with the same name. Fix this by including the unit-address in the clock name.
Quoted 8 lines
Fixes 2d3de197a818 ("ARM: dts: arm: Update ICST clock nodes 'reg' and node names")Cc Linus Walleij <[email protected]>Cc Stephen Boyd <[email protected]>Signed-off-by Rob Herring <[email protected]>---
Quoted 5 lines · Rob Herring
This does break DT ABI compatibility which is partially mitigated if these changes are backported to stable. The alternative is reverting the referenced DT changes and coming up with different node names without unit-addresses. Ultimately, ABI issues are platform maintainers' decision, not mine.
I don't mind breaking the ABI for these boards since everyone I know rebuild the DT with the kernel and boot. I don't know if other users flash it though, so check what Sudeep says.
Yours,
Linus Walleij