Skip to contentSkip to conversation

Minor Armada 370/XP cleanups

PATCH New Thomas Petazzoni 4 participants 12 messages Feb 11, 2014 – Feb 12, 2014

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

cover Minor Armada 370/XP cleanups

Jason, Greg, Andrew, Sebastian,

Here are three minor cleanups, the first one for mvebu/soc, the two other ones for mvebu/dt. I believe they are fairly self-explanatory.

Thanks!

Thomas

Thomas Petazzoni (3):
ARM: mvebu: remove unneeded ->map_io field for Armada 370/XP
ARM: mvebu: use GPIO DT defines in Armada 370/XP boards
ARM: mvebu: use input DT defines in Armada 370/XP boards

 arch/arm/boot/dts/armada-370-mirabox.dts         |  7 ++++---
 arch/arm/boot/dts/armada-370-rd.dts              |  6 ++++--
 arch/arm/boot/dts/armada-xp-axpwifiap.dts        |  6 ++++--
 arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts | 12 +++++++-----
 arch/arm/mach-mvebu/armada-370-xp.c              |  6 ------
 5 files changed, 19 insertions(+), 18 deletions(-)
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 1/3 ARM: mvebu: remove unneeded ->map_io field for Armada 370/XP

The ->map_io() implementation of Armada 370/XP simply calls debug_ll_io_init(), which is exactly what the kernel does when ->map_io is NULL. Therefore, there is no need to have a specific ->map_io() implementation in Armada 370/XP.

---
 arch/arm/mach-mvebu/armada-370-xp.c | 6 ------
 1 file changed, 6 deletions(-)
arch/arm/mach-mvebu/armada-370-xp.c +0 -6
index f6c9d1d..161cf2f 100644
@@ -31,11 +31,6 @@
 #include "coherency.h"
 #include "mvebu-soc-id.h"
 
-static void __init armada_370_xp_map_io(void)
-{
-	debug_ll_io_init();
-}
-
 static void __init armada_370_xp_timer_and_clk_init(void)
 {
 	of_clk_init(NULL);
@@ -90,7 +85,6 @@ static const char * const armada_370_xp_dt_compat[] = {
 DT_MACHINE_START(ARMADA_XP_DT, "Marvell Armada 370/XP (Device Tree)")
 	.smp		= smp_ops(armada_xp_smp_ops),
 	.init_machine	= armada_370_xp_dt_init,
-	.map_io		= armada_370_xp_map_io,
 	.init_time	= armada_370_xp_timer_and_clk_init,
 	.restart	= mvebu_restart,
 	.dt_compat	= armada_370_xp_dt_compat,
Signature · 1 line
1.8.3.2
#2 lore raw

PATCH 1/3 ARM: mvebu: remove unneeded ->map_io field for Armada 370/XP

Quoted 6 lines · Thomas Petazzoni

The ->map_io() implementation of Armada 370/XP simply calls debug_ll_io_init(), which is exactly what the kernel does when ->map_io is NULL. Therefore, there is no need to have a specific ->map_io() implementation in Armada 370/XP.

We missed it because the change made in arch/arm/mm/mmu.c was made in the same time than our change in arch/arm/mach-mvebu/armada-370-xp.c to use debug_ll_io_init().

Quoted 29 lines
---
 arch/arm/mach-mvebu/armada-370-xp.c | 6 ------
 1 file changed, 6 deletions(-)
arch/arm/mach-mvebu/armada-370-xp.c +0 -6
index f6c9d1d..161cf2f 100644
@@ -31,11 +31,6 @@
 #include "coherency.h"
 #include "mvebu-soc-id.h"
 
-static void __init armada_370_xp_map_io(void)
-{
-	debug_ll_io_init();
-}
-
 static void __init armada_370_xp_timer_and_clk_init(void)
 {
 	of_clk_init(NULL);
@@ -90,7 +85,6 @@ static const char * const armada_370_xp_dt_compat[] = {
 DT_MACHINE_START(ARMADA_XP_DT, "Marvell Armada 370/XP (Device Tree)")
 	.smp		= smp_ops(armada_xp_smp_ops),
 	.init_machine	= armada_370_xp_dt_init,
-	.map_io		= armada_370_xp_map_io,
 	.init_time	= armada_370_xp_timer_and_clk_init,
 	.restart	= mvebu_restart,
 	.dt_compat	= armada_370_xp_dt_compat,
Signature · 4 lines
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
Applied
#3 lore raw

PATCH 1/3 ARM: mvebu: remove unneeded ->map_io field for Armada 370/XP

In reply to Thomas Petazzoni
Quoted 9 lines · Thomas Petazzoni

The ->map_io() implementation of Armada 370/XP simply calls debug_ll_io_init(), which is exactly what the kernel does when ->map_io is NULL. Therefore, there is no need to have a specific ->map_io() implementation in Armada 370/XP.

---
 arch/arm/mach-mvebu/armada-370-xp.c | 6 ------
 1 file changed, 6 deletions(-)

Applied to mvebu/soc with Gregory's Ack.

thx,

Jason.

#4 lore raw

PATCH 2/3 ARM: mvebu: use GPIO DT defines in Armada 370/XP boards

In reply to Thomas Petazzoni

Instead of harcoding 0 and 1 for the gpio specifications in the Armada 370/XP boards, use the <dt-bindings/gpio/gpio.h> header file and its GPIO_ACTIVE_HIGH and GPIO_ACTIVE_LOW definitions.

---
 arch/arm/boot/dts/armada-370-mirabox.dts         | 7 ++++---
 arch/arm/boot/dts/armada-370-rd.dts              | 3 ++-
 arch/arm/boot/dts/armada-xp-axpwifiap.dts        | 3 ++-
 arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts | 9 +++++----
 4 files changed, 13 insertions(+), 9 deletions(-)
arch/arm/boot/dts/armada-370-mirabox.dts +4 -3
index 944e878..2354fe0 100644
@@ -9,6 +9,7 @@
  */
 
 /dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
 #include "armada-370.dtsi"
 
 / {
@@ -73,19 +74,19 @@
 
 				green_pwr_led {
 					label = "mirabox:green:pwr";
-					gpios = <&gpio1 31 1>;
+					gpios = <&gpio1 31 GPIO_ACTIVE_LOW>;
 					default-state = "keep";
 				};
 
 				blue_stat_led {
 					label = "mirabox:blue:stat";
-					gpios = <&gpio2 0 1>;
+					gpios = <&gpio2 0 GPIO_ACTIVE_LOW>;
 					default-state = "off";
 				};
 
 				green_stat_led {
 					label = "mirabox:green:stat";
-					gpios = <&gpio2 1 1>;
+					gpios = <&gpio2 1 GPIO_ACTIVE_LOW>;
 					default-state = "off";
 				};
 			};
arch/arm/boot/dts/armada-370-rd.dts +2 -1
index abbb807..c28865d 100644
@@ -12,6 +12,7 @@
  */
 
 /dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
 #include "armada-370.dtsi"
 
 / {
@@ -101,7 +102,7 @@
 				button at 1 {
 					label = "Software Button";
 					linux,code = <116>;
-					gpios = <&gpio0 6 1>;
+					gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
 				};
 			};
 
arch/arm/boot/dts/armada-xp-axpwifiap.dts +2 -1
index c5fe572..db1ef58 100644
@@ -16,6 +16,7 @@
  */
 
 /dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
 #include "armada-xp-mv78230.dtsi"
 
 / {
@@ -158,7 +159,7 @@
 		button at 1 {
 			label = "Factory Reset Button";
 			linux,code = <141>; /* KEY_SETUP */
-			gpios = <&gpio1 1 1>;
+			gpios = <&gpio1 1 GPIO_ACTIVE_LOW>;
 		};
 	};
 };
arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts +5 -4
index 99bcf76..944acfb 100644
@@ -11,6 +11,7 @@
  */
 
 /dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
 #include "armada-xp-mv78260.dtsi"
 
 / {
@@ -90,19 +91,19 @@
 
 				red_led {
 					label = "red_led";
-					gpios = <&gpio1 17 1>;
+					gpios = <&gpio1 17 GPIO_ACTIVE_LOW>;
 					default-state = "off";
 				};
 
 				yellow_led {
 					label = "yellow_led";
-					gpios = <&gpio1 19 1>;
+					gpios = <&gpio1 19 GPIO_ACTIVE_LOW>;
 					default-state = "off";
 				};
 
 				green_led {
 					label = "green_led";
-					gpios = <&gpio1 21 1>;
+					gpios = <&gpio1 21 GPIO_ACTIVE_LOW>;
 					default-state = "keep";
 				};
 			};
@@ -115,7 +116,7 @@
 				button at 1 {
 					label = "Init Button";
 					linux,code = <116>;
-					gpios = <&gpio1 28 0>;
+					gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>;
 				};
 			};
 
Signature · 1 line
1.8.3.2
#5 lore raw

PATCH 2/3 ARM: mvebu: use GPIO DT defines in Armada 370/XP boards

Quoted 5 lines · Thomas Petazzoni

Instead of harcoding 0 and 1 for the gpio specifications in the Armada 370/XP boards, use the <dt-bindings/gpio/gpio.h> header file and its GPIO_ACTIVE_HIGH and GPIO_ACTIVE_LOW definitions.

Quoted 129 lines
---
 arch/arm/boot/dts/armada-370-mirabox.dts         | 7 ++++---
 arch/arm/boot/dts/armada-370-rd.dts              | 3 ++-
 arch/arm/boot/dts/armada-xp-axpwifiap.dts        | 3 ++-
 arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts | 9 +++++----
 4 files changed, 13 insertions(+), 9 deletions(-)
arch/arm/boot/dts/armada-370-mirabox.dts +4 -3
index 944e878..2354fe0 100644
@@ -9,6 +9,7 @@
  */
 
 /dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
 #include "armada-370.dtsi"
 
 / {
@@ -73,19 +74,19 @@
 
 				green_pwr_led {
 					label = "mirabox:green:pwr";
-					gpios = <&gpio1 31 1>;
+					gpios = <&gpio1 31 GPIO_ACTIVE_LOW>;
 					default-state = "keep";
 				};
 
 				blue_stat_led {
 					label = "mirabox:blue:stat";
-					gpios = <&gpio2 0 1>;
+					gpios = <&gpio2 0 GPIO_ACTIVE_LOW>;
 					default-state = "off";
 				};
 
 				green_stat_led {
 					label = "mirabox:green:stat";
-					gpios = <&gpio2 1 1>;
+					gpios = <&gpio2 1 GPIO_ACTIVE_LOW>;
 					default-state = "off";
 				};
 			};
arch/arm/boot/dts/armada-370-rd.dts +2 -1
index abbb807..c28865d 100644
@@ -12,6 +12,7 @@
  */
 
 /dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
 #include "armada-370.dtsi"
 
 / {
@@ -101,7 +102,7 @@
 				button at 1 {
 					label = "Software Button";
 					linux,code = <116>;
-					gpios = <&gpio0 6 1>;
+					gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
 				};
 			};
 
arch/arm/boot/dts/armada-xp-axpwifiap.dts +2 -1
index c5fe572..db1ef58 100644
@@ -16,6 +16,7 @@
  */
 
 /dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
 #include "armada-xp-mv78230.dtsi"
 
 / {
@@ -158,7 +159,7 @@
 		button at 1 {
 			label = "Factory Reset Button";
 			linux,code = <141>; /* KEY_SETUP */
-			gpios = <&gpio1 1 1>;
+			gpios = <&gpio1 1 GPIO_ACTIVE_LOW>;
 		};
 	};
 };
arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts +5 -4
index 99bcf76..944acfb 100644
@@ -11,6 +11,7 @@
  */
 
 /dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
 #include "armada-xp-mv78260.dtsi"
 
 / {
@@ -90,19 +91,19 @@
 
 				red_led {
 					label = "red_led";
-					gpios = <&gpio1 17 1>;
+					gpios = <&gpio1 17 GPIO_ACTIVE_LOW>;
 					default-state = "off";
 				};
 
 				yellow_led {
 					label = "yellow_led";
-					gpios = <&gpio1 19 1>;
+					gpios = <&gpio1 19 GPIO_ACTIVE_LOW>;
 					default-state = "off";
 				};
 
 				green_led {
 					label = "green_led";
-					gpios = <&gpio1 21 1>;
+					gpios = <&gpio1 21 GPIO_ACTIVE_LOW>;
 					default-state = "keep";
 				};
 			};
@@ -115,7 +116,7 @@
 				button at 1 {
 					label = "Init Button";
 					linux,code = <116>;
-					gpios = <&gpio1 28 0>;
+					gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>;
 				};
 			};
 
Signature · 4 lines
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#6 lore raw

PATCH 2/3 ARM: mvebu: use GPIO DT defines in Armada 370/XP boards

In reply to Thomas Petazzoni
Quoted 11 lines · Thomas Petazzoni

Instead of harcoding 0 and 1 for the gpio specifications in the Armada 370/XP boards, use the <dt-bindings/gpio/gpio.h> header file and its GPIO_ACTIVE_HIGH and GPIO_ACTIVE_LOW definitions.

---
 arch/arm/boot/dts/armada-370-mirabox.dts         | 7 ++++---
 arch/arm/boot/dts/armada-370-rd.dts              | 3 ++-
 arch/arm/boot/dts/armada-xp-axpwifiap.dts        | 3 ++-
 arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts | 9 +++++----
 4 files changed, 13 insertions(+), 9 deletions(-)

Patches 2 and 3 applied to mvebu/dt with Gregory's Ack's.

thx,

Jason.

maintainer
#7 lore raw

PATCH 2/3 ARM: mvebu: use GPIO DT defines in Armada 370/XP boards

In reply to Thomas Petazzoni
Quoted 17 lines · Thomas Petazzoni

Instead of harcoding 0 and 1 for the gpio specifications in the Armada 370/XP boards, use the <dt-bindings/gpio/gpio.h> header file and its GPIO_ACTIVE_HIGH and GPIO_ACTIVE_LOW definitions.

---
 arch/arm/boot/dts/armada-370-mirabox.dts         | 7 ++++---
 arch/arm/boot/dts/armada-370-rd.dts              | 3 ++-
 arch/arm/boot/dts/armada-xp-axpwifiap.dts        | 3 ++-
 arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts | 9 +++++----
 4 files changed, 13 insertions(+), 9 deletions(-)
arch/arm/boot/dts/armada-370-mirabox.dts +0 -0
index 944e878..2354fe0 100644

arch/arm/boot/dts/armada-370-mirabox.dts line 13

Quoted 5 lines
arch/arm/boot/dts/armada-370-mirabox.dts +1 -0
@@ -9,6 +9,7 @@
  */
 
 /dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
 #include "armada-370.dtsi"

Hi Thomas

What i did for kirkwood is include both gpio.h and input.h in kirkwood.dtsi. Quite a few other systems do that, rather than each .dts file having to include them. However i don't have a strong opinion.

Andrew

#8 lore raw

PATCH 2/3 ARM: mvebu: use GPIO DT defines in Armada 370/XP boards

Dear Andrew Lunn,

Quoted 4 lines · Andrew Lunn

What i did for kirkwood is include both gpio.h and input.h in kirkwood.dtsi. Quite a few other systems do that, rather than each .dts file having to include them. However i don't have a strong opinion.

Right, I don't have a strong opinion on this either. I did it this way because a few other .dts files for Armada boards (Netgear NAS) were already including these header files.

I guess it is clearly something that can be factorized later on as the number of Armada boards needing this grows.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#9 lore raw

PATCH 2/3 ARM: mvebu: use GPIO DT defines in Armada 370/XP boards

Quoted 9 lines · Thomas Petazzoni

Dear Andrew Lunn,

Quoted 4 lines · Andrew Lunn

What i did for kirkwood is include both gpio.h and input.h in kirkwood.dtsi. Quite a few other systems do that, rather than each .dts file having to include them. However i don't have a strong opinion.

Quoted 6 lines

Right, I don't have a strong opinion on this either. I did it this way because a few other .dts files for Armada boards (Netgear NAS) were already including these header files.

I guess it is clearly something that can be factorized later on as the number of Armada boards needing this grows.

Same here, it's cleaner, but it can wait for cleanups next window.

thx,

Jason.

#10 lore raw

PATCH 3/3 ARM: mvebu: use input DT defines in Armada 370/XP boards

In reply to Thomas Petazzoni

Instead of harcoding keycodes specifications in the Armada 370/XP boards, use the <dt-bindings/input/input.h> header file and its keycode definitions.

---
 arch/arm/boot/dts/armada-370-rd.dts              | 3 ++-
 arch/arm/boot/dts/armada-xp-axpwifiap.dts        | 3 ++-
 arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)
arch/arm/boot/dts/armada-370-rd.dts +2 -1
index c28865d..3e2c857 100644
@@ -12,6 +12,7 @@
  */
 
 /dts-v1/;
+#include <dt-bindings/input/input.h>
 #include <dt-bindings/gpio/gpio.h>
 #include "armada-370.dtsi"
 
@@ -101,7 +102,7 @@
 				#size-cells = <0>;
 				button at 1 {
 					label = "Software Button";
-					linux,code = <116>;
+					linux,code = <KEY_POWER>;
 					gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
 				};
 			};
arch/arm/boot/dts/armada-xp-axpwifiap.dts +2 -1
index db1ef58..d83d7d6 100644
@@ -17,6 +17,7 @@
 
 /dts-v1/;
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
 #include "armada-xp-mv78230.dtsi"
 
 / {
@@ -158,7 +159,7 @@
 
 		button at 1 {
 			label = "Factory Reset Button";
-			linux,code = <141>; /* KEY_SETUP */
+			linux,code = <KEY_SETUP>;
 			gpios = <&gpio1 1 GPIO_ACTIVE_LOW>;
 		};
 	};
arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts +2 -1
index 944acfb..985948c 100644
@@ -12,6 +12,7 @@
 
 /dts-v1/;
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
 #include "armada-xp-mv78260.dtsi"
 
 / {
@@ -115,7 +116,7 @@
 
 				button at 1 {
 					label = "Init Button";
-					linux,code = <116>;
+					linux,code = <KEY_POWER>;
 					gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>;
 				};
 			};
Signature · 1 line
1.8.3.2
#11 lore raw

PATCH 3/3 ARM: mvebu: use input DT defines in Armada 370/XP boards

Hi Thomas,

Quoted 3 lines · Thomas Petazzoni

Instead of harcoding keycodes specifications in the Armada 370/XP boards, use the <dt-bindings/input/input.h> header file and its keycode definitions.

It's easier to read now,

Thanks,

Gregory

Quoted 2 lines
Quoted 70 lines
---
 arch/arm/boot/dts/armada-370-rd.dts              | 3 ++-
 arch/arm/boot/dts/armada-xp-axpwifiap.dts        | 3 ++-
 arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)
arch/arm/boot/dts/armada-370-rd.dts +2 -1
index c28865d..3e2c857 100644
@@ -12,6 +12,7 @@
  */
 
 /dts-v1/;
+#include <dt-bindings/input/input.h>
 #include <dt-bindings/gpio/gpio.h>
 #include "armada-370.dtsi"
 
@@ -101,7 +102,7 @@
 				#size-cells = <0>;
 				button at 1 {
 					label = "Software Button";
-					linux,code = <116>;
+					linux,code = <KEY_POWER>;
 					gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
 				};
 			};
arch/arm/boot/dts/armada-xp-axpwifiap.dts +2 -1
index db1ef58..d83d7d6 100644
@@ -17,6 +17,7 @@
 
 /dts-v1/;
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
 #include "armada-xp-mv78230.dtsi"
 
 / {
@@ -158,7 +159,7 @@
 
 		button at 1 {
 			label = "Factory Reset Button";
-			linux,code = <141>; /* KEY_SETUP */
+			linux,code = <KEY_SETUP>;
 			gpios = <&gpio1 1 GPIO_ACTIVE_LOW>;
 		};
 	};
arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts +2 -1
index 944acfb..985948c 100644
@@ -12,6 +12,7 @@
 
 /dts-v1/;
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
 #include "armada-xp-mv78260.dtsi"
 
 / {
@@ -115,7 +116,7 @@
 
 				button at 1 {
 					label = "Init Button";
-					linux,code = <116>;
+					linux,code = <KEY_POWER>;
 					gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>;
 				};
 			};
Signature · 4 lines
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com