aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuodong Xu <guodong.xu@linaro.org>2013-10-22 15:27:22 +0800
committerGuodong Xu <guodong.xu@linaro.org>2013-10-22 15:27:22 +0800
commit64d1755233396ac82c3a09a9d0768abd8501feed (patch)
treea68703e90bb836354ab2c727f6892f9963318ad7
parentc40340bd6f1319dacb3d1f8b187d99fa3084f11e (diff)
parent514354ce55affa52bae4b64e4d9d1f64250fb9f5 (diff)
Merge commit 'tracking-hilt-gpio-base-1022' into integration-hilt-linux-linarointegration-hilt-linux-linaro-20131206previous-hilt-ll-2013.10
* commit 'tracking-hilt-gpio-base-1022': ARM: dts: add gpio base property in hi3620 gpio: pl061: add new property for gpio base
-rw-r--r--Documentation/devicetree/bindings/gpio/gpio-pl061.txt33
-rw-r--r--arch/arm/boot/dts/hi3620.dtsi22
-rw-r--r--drivers/gpio/gpio-pl061.c15
3 files changed, 69 insertions, 1 deletions
diff --git a/Documentation/devicetree/bindings/gpio/gpio-pl061.txt b/Documentation/devicetree/bindings/gpio/gpio-pl061.txt
new file mode 100644
index 000000000000..687206727bd3
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/gpio-pl061.txt
@@ -0,0 +1,33 @@
+PL061 GPIO controller bindings
+
+Required properties:
+- compatible:
+ - "arm,pl061", "arm,primecell".
+- #gpio-cells : Should be two.
+ - first cell is the gpio 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.
+- interrupt-controller : Marks the device node as an interrupt controller.
+- #interrupt-cells : Should be two.
+ - first cell is the hw irq number
+ - second cell is used to specify the interrupt type:
+ 0 = default, unspecified type
+ 1 = rising edge triggered
+ 2 = falling edge triggered
+ 4 = high level triggered
+ 8 = low level triggered
+- linux,gpio-base : Should be the global GPIO number.
+
+Example:
+ gpio0: gpio@fc806000 {
+ compatible = "arm,pl061", "arm,primecell";
+ reg = <0xfc806000 0x1000>;
+ interrupts = <0 64 0x4>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ linux,gpio-base = <0>;
+ };
diff --git a/arch/arm/boot/dts/hi3620.dtsi b/arch/arm/boot/dts/hi3620.dtsi
index 9829c9cca12e..1c8d31b67bb7 100644
--- a/arch/arm/boot/dts/hi3620.dtsi
+++ b/arch/arm/boot/dts/hi3620.dtsi
@@ -1083,6 +1083,7 @@
#interrupt-cells = <2>;
clocks = <&gpioclk0>;
clock-names = "apb_pclk";
+ linux,gpio-base = <0>;
status = "disable";
};
@@ -1099,6 +1100,7 @@
#interrupt-cells = <2>;
clocks = <&gpioclk1>;
clock-names = "apb_pclk";
+ linux,gpio-base = <8>;
status = "disable";
};
@@ -1115,6 +1117,7 @@
#interrupt-cells = <2>;
clocks = <&gpioclk2>;
clock-names = "apb_pclk";
+ linux,gpio-base = <16>;
status = "disable";
};
@@ -1131,6 +1134,7 @@
#interrupt-cells = <2>;
clocks = <&gpioclk3>;
clock-names = "apb_pclk";
+ linux,gpio-base = <24>;
status = "disable";
};
@@ -1147,6 +1151,7 @@
#interrupt-cells = <2>;
clocks = <&gpioclk4>;
clock-names = "apb_pclk";
+ linux,gpio-base = <32>;
status = "disable";
};
@@ -1163,6 +1168,7 @@
#interrupt-cells = <2>;
clocks = <&gpioclk5>;
clock-names = "apb_pclk";
+ linux,gpio-base = <40>;
status = "disable";
};
@@ -1179,6 +1185,7 @@
#interrupt-cells = <2>;
clocks = <&gpioclk6>;
clock-names = "apb_pclk";
+ linux,gpio-base = <48>;
status = "disable";
};
@@ -1195,6 +1202,7 @@
#interrupt-cells = <2>;
clocks = <&gpioclk7>;
clock-names = "apb_pclk";
+ linux,gpio-base = <56>;
status = "disable";
};
@@ -1211,6 +1219,7 @@
#interrupt-cells = <2>;
clocks = <&gpioclk8>;
clock-names = "apb_pclk";
+ linux,gpio-base = <64>;
status = "disable";
};
@@ -1227,6 +1236,7 @@
#interrupt-cells = <2>;
clocks = <&gpioclk9>;
clock-names = "apb_pclk";
+ linux,gpio-base = <72>;
status = "disable";
};
@@ -1242,6 +1252,7 @@
#interrupt-cells = <2>;
clocks = <&gpioclk10>;
clock-names = "apb_pclk";
+ linux,gpio-base = <80>;
status = "disable";
};
@@ -1258,6 +1269,7 @@
#interrupt-cells = <2>;
clocks = <&gpioclk11>;
clock-names = "apb_pclk";
+ linux,gpio-base = <88>;
status = "disable";
};
@@ -1274,6 +1286,7 @@
#interrupt-cells = <2>;
clocks = <&gpioclk12>;
clock-names = "apb_pclk";
+ linux,gpio-base = <96>;
status = "disable";
};
@@ -1290,6 +1303,7 @@
#interrupt-cells = <2>;
clocks = <&gpioclk13>;
clock-names = "apb_pclk";
+ linux,gpio-base = <104>;
status = "disable";
};
@@ -1306,6 +1320,7 @@
#interrupt-cells = <2>;
clocks = <&gpioclk14>;
clock-names = "apb_pclk";
+ linux,gpio-base = <112>;
status = "disable";
};
@@ -1322,6 +1337,7 @@
#interrupt-cells = <2>;
clocks = <&gpioclk15>;
clock-names = "apb_pclk";
+ linux,gpio-base = <120>;
status = "disable";
};
@@ -1338,6 +1354,7 @@
#interrupt-cells = <2>;
clocks = <&gpioclk16>;
clock-names = "apb_pclk";
+ linux,gpio-base = <128>;
status = "disable";
};
@@ -1354,6 +1371,7 @@
#interrupt-cells = <2>;
clocks = <&gpioclk17>;
clock-names = "apb_pclk";
+ linux,gpio-base = <136>;
status = "disable";
};
@@ -1370,6 +1388,7 @@
#interrupt-cells = <2>;
clocks = <&gpioclk18>;
clock-names = "apb_pclk";
+ linux,gpio-base = <144>;
status = "disable";
};
@@ -1385,6 +1404,7 @@
#interrupt-cells = <2>;
clocks = <&gpioclk19>;
clock-names = "apb_pclk";
+ linux,gpio-base = <152>;
status = "disable";
};
@@ -1400,6 +1420,7 @@
#interrupt-cells = <2>;
clocks = <&gpioclk20>;
clock-names = "apb_pclk";
+ linux,gpio-base = <160>;
status = "disable";
};
@@ -1414,6 +1435,7 @@
#interrupt-cells = <2>;
clocks = <&gpioclk21>;
clock-names = "apb_pclk";
+ linux,gpio-base = <168>;
status = "disable";
};
diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c
index 4274e2e70ef8..cb5510bd070a 100644
--- a/drivers/gpio/gpio-pl061.c
+++ b/drivers/gpio/gpio-pl061.c
@@ -256,6 +256,19 @@ static const struct irq_domain_ops pl061_domain_ops = {
.xlate = irq_domain_xlate_twocell,
};
+/* Parse gpio base from DT */
+static int pl061_parse_gpio_base(struct device *dev)
+{
+ struct device_node *np = dev->of_node;
+ int ret;
+
+ if (of_property_read_u32(np, "linux,gpio-base", &ret))
+ return -ENOENT;
+ if (ret >= 0)
+ return ret;
+ return -EINVAL;
+}
+
static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
{
struct device *dev = &adev->dev;
@@ -273,7 +286,7 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
if (irq_base <= 0)
return -ENODEV;
} else {
- chip->gc.base = -1;
+ chip->gc.base = pl061_parse_gpio_base(dev);
irq_base = 0;
}