brcm63xx: switch to hardware led controllers
authorJonas Gorski <jonas.gorski@gmail.com>
Thu, 11 May 2017 11:50:18 +0000 (13:50 +0200)
committerJonas Gorski <jonas.gorski@gmail.com>
Sat, 10 Jun 2017 10:40:38 +0000 (12:40 +0200)
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@gmail.com>
target/linux/brcm63xx/config-4.4
target/linux/brcm63xx/dts/bcm6318.dtsi
target/linux/brcm63xx/dts/bcm63268.dtsi
target/linux/brcm63xx/dts/bcm6328.dtsi
target/linux/brcm63xx/dts/bcm6358.dtsi
target/linux/brcm63xx/dts/bcm6362.dtsi
target/linux/brcm63xx/dts/bcm6368.dtsi
target/linux/brcm63xx/dts/ct-6373.dts
target/linux/brcm63xx/dts/homehub2a.dts
target/linux/brcm63xx/dts/nb4-fxc-r1.dts
target/linux/brcm63xx/dts/nb4-ser-r0.dts

index 337c14c4b1f06d841a3d312364903e850ff04b25..f8ba4a06970fc12c1799d5d0cd3e7dca2a6cbcaf 100644 (file)
@@ -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
index c1dcad3ced119e845380c5cde9318f529005e610..7c4505157e4e88e551c94adfb1192b37d7ec01c1 100644 (file)
                        };
                };
 
+               leds: led-controller@10000200 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "brcm,bcm6328-leds";
+                       reg = <0x10000200 0x24>;
+                       status = "disabled";
+               };
+
                hsspi: spi@10003000 {
                        #address-cells = <1>;
                        #size-cells = <0>;
index d64fe19d0e4ace7171bbbefca4f306a031fe383c..94c7dd0138d8526a3ab3824353b79b3d4f118ab8 100644 (file)
                        interrupts = <6>;
                        /* clocks = <&clkctl 16>; */
                };
+
+               leds: led-controller@10001900 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "brcm,bcm6328-leds";
+                       reg = <0x10001900 0x24>;
+                       status = "disabled";
+               };
        };
 };
index 0bb41cfb8734cf4b8cc71c191ecb1e5c7ff3ff9a..7a79aed26c2b642c60288eb2be8381ba50c8bac0 100644 (file)
                        };
                };
 
+               leds: led-controller@10000800 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "brcm,bcm6328-leds";
+                       reg = <0x10000800 0x24>;
+                       status = "disabled";
+               };
+
                hsspi: spi@10001000 {
                        #address-cells = <1>;
                        #size-cells = <0>;
index 36b19e7710acca62b4cee3fcf259d6462c699e4a..8feb3dd61ec36b7606b8681ab83d789c2cf82b20 100644 (file)
                        reg = <0xfffe0098 0x4>;
                };
 
+               leds: led-controller@fffe00d0 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "brcm,bcm6358-leds";
+                       reg = <0xfffe00d0 0x8>;
+                       status = "disabled";
+               };
+
                lsspi: spi@fffe0800 {
                        #address-cells = <1>;
                        #size-cells = <0>;
index 11edf71aa90792370d28f66f754425865f4e03f3..076fc6a3ad5cd4fc3cc6d8ef44a742876ed298d0 100644 (file)
                        interrupts = <5>;
                        /* clocks = <&clkctl 16>; */
                };
+
+               leds: led-controller@10001900 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "brcm,bcm6328-leds";
+                       reg = <0x10001900 0x24>;
+                       status = "disabled";
+               };
        };
 };
index a49f24a96c92bd9742fbf64b3b77fcba1d461691..3efe76c6c76e42db9346d89eea52b5c1e2b45ca5 100644 (file)
                        reg = <0x100000b8 0x4>;
                };
 
+               leds: led-controller@100000d0 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+                       compatible = "brcm,bcm6358-leds";
+                       reg = <0x100000d0 0x8>;
+                       status = "disabled";
+               };
+
                lsspi: spi@10000800 {
                        #address-cells = <1>;
                        #size-cells = <0>;
index 8e6eb453a731df12dc67c0d598e16b0447038bab..8ddcacb4d3e0815442a3a2acfe812fb69f262575 100644 (file)
                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@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>;
                        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@0 {
+               reg = <0>;
+               active-low;
+               label = "CT6373-1:green:adsl";
+       };
+
+       led@1 {
+               reg = <1>;
+               active-low;
+               label = "CT6373-1:green:line";
+       };
+
+       led@2 {
+               reg = <2>;
+               active-low;
+               label = "CT6373-1:green:fxs1";
+       };
+
+       led@3 {
+               reg = <3>;
+               active-low;
+               label = "CT6373-1:green:fxs2";
        };
 };
 
index 0d51c870a173865be79a460606aa212093febb3d..6192687d1b3ebcd1cae04d878fa9b407db4e864a 100644 (file)
                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@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>;
                        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@0 {
+               reg = <0>;
+               active-low;
+               label = "HOMEHUB2A:red:power";
+       };
+
+       led@1 {
+               reg = <0>;
+               active-low;
+               label = "HOMEHUB2A:green:power";
+               default-state = "on";
+       };
+
+       led@2 {
+               reg = <2>;
+               active-low;
+               label = "HOMEHUB2A:blue:power";
+       };
+
+       led@3 {
+               reg = <3>;
+               active-low;
+               label = "HOMEHUB2A:red:broadband";
+       };
+
+       led@4 {
+               reg = <4>;
+               active-low;
+               label = "HOMEHUB2A:green:broadband";
+       };
+
+       led@5 {
+               reg = <5>;
+               active-low;
+               label = "HOMEHUB2A:blue:broadband";
+       };
+
+       led@6 {
+               reg = <6>;
+               active-low;
+               label = "HOMEHUB2A:red:wireless";
+       };
+
+       led@7 {
+               reg = <7>;
+               active-low;
+               label = "HOMEHUB2A:green:wireless";
+       };
+
+       led@8 {
+               reg = <8>;
+               active-low;
+               label = "HOMEHUB2A:blue:wireless";
+       };
+
+       led@9 {
+               reg = <9>;
+               active-low;
+               label = "HOMEHUB2A:red:phone";
+       };
+
+       led@10 {
+               reg = <10>;
+               active-low;
+               label = "HOMEHUB2A:green:phone";
+       };
+
+       led@11 {
+               reg = <11>;
+               active-low;
+               label = "HOMEHUB2A:blue:phone";
+       };
+
+       led@12 {
+               reg = <12>;
+               active-low;
+               label = "HOMEHUB2A:red:upgrading";
+       };
+
+       led@13 {
+               reg = <13>;
+               active-low;
+               label = "HOMEHUB2A:green:upgrading";
+       };
+
+       led@14 {
+               reg = <14>;
+               active-low;
+               label = "HOMEHUB2A:blue:upgrading";
        };
 };
 
index 4960afb49c9436e83045a376b3aa5aca59caa6ca..e11ec4678d45c1bdab1a29abb09b1ad42b9b7f18 100644 (file)
                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@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>;
                        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@0 {
+               reg = <0>;
+               active-low;
+               label = "NB4-FXC-r1:white:alarm";
+       };
+
+       led@2 {
+               reg = <2>;
+               active-low;
+               label = "NB4-FXC-r1:white:tv";
+       };
+
+       led@3 {
+               reg = <3>;
+               active-low;
+               label = "NB4-FXC-r1:white:tel";
+       };
+
+       led@4 {
+               reg = <4>;
+               active-low;
+               label = "NB4-FXC-r1:white:adsl";
        };
 };
 
index 128a16aa014d1855d4bc866cb8c2ee32ba81d955..8a33c66015d7be932856b3261e178b880ae0d4ab 100644 (file)
                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@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>;
                        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@0 {
+               reg = <0>;
+               active-low;
+               label = "NB4-SER-r0:white:alarm";
+       };
+
+       led@2 {
+               reg = <2>;
+               active-low;
+               label = "NB4-SER-r0:white:tv";
+       };
+
+       led@3 {
+               reg = <3>;
+               active-low;
+               label = "NB4-SER-r0:white:tel";
+       };
+
+       led@4 {
+               reg = <4>;
+               active-low;
+               label = "NB4-SER-r0:white:adsl";
        };
 };