[OpenWrt-Devel] [PATCH 2/3] brcm63xx: use bcm6328 and bcm6358 LED drivers

Álvaro Fernández Rojas noltari at gmail.com
Sat Sep 5 08:58:37 EDT 2015


Use hardware controller instead of spi-gpio to control de 74hc serial LEDs

Signed-off-by: Álvaro Fernández Rojas <noltari at gmail.com>
---
 target/linux/brcm63xx/dts/bcm6318.dtsi   |  10 ++
 target/linux/brcm63xx/dts/bcm63268.dtsi  |  10 ++
 target/linux/brcm63xx/dts/bcm6328.dtsi   |  10 ++
 target/linux/brcm63xx/dts/bcm6358.dtsi   |  10 ++
 target/linux/brcm63xx/dts/bcm6362.dtsi   |  10 ++
 target/linux/brcm63xx/dts/bcm6368.dtsi   |  10 ++
 target/linux/brcm63xx/dts/ct-6373.dts    |  61 +++++-------
 target/linux/brcm63xx/dts/homehub2a.dts  | 162 +++++++++++++++----------------
 target/linux/brcm63xx/dts/nb4-fxc-r1.dts |  61 +++++-------
 target/linux/brcm63xx/dts/nb4-ser-r0.dts |  61 +++++-------
 10 files changed, 213 insertions(+), 192 deletions(-)

diff --git a/target/linux/brcm63xx/dts/bcm6318.dtsi b/target/linux/brcm63xx/dts/bcm6318.dtsi
index f851a9c..4b70d53 100644
--- a/target/linux/brcm63xx/dts/bcm6318.dtsi
+++ b/target/linux/brcm63xx/dts/bcm6318.dtsi
@@ -6,6 +6,7 @@
 	aliases {
 		gpio0 = &gpio0;
 		gpio1 = &gpio1;
+		leds0 = &leds0;
 	};
 
 	cpus {
@@ -74,5 +75,14 @@
 			gpio-controller;
 			#gpio-cells = <2>;
 		};
+
+		leds0: led-controller at 10000200 {
+			compatible = "brcm,bcm6328-leds";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <0x10000200 0x24>;
+
+			status = "disabled";
+		};
 	};
 };
diff --git a/target/linux/brcm63xx/dts/bcm63268.dtsi b/target/linux/brcm63xx/dts/bcm63268.dtsi
index 0a1f8b1..a0e3472 100644
--- a/target/linux/brcm63xx/dts/bcm63268.dtsi
+++ b/target/linux/brcm63xx/dts/bcm63268.dtsi
@@ -6,6 +6,7 @@
 	aliases {
 		gpio0 = &gpio0;
 		gpio1 = &gpio1;
+		leds0 = &leds0;
 	};
 
 	cpus {
@@ -81,5 +82,14 @@
 			gpio-controller;
 			#gpio-cells = <2>;
 		};
+
+		leds0: led-controller at 10001900 {
+			compatible = "brcm,bcm6328-leds";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <0x10001900 0x24>;
+
+			status = "disabled";
+		};
 	};
 };
diff --git a/target/linux/brcm63xx/dts/bcm6328.dtsi b/target/linux/brcm63xx/dts/bcm6328.dtsi
index a0b1316..d570e06 100644
--- a/target/linux/brcm63xx/dts/bcm6328.dtsi
+++ b/target/linux/brcm63xx/dts/bcm6328.dtsi
@@ -5,6 +5,7 @@
 
 	aliases {
 		gpio0 = &gpio0;
+		leds0 = &leds0;
 	};
 
 	cpus {
@@ -63,5 +64,14 @@
 			gpio-controller;
 			#gpio-cells = <2>;
 		};
+
+		leds0: led-controller at 10000800 {
+			compatible = "brcm,bcm6328-leds";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <0x10000800 0x24>;
+
+			status = "disabled";
+		};
 	};
 };
diff --git a/target/linux/brcm63xx/dts/bcm6358.dtsi b/target/linux/brcm63xx/dts/bcm6358.dtsi
index bc3784a..fee3285 100644
--- a/target/linux/brcm63xx/dts/bcm6358.dtsi
+++ b/target/linux/brcm63xx/dts/bcm6358.dtsi
@@ -7,6 +7,7 @@
 		pflash = &pflash;
 		gpio0 = &gpio0;
 		gpio1 = &gpio1;
+		leds0 = &leds0;
 	};
 
 	cpus {
@@ -103,5 +104,14 @@
 			gpio-controller;
 			#gpio-cells = <2>;
 		};
+
+		leds0: led-controller at fffe00d0 {
+			compatible = "brcm,bcm6358-leds";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <0xfffe00d0 0x8>;
+
+			status = "disabled";
+		};
 	};
 };
diff --git a/target/linux/brcm63xx/dts/bcm6362.dtsi b/target/linux/brcm63xx/dts/bcm6362.dtsi
index 6604f5c..d58ae58 100644
--- a/target/linux/brcm63xx/dts/bcm6362.dtsi
+++ b/target/linux/brcm63xx/dts/bcm6362.dtsi
@@ -6,6 +6,7 @@
 	aliases {
 		gpio0 = &gpio0;
 		gpio1 = &gpio1;
+		leds0 = &leds0;
 	};
 
 	cpus {
@@ -81,5 +82,14 @@
 			gpio-controller;
 			#gpio-cells = <2>;
 		};
+
+		leds0: led-controller at 10001904 {
+			compatible = "brcm,bcm6328-leds";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <0x10001900 0x24>;
+
+			status = "disabled";
+		};
 	};
 };
diff --git a/target/linux/brcm63xx/dts/bcm6368.dtsi b/target/linux/brcm63xx/dts/bcm6368.dtsi
index 7dbe9ec..958ee48 100644
--- a/target/linux/brcm63xx/dts/bcm6368.dtsi
+++ b/target/linux/brcm63xx/dts/bcm6368.dtsi
@@ -7,6 +7,7 @@
 		pflash = &pflash;
 		gpio0 = &gpio0;
 		gpio1 = &gpio1;
+		leds0 = &leds0;
 	};
 
 	cpus {
@@ -93,6 +94,15 @@
 			gpio-controller;
 			#gpio-cells = <2>;
 		};
+
+		leds0: led-controller at 100000d0 {
+			compatible = "brcm,bcm6358-leds";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <0x100000d0 0x8>;
+
+			status = "disabled";
+		};
 	};
 
 	pflash: nor at 18000000 {
diff --git a/target/linux/brcm63xx/dts/ct-6373.dts b/target/linux/brcm63xx/dts/ct-6373.dts
index d6f0f8b..3aac3eb 100644
--- a/target/linux/brcm63xx/dts/ct-6373.dts
+++ b/target/linux/brcm63xx/dts/ct-6373.dts
@@ -8,26 +8,6 @@
 	model = "Comtrend CT-6373";
 	compatible = "comtrend,ct-6373", "brcm,bcm6358";
 
-	spi-gpio {
-		#address-cells = <1>;
-		#size-cells = <1>;
-		compatible = "spi-gpio";
-
-		gpio-mosi = <&gpio0 7 0>;
-		gpio-sck = <&gpio0 6 0>;
-		num-chipselects = <0>;
-
-		hc595: gpio-spi-controller at 0 {
-			compatible = "fairchild,74hc595";
-			reg = <0>;
-			registers-number = <1>;
-			spi-max-frequency = <100000>;
-
-			gpio-controller;
-			#gpio-cells = <2>;
-		};
-	};
-
 	gpio-keys-polled {
 		compatible = "gpio-keys-polled";
 		#address-cells = <1>;
@@ -58,22 +38,31 @@
 			label = "CT6373-1:green:wlan";
 			gpios = <&gpio0 9 1>;
 		};
-		dsl_green {
-			label = "CT6373-1:green:adsl";
-			gpios = <&hc595 0 1>;
-		};
-		line_green {
-			label = "CT6373-1:green:line";
-			gpios = <&hc595 1 1>;
-		};
-		fxs1_green {
-			label = "CT6373-1:green:fxs1";
-			gpios = <&hc595 2 1>;
-		};
-		fxs2_green {
-			label = "CT6373-1:green:fxs2";
-			gpios = <&hc595 3 1>;
-		};
+	};
+};
+
+&leds0 {
+	status = "ok";
+
+	dsl_green at 0 {
+		reg = <0>;
+		active-low;
+		label = "CT6373-1:green:adsl";
+	};
+	line_green at 1 {
+		reg = <1>;
+		active-low;
+		label = "CT6373-1:green:line";
+	};
+	fxs1_green at 2 {
+		reg = <2>;
+		active-low;
+		label = "CT6373-1:green:fxs1";
+	};
+	fxs2_green at 3 {
+		reg = <3>;
+		active-low;
+		label = "CT6373-1:green:fxs2";
 	};
 };
 
diff --git a/target/linux/brcm63xx/dts/homehub2a.dts b/target/linux/brcm63xx/dts/homehub2a.dts
index 9e7ce2f..9d1dfca 100644
--- a/target/linux/brcm63xx/dts/homehub2a.dts
+++ b/target/linux/brcm63xx/dts/homehub2a.dts
@@ -8,27 +8,6 @@
 	model = "BT Home Hub 2.0 Type A";
 	compatible = "thomson,homehub2a", "brcm,bcm6358";
 
-	spi-gpio {
-		#address-cells = <1>;
-		#size-cells = <1>;
-		compatible = "spi-gpio";
-
-		gpio-mosi = <&gpio0 7 0>;
-		gpio-sck = <&gpio0 6 0>;
-		cs-gpios = <&gpio0 5 0>;
-		num-chipselects = <1>;
-
-		hc595: gpio-spi-controller at 0 {
-			compatible = "fairchild,74hc595";
-			reg = <0>;
-			registers-number = <2>;
-			spi-max-frequency = <100000>;
-
-			gpio-controller;
-			#gpio-cells = <2>;
-		};
-	};
-
 	gpio-keys-polled {
 		compatible = "gpio-keys-polled";
 		#address-cells = <1>;
@@ -52,71 +31,86 @@
 			linux,code = <KEY_WPS_BUTTON>;
 		};
 	};
+};
 
-	gpio-leds {
-		compatible = "gpio-leds";
+&leds0 {
+	status = "ok";
 
-		power_red {
-			label = "HOMEHUB2A:red:power";
-			gpios = <&hc595 0 1>;
-		};
-		power_green {
-			label = "HOMEHUB2A:green:power";
-			gpios = <&hc595 1 1>;
-			default-state = "on";
-		};
-		power_blue {
-			label = "HOMEHUB2A:blue:power";
-			gpios = <&hc595 2 1>;
-		};
-		broadband_red {
-			label = "HOMEHUB2A:red:broadband";
-			gpios = <&hc595 3 1>;
-		};
-		broadband_green {
-			label = "HOMEHUB2A:green:broadband";
-			gpios = <&hc595 4 1>;
-		};
-		broadband_blue {
-			label = "HOMEHUB2A:blue:broadband";
-			gpios = <&hc595 5 1>;
-		};
-		wireless_red {
-			label = "HOMEHUB2A:red:wireless";
-			gpios = <&hc595 6 1>;
-		};
-		wireless_green {
-			label = "HOMEHUB2A:green:wireless";
-			gpios = <&hc595 7 1>;
-		};
-		wireless_blue {
-			label = "HOMEHUB2A:blue:wireless";
-			gpios = <&hc595 8 1>;
-		};
-		phone_red {
-			label = "HOMEHUB2A:red:phone";
-			gpios = <&hc595 9 1>;
-		};
-		phone_green {
-			label = "HOMEHUB2A:green:phone";
-			gpios = <&hc595 10 1>;
-		};
-		phone_blue {
-			label = "HOMEHUB2A:blue:phone";
-			gpios = <&hc595 11 1>;
-		};
-		upgrading_red {
-			label = "HOMEHUB2A:red:upgrading";
-			gpios = <&hc595 12 1>;
-		};
-		upgrading_green {
-			label = "HOMEHUB2A:green:upgrading";
-			gpios = <&hc595 13 1>;
-		};
-		upgrading_blue {
-			label = "HOMEHUB2A:blue:upgrading";
-			gpios = <&hc595 14 1>;
-		};
+	power_red at 0 {
+		reg = <0>;
+		active-low;
+		label = "HOMEHUB2A:red:power";
+	};
+	power_green at 1 {
+		reg = <1>;
+		active-low;
+		label = "HOMEHUB2A:green:power";
+		default-state = "on";
+	};
+	power_blue at 2 {
+		reg = <2>;
+		active-low;
+		label = "HOMEHUB2A:blue:power";
+	};
+	broadband_red at 3 {
+		reg = <3>;
+		active-low;
+		label = "HOMEHUB2A:red:broadband";
+	};
+	broadband_green at 4 {
+		reg = <4>;
+		active-low;
+		label = "HOMEHUB2A:green:broadband";
+	};
+	broadband_blue at 5 {
+		reg = <5>;
+		active-low;
+		label = "HOMEHUB2A:blue:broadband";
+	};
+	wireless_red at 6 {
+		reg = <6>;
+		active-low;
+		label = "HOMEHUB2A:red:wireless";
+	};
+	wireless_green at 7 {
+		reg = <7>;
+		active-low;
+		label = "HOMEHUB2A:green:wireless";
+	};
+	wireless_blue at 8 {
+		reg = <8>;
+		active-low;
+		label = "HOMEHUB2A:blue:wireless";
+	};
+	phone_red at 9 {
+		reg = <9>;
+		active-low;
+		label = "HOMEHUB2A:red:phone";
+	};
+	phone_green at 10 {
+		reg = <10>;
+		active-low;
+		label = "HOMEHUB2A:green:phone";
+	};
+	phone_blue at 11 {
+		reg = <11>;
+		active-low;
+		label = "HOMEHUB2A:blue:phone";
+	};
+	upgrading_red at 12 {
+		reg = <12>;
+		active-low;
+		label = "HOMEHUB2A:red:upgrading";
+	};
+	upgrading_green at 13 {
+		reg = <13>;
+		active-low;
+		label = "HOMEHUB2A:green:upgrading";
+	};
+	upgrading_blue at 14 {
+		reg = <14>;
+		active-low;
+		label = "HOMEHUB2A:blue:upgrading";
 	};
 };
 
diff --git a/target/linux/brcm63xx/dts/nb4-fxc-r1.dts b/target/linux/brcm63xx/dts/nb4-fxc-r1.dts
index 65f26c7..0324b77 100644
--- a/target/linux/brcm63xx/dts/nb4-fxc-r1.dts
+++ b/target/linux/brcm63xx/dts/nb4-fxc-r1.dts
@@ -8,26 +8,6 @@
 	model = "SFR Neuf Box 4 (Foxconn)";
 	compatible = "sfr,nb4-fxc-r1", "brcm,bcm6358";
 
-	spi-gpio {
-		#address-cells = <1>;
-		#size-cells = <1>;
-		compatible = "spi-gpio";
-
-		gpio-mosi = <&gpio0 7 0>;
-		gpio-sck = <&gpio0 6 0>;
-		num-chipselects = <0>;
-
-		hc595: gpio-spi-controller at 0 {
-			compatible = "fairchild,74hc595";
-			reg = <0>;
-			registers-number = <1>;
-			spi-max-frequency = <100000>;
-
-			gpio-controller;
-			#gpio-cells = <2>;
-		};
-	};
-
 	gpio-keys-polled {
 		compatible = "gpio-keys-polled";
 		#address-cells = <1>;
@@ -80,21 +60,30 @@
 			label = "NB4-FXC-r1:green:service";
 			gpios = <&gpio0 30 0>;
 		};
-		alarm_white {
-			label = "NB4-FXC-r1:white:alarm";
-			gpios = <&hc595 0 1>;
-		};
-		tv_white {
-			label = "NB4-FXC-r1:white:tv";
-			gpios = <&hc595 2 1>;
-		};
-		tel_white {
-			label = "NB4-FXC-r1:white:tel";
-			gpios = <&hc595 3 1>;
-		};
-		adsl_white {
-			label = "NB4-FXC-r0:white:adsl";
-			gpios = <&hc595 4 1>;
-		};
+	};
+};
+
+&leds0 {
+	status = "ok";
+
+	alarm_white at 0 {
+		reg = <0>;
+		active-low;
+		label = "NB4-FXC-r1:white:alarm";
+	};
+	tv_white at 2 {
+		reg = <2>;
+		active-low;
+		label = "NB4-FXC-r1:white:tv";
+	};
+	tel_white at 3 {
+		reg = <3>;
+		active-low;
+		label = "NB4-FXC-r1:white:tel";
+	};
+	adsl_white at 4 {
+		reg = <4>;
+		active-low;
+		label = "NB4-FXC-r0:white:adsl";
 	};
 };
diff --git a/target/linux/brcm63xx/dts/nb4-ser-r0.dts b/target/linux/brcm63xx/dts/nb4-ser-r0.dts
index 1a48b72..57087d2 100644
--- a/target/linux/brcm63xx/dts/nb4-ser-r0.dts
+++ b/target/linux/brcm63xx/dts/nb4-ser-r0.dts
@@ -8,26 +8,6 @@
 	model = "SFR Neuf Box 4 (Sercomm)";
 	compatible = "sfr,nb4-ser-r0", "brcm,bcm6358";
 
-	spi-gpio {
-		#address-cells = <1>;
-		#size-cells = <1>;
-		compatible = "spi-gpio";
-
-		gpio-mosi = <&gpio0 7 0>;
-		gpio-sck = <&gpio0 6 0>;
-		num-chipselects = <0>;
-
-		hc595: gpio-spi-controller at 0 {
-			compatible = "fairchild,74hc595";
-			reg = <0>;
-			registers-number = <1>;
-			spi-max-frequency = <100000>;
-
-			gpio-controller;
-			#gpio-cells = <2>;
-		};
-	};
-
 	gpio-keys-polled {
 		compatible = "gpio-keys-polled";
 		#address-cells = <1>;
@@ -80,21 +60,30 @@
 			label = "NB4-SER-r0:green:service";
 			gpios = <&gpio0 30 1>;
 		};
-		alarm_white {
-			label = "NB4-SER-r0:white:alarm";
-			gpios = <&hc595 0 1>;
-		};
-		tv_white {
-			label = "NB4-SER-r0:white:tv";
-			gpios = <&hc595 2 1>;
-		};
-		tel_white {
-			label = "NB4-SER-r0:white:tel";
-			gpios = <&hc595 3 1>;
-		};
-		adsl_white {
-			label = "NB4-SER-r0:white:adsl";
-			gpios = <&hc595 4 1>;
-		};
+	};
+};
+
+&leds0 {
+	status = "ok";
+
+	alarm_white at 0 {
+		reg = <0>;
+		active-low;
+		label = "NB4-SER-r0:white:alarm";
+	};
+	tv_white at 2 {
+		reg = <2>;
+		active-low;
+		label = "NB4-SER-r0:white:tv";
+	};
+	tel_white at 3 {
+		reg = <3>;
+		active-low;
+		label = "NB4-SER-r0:white:tel";
+	};
+	adsl_white at 4 {
+		reg = <4>;
+		active-low;
+		label = "NB4-SER-r0:white:adsl";
 	};
 };
-- 
1.9.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list