Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: wfx: add proper "compatible" string

Add "compatible" string matching "vendor,chip" template and proper
GPIO flags handling. Keep support for old name and reset polarity
for older devicetrees.

Cc: stable@vger.kernel.org # d3a5bcb4a17f ("gpio: add gpiod_toggle_active_low()")
Cc: stable@vger.kernel.org
Fixes: 0096214a59a7 ("staging: wfx: add support for I/O access")
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Link: https://lore.kernel.org/r/0e6dda06f145676861860f073a53dc95987c7ab5.1581416843.git.mirq-linux@rere.qmqm.pl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Michał Mirosław and committed by
Greg Kroah-Hartman
eec6e3ee e2525a95

+14 -7
+4 -3
drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/siliabs,wfx.txt
··· 6 6 You have to declare the WFxxx chip in your device tree. 7 7 8 8 Required properties: 9 - - compatible: Should be "silabs,wfx-spi" 9 + - compatible: Should be "silabs,wf200" 10 10 - reg: Chip select address of device 11 11 - spi-max-frequency: Maximum SPI clocking speed of device in Hz 12 12 - interrupts-extended: Should contain interrupt line (interrupt-parent + ··· 15 15 Optional properties: 16 16 - reset-gpios: phandle of gpio that will be used to reset chip during probe. 17 17 Without this property, you may encounter issues with warm boot. 18 + (Legacy: when compatible == "silabs,wfx-spi", the gpio is inverted.) 18 19 19 20 Please consult Documentation/devicetree/bindings/spi/spi-bus.txt for optional 20 21 SPI connection related properties, ··· 24 23 25 24 &spi1 { 26 25 wfx { 27 - compatible = "silabs,wfx-spi"; 26 + compatible = "silabs,wf200"; 28 27 pinctrl-names = "default"; 29 28 pinctrl-0 = <&wfx_irq &wfx_gpios>; 30 29 interrupts-extended = <&gpio 16 IRQ_TYPE_EDGE_RISING>; 31 30 wakeup-gpios = <&gpio 12 GPIO_ACTIVE_HIGH>; 32 - reset-gpios = <&gpio 13 GPIO_ACTIVE_HIGH>; 31 + reset-gpios = <&gpio 13 GPIO_ACTIVE_LOW>; 33 32 reg = <0>; 34 33 spi-max-frequency = <42000000>; 35 34 };
+10 -4
drivers/staging/wfx/bus_spi.c
··· 27 27 #define SET_WRITE 0x7FFF /* usage: and operation */ 28 28 #define SET_READ 0x8000 /* usage: or operation */ 29 29 30 + #define WFX_RESET_INVERTED 1 31 + 30 32 static const struct wfx_platform_data wfx_spi_pdata = { 31 33 .file_fw = "wfm_wf200", 32 34 .file_pds = "wf200.pds", ··· 208 206 if (!bus->gpio_reset) { 209 207 dev_warn(&func->dev, "try to load firmware anyway\n"); 210 208 } else { 211 - gpiod_set_value(bus->gpio_reset, 0); 212 - udelay(100); 209 + if (spi_get_device_id(func)->driver_data & WFX_RESET_INVERTED) 210 + gpiod_toggle_active_low(bus->gpio_reset); 213 211 gpiod_set_value(bus->gpio_reset, 1); 212 + udelay(100); 213 + gpiod_set_value(bus->gpio_reset, 0); 214 214 udelay(2000); 215 215 } 216 216 ··· 249 245 * stripped. 250 246 */ 251 247 static const struct spi_device_id wfx_spi_id[] = { 252 - { "wfx-spi", 0 }, 248 + { "wfx-spi", WFX_RESET_INVERTED }, 249 + { "wf200", 0 }, 253 250 { }, 254 251 }; 255 252 MODULE_DEVICE_TABLE(spi, wfx_spi_id); 256 253 257 254 #ifdef CONFIG_OF 258 255 static const struct of_device_id wfx_spi_of_match[] = { 259 - { .compatible = "silabs,wfx-spi" }, 256 + { .compatible = "silabs,wfx-spi", .data = (void *)WFX_RESET_INVERTED }, 257 + { .compatible = "silabs,wf200" }, 260 258 { }, 261 259 }; 262 260 MODULE_DEVICE_TABLE(of, wfx_spi_of_match);