Re: [PATCH v5] wlcore: spi: add wl18xx support
"Reizer, Eyal"writes: > Add support for using with both wl12xx and wl18xx. > > - all wilink family needs special init command for entering wspi mode. > extra clock cycles should be sent after the spi init command while the > cs pin is high. > - Use inverted chip select for sending a dummy 4 bytes command that > completes the init stage. > > Signed-off-by: Eyal Reizer > Acked-by: Rob Herring > --- > v1->v2:update device tree bindings configuration > v2->v3:revert from manual gpio manipulation. use inverted chip select > instead for sending the extra init cycle which, achieves the same hardware > purpose. > update device tree bindings docucmentation accordingly > v3->v4: Remove redundant data form binding documentation and fix chip > select number mismatch in wl1271 example > v4->v5: Rebase on top of head of wireless-drivers-next You now sent me two patches with v5 which is just confusing. To make the life of maintainers easier ALWAYS increase the revision number, no matter how small the change is. But the "latter" v5 is corrupted somehow in patchwork: https://patchwork.kernel.org/patch/9233597/ The "former" v5 again looks ok: https://patchwork.kernel.org/patch/9222403/ I can't immeaditely see why that happened, but please resend. -- Kalle Valo
Re: [PATCH v5] wlcore: spi: add wl18xx support
"Reizer, Eyal" writes: > Add support for using with both wl12xx and wl18xx. > > - all wilink family needs special init command for entering wspi mode. > extra clock cycles should be sent after the spi init command while the > cs pin is high. > - Use inverted chip select for sending a dummy 4 bytes command that > completes the init stage. > > Signed-off-by: Eyal Reizer > Acked-by: Rob Herring > --- > v1->v2:update device tree bindings configuration > v2->v3:revert from manual gpio manipulation. use inverted chip select > instead for sending the extra init cycle which, achieves the same hardware > purpose. > update device tree bindings docucmentation accordingly > v3->v4: Remove redundant data form binding documentation and fix chip > select number mismatch in wl1271 example > v4->v5: Rebase on top of head of wireless-drivers-next You now sent me two patches with v5 which is just confusing. To make the life of maintainers easier ALWAYS increase the revision number, no matter how small the change is. But the "latter" v5 is corrupted somehow in patchwork: https://patchwork.kernel.org/patch/9233597/ The "former" v5 again looks ok: https://patchwork.kernel.org/patch/9222403/ I can't immeaditely see why that happened, but please resend. -- Kalle Valo
[PATCH v5] wlcore: spi: add wl18xx support
Add support for using with both wl12xx and wl18xx. - all wilink family needs special init command for entering wspi mode. extra clock cycles should be sent after the spi init command while the cs pin is high. - Use inverted chip select for sending a dummy 4 bytes command that completes the init stage. Signed-off-by: Eyal ReizerAcked-by: Rob Herring --- v1->v2:update device tree bindings configuration v2->v3:revert from manual gpio manipulation. use inverted chip select instead for sending the extra init cycle which, achieves the same hardware purpose. update device tree bindings docucmentation accordingly v3->v4: Remove redundant data form binding documentation and fix chip select number mismatch in wl1271 example v4->v5: Rebase on top of head of wireless-drivers-next .../bindings/net/wireless/ti,wlcore,spi.txt| 41 +-- drivers/net/wireless/ti/wlcore/spi.c | 123 ++--- 2 files changed, 137 insertions(+), 27 deletions(-) diff --git a/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt index 9180724..8f9ced0 100644 --- a/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt +++ b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt @@ -1,19 +1,30 @@ -* Texas Instruments wl1271 wireless lan controller +* Texas Instruments wl12xx/wl18xx wireless lan controller -The wl1271 chip can be connected via SPI or via SDIO. This +The wl12xx/wl18xx chips can be connected via SPI or via SDIO. This document describes the binding for the SPI connected chip. Required properties: -- compatible : Should be "ti,wl1271" +- compatible : Should be one of the following: +* "ti,wl1271" +* "ti,wl1273" +* "ti,wl1281" +* "ti,wl1283" +* "ti,wl1801" +* "ti,wl1805" +* "ti,wl1807" +* "ti,wl1831" +* "ti,wl1835" +* "ti,wl1837" - reg : Chip select address of device - spi-max-frequency : Maximum SPI clocking speed of device in Hz -- ref-clock-frequency : Reference clock frequency - interrupt-parent, interrupts : Should contain parameters for 1 interrupt line. Interrupt parameters: parent, line number, type. -- vwlan-supply :Point the node of the regulator that powers/enable the wl1271 chip +- vwlan-supply :Point the node of the regulator that powers/enable the +wl12xx/wl18xx chip Optional properties: +- ref-clock-frequency : Reference clock frequency (should be set for +wl12xx) - clock-xtal : boolean, clock is generated from XTAL - Please consult Documentation/devicetree/bindings/spi/spi-bus.txt @@ -21,16 +32,28 @@ Optional properties: Examples: +For wl12xx family: { - wl1271@1 { + wlcore: wlcore@1 { compatible = "ti,wl1271"; - reg = <1>; spi-max-frequency = <4800>; - clock-xtal; - ref-clock-frequency = <3840>; interrupt-parent = <>; interrupts = <8 IRQ_TYPE_LEVEL_HIGH>; vwlan-supply = <_fixed>; + clock-xtal; + ref-clock-frequency = <3840>; + }; +}; + +For wl18xx family: + { + wlcore: wlcore@0 { + compatible = "ti,wl1835"; + reg = <0>; + spi-max-frequency = <4800>; + interrupt-parent = <>; + interrupts = <27 IRQ_TYPE_EDGE_RISING>; + vwlan-supply = <_fixed>; }; }; diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index cea9443..73fbcf1 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -70,16 +70,30 @@ #define WSPI_MAX_CHUNK_SIZE4092 /* - * only support SPI for 12xx - this code should be reworked when 18xx - * support is introduced + * wl18xx driver aggregation buffer size is (13 * PAGE_SIZE) compared + to + * (4 * PAGE_SIZE) for wl12xx, so use the larger buffer needed for + wl18xx */ -#define SPI_AGGR_BUFFER_SIZE (4 * PAGE_SIZE) +#define SPI_AGGR_BUFFER_SIZE (13 * PAGE_SIZE) /* Maximum number of SPI write chunks */ #define WSPI_MAX_NUM_OF_CHUNKS \ ((SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE) + 1) +struct wilink_familiy_data { + char name[8]; +}; + +const struct wilink_familiy_data *wilink_data; + +static const struct wilink_familiy_data wl18xx_data = { + .name = "wl18xx", +}; + +static const struct wilink_familiy_data wl12xx_data = { + .name = "wl12xx", +}; + struct wl12xx_spi_glue { struct device *dev; struct platform_device *core; @@ -119,6 +133,7 @@ static void wl12xx_spi_init(struct device *child) struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); struct spi_transfer t; struct spi_message m; +
[PATCH v5] wlcore: spi: add wl18xx support
Add support for using with both wl12xx and wl18xx. - all wilink family needs special init command for entering wspi mode. extra clock cycles should be sent after the spi init command while the cs pin is high. - Use inverted chip select for sending a dummy 4 bytes command that completes the init stage. Signed-off-by: Eyal Reizer Acked-by: Rob Herring --- v1->v2:update device tree bindings configuration v2->v3:revert from manual gpio manipulation. use inverted chip select instead for sending the extra init cycle which, achieves the same hardware purpose. update device tree bindings docucmentation accordingly v3->v4: Remove redundant data form binding documentation and fix chip select number mismatch in wl1271 example v4->v5: Rebase on top of head of wireless-drivers-next .../bindings/net/wireless/ti,wlcore,spi.txt| 41 +-- drivers/net/wireless/ti/wlcore/spi.c | 123 ++--- 2 files changed, 137 insertions(+), 27 deletions(-) diff --git a/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt index 9180724..8f9ced0 100644 --- a/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt +++ b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt @@ -1,19 +1,30 @@ -* Texas Instruments wl1271 wireless lan controller +* Texas Instruments wl12xx/wl18xx wireless lan controller -The wl1271 chip can be connected via SPI or via SDIO. This +The wl12xx/wl18xx chips can be connected via SPI or via SDIO. This document describes the binding for the SPI connected chip. Required properties: -- compatible : Should be "ti,wl1271" +- compatible : Should be one of the following: +* "ti,wl1271" +* "ti,wl1273" +* "ti,wl1281" +* "ti,wl1283" +* "ti,wl1801" +* "ti,wl1805" +* "ti,wl1807" +* "ti,wl1831" +* "ti,wl1835" +* "ti,wl1837" - reg : Chip select address of device - spi-max-frequency : Maximum SPI clocking speed of device in Hz -- ref-clock-frequency : Reference clock frequency - interrupt-parent, interrupts : Should contain parameters for 1 interrupt line. Interrupt parameters: parent, line number, type. -- vwlan-supply :Point the node of the regulator that powers/enable the wl1271 chip +- vwlan-supply :Point the node of the regulator that powers/enable the +wl12xx/wl18xx chip Optional properties: +- ref-clock-frequency : Reference clock frequency (should be set for +wl12xx) - clock-xtal : boolean, clock is generated from XTAL - Please consult Documentation/devicetree/bindings/spi/spi-bus.txt @@ -21,16 +32,28 @@ Optional properties: Examples: +For wl12xx family: { - wl1271@1 { + wlcore: wlcore@1 { compatible = "ti,wl1271"; - reg = <1>; spi-max-frequency = <4800>; - clock-xtal; - ref-clock-frequency = <3840>; interrupt-parent = <>; interrupts = <8 IRQ_TYPE_LEVEL_HIGH>; vwlan-supply = <_fixed>; + clock-xtal; + ref-clock-frequency = <3840>; + }; +}; + +For wl18xx family: + { + wlcore: wlcore@0 { + compatible = "ti,wl1835"; + reg = <0>; + spi-max-frequency = <4800>; + interrupt-parent = <>; + interrupts = <27 IRQ_TYPE_EDGE_RISING>; + vwlan-supply = <_fixed>; }; }; diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index cea9443..73fbcf1 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -70,16 +70,30 @@ #define WSPI_MAX_CHUNK_SIZE4092 /* - * only support SPI for 12xx - this code should be reworked when 18xx - * support is introduced + * wl18xx driver aggregation buffer size is (13 * PAGE_SIZE) compared + to + * (4 * PAGE_SIZE) for wl12xx, so use the larger buffer needed for + wl18xx */ -#define SPI_AGGR_BUFFER_SIZE (4 * PAGE_SIZE) +#define SPI_AGGR_BUFFER_SIZE (13 * PAGE_SIZE) /* Maximum number of SPI write chunks */ #define WSPI_MAX_NUM_OF_CHUNKS \ ((SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE) + 1) +struct wilink_familiy_data { + char name[8]; +}; + +const struct wilink_familiy_data *wilink_data; + +static const struct wilink_familiy_data wl18xx_data = { + .name = "wl18xx", +}; + +static const struct wilink_familiy_data wl12xx_data = { + .name = "wl12xx", +}; + struct wl12xx_spi_glue { struct device *dev; struct platform_device *core; @@ -119,6 +133,7 @@ static void wl12xx_spi_init(struct device *child) struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); struct spi_transfer t; struct spi_message m; + struct spi_device *spi =
Re: [PATCH v5] wlcore: spi: add wl18xx support
On Sun, Jul 10, 2016 at 08:32:40AM +, Reizer, Eyal wrote: > Add support for using with both wl12xx and wl18xx. > > - all wilink family needs special init command for entering wspi mode. > extra clock cycles should be sent after the spi init command while the > cs pin is high. > - Use inverted chip select for sending a dummy 4 bytes command that > completes the init stage. > > Signed-off-by: Eyal Reizer> --- > v1->v2:update device tree bindings configuration > v2->v3:revert from manual gpio manipulation. use inverted chip select instead > for sending the extra init cycle which, achieves the same hardware purpose. > update device tree bindings docucmentation accordingly > v3->v4: Remove redundant data form binding documentation and fix chip select > number mismatch in wl1271 example > v4->v5: Rebase on top of head of wireless-drivers-next Please add acks when reposting. Rob
Re: [PATCH v5] wlcore: spi: add wl18xx support
On Sun, Jul 10, 2016 at 08:32:40AM +, Reizer, Eyal wrote: > Add support for using with both wl12xx and wl18xx. > > - all wilink family needs special init command for entering wspi mode. > extra clock cycles should be sent after the spi init command while the > cs pin is high. > - Use inverted chip select for sending a dummy 4 bytes command that > completes the init stage. > > Signed-off-by: Eyal Reizer > --- > v1->v2:update device tree bindings configuration > v2->v3:revert from manual gpio manipulation. use inverted chip select instead > for sending the extra init cycle which, achieves the same hardware purpose. > update device tree bindings docucmentation accordingly > v3->v4: Remove redundant data form binding documentation and fix chip select > number mismatch in wl1271 example > v4->v5: Rebase on top of head of wireless-drivers-next Please add acks when reposting. Rob
[PATCH v5] wlcore: spi: add wl18xx support
Add support for using with both wl12xx and wl18xx. - all wilink family needs special init command for entering wspi mode. extra clock cycles should be sent after the spi init command while the cs pin is high. - Use inverted chip select for sending a dummy 4 bytes command that completes the init stage. Signed-off-by: Eyal Reizer--- v1->v2:update device tree bindings configuration v2->v3:revert from manual gpio manipulation. use inverted chip select instead for sending the extra init cycle which, achieves the same hardware purpose. update device tree bindings docucmentation accordingly v3->v4: Remove redundant data form binding documentation and fix chip select number mismatch in wl1271 example v4->v5: Rebase on top of head of wireless-drivers-next .../bindings/net/wireless/ti,wlcore,spi.txt| 41 +-- drivers/net/wireless/ti/wlcore/spi.c | 123 ++--- 2 files changed, 137 insertions(+), 27 deletions(-) diff --git a/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt index 9180724..8f9ced0 100644 --- a/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt +++ b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt @@ -1,19 +1,30 @@ -* Texas Instruments wl1271 wireless lan controller +* Texas Instruments wl12xx/wl18xx wireless lan controller -The wl1271 chip can be connected via SPI or via SDIO. This +The wl12xx/wl18xx chips can be connected via SPI or via SDIO. This document describes the binding for the SPI connected chip. Required properties: -- compatible : Should be "ti,wl1271" +- compatible : Should be one of the following: +* "ti,wl1271" +* "ti,wl1273" +* "ti,wl1281" +* "ti,wl1283" +* "ti,wl1801" +* "ti,wl1805" +* "ti,wl1807" +* "ti,wl1831" +* "ti,wl1835" +* "ti,wl1837" - reg : Chip select address of device - spi-max-frequency : Maximum SPI clocking speed of device in Hz -- ref-clock-frequency : Reference clock frequency - interrupt-parent, interrupts : Should contain parameters for 1 interrupt line. Interrupt parameters: parent, line number, type. -- vwlan-supply :Point the node of the regulator that powers/enable the wl1271 chip +- vwlan-supply :Point the node of the regulator that powers/enable the +wl12xx/wl18xx chip Optional properties: +- ref-clock-frequency : Reference clock frequency (should be set for wl12xx) - clock-xtal : boolean, clock is generated from XTAL - Please consult Documentation/devicetree/bindings/spi/spi-bus.txt @@ -21,16 +32,28 @@ Optional properties: Examples: +For wl12xx family: { - wl1271@1 { + wlcore: wlcore@1 { compatible = "ti,wl1271"; - reg = <1>; spi-max-frequency = <4800>; - clock-xtal; - ref-clock-frequency = <3840>; interrupt-parent = <>; interrupts = <8 IRQ_TYPE_LEVEL_HIGH>; vwlan-supply = <_fixed>; + clock-xtal; + ref-clock-frequency = <3840>; + }; +}; + +For wl18xx family: + { + wlcore: wlcore@0 { + compatible = "ti,wl1835"; + reg = <0>; + spi-max-frequency = <4800>; + interrupt-parent = <>; + interrupts = <27 IRQ_TYPE_EDGE_RISING>; + vwlan-supply = <_fixed>; }; }; diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index cea9443..73fbcf1 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -70,16 +70,30 @@ #define WSPI_MAX_CHUNK_SIZE4092 /* - * only support SPI for 12xx - this code should be reworked when 18xx - * support is introduced + * wl18xx driver aggregation buffer size is (13 * PAGE_SIZE) compared to + * (4 * PAGE_SIZE) for wl12xx, so use the larger buffer needed for wl18xx */ -#define SPI_AGGR_BUFFER_SIZE (4 * PAGE_SIZE) +#define SPI_AGGR_BUFFER_SIZE (13 * PAGE_SIZE) /* Maximum number of SPI write chunks */ #define WSPI_MAX_NUM_OF_CHUNKS \ ((SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE) + 1) +struct wilink_familiy_data { + char name[8]; +}; + +const struct wilink_familiy_data *wilink_data; + +static const struct wilink_familiy_data wl18xx_data = { + .name = "wl18xx", +}; + +static const struct wilink_familiy_data wl12xx_data = { + .name = "wl12xx", +}; + struct wl12xx_spi_glue { struct device *dev; struct platform_device *core; @@ -119,6 +133,7 @@ static void wl12xx_spi_init(struct device *child) struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); struct spi_transfer t; struct spi_message m; + struct spi_device *spi = to_spi_device(glue->dev);
[PATCH v5] wlcore: spi: add wl18xx support
Add support for using with both wl12xx and wl18xx. - all wilink family needs special init command for entering wspi mode. extra clock cycles should be sent after the spi init command while the cs pin is high. - Use inverted chip select for sending a dummy 4 bytes command that completes the init stage. Signed-off-by: Eyal Reizer --- v1->v2:update device tree bindings configuration v2->v3:revert from manual gpio manipulation. use inverted chip select instead for sending the extra init cycle which, achieves the same hardware purpose. update device tree bindings docucmentation accordingly v3->v4: Remove redundant data form binding documentation and fix chip select number mismatch in wl1271 example v4->v5: Rebase on top of head of wireless-drivers-next .../bindings/net/wireless/ti,wlcore,spi.txt| 41 +-- drivers/net/wireless/ti/wlcore/spi.c | 123 ++--- 2 files changed, 137 insertions(+), 27 deletions(-) diff --git a/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt index 9180724..8f9ced0 100644 --- a/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt +++ b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt @@ -1,19 +1,30 @@ -* Texas Instruments wl1271 wireless lan controller +* Texas Instruments wl12xx/wl18xx wireless lan controller -The wl1271 chip can be connected via SPI or via SDIO. This +The wl12xx/wl18xx chips can be connected via SPI or via SDIO. This document describes the binding for the SPI connected chip. Required properties: -- compatible : Should be "ti,wl1271" +- compatible : Should be one of the following: +* "ti,wl1271" +* "ti,wl1273" +* "ti,wl1281" +* "ti,wl1283" +* "ti,wl1801" +* "ti,wl1805" +* "ti,wl1807" +* "ti,wl1831" +* "ti,wl1835" +* "ti,wl1837" - reg : Chip select address of device - spi-max-frequency : Maximum SPI clocking speed of device in Hz -- ref-clock-frequency : Reference clock frequency - interrupt-parent, interrupts : Should contain parameters for 1 interrupt line. Interrupt parameters: parent, line number, type. -- vwlan-supply :Point the node of the regulator that powers/enable the wl1271 chip +- vwlan-supply :Point the node of the regulator that powers/enable the +wl12xx/wl18xx chip Optional properties: +- ref-clock-frequency : Reference clock frequency (should be set for wl12xx) - clock-xtal : boolean, clock is generated from XTAL - Please consult Documentation/devicetree/bindings/spi/spi-bus.txt @@ -21,16 +32,28 @@ Optional properties: Examples: +For wl12xx family: { - wl1271@1 { + wlcore: wlcore@1 { compatible = "ti,wl1271"; - reg = <1>; spi-max-frequency = <4800>; - clock-xtal; - ref-clock-frequency = <3840>; interrupt-parent = <>; interrupts = <8 IRQ_TYPE_LEVEL_HIGH>; vwlan-supply = <_fixed>; + clock-xtal; + ref-clock-frequency = <3840>; + }; +}; + +For wl18xx family: + { + wlcore: wlcore@0 { + compatible = "ti,wl1835"; + reg = <0>; + spi-max-frequency = <4800>; + interrupt-parent = <>; + interrupts = <27 IRQ_TYPE_EDGE_RISING>; + vwlan-supply = <_fixed>; }; }; diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index cea9443..73fbcf1 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -70,16 +70,30 @@ #define WSPI_MAX_CHUNK_SIZE4092 /* - * only support SPI for 12xx - this code should be reworked when 18xx - * support is introduced + * wl18xx driver aggregation buffer size is (13 * PAGE_SIZE) compared to + * (4 * PAGE_SIZE) for wl12xx, so use the larger buffer needed for wl18xx */ -#define SPI_AGGR_BUFFER_SIZE (4 * PAGE_SIZE) +#define SPI_AGGR_BUFFER_SIZE (13 * PAGE_SIZE) /* Maximum number of SPI write chunks */ #define WSPI_MAX_NUM_OF_CHUNKS \ ((SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE) + 1) +struct wilink_familiy_data { + char name[8]; +}; + +const struct wilink_familiy_data *wilink_data; + +static const struct wilink_familiy_data wl18xx_data = { + .name = "wl18xx", +}; + +static const struct wilink_familiy_data wl12xx_data = { + .name = "wl12xx", +}; + struct wl12xx_spi_glue { struct device *dev; struct platform_device *core; @@ -119,6 +133,7 @@ static void wl12xx_spi_init(struct device *child) struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); struct spi_transfer t; struct spi_message m; + struct spi_device *spi = to_spi_device(glue->dev); u8