pinctrl: imx-scmi: Introdue nxp,iomuxc-daisy-off
Subsystems (5)
cover pinctrl: imx-scmi: Introdue nxp,iomuxc-daisy-off
It might be a bit late, since it is 6.15-RC6 now. No rush, the target is 6.17.
i.MX9 SoC family IOMUXC features Daisy chain(multi pads driving same module input pin), each SoC has its own daisy register offset. When add a new SoC support, need to hardcode the register offset in pinctrl-imx-scmi.c just as "
if (of_machine_is_compatible("fsl,imx95"))
daisy_off = IMX95_DAISY_OFF;
else if
...
else
...
"
This is no good to long term maintainence.
With nxp,iomuxc-daisy-off introduced, things will be simplified to set daisy register offset:
"device_property_read_u32(dev, "nxp,iomuxc-daisy-off", &pmx->daisy_off);"
The new property is set as required, so there might be dtbs_check error without patch 3 applied. This is expected.
Patchset based on next-20250508
---
Peng Fan (3):
dt-bindings: firmware: nxp,imx95-scmi-pinctrl: Introduce nxp,iomuxc-daisy-off
pinctrl: imx-scmi: Get daisy register offset from DT
arm64: dts: imx95: Add property nxp,iomuxc-daisy-off
.../bindings/firmware/nxp,imx95-scmi-pinctrl.yaml | 8 +++++++ arch/arm64/boot/dts/freescale/imx95.dtsi | 1 + drivers/pinctrl/freescale/pinctrl-imx-scmi.c | 26 +++++++++++++--------- 3 files changed, 24 insertions(+), 11 deletions(-)
---
base-commit: f48887a98b78880b7711aca311fbbbcaad6c4e3b
change-id: 20250509-pin-e5b563bbd55d
Best regards,
Signature · 1 line
Peng Fan <[email protected]>
PATCH 1/3 dt-bindings: firmware: nxp,imx95-scmi-pinctrl: Introduce nxp,iomuxc-daisy-off
From: Peng Fan <[email protected]>
The IOMUX Controller in i.MX9 family has Daisy chain that multi pads drive same module input pin. Each SoC has its own register offset, so introduce "nxp,iomuxc-daisy-off" property to specify the daisy register offset. With this property being parsed by driver, there is no need to hardcode the offset in pinctrl driver for each new SoC.
--- .../devicetree/bindings/firmware/nxp,imx95-scmi-pinctrl.yaml | 8 ++++++++ 1 file changed, 8 insertions(+)
Documentation/devicetree/bindings/firmware/nxp,imx95-scmi-pinctrl.yaml +8 -0
@@ -13,6 +13,11 @@ maintainers: allOf: - $ref: /schemas/pinctrl/pinctrl.yaml +properties: + nxp,iomuxc-daisy-off: + $ref: /schemas/types.yaml#/definitions/uint32 + description: Specify the IOMUX Controller first Daisy register's offset + patternProperties: 'grp$': type: object
@@ -51,3 +56,6 @@ patternProperties: - fsl,pins additionalProperties: true + +required: + - nxp,iomuxc-daisy-off
Signature · 1 line
2.37.1
Re: [PATCH 1/3] dt-bindings: firmware: nxp,imx95-scmi-pinctrl: Introduce nxp,iomuxc-daisy-off
Quoted 18 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
The IOMUX Controller in i.MX9 family has Daisy chain that multi pads drive same module input pin. Each SoC has its own register offset, so introduce "nxp,iomuxc-daisy-off" property to specify the daisy register offset. With this property being parsed by driver, there is no need to hardcode the offset in pinctrl driver for each new SoC.
Signed-off-by Peng Fan <[email protected]>--- .../devicetree/bindings/firmware/nxp,imx95-scmi-pinctrl.yaml | 8 ++++++++ 1 file changed, 8 insertions(+)Documentation/devicetree/bindings/firmware/nxp,imx95-scmi-pinctrl.yaml +0
-0
Documentation/devicetree/bindings/firmware/nxp,imx95-scmi-pinctrl.yaml maintainers: · line 17
Quoted 5 lines
Documentation/devicetree/bindings/firmware/nxp,imx95-scmi-pinctrl.yaml +2
-0@@ -13,6 +13,11 @@ maintainers: allOf: - $ref: /schemas/pinctrl/pinctrl.yaml +properties: + nxp,iomuxc-daisy-off:
Same comment here as was left on the driver.
I also don't get why there's a property being introduced from something you can determine based on the soc.
Quoted 17 lines
Documentation/devicetree/bindings/firmware/nxp,imx95-scmi-pinctrl.yaml +6
-0+ $ref: /schemas/types.yaml#/definitions/uint32 + description: Specify the IOMUX Controller first Daisy register's offset + patternProperties: 'grp$': type: object@@ -51,3 +56,6 @@ patternProperties: - fsl,pins additionalProperties: true + +required: + - nxp,iomuxc-daisy-offSignature · 2 lines
-- 2.37.1
Re: [PATCH 1/3] dt-bindings: firmware: nxp,imx95-scmi-pinctrl: Introduce nxp,iomuxc-daisy-off
Hi Conor,
Quoted 22 lines · Conor Dooley
Quoted 21 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
The IOMUX Controller in i.MX9 family has Daisy chain that multi pads drive same module input pin. Each SoC has its own register offset, so introduce "nxp,iomuxc-daisy-off" property to specify the daisy register offset. With this property being parsed by driver, there is no need to hardcode the offset in pinctrl driver for each new SoC.
Signed-off-by Peng Fan <[email protected]>--- .../devicetree/bindings/firmware/nxp,imx95-scmi-pinctrl.yaml | 8 ++++++++ 1 file changed, 8 insertions(+)Documentation/devicetree/bindings/firmware/nxp,imx95-scmi-pinctrl.yaml +0
-0@@ -13,6 +13,11 @@ maintainers: allOf: - $ref: /schemas/pinctrl/pinctrl.yaml
Quoted 6 lines
Documentation/devicetree/bindings/firmware/nxp,imx95-scmi-pinctrl.yaml maintainers: · line 17
Quoted 2 lines
Documentation/devicetree/bindings/firmware/nxp,imx95-scmi-pinctrl.yaml +2
-0+properties: + nxp,iomuxc-daisy-off:Same comment here as was left on the driver.
I also don't get why there's a property being introduced from something you can determine based on the soc.
we are targeting a common pinctrl driver for i.MX SCMI based SoC. So that means pinctrl-imx-scmi.c needs support i.MX95, i.MX94 and i.MX9[X].
Each time we support a new SoC, we need to hardcode the register offset in the driver. But if using DT here, no need to update the pinctrl driver anymore when supporting a new i.MX SoC.
Thanks,
Peng
Quoted 18 lines
Quoted 18 lines
Documentation/devicetree/bindings/firmware/nxp,imx95-scmi-pinctrl.yaml +6
-0+ $ref: /schemas/types.yaml#/definitions/uint32 + description: Specify the IOMUX Controller first Daisy register's offset + patternProperties: 'grp$': type: object@@ -51,3 +56,6 @@ patternProperties: - fsl,pins additionalProperties: true + +required: + - nxp,iomuxc-daisy-offSignature · 2 lines
-- 2.37.1
Re: [PATCH 1/3] dt-bindings: firmware: nxp,imx95-scmi-pinctrl: Introduce nxp,iomuxc-daisy-off
Quoted 3 lines · Peng Fan
Quoted 3 lines
Same comment here as was left on the driver.
I also don't get why there's a property being introduced from something you can determine based on the soc.
I agree with Conor's observation.
Quoted 6 lines
we are targeting a common pinctrl driver for i.MX SCMI based SoC. So that means
pinctrl-imx-scmi.cneeds support i.MX95, i.MX94 and i.MX9[X].Each time we support a new SoC, we need to hardcode the register offset in the driver. But if using DT here, no need to update the pinctrl driver anymore when supporting a new i.MX SoC.
I understand that it is convenient, but that doesn't mean it is the right thing to do.
I would advice you to keep this in the driver and use the SoC compatible to determine the offset, just as is done today.
If information can be deduced from what is already present in the device tree it is redundant to add stuff like this, and it inevitably will create copy-paste errors where the wrong offset is used with the wrong SoC.
Yours,
Linus Walleij
Re: [PATCH 1/3] dt-bindings: firmware: nxp,imx95-scmi-pinctrl: Introduce nxp,iomuxc-daisy-off
Quoted 18 lines · Linus Walleij
Quoted 3 lines · Peng Fan
Quoted 3 lines
Same comment here as was left on the driver.
I also don't get why there's a property being introduced from something you can determine based on the soc.I agree with Conor's observation.
Quoted 6 lines
we are targeting a common pinctrl driver for i.MX SCMI based SoC. So that means
pinctrl-imx-scmi.cneeds support i.MX95, i.MX94 and i.MX9[X].Each time we support a new SoC, we need to hardcode the register offset in the driver. But if using DT here, no need to update the pinctrl driver anymore when supporting a new i.MX SoC.
I understand that it is convenient, but that doesn't mean it is the right thing to do.
Quoted 7 lines
I would advice you to keep this in the driver and use the SoC compatible to determine the offset, just as is done today.
If information can be deduced from what is already present in the device tree it is redundant to add stuff like this, and it inevitably will create copy-paste errors where the wrong offset is used with the wrong SoC.
Got it. Drop this patchset.
Thanks,
Peng
Quoted 3 lines
Yours,
Linus Walleij
PATCH 2/3 pinctrl: imx-scmi: Get daisy register offset from DT
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
Parsing the "nxp,iomuxc-daisy-off" to get the daisy register offset, then no need to hardcode the register offset in driver for new SoCs.
To keep backwards comatibility, still keep the register offset for i.MX95.
--- drivers/pinctrl/freescale/pinctrl-imx-scmi.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-)
drivers/pinctrl/freescale/pinctrl-imx-scmi.c +15 -11
@@ -35,6 +35,7 @@ struct scmi_pinctrl_imx {struct pinctrl_dev *pctldev;struct pinctrl_desc pctl_desc;const struct scmi_pinctrl_proto_ops *ops; +uint32_t daisy_off; };/* SCMI pin control types, aligned with SCMI firmware */
@@ -57,6 +58,7 @@ static int pinctrl_scmi_imx_dt_node_to_map(struct pinctrl_dev *pctldev,struct pinctrl_map **map, unsigned int *num_maps) { + struct scmi_pinctrl_imx *pmx = pinctrl_dev_get_drvdata(pctldev);struct pinctrl_map *new_map;const __be32 *list;unsigned long *configs =NULL ;
@@ -65,16 +67,6 @@ static int pinctrl_scmi_imx_dt_node_to_map(struct pinctrl_dev *pctldev,int mux_reg, conf_reg, input_reg, mux_val, conf_val, input_val;int i, j;uint32_t ncfg; -static uint32_t daisy_off; - -if (!daisy_off) { -if (of_machine_is_compatible ("fsl,imx95" )) { - daisy_off =IMX95_DAISY_OFF ; - }else { -dev_err (pctldev->dev,"platform not support scmi pinctrl\n" ); -return -EINVAL ; - } - } list =of_get_property (np,"fsl,pins" , &size);if (!list) {
@@ -126,7 +118,7 @@ static int pinctrl_scmi_imx_dt_node_to_map(struct pinctrl_dev *pctldev, ncfg -=2 ; }else { cfg[j++] =pinconf_to_config_packed (IMX_SCMI_PIN_DAISY_ID , - (input_reg - daisy_off) /4 ); + (input_reg - pmx->daisy_off) /4 ); cfg[j++] =pinconf_to_config_packed (IMX_SCMI_PIN_DAISY_CFG , input_val); }
@@ -315,6 +307,18 @@ static int scmi_pinctrl_imx_probe(struct scmi_device *sdev)if (!pmx)return -ENOMEM ; + ret =device_property_read_u32 (dev,"nxp,iomuxc-daisy-off" , &pmx->daisy_off); +if (ret) { +/* +* To keep backwards compatible, new chips should specify +* nxp,iomuxc-daisy_off +*/ +if (of_machine_is_compatible ("fsl,imx95" )) + pmx->daisy_off =IMX95_DAISY_OFF ; +else +return dev_err_probe (dev, ret,"Failed to get daisy off value\n" ); + } + pmx->ph = ph; pmx->ops = pinctrl_ops;
Signature · 1 line
2.37.1
Sascha Hauer
maintainerRe: [PATCH 2/3] pinctrl: imx-scmi: Get daisy register offset from DT
Quoted 13 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
Parsing the "nxp,iomuxc-daisy-off" to get the daisy register offset, then no need to hardcode the register offset in driver for new SoCs.
To keep backwards comatibility, still keep the register offset for i.MX95.
Signed-off-by Peng Fan <[email protected]>--- drivers/pinctrl/freescale/pinctrl-imx-scmi.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-)
drivers/pinctrl/freescale/pinctrl-imx-scmi.c static int scmi_pinctrl_imx_probe(struct scmi_device *sdev) · line 310
Quoted 4 lines
drivers/pinctrl/freescale/pinctrl-imx-scmi.c +1
-0@@ -315,6 +307,18 @@ static int scmi_pinctrl_imx_probe(struct scmi_device *sdev)if (!pmx)return -ENOMEM ; + ret =device_property_read_u32 (dev,"nxp,iomuxc-daisy-off" , &pmx->daisy_off);
"off" is really a poor acronym for "offset" as it unnecessarily confuses the reader by suggesting this is about turning some feature off. Please add the three bytes and just call it offset.
Sascha
Signature · 4 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Re: [PATCH 2/3] pinctrl: imx-scmi: Get daisy register offset from DT
Quoted 17 lines · Sascha Hauer
Quoted 16 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
Parsing the "nxp,iomuxc-daisy-off" to get the daisy register offset, then no need to hardcode the register offset in driver for new SoCs.
To keep backwards comatibility, still keep the register offset for i.MX95.
Signed-off-by Peng Fan <[email protected]>--- drivers/pinctrl/freescale/pinctrl-imx-scmi.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-)drivers/pinctrl/freescale/pinctrl-imx-scmi.c +0
-0@@ -315,6 +307,18 @@ static int scmi_pinctrl_imx_probe(struct scmi_device *sdev)if (!pmx)return -ENOMEM ;
Quoted 5 lines
drivers/pinctrl/freescale/pinctrl-imx-scmi.c static int scmi_pinctrl_imx_probe(struct scmi_device *sdev) · line 310
Quoted 1 line
drivers/pinctrl/freescale/pinctrl-imx-scmi.c +1
-0+ ret =device_property_read_u32 (dev,"nxp,iomuxc-daisy-off" , &pmx->daisy_off);"off" is really a poor acronym for "offset" as it unnecessarily confuses the reader by suggesting this is about turning some feature off. Please add the three bytes and just call it offset.
I will use "nxp,iomuxc-daisy-offset" in V2.
Thanks,
Peng
Quoted 8 lines
Sascha
Signature · 4 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
PATCH 3/3 arm64: dts: imx95: Add property nxp,iomuxc-daisy-off
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
i.MX95 IOMUXC Daisy register offset is at IOMUXC offset 0x408, set it.
--- arch/arm64/boot/dts/freescale/imx95.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/freescale/imx95.dtsi +1 -0
@@ -348,6 +348,7 @@ scmi_sensor: protocol@15 { scmi_iomuxc: protocol@19 { reg = <0x19>; + nxp,iomuxc-daisy-off = <0x408>; }; scmi_bbm: protocol@81 {
Signature · 1 line
2.37.1