From: Jonas Gorski Date: Thu, 11 May 2017 11:50:18 +0000 (+0200) Subject: brcm63xx: switch to hardware led controllers X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=9ceeaf4c6cac6e5ff5a5225a5c9d13ba63d9c478;p=openwrt%2Fstaging%2Fflorian.git 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 --- diff --git a/target/linux/brcm63xx/config-4.4 b/target/linux/brcm63xx/config-4.4 index 337c14c4b1..f8ba4a0697 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 c1dcad3ced..7c4505157e 100644 --- a/target/linux/brcm63xx/dts/bcm6318.dtsi +++ b/target/linux/brcm63xx/dts/bcm6318.dtsi @@ -166,6 +166,14 @@ }; }; + 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>; diff --git a/target/linux/brcm63xx/dts/bcm63268.dtsi b/target/linux/brcm63xx/dts/bcm63268.dtsi index d64fe19d0e..94c7dd0138 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@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 0bb41cfb87..7a79aed26c 100644 --- a/target/linux/brcm63xx/dts/bcm6328.dtsi +++ b/target/linux/brcm63xx/dts/bcm6328.dtsi @@ -151,6 +151,14 @@ }; }; + 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>; diff --git a/target/linux/brcm63xx/dts/bcm6358.dtsi b/target/linux/brcm63xx/dts/bcm6358.dtsi index 36b19e7710..8feb3dd61e 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@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>; diff --git a/target/linux/brcm63xx/dts/bcm6362.dtsi b/target/linux/brcm63xx/dts/bcm6362.dtsi index 11edf71aa9..076fc6a3ad 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@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 a49f24a96c..3efe76c6c7 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@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>; diff --git a/target/linux/brcm63xx/dts/ct-6373.dts b/target/linux/brcm63xx/dts/ct-6373.dts index 8e6eb453a7..8ddcacb4d3 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@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@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"; }; }; diff --git a/target/linux/brcm63xx/dts/homehub2a.dts b/target/linux/brcm63xx/dts/homehub2a.dts index 0d51c870a1..6192687d1b 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@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 = ; }; }; +}; - 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"; }; }; diff --git a/target/linux/brcm63xx/dts/nb4-fxc-r1.dts b/target/linux/brcm63xx/dts/nb4-fxc-r1.dts index 4960afb49c..e11ec4678d 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@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@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"; }; }; diff --git a/target/linux/brcm63xx/dts/nb4-ser-r0.dts b/target/linux/brcm63xx/dts/nb4-ser-r0.dts index 128a16aa01..8a33c66015 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@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@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"; }; };