Add pinctrl support for S32 SoC family
Subsystems (4)
v3 cover Add pinctrl support for S32 SoC family
Hello,
Here I want to introduce a new patch series, which aims to support IOMUX functions provided by SIUL2 [System Integration Unit Lite2] on S32 SoCs, such as S32G2. This series is originally from NXP's implementation on CodeAurora[1] and it will be required by upstream kernel for supporting a variety of devices on S32 SoCs which need to config PINMUXs, such as PHYs and MAC controllers.
Thanks,
Chester
Changes in v3:
- dt-bindings:
- Remove the minItems from reg because there's no optional item for
s32g2.
- List supported properties of pinmux-node and pincfg-node and add more descriptions.
- Adjust the location of "required:".
- Fix descriptions and wordings.
- Rename the yaml file to nxp,s32g2-siul2-pinctrl.yaml.
- Rename pinctrl-s32g.c to pinctrl-s32g2.c
- Adjust Kconfig options [menu-invisible] and names [S32G -> S32G2].
- Add .suppress_bind_attrs
- Drop the .remove callback and replace the module_platform_driver() call with builtin_platform_driver()
Changes in v2:
- Move the "nxp,pins" ID range information from DT to the driver.
- dt-bindings:
- Fix schema issues.
- Add descriptions for reg entries.
- Revise the example.
- Refine the compatible name from "nxp,s32g-..." to "nxp,s32g2-...".
- Fix the copyright format suggested by NXP.
Chester Lin (2):
dt-bindings: pinctrl: add schema for NXP S32 SoCs
pinctrl: add NXP S32 SoC family support
.../pinctrl/nxp,s32g2-siul2-pinctrl.yaml | 129 +++ drivers/pinctrl/freescale/Kconfig | 14 + drivers/pinctrl/freescale/Makefile | 2 + drivers/pinctrl/freescale/pinctrl-s32.h | 76 ++ drivers/pinctrl/freescale/pinctrl-s32cc.c | 983 ++++++++++++++++++ drivers/pinctrl/freescale/pinctrl-s32g2.c | 773 ++++++++++++++ 6 files changed, 1977 insertions(+) create mode 100644 Documentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yaml create mode 100644 drivers/pinctrl/freescale/pinctrl-s32.h create mode 100644 drivers/pinctrl/freescale/pinctrl-s32cc.c create mode 100644 drivers/pinctrl/freescale/pinctrl-s32g2.c
Signature · 1 line
2.37.3
PATCH v3 1/2 dt-bindings: pinctrl: add schema for NXP S32 SoCs
Add DT schema for the pinctrl driver of NXP S32 SoC family.
---
Changes in v3:
- Remove the minItems from reg because there's no optional item for s32g2.
- List supported properties of pinmux-node and pincfg-node and add more descriptions.
- Adjust the location of "required:".
- Fix descriptions and wordings.
- Rename the yaml file to nxp,s32g2-siul2-pinctrl.yaml.
Changes in v2:
- Remove the "nxp,pins" property since it has been moved into the driver.
- Add descriptions for reg entries.
- Refine the compatible name from "nxp,s32g-..." to "nxp,s32g2-...".
- Fix schema issues and revise the example.
- Fix the copyright format suggested by NXP.
.../pinctrl/nxp,s32g2-siul2-pinctrl.yaml | 129 ++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 Documentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yaml
Documentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yaml new file +129 -0
@@ -0,0 +1,129 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright 2022 NXP +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pinctrl/nxp,s32g2-siul2-pinctrl.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP S32G2 pin controller + +maintainers: + - Ghennadi Procopciuc <[email protected]> + - Chester Lin <[email protected]> + +description: | + S32G2 pinmux is implemented in SIUL2 (System Integration Unit Lite2), + whose memory map is split into two regions: + SIUL2_0 @ 0x4009c000 + SIUL2_1 @ 0x44010000 + + Every SIUL2 region has multiple register types, and here only MSCR and + IMCR registers need to be revealed for kernel to configure pinmux. + + Please note that some register indexes are reserved in S32G2, such as + MSCR102-MSCR111, MSCR123-MSCR143, IMCR84-IMCR118 and IMCR398-IMCR429. + +properties: + compatible: + enum: + - nxp,s32g2-siul2-pinctrl + + reg: + description: | + A list of MSCR/IMCR register regions to be reserved. + - MSCR (Multiplexed Signal Configuration Register) + An MSCR register can configure the associated pin as either a GPIO pin + or a function output pin depends on the selected signal source. + - IMCR (Input Multiplexed Signal Configuration Register) + An IMCR register can configure the associated pin as function input + pin depends on the selected signal source. + items: + - description: MSCR registers group 0 in SIUL2_0 + - description: MSCR registers group 1 in SIUL2_1 + - description: MSCR registers group 2 in SIUL2_1 + - description: IMCR registers group 0 in SIUL2_0 + - description: IMCR registers group 1 in SIUL2_1 + - description: IMCR registers group 2 in SIUL2_1 + +patternProperties: + '-pins$': + type: object + additionalProperties: false + + patternProperties: + '-grp[0-9]$': + type: object + allOf: + - $ref: pinmux-node.yaml# + - $ref: pincfg-node.yaml# + description: | + Pinctrl node's client devices specify pin muxes using subnodes, + which in turn use the standard properties below. + + properties: + bias-disable: true + bias-high-impedance: true + bias-pull-up: true + bias-pull-down: true + drive-open-drain: true + input-enable: true + output-enable: true + + pinmux: + description: | + An integer array for representing pinmux configurations of + a device. Each integer consists of a PIN_ID and a 4-bit + selected signal source(SSS) as IOMUX setting, which is + calculated as: pinmux = (PIN_ID << 4 | SSS) + + slew-rate: + description: | + 0: 208MHz + 1-3: Reserved + 4: 166MHz + 5: 150MHz + 6: 133MHz + 7: 83MHz + enum: [0, 4, 5, 6, 7] + + additionalProperties: false + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + pinctrl@4009c240 { + compatible = "nxp,s32g2-siul2-pinctrl"; + + /* MSCR0-MSCR101 registers on siul2_0 */ + reg = <0x4009c240 0x198>, + /* MSCR112-MSCR122 registers on siul2_1 */ + <0x44010400 0x2c>, + /* MSCR144-MSCR190 registers on siul2_1 */ + <0x44010480 0xbc>, + /* IMCR0-IMCR83 registers on siul2_0 */ + <0x4009ca40 0x150>, + /* IMCR119-IMCR397 registers on siul2_1 */ + <0x44010c1c 0x45c>, + /* IMCR430-IMCR495 registers on siul2_1 */ + <0x440110f8 0x108>; + + llce-can0-pins { + llce-can0-grp0 { + pinmux = <0x2b0>; + input-enable; + slew-rate = <0>; + }; + + llce-can0-grp1 { + pinmux = <0x2c2>; + output-enable; + slew-rate = <0>; + }; + }; + }; +...
Signature · 1 line
2.37.3
PATCH v3 2/2 pinctrl: add NXP S32 SoC family support
In reply to Chester LinAdd the pinctrl driver for NXP S32 SoC family. This driver is mainly based on NXP's downstream implementation on CodeAurora[1].
---
Changes in v3:
- Rename pinctrl-s32g.c to pinctrl-s32g2.c
- Adjust Kconfig options [menu-invisible] and names [S32G -> S32G2].
- Add .suppress_bind_attrs
- Drop the .remove callback and replace the module_platform_driver() call with builtin_platform_driver()
Changes in v2:
- Create a s32_pin_range matrix in the driver for replacing the "nxp,pins" property in DT.
- Refine the compatible name to "nxp,s32g2-siul2-pinctrl".
- Fix the copyright requested by NXP.
- Remove a few recipients from the Cc list since these email addresses are no longer available.
drivers/pinctrl/freescale/Kconfig | 14 + drivers/pinctrl/freescale/Makefile | 2 + drivers/pinctrl/freescale/pinctrl-s32.h | 76 ++ drivers/pinctrl/freescale/pinctrl-s32cc.c | 983 ++++++++++++++++++++++ drivers/pinctrl/freescale/pinctrl-s32g2.c | 773 +++++++++++++++++ 5 files changed, 1848 insertions(+) create mode 100644 drivers/pinctrl/freescale/pinctrl-s32.h create mode 100644 drivers/pinctrl/freescale/pinctrl-s32cc.c create mode 100644 drivers/pinctrl/freescale/pinctrl-s32g2.c
drivers/pinctrl/freescale/Kconfig +14 -0
@@ -217,3 +217,17 @@ config PINCTRL_IMXRT1170 select PINCTRL_IMX help Say Y here to enable the imxrt1170 pinctrl driver + +config PINCTRL_S32CC + bool + depends on ARCH_S32 && OF + select GENERIC_PINCTRL_GROUPS + select GENERIC_PINMUX_FUNCTIONS + select GENERIC_PINCONF + +config PINCTRL_S32G2 + depends on ARCH_S32 && OF + bool "NXP S32G2 pinctrl driver" + select PINCTRL_S32CC + help + Say Y here to enable the pinctrl driver for NXP S32G2 family SoCs
drivers/pinctrl/freescale/Makefile +2 -0
@@ -33,3 +33,5 @@ obj-$(CONFIG_PINCTRL_IMX25) += pinctrl-imx25.o obj-$(CONFIG_PINCTRL_IMX28) += pinctrl-imx28.o obj-$(CONFIG_PINCTRL_IMXRT1050) += pinctrl-imxrt1050.o obj-$(CONFIG_PINCTRL_IMXRT1170) += pinctrl-imxrt1170.o +obj-$(CONFIG_PINCTRL_S32CC) += pinctrl-s32cc.o +obj-$(CONFIG_PINCTRL_S32G2) += pinctrl-s32g2.o
drivers/pinctrl/freescale/pinctrl-s32.h new file +76 -0
76 lines not on this page · raw message
drivers/pinctrl/freescale/pinctrl-s32cc.c new file +983 -0
983 lines not on this page · raw message
drivers/pinctrl/freescale/pinctrl-s32g2.c new file +773 -0
773 lines not on this page · raw message
Signature · 1 line
2.37.3
RE: [PATCH v3 1/2] dt-bindings: pinctrl: add schema for NXP S32 SoCs
In reply to Chester LinHi Chester,
Documentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yaml line 49
Quoted 2 lines
Documentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yaml new file +2
-0+patternProperties: + '-pins$':
Sorry, I missed this in the previous versions. Could you change it to '_pins' (underscore)? In our .dts files we use underscore in the names for pinctrl configuration nodes e.g. i2c4_pins, usbotg_pins.
Review
Quoted 2 lines
(quoted diff) +2
-0+ patternProperties: + '-grp[0-9]$':
The same comment also applies here.
Documentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yaml line 116
Quoted 2 lines
Documentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yaml new file +2
-0+ llce-can0-pins { + llce-can0-grp0 {
This should also change to something like:llce_can0_pins {
llce_can0_grp0 {
... }
}
Otherwise, this and PATCH 2/2 look good to me.
Best regards,
Andrei
Re: [PATCH v3 1/2] dt-bindings: pinctrl: add schema for NXP S32 SoCs
Quoted 6 lines · Andrei Stefanescu
Hi Chester,
Documentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yaml line 49
Quoted 2 lines
Documentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yaml new file +2
-0+patternProperties: + '-pins$':Sorry, I missed this in the previous versions. Could you change it to '
_pins' (underscore)? In our .dts files we use underscore in the names for pinctrl configuration nodes e.g.i2c4_pins,usbotg_pins.
You cannot have underscores as node names, so what do you mean here? You need to fix your DTS not introduce bad practices to mainline kernel.
Best regards,
Krzysztof
Re: [PATCH v3 1/2] dt-bindings: pinctrl: add schema for NXP S32 SoCs
Hi Krzysztof and Andrei,
Thanks for reviewing this patch!
Quoted 9 lines · Krzysztof Kozlowski
Quoted 6 lines · Andrei Stefanescu
Hi Chester,
Documentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yaml line 49
Quoted 2 lines
Documentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yaml new file +2
-0+patternProperties: + '-pins$':Sorry, I missed this in the previous versions. Could you change it to '
_pins' (underscore)? In our .dts files we use underscore in the names for pinctrl configuration nodes e.g.i2c4_pins,usbotg_pins.You cannot have underscores as node names, so what do you mean here? You
Krzysztof is right, and Rob also reminded me in his comments in v1:
https://lore.kernel.org/linux-arm-kernel/[email protected]/
Regards,
Chester
Quoted 5 lines
need to fix your DTS not introduce bad practices to mainline kernel.
Best regards,
Krzysztof
Re: [PATCH v3 1/2] dt-bindings: pinctrl: add schema for NXP S32 SoCs
In reply to Chester LinQuoted 109 lines · Chester Lin
Add DT schema for the pinctrl driver of NXP S32 SoC family.
Signed-off-by Larisa Grigore <[email protected]>Signed-off-by Ghennadi Procopciuc <[email protected]>Signed-off-by Chester Lin <[email protected]>---
Changes in v3:
- Remove the minItems from reg because there's no optional item for s32g2.
- List supported properties of pinmux-node and pincfg-node and add more descriptions.
- Adjust the location of "required:".
- Fix descriptions and wordings.
- Rename the yaml file to nxp,s32g2-siul2-pinctrl.yaml.Changes in v2:
- Remove the "nxp,pins" property since it has been moved into the driver.
- Add descriptions for reg entries.
- Refine the compatible name from "nxp,s32g-..." to "nxp,s32g2-...".
- Fix schema issues and revise the example.
- Fix the copyright format suggested by NXP..../pinctrl/nxp,s32g2-siul2-pinctrl.yaml | 129 ++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 Documentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yamlDocumentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yaml new file +77
-0@@ -0,0 +1,129 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright 2022 NXP +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pinctrl/nxp,s32g2-siul2-pinctrl.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP S32G2 pin controller + +maintainers: + - Ghennadi Procopciuc <[email protected]> + - Chester Lin <[email protected]> + +description: | + S32G2 pinmux is implemented in SIUL2 (System Integration Unit Lite2), + whose memory map is split into two regions: + SIUL2_0 @ 0x4009c000 + SIUL2_1 @ 0x44010000 + + Every SIUL2 region has multiple register types, and here only MSCR and + IMCR registers need to be revealed for kernel to configure pinmux. + + Please note that some register indexes are reserved in S32G2, such as + MSCR102-MSCR111, MSCR123-MSCR143, IMCR84-IMCR118 and IMCR398-IMCR429. + +properties: + compatible: + enum: + - nxp,s32g2-siul2-pinctrl + + reg: + description: | + A list of MSCR/IMCR register regions to be reserved. + - MSCR (Multiplexed Signal Configuration Register) + An MSCR register can configure the associated pin as either a GPIO pin + or a function output pin depends on the selected signal source. + - IMCR (Input Multiplexed Signal Configuration Register) + An IMCR register can configure the associated pin as function input + pin depends on the selected signal source. + items: + - description: MSCR registers group 0 in SIUL2_0 + - description: MSCR registers group 1 in SIUL2_1 + - description: MSCR registers group 2 in SIUL2_1 + - description: IMCR registers group 0 in SIUL2_0 + - description: IMCR registers group 1 in SIUL2_1 + - description: IMCR registers group 2 in SIUL2_1 + +patternProperties: + '-pins$': + type: object + additionalProperties: false + + patternProperties: + '-grp[0-9]$': + type: object + allOf: + - $ref: pinmux-node.yaml# + - $ref: pincfg-node.yaml# + description: | + Pinctrl node's client devices specify pin muxes using subnodes, + which in turn use the standard properties below. + + properties: + bias-disable: true + bias-high-impedance: true + bias-pull-up: true + bias-pull-down: true + drive-open-drain: true + input-enable: true + output-enable: true + + pinmux: + description: | + An integer array for representing pinmux configurations of + a device. Each integer consists of a PIN_ID and a 4-bit + selected signal source(SSS) as IOMUX setting, which is + calculated as: pinmux = (PIN_ID << 4 | SSS)
Documentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yaml line 87
Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yaml new file +10
-0+ + slew-rate: + description: | + 0: 208MHz + 1-3: Reserved + 4: 166MHz + 5: 150MHz + 6: 133MHz + 7: 83MHz + enum: [0, 4, 5, 6, 7]
You have known values, then use them. This is much more readable in DTS.
Best regards,
Krzysztof
Re: [PATCH v3 1/2] dt-bindings: pinctrl: add schema for NXP S32 SoCs
Hi Krzysztof,
Quoted 114 lines · Krzysztof Kozlowski
Quoted 113 lines · Chester Lin
Add DT schema for the pinctrl driver of NXP S32 SoC family.
Signed-off-by Larisa Grigore <[email protected]>Signed-off-by Ghennadi Procopciuc <[email protected]>Signed-off-by Chester Lin <[email protected]>---
Changes in v3:
- Remove the minItems from reg because there's no optional item for s32g2.
- List supported properties of pinmux-node and pincfg-node and add more descriptions.
- Adjust the location of "required:".
- Fix descriptions and wordings.
- Rename the yaml file to nxp,s32g2-siul2-pinctrl.yaml.Changes in v2:
- Remove the "nxp,pins" property since it has been moved into the driver.
- Add descriptions for reg entries.
- Refine the compatible name from "nxp,s32g-..." to "nxp,s32g2-...".
- Fix schema issues and revise the example.
- Fix the copyright format suggested by NXP..../pinctrl/nxp,s32g2-siul2-pinctrl.yaml | 129 ++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 Documentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yamlDocumentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yaml new file +81
-0@@ -0,0 +1,129 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright 2022 NXP +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pinctrl/nxp,s32g2-siul2-pinctrl.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP S32G2 pin controller + +maintainers: + - Ghennadi Procopciuc <[email protected]> + - Chester Lin <[email protected]> + +description: | + S32G2 pinmux is implemented in SIUL2 (System Integration Unit Lite2), + whose memory map is split into two regions: + SIUL2_0 @ 0x4009c000 + SIUL2_1 @ 0x44010000 + + Every SIUL2 region has multiple register types, and here only MSCR and + IMCR registers need to be revealed for kernel to configure pinmux. + + Please note that some register indexes are reserved in S32G2, such as + MSCR102-MSCR111, MSCR123-MSCR143, IMCR84-IMCR118 and IMCR398-IMCR429. + +properties: + compatible: + enum: + - nxp,s32g2-siul2-pinctrl + + reg: + description: | + A list of MSCR/IMCR register regions to be reserved. + - MSCR (Multiplexed Signal Configuration Register) + An MSCR register can configure the associated pin as either a GPIO pin + or a function output pin depends on the selected signal source. + - IMCR (Input Multiplexed Signal Configuration Register) + An IMCR register can configure the associated pin as function input + pin depends on the selected signal source. + items: + - description: MSCR registers group 0 in SIUL2_0 + - description: MSCR registers group 1 in SIUL2_1 + - description: MSCR registers group 2 in SIUL2_1 + - description: IMCR registers group 0 in SIUL2_0 + - description: IMCR registers group 1 in SIUL2_1 + - description: IMCR registers group 2 in SIUL2_1 + +patternProperties: + '-pins$': + type: object + additionalProperties: false + + patternProperties: + '-grp[0-9]$': + type: object + allOf: + - $ref: pinmux-node.yaml# + - $ref: pincfg-node.yaml# + description: | + Pinctrl node's client devices specify pin muxes using subnodes, + which in turn use the standard properties below. + + properties: + bias-disable: true + bias-high-impedance: true + bias-pull-up: true + bias-pull-down: true + drive-open-drain: true + input-enable: true + output-enable: true + + pinmux: + description: | + An integer array for representing pinmux configurations of + a device. Each integer consists of a PIN_ID and a 4-bit + selected signal source(SSS) as IOMUX setting, which is + calculated as: pinmux = (PIN_ID << 4 | SSS) + + slew-rate: + description: | + 0: 208MHz
Quoted 8 lines
Documentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yaml line 87
Quoted 6 lines
Documentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yaml new file +6
-0+ 1-3: Reserved + 4: 166MHz + 5: 150MHz + 6: 133MHz + 7: 83MHz + enum: [0, 4, 5, 6, 7]You have known values, then use them. This is much more readable in DTS.
The main reason of mapping with register values [0-7] is to simplify the driver implementation while handling register r/w. To improve readability as you suggested, I am thinking of having a DT header "s32g2-pinfunc.h" with a few binding macros/helper as below, the only difference compared to v3 is using S32G2_PINMUX and S32G2_SLEW_XXXMHZ macros rather than pure integers to represent pinmux and slew-rate property values.
Regards,
Chester
From 3a29d905ae104e694230ffc02dc9f9de4191c5d1 Mon Sep 17 00:00:00 2001
From: Chester Lin <[email protected]>
Date: Fri, 28 Oct 2022 16:44:29 +0800
Subject: [PATCH] dt-bindings: pinctrl: add support for NXP S32 SoCs
Add DT schema and hedaer file for the pinctrl driver of NXP S32 SoC family.
--- .../pinctrl/nxp,s32g2-siul2-pinctrl.yaml | 136 ++++++++++++++++++ include/dt-bindings/pinctrl/s32g2-pinfunc.h | 17 +++ 2 files changed, 153 insertions(+) create mode 100644 Documentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yaml create mode 100644 include/dt-bindings/pinctrl/s32g2-pinfunc.h
Documentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yaml new file +136 -0
@@ -0,0 +1,136 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright 2022 NXP +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pinctrl/nxp,s32g2-siul2-pinctrl.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP S32G2 pin controller + +maintainers: + - Ghennadi Procopciuc <[email protected]> + - Chester Lin <[email protected]> + +description: | + S32G2 pinmux is implemented in SIUL2 (System Integration Unit Lite2), + whose memory map is split into two regions: + SIUL2_0 @ 0x4009c000 + SIUL2_1 @ 0x44010000 + + Every SIUL2 region has multiple register types, and here only MSCR and + IMCR registers need to be revealed for kernel to configure pinmux. + + Please note that some register indexes are reserved in S32G2, such as + MSCR102-MSCR111, MSCR123-MSCR143, IMCR84-IMCR118 and IMCR398-IMCR429. + +properties: + compatible: + enum: + - nxp,s32g2-siul2-pinctrl + + reg: + description: | + A list of MSCR/IMCR register regions to be reserved. + - MSCR (Multiplexed Signal Configuration Register) + An MSCR register can configure the associated pin as either a GPIO pin + or a function output pin depends on the selected signal source. + - IMCR (Input Multiplexed Signal Configuration Register) + An IMCR register can configure the associated pin as function input + pin depends on the selected signal source. + items: + - description: MSCR registers group 0 in SIUL2_0 + - description: MSCR registers group 1 in SIUL2_1 + - description: MSCR registers group 2 in SIUL2_1 + - description: IMCR registers group 0 in SIUL2_0 + - description: IMCR registers group 1 in SIUL2_1 + - description: IMCR registers group 2 in SIUL2_1 + +patternProperties: + '-pins$': + type: object + additionalProperties: false + + patternProperties: + '-grp[0-9]$': + type: object + allOf: + - $ref: pinmux-node.yaml# + - $ref: pincfg-node.yaml# + description: | + Pinctrl node's client devices specify pin muxes using subnodes, + which in turn use the standard properties below. + + properties: + bias-disable: true + bias-high-impedance: true + bias-pull-up: true + bias-pull-down: true + drive-open-drain: true + input-enable: true + output-enable: true + + pinmux: + description: | + An integer array for representing pinmux configurations of + a device. Each integer consists of a PIN_ID and a 4-bit + selected signal source(SSS) as IOMUX setting, which is + calculated as: pinmux = (PIN_ID << 4 | SSS) + It's recommended that using the helper macro S32G2_PINMUX() + defined in dt-bindings/pinctrl/s32g2-pinfunc.h in order to + assemble a pinmux value. + + slew-rate: + description: | + 0: 208MHz + 1-3: Reserved + 4: 166MHz + 5: 150MHz + 6: 133MHz + 7: 83MHz + The available slew rates are defined as macros in + dt-bindings/pinctrl/s32g2-pinfunc.h. + enum: [0, 4, 5, 6, 7] + + additionalProperties: false + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + #include <dt-bindings/pinctrl/s32g2-pinfunc.h> + + pinctrl@4009c240 { + compatible = "nxp,s32g2-siul2-pinctrl"; + + /* MSCR0-MSCR101 registers on siul2_0 */ + reg = <0x4009c240 0x198>, + /* MSCR112-MSCR122 registers on siul2_1 */ + <0x44010400 0x2c>, + /* MSCR144-MSCR190 registers on siul2_1 */ + <0x44010480 0xbc>, + /* IMCR0-IMCR83 registers on siul2_0 */ + <0x4009ca40 0x150>, + /* IMCR119-IMCR397 registers on siul2_1 */ + <0x44010c1c 0x45c>, + /* IMCR430-IMCR495 registers on siul2_1 */ + <0x440110f8 0x108>; + + llce-can0-pins { + llce-can0-grp0 { + pinmux = <S32G2_PINMUX(43, 0)>; + input-enable; + slew-rate = <S32G2_SLEW_208MHZ>; + }; + + llce-can0-grp1 { + pinmux = <S32G2_PINMUX(44, 2)>; + output-enable; + slew-rate = <S32G2_SLEW_208MHZ>; + }; + }; + }; +...
include/dt-bindings/pinctrl/s32g2-pinfunc.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-or-later) */ +/* +* Copyright 2022 NXP +*/ + +#ifndef _DT_BINDINGS_S32G2_PINFUNC_H +#define _DT_BINDINGS_S32G2_PINFUNC_H + +#define S32G2_PINMUX (PIN ,FUNC ) (((PIN) << 4) | (FUNC)) + +#define S32G2_SLEW_208MHZ 0 +#define S32G2_SLEW_166MHZ 4 +#define S32G2_SLEW_150MHZ 5 +#define S32G2_SLEW_133MHZ 6 +#define S32G2_SLEW_83MHZ 7 + +#endif
Signature · 1 line
2.37.3
Re: [PATCH v3 1/2] dt-bindings: pinctrl: add schema for NXP S32 SoCs
Quoted 126 lines · Chester Lin
Hi Krzysztof,
Quoted 114 lines · Krzysztof Kozlowski
Quoted 113 lines · Chester Lin
Add DT schema for the pinctrl driver of NXP S32 SoC family.
Signed-off-by Larisa Grigore <[email protected]>Signed-off-by Ghennadi Procopciuc <[email protected]>Signed-off-by Chester Lin <[email protected]>---
Changes in v3:
- Remove the minItems from reg because there's no optional item for s32g2.
- List supported properties of pinmux-node and pincfg-node and add more descriptions.
- Adjust the location of "required:".
- Fix descriptions and wordings.
- Rename the yaml file to nxp,s32g2-siul2-pinctrl.yaml.Changes in v2:
- Remove the "nxp,pins" property since it has been moved into the driver.
- Add descriptions for reg entries.
- Refine the compatible name from "nxp,s32g-..." to "nxp,s32g2-...".
- Fix schema issues and revise the example.
- Fix the copyright format suggested by NXP..../pinctrl/nxp,s32g2-siul2-pinctrl.yaml | 129 ++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 Documentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yamlDocumentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yaml new file +81
-0@@ -0,0 +1,129 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright 2022 NXP +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pinctrl/nxp,s32g2-siul2-pinctrl.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP S32G2 pin controller + +maintainers: + - Ghennadi Procopciuc <[email protected]> + - Chester Lin <[email protected]> + +description: | + S32G2 pinmux is implemented in SIUL2 (System Integration Unit Lite2), + whose memory map is split into two regions: + SIUL2_0 @ 0x4009c000 + SIUL2_1 @ 0x44010000 + + Every SIUL2 region has multiple register types, and here only MSCR and + IMCR registers need to be revealed for kernel to configure pinmux. + + Please note that some register indexes are reserved in S32G2, such as + MSCR102-MSCR111, MSCR123-MSCR143, IMCR84-IMCR118 and IMCR398-IMCR429. + +properties: + compatible: + enum: + - nxp,s32g2-siul2-pinctrl + + reg: + description: | + A list of MSCR/IMCR register regions to be reserved. + - MSCR (Multiplexed Signal Configuration Register) + An MSCR register can configure the associated pin as either a GPIO pin + or a function output pin depends on the selected signal source. + - IMCR (Input Multiplexed Signal Configuration Register) + An IMCR register can configure the associated pin as function input + pin depends on the selected signal source. + items: + - description: MSCR registers group 0 in SIUL2_0 + - description: MSCR registers group 1 in SIUL2_1 + - description: MSCR registers group 2 in SIUL2_1 + - description: IMCR registers group 0 in SIUL2_0 + - description: IMCR registers group 1 in SIUL2_1 + - description: IMCR registers group 2 in SIUL2_1 + +patternProperties: + '-pins$': + type: object + additionalProperties: false + + patternProperties: + '-grp[0-9]$': + type: object + allOf: + - $ref: pinmux-node.yaml# + - $ref: pincfg-node.yaml# + description: | + Pinctrl node's client devices specify pin muxes using subnodes, + which in turn use the standard properties below. + + properties: + bias-disable: true + bias-high-impedance: true + bias-pull-up: true + bias-pull-down: true + drive-open-drain: true + input-enable: true + output-enable: true + + pinmux: + description: | + An integer array for representing pinmux configurations of + a device. Each integer consists of a PIN_ID and a 4-bit + selected signal source(SSS) as IOMUX setting, which is + calculated as: pinmux = (PIN_ID << 4 | SSS) + + slew-rate: + description: | + 0: 208MHzQuoted 8 lines
Documentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yaml line 92
Quoted 6 lines
Documentation/devicetree/bindings/pinctrl/nxp,s32g2-siul2-pinctrl.yaml new file +6
-0+ 1-3: Reserved + 4: 166MHz + 5: 150MHz + 6: 133MHz + 7: 83MHz + enum: [0, 4, 5, 6, 7]You have known values, then use them. This is much more readable in DTS.
Quoted 2 lines
The main reason of mapping with register values [0-7] is to simplify the driver implementation while handling register r/w.
Define bindings for the DTS, not for the drivers.
Quoted 5 lines
To improve readability
as you suggested, I am thinking of having a DT header "s32g2-pinfunc.h" with a few binding macros/helper as below, the only difference compared to v3 is usingS32G2_PINMUXandS32G2_SLEW_XXXMHZmacros rather than pure integers to represent pinmux and slew-rate property values.
Binding headers is not a place for register values. By definition - these are bindings, not hardware description. Hardware description is DTS. Feel free to store them in DTS headers, but anyway this does not solve the issue here.
The issue is: you store register values in DTS, which is limited, not extendable description. Each of your devices would need entirely different binding for this because register values can change between every SoC version. Several other pinctrl bindings use similar approach, but they have not got a clear mapping to values (e.g. they have fast and slow). For the case with real values, use the same solution as drive-strength - real values.
Quoted 10 lines
Regards,
ChesterFrom
3a29d905ae104e694230ffc02dc9f9de4191c5d1Mon Sep 17 00:00:00 2001
From: Chester Lin <[email protected]>
Date: Fri, 28 Oct 2022 16:44:29 +0800
Subject: [PATCH] dt-bindings: pinctrl: add support for NXP S32 SoCs
Quoted 8 lines
Add DT schema and hedaer file for the pinctrl driver of NXP S32 SoC family.
Signed-off-by Larisa Grigore <[email protected]>Signed-off-by Ghennadi Procopciuc <[email protected]>Signed-off-by Chester Lin <[email protected]>--- .../pinctrl/nxp,s32g2-siul2-pinctrl.yaml | 136 ++++++++++++++++++ include/dt-bindings/pinctrl/s32g2-pinfunc.h | 17 +++
NAK for bindings.
Best regards,
Krzysztof
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH v3 2/2] pinctrl: add NXP S32 SoC family support
In reply to Chester LinHi Chester,
thanks for your patch!
Quoted 13 lines · Chester Lin
Add the pinctrl driver for NXP S32 SoC family. This driver is mainly based on NXP's downstream implementation on CodeAurora[1].
Signed-off-by Matthew Nunez <[email protected]>Signed-off-by Phu Luu An <[email protected]>Signed-off-by Stefan-Gabriel Mirea <[email protected]>Signed-off-by Larisa Grigore <[email protected]>Signed-off-by Ghennadi Procopciuc <[email protected]>Signed-off-by Andrei Stefanescu <[email protected]>Signed-off-by Radu Pirea <[email protected]>Signed-off-by Chester Lin <[email protected]>
(...)
Quoted 5 lines
drivers/pinctrl/freescale/Kconfig | 14 + drivers/pinctrl/freescale/Makefile | 2 + drivers/pinctrl/freescale/pinctrl-s32.h | 76 ++ drivers/pinctrl/freescale/pinctrl-s32cc.c | 983 ++++++++++++++++++++++ drivers/pinctrl/freescale/pinctrl-s32g2.c | 773 +++++++++++++++++
Should this driver really be grouped together with the legacy branded "freescale" stuff? Does it share any hardware or structure or code with the Freescale drivers?
Maybe you should bite the bullet and created drivers/pinctrl/nxp?
Also create a new MAINTAINERS entry so we do not get the Freescale legacy maintainer list.
Overall the driver looks good, I am a bit sceptic about the things that Kryzstof is talking about as well so that needs to be resolved.
Yours,
Linus Walleij