Skip to contentSkip to conversation

Add IMX8 SCU GPIO support

PATCH Superseded Shenwei Wang 4 participants 11 messages Aug 4, 2022 – Aug 8, 2022

Subsystems (3)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

cover Add IMX8 SCU GPIO support

The system controller (SCU) is the central unit to manage the resources on i.MX8 platforms. The SCU firmware provides a set of APIs to access the GPIO PINs on the SCU domain.

This patch series implements the standard GPIO driver over the SCU firmware APIs, so that the GPIOs on the SCU domain could be accessed like a local GPIO PINs.

Shenwei Wang (3):
dt-bindings: gpio: Add imx-scu gpio driver bindings
dt-bindings: firmware: imx: Add imx-scu gpio node
firmware: imx: add imx-scu GPIO driver

 .../devicetree/bindings/firmware/fsl,scu.yaml |   5 +
 .../bindings/gpio/fsl,imx8-scu-gpio.yaml      |  39 +++++
 drivers/firmware/imx/Kconfig                  |   6 +
 drivers/firmware/imx/Makefile                 |   1 +
 drivers/firmware/imx/imx-scu-gpio.c           | 139 ++++++++++++++++++
 5 files changed, 190 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/fsl,imx8-scu-gpio.yaml
 create mode 100644 drivers/firmware/imx/imx-scu-gpio.c

--
2.25.1

#1 lore raw

PATCH 1/3 dt-bindings: gpio: Add imx-scu gpio driver bindings

Add binding document for the imx-scu gpio driver.

---
 .../bindings/gpio/fsl,imx8-scu-gpio.yaml      | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/fsl,imx8-scu-gpio.yaml
Documentation/devicetree/bindings/gpio/fsl,imx8-scu-gpio.yaml new file +39 -0
new file mode 100644
index 000000000000..d06e91402666
@@ -0,0 +1,39 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/gpio/fsl,imx8-scu-gpio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: GPIO driver over IMX SCU firmware API
+
+maintainers:
+  - Shenwei Wang <[email protected]>
+
+description: |
+  This module provides the standard interface to control the
+  resource pins in SCU domain on i.MX8 platforms.
+
+properties:
+  compatible:
+    enum:
+      - fsl,imx8-scu-gpio
+
+  "#gpio-cells":
+    const: 2
+
+  gpio-controller: true
+
+required:
+  - compatible
+  - "#gpio-cells"
+  - gpio-controller
+
+additionalProperties: false
+
+examples:
+  - |
+    gpio@scu {
+        compatible = "fsl,imx8-scu-gpio";
+        gpio-controller;
+        #gpio-cells = <2>;
+    };
Signature · 1 line
2.25.1
maintainer
#2 lore raw

Re: [PATCH v1 1/3] dt-bindings: gpio: Add imx-scu gpio driver bindings

Quoted 8 lines · Shenwei Wang

Add binding document for the imx-scu gpio driver.

---
 .../bindings/gpio/fsl,imx8-scu-gpio.yaml      | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/fsl,imx8-scu-gpio.yaml

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/gpio/fsl,imx8-scu-gpio.example.dts:18.18-22.11: Warning (unit_address_vs_reg): /example-0/gpio@scu: node has a unit name, but no reg or ranges property

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/

This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit.

#3 lore raw

Re: [PATCH v1 1/3] dt-bindings: gpio: Add imx-scu gpio driver bindings

In reply to Shenwei Wang
Quoted 11 lines · Shenwei Wang
Documentation/devicetree/bindings/gpio/fsl,imx8-scu-gpio.yaml new file +11 -0
+
+properties:
+  compatible:
+    enum:
+      - fsl,imx8-scu-gpio
+
+  "#gpio-cells":
+    const: 2
+
+  gpio-controller: true
+

Documentation/devicetree/bindings/gpio/fsl,imx8-scu-gpio.yaml line 35

Quoted 10 lines
Documentation/devicetree/bindings/gpio/fsl,imx8-scu-gpio.yaml new file +10 -0
+required:
+  - compatible
+  - "#gpio-cells"
+  - gpio-controller
+
+additionalProperties: false
+
+examples:
+  - |
+    gpio@scu {

Does not look like you tested the bindings. Please run make dt_binding_check (see Documentation/devicetree/bindings/writing-schema.rst for instructions).

Best regards,
Krzysztof

#4 lore raw

PATCH 2/3 dt-bindings: firmware: imx: Add imx-scu gpio node

In reply to Shenwei Wang

Add the description for imx-scu gpio subnode.

---
 Documentation/devicetree/bindings/firmware/fsl,scu.yaml | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/firmware/fsl,scu.yaml +5 -0
index b40b0ef56978..080955b6edd8 100644
@@ -30,6 +30,11 @@ properties:
       Clock controller node that provides the clocks controlled by the SCU
     $ref: /schemas/clock/fsl,scu-clk.yaml
 
+  gpio:
+    description:
+      GPIO control over the SCU firmware APIs
+    $ref: /schemas/gpio/fsl,imx8-scu-gpio.yaml
+
   ocotp:
     description:
       OCOTP controller node provided by the SCU
Signature · 1 line
2.25.1
#5 lore raw

Re: [PATCH v1 2/3] dt-bindings: firmware: imx: Add imx-scu gpio node

Quoted 12 lines · Shenwei Wang

Add the description for imx-scu gpio subnode.

---
 Documentation/devicetree/bindings/firmware/fsl,scu.yaml | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/firmware/fsl,scu.yaml +0 -0
index b40b0ef56978..080955b6edd8 100644

Documentation/devicetree/bindings/firmware/fsl,scu.yaml properties: · line 35

Quoted 6 lines
Documentation/devicetree/bindings/firmware/fsl,scu.yaml +3 -0
@@ -30,6 +30,11 @@ properties:
       Clock controller node that provides the clocks controlled by the SCU
     $ref: /schemas/clock/fsl,scu-clk.yaml
 
+  gpio:
+    description:
+      GPIO control over the SCU firmware APIs

I don't understand this description. How GPIO can control some API?

Best regards,
Krzysztof

#6 lore raw

RE: [EXT] Re: [PATCH v1 2/3] dt-bindings: firmware: imx: Add imx-scu gpio node

Quoted 33 lines

-----Original Message-----
From: Krzysztof Kozlowski <[email protected]>
Sent: Friday, August 5, 2022 1:56 AM
To: Shenwei Wang <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; dl-linux-imx <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]
Subject: [EXT] Re: [PATCH v1 2/3] dt-bindings: firmware: imx: Add imx-scu gpio node

Caution: EXT Email

Review

Quoted 8 lines · Shenwei Wang

Add the description for imx-scu gpio subnode.

---
 Documentation/devicetree/bindings/firmware/fsl,scu.yaml | 5 +++++
 1 file changed, 5 insertions(+)
(quoted diff) +0 -0

b/Documentation/devicetree/bindings/firmware/fsl,scu.yaml

Quoted 7 lines

index b40b0ef56978..080955b6edd8 100644

Documentation/devicetree/bindings/firmware/fsl,scu.yaml +0 -0
@@ -30,6 +30,11 @@ properties:
       Clock controller node that provides the clocks controlled by the SCU
     $ref: /schemas/clock/fsl,scu-clk.yaml
 
Quoted 5 lines

Documentation/devicetree/bindings/firmware/fsl,scu.yaml properties: · line 35

Quoted 3 lines
Documentation/devicetree/bindings/firmware/fsl,scu.yaml +3 -0
+  gpio:
+    description:
+      GPIO control over the SCU firmware APIs

I don't understand this description. How GPIO can control some API?

How about change to "Control the GPIO PINs on SCU domain over the firmware APIs"?

Thanks,
Shenwei

Quoted 3 lines

Best regards,
Krzysztof

#7 lore raw

Re: [EXT] Re: [PATCH v1 2/3] dt-bindings: firmware: imx: Add imx-scu gpio node

Quoted 33 lines · Shenwei Wang
Quoted 33 lines

-----Original Message-----
From: Krzysztof Kozlowski <[email protected]>
Sent: Friday, August 5, 2022 1:56 AM
To: Shenwei Wang <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; dl-linux-imx <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]
Subject: [EXT] Re: [PATCH v1 2/3] dt-bindings: firmware: imx: Add imx-scu gpio node

Caution: EXT Email

Review

Quoted 8 lines · Shenwei Wang

Add the description for imx-scu gpio subnode.

---
 Documentation/devicetree/bindings/firmware/fsl,scu.yaml | 5 +++++
 1 file changed, 5 insertions(+)
(quoted diff) +0 -0

b/Documentation/devicetree/bindings/firmware/fsl,scu.yaml

Quoted 7 lines

index b40b0ef56978..080955b6edd8 100644

Documentation/devicetree/bindings/firmware/fsl,scu.yaml +0 -0
@@ -30,6 +30,11 @@ properties:
       Clock controller node that provides the clocks controlled by the SCU
     $ref: /schemas/clock/fsl,scu-clk.yaml
 
Quoted 7 lines
Quoted 5 lines

Documentation/devicetree/bindings/firmware/fsl,scu.yaml properties: · line 35

Quoted 3 lines
Documentation/devicetree/bindings/firmware/fsl,scu.yaml +3 -0
+  gpio:
+    description:
+      GPIO control over the SCU firmware APIs

I don't understand this description. How GPIO can control some API?

How about change to "Control the GPIO PINs on SCU domain over the firmware APIs"?

For linux it doesn't matter how the GPIOs are controlled. They can be controlled by a co-processor like this SCU or by an I2C expander or they are native, the list goes on. All those details are hidden.

Regards,
Marco

Quoted 7 lines

Thanks,
Shenwei

Quoted 3 lines

Best regards,
Krzysztof

#8 lore raw

PATCH 3/3 firmware: imx: add imx-scu GPIO driver

In reply to Shenwei Wang

The SCU firmware on i.MX8 platforms provides a set of APIs to control the GPIO PINs on the SCU domain. This patch implements the standard GPIO driver interface to access those PINs on the SCU domain over the SCU APIs.

---
 drivers/firmware/imx/Kconfig        |   6 ++
 drivers/firmware/imx/Makefile       |   1 +
 drivers/firmware/imx/imx-scu-gpio.c | 139 ++++++++++++++++++++++++++++
 3 files changed, 146 insertions(+)
 create mode 100644 drivers/firmware/imx/imx-scu-gpio.c
drivers/firmware/imx/Kconfig +6 -0
index c027d99f2a59..484c13f3149a 100644
@@ -28,3 +28,9 @@ config IMX_SCU_PD
 	depends on IMX_SCU
 	help
 	  The System Controller Firmware (SCFW) based power domain driver.
+
+config IMX_SCU_GPIO
+       def_bool y
+       depends on IMX_SCU
+       help
+         Say Y here to enable the imx8 gpio over SCFW MISC API
drivers/firmware/imx/Makefile +1 -0
index b76acbade2a0..436476502bd8 100644
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_IMX_DSP)		+= imx-dsp.o
 obj-$(CONFIG_IMX_SCU)		+= imx-scu.o misc.o imx-scu-irq.o rm.o imx-scu-soc.o
+obj-$(CONFIG_IMX_SCU_GPIO)	+= imx-scu-gpio.o
 obj-$(CONFIG_IMX_SCU_PD)	+= scu-pd.o
drivers/firmware/imx/imx-scu-gpio.c new file +139 -0

139 lines not on this page · raw message

Signature · 1 line
2.25.1
#9 lore raw

Re: [PATCH v1 3/3] firmware: imx: add imx-scu GPIO driver

Quoted 18 lines · Shenwei Wang

The SCU firmware on i.MX8 platforms provides a set of APIs to control the GPIO PINs on the SCU domain. This patch implements the standard GPIO driver interface to access those PINs on the SCU domain over the SCU APIs.

---
 drivers/firmware/imx/Kconfig        |   6 ++
 drivers/firmware/imx/Makefile       |   1 +
 drivers/firmware/imx/imx-scu-gpio.c | 139 ++++++++++++++++++++++++++++
 3 files changed, 146 insertions(+)
 create mode 100644 drivers/firmware/imx/imx-scu-gpio.c
drivers/firmware/imx/Kconfig +0 -0
index c027d99f2a59..484c13f3149a 100644

drivers/firmware/imx/Kconfig config IMX_SCU_PD · line 36

Quoted 9 lines
drivers/firmware/imx/Kconfig +6 -0
@@ -28,3 +28,9 @@ config IMX_SCU_PD
 	depends on IMX_SCU
 	help
 	  The System Controller Firmware (SCFW) based power domain driver.
+
+config IMX_SCU_GPIO
+       def_bool y
+       depends on IMX_SCU
+       help
+         Say Y here to enable the imx8 gpio over SCFW MISC API

gpio driver go to drivers/gpio/

Best regards,
Krzysztof

#10 lore raw

RE: [EXT] Re: [PATCH v1 3/3] firmware: imx: add imx-scu GPIO driver

Quoted 30 lines

-----Original Message-----
From: Krzysztof Kozlowski <[email protected]>
Sent: Friday, August 5, 2022 1:57 AM
To: Shenwei Wang <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; dl-linux-imx <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]
Subject: [EXT] Re: [PATCH v1 3/3] firmware: imx: add imx-scu GPIO driver

Caution: EXT Email

Quoted 14 lines · Shenwei Wang

The SCU firmware on i.MX8 platforms provides a set of APIs to control the GPIO PINs on the SCU domain. This patch implements the standard GPIO driver interface to access those PINs on the SCU domain over the SCU APIs.

---
 drivers/firmware/imx/Kconfig        |   6 ++
 drivers/firmware/imx/Makefile       |   1 +
 drivers/firmware/imx/imx-scu-gpio.c | 139
++++++++++++++++++++++++++++
 3 files changed, 146 insertions(+)
 create mode 100644 drivers/firmware/imx/imx-scu-gpio.c
Quoted 16 lines
Quoted 5 lines
(quoted diff) +0 -0

b/drivers/firmware/imx/Kconfig index c027d99f2a59..484c13f3149a 100644

drivers/firmware/imx/Kconfig config IMX_SCU_PD · line 36

Quoted 9 lines
drivers/firmware/imx/Kconfig +6 -0
@@ -28,3 +28,9 @@ config IMX_SCU_PD
      depends on IMX_SCU
      help
        The System Controller Firmware (SCFW) based power domain driver.
+
+config IMX_SCU_GPIO
+       def_bool y
+       depends on IMX_SCU
+       help
+         Say Y here to enable the imx8 gpio over SCFW MISC API

gpio driver go to drivers/gpio/

I was thinking to put the driver under drivers/gpio at the beginning too. Are there any requirements to put a driver under firmware directory?

Thanks,
Shenwei

Quoted 3 lines

Best regards,
Krzysztof