Skip to contentSkip to conversation

Add IMX8 SCU GPIO support

PATCH Superseded Shenwei Wang 2 participants 8 messages Aug 10, 2022

Subsystems (3)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 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.

Changes in V3:
- follow the other imx8 SCU binding rule and rename the compatible string from fsl,imx8-scu-gpio to fsl,imx8qxp-sc-gpio
- rename the doc file from fsl,imx8-scu-gpio.yaml to fsl,imx-sc-gpio.yaml

Changes in V2:
- move the driver into the gpio directory per Krzysztof's feedback
- change the subnode description in file fsl,scu.yaml
- fix the dt_binding_check error

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,imx-sc-gpio.yaml        |  40 +++++
 drivers/gpio/Kconfig                          |   4 +
 drivers/gpio/Makefile                         |   1 +
 drivers/gpio/gpio-imx-scu.c                   | 140 ++++++++++++++++++
 5 files changed, 190 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/fsl,imx-sc-gpio.yaml
 create mode 100644 drivers/gpio/gpio-imx-scu.c

--
2.25.1

#1 lore raw

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

Add binding document for the imx scu gpio driver.

---
 .../bindings/gpio/fsl,imx-sc-gpio.yaml        | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/fsl,imx-sc-gpio.yaml
Documentation/devicetree/bindings/gpio/fsl,imx-sc-gpio.yaml new file +40 -0
new file mode 100644
index 000000000000..66abff316c0c
@@ -0,0 +1,40 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/gpio/fsl,imx-sc-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,imx8qxp-sc-gpio
+      - fsl,imx-scu-gpio
+
+  "#gpio-cells":
+    const: 2
+
+  gpio-controller: true
+
+required:
+  - compatible
+  - "#gpio-cells"
+  - gpio-controller
+
+additionalProperties: false
+
+examples:
+  - |
+    gpio0: gpio {
+        compatible = "fsl,imx8qxp-sc-gpio";
+        gpio-controller;
+        #gpio-cells = <2>;
+    };
Signature · 1 line
2.25.1
#2 lore raw

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

Quoted 24 lines · Shenwei Wang

Add binding document for the imx scu gpio driver.

---
 .../bindings/gpio/fsl,imx-sc-gpio.yaml        | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/fsl,imx-sc-gpio.yaml
Documentation/devicetree/bindings/gpio/fsl,imx-sc-gpio.yaml new file +10 -0
new file mode 100644
index 000000000000..66abff316c0c
@@ -0,0 +1,40 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/gpio/fsl,imx-sc-gpio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: GPIO driver over IMX SCU firmware API
+
+maintainers:
+  - Shenwei Wang <[email protected]>

Documentation/devicetree/bindings/gpio/fsl,imx-sc-gpio.yaml line 20

Quoted 10 lines
Documentation/devicetree/bindings/gpio/fsl,imx-sc-gpio.yaml new file +10 -0
+
+description: |
+  This module provides the standard interface to control the
+  resource pins in SCU domain on i.MX8 platforms.
+
+properties:
+  compatible:
+    enum:
+      - fsl,imx8qxp-sc-gpio
+      - fsl,imx-scu-gpio

This is too generic compatible and it even conflicts with the above... Your driver binds to both without driver data which is even more confusing. Make the compatible specific for one, given SoC.

Best regards,
Krzysztof

#3 lore raw

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

Quoted 29 lines

-----Original Message-----
From: Krzysztof Kozlowski <[email protected]>
Sent: Wednesday, August 10, 2022 9:46 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]; [email protected]
Subject: [EXT] Re: [PATCH v3 1/3] dt-bindings: gpio: Add imx scu gpio driver bindings

Caution: EXT Email

Documentation/devicetree/bindings/gpio/fsl,imx-sc-gpio.yaml line 20

Quoted 10 lines · Shenwei Wang

Add binding document for the imx scu gpio driver.

---
 .../bindings/gpio/fsl,imx-sc-gpio.yaml        | 40 +++++++++++++++++++
Documentation/devicetree/bindings/gpio/fsl,imx-sc-gpio.yaml new file +5 -0
+properties:
+  compatible:
+    enum:
+      - fsl,imx8qxp-sc-gpio
+      - fsl,imx-scu-gpio
Quoted 4 lines

This is too generic compatible and it even conflicts with the above... Your driver binds to both without driver data which is even more confusing. Make the compatible specific for one, given SoC.

Oh, that's my bad. It is a typo. The generic compatible should be "fsl,imx-sc-gpio". So far there is no driver data required for both imx8qxp and imx8dxl, but it might be required sometimes later in case the scu firmware is customized for a specified use case. That's why I put the generic one here.

Thanks,
Shenwei

Quoted 3 lines

Best regards,
Krzysztof

#4 lore raw

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

Quoted 34 lines · Shenwei Wang
Quoted 29 lines

-----Original Message-----
From: Krzysztof Kozlowski <[email protected]>
Sent: Wednesday, August 10, 2022 9:46 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]; [email protected]
Subject: [EXT] Re: [PATCH v3 1/3] dt-bindings: gpio: Add imx scu gpio driver bindings

Caution: EXT Email

Documentation/devicetree/bindings/gpio/fsl,imx-sc-gpio.yaml line 20

Quoted 10 lines · Shenwei Wang

Add binding document for the imx scu gpio driver.

---
 .../bindings/gpio/fsl,imx-sc-gpio.yaml        | 40 +++++++++++++++++++
Documentation/devicetree/bindings/gpio/fsl,imx-sc-gpio.yaml new file +5 -0
+properties:
+  compatible:
+    enum:
+      - fsl,imx8qxp-sc-gpio
+      - fsl,imx-scu-gpio
Quoted 4 lines

This is too generic compatible and it even conflicts with the above... Your driver binds to both without driver data which is even more confusing. Make the compatible specific for one, given SoC.

Quoted 4 lines

Oh, that's my bad. It is a typo. The generic compatible should be "fsl,imx-sc-gpio". So far there is no driver data required for both imx8qxp and imx8dxl, but it might be required sometimes later in case the scu firmware is customized for a specified use case. That's why I put the generic one here.

That's not a proper reason to add generic one. Either all implementations are compatible or not. If you are unsure, this should be assumed as not and just use specific compatible. If you are 100% sure, then use fallback, not two compatibles, and properly justify it.

Best regards,
Krzysztof

#5 lore raw

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

Quoted 57 lines

-----Original Message-----
From: Krzysztof Kozlowski <[email protected]>
Sent: Wednesday, August 10, 2022 10:46 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]; [email protected]
Subject: Re: [EXT] Re: [PATCH v3 1/3] dt-bindings: gpio: Add imx scu gpio driver bindings

Caution: EXT Email

Quoted 31 lines · Shenwei Wang
Quoted 31 lines

-----Original Message-----
From: Krzysztof Kozlowski <[email protected]>
Sent: Wednesday, August 10, 2022 9:46 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]; [email protected]
Subject: [EXT] Re: [PATCH v3 1/3] dt-bindings: gpio: Add imx scu gpio driver bindings

Caution: EXT Email

Quoted 10 lines · Shenwei Wang

Add binding document for the imx scu gpio driver.

---
 .../bindings/gpio/fsl,imx-sc-gpio.yaml        | 40 +++++++++++++++++++
Documentation/devicetree/bindings/gpio/fsl,imx-sc-gpio.yaml new file +5 -0
+properties:
+  compatible:
+    enum:
+      - fsl,imx8qxp-sc-gpio
+      - fsl,imx-scu-gpio
Quoted 6 lines
Quoted 4 lines

This is too generic compatible and it even conflicts with the above... Your driver binds to both without driver data which is even more confusing. Make the compatible specific for one, given SoC.

Oh, that's my bad. It is a typo. The generic compatible should be "fsl,imx-sc-

gpio".

Quoted 2 lines

So far there is no driver data required for both imx8qxp and imx8dxl, but it might be required sometimes later in case the scu firmware is

Quoted 8 lines

customized for a specified use case.

Quoted 1 line

That's why I put the generic one here.

That's not a proper reason to add generic one. Either all implementations are compatible or not. If you are unsure, this should be assumed as not and just use specific compatible. If you are 100% sure, then use fallback, not two compatibles, and properly justify it.

Okay. I will only keep "fsl,imx8qxp-sc-gpio" for now.

Thanks,
Shenwei

Quoted 2 lines

Best regards,
Krzysztof

#6 lore raw

PATCH v3 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..afcfc8ea90c4 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:
+      Control the GPIO PINs on SCU domain over the 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
#7 lore raw

PATCH v3 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/gpio/Kconfig        |   4 ++
 drivers/gpio/Makefile       |   1 +
 drivers/gpio/gpio-imx-scu.c | 140 ++++++++++++++++++++++++++++++++++++
 3 files changed, 145 insertions(+)
 create mode 100644 drivers/gpio/gpio-imx-scu.c
drivers/gpio/Kconfig +4 -0
index 0499c2facbb0..b01310f6ebcc 100644
@@ -341,6 +341,10 @@ config GPIO_ICH
 
 	  If unsure, say N.
 
+config GPIO_IMX_SCU
+       def_bool y
+       depends on IMX_SCU
+
 config GPIO_IOP
 	tristate "Intel IOP GPIO"
 	depends on ARCH_IOP32X || COMPILE_TEST
drivers/gpio/Makefile +1 -0
index 3fa4f3f93d85..b39ab87793ec 100644
@@ -70,6 +70,7 @@ obj-$(CONFIG_HTC_EGPIO)			+= gpio-htc-egpio.o
 obj-$(CONFIG_GPIO_I8255)		+= gpio-i8255.o
 obj-$(CONFIG_GPIO_ICH)			+= gpio-ich.o
 obj-$(CONFIG_GPIO_IDT3243X)		+= gpio-idt3243x.o
+obj-$(CONFIG_GPIO_IMX_SCU)		+= gpio-imx-scu.o
 obj-$(CONFIG_GPIO_IOP)			+= gpio-iop.o
 obj-$(CONFIG_GPIO_IT87)			+= gpio-it87.o
 obj-$(CONFIG_GPIO_IXP4XX)		+= gpio-ixp4xx.o
drivers/gpio/gpio-imx-scu.c new file +140 -0

140 lines not on this page · raw message

Signature · 1 line
2.25.1