The SPI chip select GPIO polarity is active low by default. We must
use "spi-cs-high" dts property to toggle the polarity. The polarity
on "cs-gpios" won't take effect at all[1]. Fix these incorrect GPIO
polarities to silence the kernel warnings.
[1] Refer to Linux/Documentation/devicetree/bindings/spi/spi-controller.yaml
```
device node | cs-gpio | CS pin state active | Note
================+===============+=====================+=====
spi-cs-high | - | H |
- | - | L |
spi-cs-high | ACTIVE_HIGH | H |
- | ACTIVE_HIGH | L | 1
spi-cs-high | ACTIVE_LOW | H | 2
- | ACTIVE_LOW | L |
Notes:
1) Should print a warning about polarity inversion.
Here it would be wise to avoid and define the gpio as
ACTIVE_LOW.
2) Should print a warning about polarity inversion
because ACTIVE_LOW is overridden by spi-cs-high.
Should be generally avoided and be replaced by
spi-cs-high + ACTIVE_HIGH.
```
Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/19845
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
sck-gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;
mosi-gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
- cs-gpios = <&gpio 14 GPIO_ACTIVE_HIGH>;
+ cs-gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
num-chipselects = <1>;
gpio_hc595: gpio_spi@0 {
sck-gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
mosi-gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;
- cs-gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;
+ cs-gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
num-chipselects = <1>;
led_gpio: led_gpio@0 {
sck-gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
mosi-gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
- cs-gpios = <&gpio 3 GPIO_ACTIVE_HIGH>;
+ cs-gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
num-chipselects = <1>;
led_gpio: led_gpio@0 {
sck-gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
mosi-gpios = <&gpio 14 GPIO_ACTIVE_HIGH>;
- cs-gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;
+ cs-gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
num-chipselects = <1>;
led_gpio: led_gpio@0 {
sck-gpios = <&gpio 18 GPIO_ACTIVE_HIGH>;
mosi-gpios = <&gpio 17 GPIO_ACTIVE_HIGH>;
- cs-gpios = <&gpio 20 GPIO_ACTIVE_HIGH>;
+ cs-gpios = <&gpio 20 GPIO_ACTIVE_LOW>;
num-chipselects = <1>;
led_gpio: led_gpio@0 {
sck-gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; // 74HC595 SRCLK (Serial Clock)
mosi-gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; // 74HC595 SER (Serial)
- cs-gpios = <&gpio 16 GPIO_ACTIVE_HIGH>; // 74HC595 RCLK (Register Clock)
+ cs-gpios = <&gpio 16 GPIO_ACTIVE_LOW>; // 74HC595 RCLK (Register Clock)
num-chipselects = <1>;
led_gpio: led_gpio@0 {
gpio-sck = <&tlmm 1 GPIO_ACTIVE_HIGH>;
gpio-mosi = <&tlmm 3 GPIO_ACTIVE_HIGH>;
- cs-gpios = <&tlmm 2 GPIO_ACTIVE_HIGH>;
+ cs-gpios = <&tlmm 2 GPIO_ACTIVE_LOW>;
num-chipselects = <1>;
shift_io: shift_io@0 {
sck-gpios = <&gpio 3 GPIO_ACTIVE_HIGH>;
mosi-gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
- cs-gpios = <&gpio 2 GPIO_ACTIVE_HIGH>;
+ cs-gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
num-chipselects = <1>;
gpio_hc595: gpio_hc595@0 {