Skip to contentSkip to conversation

gpio: Driver for SYSCON-based GPIOs

PATCH In review Alexander Shiyan 4 participants 10 messages Jan 13, 2014 – Mar 9, 2014 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 gpio: Driver for SYSCON-based GPIOs

SYSCON driver was designed for using memory areas (registers) that are used in several subsystems. There are systems (CPUs) which use bits in one register for various purposes and thus should be handled by various kernel subsystems. This driver allows you to use the individual SYSCON bits as GPIOs. ARM CLPS711X SYSFLG1 input lines has been added as first user of this driver.

---
 .../devicetree/bindings/gpio/gpio-syscon.txt       |  19 +++
 drivers/gpio/Kconfig                               |   6 +
 drivers/gpio/Makefile                              |   1 +
 drivers/gpio/gpio-syscon.c                         | 187 +++++++++++++++++++++
 4 files changed, 213 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-syscon.txt
 create mode 100644 drivers/gpio/gpio-syscon.c
Documentation/devicetree/bindings/gpio/gpio-syscon.txt new file +19 -0
new file mode 100644
index 0000000..cad764a
@@ -0,0 +1,19 @@
+* SYSCON-based GPIO driver
+
+Required properties:
+- compatible: Should contain one of the following:
+  - "cirrus,clps711x-mctrl": For ARM CLPS711X SYSFLG1 MCTRL GPIOs.
+- syscon: phandle to syscon device node.
+- gpio-controller: Marks the device node as a gpio controller.
+- #gpio-cells: Should be two. The first cell is the pin number and
+  the second cell is used to specify the gpio polarity:
+    0 = Active high,
+    1 = Active low.
+
+Example:
+	sysgpio: sysgpio {
+		compatible = "cirrus,clps711x-mctrl";
+		syscon = <&syscon1>;
+		gpio-controller;
+		#gpio-cells = <2>;
+	};
drivers/gpio/Kconfig +6 -0
index 8c0df49..1f34bdc 100644
@@ -275,6 +275,12 @@ config GPIO_STA2X11
 	  Say yes here to support the STA2x11/ConneXt GPIO device.
 	  The GPIO module has 128 GPIO pins with alternate functions.
 
+config GPIO_SYSCON
+	tristate "GPIO based on SYSCON"
+	depends on MFD_SYSCON && OF
+	help
+	  Say yes here to support GPIO functionality though SYSCON driver.
+
 config GPIO_TS5500
 	tristate "TS-5500 DIO blocks and compatibles"
 	help
drivers/gpio/Makefile +1 -0
index 5d50179..8ae6d47 100644
@@ -76,6 +76,7 @@ obj-$(CONFIG_GPIO_STA2X11)	+= gpio-sta2x11.o
 obj-$(CONFIG_GPIO_STMPE)	+= gpio-stmpe.o
 obj-$(CONFIG_GPIO_STP_XWAY)	+= gpio-stp-xway.o
 obj-$(CONFIG_GPIO_SX150X)	+= gpio-sx150x.o
+obj-$(CONFIG_GPIO_SYSCON)	+= gpio-syscon.o
 obj-$(CONFIG_GPIO_TB10X)	+= gpio-tb10x.o
 obj-$(CONFIG_GPIO_TC3589X)	+= gpio-tc3589x.o
 obj-$(CONFIG_ARCH_TEGRA)	+= gpio-tegra.o
drivers/gpio/gpio-syscon.c new file +187 -0

187 lines not on this page · raw message

Signature · 6 lines
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw
Quoted 9 lines · Alexander Shiyan

SYSCON driver was designed for using memory areas (registers) that are used in several subsystems. There are systems (CPUs) which use bits in one register for various purposes and thus should be handled by various kernel subsystems. This driver allows you to use the individual SYSCON bits as GPIOs. ARM CLPS711X SYSFLG1 input lines has been added as first user of this driver.

Oh the pain. I am so ambivalent of this patch as it obfuscates some stuff about the hardware that the driver should know, while at the same time being elegant in a way.

What does the ARM SoC maintainers think about this approach?

Arnd, Olof, Kevin: is this something you'd like to see deployed?

Yours,
Linus Walleij

A message that is not in the archive (sent off-list or not yet received): CACRpkdaVn0iNFYKE3HXWxnb4iCJorF0HSVG4Uvz8Q18SiF5PUQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#3 lore raw
Quoted 12 lines · On Thu, 30 Jan 2014 14:54:36 +0100 Linus Walleij…
Quoted 9 lines · Alexander Shiyan

SYSCON driver was designed for using memory areas (registers) that are used in several subsystems. There are systems (CPUs) which use bits in one register for various purposes and thus should be handled by various kernel subsystems. This driver allows you to use the individual SYSCON bits as GPIOs. ARM CLPS711X SYSFLG1 input lines has been added as first user of this driver.

Quoted 7 lines

Oh the pain. I am so ambivalent of this patch as it obfuscates some stuff about the hardware that the driver should know, while at the same time being elegant in a way.

What does the ARM SoC maintainers think about this approach?

Arnd, Olof, Kevin: is this something you'd like to see deployed?

Ping.

Signature · 5 lines
Alexander Shiyan <shc_work-JGs/[email protected]>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw
In reply to Linus Walleij
Quoted 16 lines · On Thu, 30 Jan 2014 14:54:36 +0100 Linus Walleij <[email protected]>…
Quoted 9 lines · Alexander Shiyan

SYSCON driver was designed for using memory areas (registers) that are used in several subsystems. There are systems (CPUs) which use bits in one register for various purposes and thus should be handled by various kernel subsystems. This driver allows you to use the individual SYSCON bits as GPIOs. ARM CLPS711X SYSFLG1 input lines has been added as first user of this driver.

Oh the pain. I am so ambivalent of this patch as it obfuscates some stuff about the hardware that the driver should know, while at the same time being elegant in a way.

Quoted 6 lines

What does the ARM SoC maintainers think about this approach?

Arnd, Olof, Kevin: is this something you'd like to see deployed?

Yours,
Linus Walleij

Ping.

Signature · 1 line
Alexander Shiyan <[email protected]>
#5 lore raw
In reply to Linus Walleij
Quoted 12 lines · Linus Walleij
Quoted 9 lines · Alexander Shiyan

SYSCON driver was designed for using memory areas (registers) that are used in several subsystems. There are systems (CPUs) which use bits in one register for various purposes and thus should be handled by various kernel subsystems. This driver allows you to use the individual SYSCON bits as GPIOs. ARM CLPS711X SYSFLG1 input lines has been added as first user of this driver.

Quoted 7 lines

Oh the pain. I am so ambivalent of this patch as it obfuscates some stuff about the hardware that the driver should know, while at the same time being elegant in a way.

What does the ARM SoC maintainers think about this approach?

Arnd, Olof, Kevin: is this something you'd like to see deployed?

I think the binding needs to be adjusted -- syscon has nothing to do with the binding, that's a Linux construct.

Really, if this is rephrased it becomes much more clear that this is a useful driver:

CLPS711X implements a few GPIO lines in a register area that is shared with other system registers. This is a driver for those GPIO lines, implemented using the shared syscon infrastructure in the kernel.

And then take out syscon from the name of the driver (and the binding).

If we have more drivers like these down the road we can make a common shared binding, but until then I don't think there's much point in it.

-Olof

#6 lore raw
Quoted 27 lines · On Tue, 18 Feb 2014 15:25:20 -0800 Olof Johansson <[email protected]> wrote:
Quoted 12 lines · Linus Walleij
Quoted 9 lines · Alexander Shiyan

SYSCON driver was designed for using memory areas (registers) that are used in several subsystems. There are systems (CPUs) which use bits in one register for various purposes and thus should be handled by various kernel subsystems. This driver allows you to use the individual SYSCON bits as GPIOs. ARM CLPS711X SYSFLG1 input lines has been added as first user of this driver.

Quoted 7 lines

Oh the pain. I am so ambivalent of this patch as it obfuscates some stuff about the hardware that the driver should know, while at the same time being elegant in a way.

What does the ARM SoC maintainers think about this approach?

Arnd, Olof, Kevin: is this something you'd like to see deployed?

I think the binding needs to be adjusted -- syscon has nothing to do with the binding, that's a Linux construct.

Really, if this is rephrased it becomes much more clear that this is a useful driver:

Quoted 8 lines

CLPS711X implements a few GPIO lines in a register area that is shared with other system registers. This is a driver for those GPIO lines, implemented using the shared syscon infrastructure in the kernel.

And then take out syscon from the name of the driver (and the binding).

If we have more drivers like these down the road we can make a common shared binding, but until then I don't think there's much point in it.

Is this proposed to remove the generic implementation? Linus, what is your opinion on this?

Signature · 1 line
Alexander Shiyan <[email protected]>
#7 lore raw
Quoted 8 lines · Alexander Shiyan
Quoted 2 lines · On Tue, 18 Feb 2014 15:25:20 -0800 Olof Johansson <[email protected]> wrote:

If we have more drivers like these down the road we can make a common shared binding, but until then I don't think there's much point in it.

Is this proposed to remove the generic implementation? Linus, what is your opinion on this?

That is better, because it relieves me from the pain about this driver. (Sorry for slow answers.)

So instead of this:

+- compatible: Should contain one of the following:
+  - "clps711x,syscon-gpio-mctrl": For ARM CLPS711X SYSFLG1 MCTRL GPIOs.

Something more like

"cirrus,clps711x-syscon-gpio"

I guess?

Yours,
Linus Walleij

#8 lore raw

Среда, 5 марта 2014, 9:11 +08:00 от Linus Walleij <[email protected]>:

Quoted 15 lines · Alexander Shiyan
Quoted 8 lines
Quoted 2 lines · On Tue, 18 Feb 2014 15:25:20 -0800 Olof Johansson <[email protected]> wrote:

If we have more drivers like these down the road we can make a common shared binding, but until then I don't think there's much point in it.

Is this proposed to remove the generic implementation? Linus, what is your opinion on this?

That is better, because it relieves me from the pain about this driver. (Sorry for slow answers.)

So instead of this:

Quoted 8 lines
+- compatible: Should contain one of the following:
+  - "clps711x,syscon-gpio-mctrl": For ARM CLPS711X SYSFLG1 MCTRL GPIOs.

Something more like

"cirrus,clps711x-syscon-gpio"

I guess?

I think that Olof meant to completely remove the concept of "syscon" from the DT description.
This can be done by changing the compatibility string with "cirrus,clps711x-mctrl-gpio" for my case and hide "syscon" in the internal structure of the driver to use the syscon_regmap_lookup_by_compatible() function.
If so, then I'll make the next version.

---

#9 lore raw
Quoted 6 lines · Alexander Shiyan

I think that Olof meant to completely remove the concept of "syscon" from the DT description.
This can be done by changing the compatibility string with "cirrus,clps711x-mctrl-gpio" for my case and hide "syscon" in the internal structure of the driver to use the syscon_regmap_lookup_by_compatible() function.
If so, then I'll make the next version.

OK sounds like a plan.

Yours,
Linus Walleij

#10 lore raw
Quoted 10 lines · Linus Walleij
Quoted 6 lines · Alexander Shiyan

I think that Olof meant to completely remove the concept of "syscon" from the DT description.
This can be done by changing the compatibility string with "cirrus,clps711x-mctrl-gpio" for my case and hide "syscon" in the internal structure of the driver to use the syscon_regmap_lookup_by_compatible() function.
If so, then I'll make the next version.

OK sounds like a plan.

Yep, agreed. Syscon as a term is a linux-side construct, and not something we should necessarily have carry over in mindings and DT names.

-Olof