[source] brcm63xx: switch to hardware led controllers
LEDE Commits
lede-commits at lists.infradead.org
Sun Jun 11 03:01:46 PDT 2017
jogo pushed a commit to source.git, branch master:
https://git.lede-project.org/9ceeaf4c6cac6e5ff5a5225a5c9d13ba63d9c478
commit 9ceeaf4c6cac6e5ff5a5225a5c9d13ba63d9c478
Author: Jonas Gorski <jonas.gorski at gmail.com>
AuthorDate: Thu May 11 13:50:18 2017 +0200
brcm63xx: switch to hardware led controllers
Instead of bit banging SPI to talk to the GPIO chip, use the hardware
led controllers intended for controlling the LEDs.
Signed-off-by: Jonas Gorski <jonas.gorski at gmail.com>
---
target/linux/brcm63xx/config-4.4 | 5 +-
target/linux/brcm63xx/dts/bcm6318.dtsi | 8 ++
target/linux/brcm63xx/dts/bcm63268.dtsi | 8 ++
target/linux/brcm63xx/dts/bcm6328.dtsi | 8 ++
target/linux/brcm63xx/dts/bcm6358.dtsi | 8 ++
target/linux/brcm63xx/dts/bcm6362.dtsi | 8 ++
target/linux/brcm63xx/dts/bcm6368.dtsi | 8 ++
target/linux/brcm63xx/dts/ct-6373.dts | 67 ++++++------
target/linux/brcm63xx/dts/homehub2a.dts | 179 ++++++++++++++++---------------
target/linux/brcm63xx/dts/nb4-fxc-r1.dts | 67 ++++++------
target/linux/brcm63xx/dts/nb4-ser-r0.dts | 67 ++++++------
11 files changed, 238 insertions(+), 195 deletions(-)
diff --git a/target/linux/brcm63xx/config-4.4 b/target/linux/brcm63xx/config-4.4
index 337c14c..f8ba4a0 100644
--- a/target/linux/brcm63xx/config-4.4
+++ b/target/linux/brcm63xx/config-4.4
@@ -80,7 +80,6 @@ CONFIG_GENERIC_SCHED_CLOCK=y
CONFIG_GENERIC_SMP_IDLE_THREAD=y
CONFIG_GENERIC_TIME_VSYSCALL=y
CONFIG_GPIOLIB=y
-CONFIG_GPIO_74X164=y
CONFIG_GPIO_BCM63XX=y
CONFIG_GPIO_DEVRES=y
CONFIG_GPIO_GENERIC=y
@@ -139,6 +138,8 @@ CONFIG_IRQ_MIPS_CPU=y
CONFIG_IRQ_WORK=y
CONFIG_KEXEC=y
CONFIG_KEXEC_CORE=y
+CONFIG_LEDS_BCM6328=y
+CONFIG_LEDS_BCM6358=y
CONFIG_LEDS_GPIO=y
CONFIG_LIBFDT=y
CONFIG_MDIO_BOARDINFO=y
@@ -221,8 +222,6 @@ CONFIG_SERIAL_BCM63XX_CONSOLE=y
CONFIG_SPI=y
CONFIG_SPI_BCM63XX=y
CONFIG_SPI_BCM63XX_HSSPI=y
-CONFIG_SPI_BITBANG=y
-CONFIG_SPI_GPIO=y
CONFIG_SPI_MASTER=y
CONFIG_SQUASHFS_EMBEDDED=y
CONFIG_SRCU=y
diff --git a/target/linux/brcm63xx/dts/bcm6318.dtsi b/target/linux/brcm63xx/dts/bcm6318.dtsi
index c1dcad3..7c45051 100644
--- a/target/linux/brcm63xx/dts/bcm6318.dtsi
+++ b/target/linux/brcm63xx/dts/bcm6318.dtsi
@@ -166,6 +166,14 @@
};
};
+ leds: led-controller at 10000200 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "brcm,bcm6328-leds";
+ reg = <0x10000200 0x24>;
+ status = "disabled";
+ };
+
hsspi: spi at 10003000 {
#address-cells = <1>;
#size-cells = <0>;
diff --git a/target/linux/brcm63xx/dts/bcm63268.dtsi b/target/linux/brcm63xx/dts/bcm63268.dtsi
index d64fe19..94c7dd0 100644
--- a/target/linux/brcm63xx/dts/bcm63268.dtsi
+++ b/target/linux/brcm63xx/dts/bcm63268.dtsi
@@ -210,5 +210,13 @@
interrupts = <6>;
/* clocks = <&clkctl 16>; */
};
+
+ leds: led-controller at 10001900 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "brcm,bcm6328-leds";
+ reg = <0x10001900 0x24>;
+ status = "disabled";
+ };
};
};
diff --git a/target/linux/brcm63xx/dts/bcm6328.dtsi b/target/linux/brcm63xx/dts/bcm6328.dtsi
index 0bb41cf..7a79aed 100644
--- a/target/linux/brcm63xx/dts/bcm6328.dtsi
+++ b/target/linux/brcm63xx/dts/bcm6328.dtsi
@@ -151,6 +151,14 @@
};
};
+ leds: led-controller at 10000800 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "brcm,bcm6328-leds";
+ reg = <0x10000800 0x24>;
+ status = "disabled";
+ };
+
hsspi: spi at 10001000 {
#address-cells = <1>;
#size-cells = <0>;
diff --git a/target/linux/brcm63xx/dts/bcm6358.dtsi b/target/linux/brcm63xx/dts/bcm6358.dtsi
index 36b19e7..8feb3dd 100644
--- a/target/linux/brcm63xx/dts/bcm6358.dtsi
+++ b/target/linux/brcm63xx/dts/bcm6358.dtsi
@@ -155,6 +155,14 @@
reg = <0xfffe0098 0x4>;
};
+ leds: led-controller at fffe00d0 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "brcm,bcm6358-leds";
+ reg = <0xfffe00d0 0x8>;
+ status = "disabled";
+ };
+
lsspi: spi at fffe0800 {
#address-cells = <1>;
#size-cells = <0>;
diff --git a/target/linux/brcm63xx/dts/bcm6362.dtsi b/target/linux/brcm63xx/dts/bcm6362.dtsi
index 11edf71..076fc6a 100644
--- a/target/linux/brcm63xx/dts/bcm6362.dtsi
+++ b/target/linux/brcm63xx/dts/bcm6362.dtsi
@@ -254,5 +254,13 @@
interrupts = <5>;
/* clocks = <&clkctl 16>; */
};
+
+ leds: led-controller at 10001900 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "brcm,bcm6328-leds";
+ reg = <0x10001900 0x24>;
+ status = "disabled";
+ };
};
};
diff --git a/target/linux/brcm63xx/dts/bcm6368.dtsi b/target/linux/brcm63xx/dts/bcm6368.dtsi
index a49f24a..3efe76c 100644
--- a/target/linux/brcm63xx/dts/bcm6368.dtsi
+++ b/target/linux/brcm63xx/dts/bcm6368.dtsi
@@ -262,6 +262,14 @@
reg = <0x100000b8 0x4>;
};
+ leds: led-controller at 100000d0 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "brcm,bcm6358-leds";
+ reg = <0x100000d0 0x8>;
+ status = "disabled";
+ };
+
lsspi: spi at 10000800 {
#address-cells = <1>;
#size-cells = <0>;
diff --git a/target/linux/brcm63xx/dts/ct-6373.dts b/target/linux/brcm63xx/dts/ct-6373.dts
index 8e6eb45..8ddcacb 100644
--- a/target/linux/brcm63xx/dts/ct-6373.dts
+++ b/target/linux/brcm63xx/dts/ct-6373.dts
@@ -12,26 +12,6 @@
bootargs = "root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200";
};
- spi-gpio {
- #address-cells = <1>;
- #size-cells = <0>;
- compatible = "spi-gpio";
-
- gpio-mosi = <&pinctrl 7 0>;
- gpio-sck = <&pinctrl 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>;
@@ -62,22 +42,37 @@
label = "CT6373-1:green:wlan";
gpios = <&pinctrl 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>;
- };
+ };
+};
+
+&leds {
+ status = "ok";
+
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_serial_led>;
+
+ led at 0 {
+ reg = <0>;
+ active-low;
+ label = "CT6373-1:green:adsl";
+ };
+
+ led at 1 {
+ reg = <1>;
+ active-low;
+ label = "CT6373-1:green:line";
+ };
+
+ led at 2 {
+ reg = <2>;
+ active-low;
+ label = "CT6373-1:green:fxs1";
+ };
+
+ led 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 0d51c87..6192687 100644
--- a/target/linux/brcm63xx/dts/homehub2a.dts
+++ b/target/linux/brcm63xx/dts/homehub2a.dts
@@ -12,27 +12,6 @@
bootargs = "root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200";
};
- spi-gpio {
- #address-cells = <1>;
- #size-cells = <0>;
- compatible = "spi-gpio";
-
- gpio-mosi = <&pinctrl 7 0>;
- gpio-sck = <&pinctrl 6 0>;
- cs-gpios = <&pinctrl 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>;
@@ -56,71 +35,103 @@
linux,code = <KEY_WPS_BUTTON>;
};
};
+};
- gpio-leds {
- compatible = "gpio-leds";
+&leds {
+ 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>;
- };
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_serial_led>;
+
+ led at 0 {
+ reg = <0>;
+ active-low;
+ label = "HOMEHUB2A:red:power";
+ };
+
+ led at 1 {
+ reg = <0>;
+ active-low;
+ label = "HOMEHUB2A:green:power";
+ default-state = "on";
+ };
+
+ led at 2 {
+ reg = <2>;
+ active-low;
+ label = "HOMEHUB2A:blue:power";
+ };
+
+ led at 3 {
+ reg = <3>;
+ active-low;
+ label = "HOMEHUB2A:red:broadband";
+ };
+
+ led at 4 {
+ reg = <4>;
+ active-low;
+ label = "HOMEHUB2A:green:broadband";
+ };
+
+ led at 5 {
+ reg = <5>;
+ active-low;
+ label = "HOMEHUB2A:blue:broadband";
+ };
+
+ led at 6 {
+ reg = <6>;
+ active-low;
+ label = "HOMEHUB2A:red:wireless";
+ };
+
+ led at 7 {
+ reg = <7>;
+ active-low;
+ label = "HOMEHUB2A:green:wireless";
+ };
+
+ led at 8 {
+ reg = <8>;
+ active-low;
+ label = "HOMEHUB2A:blue:wireless";
+ };
+
+ led at 9 {
+ reg = <9>;
+ active-low;
+ label = "HOMEHUB2A:red:phone";
+ };
+
+ led at 10 {
+ reg = <10>;
+ active-low;
+ label = "HOMEHUB2A:green:phone";
+ };
+
+ led at 11 {
+ reg = <11>;
+ active-low;
+ label = "HOMEHUB2A:blue:phone";
+ };
+
+ led at 12 {
+ reg = <12>;
+ active-low;
+ label = "HOMEHUB2A:red:upgrading";
+ };
+
+ led at 13 {
+ reg = <13>;
+ active-low;
+ label = "HOMEHUB2A:green:upgrading";
+ };
+
+ led 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 4960afb..e11ec46 100644
--- a/target/linux/brcm63xx/dts/nb4-fxc-r1.dts
+++ b/target/linux/brcm63xx/dts/nb4-fxc-r1.dts
@@ -12,26 +12,6 @@
bootargs = "root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200";
};
- spi-gpio {
- #address-cells = <1>;
- #size-cells = <0>;
- compatible = "spi-gpio";
-
- gpio-mosi = <&pinctrl 7 0>;
- gpio-sck = <&pinctrl 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>;
@@ -84,22 +64,37 @@
label = "NB4-FXC-r1:green:service";
gpios = <&pinctrl 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>;
- };
+ };
+};
+
+&leds {
+ status = "ok";
+
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_serial_led>;
+
+ led at 0 {
+ reg = <0>;
+ active-low;
+ label = "NB4-FXC-r1:white:alarm";
+ };
+
+ led at 2 {
+ reg = <2>;
+ active-low;
+ label = "NB4-FXC-r1:white:tv";
+ };
+
+ led at 3 {
+ reg = <3>;
+ active-low;
+ label = "NB4-FXC-r1:white:tel";
+ };
+
+ led at 4 {
+ reg = <4>;
+ active-low;
+ label = "NB4-FXC-r1:white:adsl";
};
};
diff --git a/target/linux/brcm63xx/dts/nb4-ser-r0.dts b/target/linux/brcm63xx/dts/nb4-ser-r0.dts
index 128a16a..8a33c66 100644
--- a/target/linux/brcm63xx/dts/nb4-ser-r0.dts
+++ b/target/linux/brcm63xx/dts/nb4-ser-r0.dts
@@ -12,26 +12,6 @@
bootargs = "root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200";
};
- spi-gpio {
- #address-cells = <1>;
- #size-cells = <0>;
- compatible = "spi-gpio";
-
- gpio-mosi = <&pinctrl 7 0>;
- gpio-sck = <&pinctrl 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>;
@@ -84,22 +64,37 @@
label = "NB4-SER-r0:green:service";
gpios = <&pinctrl 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>;
- };
+ };
+};
+
+&leds {
+ status = "ok";
+
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_serial_led>;
+
+ led at 0 {
+ reg = <0>;
+ active-low;
+ label = "NB4-SER-r0:white:alarm";
+ };
+
+ led at 2 {
+ reg = <2>;
+ active-low;
+ label = "NB4-SER-r0:white:tv";
+ };
+
+ led at 3 {
+ reg = <3>;
+ active-low;
+ label = "NB4-SER-r0:white:tel";
+ };
+
+ led at 4 {
+ reg = <4>;
+ active-low;
+ label = "NB4-SER-r0:white:adsl";
};
};
More information about the lede-commits
mailing list