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@gmail.com>
openwrt-18.06
Jonas Gorski 2017-05-11 13:50:18 +02:00
parent 0aa366c6e0
commit 9ceeaf4c6c
11 changed files with 238 additions and 195 deletions

View File

@ -80,7 +80,6 @@ CONFIG_GENERIC_SCHED_CLOCK=y
CONFIG_GENERIC_SMP_IDLE_THREAD=y CONFIG_GENERIC_SMP_IDLE_THREAD=y
CONFIG_GENERIC_TIME_VSYSCALL=y CONFIG_GENERIC_TIME_VSYSCALL=y
CONFIG_GPIOLIB=y CONFIG_GPIOLIB=y
CONFIG_GPIO_74X164=y
CONFIG_GPIO_BCM63XX=y CONFIG_GPIO_BCM63XX=y
CONFIG_GPIO_DEVRES=y CONFIG_GPIO_DEVRES=y
CONFIG_GPIO_GENERIC=y CONFIG_GPIO_GENERIC=y
@ -139,6 +138,8 @@ CONFIG_IRQ_MIPS_CPU=y
CONFIG_IRQ_WORK=y CONFIG_IRQ_WORK=y
CONFIG_KEXEC=y CONFIG_KEXEC=y
CONFIG_KEXEC_CORE=y CONFIG_KEXEC_CORE=y
CONFIG_LEDS_BCM6328=y
CONFIG_LEDS_BCM6358=y
CONFIG_LEDS_GPIO=y CONFIG_LEDS_GPIO=y
CONFIG_LIBFDT=y CONFIG_LIBFDT=y
CONFIG_MDIO_BOARDINFO=y CONFIG_MDIO_BOARDINFO=y
@ -221,8 +222,6 @@ CONFIG_SERIAL_BCM63XX_CONSOLE=y
CONFIG_SPI=y CONFIG_SPI=y
CONFIG_SPI_BCM63XX=y CONFIG_SPI_BCM63XX=y
CONFIG_SPI_BCM63XX_HSSPI=y CONFIG_SPI_BCM63XX_HSSPI=y
CONFIG_SPI_BITBANG=y
CONFIG_SPI_GPIO=y
CONFIG_SPI_MASTER=y CONFIG_SPI_MASTER=y
CONFIG_SQUASHFS_EMBEDDED=y CONFIG_SQUASHFS_EMBEDDED=y
CONFIG_SRCU=y CONFIG_SRCU=y

View File

@ -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 { hsspi: spi@10003000 {
#address-cells = <1>; #address-cells = <1>;
#size-cells = <0>; #size-cells = <0>;

View File

@ -210,5 +210,13 @@
interrupts = <6>; interrupts = <6>;
/* clocks = <&clkctl 16>; */ /* clocks = <&clkctl 16>; */
}; };
leds: led-controller@10001900 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "brcm,bcm6328-leds";
reg = <0x10001900 0x24>;
status = "disabled";
};
}; };
}; };

View File

@ -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 { hsspi: spi@10001000 {
#address-cells = <1>; #address-cells = <1>;
#size-cells = <0>; #size-cells = <0>;

View File

@ -155,6 +155,14 @@
reg = <0xfffe0098 0x4>; 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 { lsspi: spi@fffe0800 {
#address-cells = <1>; #address-cells = <1>;
#size-cells = <0>; #size-cells = <0>;

View File

@ -254,5 +254,13 @@
interrupts = <5>; interrupts = <5>;
/* clocks = <&clkctl 16>; */ /* clocks = <&clkctl 16>; */
}; };
leds: led-controller@10001900 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "brcm,bcm6328-leds";
reg = <0x10001900 0x24>;
status = "disabled";
};
}; };
}; };

View File

@ -262,6 +262,14 @@
reg = <0x100000b8 0x4>; 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 { lsspi: spi@10000800 {
#address-cells = <1>; #address-cells = <1>;
#size-cells = <0>; #size-cells = <0>;

View File

@ -12,26 +12,6 @@
bootargs = "root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; 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 { gpio-keys-polled {
compatible = "gpio-keys-polled"; compatible = "gpio-keys-polled";
#address-cells = <1>; #address-cells = <1>;
@ -62,22 +42,37 @@
label = "CT6373-1:green:wlan"; label = "CT6373-1:green:wlan";
gpios = <&pinctrl 9 1>; gpios = <&pinctrl 9 1>;
}; };
dsl_green { };
label = "CT6373-1:green:adsl"; };
gpios = <&hc595 0 1>;
}; &leds {
line_green { status = "ok";
label = "CT6373-1:green:line";
gpios = <&hc595 1 1>; pinctrl-names = "default";
}; pinctrl-0 = <&pinctrl_serial_led>;
fxs1_green {
label = "CT6373-1:green:fxs1"; led@0 {
gpios = <&hc595 2 1>; reg = <0>;
}; active-low;
fxs2_green { label = "CT6373-1:green:adsl";
label = "CT6373-1:green:fxs2"; };
gpios = <&hc595 3 1>;
}; 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";
}; };
}; };

View File

@ -12,27 +12,6 @@
bootargs = "root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; 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 { gpio-keys-polled {
compatible = "gpio-keys-polled"; compatible = "gpio-keys-polled";
#address-cells = <1>; #address-cells = <1>;
@ -56,71 +35,103 @@
linux,code = <KEY_WPS_BUTTON>; linux,code = <KEY_WPS_BUTTON>;
}; };
}; };
};
gpio-leds { &leds {
compatible = "gpio-leds"; status = "ok";
power_red { pinctrl-names = "default";
label = "HOMEHUB2A:red:power"; pinctrl-0 = <&pinctrl_serial_led>;
gpios = <&hc595 0 1>;
}; led@0 {
power_green { reg = <0>;
label = "HOMEHUB2A:green:power"; active-low;
gpios = <&hc595 1 1>; label = "HOMEHUB2A:red:power";
default-state = "on"; };
};
power_blue { led@1 {
label = "HOMEHUB2A:blue:power"; reg = <0>;
gpios = <&hc595 2 1>; active-low;
}; label = "HOMEHUB2A:green:power";
broadband_red { default-state = "on";
label = "HOMEHUB2A:red:broadband"; };
gpios = <&hc595 3 1>;
}; led@2 {
broadband_green { reg = <2>;
label = "HOMEHUB2A:green:broadband"; active-low;
gpios = <&hc595 4 1>; label = "HOMEHUB2A:blue:power";
}; };
broadband_blue {
label = "HOMEHUB2A:blue:broadband"; led@3 {
gpios = <&hc595 5 1>; reg = <3>;
}; active-low;
wireless_red { label = "HOMEHUB2A:red:broadband";
label = "HOMEHUB2A:red:wireless"; };
gpios = <&hc595 6 1>;
}; led@4 {
wireless_green { reg = <4>;
label = "HOMEHUB2A:green:wireless"; active-low;
gpios = <&hc595 7 1>; label = "HOMEHUB2A:green:broadband";
}; };
wireless_blue {
label = "HOMEHUB2A:blue:wireless"; led@5 {
gpios = <&hc595 8 1>; reg = <5>;
}; active-low;
phone_red { label = "HOMEHUB2A:blue:broadband";
label = "HOMEHUB2A:red:phone"; };
gpios = <&hc595 9 1>;
}; led@6 {
phone_green { reg = <6>;
label = "HOMEHUB2A:green:phone"; active-low;
gpios = <&hc595 10 1>; label = "HOMEHUB2A:red:wireless";
}; };
phone_blue {
label = "HOMEHUB2A:blue:phone"; led@7 {
gpios = <&hc595 11 1>; reg = <7>;
}; active-low;
upgrading_red { label = "HOMEHUB2A:green:wireless";
label = "HOMEHUB2A:red:upgrading"; };
gpios = <&hc595 12 1>;
}; led@8 {
upgrading_green { reg = <8>;
label = "HOMEHUB2A:green:upgrading"; active-low;
gpios = <&hc595 13 1>; label = "HOMEHUB2A:blue:wireless";
}; };
upgrading_blue {
label = "HOMEHUB2A:blue:upgrading"; led@9 {
gpios = <&hc595 14 1>; 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";
}; };
}; };

View File

@ -12,26 +12,6 @@
bootargs = "root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; 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 { gpio-keys-polled {
compatible = "gpio-keys-polled"; compatible = "gpio-keys-polled";
#address-cells = <1>; #address-cells = <1>;
@ -84,22 +64,37 @@
label = "NB4-FXC-r1:green:service"; label = "NB4-FXC-r1:green:service";
gpios = <&pinctrl 30 0>; gpios = <&pinctrl 30 0>;
}; };
alarm_white { };
label = "NB4-FXC-r1:white:alarm"; };
gpios = <&hc595 0 1>;
}; &leds {
tv_white { status = "ok";
label = "NB4-FXC-r1:white:tv";
gpios = <&hc595 2 1>; pinctrl-names = "default";
}; pinctrl-0 = <&pinctrl_serial_led>;
tel_white {
label = "NB4-FXC-r1:white:tel"; led@0 {
gpios = <&hc595 3 1>; reg = <0>;
}; active-low;
adsl_white { label = "NB4-FXC-r1:white:alarm";
label = "NB4-FXC-r0:white:adsl"; };
gpios = <&hc595 4 1>;
}; 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";
}; };
}; };

View File

@ -12,26 +12,6 @@
bootargs = "root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; 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 { gpio-keys-polled {
compatible = "gpio-keys-polled"; compatible = "gpio-keys-polled";
#address-cells = <1>; #address-cells = <1>;
@ -84,22 +64,37 @@
label = "NB4-SER-r0:green:service"; label = "NB4-SER-r0:green:service";
gpios = <&pinctrl 30 1>; gpios = <&pinctrl 30 1>;
}; };
alarm_white { };
label = "NB4-SER-r0:white:alarm"; };
gpios = <&hc595 0 1>;
}; &leds {
tv_white { status = "ok";
label = "NB4-SER-r0:white:tv";
gpios = <&hc595 2 1>; pinctrl-names = "default";
}; pinctrl-0 = <&pinctrl_serial_led>;
tel_white {
label = "NB4-SER-r0:white:tel"; led@0 {
gpios = <&hc595 3 1>; reg = <0>;
}; active-low;
adsl_white { label = "NB4-SER-r0:white:alarm";
label = "NB4-SER-r0:white:adsl"; };
gpios = <&hc595 4 1>;
}; 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";
}; };
}; };