Skip to contentSkip to conversation

ls2080a/dts: Add little endian property for GPIO IP block

PATCH New Liu Gang 3 participants 5 messages Nov 5, 2015 – Nov 11, 2015

Subsystems (3)
lore
Share & tools
lore

Liu Gang

author
#0 lore raw

PATCH v2 1/2 ls2080a/dts: Add little endian property for GPIO IP block

The GPIO block for ls2080a platform has little endian registers, the GPIO driver needs this property to read/write registers by right interface.

---
V2 changes: No

 Documentation/devicetree/bindings/gpio/gpio-mpc8xxx.txt | 3 +++
 arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi          | 4 ++++
 2 files changed, 7 insertions(+)
Documentation/devicetree/bindings/gpio/gpio-mpc8xxx.txt +3 -0
index f2455c5..c836dab 100644
@@ -10,6 +10,9 @@ Required properties:
   the second cell is used to specify the gpio polarity:
       0 = active high
       1 = active low
+- little-endian : Should be set if the GPIO has little endian
+		  registers. No the property means the GPIO
+		  registers are big endian mode.
 
 Example:
 
arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi +4 -0
index e81cd48..0099205 100644
@@ -277,6 +277,7 @@
 			reg = <0x0 0x2300000 0x0 0x10000>;
 			interrupts = <0 36 0x4>; /* Level high type */
 			gpio-controller;
+			little-endian;
 			#gpio-cells = <2>;
 			interrupt-controller;
 			#interrupt-cells = <2>;
@@ -287,6 +288,7 @@
 			reg = <0x0 0x2310000 0x0 0x10000>;
 			interrupts = <0 36 0x4>; /* Level high type */
 			gpio-controller;
+			little-endian;
 			#gpio-cells = <2>;
 			interrupt-controller;
 			#interrupt-cells = <2>;
@@ -297,6 +299,7 @@
 			reg = <0x0 0x2320000 0x0 0x10000>;
 			interrupts = <0 37 0x4>; /* Level high type */
 			gpio-controller;
+			little-endian;
 			#gpio-cells = <2>;
 			interrupt-controller;
 			#interrupt-cells = <2>;
@@ -307,6 +310,7 @@
 			reg = <0x0 0x2330000 0x0 0x10000>;
 			interrupts = <0 37 0x4>; /* Level high type */
 			gpio-controller;
+			little-endian;
 			#gpio-cells = <2>;
 			interrupt-controller;
 			#interrupt-cells = <2>;
Signature · 1 line
2.1.0.27.g96db324
author
#1 lore raw

PATCH v2 2/2 drivers/gpio: Port gpio driver to layerscape platform

Layerscape has the same ip block/controller as GPIO on powerpc platform(MPC8XXX).

So use portable i/o accessors, as in_be32/out_be32 accessors are Power architecture specific whereas ioread32/iowrite32 and ioread32be/iowrite32be are available in other architectures.

Layerscape GPIO controller's registers may be big or little endian, so the code needs to get the endian property from DTB, then make additional functions to fit right register read/write operations.

Currently the code can support ls2080a GPIO with little endian registers. And it can also work well on other layerscape platform with big endian GPIO registers.

---
V2 changes: Add '|| COMPILE_TEST' based on Arnd's comments.

 drivers/gpio/Kconfig        |  6 ++--
 drivers/gpio/gpio-mpc8xxx.c | 87 +++++++++++++++++++++++++++++++++------------
 2 files changed, 67 insertions(+), 26 deletions(-)
drivers/gpio/Kconfig +3 -3
index 8949b3f..8d4f159 100644
@@ -290,12 +290,12 @@ config GPIO_MPC5200
 	depends on PPC_MPC52xx
 
 config GPIO_MPC8XXX
-	bool "MPC512x/MPC8xxx GPIO support"
+	bool "MPC512x/MPC8xxx/QorIQ GPIO support"
 	depends on PPC_MPC512x || PPC_MPC831x || PPC_MPC834x || PPC_MPC837x || \
-		   FSL_SOC_BOOKE || PPC_86xx
+		   FSL_SOC_BOOKE || PPC_86xx || ARCH_LAYERSCAPE || COMPILE_TEST
 	help
 	  Say Y here if you're going to use hardware that connects to the
-	  MPC512x/831x/834x/837x/8572/8610 GPIOs.
+	  MPC512x/831x/834x/837x/8572/8610/QorIQ GPIOs.
 
 config GPIO_MSM_V2
 	tristate "Qualcomm MSM GPIO v2"
drivers/gpio/gpio-mpc8xxx.c +64 -23

218 lines not on this page · raw message

Signature · 1 line
2.1.0.27.g96db324
author
#2 lore raw

PATCH v2 2/2 drivers/gpio: Port gpio driver to layerscape platform

Hi, Arnd,

Do you have more comments for the V2 patch, or could you please ack the patch?

Thanks!
Liu Gang

#3 lore raw

PATCH v2 1/2 ls2080a/dts: Add little endian property for GPIO IP block

In reply to Liu Gang

Hi Gang,

Quoted 20 lines

From: Liu Gang [mailto:Gang.Liu at freescale.com]
Sent: Thursday, November 05, 2015 8:12 AM

The GPIO block for ls2080a platform has little endian registers, the GPIO driver needs this property to read/write registers by right interface.

---
V2 changes: No

 Documentation/devicetree/bindings/gpio/gpio-mpc8xxx.txt | 3 +++
 arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi          | 4 ++++
 2 files changed, 7 insertions(+)
Documentation/devicetree/bindings/gpio/gpio-mpc8xxx.txt +0 -0
index f2455c5..c836dab 100644

Documentation/devicetree/bindings/gpio/gpio-mpc8xxx.txt Required properties: · line 15

Quoted 6 lines
Documentation/devicetree/bindings/gpio/gpio-mpc8xxx.txt +3 -0
@@ -10,6 +10,9 @@ Required properties:
   the second cell is used to specify the gpio polarity:
       0 = active high
       1 = active low
+- little-endian : Should be set if the GPIO has little endian
+		  registers. No the property means the GPIO
+		  registers are big endian mode.

Nitpick: I would suggest rewording this to the following, for better readability:

 +- little-endian : Should be set if the GPIO has little endian
 +		  registers. If this property is not set, then the GPIO
 +		  registers are configured in big endian mode.

Regards,
Bhupesh

Quoted 42 lines
Documentation/devicetree/bindings/gpio/gpio-mpc8xxx.txt +0 -0
 Example:
 
arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi +4 -1
index e81cd48..0099205 100644
@@ -277,6 +277,7 @@
 			reg = <0x0 0x2300000 0x0 0x10000>;
 			interrupts = <0 36 0x4>; /* Level high type */
 			gpio-controller;
+			little-endian;
 			#gpio-cells = <2>;
 			interrupt-controller;
 			#interrupt-cells = <2>;
@@ -287,6 +288,7 @@
 			reg = <0x0 0x2310000 0x0 0x10000>;
 			interrupts = <0 36 0x4>; /* Level high type */
 			gpio-controller;
+			little-endian;
 			#gpio-cells = <2>;
 			interrupt-controller;
 			#interrupt-cells = <2>;
@@ -297,6 +299,7 @@
 			reg = <0x0 0x2320000 0x0 0x10000>;
 			interrupts = <0 37 0x4>; /* Level high type */
 			gpio-controller;
+			little-endian;
 			#gpio-cells = <2>;
 			interrupt-controller;
 			#interrupt-cells = <2>;
@@ -307,6 +310,7 @@
 			reg = <0x0 0x2330000 0x0 0x10000>;
 			interrupts = <0 37 0x4>; /* Level high type */
 			gpio-controller;
+			little-endian;
 			#gpio-cells = <2>;
 			interrupt-controller;
 			#interrupt-cells = <2>;
--

2.1.0.27.g96db324

maintainer
#4 lore raw

PATCH v2 1/2 ls2080a/dts: Add little endian property for GPIO IP block

In reply to Liu Gang
Quoted 5 lines · Liu Gang

The GPIO block for ls2080a platform has little endian registers, the GPIO driver needs this property to read/write registers by right interface.

Quoted 60 lines

---
V2 changes: No

 Documentation/devicetree/bindings/gpio/gpio-mpc8xxx.txt | 3 +++
 arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi          | 4 ++++
 2 files changed, 7 insertions(+)
Documentation/devicetree/bindings/gpio/gpio-mpc8xxx.txt +3 -0
index f2455c5..c836dab 100644
@@ -10,6 +10,9 @@ Required properties:
   the second cell is used to specify the gpio polarity:
       0 = active high
       1 = active low
+- little-endian : Should be set if the GPIO has little endian
+		  registers. No the property means the GPIO
+		  registers are big endian mode.
 
 Example:
 
arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi +4 -0
index e81cd48..0099205 100644
@@ -277,6 +277,7 @@
 			reg = <0x0 0x2300000 0x0 0x10000>;
 			interrupts = <0 36 0x4>; /* Level high type */
 			gpio-controller;
+			little-endian;
 			#gpio-cells = <2>;
 			interrupt-controller;
 			#interrupt-cells = <2>;
@@ -287,6 +288,7 @@
 			reg = <0x0 0x2310000 0x0 0x10000>;
 			interrupts = <0 36 0x4>; /* Level high type */
 			gpio-controller;
+			little-endian;
 			#gpio-cells = <2>;
 			interrupt-controller;
 			#interrupt-cells = <2>;
@@ -297,6 +299,7 @@
 			reg = <0x0 0x2320000 0x0 0x10000>;
 			interrupts = <0 37 0x4>; /* Level high type */
 			gpio-controller;
+			little-endian;
 			#gpio-cells = <2>;
 			interrupt-controller;
 			#interrupt-cells = <2>;
@@ -307,6 +310,7 @@
 			reg = <0x0 0x2330000 0x0 0x10000>;
 			interrupts = <0 37 0x4>; /* Level high type */
 			gpio-controller;
+			little-endian;
 			#gpio-cells = <2>;
 			interrupt-controller;
 			#interrupt-cells = <2>;
Signature · 1 line
2.1.0.27.g96db324