Skip to contentSkip to conversation

gpio: Add APM X-Gene standy platform GPIO driver

PATCH Superseded Y Vo 1 participant 4 messages Dec 17, 2014

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Y Vo

author
#0 lore raw

v2 cover gpio: Add APM X-Gene standy platform GPIO driver

This patch add the GPIO standby controller in the APM X-Gene platform.

v1 Change:
1. Do not access GIC register from driver.
2. Duplicate gpio probe funtion.
3. Function gpiochip_remove doesn't return value.

Y Vo (3):
gpio: Add APM X-Gene standby GPIO controller driver
Documentation: gpio: Add APM X-Gene standby GPIO controller DTS
binding
arm64:dts: Add APM X-Gene standby GPIO controller DTS entries

 .../devicetree/bindings/gpio/gpio-xgene-sb.txt     |  31 +++
 arch/arm64/boot/dts/apm-storm.dtsi                 |  13 ++
 drivers/gpio/Kconfig                               |   7 +
 drivers/gpio/Makefile                              |   1 +
 drivers/gpio/gpio-xgene-sb.c                       | 216 +++++++++++++++++++++
 5 files changed, 268 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-xgene-sb.txt
 create mode 100644 drivers/gpio/gpio-xgene-sb.c
Signature · 1 line
2.2.0
author
#1 lore raw

PATCH v2 1/3 gpio: Add APM X-Gene standby GPIO controller driver

Add APM X-Gene standby GPIO controller driver.

---
 drivers/gpio/Kconfig         |   7 ++
 drivers/gpio/Makefile        |   1 +
 drivers/gpio/gpio-xgene-sb.c | 228 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 236 insertions(+)
 create mode 100644 drivers/gpio/gpio-xgene-sb.c
drivers/gpio/Kconfig +7 -0
index 0959ca9..aa53682 100644
@@ -342,6 +342,13 @@ config GPIO_XGENE
 	  the generic flash controller's address and data pins. Say yes
 	  here to enable the GFC GPIO functionality.
 
+config GPIO_XGENE_SB
+	tristate "APM X-Gene GPIO standby controller support"
+	depends on ARCH_XGENE && OF_GPIO
+	help
+	  This driver supports the GPIO block within the APM X-Gene
+	  Standby Domain. Say yes here to enable the GPIO functionality.
+
 config GPIO_XILINX
 	bool "Xilinx GPIO support"
 	depends on PPC_OF || MICROBLAZE || ARCH_ZYNQ
drivers/gpio/Makefile +1 -0
index e5d346c..edf8d8f 100644
@@ -102,6 +102,7 @@ obj-$(CONFIG_GPIO_WM831X)	+= gpio-wm831x.o
 obj-$(CONFIG_GPIO_WM8350)	+= gpio-wm8350.o
 obj-$(CONFIG_GPIO_WM8994)	+= gpio-wm8994.o
 obj-$(CONFIG_GPIO_XGENE)	+= gpio-xgene.o
+obj-$(CONFIG_GPIO_XGENE_SB)	+= gpio-xgene-sb.o
 obj-$(CONFIG_GPIO_XILINX)	+= gpio-xilinx.o
 obj-$(CONFIG_GPIO_XTENSA)	+= gpio-xtensa.o
 obj-$(CONFIG_GPIO_ZEVIO)	+= gpio-zevio.o
drivers/gpio/gpio-xgene-sb.c new file +228 -0

228 lines not on this page · raw message

Signature · 1 line
2.2.0
author
#2 lore raw

PATCH v2 2/3 Documentation: gpio: Add APM X-Gene standby GPIO controller DTS binding

In reply to Y Vo

Documentation for APM X-Gene standby GPIO controller DTS binding.

---
 .../devicetree/bindings/gpio/gpio-xgene-sb.txt     | 31 ++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-xgene-sb.txt
Documentation/devicetree/bindings/gpio/gpio-xgene-sb.txt new file +31 -0
new file mode 100644
index 0000000..3215e4d
@@ -0,0 +1,31 @@
+APM X-Gene Standby GPIO controller bindings
+
+This is a gpio controller in standby domain.
+
+There are 20 GPIO pins from 0..21. There is no GPIO_DS14 and GPIO_DS15. 
+Only GPIO_DS8..GPIO_DS13 support interrupt. IRQ mapping 0x28..0x2d.
+
+Required properties:
+- compatible: "apm,xgene-gpio-sb" for X-Gene Standby GPIO controller
+- reg: Physical base address and size of the controller's registers
+- #gpio-cells: Should be two.
+	- first cell is the pin number
+	- second cell is used to specify the gpio polarity:
+		0 = active high
+		1 = active low
+- gpio-controller: Marks the device node as a GPIO controller.
+- interrupts: Shall contains the interrupts.
+
+Example:
+	sbgpio: sbgpio at 17001000 {
+		compatible = "apm,xgene-gpio-sb";
+		reg = <0x0 0x17001000 0x0 0x400>;
+		#gpio-cells = <2>;
+		gpio-controller;
+		interrupts = 	<0x0 0x28 0x1>,
+				<0x0 0x29 0x1>,
+				<0x0 0x2a 0x1>,
+				<0x0 0x2b 0x1>,
+				<0x0 0x2c 0x1>,
+				<0x0 0x2d 0x1>;
+	};
Signature · 1 line
2.2.0
author
#3 lore raw

PATCH v2 3/3 arm64:dts: Add APM X-Gene standby GPIO controller DTS entries

In reply to Y Vo

Add standby domain gpio controller for APM X-Gene SoC platform.

---
 arch/arm64/boot/dts/apm-storm.dtsi | 13 +++++++++++++
 drivers/gpio/gpio-xgene-sb.c       | 18 +++---------------
 2 files changed, 16 insertions(+), 15 deletions(-)
arch/arm64/boot/dts/apm-storm.dtsi +13 -0
index 295c72d..e2454a2 100644
@@ -587,6 +587,19 @@
 			phy-names = "sata-phy";
 		};
 
+		sbgpio: sbgpio at 17001000{
+			compatible = "apm,xgene-gpio-sb";
+			reg = <0x0 0x17001000 0x0 0x400>;
+			#gpio-cells = <2>;
+			gpio-controller;
+			interrupts = 	<0x0 0x28 0x1>,
+					<0x0 0x29 0x1>,
+					<0x0 0x2a 0x1>,
+					<0x0 0x2b 0x1>,
+					<0x0 0x2c 0x1>,
+					<0x0 0x2d 0x1>;
+		};
+
 		rtc: rtc at 10510000 {
 			compatible = "apm,xgene-rtc";
 			reg = <0x0 0x10510000 0x0 0x400>;
drivers/gpio/gpio-xgene-sb.c +3 -15
index 7668626..425234b 100644
@@ -44,14 +44,10 @@
 #define MPA_GPIO_SEL_LO			0x0294
 #define MPA_GPIO_SEL_HIGH		0x029c
 
-#define GICD_SPI_BASE			0x78010000
-#define GICD_SPIR1			0x00000d08
-
 struct xgene_gpio_sb {
 	struct of_mm_gpio_chip mm;
 	u32 *irq;
 	u32 nirq;
-	void __iomem *gic_regs;
 	spinlock_t lock; /* mutual exclusion */
 };
 
@@ -75,14 +71,9 @@ static void xgene_gpio_set_bit(void __iomem *reg, u32 gpio, int val)
 static int xgene_gpio_sb_get(struct gpio_chip *gc, u32 gpio)
 {
 	struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
-	struct xgene_gpio_sb *chip = to_xgene_gpio_sb(mm_gc);
 	u32 data;
 
-	if (chip->irq[gpio]) {
-		data = ioread32(chip->gic_regs + GICD_SPIR1);
-	} else {
-		data = ioread32(mm_gc->regs + MPA_GPIO_IN_ADDR);
-	}
+	data = ioread32(mm_gc->regs + MPA_GPIO_IN_ADDR);
 
 	return (data &  GPIO_MASK(gpio)) ? 1 : 0;
 }
@@ -167,10 +158,6 @@ static int xgene_gpio_sb_probe(struct platform_device *pdev)
 	mm->gc.ngpio = XGENE_MAX_GPIO_DS;
 	apm_gc->nirq = XGENE_MAX_GPIO_DS_IRQ;
 
-	apm_gc->gic_regs = ioremap(GICD_SPI_BASE, 16);
-	if (!apm_gc->gic_regs)
-		return -ENOMEM;
-
 	apm_gc->irq = devm_kzalloc(&pdev->dev, sizeof(u32) * XGENE_MAX_GPIO_DS,
 				   GFP_KERNEL);
 	if (!apm_gc->irq)
@@ -202,7 +189,8 @@ static int xgene_gpio_sb_remove(struct platform_device *pdev)
 {
 	struct of_mm_gpio_chip *mm = platform_get_drvdata(pdev);
 
-	return gpiochip_remove(&mm->gc);
+	gpiochip_remove(&mm->gc);
+	return 0;
 }
 
 static const struct of_device_id xgene_gpio_sb_of_match[] = {
Signature · 1 line
2.2.0