All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] gpio: gemini: augment DT bindings
@ 2017-03-12 23:28 ` Linus Walleij
  0 siblings, 0 replies; 22+ messages in thread
From: Linus Walleij @ 2017-03-12 23:28 UTC (permalink / raw)
  To: Hans Ulli Kroll, Florian Fainelli, Jonas Jensen, Alexandre Courbot
  Cc: openwrt-devel, devicetree, Paulius Zaleckas, linux-gpio,
	Janos Laube, linux-arm-kernel

The DT bindings assumed that this IP block was coming from
Cortina Systems, which turns out not to be true. It is a
standard IP block from Faraday Technology and also used in the
Moxa moxart SoC.

We augment the bindings to cover all existing parts and rename
it after the IP block. This involves deleting the old Moxa
bindings that now are contained in this binding.

Cc: devicetree@vger.kernel.org
Cc: Jonas Jensen <jonas.jensen@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 ...{cortina,gemini-gpio.txt => faraday,ftgpio010.txt} |  9 ++++++---
 .../devicetree/bindings/gpio/moxa,moxart-gpio.txt     | 19 -------------------
 2 files changed, 6 insertions(+), 22 deletions(-)
 rename Documentation/devicetree/bindings/gpio/{cortina,gemini-gpio.txt => faraday,ftgpio010.txt} (70%)
 delete mode 100644 Documentation/devicetree/bindings/gpio/moxa,moxart-gpio.txt

diff --git a/Documentation/devicetree/bindings/gpio/cortina,gemini-gpio.txt b/Documentation/devicetree/bindings/gpio/faraday,ftgpio010.txt
similarity index 70%
rename from Documentation/devicetree/bindings/gpio/cortina,gemini-gpio.txt
rename to Documentation/devicetree/bindings/gpio/faraday,ftgpio010.txt
index 5c9246c054e5..d04236558619 100644
--- a/Documentation/devicetree/bindings/gpio/cortina,gemini-gpio.txt
+++ b/Documentation/devicetree/bindings/gpio/faraday,ftgpio010.txt
@@ -1,8 +1,11 @@
-Cortina Systems Gemini GPIO Controller
+Faraday Technology FTGPIO010 GPIO Controller
 
 Required properties:
 
-- compatible : Must be "cortina,gemini-gpio"
+- compatible : Should be one of
+  "cortina,gemini-gpio", "faraday,ftgpio010"
+  "moxa,moxart-gpio", "faraday,ftgpio010"
+  "faraday,ftgpio010"
 - reg : Should contain registers location and length
 - interrupts : Should contain the interrupt line for the GPIO block
 - gpio-controller : marks this as a GPIO controller
@@ -14,7 +17,7 @@ Required properties:
 Example:
 
 gpio@4d000000 {
-	compatible = "cortina,gemini-gpio";
+	compatible = "cortina,gemini-gpio", "faraday,ftgpio010";
 	reg = <0x4d000000 0x100>;
 	interrupts = <22 IRQ_TYPE_LEVEL_HIGH>;
 	gpio-controller;
diff --git a/Documentation/devicetree/bindings/gpio/moxa,moxart-gpio.txt b/Documentation/devicetree/bindings/gpio/moxa,moxart-gpio.txt
deleted file mode 100644
index f8e8f185a3db..000000000000
--- a/Documentation/devicetree/bindings/gpio/moxa,moxart-gpio.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-MOXA ART GPIO Controller
-
-Required properties:
-
-- #gpio-cells : Should be 2, The first cell is the pin number,
-		the second cell is used to specify polarity:
-			0 = active high
-			1 = active low
-- compatible : Must be "moxa,moxart-gpio"
-- reg : Should contain registers location and length
-
-Example:
-
-	gpio: gpio@98700000 {
-		gpio-controller;
-		#gpio-cells = <2>;
-		compatible = "moxa,moxart-gpio";
-		reg =	<0x98700000 0xC>;
-	};
-- 
2.9.3
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 1/6] gpio: gemini: augment DT bindings
@ 2017-03-12 23:28 ` Linus Walleij
  0 siblings, 0 replies; 22+ messages in thread
From: Linus Walleij @ 2017-03-12 23:28 UTC (permalink / raw)
  To: linux-arm-kernel

The DT bindings assumed that this IP block was coming from
Cortina Systems, which turns out not to be true. It is a
standard IP block from Faraday Technology and also used in the
Moxa moxart SoC.

We augment the bindings to cover all existing parts and rename
it after the IP block. This involves deleting the old Moxa
bindings that now are contained in this binding.

Cc: devicetree at vger.kernel.org
Cc: Jonas Jensen <jonas.jensen@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 ...{cortina,gemini-gpio.txt => faraday,ftgpio010.txt} |  9 ++++++---
 .../devicetree/bindings/gpio/moxa,moxart-gpio.txt     | 19 -------------------
 2 files changed, 6 insertions(+), 22 deletions(-)
 rename Documentation/devicetree/bindings/gpio/{cortina,gemini-gpio.txt => faraday,ftgpio010.txt} (70%)
 delete mode 100644 Documentation/devicetree/bindings/gpio/moxa,moxart-gpio.txt

diff --git a/Documentation/devicetree/bindings/gpio/cortina,gemini-gpio.txt b/Documentation/devicetree/bindings/gpio/faraday,ftgpio010.txt
similarity index 70%
rename from Documentation/devicetree/bindings/gpio/cortina,gemini-gpio.txt
rename to Documentation/devicetree/bindings/gpio/faraday,ftgpio010.txt
index 5c9246c054e5..d04236558619 100644
--- a/Documentation/devicetree/bindings/gpio/cortina,gemini-gpio.txt
+++ b/Documentation/devicetree/bindings/gpio/faraday,ftgpio010.txt
@@ -1,8 +1,11 @@
-Cortina Systems Gemini GPIO Controller
+Faraday Technology FTGPIO010 GPIO Controller
 
 Required properties:
 
-- compatible : Must be "cortina,gemini-gpio"
+- compatible : Should be one of
+  "cortina,gemini-gpio", "faraday,ftgpio010"
+  "moxa,moxart-gpio", "faraday,ftgpio010"
+  "faraday,ftgpio010"
 - reg : Should contain registers location and length
 - interrupts : Should contain the interrupt line for the GPIO block
 - gpio-controller : marks this as a GPIO controller
@@ -14,7 +17,7 @@ Required properties:
 Example:
 
 gpio at 4d000000 {
-	compatible = "cortina,gemini-gpio";
+	compatible = "cortina,gemini-gpio", "faraday,ftgpio010";
 	reg = <0x4d000000 0x100>;
 	interrupts = <22 IRQ_TYPE_LEVEL_HIGH>;
 	gpio-controller;
diff --git a/Documentation/devicetree/bindings/gpio/moxa,moxart-gpio.txt b/Documentation/devicetree/bindings/gpio/moxa,moxart-gpio.txt
deleted file mode 100644
index f8e8f185a3db..000000000000
--- a/Documentation/devicetree/bindings/gpio/moxa,moxart-gpio.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-MOXA ART GPIO Controller
-
-Required properties:
-
-- #gpio-cells : Should be 2, The first cell is the pin number,
-		the second cell is used to specify polarity:
-			0 = active high
-			1 = active low
-- compatible : Must be "moxa,moxart-gpio"
-- reg : Should contain registers location and length
-
-Example:
-
-	gpio: gpio at 98700000 {
-		gpio-controller;
-		#gpio-cells = <2>;
-		compatible = "moxa,moxart-gpio";
-		reg =	<0x98700000 0xC>;
-	};
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 2/6] ARM: dts: augment Gemini GPIO nodes
  2017-03-12 23:28 ` Linus Walleij
@ 2017-03-12 23:28   ` Linus Walleij
  -1 siblings, 0 replies; 22+ messages in thread
From: Linus Walleij @ 2017-03-12 23:28 UTC (permalink / raw)
  To: Hans Ulli Kroll, Florian Fainelli, Jonas Jensen, Alexandre Courbot
  Cc: Janos Laube, Paulius Zaleckas, openwrt-devel, linux-arm-kernel,
	linux-gpio, Linus Walleij

The binding should state "cortina,gemini-gpio", "faraday,ftgpio010"
stating the full name of the IP part.

Cc: Jonas Jensen <jonas.jensen@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 arch/arm/boot/dts/gemini.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/gemini.dtsi b/arch/arm/boot/dts/gemini.dtsi
index 67c0a63d5527..b8d011bdcc76 100644
--- a/arch/arm/boot/dts/gemini.dtsi
+++ b/arch/arm/boot/dts/gemini.dtsi
@@ -82,7 +82,7 @@
 		};
 
 		gpio0: gpio@4d000000 {
-			compatible = "cortina,gemini-gpio";
+			compatible = "cortina,gemini-gpio", "faraday,ftgpio010";
 			reg = <0x4d000000 0x100>;
 			interrupts = <22 IRQ_TYPE_LEVEL_HIGH>;
 			gpio-controller;
@@ -92,7 +92,7 @@
 		};
 
 		gpio1: gpio@4e000000 {
-			compatible = "cortina,gemini-gpio";
+			compatible = "cortina,gemini-gpio", "faraday,ftgpio010";
 			reg = <0x4e000000 0x100>;
 			interrupts = <23 IRQ_TYPE_LEVEL_HIGH>;
 			gpio-controller;
@@ -102,7 +102,7 @@
 		};
 
 		gpio2: gpio@4f000000 {
-			compatible = "cortina,gemini-gpio";
+			compatible = "cortina,gemini-gpio", "faraday,ftgpio010";
 			reg = <0x4f000000 0x100>;
 			interrupts = <24 IRQ_TYPE_LEVEL_HIGH>;
 			gpio-controller;
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 2/6] ARM: dts: augment Gemini GPIO nodes
@ 2017-03-12 23:28   ` Linus Walleij
  0 siblings, 0 replies; 22+ messages in thread
From: Linus Walleij @ 2017-03-12 23:28 UTC (permalink / raw)
  To: linux-arm-kernel

The binding should state "cortina,gemini-gpio", "faraday,ftgpio010"
stating the full name of the IP part.

Cc: Jonas Jensen <jonas.jensen@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 arch/arm/boot/dts/gemini.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/gemini.dtsi b/arch/arm/boot/dts/gemini.dtsi
index 67c0a63d5527..b8d011bdcc76 100644
--- a/arch/arm/boot/dts/gemini.dtsi
+++ b/arch/arm/boot/dts/gemini.dtsi
@@ -82,7 +82,7 @@
 		};
 
 		gpio0: gpio at 4d000000 {
-			compatible = "cortina,gemini-gpio";
+			compatible = "cortina,gemini-gpio", "faraday,ftgpio010";
 			reg = <0x4d000000 0x100>;
 			interrupts = <22 IRQ_TYPE_LEVEL_HIGH>;
 			gpio-controller;
@@ -92,7 +92,7 @@
 		};
 
 		gpio1: gpio at 4e000000 {
-			compatible = "cortina,gemini-gpio";
+			compatible = "cortina,gemini-gpio", "faraday,ftgpio010";
 			reg = <0x4e000000 0x100>;
 			interrupts = <23 IRQ_TYPE_LEVEL_HIGH>;
 			gpio-controller;
@@ -102,7 +102,7 @@
 		};
 
 		gpio2: gpio at 4f000000 {
-			compatible = "cortina,gemini-gpio";
+			compatible = "cortina,gemini-gpio", "faraday,ftgpio010";
 			reg = <0x4f000000 0x100>;
 			interrupts = <24 IRQ_TYPE_LEVEL_HIGH>;
 			gpio-controller;
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 3/6] ARM: dts: augment Moxa ART GPIO node
  2017-03-12 23:28 ` Linus Walleij
@ 2017-03-12 23:28   ` Linus Walleij
  -1 siblings, 0 replies; 22+ messages in thread
From: Linus Walleij @ 2017-03-12 23:28 UTC (permalink / raw)
  To: Hans Ulli Kroll, Florian Fainelli, Jonas Jensen, Alexandre Courbot
  Cc: Janos Laube, Paulius Zaleckas, openwrt-devel, linux-arm-kernel,
	linux-gpio, Linus Walleij

The Moxa ART GPIO is a Faraday FTGPIO010. Augment the DTS node
to indicate both compatible values for the SoC and the IP part.
Also increase the register range to 0x100, it has at least 0x48
bytes of registers, and a few extra will not hurt.

Cc: Jonas Jensen <jonas.jensen@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 arch/arm/boot/dts/moxart.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/moxart.dtsi b/arch/arm/boot/dts/moxart.dtsi
index 1fd27ed65a01..10a8184e0ce9 100644
--- a/arch/arm/boot/dts/moxart.dtsi
+++ b/arch/arm/boot/dts/moxart.dtsi
@@ -66,8 +66,8 @@
 		gpio: gpio@98700000 {
 			gpio-controller;
 			#gpio-cells = <2>;
-			compatible = "moxa,moxart-gpio";
-			reg = <0x98700000 0xC>;
+			compatible = "moxa,moxart-gpio", "faraday,ftgpio010";
+			reg = <0x98700000 0x100>;
 		};
 
 		rtc: rtc {
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 3/6] ARM: dts: augment Moxa ART GPIO node
@ 2017-03-12 23:28   ` Linus Walleij
  0 siblings, 0 replies; 22+ messages in thread
From: Linus Walleij @ 2017-03-12 23:28 UTC (permalink / raw)
  To: linux-arm-kernel

The Moxa ART GPIO is a Faraday FTGPIO010. Augment the DTS node
to indicate both compatible values for the SoC and the IP part.
Also increase the register range to 0x100, it has at least 0x48
bytes of registers, and a few extra will not hurt.

Cc: Jonas Jensen <jonas.jensen@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 arch/arm/boot/dts/moxart.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/moxart.dtsi b/arch/arm/boot/dts/moxart.dtsi
index 1fd27ed65a01..10a8184e0ce9 100644
--- a/arch/arm/boot/dts/moxart.dtsi
+++ b/arch/arm/boot/dts/moxart.dtsi
@@ -66,8 +66,8 @@
 		gpio: gpio at 98700000 {
 			gpio-controller;
 			#gpio-cells = <2>;
-			compatible = "moxa,moxart-gpio";
-			reg = <0x98700000 0xC>;
+			compatible = "moxa,moxart-gpio", "faraday,ftgpio010";
+			reg = <0x98700000 0x100>;
 		};
 
 		rtc: rtc {
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 4/6] gpio: gemini: rename to match Faraday IP
  2017-03-12 23:28 ` Linus Walleij
@ 2017-03-12 23:28   ` Linus Walleij
  -1 siblings, 0 replies; 22+ messages in thread
From: Linus Walleij @ 2017-03-12 23:28 UTC (permalink / raw)
  To: Hans Ulli Kroll, Florian Fainelli, Jonas Jensen, Alexandre Courbot
  Cc: Janos Laube, Paulius Zaleckas, openwrt-devel, linux-arm-kernel,
	linux-gpio, Linus Walleij

The Gemini driver is actually a driver for the Faraday Technology
FTGPIO010 IP block. We rename the driver and the Kconfig symbol and
put in a a new compatible string for the Moxa ART SoC that is also
using this IP block.

Cc: Jonas Jensen <jonas.jensen@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/gpio/Kconfig                             |  7 ++-
 drivers/gpio/Makefile                            |  2 +-
 drivers/gpio/{gpio-gemini.c => gpio-ftgpio010.c} | 72 +++++++++++++-----------
 3 files changed, 44 insertions(+), 37 deletions(-)
 rename drivers/gpio/{gpio-gemini.c => gpio-ftgpio010.c} (73%)

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 05043071fc98..82ba825c224a 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -204,14 +204,15 @@ config GPIO_GE_FPGA
 	  and write pin state) for GPIO implemented in a number of GE single
 	  board computers.
 
-config GPIO_GEMINI
-	bool "Gemini GPIO"
+config GPIO_FTGPIO010
+	bool "Faraday FTGPIO010 GPIO"
 	depends on ARCH_GEMINI
 	depends on OF_GPIO
 	select GPIO_GENERIC
 	select GPIOLIB_IRQCHIP
 	help
-	  Support for common GPIOs found in Cortina systems Gemini platforms.
+	  Support for common GPIOs from the Faraday FTGPIO010 IP core, found in
+	  Cortina systems Gemini platforms, Moxa ART and others.
 
 config GPIO_GENERIC_PLATFORM
 	tristate "Generic memory-mapped GPIO controller support (MMIO platform device)"
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index becb96c724fe..4b904fec8273 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -48,8 +48,8 @@ obj-$(CONFIG_GPIO_EP93XX)	+= gpio-ep93xx.o
 obj-$(CONFIG_GPIO_ETRAXFS)	+= gpio-etraxfs.o
 obj-$(CONFIG_GPIO_EXAR)		+= gpio-exar.o
 obj-$(CONFIG_GPIO_F7188X)	+= gpio-f7188x.o
+obj-$(CONFIG_GPIO_FTGPIO010)	+= gpio-ftgpio010.o
 obj-$(CONFIG_GPIO_GE_FPGA)	+= gpio-ge.o
-obj-$(CONFIG_GPIO_GEMINI)	+= gpio-gemini.o
 obj-$(CONFIG_GPIO_GPIO_MM)	+= gpio-gpio-mm.o
 obj-$(CONFIG_GPIO_GRGPIO)	+= gpio-grgpio.o
 obj-$(CONFIG_HTC_EGPIO)		+= gpio-htc-egpio.o
diff --git a/drivers/gpio/gpio-gemini.c b/drivers/gpio/gpio-ftgpio010.c
similarity index 73%
rename from drivers/gpio/gpio-gemini.c
rename to drivers/gpio/gpio-ftgpio010.c
index 962485163b7f..e9386f8b67f5 100644
--- a/drivers/gpio/gpio-gemini.c
+++ b/drivers/gpio/gpio-ftgpio010.c
@@ -1,5 +1,5 @@
 /*
- * Gemini gpiochip and interrupt routines
+ * Faraday Technolog FTGPIO010 gpiochip and interrupt routines
  * Copyright (C) 2017 Linus Walleij <linus.walleij@linaro.org>
  *
  * Based on arch/arm/mach-gemini/gpio.c:
@@ -35,28 +35,28 @@
 #define GPIO_DEBOUNCE_PRESCALE	0x44
 
 /**
- * struct gemini_gpio - Gemini GPIO state container
+ * struct ftgpio_gpio - Gemini GPIO state container
  * @dev: containing device for this instance
  * @gc: gpiochip for this instance
  */
-struct gemini_gpio {
+struct ftgpio_gpio {
 	struct device *dev;
 	struct gpio_chip gc;
 	void __iomem *base;
 };
 
-static void gemini_gpio_ack_irq(struct irq_data *d)
+static void ftgpio_gpio_ack_irq(struct irq_data *d)
 {
 	struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
-	struct gemini_gpio *g = gpiochip_get_data(gc);
+	struct ftgpio_gpio *g = gpiochip_get_data(gc);
 
 	writel(BIT(irqd_to_hwirq(d)), g->base + GPIO_INT_CLR);
 }
 
-static void gemini_gpio_mask_irq(struct irq_data *d)
+static void ftgpio_gpio_mask_irq(struct irq_data *d)
 {
 	struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
-	struct gemini_gpio *g = gpiochip_get_data(gc);
+	struct ftgpio_gpio *g = gpiochip_get_data(gc);
 	u32 val;
 
 	val = readl(g->base + GPIO_INT_EN);
@@ -64,10 +64,10 @@ static void gemini_gpio_mask_irq(struct irq_data *d)
 	writel(val, g->base + GPIO_INT_EN);
 }
 
-static void gemini_gpio_unmask_irq(struct irq_data *d)
+static void ftgpio_gpio_unmask_irq(struct irq_data *d)
 {
 	struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
-	struct gemini_gpio *g = gpiochip_get_data(gc);
+	struct ftgpio_gpio *g = gpiochip_get_data(gc);
 	u32 val;
 
 	val = readl(g->base + GPIO_INT_EN);
@@ -75,10 +75,10 @@ static void gemini_gpio_unmask_irq(struct irq_data *d)
 	writel(val, g->base + GPIO_INT_EN);
 }
 
-static int gemini_gpio_set_irq_type(struct irq_data *d, unsigned int type)
+static int ftgpio_gpio_set_irq_type(struct irq_data *d, unsigned int type)
 {
 	struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
-	struct gemini_gpio *g = gpiochip_get_data(gc);
+	struct ftgpio_gpio *g = gpiochip_get_data(gc);
 	u32 mask = BIT(irqd_to_hwirq(d));
 	u32 reg_both, reg_level, reg_type;
 
@@ -123,23 +123,23 @@ static int gemini_gpio_set_irq_type(struct irq_data *d, unsigned int type)
 	writel(reg_level, g->base + GPIO_INT_LEVEL);
 	writel(reg_both, g->base + GPIO_INT_BOTH_EDGE);
 
-	gemini_gpio_ack_irq(d);
+	ftgpio_gpio_ack_irq(d);
 
 	return 0;
 }
 
-static struct irq_chip gemini_gpio_irqchip = {
-	.name = "GPIO",
-	.irq_ack = gemini_gpio_ack_irq,
-	.irq_mask = gemini_gpio_mask_irq,
-	.irq_unmask = gemini_gpio_unmask_irq,
-	.irq_set_type = gemini_gpio_set_irq_type,
+static struct irq_chip ftgpio_gpio_irqchip = {
+	.name = "FTGPIO010",
+	.irq_ack = ftgpio_gpio_ack_irq,
+	.irq_mask = ftgpio_gpio_mask_irq,
+	.irq_unmask = ftgpio_gpio_unmask_irq,
+	.irq_set_type = ftgpio_gpio_set_irq_type,
 };
 
-static void gemini_gpio_irq_handler(struct irq_desc *desc)
+static void ftgpio_gpio_irq_handler(struct irq_desc *desc)
 {
 	struct gpio_chip *gc = irq_desc_get_handler_data(desc);
-	struct gemini_gpio *g = gpiochip_get_data(gc);
+	struct ftgpio_gpio *g = gpiochip_get_data(gc);
 	struct irq_chip *irqchip = irq_desc_get_chip(desc);
 	int offset;
 	unsigned long stat;
@@ -155,11 +155,11 @@ static void gemini_gpio_irq_handler(struct irq_desc *desc)
 	chained_irq_exit(irqchip, desc);
 }
 
-static int gemini_gpio_probe(struct platform_device *pdev)
+static int ftgpio_gpio_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct resource *res;
-	struct gemini_gpio *g;
+	struct ftgpio_gpio *g;
 	int irq;
 	int ret;
 
@@ -189,7 +189,7 @@ static int gemini_gpio_probe(struct platform_device *pdev)
 		dev_err(dev, "unable to init generic GPIO\n");
 		return ret;
 	}
-	g->gc.label = "Gemini";
+	g->gc.label = "FTGPIO010";
 	g->gc.base = -1;
 	g->gc.parent = dev;
 	g->gc.owner = THIS_MODULE;
@@ -204,33 +204,39 @@ static int gemini_gpio_probe(struct platform_device *pdev)
 	writel(0x0, g->base + GPIO_INT_MASK);
 	writel(~0x0, g->base + GPIO_INT_CLR);
 
-	ret = gpiochip_irqchip_add(&g->gc, &gemini_gpio_irqchip,
+	ret = gpiochip_irqchip_add(&g->gc, &ftgpio_gpio_irqchip,
 				   0, handle_bad_irq,
 				   IRQ_TYPE_NONE);
 	if (ret) {
 		dev_info(dev, "could not add irqchip\n");
 		return ret;
 	}
-	gpiochip_set_chained_irqchip(&g->gc, &gemini_gpio_irqchip,
-				     irq, gemini_gpio_irq_handler);
+	gpiochip_set_chained_irqchip(&g->gc, &ftgpio_gpio_irqchip,
+				     irq, ftgpio_gpio_irq_handler);
 
-	dev_info(dev, "Gemini GPIO @%p registered\n", g->base);
+	dev_info(dev, "FTGPIO010 @%p registered\n", g->base);
 
 	return 0;
 }
 
-static const struct of_device_id gemini_gpio_of_match[] = {
+static const struct of_device_id ftgpio_gpio_of_match[] = {
 	{
 		.compatible = "cortina,gemini-gpio",
 	},
+	{
+		.compatible = "moxa,moxart-gpio",
+	},
+	{
+		.compatible = "faraday,ftgpio010",
+	},
 	{},
 };
 
-static struct platform_driver gemini_gpio_driver = {
+static struct platform_driver ftgpio_gpio_driver = {
 	.driver = {
-		.name		= "gemini-gpio",
-		.of_match_table = of_match_ptr(gemini_gpio_of_match),
+		.name		= "ftgpio010-gpio",
+		.of_match_table = of_match_ptr(ftgpio_gpio_of_match),
 	},
-	.probe	= gemini_gpio_probe,
+	.probe	= ftgpio_gpio_probe,
 };
-builtin_platform_driver(gemini_gpio_driver);
+builtin_platform_driver(ftgpio_gpio_driver);
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 4/6] gpio: gemini: rename to match Faraday IP
@ 2017-03-12 23:28   ` Linus Walleij
  0 siblings, 0 replies; 22+ messages in thread
From: Linus Walleij @ 2017-03-12 23:28 UTC (permalink / raw)
  To: linux-arm-kernel

The Gemini driver is actually a driver for the Faraday Technology
FTGPIO010 IP block. We rename the driver and the Kconfig symbol and
put in a a new compatible string for the Moxa ART SoC that is also
using this IP block.

Cc: Jonas Jensen <jonas.jensen@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/gpio/Kconfig                             |  7 ++-
 drivers/gpio/Makefile                            |  2 +-
 drivers/gpio/{gpio-gemini.c => gpio-ftgpio010.c} | 72 +++++++++++++-----------
 3 files changed, 44 insertions(+), 37 deletions(-)
 rename drivers/gpio/{gpio-gemini.c => gpio-ftgpio010.c} (73%)

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 05043071fc98..82ba825c224a 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -204,14 +204,15 @@ config GPIO_GE_FPGA
 	  and write pin state) for GPIO implemented in a number of GE single
 	  board computers.
 
-config GPIO_GEMINI
-	bool "Gemini GPIO"
+config GPIO_FTGPIO010
+	bool "Faraday FTGPIO010 GPIO"
 	depends on ARCH_GEMINI
 	depends on OF_GPIO
 	select GPIO_GENERIC
 	select GPIOLIB_IRQCHIP
 	help
-	  Support for common GPIOs found in Cortina systems Gemini platforms.
+	  Support for common GPIOs from the Faraday FTGPIO010 IP core, found in
+	  Cortina systems Gemini platforms, Moxa ART and others.
 
 config GPIO_GENERIC_PLATFORM
 	tristate "Generic memory-mapped GPIO controller support (MMIO platform device)"
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index becb96c724fe..4b904fec8273 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -48,8 +48,8 @@ obj-$(CONFIG_GPIO_EP93XX)	+= gpio-ep93xx.o
 obj-$(CONFIG_GPIO_ETRAXFS)	+= gpio-etraxfs.o
 obj-$(CONFIG_GPIO_EXAR)		+= gpio-exar.o
 obj-$(CONFIG_GPIO_F7188X)	+= gpio-f7188x.o
+obj-$(CONFIG_GPIO_FTGPIO010)	+= gpio-ftgpio010.o
 obj-$(CONFIG_GPIO_GE_FPGA)	+= gpio-ge.o
-obj-$(CONFIG_GPIO_GEMINI)	+= gpio-gemini.o
 obj-$(CONFIG_GPIO_GPIO_MM)	+= gpio-gpio-mm.o
 obj-$(CONFIG_GPIO_GRGPIO)	+= gpio-grgpio.o
 obj-$(CONFIG_HTC_EGPIO)		+= gpio-htc-egpio.o
diff --git a/drivers/gpio/gpio-gemini.c b/drivers/gpio/gpio-ftgpio010.c
similarity index 73%
rename from drivers/gpio/gpio-gemini.c
rename to drivers/gpio/gpio-ftgpio010.c
index 962485163b7f..e9386f8b67f5 100644
--- a/drivers/gpio/gpio-gemini.c
+++ b/drivers/gpio/gpio-ftgpio010.c
@@ -1,5 +1,5 @@
 /*
- * Gemini gpiochip and interrupt routines
+ * Faraday Technolog FTGPIO010 gpiochip and interrupt routines
  * Copyright (C) 2017 Linus Walleij <linus.walleij@linaro.org>
  *
  * Based on arch/arm/mach-gemini/gpio.c:
@@ -35,28 +35,28 @@
 #define GPIO_DEBOUNCE_PRESCALE	0x44
 
 /**
- * struct gemini_gpio - Gemini GPIO state container
+ * struct ftgpio_gpio - Gemini GPIO state container
  * @dev: containing device for this instance
  * @gc: gpiochip for this instance
  */
-struct gemini_gpio {
+struct ftgpio_gpio {
 	struct device *dev;
 	struct gpio_chip gc;
 	void __iomem *base;
 };
 
-static void gemini_gpio_ack_irq(struct irq_data *d)
+static void ftgpio_gpio_ack_irq(struct irq_data *d)
 {
 	struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
-	struct gemini_gpio *g = gpiochip_get_data(gc);
+	struct ftgpio_gpio *g = gpiochip_get_data(gc);
 
 	writel(BIT(irqd_to_hwirq(d)), g->base + GPIO_INT_CLR);
 }
 
-static void gemini_gpio_mask_irq(struct irq_data *d)
+static void ftgpio_gpio_mask_irq(struct irq_data *d)
 {
 	struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
-	struct gemini_gpio *g = gpiochip_get_data(gc);
+	struct ftgpio_gpio *g = gpiochip_get_data(gc);
 	u32 val;
 
 	val = readl(g->base + GPIO_INT_EN);
@@ -64,10 +64,10 @@ static void gemini_gpio_mask_irq(struct irq_data *d)
 	writel(val, g->base + GPIO_INT_EN);
 }
 
-static void gemini_gpio_unmask_irq(struct irq_data *d)
+static void ftgpio_gpio_unmask_irq(struct irq_data *d)
 {
 	struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
-	struct gemini_gpio *g = gpiochip_get_data(gc);
+	struct ftgpio_gpio *g = gpiochip_get_data(gc);
 	u32 val;
 
 	val = readl(g->base + GPIO_INT_EN);
@@ -75,10 +75,10 @@ static void gemini_gpio_unmask_irq(struct irq_data *d)
 	writel(val, g->base + GPIO_INT_EN);
 }
 
-static int gemini_gpio_set_irq_type(struct irq_data *d, unsigned int type)
+static int ftgpio_gpio_set_irq_type(struct irq_data *d, unsigned int type)
 {
 	struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
-	struct gemini_gpio *g = gpiochip_get_data(gc);
+	struct ftgpio_gpio *g = gpiochip_get_data(gc);
 	u32 mask = BIT(irqd_to_hwirq(d));
 	u32 reg_both, reg_level, reg_type;
 
@@ -123,23 +123,23 @@ static int gemini_gpio_set_irq_type(struct irq_data *d, unsigned int type)
 	writel(reg_level, g->base + GPIO_INT_LEVEL);
 	writel(reg_both, g->base + GPIO_INT_BOTH_EDGE);
 
-	gemini_gpio_ack_irq(d);
+	ftgpio_gpio_ack_irq(d);
 
 	return 0;
 }
 
-static struct irq_chip gemini_gpio_irqchip = {
-	.name = "GPIO",
-	.irq_ack = gemini_gpio_ack_irq,
-	.irq_mask = gemini_gpio_mask_irq,
-	.irq_unmask = gemini_gpio_unmask_irq,
-	.irq_set_type = gemini_gpio_set_irq_type,
+static struct irq_chip ftgpio_gpio_irqchip = {
+	.name = "FTGPIO010",
+	.irq_ack = ftgpio_gpio_ack_irq,
+	.irq_mask = ftgpio_gpio_mask_irq,
+	.irq_unmask = ftgpio_gpio_unmask_irq,
+	.irq_set_type = ftgpio_gpio_set_irq_type,
 };
 
-static void gemini_gpio_irq_handler(struct irq_desc *desc)
+static void ftgpio_gpio_irq_handler(struct irq_desc *desc)
 {
 	struct gpio_chip *gc = irq_desc_get_handler_data(desc);
-	struct gemini_gpio *g = gpiochip_get_data(gc);
+	struct ftgpio_gpio *g = gpiochip_get_data(gc);
 	struct irq_chip *irqchip = irq_desc_get_chip(desc);
 	int offset;
 	unsigned long stat;
@@ -155,11 +155,11 @@ static void gemini_gpio_irq_handler(struct irq_desc *desc)
 	chained_irq_exit(irqchip, desc);
 }
 
-static int gemini_gpio_probe(struct platform_device *pdev)
+static int ftgpio_gpio_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct resource *res;
-	struct gemini_gpio *g;
+	struct ftgpio_gpio *g;
 	int irq;
 	int ret;
 
@@ -189,7 +189,7 @@ static int gemini_gpio_probe(struct platform_device *pdev)
 		dev_err(dev, "unable to init generic GPIO\n");
 		return ret;
 	}
-	g->gc.label = "Gemini";
+	g->gc.label = "FTGPIO010";
 	g->gc.base = -1;
 	g->gc.parent = dev;
 	g->gc.owner = THIS_MODULE;
@@ -204,33 +204,39 @@ static int gemini_gpio_probe(struct platform_device *pdev)
 	writel(0x0, g->base + GPIO_INT_MASK);
 	writel(~0x0, g->base + GPIO_INT_CLR);
 
-	ret = gpiochip_irqchip_add(&g->gc, &gemini_gpio_irqchip,
+	ret = gpiochip_irqchip_add(&g->gc, &ftgpio_gpio_irqchip,
 				   0, handle_bad_irq,
 				   IRQ_TYPE_NONE);
 	if (ret) {
 		dev_info(dev, "could not add irqchip\n");
 		return ret;
 	}
-	gpiochip_set_chained_irqchip(&g->gc, &gemini_gpio_irqchip,
-				     irq, gemini_gpio_irq_handler);
+	gpiochip_set_chained_irqchip(&g->gc, &ftgpio_gpio_irqchip,
+				     irq, ftgpio_gpio_irq_handler);
 
-	dev_info(dev, "Gemini GPIO @%p registered\n", g->base);
+	dev_info(dev, "FTGPIO010 @%p registered\n", g->base);
 
 	return 0;
 }
 
-static const struct of_device_id gemini_gpio_of_match[] = {
+static const struct of_device_id ftgpio_gpio_of_match[] = {
 	{
 		.compatible = "cortina,gemini-gpio",
 	},
+	{
+		.compatible = "moxa,moxart-gpio",
+	},
+	{
+		.compatible = "faraday,ftgpio010",
+	},
 	{},
 };
 
-static struct platform_driver gemini_gpio_driver = {
+static struct platform_driver ftgpio_gpio_driver = {
 	.driver = {
-		.name		= "gemini-gpio",
-		.of_match_table = of_match_ptr(gemini_gpio_of_match),
+		.name		= "ftgpio010-gpio",
+		.of_match_table = of_match_ptr(ftgpio_gpio_of_match),
 	},
-	.probe	= gemini_gpio_probe,
+	.probe	= ftgpio_gpio_probe,
 };
-builtin_platform_driver(gemini_gpio_driver);
+builtin_platform_driver(ftgpio_gpio_driver);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 5/6] gpio: moxart: Switch to using the FTGPIO010 driver
  2017-03-12 23:28 ` Linus Walleij
@ 2017-03-12 23:28   ` Linus Walleij
  -1 siblings, 0 replies; 22+ messages in thread
From: Linus Walleij @ 2017-03-12 23:28 UTC (permalink / raw)
  To: Hans Ulli Kroll, Florian Fainelli, Jonas Jensen, Alexandre Courbot
  Cc: Janos Laube, Paulius Zaleckas, openwrt-devel, linux-arm-kernel,
	linux-gpio, Linus Walleij

This just deletes the Moxa ART driver and replaces it with the
more versatile Faraday FTGPIO010 driver.

Make this default on for ARCH_GEMINI and ARCH_MOXART so we do
not get Kconfig glitches.

Cc: Jonas Jensen <jonas.jensen@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/gpio/Kconfig       | 10 +-----
 drivers/gpio/Makefile      |  1 -
 drivers/gpio/gpio-moxart.c | 84 ----------------------------------------------
 3 files changed, 1 insertion(+), 94 deletions(-)
 delete mode 100644 drivers/gpio/gpio-moxart.c

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 82ba825c224a..36298ddca3d6 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -206,10 +206,10 @@ config GPIO_GE_FPGA
 
 config GPIO_FTGPIO010
 	bool "Faraday FTGPIO010 GPIO"
-	depends on ARCH_GEMINI
 	depends on OF_GPIO
 	select GPIO_GENERIC
 	select GPIOLIB_IRQCHIP
+	default (ARCH_GEMINI || ARCH_MOXART)
 	help
 	  Support for common GPIOs from the Faraday FTGPIO010 IP core, found in
 	  Cortina systems Gemini platforms, Moxa ART and others.
@@ -309,14 +309,6 @@ config GPIO_MOCKUP
 	  tools/testing/selftests/gpio/gpio-mockup.sh. Reference the usage in
 	  it.
 
-config GPIO_MOXART
-	bool "MOXART GPIO support"
-	depends on ARCH_MOXART || COMPILE_TEST
-	select GPIO_GENERIC
-	help
-	  Select this option to enable GPIO driver for
-	  MOXA ART SoC devices.
-
 config GPIO_MPC5200
 	def_bool y
 	depends on PPC_MPC52xx
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 4b904fec8273..bd995dc2a84a 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -80,7 +80,6 @@ obj-$(CONFIG_GPIO_MCP23S08)	+= gpio-mcp23s08.o
 obj-$(CONFIG_GPIO_ML_IOH)	+= gpio-ml-ioh.o
 obj-$(CONFIG_GPIO_MM_LANTIQ)	+= gpio-mm-lantiq.o
 obj-$(CONFIG_GPIO_MOCKUP)      += gpio-mockup.o
-obj-$(CONFIG_GPIO_MOXART)	+= gpio-moxart.o
 obj-$(CONFIG_GPIO_MPC5200)	+= gpio-mpc5200.o
 obj-$(CONFIG_GPIO_MPC8XXX)	+= gpio-mpc8xxx.o
 obj-$(CONFIG_GPIO_MSIC)		+= gpio-msic.o
diff --git a/drivers/gpio/gpio-moxart.c b/drivers/gpio/gpio-moxart.c
deleted file mode 100644
index d58d38906ba6..000000000000
--- a/drivers/gpio/gpio-moxart.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * MOXA ART SoCs GPIO driver.
- *
- * Copyright (C) 2013 Jonas Jensen
- *
- * Jonas Jensen <jonas.jensen@gmail.com>
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2.  This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-
-#include <linux/err.h>
-#include <linux/init.h>
-#include <linux/irq.h>
-#include <linux/io.h>
-#include <linux/platform_device.h>
-#include <linux/of_address.h>
-#include <linux/of_gpio.h>
-#include <linux/pinctrl/consumer.h>
-#include <linux/delay.h>
-#include <linux/timer.h>
-#include <linux/bitops.h>
-#include <linux/gpio/driver.h>
-
-#define GPIO_DATA_OUT		0x00
-#define GPIO_DATA_IN		0x04
-#define GPIO_PIN_DIRECTION	0x08
-
-static int moxart_gpio_probe(struct platform_device *pdev)
-{
-	struct device *dev = &pdev->dev;
-	struct resource *res;
-	struct gpio_chip *gc;
-	void __iomem *base;
-	int ret;
-
-	gc = devm_kzalloc(dev, sizeof(*gc), GFP_KERNEL);
-	if (!gc)
-		return -ENOMEM;
-
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	base = devm_ioremap_resource(dev, res);
-	if (IS_ERR(base))
-		return PTR_ERR(base);
-
-	ret = bgpio_init(gc, dev, 4, base + GPIO_DATA_IN,
-			 base + GPIO_DATA_OUT, NULL,
-			 base + GPIO_PIN_DIRECTION, NULL,
-			 BGPIOF_READ_OUTPUT_REG_SET);
-	if (ret) {
-		dev_err(&pdev->dev, "bgpio_init failed\n");
-		return ret;
-	}
-
-	gc->label = "moxart-gpio";
-	gc->request = gpiochip_generic_request;
-	gc->free = gpiochip_generic_free;
-	gc->base = 0;
-	gc->owner = THIS_MODULE;
-
-	ret = devm_gpiochip_add_data(dev, gc, NULL);
-	if (ret) {
-		dev_err(dev, "%s: gpiochip_add failed\n",
-			dev->of_node->full_name);
-		return ret;
-	}
-
-	return ret;
-}
-
-static const struct of_device_id moxart_gpio_match[] = {
-	{ .compatible = "moxa,moxart-gpio" },
-	{ }
-};
-
-static struct platform_driver moxart_gpio_driver = {
-	.driver	= {
-		.name		= "moxart-gpio",
-		.of_match_table	= moxart_gpio_match,
-	},
-	.probe	= moxart_gpio_probe,
-};
-builtin_platform_driver(moxart_gpio_driver);
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 5/6] gpio: moxart: Switch to using the FTGPIO010 driver
@ 2017-03-12 23:28   ` Linus Walleij
  0 siblings, 0 replies; 22+ messages in thread
From: Linus Walleij @ 2017-03-12 23:28 UTC (permalink / raw)
  To: linux-arm-kernel

This just deletes the Moxa ART driver and replaces it with the
more versatile Faraday FTGPIO010 driver.

Make this default on for ARCH_GEMINI and ARCH_MOXART so we do
not get Kconfig glitches.

Cc: Jonas Jensen <jonas.jensen@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/gpio/Kconfig       | 10 +-----
 drivers/gpio/Makefile      |  1 -
 drivers/gpio/gpio-moxart.c | 84 ----------------------------------------------
 3 files changed, 1 insertion(+), 94 deletions(-)
 delete mode 100644 drivers/gpio/gpio-moxart.c

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 82ba825c224a..36298ddca3d6 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -206,10 +206,10 @@ config GPIO_GE_FPGA
 
 config GPIO_FTGPIO010
 	bool "Faraday FTGPIO010 GPIO"
-	depends on ARCH_GEMINI
 	depends on OF_GPIO
 	select GPIO_GENERIC
 	select GPIOLIB_IRQCHIP
+	default (ARCH_GEMINI || ARCH_MOXART)
 	help
 	  Support for common GPIOs from the Faraday FTGPIO010 IP core, found in
 	  Cortina systems Gemini platforms, Moxa ART and others.
@@ -309,14 +309,6 @@ config GPIO_MOCKUP
 	  tools/testing/selftests/gpio/gpio-mockup.sh. Reference the usage in
 	  it.
 
-config GPIO_MOXART
-	bool "MOXART GPIO support"
-	depends on ARCH_MOXART || COMPILE_TEST
-	select GPIO_GENERIC
-	help
-	  Select this option to enable GPIO driver for
-	  MOXA ART SoC devices.
-
 config GPIO_MPC5200
 	def_bool y
 	depends on PPC_MPC52xx
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 4b904fec8273..bd995dc2a84a 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -80,7 +80,6 @@ obj-$(CONFIG_GPIO_MCP23S08)	+= gpio-mcp23s08.o
 obj-$(CONFIG_GPIO_ML_IOH)	+= gpio-ml-ioh.o
 obj-$(CONFIG_GPIO_MM_LANTIQ)	+= gpio-mm-lantiq.o
 obj-$(CONFIG_GPIO_MOCKUP)      += gpio-mockup.o
-obj-$(CONFIG_GPIO_MOXART)	+= gpio-moxart.o
 obj-$(CONFIG_GPIO_MPC5200)	+= gpio-mpc5200.o
 obj-$(CONFIG_GPIO_MPC8XXX)	+= gpio-mpc8xxx.o
 obj-$(CONFIG_GPIO_MSIC)		+= gpio-msic.o
diff --git a/drivers/gpio/gpio-moxart.c b/drivers/gpio/gpio-moxart.c
deleted file mode 100644
index d58d38906ba6..000000000000
--- a/drivers/gpio/gpio-moxart.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * MOXA ART SoCs GPIO driver.
- *
- * Copyright (C) 2013 Jonas Jensen
- *
- * Jonas Jensen <jonas.jensen@gmail.com>
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2.  This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-
-#include <linux/err.h>
-#include <linux/init.h>
-#include <linux/irq.h>
-#include <linux/io.h>
-#include <linux/platform_device.h>
-#include <linux/of_address.h>
-#include <linux/of_gpio.h>
-#include <linux/pinctrl/consumer.h>
-#include <linux/delay.h>
-#include <linux/timer.h>
-#include <linux/bitops.h>
-#include <linux/gpio/driver.h>
-
-#define GPIO_DATA_OUT		0x00
-#define GPIO_DATA_IN		0x04
-#define GPIO_PIN_DIRECTION	0x08
-
-static int moxart_gpio_probe(struct platform_device *pdev)
-{
-	struct device *dev = &pdev->dev;
-	struct resource *res;
-	struct gpio_chip *gc;
-	void __iomem *base;
-	int ret;
-
-	gc = devm_kzalloc(dev, sizeof(*gc), GFP_KERNEL);
-	if (!gc)
-		return -ENOMEM;
-
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	base = devm_ioremap_resource(dev, res);
-	if (IS_ERR(base))
-		return PTR_ERR(base);
-
-	ret = bgpio_init(gc, dev, 4, base + GPIO_DATA_IN,
-			 base + GPIO_DATA_OUT, NULL,
-			 base + GPIO_PIN_DIRECTION, NULL,
-			 BGPIOF_READ_OUTPUT_REG_SET);
-	if (ret) {
-		dev_err(&pdev->dev, "bgpio_init failed\n");
-		return ret;
-	}
-
-	gc->label = "moxart-gpio";
-	gc->request = gpiochip_generic_request;
-	gc->free = gpiochip_generic_free;
-	gc->base = 0;
-	gc->owner = THIS_MODULE;
-
-	ret = devm_gpiochip_add_data(dev, gc, NULL);
-	if (ret) {
-		dev_err(dev, "%s: gpiochip_add failed\n",
-			dev->of_node->full_name);
-		return ret;
-	}
-
-	return ret;
-}
-
-static const struct of_device_id moxart_gpio_match[] = {
-	{ .compatible = "moxa,moxart-gpio" },
-	{ }
-};
-
-static struct platform_driver moxart_gpio_driver = {
-	.driver	= {
-		.name		= "moxart-gpio",
-		.of_match_table	= moxart_gpio_match,
-	},
-	.probe	= moxart_gpio_probe,
-};
-builtin_platform_driver(moxart_gpio_driver);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 6/6] ARM: gemini: select the right GPIO block
  2017-03-12 23:28 ` Linus Walleij
@ 2017-03-12 23:28   ` Linus Walleij
  -1 siblings, 0 replies; 22+ messages in thread
From: Linus Walleij @ 2017-03-12 23:28 UTC (permalink / raw)
  To: Hans Ulli Kroll, Florian Fainelli, Jonas Jensen, Alexandre Courbot
  Cc: Janos Laube, Paulius Zaleckas, openwrt-devel, linux-arm-kernel,
	linux-gpio, Linus Walleij

We want to select the GPIO_FTGPIO010 symbol for the generic
Faraday FTGPIO010 driver, not the old driver.

Cc: Jonas Jensen <jonas.jensen@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 arch/arm/mach-gemini/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-gemini/Kconfig b/arch/arm/mach-gemini/Kconfig
index 2dd8bc720089..eaae82637da3 100644
--- a/arch/arm/mach-gemini/Kconfig
+++ b/arch/arm/mach-gemini/Kconfig
@@ -4,7 +4,7 @@ menuconfig ARCH_GEMINI
 	select ARM_APPENDED_DTB # Old Redboot bootloaders deployed
 	select FARADAY_FTINTC010
 	select FTTMR010_TIMER
-	select GPIO_GEMINI
+	select GPIO_FTGPIO010
 	select GPIOLIB
 	select POWER_RESET
 	select POWER_RESET_GEMINI_POWEROFF
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 6/6] ARM: gemini: select the right GPIO block
@ 2017-03-12 23:28   ` Linus Walleij
  0 siblings, 0 replies; 22+ messages in thread
From: Linus Walleij @ 2017-03-12 23:28 UTC (permalink / raw)
  To: linux-arm-kernel

We want to select the GPIO_FTGPIO010 symbol for the generic
Faraday FTGPIO010 driver, not the old driver.

Cc: Jonas Jensen <jonas.jensen@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 arch/arm/mach-gemini/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-gemini/Kconfig b/arch/arm/mach-gemini/Kconfig
index 2dd8bc720089..eaae82637da3 100644
--- a/arch/arm/mach-gemini/Kconfig
+++ b/arch/arm/mach-gemini/Kconfig
@@ -4,7 +4,7 @@ menuconfig ARCH_GEMINI
 	select ARM_APPENDED_DTB # Old Redboot bootloaders deployed
 	select FARADAY_FTINTC010
 	select FTTMR010_TIMER
-	select GPIO_GEMINI
+	select GPIO_FTGPIO010
 	select GPIOLIB
 	select POWER_RESET
 	select POWER_RESET_GEMINI_POWEROFF
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH 1/6] gpio: gemini: augment DT bindings
  2017-03-12 23:28 ` Linus Walleij
@ 2017-03-20 17:16   ` Rob Herring
  -1 siblings, 0 replies; 22+ messages in thread
From: Rob Herring @ 2017-03-20 17:16 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Hans Ulli Kroll, Florian Fainelli, Jonas Jensen,
	Alexandre Courbot, Janos Laube, Paulius Zaleckas, openwrt-devel,
	linux-arm-kernel, linux-gpio, devicetree

On Mon, Mar 13, 2017 at 12:28:13AM +0100, Linus Walleij wrote:
> The DT bindings assumed that this IP block was coming from
> Cortina Systems, which turns out not to be true. It is a
> standard IP block from Faraday Technology and also used in the
> Moxa moxart SoC.
> 
> We augment the bindings to cover all existing parts and rename
> it after the IP block. This involves deleting the old Moxa
> bindings that now are contained in this binding.
> 
> Cc: devicetree@vger.kernel.org
> Cc: Jonas Jensen <jonas.jensen@gmail.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  ...{cortina,gemini-gpio.txt => faraday,ftgpio010.txt} |  9 ++++++---
>  .../devicetree/bindings/gpio/moxa,moxart-gpio.txt     | 19 -------------------
>  2 files changed, 6 insertions(+), 22 deletions(-)
>  rename Documentation/devicetree/bindings/gpio/{cortina,gemini-gpio.txt => faraday,ftgpio010.txt} (70%)
>  delete mode 100644 Documentation/devicetree/bindings/gpio/moxa,moxart-gpio.txt

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 1/6] gpio: gemini: augment DT bindings
@ 2017-03-20 17:16   ` Rob Herring
  0 siblings, 0 replies; 22+ messages in thread
From: Rob Herring @ 2017-03-20 17:16 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Mar 13, 2017 at 12:28:13AM +0100, Linus Walleij wrote:
> The DT bindings assumed that this IP block was coming from
> Cortina Systems, which turns out not to be true. It is a
> standard IP block from Faraday Technology and also used in the
> Moxa moxart SoC.
> 
> We augment the bindings to cover all existing parts and rename
> it after the IP block. This involves deleting the old Moxa
> bindings that now are contained in this binding.
> 
> Cc: devicetree at vger.kernel.org
> Cc: Jonas Jensen <jonas.jensen@gmail.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  ...{cortina,gemini-gpio.txt => faraday,ftgpio010.txt} |  9 ++++++---
>  .../devicetree/bindings/gpio/moxa,moxart-gpio.txt     | 19 -------------------
>  2 files changed, 6 insertions(+), 22 deletions(-)
>  rename Documentation/devicetree/bindings/gpio/{cortina,gemini-gpio.txt => faraday,ftgpio010.txt} (70%)
>  delete mode 100644 Documentation/devicetree/bindings/gpio/moxa,moxart-gpio.txt

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 4/6] gpio: gemini: rename to match Faraday IP
  2017-03-12 23:28   ` Linus Walleij
@ 2017-03-21 10:59     ` Jonas Jensen
  -1 siblings, 0 replies; 22+ messages in thread
From: Jonas Jensen @ 2017-03-21 10:59 UTC (permalink / raw)
  To: Linus Walleij
  Cc: openwrt-devel, Alexandre Courbot, Paulius Zaleckas, linux-gpio,
	Janos Laube, linux-arm-kernel

Verified on UC-7112-LX by buzzing the buzzer and writing the RTC (see
log [1] for next-20170310):

[1] https://bitbucket.org/Kasreyn/linux-next/commits/c63f3c2215f6fd106ff0ec6f9864b85b7be565ac

[    0.000000] Linux version 4.11.0-rc1-next-20170310-00004-gc63f3c2
(i@ildjarn) (gcc version 4.9.1 (crosstool-NG 1.20.0) ) #4461 PREEMP
T Tue Mar 21 11:43:29 CET 2017
..
echo 24 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio24/direction
echo 1 > /sys/class/gpio/gpio24/value
echo 0 > /sys/class/gpio/gpio24/value
..
date +%Y%m%d%h%m -s "201001202323"
hwclock -w
reboot
..
[    4.520000] moxart-rtc 90000000.soc:rtc: setting system clock to
2010-01-20 23:23:20 UTC (1264029800)
..
date +%Y%m%d%h%m -s "201212181553"
hwclock -w
reboot
..
[    4.520000] moxart-rtc 90000000.soc:rtc: setting system clock to
2012-12-18 15:53:20 UTC (1355846000)


Tested-by: Jonas Jensen <jonas.jensen@gmail.com>
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 4/6] gpio: gemini: rename to match Faraday IP
@ 2017-03-21 10:59     ` Jonas Jensen
  0 siblings, 0 replies; 22+ messages in thread
From: Jonas Jensen @ 2017-03-21 10:59 UTC (permalink / raw)
  To: linux-arm-kernel

Verified on UC-7112-LX by buzzing the buzzer and writing the RTC (see
log [1] for next-20170310):

[1] https://bitbucket.org/Kasreyn/linux-next/commits/c63f3c2215f6fd106ff0ec6f9864b85b7be565ac

[    0.000000] Linux version 4.11.0-rc1-next-20170310-00004-gc63f3c2
(i at ildjarn) (gcc version 4.9.1 (crosstool-NG 1.20.0) ) #4461 PREEMP
T Tue Mar 21 11:43:29 CET 2017
..
echo 24 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio24/direction
echo 1 > /sys/class/gpio/gpio24/value
echo 0 > /sys/class/gpio/gpio24/value
..
date +%Y%m%d%h%m -s "201001202323"
hwclock -w
reboot
..
[    4.520000] moxart-rtc 90000000.soc:rtc: setting system clock to
2010-01-20 23:23:20 UTC (1264029800)
..
date +%Y%m%d%h%m -s "201212181553"
hwclock -w
reboot
..
[    4.520000] moxart-rtc 90000000.soc:rtc: setting system clock to
2012-12-18 15:53:20 UTC (1355846000)


Tested-by: Jonas Jensen <jonas.jensen@gmail.com>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 4/6] gpio: gemini: rename to match Faraday IP
  2017-03-21 10:59     ` Jonas Jensen
@ 2017-03-22  8:42       ` Linus Walleij
  -1 siblings, 0 replies; 22+ messages in thread
From: Linus Walleij @ 2017-03-22  8:42 UTC (permalink / raw)
  To: Jonas Jensen
  Cc: openwrt-devel, Alexandre Courbot, Paulius Zaleckas, linux-gpio,
	Janos Laube, linux-arm-kernel

On Tue, Mar 21, 2017 at 11:59 AM, Jonas Jensen <jonas.jensen@gmail.com> wrote:

> Verified on UC-7112-LX by buzzing the buzzer and writing the RTC (see
> log [1] for next-20170310):
>
> [1] https://bitbucket.org/Kasreyn/linux-next/commits/c63f3c2215f6fd106ff0ec6f9864b85b7be565ac
>
> [    0.000000] Linux version 4.11.0-rc1-next-20170310-00004-gc63f3c2
> (i@ildjarn) (gcc version 4.9.1 (crosstool-NG 1.20.0) ) #4461 PREEMP
> T Tue Mar 21 11:43:29 CET 2017
> ..
> echo 24 > /sys/class/gpio/export
> echo out > /sys/class/gpio/gpio24/direction
> echo 1 > /sys/class/gpio/gpio24/value
> echo 0 > /sys/class/gpio/gpio24/value
> ..
> date +%Y%m%d%h%m -s "201001202323"
> hwclock -w
> reboot
> ..
> [    4.520000] moxart-rtc 90000000.soc:rtc: setting system clock to
> 2010-01-20 23:23:20 UTC (1264029800)

Nice! Have you tested my new GPIO character device tools from
tools/gpio/* in the kernel tree?

> Tested-by: Jonas Jensen <jonas.jensen@gmail.com>

Thanks man. I have only a few more or these, I might save some
for the next kernel cycle. ;)

Yours,
Linus Walleij
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 4/6] gpio: gemini: rename to match Faraday IP
@ 2017-03-22  8:42       ` Linus Walleij
  0 siblings, 0 replies; 22+ messages in thread
From: Linus Walleij @ 2017-03-22  8:42 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 21, 2017 at 11:59 AM, Jonas Jensen <jonas.jensen@gmail.com> wrote:

> Verified on UC-7112-LX by buzzing the buzzer and writing the RTC (see
> log [1] for next-20170310):
>
> [1] https://bitbucket.org/Kasreyn/linux-next/commits/c63f3c2215f6fd106ff0ec6f9864b85b7be565ac
>
> [    0.000000] Linux version 4.11.0-rc1-next-20170310-00004-gc63f3c2
> (i at ildjarn) (gcc version 4.9.1 (crosstool-NG 1.20.0) ) #4461 PREEMP
> T Tue Mar 21 11:43:29 CET 2017
> ..
> echo 24 > /sys/class/gpio/export
> echo out > /sys/class/gpio/gpio24/direction
> echo 1 > /sys/class/gpio/gpio24/value
> echo 0 > /sys/class/gpio/gpio24/value
> ..
> date +%Y%m%d%h%m -s "201001202323"
> hwclock -w
> reboot
> ..
> [    4.520000] moxart-rtc 90000000.soc:rtc: setting system clock to
> 2010-01-20 23:23:20 UTC (1264029800)

Nice! Have you tested my new GPIO character device tools from
tools/gpio/* in the kernel tree?

> Tested-by: Jonas Jensen <jonas.jensen@gmail.com>

Thanks man. I have only a few more or these, I might save some
for the next kernel cycle. ;)

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 4/6] gpio: gemini: rename to match Faraday IP
  2017-03-22  8:42       ` Linus Walleij
@ 2017-03-22 10:21         ` Jonas Jensen
  -1 siblings, 0 replies; 22+ messages in thread
From: Jonas Jensen @ 2017-03-22 10:21 UTC (permalink / raw)
  To: Linus Walleij
  Cc: openwrt-devel, Alexandre Courbot, Paulius Zaleckas, linux-gpio,
	Janos Laube, linux-arm-kernel

On 22 March 2017 at 09:42, Linus Walleij <linus.walleij@linaro.org> wrote:
> Nice! Have you tested my new GPIO character device tools from
> tools/gpio/* in the kernel tree?

I had not and thanks for pointing that out, lsgpio lists all available
gpios (though most of them are unnamed), and gpio-hammer successfully
toggled buzzer on/off.

uname -a
Linux zurkon 4.11.0-rc1-next-20170310-00004-gc63f3c2 #4466 PREEMPT Wed
Mar 22 11:05:28 CET 2017 armv4l GNU/Linux

./lsgpio
GPIO chip: gpiochip0, "FTGPIO010", 32 GPIO lines
        line  0: unnamed unused [output]
        line  1: unnamed unused [output]
        line  2: unnamed unused [output]
        line  3: unnamed unused [output]
        line  4: unnamed unused
        line  5: unnamed "rtc_sclk" [kernel output]
        line  6: unnamed "rtc_data" [kernel]
        line  7: unnamed "rtc_reset" [kernel output]
        line  8: unnamed unused
        line  9: unnamed unused
        line 10: unnamed unused
        line 11: unnamed unused [output]
        line 12: unnamed unused
        line 13: unnamed unused [output]
        line 14: unnamed unused
        line 15: unnamed unused [output]
        line 16: unnamed unused
        line 17: unnamed unused [output]
        line 18: unnamed unused
        line 19: unnamed unused
        line 20: unnamed unused
        line 21: unnamed unused
        line 22: unnamed unused
        line 23: unnamed unused
        line 24: unnamed unused [output]
        line 25: unnamed unused
        line 26: unnamed unused
        line 27: unnamed "ready-led" [kernel output active-low]
        line 28: unnamed unused
        line 29: unnamed unused
        line 30: unnamed unused
        line 31: unnamed unused [output]

./gpio-hammer -n gpiochip0 -o 24
Hammer lines [24] on gpiochip0, initial states: [0]
[|] [24: 1]

./gpio-hammer -n gpiochip0 -o 27
Failed to issue GET LINEHANDLE IOCTL (-16)


   Jonas
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 4/6] gpio: gemini: rename to match Faraday IP
@ 2017-03-22 10:21         ` Jonas Jensen
  0 siblings, 0 replies; 22+ messages in thread
From: Jonas Jensen @ 2017-03-22 10:21 UTC (permalink / raw)
  To: linux-arm-kernel

On 22 March 2017 at 09:42, Linus Walleij <linus.walleij@linaro.org> wrote:
> Nice! Have you tested my new GPIO character device tools from
> tools/gpio/* in the kernel tree?

I had not and thanks for pointing that out, lsgpio lists all available
gpios (though most of them are unnamed), and gpio-hammer successfully
toggled buzzer on/off.

uname -a
Linux zurkon 4.11.0-rc1-next-20170310-00004-gc63f3c2 #4466 PREEMPT Wed
Mar 22 11:05:28 CET 2017 armv4l GNU/Linux

./lsgpio
GPIO chip: gpiochip0, "FTGPIO010", 32 GPIO lines
        line  0: unnamed unused [output]
        line  1: unnamed unused [output]
        line  2: unnamed unused [output]
        line  3: unnamed unused [output]
        line  4: unnamed unused
        line  5: unnamed "rtc_sclk" [kernel output]
        line  6: unnamed "rtc_data" [kernel]
        line  7: unnamed "rtc_reset" [kernel output]
        line  8: unnamed unused
        line  9: unnamed unused
        line 10: unnamed unused
        line 11: unnamed unused [output]
        line 12: unnamed unused
        line 13: unnamed unused [output]
        line 14: unnamed unused
        line 15: unnamed unused [output]
        line 16: unnamed unused
        line 17: unnamed unused [output]
        line 18: unnamed unused
        line 19: unnamed unused
        line 20: unnamed unused
        line 21: unnamed unused
        line 22: unnamed unused
        line 23: unnamed unused
        line 24: unnamed unused [output]
        line 25: unnamed unused
        line 26: unnamed unused
        line 27: unnamed "ready-led" [kernel output active-low]
        line 28: unnamed unused
        line 29: unnamed unused
        line 30: unnamed unused
        line 31: unnamed unused [output]

./gpio-hammer -n gpiochip0 -o 24
Hammer lines [24] on gpiochip0, initial states: [0]
[|] [24: 1]

./gpio-hammer -n gpiochip0 -o 27
Failed to issue GET LINEHANDLE IOCTL (-16)


   Jonas

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 4/6] gpio: gemini: rename to match Faraday IP
  2017-03-22 10:21         ` Jonas Jensen
@ 2017-03-23 12:47           ` Linus Walleij
  -1 siblings, 0 replies; 22+ messages in thread
From: Linus Walleij @ 2017-03-23 12:47 UTC (permalink / raw)
  To: Jonas Jensen
  Cc: openwrt-devel, Alexandre Courbot, Paulius Zaleckas, linux-gpio,
	Janos Laube, linux-arm-kernel

On Wed, Mar 22, 2017 at 11:21 AM, Jonas Jensen <jonas.jensen@gmail.com> wrote:
> On 22 March 2017 at 09:42, Linus Walleij <linus.walleij@linaro.org> wrote:

>> Nice! Have you tested my new GPIO character device tools from
>> tools/gpio/* in the kernel tree?
>
> I had not and thanks for pointing that out, lsgpio lists all available
> gpios (though most of them are unnamed), and gpio-hammer successfully
> toggled buzzer on/off.

Nice.

> GPIO chip: gpiochip0, "FTGPIO010", 32 GPIO lines
>         line  0: unnamed unused [output]
>         line  1: unnamed unused [output]
>         line  2: unnamed unused [output]
>         line  3: unnamed unused [output]

BTW you can name all the "unnamed" lines by using
gpio-line-names in the gpio node of the device tree, c.f.
commit 3a1689ea752436917c5ce4487527ed6c444630ee

>         line 24: unnamed unused [output]
>         line 25: unnamed unused
>         line 26: unnamed unused
>         line 27: unnamed "ready-led" [kernel output active-low]
(...)
>
> ./gpio-hammer -n gpiochip0 -o 24
> Hammer lines [24] on gpiochip0, initial states: [0]
> [|] [24: 1]
>
> ./gpio-hammer -n gpiochip0 -o 27
> Failed to issue GET LINEHANDLE IOCTL (-16)

So finally when the kernel is using a GPIO line you can't use it
from userspace at the same time. -16 is -EBUSY.

Yours,
Linus Walleij
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 4/6] gpio: gemini: rename to match Faraday IP
@ 2017-03-23 12:47           ` Linus Walleij
  0 siblings, 0 replies; 22+ messages in thread
From: Linus Walleij @ 2017-03-23 12:47 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Mar 22, 2017 at 11:21 AM, Jonas Jensen <jonas.jensen@gmail.com> wrote:
> On 22 March 2017 at 09:42, Linus Walleij <linus.walleij@linaro.org> wrote:

>> Nice! Have you tested my new GPIO character device tools from
>> tools/gpio/* in the kernel tree?
>
> I had not and thanks for pointing that out, lsgpio lists all available
> gpios (though most of them are unnamed), and gpio-hammer successfully
> toggled buzzer on/off.

Nice.

> GPIO chip: gpiochip0, "FTGPIO010", 32 GPIO lines
>         line  0: unnamed unused [output]
>         line  1: unnamed unused [output]
>         line  2: unnamed unused [output]
>         line  3: unnamed unused [output]

BTW you can name all the "unnamed" lines by using
gpio-line-names in the gpio node of the device tree, c.f.
commit 3a1689ea752436917c5ce4487527ed6c444630ee

>         line 24: unnamed unused [output]
>         line 25: unnamed unused
>         line 26: unnamed unused
>         line 27: unnamed "ready-led" [kernel output active-low]
(...)
>
> ./gpio-hammer -n gpiochip0 -o 24
> Hammer lines [24] on gpiochip0, initial states: [0]
> [|] [24: 1]
>
> ./gpio-hammer -n gpiochip0 -o 27
> Failed to issue GET LINEHANDLE IOCTL (-16)

So finally when the kernel is using a GPIO line you can't use it
from userspace at the same time. -16 is -EBUSY.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2017-03-23 12:47 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-12 23:28 [PATCH 1/6] gpio: gemini: augment DT bindings Linus Walleij
2017-03-12 23:28 ` Linus Walleij
2017-03-12 23:28 ` [PATCH 2/6] ARM: dts: augment Gemini GPIO nodes Linus Walleij
2017-03-12 23:28   ` Linus Walleij
2017-03-12 23:28 ` [PATCH 3/6] ARM: dts: augment Moxa ART GPIO node Linus Walleij
2017-03-12 23:28   ` Linus Walleij
2017-03-12 23:28 ` [PATCH 4/6] gpio: gemini: rename to match Faraday IP Linus Walleij
2017-03-12 23:28   ` Linus Walleij
2017-03-21 10:59   ` Jonas Jensen
2017-03-21 10:59     ` Jonas Jensen
2017-03-22  8:42     ` Linus Walleij
2017-03-22  8:42       ` Linus Walleij
2017-03-22 10:21       ` Jonas Jensen
2017-03-22 10:21         ` Jonas Jensen
2017-03-23 12:47         ` Linus Walleij
2017-03-23 12:47           ` Linus Walleij
2017-03-12 23:28 ` [PATCH 5/6] gpio: moxart: Switch to using the FTGPIO010 driver Linus Walleij
2017-03-12 23:28   ` Linus Walleij
2017-03-12 23:28 ` [PATCH 6/6] ARM: gemini: select the right GPIO block Linus Walleij
2017-03-12 23:28   ` Linus Walleij
2017-03-20 17:16 ` [PATCH 1/6] gpio: gemini: augment DT bindings Rob Herring
2017-03-20 17:16   ` Rob Herring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.