RE: [EXTERNAL] Re: [PATCH] arm: dts: am437x-sk-evm: add wilink8 support
Hi Tony, > > Yeah my guess is that the reason for the separate GPIO interrupt was > that on omap3 we did not have SDIO interrupt working for years. This was > because of the issues related to padconf interrupts for off mode. > > We now have Linux generic wakeirq support working with SDIO and it has > been confirmed to work also for off mode with mwifiex at least. So > there should be no reason to not also use the SDIO interrupt. > There is more to this than just the padconf. Using in-band interrupt instead of the out of band one requires Supporting a feature called "Asynchronous interrupts in 4Bit mode" Which is part of SDIO 3.0 spec: https://www.sdcard.org/downloads/pls/pdf/index.php?p=PartE1_SDIO_Simplified_Specification_Ver3.00.jpg=PartE1_SDIO_Simplified_Specification_Ver3.00.pdf=EN_SSE1 Take a look at page 41 at the bottom part of the table. Wilink8 supports this feature but AFAIK this support is still not part of the mmc/sdio core in the Linux kernel. If we want wilink8 to trigger a host wakeup using the in-band interrupt instead Of the wlan_irq pin we would need to enable/use this feature. I did use it internally in the past and was able to patch the Ubuntu kernel (3.5.0 at that time) to use wilink8 in a standard SD Card slot of an Ubuntu Laptop while removing the use of wlan_irq pin completely. However this was an experimental patch set written by a third party that was not up-steamtable at that time. I do have this patch set somewhere... It is similar to the following patch which is not upstream as well for some reason: https://gitlab.com/k2wl/g2_kernel/commit/5c4970fdaa50422d7ea7220efa20fb35148a4bca It is not the only patch needed, there are a couple of additional patches needed for fully using it from driver. I did check latest Linux-next and don't see this support there. Not sure why. Best Regards, Eyal
RE: [EXTERNAL] Re: [PATCH] arm: dts: am437x-sk-evm: add wilink8 support
Hi Tony, > > Yeah my guess is that the reason for the separate GPIO interrupt was > that on omap3 we did not have SDIO interrupt working for years. This was > because of the issues related to padconf interrupts for off mode. > > We now have Linux generic wakeirq support working with SDIO and it has > been confirmed to work also for off mode with mwifiex at least. So > there should be no reason to not also use the SDIO interrupt. > There is more to this than just the padconf. Using in-band interrupt instead of the out of band one requires Supporting a feature called "Asynchronous interrupts in 4Bit mode" Which is part of SDIO 3.0 spec: https://www.sdcard.org/downloads/pls/pdf/index.php?p=PartE1_SDIO_Simplified_Specification_Ver3.00.jpg=PartE1_SDIO_Simplified_Specification_Ver3.00.pdf=EN_SSE1 Take a look at page 41 at the bottom part of the table. Wilink8 supports this feature but AFAIK this support is still not part of the mmc/sdio core in the Linux kernel. If we want wilink8 to trigger a host wakeup using the in-band interrupt instead Of the wlan_irq pin we would need to enable/use this feature. I did use it internally in the past and was able to patch the Ubuntu kernel (3.5.0 at that time) to use wilink8 in a standard SD Card slot of an Ubuntu Laptop while removing the use of wlan_irq pin completely. However this was an experimental patch set written by a third party that was not up-steamtable at that time. I do have this patch set somewhere... It is similar to the following patch which is not upstream as well for some reason: https://gitlab.com/k2wl/g2_kernel/commit/5c4970fdaa50422d7ea7220efa20fb35148a4bca It is not the only patch needed, there are a couple of additional patches needed for fully using it from driver. I did check latest Linux-next and don't see this support there. Not sure why. Best Regards, Eyal
RE: [EXTERNAL] Re: [PATCH] arm: dts: am437x-sk-evm: add wilink8 support
> > * Reizer, Eyal <ey...@ti.com> [180503 06:43]: > > > > > > * Eyal Reizer <eyalrei...@gmail.com> [180501 00:26]: > > > > enable mmc3 used for wlan and uart1 used for bluetooth > > > > configure the gpios used for wlan and bluetooth controls > > > > add fixed voltage regulator used for wlan power control > > > ... > > > > / { > > > > model = "TI AM437x SK EVM"; > > > > @@ -158,6 +159,22 @@ > > > > }; > > > > }; > > > > }; > > > > + > > > > + vmmcwl_fixed: fixedregulator-mmcwl { > > > > + /* > > > > +* WL_EN is not SDIO standard compliant. It is an out > > > > of band > > > > +* signal and hard to be dealt with in a standard way > > > > by the > > > > +* SDIO core driver. > > > > +* So modelling the WL_EN line as a regulator was a > > > > natural > > > > +* choice as the MMC core already deals with MMC > > > > supplies. > > > > +*/ > > > > + compatible = "regulator-fixed"; > > > > + regulator-name = "vmmcwl_fixed"; > > > > + regulator-min-microvolt = <180>; > > > > + regulator-max-microvolt = <180>; > > > > + gpio = < 8 GPIO_ACTIVE_HIGH>; > > > > + enable-active-high; > > > > + }; > > > > }; > > > > > > Interesting that it needs much longer delay here compared to the > > > earlier? > > > > Where do you see a delay in here? > > There is no startup-delay-us value used in this patch. > > Oops sorry, I misread the voltage above as the startup-delay-us > value :) > No issue :) > > > BTW, I do have a patch in work to add pwrseq support for wlcore that > > > allows leaving out the regulator here. It still needs a bit more > > > work though. > > > > > > And I also have a series in work to make wlcore use runtime PM that > > > needs even more work, just FYI to avoid any duplicate work. > > > > > > Hmm you don't happen to have a patch series somewhere making > > > wlcore use the SDIO dat lien interrupt? > > wilink has always used out of band interrupt (using wlan_irq gpio). > > in-band interrupts was not supported. > > See section 10.5.2 in this the wl18xx hardware integration guide: > > http://www.ti.com/lit/ug/swru437/swru437.pdf > > Hmm yeah I've been wondering about that. Why not follow the SDIO > standard here though? Do you have links to documentation explaining > that? > I will try to see what I can find out and why it has always been used only With out-of band interrupts and whether there is a real hardware Limitation behind it . In the past also the omap-hsmmc driver was not really supporting in-band sdio interrupt out of the box. Not sure what is the state of it tofday. > > > I think we should use that when idle rather than the (edge) gpio > > > interrupt as the SDIO dat interrupt is level sensitive and wired > > > to the always on gpio bank for most SDIO controller instances. > > > On runtime PM wakeup, there's no status anywhere to been with the > > > GPIO edge interrupt. > > > > > I agree that it would have been better, especially for cases such as wake > > On wlan, but again, in-band interrupt was something that was talked > > about way back but it was never implemented. > > I think we can have both if performance is the reason for the > out of band interrupt. We could still use SDIO dat line interrupt > during idle for wake-up events. Correct, assuming we can make in-band interrupt work with wilink8. Best Regards, Eyal
RE: [EXTERNAL] Re: [PATCH] arm: dts: am437x-sk-evm: add wilink8 support
> > * Reizer, Eyal [180503 06:43]: > > > > > > * Eyal Reizer [180501 00:26]: > > > > enable mmc3 used for wlan and uart1 used for bluetooth > > > > configure the gpios used for wlan and bluetooth controls > > > > add fixed voltage regulator used for wlan power control > > > ... > > > > / { > > > > model = "TI AM437x SK EVM"; > > > > @@ -158,6 +159,22 @@ > > > > }; > > > > }; > > > > }; > > > > + > > > > + vmmcwl_fixed: fixedregulator-mmcwl { > > > > + /* > > > > +* WL_EN is not SDIO standard compliant. It is an out > > > > of band > > > > +* signal and hard to be dealt with in a standard way > > > > by the > > > > +* SDIO core driver. > > > > +* So modelling the WL_EN line as a regulator was a > > > > natural > > > > +* choice as the MMC core already deals with MMC > > > > supplies. > > > > +*/ > > > > + compatible = "regulator-fixed"; > > > > + regulator-name = "vmmcwl_fixed"; > > > > + regulator-min-microvolt = <180>; > > > > + regulator-max-microvolt = <180>; > > > > + gpio = < 8 GPIO_ACTIVE_HIGH>; > > > > + enable-active-high; > > > > + }; > > > > }; > > > > > > Interesting that it needs much longer delay here compared to the > > > earlier? > > > > Where do you see a delay in here? > > There is no startup-delay-us value used in this patch. > > Oops sorry, I misread the voltage above as the startup-delay-us > value :) > No issue :) > > > BTW, I do have a patch in work to add pwrseq support for wlcore that > > > allows leaving out the regulator here. It still needs a bit more > > > work though. > > > > > > And I also have a series in work to make wlcore use runtime PM that > > > needs even more work, just FYI to avoid any duplicate work. > > > > > > Hmm you don't happen to have a patch series somewhere making > > > wlcore use the SDIO dat lien interrupt? > > wilink has always used out of band interrupt (using wlan_irq gpio). > > in-band interrupts was not supported. > > See section 10.5.2 in this the wl18xx hardware integration guide: > > http://www.ti.com/lit/ug/swru437/swru437.pdf > > Hmm yeah I've been wondering about that. Why not follow the SDIO > standard here though? Do you have links to documentation explaining > that? > I will try to see what I can find out and why it has always been used only With out-of band interrupts and whether there is a real hardware Limitation behind it . In the past also the omap-hsmmc driver was not really supporting in-band sdio interrupt out of the box. Not sure what is the state of it tofday. > > > I think we should use that when idle rather than the (edge) gpio > > > interrupt as the SDIO dat interrupt is level sensitive and wired > > > to the always on gpio bank for most SDIO controller instances. > > > On runtime PM wakeup, there's no status anywhere to been with the > > > GPIO edge interrupt. > > > > > I agree that it would have been better, especially for cases such as wake > > On wlan, but again, in-band interrupt was something that was talked > > about way back but it was never implemented. > > I think we can have both if performance is the reason for the > out of band interrupt. We could still use SDIO dat line interrupt > during idle for wake-up events. Correct, assuming we can make in-band interrupt work with wilink8. Best Regards, Eyal
RE: [EXTERNAL] Re: [PATCH] arm: dts: am437x-sk-evm: add wilink8 support
> > * Eyal Reizer[180501 00:26]: > > enable mmc3 used for wlan and uart1 used for bluetooth > > configure the gpios used for wlan and bluetooth controls > > add fixed voltage regulator used for wlan power control > ... > > / { > > model = "TI AM437x SK EVM"; > > @@ -158,6 +159,22 @@ > > }; > > }; > > }; > > + > > + vmmcwl_fixed: fixedregulator-mmcwl { > > + /* > > +* WL_EN is not SDIO standard compliant. It is an out of band > > +* signal and hard to be dealt with in a standard way by the > > +* SDIO core driver. > > +* So modelling the WL_EN line as a regulator was a natural > > +* choice as the MMC core already deals with MMC supplies. > > +*/ > > + compatible = "regulator-fixed"; > > + regulator-name = "vmmcwl_fixed"; > > + regulator-min-microvolt = <180>; > > + regulator-max-microvolt = <180>; > > + gpio = < 8 GPIO_ACTIVE_HIGH>; > > + enable-active-high; > > + }; > > }; > > Interesting that it needs much longer delay here compared to the > earlier? Where do you see a delay in here? There is no startup-delay-us value used in this patch. > > BTW, I do have a patch in work to add pwrseq support for wlcore that > allows leaving out the regulator here. It still needs a bit more > work though. > > And I also have a series in work to make wlcore use runtime PM that > needs even more work, just FYI to avoid any duplicate work. > > Hmm you don't happen to have a patch series somewhere making > wlcore use the SDIO dat lien interrupt? wilink has always used out of band interrupt (using wlan_irq gpio). in-band interrupts was not supported. See section 10.5.2 in this the wl18xx hardware integration guide: http://www.ti.com/lit/ug/swru437/swru437.pdf > > I think we should use that when idle rather than the (edge) gpio > interrupt as the SDIO dat interrupt is level sensitive and wired > to the always on gpio bank for most SDIO controller instances. > On runtime PM wakeup, there's no status anywhere to been with the > GPIO edge interrupt. > I agree that it would have been better, especially for cases such as wake On wlan, but again, in-band interrupt was something that was talked about way back but it was never implemented. Best Regards, Eyal
RE: [EXTERNAL] Re: [PATCH] arm: dts: am437x-sk-evm: add wilink8 support
> > * Eyal Reizer [180501 00:26]: > > enable mmc3 used for wlan and uart1 used for bluetooth > > configure the gpios used for wlan and bluetooth controls > > add fixed voltage regulator used for wlan power control > ... > > / { > > model = "TI AM437x SK EVM"; > > @@ -158,6 +159,22 @@ > > }; > > }; > > }; > > + > > + vmmcwl_fixed: fixedregulator-mmcwl { > > + /* > > +* WL_EN is not SDIO standard compliant. It is an out of band > > +* signal and hard to be dealt with in a standard way by the > > +* SDIO core driver. > > +* So modelling the WL_EN line as a regulator was a natural > > +* choice as the MMC core already deals with MMC supplies. > > +*/ > > + compatible = "regulator-fixed"; > > + regulator-name = "vmmcwl_fixed"; > > + regulator-min-microvolt = <180>; > > + regulator-max-microvolt = <180>; > > + gpio = < 8 GPIO_ACTIVE_HIGH>; > > + enable-active-high; > > + }; > > }; > > Interesting that it needs much longer delay here compared to the > earlier? Where do you see a delay in here? There is no startup-delay-us value used in this patch. > > BTW, I do have a patch in work to add pwrseq support for wlcore that > allows leaving out the regulator here. It still needs a bit more > work though. > > And I also have a series in work to make wlcore use runtime PM that > needs even more work, just FYI to avoid any duplicate work. > > Hmm you don't happen to have a patch series somewhere making > wlcore use the SDIO dat lien interrupt? wilink has always used out of band interrupt (using wlan_irq gpio). in-band interrupts was not supported. See section 10.5.2 in this the wl18xx hardware integration guide: http://www.ti.com/lit/ug/swru437/swru437.pdf > > I think we should use that when idle rather than the (edge) gpio > interrupt as the SDIO dat interrupt is level sensitive and wired > to the always on gpio bank for most SDIO controller instances. > On runtime PM wakeup, there's no status anywhere to been with the > GPIO edge interrupt. > I agree that it would have been better, especially for cases such as wake On wlan, but again, in-band interrupt was something that was talked about way back but it was never implemented. Best Regards, Eyal
RE: [PATCH] arm: dts: am437x-sk-evm: add wilink8 support
> > ARM should be capitalized in subject line. OK, will be fixed in v2 > > > + > > + { > > + status = "okay"; > > + /* > > +* these are on the crossbar and are outlined in the > > +* xbar-event-map element > > +*/ > > + dmas = <_xbar 30 0 1>, > > + <_xbar 31 0 2>; > > + dma-names = "tx", "rx"; > > + vmmc-supply = <_fixed>; > > + bus-width = <4>; > > + pinctrl-names = "default", "sleep"; > > + pinctrl-0 = <_pins_default>; > > + pinctrl-1 = <_pins_sleep>; > > + cap-power-off-card; > > + keep-power-in-suspend; > > + ti,non-removable; > > + > > + #address-cells = <1>; > > + #size-cells = <0>; > > + wlcore: wlcore@0 { > > wlcore@2 > Will be fixed in v2 > > + compatible = "ti,wl1835"; > > + pinctrl-names = "default", "sleep"; > > + pinctrl-0 = <_pins_default>; > > + pinctrl-1 = <_pins_sleep>; > > + reg = <2>; > > + interrupt-parent = <>; > > + interrupts = <13 IRQ_TYPE_LEVEL_HIGH>; > > + }; > > +}; > Best Regards, Eyal
RE: [PATCH] arm: dts: am437x-sk-evm: add wilink8 support
> > ARM should be capitalized in subject line. OK, will be fixed in v2 > > > + > > + { > > + status = "okay"; > > + /* > > +* these are on the crossbar and are outlined in the > > +* xbar-event-map element > > +*/ > > + dmas = <_xbar 30 0 1>, > > + <_xbar 31 0 2>; > > + dma-names = "tx", "rx"; > > + vmmc-supply = <_fixed>; > > + bus-width = <4>; > > + pinctrl-names = "default", "sleep"; > > + pinctrl-0 = <_pins_default>; > > + pinctrl-1 = <_pins_sleep>; > > + cap-power-off-card; > > + keep-power-in-suspend; > > + ti,non-removable; > > + > > + #address-cells = <1>; > > + #size-cells = <0>; > > + wlcore: wlcore@0 { > > wlcore@2 > Will be fixed in v2 > > + compatible = "ti,wl1835"; > > + pinctrl-names = "default", "sleep"; > > + pinctrl-0 = <_pins_default>; > > + pinctrl-1 = <_pins_sleep>; > > + reg = <2>; > > + interrupt-parent = <>; > > + interrupts = <13 IRQ_TYPE_LEVEL_HIGH>; > > + }; > > +}; > Best Regards, Eyal
RE: [EXTERNAL] [tiL4.14-CON PATCH v2] ARM: dts: am437x-sk-evm: add wilink8 support
Please discard. Wrong patch header. Will resend. Sorry about that. > > enable mmc3 used for wlan and uart1 used for bluetooth > configure the gpios used for wlan and bluetooth controls > add fixed voltage regulator used for wlan power control > > Signed-off-by: Eyal Reizer> --- > arch/arm/boot/dts/am437x-sk-evm.dts | 115 > > 1 file changed, 115 insertions(+) > > diff --git a/arch/arm/boot/dts/am437x-sk-evm.dts > b/arch/arm/boot/dts/am437x-sk-evm.dts > index 16d9db0..afffdb1 100644 > --- a/arch/arm/boot/dts/am437x-sk-evm.dts > +++ b/arch/arm/boot/dts/am437x-sk-evm.dts > @@ -15,6 +15,7 @@ > #include > #include > #include > +#include > > / { > model = "TI AM437x SK EVM"; > @@ -158,6 +159,22 @@ > }; > }; > }; > + > + vmmcwl_fixed: fixedregulator-mmcwl { > + /* > + * WL_EN is not SDIO standard compliant. It is an out of band > + * signal and hard to be dealt with in a standard way by the > + * SDIO core driver. > + * So modelling the WL_EN line as a regulator was a natural > + * choice as the MMC core already deals with MMC supplies. > + */ > + compatible = "regulator-fixed"; > + regulator-name = "vmmcwl_fixed"; > + regulator-min-microvolt = <180>; > + regulator-max-microvolt = <180>; > + gpio = < 8 GPIO_ACTIVE_HIGH>; > + enable-active-high; > + }; > }; > > _pinmux { > @@ -424,6 +441,62 @@ > AM4372_IOPAD(0xac4, PIN_OUTPUT | > MUX_MODE0) /* usb0_drvvbus.usb0_drvvbus */ > >; > }; > + > + mmc3_pins_default: pinmux_mmc3_pins_default { > + pinctrl-single,pins = < > + AM4372_IOPAD(0x9f0, PIN_INPUT_PULLUP | > MUX_MODE3) /* (AD21) cam1_data2.mmc2_clk */ > + AM4372_IOPAD(0x9f4, PIN_INPUT_PULLUP | > MUX_MODE3) /* (AE22) cam1_data3.mmc2_cmd */ > + AM4372_IOPAD(0x9f8, PIN_INPUT_PULLUP | > MUX_MODE3) /* (AD22) cam1_data4.mmc2_dat0 */ > + AM4372_IOPAD(0x9fc, PIN_INPUT_PULLUP | > MUX_MODE3) /* (AE23) cam1_data5.mmc2_dat1 */ > + AM4372_IOPAD(0xa00, PIN_INPUT_PULLUP | > MUX_MODE3) /* (AD23) cam1_data6.mmc2_dat2 */ > + AM4372_IOPAD(0xa04, PIN_INPUT_PULLUP | > MUX_MODE3) /* (AE24) cam1_data7.mmc2_dat3 */ > + >; > + }; > + > + mmc3_pins_sleep: pinmux_mmc3_pins_sleep { > + pinctrl-single,pins = < > + AM4372_IOPAD(0x9f0, PIN_INPUT_PULLDOWN | > MUX_MODE7) /* (AD21) cam1_data2.mmc2_clk */ > + AM4372_IOPAD(0x9f4, PIN_INPUT_PULLDOWN | > MUX_MODE7) /* (AE22) cam1_data3.mmc2_cmd */ > + AM4372_IOPAD(0x9f8, PIN_INPUT_PULLDOWN | > MUX_MODE7) /* (AD22) cam1_data4.mmc2_dat0 */ > + AM4372_IOPAD(0x9fc, PIN_INPUT_PULLDOWN | > MUX_MODE7) /* (AE23) cam1_data5.mmc2_dat1 */ > + AM4372_IOPAD(0xa00, PIN_INPUT_PULLDOWN | > MUX_MODE7) /* (AD23) cam1_data6.mmc2_dat2 */ > + AM4372_IOPAD(0xa04, PIN_INPUT_PULLDOWN | > MUX_MODE7) /* (AE24) cam1_data7.mmc2_dat3 */ > + >; > + }; > + > + wlan_pins_default: pinmux_wlan_pins_default { > + pinctrl-single,pins = < > + AM4372_IOPAD(0x9d0, PIN_OUTPUT_PULLDOWN | > MUX_MODE7)/* cam1_data8.gpio4_8 WL_EN */ > + AM4372_IOPAD(0x9e4, PIN_INPUT | > WAKEUP_ENABLE | MUX_MODE7)/* cam1_wen.gpio4_13 WL_IRQ */ > + >; > + }; > + > + wlan_pins_sleep: pinmux_wlan_pins_sleep { > + pinctrl-single,pins = < > + AM4372_IOPAD(0x9d0, PIN_OUTPUT_PULLDOWN | > MUX_MODE7)/* cam1_data8.gpio4_8 WL_EN */ > + AM4372_IOPAD(0x9e4, PIN_INPUT | > WAKEUP_ENABLE | MUX_MODE7)/* cam1_wen.gpio4_13 WL_IRQ */ > + >; > + }; > + > + uart1_bt_pins_default: pinmux_uart1_bt_pins_default { > + pinctrl-single,pins = < > + AM4372_IOPAD(0x980, PIN_INPUT | MUX_MODE0) > /* uart1_rxd.uart1_rxd */ > + AM4372_IOPAD(0x984, PIN_OUTPUT_PULLDOWN | > MUX_MODE0)/* uart1_txd.uart1_txd */ > + AM4372_IOPAD(0x978, PIN_INPUT_PULLUP | > MUX_MODE0)/* uart1_ctsn.uart1_ctsn */ > + AM4372_IOPAD(0x97c, PIN_OUTPUT_PULLDOWN | > MUX_MODE0)/* uart1_rtsn.uart1_rtsn */ > + AM4372_IOPAD(0x9cc, PIN_OUTPUT_PULLDOWN | > MUX_MODE7)/* cam1_data9.gpio4_7 BT_EN */ > + >; > + }; > + > + uart1_bt_pins_sleep: pinmux_uart1_bt_pins_sleep { > + pinctrl-single,pins = < > + AM4372_IOPAD(0x980, PIN_OUTPUT_PULLDOWN | > MUX_MODE7)/* uart1_rxd.uart1_rxd */ > + AM4372_IOPAD(0x984,
RE: [EXTERNAL] [tiL4.14-CON PATCH v2] ARM: dts: am437x-sk-evm: add wilink8 support
Please discard. Wrong patch header. Will resend. Sorry about that. > > enable mmc3 used for wlan and uart1 used for bluetooth > configure the gpios used for wlan and bluetooth controls > add fixed voltage regulator used for wlan power control > > Signed-off-by: Eyal Reizer > --- > arch/arm/boot/dts/am437x-sk-evm.dts | 115 > > 1 file changed, 115 insertions(+) > > diff --git a/arch/arm/boot/dts/am437x-sk-evm.dts > b/arch/arm/boot/dts/am437x-sk-evm.dts > index 16d9db0..afffdb1 100644 > --- a/arch/arm/boot/dts/am437x-sk-evm.dts > +++ b/arch/arm/boot/dts/am437x-sk-evm.dts > @@ -15,6 +15,7 @@ > #include > #include > #include > +#include > > / { > model = "TI AM437x SK EVM"; > @@ -158,6 +159,22 @@ > }; > }; > }; > + > + vmmcwl_fixed: fixedregulator-mmcwl { > + /* > + * WL_EN is not SDIO standard compliant. It is an out of band > + * signal and hard to be dealt with in a standard way by the > + * SDIO core driver. > + * So modelling the WL_EN line as a regulator was a natural > + * choice as the MMC core already deals with MMC supplies. > + */ > + compatible = "regulator-fixed"; > + regulator-name = "vmmcwl_fixed"; > + regulator-min-microvolt = <180>; > + regulator-max-microvolt = <180>; > + gpio = < 8 GPIO_ACTIVE_HIGH>; > + enable-active-high; > + }; > }; > > _pinmux { > @@ -424,6 +441,62 @@ > AM4372_IOPAD(0xac4, PIN_OUTPUT | > MUX_MODE0) /* usb0_drvvbus.usb0_drvvbus */ > >; > }; > + > + mmc3_pins_default: pinmux_mmc3_pins_default { > + pinctrl-single,pins = < > + AM4372_IOPAD(0x9f0, PIN_INPUT_PULLUP | > MUX_MODE3) /* (AD21) cam1_data2.mmc2_clk */ > + AM4372_IOPAD(0x9f4, PIN_INPUT_PULLUP | > MUX_MODE3) /* (AE22) cam1_data3.mmc2_cmd */ > + AM4372_IOPAD(0x9f8, PIN_INPUT_PULLUP | > MUX_MODE3) /* (AD22) cam1_data4.mmc2_dat0 */ > + AM4372_IOPAD(0x9fc, PIN_INPUT_PULLUP | > MUX_MODE3) /* (AE23) cam1_data5.mmc2_dat1 */ > + AM4372_IOPAD(0xa00, PIN_INPUT_PULLUP | > MUX_MODE3) /* (AD23) cam1_data6.mmc2_dat2 */ > + AM4372_IOPAD(0xa04, PIN_INPUT_PULLUP | > MUX_MODE3) /* (AE24) cam1_data7.mmc2_dat3 */ > + >; > + }; > + > + mmc3_pins_sleep: pinmux_mmc3_pins_sleep { > + pinctrl-single,pins = < > + AM4372_IOPAD(0x9f0, PIN_INPUT_PULLDOWN | > MUX_MODE7) /* (AD21) cam1_data2.mmc2_clk */ > + AM4372_IOPAD(0x9f4, PIN_INPUT_PULLDOWN | > MUX_MODE7) /* (AE22) cam1_data3.mmc2_cmd */ > + AM4372_IOPAD(0x9f8, PIN_INPUT_PULLDOWN | > MUX_MODE7) /* (AD22) cam1_data4.mmc2_dat0 */ > + AM4372_IOPAD(0x9fc, PIN_INPUT_PULLDOWN | > MUX_MODE7) /* (AE23) cam1_data5.mmc2_dat1 */ > + AM4372_IOPAD(0xa00, PIN_INPUT_PULLDOWN | > MUX_MODE7) /* (AD23) cam1_data6.mmc2_dat2 */ > + AM4372_IOPAD(0xa04, PIN_INPUT_PULLDOWN | > MUX_MODE7) /* (AE24) cam1_data7.mmc2_dat3 */ > + >; > + }; > + > + wlan_pins_default: pinmux_wlan_pins_default { > + pinctrl-single,pins = < > + AM4372_IOPAD(0x9d0, PIN_OUTPUT_PULLDOWN | > MUX_MODE7)/* cam1_data8.gpio4_8 WL_EN */ > + AM4372_IOPAD(0x9e4, PIN_INPUT | > WAKEUP_ENABLE | MUX_MODE7)/* cam1_wen.gpio4_13 WL_IRQ */ > + >; > + }; > + > + wlan_pins_sleep: pinmux_wlan_pins_sleep { > + pinctrl-single,pins = < > + AM4372_IOPAD(0x9d0, PIN_OUTPUT_PULLDOWN | > MUX_MODE7)/* cam1_data8.gpio4_8 WL_EN */ > + AM4372_IOPAD(0x9e4, PIN_INPUT | > WAKEUP_ENABLE | MUX_MODE7)/* cam1_wen.gpio4_13 WL_IRQ */ > + >; > + }; > + > + uart1_bt_pins_default: pinmux_uart1_bt_pins_default { > + pinctrl-single,pins = < > + AM4372_IOPAD(0x980, PIN_INPUT | MUX_MODE0) > /* uart1_rxd.uart1_rxd */ > + AM4372_IOPAD(0x984, PIN_OUTPUT_PULLDOWN | > MUX_MODE0)/* uart1_txd.uart1_txd */ > + AM4372_IOPAD(0x978, PIN_INPUT_PULLUP | > MUX_MODE0)/* uart1_ctsn.uart1_ctsn */ > + AM4372_IOPAD(0x97c, PIN_OUTPUT_PULLDOWN | > MUX_MODE0)/* uart1_rtsn.uart1_rtsn */ > + AM4372_IOPAD(0x9cc, PIN_OUTPUT_PULLDOWN | > MUX_MODE7)/* cam1_data9.gpio4_7 BT_EN */ > + >; > + }; > + > + uart1_bt_pins_sleep: pinmux_uart1_bt_pins_sleep { > + pinctrl-single,pins = < > + AM4372_IOPAD(0x980, PIN_OUTPUT_PULLDOWN | > MUX_MODE7)/* uart1_rxd.uart1_rxd */ > + AM4372_IOPAD(0x984, PIN_OUTPUT_PULLDOWN | >
RE: [EXTERNAL] Re: [PATCH v2] wlcore: sdio: allow pm to handle sdio power
> > >> > >> > pm_runtime handles sdio power on and power off transitions. > >> > An old workaround for trying to control the power explicitly from the > >> > driver was in fact causing failures on suspend/resume as the mmc layer > >> > already power the module on resume. > >> > > >> > In case of resume pm_runtime_get sync returns a positive device's > usage > >> > count causing the driver to try an re-initialize an already initialized > >> > device. This was causing sdio bus failure on resume. > >> > > >> > Remove this manual power on/off sequence as it is in-fact not needed. > >> > > >> > Signed-off-by: Eyal Reizer> >> > Acked-by: Tony Lindgren > >> > >> No changelog. > >> > >> > https://wireless.wiki.kernel.org/en/developers/documentation/submittingp > >> atches#changelog_missing > >> > >> No need to resubmit because of this, I guess you just fixed the title > >> and added Tony's Acked-by? > > > > Yes, this is correct. No change in the actual patch hence there was no > change > > Log. > > _Always_ include a change log, even if you didn't actually change > anything. Otherwise the maintainer has no clue what has changed and why > a new version was submitted. > Understood. Thanks! BR, Eyal
RE: [EXTERNAL] Re: [PATCH v2] wlcore: sdio: allow pm to handle sdio power
> > >> > >> > pm_runtime handles sdio power on and power off transitions. > >> > An old workaround for trying to control the power explicitly from the > >> > driver was in fact causing failures on suspend/resume as the mmc layer > >> > already power the module on resume. > >> > > >> > In case of resume pm_runtime_get sync returns a positive device's > usage > >> > count causing the driver to try an re-initialize an already initialized > >> > device. This was causing sdio bus failure on resume. > >> > > >> > Remove this manual power on/off sequence as it is in-fact not needed. > >> > > >> > Signed-off-by: Eyal Reizer > >> > Acked-by: Tony Lindgren > >> > >> No changelog. > >> > >> > https://wireless.wiki.kernel.org/en/developers/documentation/submittingp > >> atches#changelog_missing > >> > >> No need to resubmit because of this, I guess you just fixed the title > >> and added Tony's Acked-by? > > > > Yes, this is correct. No change in the actual patch hence there was no > change > > Log. > > _Always_ include a change log, even if you didn't actually change > anything. Otherwise the maintainer has no clue what has changed and why > a new version was submitted. > Understood. Thanks! BR, Eyal
RE: [EXTERNAL] Re: [PATCH v2] wlcore: sdio: allow pm to handle sdio power
> > > pm_runtime handles sdio power on and power off transitions. > > An old workaround for trying to control the power explicitly from the > > driver was in fact causing failures on suspend/resume as the mmc layer > > already power the module on resume. > > > > In case of resume pm_runtime_get sync returns a positive device's usage > > count causing the driver to try an re-initialize an already initialized > > device. This was causing sdio bus failure on resume. > > > > Remove this manual power on/off sequence as it is in-fact not needed. > > > > Signed-off-by: Eyal Reizer> > Acked-by: Tony Lindgren > > No changelog. > > https://wireless.wiki.kernel.org/en/developers/documentation/submittingp > atches#changelog_missing > > No need to resubmit because of this, I guess you just fixed the title > and added Tony's Acked-by? Yes, this is correct. No change in the actual patch hence there was no change Log. Best Regards, Eyal
RE: [EXTERNAL] Re: [PATCH v2] wlcore: sdio: allow pm to handle sdio power
> > > pm_runtime handles sdio power on and power off transitions. > > An old workaround for trying to control the power explicitly from the > > driver was in fact causing failures on suspend/resume as the mmc layer > > already power the module on resume. > > > > In case of resume pm_runtime_get sync returns a positive device's usage > > count causing the driver to try an re-initialize an already initialized > > device. This was causing sdio bus failure on resume. > > > > Remove this manual power on/off sequence as it is in-fact not needed. > > > > Signed-off-by: Eyal Reizer > > Acked-by: Tony Lindgren > > No changelog. > > https://wireless.wiki.kernel.org/en/developers/documentation/submittingp > atches#changelog_missing > > No need to resubmit because of this, I guess you just fixed the title > and added Tony's Acked-by? Yes, this is correct. No change in the actual patch hence there was no change Log. Best Regards, Eyal
[PATCH] wlcore: allow elp during wowlan suspend
when enabling wowlan and entering suspend the last write to the firmware allowing it to go into elp mode was not completing before suspend, leaving the firmware running in full active mode consuming high power. Use an immediate call instead of a work queue for this last access allowing the firmware to go into power save during wowlan uspend. Signed-off-by: Eyal Reizer--- drivers/net/wireless/ti/wlcore/main.c | 29 - 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 792cb91..1c31555 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c @@ -42,6 +42,7 @@ #include "sysfs.h" #define WL1271_BOOT_RETRIES 3 +#define WL1271_SUSPEND_SLEEP 100 static char *fwlog_param; static int fwlog_mem_blocks = -1; @@ -979,6 +980,24 @@ static int wlcore_fw_wakeup(struct wl1271 *wl) return wlcore_raw_write32(wl, HW_ACCESS_ELP_CTRL_REG, ELPCTRL_WAKE_UP); } +static int wlcore_fw_sleep(struct wl1271 *wl) +{ + int ret; + + mutex_lock(>mutex); + ret = wlcore_raw_write32(wl, HW_ACCESS_ELP_CTRL_REG, ELPCTRL_SLEEP); + if (ret < 0) { + wl12xx_queue_recovery_work(wl); + goto out; + } + set_bit(WL1271_FLAG_IN_ELP, >flags); +out: + mutex_unlock(>mutex); + mdelay(WL1271_SUSPEND_SLEEP); + + return 0; +} + static int wl1271_setup(struct wl1271 *wl) { wl->raw_fw_status = kzalloc(wl->fw_status_len, GFP_KERNEL); @@ -1750,7 +1769,6 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw, goto out_sleep; out_sleep: - wl1271_ps_elp_sleep(wl); mutex_unlock(>mutex); if (ret < 0) { @@ -1783,6 +1801,15 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw, */ cancel_delayed_work(>tx_watchdog_work); + /* +* Use an immediate call for allowing the firmware to go into power +* save during suspend. +* Using a workque for this last write was only hapenning on resume +* leaving the firmware with power save disabled during suspend, +* while consuming full power during wowlan suspend. +*/ + wlcore_fw_sleep(wl); + return 0; } -- 2.7.4
[PATCH] wlcore: allow elp during wowlan suspend
when enabling wowlan and entering suspend the last write to the firmware allowing it to go into elp mode was not completing before suspend, leaving the firmware running in full active mode consuming high power. Use an immediate call instead of a work queue for this last access allowing the firmware to go into power save during wowlan uspend. Signed-off-by: Eyal Reizer --- drivers/net/wireless/ti/wlcore/main.c | 29 - 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 792cb91..1c31555 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c @@ -42,6 +42,7 @@ #include "sysfs.h" #define WL1271_BOOT_RETRIES 3 +#define WL1271_SUSPEND_SLEEP 100 static char *fwlog_param; static int fwlog_mem_blocks = -1; @@ -979,6 +980,24 @@ static int wlcore_fw_wakeup(struct wl1271 *wl) return wlcore_raw_write32(wl, HW_ACCESS_ELP_CTRL_REG, ELPCTRL_WAKE_UP); } +static int wlcore_fw_sleep(struct wl1271 *wl) +{ + int ret; + + mutex_lock(>mutex); + ret = wlcore_raw_write32(wl, HW_ACCESS_ELP_CTRL_REG, ELPCTRL_SLEEP); + if (ret < 0) { + wl12xx_queue_recovery_work(wl); + goto out; + } + set_bit(WL1271_FLAG_IN_ELP, >flags); +out: + mutex_unlock(>mutex); + mdelay(WL1271_SUSPEND_SLEEP); + + return 0; +} + static int wl1271_setup(struct wl1271 *wl) { wl->raw_fw_status = kzalloc(wl->fw_status_len, GFP_KERNEL); @@ -1750,7 +1769,6 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw, goto out_sleep; out_sleep: - wl1271_ps_elp_sleep(wl); mutex_unlock(>mutex); if (ret < 0) { @@ -1783,6 +1801,15 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw, */ cancel_delayed_work(>tx_watchdog_work); + /* +* Use an immediate call for allowing the firmware to go into power +* save during suspend. +* Using a workque for this last write was only hapenning on resume +* leaving the firmware with power save disabled during suspend, +* while consuming full power during wowlan suspend. +*/ + wlcore_fw_sleep(wl); + return 0; } -- 2.7.4
[v9] wlcore: add missing nvs file name info for wilink8
The following commits: commit c815fdebef44 ("wlcore: spi: Populate config firmware data") commit d776fc86b82f ("wlcore: sdio: Populate config firmware data") Populated the nvs entry for wilink6 and wilink7 only while it is still needed for wilink8 as well. This broke user space backward compatibility when upgrading from older kernels, as the alternate mac address would not be read from the nvs that is present in the file system (lib/firmware/ti-connectivity/wl1271-nvs.bin) causing mac address change of the wlan interface. This patch fix this and update the structure field with the same default nvs file name that has been used before. In addition, some distros hold a default wl1271-nvs.bin in the file system with a bogus mac address (deadbeef...) that overrides the mac address that is stored inside the device. Warn users about this bogus mac address and use the internal mac address Fixes: c815fdebef44 ("wlcore: spi: Populate config firmware data") Fixes: d776fc86b82f ("wlcore: sdio: Populate config firmware data") Signed-off-by: Eyal ReizerReviewed-by: Sebastian Reichel Tested-by: Tony Lindgren --- v2->v3: add a check for default deadbeef... mac address and warn about it v3->v4: use a random TI mac address instead of the bogus one v4->v5: add constant definition for TI oui address v5->v6: after also verifying on wilink6/7 Use internal mac address instead of a random one v6->v7: use random mac in case internal mac is zero v7->v8: adjust warning message based on wilink family (wl12xx/wl18xx) v8->v9: change to detecting wl18xx family for correct warning string when bogus nvs is used --- drivers/net/wireless/ti/wlcore/main.c | 23 +++ drivers/net/wireless/ti/wlcore/sdio.c | 1 + drivers/net/wireless/ti/wlcore/spi.c| 1 + drivers/net/wireless/ti/wlcore/wlcore.h | 3 +++ 4 files changed, 28 insertions(+) diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 60aaa85..c346c02 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c @@ -6016,6 +6016,8 @@ static int wl1271_register_hw(struct wl1271 *wl) { int ret; u32 oui_addr = 0, nic_addr = 0; + struct platform_device *pdev = wl->pdev; + struct wlcore_platdev_data *pdev_data = dev_get_platdata(>dev); if (wl->mac80211_registered) return 0; @@ -6040,6 +6042,27 @@ static int wl1271_register_hw(struct wl1271 *wl) nic_addr = wl->fuse_nic_addr + 1; } + if (oui_addr == 0xdeadbe && nic_addr == 0xef) { + wl1271_warning("Detected unconfigured mac address in nvs, derive from fuse instead.\n"); + if (!strcmp(pdev_data->family->name, "wl18xx")) { + wl1271_warning("This default nvs file can be removed from the file system\n"); + } else { + wl1271_warning("Your device performance is not optimized.\n"); + wl1271_warning("Please use the calibrator tool to configure your device.\n"); + } + + if (wl->fuse_oui_addr == 0 && wl->fuse_nic_addr == 0) { + wl1271_warning("Fuse mac address is zero. using random mac\n"); + /* Use TI oui and a random nic */ + oui_addr = WLCORE_TI_OUI_ADDRESS; + nic_addr = get_random_int(); + } else { + oui_addr = wl->fuse_oui_addr; + /* fuse has the BD_ADDR, the WLAN addresses are the next two */ + nic_addr = wl->fuse_nic_addr + 1; + } + } + wl12xx_derive_mac_addresses(wl, oui_addr, nic_addr); ret = ieee80211_register_hw(wl->hw); diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index 2fb3871..f8a1fea 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c @@ -230,6 +230,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; static const struct of_device_id wlcore_sdio_of_match_table[] = { diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index fdabb92..62ce54a 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -92,6 +92,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; struct wl12xx_spi_glue { diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h
[v9] wlcore: add missing nvs file name info for wilink8
The following commits: commit c815fdebef44 ("wlcore: spi: Populate config firmware data") commit d776fc86b82f ("wlcore: sdio: Populate config firmware data") Populated the nvs entry for wilink6 and wilink7 only while it is still needed for wilink8 as well. This broke user space backward compatibility when upgrading from older kernels, as the alternate mac address would not be read from the nvs that is present in the file system (lib/firmware/ti-connectivity/wl1271-nvs.bin) causing mac address change of the wlan interface. This patch fix this and update the structure field with the same default nvs file name that has been used before. In addition, some distros hold a default wl1271-nvs.bin in the file system with a bogus mac address (deadbeef...) that overrides the mac address that is stored inside the device. Warn users about this bogus mac address and use the internal mac address Fixes: c815fdebef44 ("wlcore: spi: Populate config firmware data") Fixes: d776fc86b82f ("wlcore: sdio: Populate config firmware data") Signed-off-by: Eyal Reizer Reviewed-by: Sebastian Reichel Tested-by: Tony Lindgren --- v2->v3: add a check for default deadbeef... mac address and warn about it v3->v4: use a random TI mac address instead of the bogus one v4->v5: add constant definition for TI oui address v5->v6: after also verifying on wilink6/7 Use internal mac address instead of a random one v6->v7: use random mac in case internal mac is zero v7->v8: adjust warning message based on wilink family (wl12xx/wl18xx) v8->v9: change to detecting wl18xx family for correct warning string when bogus nvs is used --- drivers/net/wireless/ti/wlcore/main.c | 23 +++ drivers/net/wireless/ti/wlcore/sdio.c | 1 + drivers/net/wireless/ti/wlcore/spi.c| 1 + drivers/net/wireless/ti/wlcore/wlcore.h | 3 +++ 4 files changed, 28 insertions(+) diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 60aaa85..c346c02 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c @@ -6016,6 +6016,8 @@ static int wl1271_register_hw(struct wl1271 *wl) { int ret; u32 oui_addr = 0, nic_addr = 0; + struct platform_device *pdev = wl->pdev; + struct wlcore_platdev_data *pdev_data = dev_get_platdata(>dev); if (wl->mac80211_registered) return 0; @@ -6040,6 +6042,27 @@ static int wl1271_register_hw(struct wl1271 *wl) nic_addr = wl->fuse_nic_addr + 1; } + if (oui_addr == 0xdeadbe && nic_addr == 0xef) { + wl1271_warning("Detected unconfigured mac address in nvs, derive from fuse instead.\n"); + if (!strcmp(pdev_data->family->name, "wl18xx")) { + wl1271_warning("This default nvs file can be removed from the file system\n"); + } else { + wl1271_warning("Your device performance is not optimized.\n"); + wl1271_warning("Please use the calibrator tool to configure your device.\n"); + } + + if (wl->fuse_oui_addr == 0 && wl->fuse_nic_addr == 0) { + wl1271_warning("Fuse mac address is zero. using random mac\n"); + /* Use TI oui and a random nic */ + oui_addr = WLCORE_TI_OUI_ADDRESS; + nic_addr = get_random_int(); + } else { + oui_addr = wl->fuse_oui_addr; + /* fuse has the BD_ADDR, the WLAN addresses are the next two */ + nic_addr = wl->fuse_nic_addr + 1; + } + } + wl12xx_derive_mac_addresses(wl, oui_addr, nic_addr); ret = ieee80211_register_hw(wl->hw); diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index 2fb3871..f8a1fea 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c @@ -230,6 +230,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; static const struct of_device_id wlcore_sdio_of_match_table[] = { diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index fdabb92..62ce54a 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -92,6 +92,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; struct wl12xx_spi_glue { diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h b/drivers/net/wireless/ti/wlcore/wlcore.h index 1827546..95fbedc 100644 ---
[v8] wlcore: add missing nvs file name info for wilink8
The following commits: commit c815fdebef44 ("wlcore: spi: Populate config firmware data") commit d776fc86b82f ("wlcore: sdio: Populate config firmware data") Populated the nvs entry for wilink6 and wilink7 only while it is still needed for wilink8 as well. This broke user space backward compatibility when upgrading from older kernels, as the alternate mac address would not be read from the nvs that is present in the file system (lib/firmware/ti-connectivity/wl1271-nvs.bin) causing mac address change of the wlan interface. This patch fix this and update the structure field with the same default nvs file name that has been used before. In addition, some distros hold a default wl1271-nvs.bin in the file system with a bogus mac address (deadbeef...) that overrides the mac address that is stored inside the device. Warn users about this bogus mac address and use the internal mac address Fixes: c815fdebef44 ("wlcore: spi: Populate config firmware data") Fixes: d776fc86b82f ("wlcore: sdio: Populate config firmware data") Signed-off-by: Eyal ReizerReviewed-by: Sebastian Reichel Tested-by: Tony Lindgren --- v2->v3: add a check for default deadbeef... mac address and warn about it v3->v4: use a random TI mac address instead of the bogus one v4->v5: add constant definition for TI oui address v5->v6: after also verifying on wilink6/7 Use internal mac address instead of a random one v6->v7: use random mac in case internal mac is zero v7->v8: adjust warning message based on wilink family (wl12xx/wl18xx) --- drivers/net/wireless/ti/wlcore/main.c | 23 +++ drivers/net/wireless/ti/wlcore/sdio.c | 1 + drivers/net/wireless/ti/wlcore/spi.c| 1 + drivers/net/wireless/ti/wlcore/wlcore.h | 3 +++ 4 files changed, 28 insertions(+) diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 60aaa85..2c80cea 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c @@ -6016,6 +6016,8 @@ static int wl1271_register_hw(struct wl1271 *wl) { int ret; u32 oui_addr = 0, nic_addr = 0; + struct platform_device *pdev = wl->pdev; + struct wlcore_platdev_data *pdev_data = dev_get_platdata(>dev); if (wl->mac80211_registered) return 0; @@ -6040,6 +6042,27 @@ static int wl1271_register_hw(struct wl1271 *wl) nic_addr = wl->fuse_nic_addr + 1; } + if (oui_addr == 0xdeadbe && nic_addr == 0xef) { + wl1271_warning("Detected unconfigured mac address in nvs, derive from fuse instead.\n"); + if (!strcmp(pdev_data->family->name, "wl12xx")) { + wl1271_warning("Your device performance is not optimized.\n"); + wl1271_warning("Please use the calibrator tool to configure your device.\n"); + } else { + wl1271_warning("This default nvs file can be removed from the file system\n"); + } + + if (wl->fuse_oui_addr == 0 && wl->fuse_nic_addr == 0) { + wl1271_warning("Fuse mac address is zero. using random mac\n"); + /* Use TI oui and a random nic */ + oui_addr = WLCORE_TI_OUI_ADDRESS; + nic_addr = get_random_int(); + } else { + oui_addr = wl->fuse_oui_addr; + /* fuse has the BD_ADDR, the WLAN addresses are the next two */ + nic_addr = wl->fuse_nic_addr + 1; + } + } + wl12xx_derive_mac_addresses(wl, oui_addr, nic_addr); ret = ieee80211_register_hw(wl->hw); diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index 2fb3871..f8a1fea 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c @@ -230,6 +230,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; static const struct of_device_id wlcore_sdio_of_match_table[] = { diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index fdabb92..62ce54a 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -92,6 +92,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; struct wl12xx_spi_glue { diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h b/drivers/net/wireless/ti/wlcore/wlcore.h index 1827546..95fbedc 100644 --- a/drivers/net/wireless/ti/wlcore/wlcore.h +++
[v8] wlcore: add missing nvs file name info for wilink8
The following commits: commit c815fdebef44 ("wlcore: spi: Populate config firmware data") commit d776fc86b82f ("wlcore: sdio: Populate config firmware data") Populated the nvs entry for wilink6 and wilink7 only while it is still needed for wilink8 as well. This broke user space backward compatibility when upgrading from older kernels, as the alternate mac address would not be read from the nvs that is present in the file system (lib/firmware/ti-connectivity/wl1271-nvs.bin) causing mac address change of the wlan interface. This patch fix this and update the structure field with the same default nvs file name that has been used before. In addition, some distros hold a default wl1271-nvs.bin in the file system with a bogus mac address (deadbeef...) that overrides the mac address that is stored inside the device. Warn users about this bogus mac address and use the internal mac address Fixes: c815fdebef44 ("wlcore: spi: Populate config firmware data") Fixes: d776fc86b82f ("wlcore: sdio: Populate config firmware data") Signed-off-by: Eyal Reizer Reviewed-by: Sebastian Reichel Tested-by: Tony Lindgren --- v2->v3: add a check for default deadbeef... mac address and warn about it v3->v4: use a random TI mac address instead of the bogus one v4->v5: add constant definition for TI oui address v5->v6: after also verifying on wilink6/7 Use internal mac address instead of a random one v6->v7: use random mac in case internal mac is zero v7->v8: adjust warning message based on wilink family (wl12xx/wl18xx) --- drivers/net/wireless/ti/wlcore/main.c | 23 +++ drivers/net/wireless/ti/wlcore/sdio.c | 1 + drivers/net/wireless/ti/wlcore/spi.c| 1 + drivers/net/wireless/ti/wlcore/wlcore.h | 3 +++ 4 files changed, 28 insertions(+) diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 60aaa85..2c80cea 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c @@ -6016,6 +6016,8 @@ static int wl1271_register_hw(struct wl1271 *wl) { int ret; u32 oui_addr = 0, nic_addr = 0; + struct platform_device *pdev = wl->pdev; + struct wlcore_platdev_data *pdev_data = dev_get_platdata(>dev); if (wl->mac80211_registered) return 0; @@ -6040,6 +6042,27 @@ static int wl1271_register_hw(struct wl1271 *wl) nic_addr = wl->fuse_nic_addr + 1; } + if (oui_addr == 0xdeadbe && nic_addr == 0xef) { + wl1271_warning("Detected unconfigured mac address in nvs, derive from fuse instead.\n"); + if (!strcmp(pdev_data->family->name, "wl12xx")) { + wl1271_warning("Your device performance is not optimized.\n"); + wl1271_warning("Please use the calibrator tool to configure your device.\n"); + } else { + wl1271_warning("This default nvs file can be removed from the file system\n"); + } + + if (wl->fuse_oui_addr == 0 && wl->fuse_nic_addr == 0) { + wl1271_warning("Fuse mac address is zero. using random mac\n"); + /* Use TI oui and a random nic */ + oui_addr = WLCORE_TI_OUI_ADDRESS; + nic_addr = get_random_int(); + } else { + oui_addr = wl->fuse_oui_addr; + /* fuse has the BD_ADDR, the WLAN addresses are the next two */ + nic_addr = wl->fuse_nic_addr + 1; + } + } + wl12xx_derive_mac_addresses(wl, oui_addr, nic_addr); ret = ieee80211_register_hw(wl->hw); diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index 2fb3871..f8a1fea 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c @@ -230,6 +230,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; static const struct of_device_id wlcore_sdio_of_match_table[] = { diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index fdabb92..62ce54a 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -92,6 +92,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; struct wl12xx_spi_glue { diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h b/drivers/net/wireless/ti/wlcore/wlcore.h index 1827546..95fbedc 100644 --- a/drivers/net/wireless/ti/wlcore/wlcore.h +++ b/drivers/net/wireless/ti/wlcore/wlcore.h @@ -40,6 +40,9 @@ /*
RE: [v7 wlcore: add missing nvs file name info for wilink8
> > > > + if (oui_addr == 0xdeadbe && nic_addr == 0xef) { > > + wl1271_warning("Detected unconfigured mac address in > nvs.\n" > > + "derive from fuse instead.\n" > > + "in case of using a wl12xx device, your " > > + "device performance may not be > optimized.\n" > > + "Please use the calibrator tool to configure " > > + "your device.\n" > > + "When using a wl18xx device this default nvs > " > > + "file can be removed from the file > system\n"); > > Usually we do not break multiline messages to make it easier to grep > for them. Also it feels weird to say "if your device is ..., then > ...", when we actually know which device it is. I suggest the > following: > > wl1271_warning("Detected unconfigured mac address in nvs, derive from > fuse instead.\n"); > if (device_is_wl12xx) { > wl1271_warning("Your device performance is not optimized.\n"); > wl1271_warning("Please use the calibrator tool to configure your > device.\n"); > } else { > wl1271_warning("This default nvs file can be removed from the file > system\n"); > } OK, will try that out. > > > + if (wl->fuse_oui_addr == 0 && wl->fuse_nic_addr == 0) { > > + wl1271_warning("Fuse mac address is zero. using " > > + "random mac\n"); > > This one should also go into one line. This will still exceed 80 characters. Is this still ok? > > > + /* Use TI oui and a random nic */ > > + oui_addr = WLCORE_TI_OUI_ADDRESS; > > + nic_addr = get_random_int(); > > + } else { > > + oui_addr = wl->fuse_oui_addr; > > + /* fuse has the BD_ADDR, the WLAN addresses are > the next two */ > > + nic_addr = wl->fuse_nic_addr + 1; > > + } > > + } > > + > > wl12xx_derive_mac_addresses(wl, oui_addr, nic_addr); > > > > ret = ieee80211_register_hw(wl->hw); > > diff --git a/drivers/net/wireless/ti/wlcore/sdio.c > b/drivers/net/wireless/ti/wlcore/sdio.c > > index 2fb3871..f8a1fea 100644 > > --- a/drivers/net/wireless/ti/wlcore/sdio.c > > +++ b/drivers/net/wireless/ti/wlcore/sdio.c > > @@ -230,6 +230,7 @@ static const struct wilink_family_data wl128x_data = > { > > static const struct wilink_family_data wl18xx_data = { > > .name = "wl18xx", > > .cfg_name = "ti-connectivity/wl18xx-conf.bin", > > + .nvs_name = "ti-connectivity/wl1271-nvs.bin", > > }; > > > > static const struct of_device_id wlcore_sdio_of_match_table[] = { > > diff --git a/drivers/net/wireless/ti/wlcore/spi.c > b/drivers/net/wireless/ti/wlcore/spi.c > > index fdabb92..62ce54a 100644 > > --- a/drivers/net/wireless/ti/wlcore/spi.c > > +++ b/drivers/net/wireless/ti/wlcore/spi.c > > @@ -92,6 +92,7 @@ static const struct wilink_family_data wl128x_data = { > > static const struct wilink_family_data wl18xx_data = { > > .name = "wl18xx", > > .cfg_name = "ti-connectivity/wl18xx-conf.bin", > > + .nvs_name = "ti-connectivity/wl1271-nvs.bin", > > }; > > > > struct wl12xx_spi_glue { > > diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h > b/drivers/net/wireless/ti/wlcore/wlcore.h > > index 1827546..95fbedc 100644 > > --- a/drivers/net/wireless/ti/wlcore/wlcore.h > > +++ b/drivers/net/wireless/ti/wlcore/wlcore.h > > @@ -40,6 +40,9 @@ > > /* wl12xx/wl18xx maximum transmission power (in dBm) */ > > #define WLCORE_MAX_TXPWR25 > > > > +/* Texas Instruments pre assigned OUI */ > > +#define WLCORE_TI_OUI_ADDRESS 0x080028 > > + > > /* forward declaration */ > > struct wl1271_tx_hw_descr; > > enum wl_rx_buf_align; > > Otherwise: > > Reviewed-by: Sebastian Reichel> Thank you. Will submit v8 with your comments about the strings. Just waiting for clarification on the 80 characters question above Best Regards, Eyal
RE: [v7 wlcore: add missing nvs file name info for wilink8
> > > > + if (oui_addr == 0xdeadbe && nic_addr == 0xef) { > > + wl1271_warning("Detected unconfigured mac address in > nvs.\n" > > + "derive from fuse instead.\n" > > + "in case of using a wl12xx device, your " > > + "device performance may not be > optimized.\n" > > + "Please use the calibrator tool to configure " > > + "your device.\n" > > + "When using a wl18xx device this default nvs > " > > + "file can be removed from the file > system\n"); > > Usually we do not break multiline messages to make it easier to grep > for them. Also it feels weird to say "if your device is ..., then > ...", when we actually know which device it is. I suggest the > following: > > wl1271_warning("Detected unconfigured mac address in nvs, derive from > fuse instead.\n"); > if (device_is_wl12xx) { > wl1271_warning("Your device performance is not optimized.\n"); > wl1271_warning("Please use the calibrator tool to configure your > device.\n"); > } else { > wl1271_warning("This default nvs file can be removed from the file > system\n"); > } OK, will try that out. > > > + if (wl->fuse_oui_addr == 0 && wl->fuse_nic_addr == 0) { > > + wl1271_warning("Fuse mac address is zero. using " > > + "random mac\n"); > > This one should also go into one line. This will still exceed 80 characters. Is this still ok? > > > + /* Use TI oui and a random nic */ > > + oui_addr = WLCORE_TI_OUI_ADDRESS; > > + nic_addr = get_random_int(); > > + } else { > > + oui_addr = wl->fuse_oui_addr; > > + /* fuse has the BD_ADDR, the WLAN addresses are > the next two */ > > + nic_addr = wl->fuse_nic_addr + 1; > > + } > > + } > > + > > wl12xx_derive_mac_addresses(wl, oui_addr, nic_addr); > > > > ret = ieee80211_register_hw(wl->hw); > > diff --git a/drivers/net/wireless/ti/wlcore/sdio.c > b/drivers/net/wireless/ti/wlcore/sdio.c > > index 2fb3871..f8a1fea 100644 > > --- a/drivers/net/wireless/ti/wlcore/sdio.c > > +++ b/drivers/net/wireless/ti/wlcore/sdio.c > > @@ -230,6 +230,7 @@ static const struct wilink_family_data wl128x_data = > { > > static const struct wilink_family_data wl18xx_data = { > > .name = "wl18xx", > > .cfg_name = "ti-connectivity/wl18xx-conf.bin", > > + .nvs_name = "ti-connectivity/wl1271-nvs.bin", > > }; > > > > static const struct of_device_id wlcore_sdio_of_match_table[] = { > > diff --git a/drivers/net/wireless/ti/wlcore/spi.c > b/drivers/net/wireless/ti/wlcore/spi.c > > index fdabb92..62ce54a 100644 > > --- a/drivers/net/wireless/ti/wlcore/spi.c > > +++ b/drivers/net/wireless/ti/wlcore/spi.c > > @@ -92,6 +92,7 @@ static const struct wilink_family_data wl128x_data = { > > static const struct wilink_family_data wl18xx_data = { > > .name = "wl18xx", > > .cfg_name = "ti-connectivity/wl18xx-conf.bin", > > + .nvs_name = "ti-connectivity/wl1271-nvs.bin", > > }; > > > > struct wl12xx_spi_glue { > > diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h > b/drivers/net/wireless/ti/wlcore/wlcore.h > > index 1827546..95fbedc 100644 > > --- a/drivers/net/wireless/ti/wlcore/wlcore.h > > +++ b/drivers/net/wireless/ti/wlcore/wlcore.h > > @@ -40,6 +40,9 @@ > > /* wl12xx/wl18xx maximum transmission power (in dBm) */ > > #define WLCORE_MAX_TXPWR25 > > > > +/* Texas Instruments pre assigned OUI */ > > +#define WLCORE_TI_OUI_ADDRESS 0x080028 > > + > > /* forward declaration */ > > struct wl1271_tx_hw_descr; > > enum wl_rx_buf_align; > > Otherwise: > > Reviewed-by: Sebastian Reichel > Thank you. Will submit v8 with your comments about the strings. Just waiting for clarification on the 80 characters question above Best Regards, Eyal
[v7 wlcore: add missing nvs file name info for wilink8
The following commits: commit c815fdebef44 ("wlcore: spi: Populate config firmware data") commit d776fc86b82f ("wlcore: sdio: Populate config firmware data") Populated the nvs entry for wilink6 and wilink7 only while it is still needed for wilink8 as well. This broke user space backward compatibility when upgrading from older kernels, as the alternate mac address would not be read from the nvs that is present in the file system (lib/firmware/ti-connectivity/wl1271-nvs.bin) causing mac address change of the wlan interface. This patch fix this and update the structure field with the same default nvs file name that has been used before. In addition, some distros hold a default wl1271-nvs.bin in the file system with a bogus mac address (deadbeef...) that overrides the mac address that is stored inside the device. Warn users about this bogus mac address and use the internal mac address Fixes: c815fdebef44 ("wlcore: spi: Populate config firmware data") Fixes: d776fc86b82f ("wlcore: sdio: Populate config firmware data") Signed-off-by: Eyal Reizer--- v2->v3: add a check for default deadbeef... mac address and warn about it v3->v4: use a random TI mac address instead of the bogus one v4->v5: add constant definition for TI oui address v5->v6: after also verifying on wilink6/7 Use mac internal mac address instead of a random one v6->v7: use random mac in case internal mac is zero --- drivers/net/wireless/ti/wlcore/main.c | 23 +++ drivers/net/wireless/ti/wlcore/sdio.c | 1 + drivers/net/wireless/ti/wlcore/spi.c| 1 + drivers/net/wireless/ti/wlcore/wlcore.h | 3 +++ 4 files changed, 28 insertions(+) diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 60aaa85..40692ac 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c @@ -6040,6 +6040,29 @@ static int wl1271_register_hw(struct wl1271 *wl) nic_addr = wl->fuse_nic_addr + 1; } + if (oui_addr == 0xdeadbe && nic_addr == 0xef) { + wl1271_warning("Detected unconfigured mac address in nvs.\n" + "derive from fuse instead.\n" + "in case of using a wl12xx device, your " + "device performance may not be optimized.\n" + "Please use the calibrator tool to configure " + "your device.\n" + "When using a wl18xx device this default nvs " + "file can be removed from the file system\n"); + + if (wl->fuse_oui_addr == 0 && wl->fuse_nic_addr == 0) { + wl1271_warning("Fuse mac address is zero. using " + "random mac\n"); + /* Use TI oui and a random nic */ + oui_addr = WLCORE_TI_OUI_ADDRESS; + nic_addr = get_random_int(); + } else { + oui_addr = wl->fuse_oui_addr; + /* fuse has the BD_ADDR, the WLAN addresses are the next two */ + nic_addr = wl->fuse_nic_addr + 1; + } + } + wl12xx_derive_mac_addresses(wl, oui_addr, nic_addr); ret = ieee80211_register_hw(wl->hw); diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index 2fb3871..f8a1fea 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c @@ -230,6 +230,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; static const struct of_device_id wlcore_sdio_of_match_table[] = { diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index fdabb92..62ce54a 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -92,6 +92,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; struct wl12xx_spi_glue { diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h b/drivers/net/wireless/ti/wlcore/wlcore.h index 1827546..95fbedc 100644 --- a/drivers/net/wireless/ti/wlcore/wlcore.h +++ b/drivers/net/wireless/ti/wlcore/wlcore.h @@ -40,6 +40,9 @@ /* wl12xx/wl18xx maximum transmission power (in dBm) */ #define WLCORE_MAX_TXPWR25 +/* Texas Instruments pre assigned OUI */ +#define WLCORE_TI_OUI_ADDRESS 0x080028 + /* forward declaration */ struct wl1271_tx_hw_descr; enum wl_rx_buf_align; -- 2.7.4
[v7 wlcore: add missing nvs file name info for wilink8
The following commits: commit c815fdebef44 ("wlcore: spi: Populate config firmware data") commit d776fc86b82f ("wlcore: sdio: Populate config firmware data") Populated the nvs entry for wilink6 and wilink7 only while it is still needed for wilink8 as well. This broke user space backward compatibility when upgrading from older kernels, as the alternate mac address would not be read from the nvs that is present in the file system (lib/firmware/ti-connectivity/wl1271-nvs.bin) causing mac address change of the wlan interface. This patch fix this and update the structure field with the same default nvs file name that has been used before. In addition, some distros hold a default wl1271-nvs.bin in the file system with a bogus mac address (deadbeef...) that overrides the mac address that is stored inside the device. Warn users about this bogus mac address and use the internal mac address Fixes: c815fdebef44 ("wlcore: spi: Populate config firmware data") Fixes: d776fc86b82f ("wlcore: sdio: Populate config firmware data") Signed-off-by: Eyal Reizer --- v2->v3: add a check for default deadbeef... mac address and warn about it v3->v4: use a random TI mac address instead of the bogus one v4->v5: add constant definition for TI oui address v5->v6: after also verifying on wilink6/7 Use mac internal mac address instead of a random one v6->v7: use random mac in case internal mac is zero --- drivers/net/wireless/ti/wlcore/main.c | 23 +++ drivers/net/wireless/ti/wlcore/sdio.c | 1 + drivers/net/wireless/ti/wlcore/spi.c| 1 + drivers/net/wireless/ti/wlcore/wlcore.h | 3 +++ 4 files changed, 28 insertions(+) diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 60aaa85..40692ac 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c @@ -6040,6 +6040,29 @@ static int wl1271_register_hw(struct wl1271 *wl) nic_addr = wl->fuse_nic_addr + 1; } + if (oui_addr == 0xdeadbe && nic_addr == 0xef) { + wl1271_warning("Detected unconfigured mac address in nvs.\n" + "derive from fuse instead.\n" + "in case of using a wl12xx device, your " + "device performance may not be optimized.\n" + "Please use the calibrator tool to configure " + "your device.\n" + "When using a wl18xx device this default nvs " + "file can be removed from the file system\n"); + + if (wl->fuse_oui_addr == 0 && wl->fuse_nic_addr == 0) { + wl1271_warning("Fuse mac address is zero. using " + "random mac\n"); + /* Use TI oui and a random nic */ + oui_addr = WLCORE_TI_OUI_ADDRESS; + nic_addr = get_random_int(); + } else { + oui_addr = wl->fuse_oui_addr; + /* fuse has the BD_ADDR, the WLAN addresses are the next two */ + nic_addr = wl->fuse_nic_addr + 1; + } + } + wl12xx_derive_mac_addresses(wl, oui_addr, nic_addr); ret = ieee80211_register_hw(wl->hw); diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index 2fb3871..f8a1fea 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c @@ -230,6 +230,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; static const struct of_device_id wlcore_sdio_of_match_table[] = { diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index fdabb92..62ce54a 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -92,6 +92,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; struct wl12xx_spi_glue { diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h b/drivers/net/wireless/ti/wlcore/wlcore.h index 1827546..95fbedc 100644 --- a/drivers/net/wireless/ti/wlcore/wlcore.h +++ b/drivers/net/wireless/ti/wlcore/wlcore.h @@ -40,6 +40,9 @@ /* wl12xx/wl18xx maximum transmission power (in dBm) */ #define WLCORE_MAX_TXPWR25 +/* Texas Instruments pre assigned OUI */ +#define WLCORE_TI_OUI_ADDRESS 0x080028 + /* forward declaration */ struct wl1271_tx_hw_descr; enum wl_rx_buf_align; -- 2.7.4
RE: [v6] wlcore: add missing nvs file name info for wilink8
> > > > > > > > > > Sure, just want to make sure we are not trying to add work around just > for > > > A couple of faulty devices. > > > > > > > > I have verified using a couple of com6 modules with an am335x-evm > and > > > > they had mac addresses read ok. > > > > > > > > Sounds like there are multiple variants of the wl12xx > > > > available then. > > > > > > > I am trying to find out internally if there is a possibility that there > > > were > > > devices > > > Produced in the past where the internal fuses were not programmed > with a > > > valid > > > Address before being assembled into the modules. > > > > > > > Seems like MAC address for wilink6/7 was added to devices that were > produced around Q3 of 2010 > > In case you still have this omap3-evm up and can just do a quick check for > me as I don't have this board, can you try using the following command: > > > > cat /sys/bus/platform/drivers/wl12xx_driver/wl12xx.0.auto/hw_pg_ver > > > > and let me know what the output you get is? > > Sure, my omap3-evm has hw_pg_ver set to 3. > Ok, you have a PG3.0 device. Mac address was added in PG3.1 so it explains Why the mac address remains zero and not read from fuse. Will use random mac in case it is read a zero. Best Regards, Eyal
RE: [v6] wlcore: add missing nvs file name info for wilink8
> > > > > > > > > > Sure, just want to make sure we are not trying to add work around just > for > > > A couple of faulty devices. > > > > > > > > I have verified using a couple of com6 modules with an am335x-evm > and > > > > they had mac addresses read ok. > > > > > > > > Sounds like there are multiple variants of the wl12xx > > > > available then. > > > > > > > I am trying to find out internally if there is a possibility that there > > > were > > > devices > > > Produced in the past where the internal fuses were not programmed > with a > > > valid > > > Address before being assembled into the modules. > > > > > > > Seems like MAC address for wilink6/7 was added to devices that were > produced around Q3 of 2010 > > In case you still have this omap3-evm up and can just do a quick check for > me as I don't have this board, can you try using the following command: > > > > cat /sys/bus/platform/drivers/wl12xx_driver/wl12xx.0.auto/hw_pg_ver > > > > and let me know what the output you get is? > > Sure, my omap3-evm has hw_pg_ver set to 3. > Ok, you have a PG3.0 device. Mac address was added in PG3.1 so it explains Why the mac address remains zero and not read from fuse. Will use random mac in case it is read a zero. Best Regards, Eyal
RE: [v6] wlcore: add missing nvs file name info for wilink8
> > > > Sure, just want to make sure we are not trying to add work around just for > A couple of faulty devices. > > > > I have verified using a couple of com6 modules with an am335x-evm and > > they had mac addresses read ok. > > > > Sounds like there are multiple variants of the wl12xx > > available then. > > > I am trying to find out internally if there is a possibility that there were > devices > Produced in the past where the internal fuses were not programmed with a > valid > Address before being assembled into the modules. > Seems like MAC address for wilink6/7 was added to devices that were produced around Q3 of 2010 In case you still have this omap3-evm up and can just do a quick check for me as I don't have this board, can you try using the following command: cat /sys/bus/platform/drivers/wl12xx_driver/wl12xx.0.auto/hw_pg_ver and let me know what the output you get is? Best Regards, Eyal
RE: [v6] wlcore: add missing nvs file name info for wilink8
> > > > Sure, just want to make sure we are not trying to add work around just for > A couple of faulty devices. > > > > I have verified using a couple of com6 modules with an am335x-evm and > > they had mac addresses read ok. > > > > Sounds like there are multiple variants of the wl12xx > > available then. > > > I am trying to find out internally if there is a possibility that there were > devices > Produced in the past where the internal fuses were not programmed with a > valid > Address before being assembled into the modules. > Seems like MAC address for wilink6/7 was added to devices that were produced around Q3 of 2010 In case you still have this omap3-evm up and can just do a quick check for me as I don't have this board, can you try using the following command: cat /sys/bus/platform/drivers/wl12xx_driver/wl12xx.0.auto/hw_pg_ver and let me know what the output you get is? Best Regards, Eyal
RE: [v6] wlcore: add missing nvs file name info for wilink8
> > >> The fact that is old does not change a thing, we still need to > >> support it no matter what the data sheet and your system design > >> says. A fix that breaks other things is not really a fix :) > >> > > > > Sure, just want to make sure we are not trying to add work around just for > > A couple of faulty devices. > > > >> > I have verified using a couple of com6 modules with an am335x-evm and > >> they had mac addresses read ok. > >> > >> Sounds like there are multiple variants of the wl12xx > >> available then. > >> > > I am trying to find out internally if there is a possibility that there were > devices > > Produced in the past where the internal fuses were not programmed with > a valid > > Address before being assembled into the modules. > > Just a general remark, based on my past experience, you can't really > know what hardware is out there, no matter how someone in the company > claims otherwise. Uncalibrated devices, prototypes and calibration data > broken are all possible and better be preparared for that in the driver. > > It's a good idea at least to detect and print a proper error message if > the calibration data is broken. But if the data on the device only > consists of MAC address and nothing else, then I guess using a random > address is fine. > Understood. I will handle the zero mac address case and use random mac instaed. Just trying to find out how common it is as it seems strange devices like that found their way to boards that we shipped to customers. Best Regards, Eyal
RE: [v6] wlcore: add missing nvs file name info for wilink8
> > >> The fact that is old does not change a thing, we still need to > >> support it no matter what the data sheet and your system design > >> says. A fix that breaks other things is not really a fix :) > >> > > > > Sure, just want to make sure we are not trying to add work around just for > > A couple of faulty devices. > > > >> > I have verified using a couple of com6 modules with an am335x-evm and > >> they had mac addresses read ok. > >> > >> Sounds like there are multiple variants of the wl12xx > >> available then. > >> > > I am trying to find out internally if there is a possibility that there were > devices > > Produced in the past where the internal fuses were not programmed with > a valid > > Address before being assembled into the modules. > > Just a general remark, based on my past experience, you can't really > know what hardware is out there, no matter how someone in the company > claims otherwise. Uncalibrated devices, prototypes and calibration data > broken are all possible and better be preparared for that in the driver. > > It's a good idea at least to detect and print a proper error message if > the calibration data is broken. But if the data on the device only > consists of MAC address and nothing else, then I guess using a random > address is fine. > Understood. I will handle the zero mac address case and use random mac instaed. Just trying to find out how common it is as it seems strange devices like that found their way to boards that we shipped to customers. Best Regards, Eyal
RE: [v6] wlcore: add missing nvs file name info for wilink8
> > On Thu, Aug 10, 2017 at 4:35 PM, Reizer, Eyal <ey...@ti.com> wrote: > >> > > >> > Sorry for top posting (mobile...) > >> > I have verified with system design and the data sheet that every wilink > 6/7 > >> chip has a mac address in fuse so probably the board you have (pretty old, > >> right?) has this mac address in fuse. Maybe it was from very early > batches? > >> Anyway I see no reason to change it. > >> > Anyway the calibrator can be used to store a different one into the nvs > file > >> that will overide it. > >> > >> Well clearly at least this one does not have any valid hardware > >> mac address, the hardware mac address is broken with all zeroes. > >> > > > > Looks like it is not really all zeros but rather 00:00:00:00:00:01. > > I wonder if it is just a one board issue or not... > > It's 00:00:00:00:00:01 because your code adds 1 to it. > You are right of course! I saw it as well after sending my previous reply. Best Regards, Eyal
RE: [v6] wlcore: add missing nvs file name info for wilink8
> > On Thu, Aug 10, 2017 at 4:35 PM, Reizer, Eyal wrote: > >> > > >> > Sorry for top posting (mobile...) > >> > I have verified with system design and the data sheet that every wilink > 6/7 > >> chip has a mac address in fuse so probably the board you have (pretty old, > >> right?) has this mac address in fuse. Maybe it was from very early > batches? > >> Anyway I see no reason to change it. > >> > Anyway the calibrator can be used to store a different one into the nvs > file > >> that will overide it. > >> > >> Well clearly at least this one does not have any valid hardware > >> mac address, the hardware mac address is broken with all zeroes. > >> > > > > Looks like it is not really all zeros but rather 00:00:00:00:00:01. > > I wonder if it is just a one board issue or not... > > It's 00:00:00:00:00:01 because your code adds 1 to it. > You are right of course! I saw it as well after sending my previous reply. Best Regards, Eyal
RE: [v6] wlcore: add missing nvs file name info for wilink8
> > > > Sorry for top posting (mobile...) > > I have verified with system design and the data sheet that every wilink 6/7 > chip has a mac address in fuse so probably the board you have (pretty old, > right?) has this mac address in fuse. Maybe it was from very early batches? > Anyway I see no reason to change it. > > Anyway the calibrator can be used to store a different one into the nvs file > that will overide it. > > Well clearly at least this one does not have any valid hardware > mac address, the hardware mac address is broken with all zeroes. > Looks like it is not really all zeros but rather 00:00:00:00:00:01. I wonder if it is just a one board issue or not... > It seems that you can easily add a check for empty mac address, no? > And you already showed a version that falls back to a random mac > address. > Of course I can add a check for this but need to make sure it is not just one private case. Do you happen to have another omap3-evm and can check if this is a typical case For the wilink modules that were assembled on this EVM? I have not seen another module here that showed this issue and want to make Sure it is really a common issue before adding additional checks to the kernel. > The fact that is old does not change a thing, we still need to > support it no matter what the data sheet and your system design > says. A fix that breaks other things is not really a fix :) > Sure, just want to make sure we are not trying to add work around just for A couple of faulty devices. > > I have verified using a couple of com6 modules with an am335x-evm and > they had mac addresses read ok. > > Sounds like there are multiple variants of the wl12xx > available then. > I am trying to find out internally if there is a possibility that there were devices Produced in the past where the internal fuses were not programmed with a valid Address before being assembled into the modules. Best Regards, Eyal
RE: [v6] wlcore: add missing nvs file name info for wilink8
> > > > Sorry for top posting (mobile...) > > I have verified with system design and the data sheet that every wilink 6/7 > chip has a mac address in fuse so probably the board you have (pretty old, > right?) has this mac address in fuse. Maybe it was from very early batches? > Anyway I see no reason to change it. > > Anyway the calibrator can be used to store a different one into the nvs file > that will overide it. > > Well clearly at least this one does not have any valid hardware > mac address, the hardware mac address is broken with all zeroes. > Looks like it is not really all zeros but rather 00:00:00:00:00:01. I wonder if it is just a one board issue or not... > It seems that you can easily add a check for empty mac address, no? > And you already showed a version that falls back to a random mac > address. > Of course I can add a check for this but need to make sure it is not just one private case. Do you happen to have another omap3-evm and can check if this is a typical case For the wilink modules that were assembled on this EVM? I have not seen another module here that showed this issue and want to make Sure it is really a common issue before adding additional checks to the kernel. > The fact that is old does not change a thing, we still need to > support it no matter what the data sheet and your system design > says. A fix that breaks other things is not really a fix :) > Sure, just want to make sure we are not trying to add work around just for A couple of faulty devices. > > I have verified using a couple of com6 modules with an am335x-evm and > they had mac addresses read ok. > > Sounds like there are multiple variants of the wl12xx > available then. > I am trying to find out internally if there is a possibility that there were devices Produced in the past where the internal fuses were not programmed with a valid Address before being assembled into the modules. Best Regards, Eyal
[v6] wlcore: add missing nvs file name info for wilink8
The following commits: commit c815fdebef44 ("wlcore: spi: Populate config firmware data") commit d776fc86b82f ("wlcore: sdio: Populate config firmware data") Populated the nvs entry for wilink6 and wilink7 only while it is still needed for wilink8 as well for specifying an alternate mac address. This broke user space backward compatibility when upgrading from older kernels, as the alternate mac address would not be read from the nvs that is present in the file system (lib/firmware/ti-connectivity/wl1271-nvs.bin) causing mac address change of the wlan interface. This patch fix this and update the structure field with the same default nvs file name that has been used before. In addition, some distros hold a default wl1271-nvs.bin in the file system with a bogus mac address (deadbeef...) that overrides the mac address that is stored inside the device. Warn users about this bogus mac address and use the internal mac address Fixes: c815fdebef44 ("wlcore: spi: Populate config firmware data") Fixes: d776fc86b82f ("wlcore: sdio: Populate config firmware data") Cc:# 4.9+ Signed-off-by: Eyal Reizer --- v2->v3: add a check for default deadbeef... mac address and warn about it v3->v4: use a random TI mac address instead of the bogus one v4->v5: add constant definition for TI oui address v5->v6: after also verifying on wilink6/7 Use mac internal mac address instead of a random one --- drivers/net/wireless/ti/wlcore/main.c | 15 +++ drivers/net/wireless/ti/wlcore/sdio.c | 1 + drivers/net/wireless/ti/wlcore/spi.c | 1 + 3 files changed, 17 insertions(+) diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 60aaa85..dd1ac48 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c @@ -6040,6 +6040,21 @@ static int wl1271_register_hw(struct wl1271 *wl) nic_addr = wl->fuse_nic_addr + 1; } + if (oui_addr == 0xdeadbe && nic_addr == 0xef) { + wl1271_warning("Detected unconfigured mac address in nvs.\n" + "derive from fuse instead.\n" + "in case of using a wl12xx device, your " + "device performance may not be optimized.\n" + "Please use the calibrator tool to configure " + "your device.\n" + "When using a wl18xx device this default nvs " + "file can be removed from the file system\n"); + + oui_addr = wl->fuse_oui_addr; + /* fuse has the BD_ADDR, the WLAN addresses are the next two */ + nic_addr = wl->fuse_nic_addr + 1; + } + wl12xx_derive_mac_addresses(wl, oui_addr, nic_addr); ret = ieee80211_register_hw(wl->hw); diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index 2fb3871..f8a1fea 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c @@ -230,6 +230,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; static const struct of_device_id wlcore_sdio_of_match_table[] = { diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index fdabb92..62ce54a 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -92,6 +92,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; struct wl12xx_spi_glue { -- 2.7.4
[v6] wlcore: add missing nvs file name info for wilink8
The following commits: commit c815fdebef44 ("wlcore: spi: Populate config firmware data") commit d776fc86b82f ("wlcore: sdio: Populate config firmware data") Populated the nvs entry for wilink6 and wilink7 only while it is still needed for wilink8 as well for specifying an alternate mac address. This broke user space backward compatibility when upgrading from older kernels, as the alternate mac address would not be read from the nvs that is present in the file system (lib/firmware/ti-connectivity/wl1271-nvs.bin) causing mac address change of the wlan interface. This patch fix this and update the structure field with the same default nvs file name that has been used before. In addition, some distros hold a default wl1271-nvs.bin in the file system with a bogus mac address (deadbeef...) that overrides the mac address that is stored inside the device. Warn users about this bogus mac address and use the internal mac address Fixes: c815fdebef44 ("wlcore: spi: Populate config firmware data") Fixes: d776fc86b82f ("wlcore: sdio: Populate config firmware data") Cc: # 4.9+ Signed-off-by: Eyal Reizer --- v2->v3: add a check for default deadbeef... mac address and warn about it v3->v4: use a random TI mac address instead of the bogus one v4->v5: add constant definition for TI oui address v5->v6: after also verifying on wilink6/7 Use mac internal mac address instead of a random one --- drivers/net/wireless/ti/wlcore/main.c | 15 +++ drivers/net/wireless/ti/wlcore/sdio.c | 1 + drivers/net/wireless/ti/wlcore/spi.c | 1 + 3 files changed, 17 insertions(+) diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 60aaa85..dd1ac48 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c @@ -6040,6 +6040,21 @@ static int wl1271_register_hw(struct wl1271 *wl) nic_addr = wl->fuse_nic_addr + 1; } + if (oui_addr == 0xdeadbe && nic_addr == 0xef) { + wl1271_warning("Detected unconfigured mac address in nvs.\n" + "derive from fuse instead.\n" + "in case of using a wl12xx device, your " + "device performance may not be optimized.\n" + "Please use the calibrator tool to configure " + "your device.\n" + "When using a wl18xx device this default nvs " + "file can be removed from the file system\n"); + + oui_addr = wl->fuse_oui_addr; + /* fuse has the BD_ADDR, the WLAN addresses are the next two */ + nic_addr = wl->fuse_nic_addr + 1; + } + wl12xx_derive_mac_addresses(wl, oui_addr, nic_addr); ret = ieee80211_register_hw(wl->hw); diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index 2fb3871..f8a1fea 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c @@ -230,6 +230,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; static const struct of_device_id wlcore_sdio_of_match_table[] = { diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index fdabb92..62ce54a 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -92,6 +92,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; struct wl12xx_spi_glue { -- 2.7.4
RE: [v5] wlcore: add missing nvs file name info for wilink8
> > > Subject: Re: [v5] wlcore: add missing nvs file name info for wilink8 > > > > * Reizer, Eyal <ey...@ti.com> [170807 00:47]: > > > Hi Tony, > > > > > > > > * Reizer, Eyal <ey...@ti.com> [170807 00:32]: > > > > > The following commits: > > > > > c815fde wlcore: spi: Populate config firmware data > > > > > d776fc8 wlcore: sdio: Populate config firmware data > > > > > > > > > > Populated the nvs entry for wilink6 and wilink7 only while it is > > > > > still needed for wilink8 as well. > > > > > This broke user space backward compatibility when upgrading from > > older > > > > > kernels, as the alternate mac address would not be read from the nvs > > that > > > > is > > > > > present in the file system (lib/firmware/ti-connectivity/wl1271- > nvs.bin) > > > > > causing mac address change of the wlan interface. > > > > > > > > > > This patch fix this and update the structure field with the same > default > > > > > nvs file name that has been used before. > > > > > > > > > > In addition, some distros hold a default wl1271-nvs.bin in the file > > > > > system with a bogus mac address (deadbeef...) that for a wl18xx > device > > > > > also overrides the mac address that is stored inside the device. > > > > > Warn users about this bogus mac address and use a random mac > > instead > > > > > > > > Hmm looks pretty good to me except for one more thing I just noticed. > > > > > > > > Why don't you just use the hardware mac address instead of a random > > > > mac address on wl18xx device when you see a bogus nvs file? > > > > > > > > > > I agree that this would have been better but the problem is that > hardware > > > mac address is available for wilink8 onlyWilink6/7 don't have one stored. > > > The wlcore code responsible for handling mac address is common code > > > and there is method for detecting between them in this module. > > > > Care to clarify a bit.. Are you saying wilink8 will use the hardware > > mac address in case of bogus nvs file? > > > With present implementation it will not. It will use the random one for both > wilink6/7 as well as wilink8. > I need to get a hold of a wilink6/7 module and see if reverting to an internal > mac address is working. Will try to look around as it has been a while since > I used one. > Managed to test with a wilink6 module and in fact reading hardware mac Address from fuse is working ok for wilink6/7 as well. submitting v6 using this mac address instead of a random one when the bogus (deadbeef...) mac address is read from default nvs file. Best Regards, Eyal
RE: [v5] wlcore: add missing nvs file name info for wilink8
> > > Subject: Re: [v5] wlcore: add missing nvs file name info for wilink8 > > > > * Reizer, Eyal [170807 00:47]: > > > Hi Tony, > > > > > > > > * Reizer, Eyal [170807 00:32]: > > > > > The following commits: > > > > > c815fde wlcore: spi: Populate config firmware data > > > > > d776fc8 wlcore: sdio: Populate config firmware data > > > > > > > > > > Populated the nvs entry for wilink6 and wilink7 only while it is > > > > > still needed for wilink8 as well. > > > > > This broke user space backward compatibility when upgrading from > > older > > > > > kernels, as the alternate mac address would not be read from the nvs > > that > > > > is > > > > > present in the file system (lib/firmware/ti-connectivity/wl1271- > nvs.bin) > > > > > causing mac address change of the wlan interface. > > > > > > > > > > This patch fix this and update the structure field with the same > default > > > > > nvs file name that has been used before. > > > > > > > > > > In addition, some distros hold a default wl1271-nvs.bin in the file > > > > > system with a bogus mac address (deadbeef...) that for a wl18xx > device > > > > > also overrides the mac address that is stored inside the device. > > > > > Warn users about this bogus mac address and use a random mac > > instead > > > > > > > > Hmm looks pretty good to me except for one more thing I just noticed. > > > > > > > > Why don't you just use the hardware mac address instead of a random > > > > mac address on wl18xx device when you see a bogus nvs file? > > > > > > > > > > I agree that this would have been better but the problem is that > hardware > > > mac address is available for wilink8 onlyWilink6/7 don't have one stored. > > > The wlcore code responsible for handling mac address is common code > > > and there is method for detecting between them in this module. > > > > Care to clarify a bit.. Are you saying wilink8 will use the hardware > > mac address in case of bogus nvs file? > > > With present implementation it will not. It will use the random one for both > wilink6/7 as well as wilink8. > I need to get a hold of a wilink6/7 module and see if reverting to an internal > mac address is working. Will try to look around as it has been a while since > I used one. > Managed to test with a wilink6 module and in fact reading hardware mac Address from fuse is working ok for wilink6/7 as well. submitting v6 using this mac address instead of a random one when the bogus (deadbeef...) mac address is read from default nvs file. Best Regards, Eyal
RE: [v5] wlcore: add missing nvs file name info for wilink8
> Subject: Re: [v5] wlcore: add missing nvs file name info for wilink8 > > * Reizer, Eyal <ey...@ti.com> [170807 00:47]: > > Hi Tony, > > > > > > * Reizer, Eyal <ey...@ti.com> [170807 00:32]: > > > > The following commits: > > > > c815fde wlcore: spi: Populate config firmware data > > > > d776fc8 wlcore: sdio: Populate config firmware data > > > > > > > > Populated the nvs entry for wilink6 and wilink7 only while it is > > > > still needed for wilink8 as well. > > > > This broke user space backward compatibility when upgrading from > older > > > > kernels, as the alternate mac address would not be read from the nvs > that > > > is > > > > present in the file system (lib/firmware/ti-connectivity/wl1271-nvs.bin) > > > > causing mac address change of the wlan interface. > > > > > > > > This patch fix this and update the structure field with the same default > > > > nvs file name that has been used before. > > > > > > > > In addition, some distros hold a default wl1271-nvs.bin in the file > > > > system with a bogus mac address (deadbeef...) that for a wl18xx device > > > > also overrides the mac address that is stored inside the device. > > > > Warn users about this bogus mac address and use a random mac > instead > > > > > > Hmm looks pretty good to me except for one more thing I just noticed. > > > > > > Why don't you just use the hardware mac address instead of a random > > > mac address on wl18xx device when you see a bogus nvs file? > > > > > > > I agree that this would have been better but the problem is that hardware > > mac address is available for wilink8 onlyWilink6/7 don't have one stored. > > The wlcore code responsible for handling mac address is common code > > and there is method for detecting between them in this module. > > Care to clarify a bit.. Are you saying wilink8 will use the hardware > mac address in case of bogus nvs file? > With present implementation it will not. It will use the random one for both wilink6/7 as well as wilink8. I need to get a hold of a wilink6/7 module and see if reverting to an internal mac address is working. Will try to look around as it has been a while since I used one. Best Regards, Eyal
RE: [v5] wlcore: add missing nvs file name info for wilink8
> Subject: Re: [v5] wlcore: add missing nvs file name info for wilink8 > > * Reizer, Eyal [170807 00:47]: > > Hi Tony, > > > > > > * Reizer, Eyal [170807 00:32]: > > > > The following commits: > > > > c815fde wlcore: spi: Populate config firmware data > > > > d776fc8 wlcore: sdio: Populate config firmware data > > > > > > > > Populated the nvs entry for wilink6 and wilink7 only while it is > > > > still needed for wilink8 as well. > > > > This broke user space backward compatibility when upgrading from > older > > > > kernels, as the alternate mac address would not be read from the nvs > that > > > is > > > > present in the file system (lib/firmware/ti-connectivity/wl1271-nvs.bin) > > > > causing mac address change of the wlan interface. > > > > > > > > This patch fix this and update the structure field with the same default > > > > nvs file name that has been used before. > > > > > > > > In addition, some distros hold a default wl1271-nvs.bin in the file > > > > system with a bogus mac address (deadbeef...) that for a wl18xx device > > > > also overrides the mac address that is stored inside the device. > > > > Warn users about this bogus mac address and use a random mac > instead > > > > > > Hmm looks pretty good to me except for one more thing I just noticed. > > > > > > Why don't you just use the hardware mac address instead of a random > > > mac address on wl18xx device when you see a bogus nvs file? > > > > > > > I agree that this would have been better but the problem is that hardware > > mac address is available for wilink8 onlyWilink6/7 don't have one stored. > > The wlcore code responsible for handling mac address is common code > > and there is method for detecting between them in this module. > > Care to clarify a bit.. Are you saying wilink8 will use the hardware > mac address in case of bogus nvs file? > With present implementation it will not. It will use the random one for both wilink6/7 as well as wilink8. I need to get a hold of a wilink6/7 module and see if reverting to an internal mac address is working. Will try to look around as it has been a while since I used one. Best Regards, Eyal
RE: [v5] wlcore: add missing nvs file name info for wilink8
Hi Tony, > > * Reizer, Eyal <ey...@ti.com> [170807 00:32]: > > The following commits: > > c815fde wlcore: spi: Populate config firmware data > > d776fc8 wlcore: sdio: Populate config firmware data > > > > Populated the nvs entry for wilink6 and wilink7 only while it is > > still needed for wilink8 as well. > > This broke user space backward compatibility when upgrading from older > > kernels, as the alternate mac address would not be read from the nvs that > is > > present in the file system (lib/firmware/ti-connectivity/wl1271-nvs.bin) > > causing mac address change of the wlan interface. > > > > This patch fix this and update the structure field with the same default > > nvs file name that has been used before. > > > > In addition, some distros hold a default wl1271-nvs.bin in the file > > system with a bogus mac address (deadbeef...) that for a wl18xx device > > also overrides the mac address that is stored inside the device. > > Warn users about this bogus mac address and use a random mac instead > > Hmm looks pretty good to me except for one more thing I just noticed. > > Why don't you just use the hardware mac address instead of a random > mac address on wl18xx device when you see a bogus nvs file? > I agree that this would have been better but the problem is that hardware mac address is available for wilink8 onlyWilink6/7 don't have one stored. The wlcore code responsible for handling mac address is common code and there is method for detecting between them in this module. Best Regards, Eyal
RE: [v5] wlcore: add missing nvs file name info for wilink8
Hi Tony, > > * Reizer, Eyal [170807 00:32]: > > The following commits: > > c815fde wlcore: spi: Populate config firmware data > > d776fc8 wlcore: sdio: Populate config firmware data > > > > Populated the nvs entry for wilink6 and wilink7 only while it is > > still needed for wilink8 as well. > > This broke user space backward compatibility when upgrading from older > > kernels, as the alternate mac address would not be read from the nvs that > is > > present in the file system (lib/firmware/ti-connectivity/wl1271-nvs.bin) > > causing mac address change of the wlan interface. > > > > This patch fix this and update the structure field with the same default > > nvs file name that has been used before. > > > > In addition, some distros hold a default wl1271-nvs.bin in the file > > system with a bogus mac address (deadbeef...) that for a wl18xx device > > also overrides the mac address that is stored inside the device. > > Warn users about this bogus mac address and use a random mac instead > > Hmm looks pretty good to me except for one more thing I just noticed. > > Why don't you just use the hardware mac address instead of a random > mac address on wl18xx device when you see a bogus nvs file? > I agree that this would have been better but the problem is that hardware mac address is available for wilink8 onlyWilink6/7 don't have one stored. The wlcore code responsible for handling mac address is common code and there is method for detecting between them in this module. Best Regards, Eyal
RE: [v4] wlcore: add missing nvs file name info for wilink8
> -Original Message- > From: Julian Calaby [mailto:julian.cal...@gmail.com] > Sent: Saturday, August 5, 2017 8:51 AM > To: Reizer, Eyal > Cc: Kalle Valo; ,Tony Lindgren; linux-wirel...@vger.kernel.org; linux- > ker...@vger.kernel.org; sebastian.reic...@collabora.co.uk > Subject: Re: [v4] wlcore: add missing nvs file name info for wilink8 > > Hi Eyal, > > On Mon, Jul 31, 2017 at 6:45 PM, Reizer, Eyal <ey...@ti.com> wrote: > > The following commits: > > c815fde wlcore: spi: Populate config firmware data > > d776fc8 wlcore: sdio: Populate config firmware data > > > > Populated the nvs entry for wilink6 and wilink7 only while it is > > still needed for wilink8 as well. > > This broke user space backward compatibility when upgrading from older > > kernels, as the alternate mac address would not be read from the nvs that > > is present in the file system (lib/firmware/ti-connectivity/wl1271-nvs.bin) > > causing mac address change of the wlan interface. > > > > This patch fix this and update the structure field with the same default > > nvs file name that has been used before. > > > > In addition, some distros hold a default wl1271-nvs.bin in the file > > system with a bogus mac address (deadbeef...) that for a wl18xx device > > also overrides the mac address that is stored inside the device. > > Warn users about this bogus mac address and use a random mac instead > > > > Cc: stable <sta...@vger.kernel.org> > > Signed-off-by: Eyal Reizer <ey...@ti.com> > > --- > > > > diff --git a/drivers/net/wireless/ti/wlcore/main.c > b/drivers/net/wireless/ti/wlcore/main.c > > index 60aaa85..7ce4221 100644 > > --- a/drivers/net/wireless/ti/wlcore/main.c > > +++ b/drivers/net/wireless/ti/wlcore/main.c > > @@ -5961,6 +5961,22 @@ static void wl12xx_derive_mac_addresses(struct > wl1271 *wl, u32 oui, u32 nic) > > if (nic + WLCORE_NUM_MAC_ADDRESSES - wl->num_mac_addr > > 0xff) > > wl1271_warning("NIC part of the MAC address wraps around!"); > > > > + if (oui == 0xdeadbe && nic == 0xef) { > > + wl1271_warning("Detected unconfigured mac address in nvs.\n" > > + "Using a random TI mac address instead.\n" > > + "in case of using a wl12xx device, your " > > + "device performance may not be optimized.\n" > > + "Please use the calibrator tool to > > configure " > > + "your device.\n" > > + "When using a wl18xx device the nvs file > > can " > > + "be removed as a default mac address is " > > + "stored internally.\n"); > > + > > + /* Use TI oui and a random nic */ > > + oui = 0x080028; > > Is there (or should there be) a constant for this? Thanks for the comment. Submitting v5 fixing this. Best Regards, Eyal
RE: [v4] wlcore: add missing nvs file name info for wilink8
> -Original Message- > From: Julian Calaby [mailto:julian.cal...@gmail.com] > Sent: Saturday, August 5, 2017 8:51 AM > To: Reizer, Eyal > Cc: Kalle Valo; ,Tony Lindgren; linux-wirel...@vger.kernel.org; linux- > ker...@vger.kernel.org; sebastian.reic...@collabora.co.uk > Subject: Re: [v4] wlcore: add missing nvs file name info for wilink8 > > Hi Eyal, > > On Mon, Jul 31, 2017 at 6:45 PM, Reizer, Eyal wrote: > > The following commits: > > c815fde wlcore: spi: Populate config firmware data > > d776fc8 wlcore: sdio: Populate config firmware data > > > > Populated the nvs entry for wilink6 and wilink7 only while it is > > still needed for wilink8 as well. > > This broke user space backward compatibility when upgrading from older > > kernels, as the alternate mac address would not be read from the nvs that > > is present in the file system (lib/firmware/ti-connectivity/wl1271-nvs.bin) > > causing mac address change of the wlan interface. > > > > This patch fix this and update the structure field with the same default > > nvs file name that has been used before. > > > > In addition, some distros hold a default wl1271-nvs.bin in the file > > system with a bogus mac address (deadbeef...) that for a wl18xx device > > also overrides the mac address that is stored inside the device. > > Warn users about this bogus mac address and use a random mac instead > > > > Cc: stable > > Signed-off-by: Eyal Reizer > > --- > > > > diff --git a/drivers/net/wireless/ti/wlcore/main.c > b/drivers/net/wireless/ti/wlcore/main.c > > index 60aaa85..7ce4221 100644 > > --- a/drivers/net/wireless/ti/wlcore/main.c > > +++ b/drivers/net/wireless/ti/wlcore/main.c > > @@ -5961,6 +5961,22 @@ static void wl12xx_derive_mac_addresses(struct > wl1271 *wl, u32 oui, u32 nic) > > if (nic + WLCORE_NUM_MAC_ADDRESSES - wl->num_mac_addr > > 0xff) > > wl1271_warning("NIC part of the MAC address wraps around!"); > > > > + if (oui == 0xdeadbe && nic == 0xef) { > > + wl1271_warning("Detected unconfigured mac address in nvs.\n" > > + "Using a random TI mac address instead.\n" > > + "in case of using a wl12xx device, your " > > + "device performance may not be optimized.\n" > > + "Please use the calibrator tool to > > configure " > > + "your device.\n" > > + "When using a wl18xx device the nvs file > > can " > > + "be removed as a default mac address is " > > + "stored internally.\n"); > > + > > + /* Use TI oui and a random nic */ > > + oui = 0x080028; > > Is there (or should there be) a constant for this? Thanks for the comment. Submitting v5 fixing this. Best Regards, Eyal
[v5] wlcore: add missing nvs file name info for wilink8
The following commits: c815fde wlcore: spi: Populate config firmware data d776fc8 wlcore: sdio: Populate config firmware data Populated the nvs entry for wilink6 and wilink7 only while it is still needed for wilink8 as well. This broke user space backward compatibility when upgrading from older kernels, as the alternate mac address would not be read from the nvs that is present in the file system (lib/firmware/ti-connectivity/wl1271-nvs.bin) causing mac address change of the wlan interface. This patch fix this and update the structure field with the same default nvs file name that has been used before. In addition, some distros hold a default wl1271-nvs.bin in the file system with a bogus mac address (deadbeef...) that for a wl18xx device also overrides the mac address that is stored inside the device. Warn users about this bogus mac address and use a random mac instead Cc: stableSigned-off-by: Eyal Reizer --- v2->v3: add a check for default deadbeef... mac address and warn about it v3->v4: use a random TI mac address instead of the bogus one v4->v5: add constant definition for TI oui address --- drivers/net/wireless/ti/wlcore/main.c | 16 drivers/net/wireless/ti/wlcore/sdio.c | 1 + drivers/net/wireless/ti/wlcore/spi.c| 1 + drivers/net/wireless/ti/wlcore/wlcore.h | 3 +++ 4 files changed, 21 insertions(+) diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 60aaa85..257831a 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c @@ -5961,6 +5961,22 @@ static void wl12xx_derive_mac_addresses(struct wl1271 *wl, u32 oui, u32 nic) if (nic + WLCORE_NUM_MAC_ADDRESSES - wl->num_mac_addr > 0xff) wl1271_warning("NIC part of the MAC address wraps around!"); + if (oui == 0xdeadbe && nic == 0xef) { + wl1271_warning("Detected unconfigured mac address in nvs.\n" + "Using a random TI mac address instead.\n" + "in case of using a wl12xx device, your " + "device performance may not be optimized.\n" + "Please use the calibrator tool to configure " + "your device.\n" + "When using a wl18xx device the nvs file can " + "be removed as a default mac address is " + "stored internally.\n"); + + /* Use TI oui and a random nic */ + oui = WLCORE_TI_OUI_ADDRESS; + nic = get_random_int(); + } + for (i = 0; i < wl->num_mac_addr; i++) { wl->addresses[i].addr[0] = (u8)(oui >> 16); wl->addresses[i].addr[1] = (u8)(oui >> 8); diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index 2fb3871..f8a1fea 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c @@ -230,6 +230,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; static const struct of_device_id wlcore_sdio_of_match_table[] = { diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index fdabb92..62ce54a 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -92,6 +92,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; struct wl12xx_spi_glue { diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h b/drivers/net/wireless/ti/wlcore/wlcore.h index 1827546..95fbedc 100644 --- a/drivers/net/wireless/ti/wlcore/wlcore.h +++ b/drivers/net/wireless/ti/wlcore/wlcore.h @@ -40,6 +40,9 @@ /* wl12xx/wl18xx maximum transmission power (in dBm) */ #define WLCORE_MAX_TXPWR25 +/* Texas Instruments pre assigned OUI */ +#define WLCORE_TI_OUI_ADDRESS 0x080028 + /* forward declaration */ struct wl1271_tx_hw_descr; enum wl_rx_buf_align; -- 2.7.4
[v5] wlcore: add missing nvs file name info for wilink8
The following commits: c815fde wlcore: spi: Populate config firmware data d776fc8 wlcore: sdio: Populate config firmware data Populated the nvs entry for wilink6 and wilink7 only while it is still needed for wilink8 as well. This broke user space backward compatibility when upgrading from older kernels, as the alternate mac address would not be read from the nvs that is present in the file system (lib/firmware/ti-connectivity/wl1271-nvs.bin) causing mac address change of the wlan interface. This patch fix this and update the structure field with the same default nvs file name that has been used before. In addition, some distros hold a default wl1271-nvs.bin in the file system with a bogus mac address (deadbeef...) that for a wl18xx device also overrides the mac address that is stored inside the device. Warn users about this bogus mac address and use a random mac instead Cc: stable Signed-off-by: Eyal Reizer --- v2->v3: add a check for default deadbeef... mac address and warn about it v3->v4: use a random TI mac address instead of the bogus one v4->v5: add constant definition for TI oui address --- drivers/net/wireless/ti/wlcore/main.c | 16 drivers/net/wireless/ti/wlcore/sdio.c | 1 + drivers/net/wireless/ti/wlcore/spi.c| 1 + drivers/net/wireless/ti/wlcore/wlcore.h | 3 +++ 4 files changed, 21 insertions(+) diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 60aaa85..257831a 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c @@ -5961,6 +5961,22 @@ static void wl12xx_derive_mac_addresses(struct wl1271 *wl, u32 oui, u32 nic) if (nic + WLCORE_NUM_MAC_ADDRESSES - wl->num_mac_addr > 0xff) wl1271_warning("NIC part of the MAC address wraps around!"); + if (oui == 0xdeadbe && nic == 0xef) { + wl1271_warning("Detected unconfigured mac address in nvs.\n" + "Using a random TI mac address instead.\n" + "in case of using a wl12xx device, your " + "device performance may not be optimized.\n" + "Please use the calibrator tool to configure " + "your device.\n" + "When using a wl18xx device the nvs file can " + "be removed as a default mac address is " + "stored internally.\n"); + + /* Use TI oui and a random nic */ + oui = WLCORE_TI_OUI_ADDRESS; + nic = get_random_int(); + } + for (i = 0; i < wl->num_mac_addr; i++) { wl->addresses[i].addr[0] = (u8)(oui >> 16); wl->addresses[i].addr[1] = (u8)(oui >> 8); diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index 2fb3871..f8a1fea 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c @@ -230,6 +230,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; static const struct of_device_id wlcore_sdio_of_match_table[] = { diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index fdabb92..62ce54a 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -92,6 +92,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; struct wl12xx_spi_glue { diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h b/drivers/net/wireless/ti/wlcore/wlcore.h index 1827546..95fbedc 100644 --- a/drivers/net/wireless/ti/wlcore/wlcore.h +++ b/drivers/net/wireless/ti/wlcore/wlcore.h @@ -40,6 +40,9 @@ /* wl12xx/wl18xx maximum transmission power (in dBm) */ #define WLCORE_MAX_TXPWR25 +/* Texas Instruments pre assigned OUI */ +#define WLCORE_TI_OUI_ADDRESS 0x080028 + /* forward declaration */ struct wl1271_tx_hw_descr; enum wl_rx_buf_align; -- 2.7.4
[v4] wlcore: add missing nvs file name info for wilink8
The following commits: c815fde wlcore: spi: Populate config firmware data d776fc8 wlcore: sdio: Populate config firmware data Populated the nvs entry for wilink6 and wilink7 only while it is still needed for wilink8 as well. This broke user space backward compatibility when upgrading from older kernels, as the alternate mac address would not be read from the nvs that is present in the file system (lib/firmware/ti-connectivity/wl1271-nvs.bin) causing mac address change of the wlan interface. This patch fix this and update the structure field with the same default nvs file name that has been used before. In addition, some distros hold a default wl1271-nvs.bin in the file system with a bogus mac address (deadbeef...) that for a wl18xx device also overrides the mac address that is stored inside the device. Warn users about this bogus mac address and use a random mac instead Cc: stableSigned-off-by: Eyal Reizer --- v2->v3: add a check for default deadbeef... mac address and warn about it v3->v4: use a random TI mac address instead of the bogus one --- drivers/net/wireless/ti/wlcore/main.c | 16 drivers/net/wireless/ti/wlcore/sdio.c | 1 + drivers/net/wireless/ti/wlcore/spi.c | 1 + 3 files changed, 18 insertions(+) diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 60aaa85..7ce4221 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c @@ -5961,6 +5961,22 @@ static void wl12xx_derive_mac_addresses(struct wl1271 *wl, u32 oui, u32 nic) if (nic + WLCORE_NUM_MAC_ADDRESSES - wl->num_mac_addr > 0xff) wl1271_warning("NIC part of the MAC address wraps around!"); + if (oui == 0xdeadbe && nic == 0xef) { + wl1271_warning("Detected unconfigured mac address in nvs.\n" + "Using a random TI mac address instead.\n" + "in case of using a wl12xx device, your " + "device performance may not be optimized.\n" + "Please use the calibrator tool to configure " + "your device.\n" + "When using a wl18xx device the nvs file can " + "be removed as a default mac address is " + "stored internally.\n"); + + /* Use TI oui and a random nic */ + oui = 0x080028; + nic = get_random_int(); + } + for (i = 0; i < wl->num_mac_addr; i++) { wl->addresses[i].addr[0] = (u8)(oui >> 16); wl->addresses[i].addr[1] = (u8)(oui >> 8); diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index 2fb3871..f8a1fea 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c @@ -230,6 +230,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; static const struct of_device_id wlcore_sdio_of_match_table[] = { diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index fdabb92..62ce54a 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -92,6 +92,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; struct wl12xx_spi_glue { -- 2.7.4
[v4] wlcore: add missing nvs file name info for wilink8
The following commits: c815fde wlcore: spi: Populate config firmware data d776fc8 wlcore: sdio: Populate config firmware data Populated the nvs entry for wilink6 and wilink7 only while it is still needed for wilink8 as well. This broke user space backward compatibility when upgrading from older kernels, as the alternate mac address would not be read from the nvs that is present in the file system (lib/firmware/ti-connectivity/wl1271-nvs.bin) causing mac address change of the wlan interface. This patch fix this and update the structure field with the same default nvs file name that has been used before. In addition, some distros hold a default wl1271-nvs.bin in the file system with a bogus mac address (deadbeef...) that for a wl18xx device also overrides the mac address that is stored inside the device. Warn users about this bogus mac address and use a random mac instead Cc: stable Signed-off-by: Eyal Reizer --- v2->v3: add a check for default deadbeef... mac address and warn about it v3->v4: use a random TI mac address instead of the bogus one --- drivers/net/wireless/ti/wlcore/main.c | 16 drivers/net/wireless/ti/wlcore/sdio.c | 1 + drivers/net/wireless/ti/wlcore/spi.c | 1 + 3 files changed, 18 insertions(+) diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 60aaa85..7ce4221 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c @@ -5961,6 +5961,22 @@ static void wl12xx_derive_mac_addresses(struct wl1271 *wl, u32 oui, u32 nic) if (nic + WLCORE_NUM_MAC_ADDRESSES - wl->num_mac_addr > 0xff) wl1271_warning("NIC part of the MAC address wraps around!"); + if (oui == 0xdeadbe && nic == 0xef) { + wl1271_warning("Detected unconfigured mac address in nvs.\n" + "Using a random TI mac address instead.\n" + "in case of using a wl12xx device, your " + "device performance may not be optimized.\n" + "Please use the calibrator tool to configure " + "your device.\n" + "When using a wl18xx device the nvs file can " + "be removed as a default mac address is " + "stored internally.\n"); + + /* Use TI oui and a random nic */ + oui = 0x080028; + nic = get_random_int(); + } + for (i = 0; i < wl->num_mac_addr; i++) { wl->addresses[i].addr[0] = (u8)(oui >> 16); wl->addresses[i].addr[1] = (u8)(oui >> 8); diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index 2fb3871..f8a1fea 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c @@ -230,6 +230,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; static const struct of_device_id wlcore_sdio_of_match_table[] = { diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index fdabb92..62ce54a 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -92,6 +92,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; struct wl12xx_spi_glue { -- 2.7.4
RE: [v3] wlcore: add missing nvs file name info for wilink8
> -Original Message- > From: Tony Lindgren [mailto:t...@atomide.com] > Sent: Tuesday, July 25, 2017 1:22 PM > To: Reizer, Eyal > Cc: Kalle Valo; linux-wirel...@vger.kernel.org; linux-kernel@vger.kernel.org; > sebastian.reic...@collabora.co.uk > Subject: Re: [v3] wlcore: add missing nvs file name info for wilink8 > > * Reizer, Eyal <ey...@ti.com> [170720 05:17]: > > The following commits: > > c815fde wlcore: spi: Populate config firmware data > > d776fc8 wlcore: sdio: Populate config firmware data > > > > Populated the nvs entry for wilink6 and wilink7 only while it is > > still needed for wilink8 as well. > > This broke user space backward compatibility when upgrading from older > > kernels, as the alternate mac address would not be read from the nvs that is > > already present in the file system (lib/firmware/ti-connectivity/wl1271- > nvs.bin) > > causing mac address change of the wlan interface. > > > > This patch fix this and update the structure field with the same default nvs > file > > name that has been used before. > > > > In addition, some distros hold a default wl1271-nvs.bin in the file > > system with a bogus mac address (deadbeef...) that for a wl18xx device > > also overrides the mac address that is stored inside the device. > > Warn users about this bogus mac address. > > > > Cc: stable <sta...@vger.kernel.org> > > Signed-off-by: Eyal Reizer <ey...@ti.com> > > --- > > v2->v3: add a check for default deadbeef... mac address and warn about it > > > > drivers/net/wireless/ti/wlcore/main.c | 10 ++ > > drivers/net/wireless/ti/wlcore/sdio.c | 1 + > > drivers/net/wireless/ti/wlcore/spi.c | 1 + > > 3 files changed, 12 insertions(+) > > > > diff --git a/drivers/net/wireless/ti/wlcore/main.c > b/drivers/net/wireless/ti/wlcore/main.c > > index 60aaa85..37c35aa 100644 > > --- a/drivers/net/wireless/ti/wlcore/main.c > > +++ b/drivers/net/wireless/ti/wlcore/main.c > > @@ -5961,6 +5961,16 @@ static void wl12xx_derive_mac_addresses(struct > wl1271 *wl, u32 oui, u32 nic) > > if (nic + WLCORE_NUM_MAC_ADDRESSES - wl->num_mac_addr > > 0xff) > > wl1271_warning("NIC part of the MAC address wraps > around!"); > > > > + if (oui == 0xdeadbe && nic == 0xef) > > + wl1271_warning("Detected unconfigured mac address in > nvs.\n" > > + "in case of using a wl12xx device, your " > > + "device performance may not be optimized.\n" > > + "Please use the calibrator tool to configure " > > + "your device.\n" > > + "When using a wl18xx device the nvs file can " > > + "be removed as a default mac address is " > > + "stored internally.\n"); > > + > > for (i = 0; i < wl->num_mac_addr; i++) { > > wl->addresses[i].addr[0] = (u8)(oui >> 16); > > wl->addresses[i].addr[1] = (u8)(oui >> 8); > > Hmm so why would we ever even use this bogus nvs file? In addition to > warning, > I think we should just ignore the bogus nvs file completely. > While it looks bogus, it is still at least a valid mac address and the chip will function Using it. Wilink6/7 doesn't have a default mac address in hardware (wilink8 does have one) so we need to assign one for it so It can work, even if not optimally until configured using the calibrator tool and a unique mac address is assigned to it. Best Regards, Eyal
RE: [v3] wlcore: add missing nvs file name info for wilink8
> -Original Message- > From: Tony Lindgren [mailto:t...@atomide.com] > Sent: Tuesday, July 25, 2017 1:22 PM > To: Reizer, Eyal > Cc: Kalle Valo; linux-wirel...@vger.kernel.org; linux-kernel@vger.kernel.org; > sebastian.reic...@collabora.co.uk > Subject: Re: [v3] wlcore: add missing nvs file name info for wilink8 > > * Reizer, Eyal [170720 05:17]: > > The following commits: > > c815fde wlcore: spi: Populate config firmware data > > d776fc8 wlcore: sdio: Populate config firmware data > > > > Populated the nvs entry for wilink6 and wilink7 only while it is > > still needed for wilink8 as well. > > This broke user space backward compatibility when upgrading from older > > kernels, as the alternate mac address would not be read from the nvs that is > > already present in the file system (lib/firmware/ti-connectivity/wl1271- > nvs.bin) > > causing mac address change of the wlan interface. > > > > This patch fix this and update the structure field with the same default nvs > file > > name that has been used before. > > > > In addition, some distros hold a default wl1271-nvs.bin in the file > > system with a bogus mac address (deadbeef...) that for a wl18xx device > > also overrides the mac address that is stored inside the device. > > Warn users about this bogus mac address. > > > > Cc: stable > > Signed-off-by: Eyal Reizer > > --- > > v2->v3: add a check for default deadbeef... mac address and warn about it > > > > drivers/net/wireless/ti/wlcore/main.c | 10 ++ > > drivers/net/wireless/ti/wlcore/sdio.c | 1 + > > drivers/net/wireless/ti/wlcore/spi.c | 1 + > > 3 files changed, 12 insertions(+) > > > > diff --git a/drivers/net/wireless/ti/wlcore/main.c > b/drivers/net/wireless/ti/wlcore/main.c > > index 60aaa85..37c35aa 100644 > > --- a/drivers/net/wireless/ti/wlcore/main.c > > +++ b/drivers/net/wireless/ti/wlcore/main.c > > @@ -5961,6 +5961,16 @@ static void wl12xx_derive_mac_addresses(struct > wl1271 *wl, u32 oui, u32 nic) > > if (nic + WLCORE_NUM_MAC_ADDRESSES - wl->num_mac_addr > > 0xff) > > wl1271_warning("NIC part of the MAC address wraps > around!"); > > > > + if (oui == 0xdeadbe && nic == 0xef) > > + wl1271_warning("Detected unconfigured mac address in > nvs.\n" > > + "in case of using a wl12xx device, your " > > + "device performance may not be optimized.\n" > > + "Please use the calibrator tool to configure " > > + "your device.\n" > > + "When using a wl18xx device the nvs file can " > > + "be removed as a default mac address is " > > + "stored internally.\n"); > > + > > for (i = 0; i < wl->num_mac_addr; i++) { > > wl->addresses[i].addr[0] = (u8)(oui >> 16); > > wl->addresses[i].addr[1] = (u8)(oui >> 8); > > Hmm so why would we ever even use this bogus nvs file? In addition to > warning, > I think we should just ignore the bogus nvs file completely. > While it looks bogus, it is still at least a valid mac address and the chip will function Using it. Wilink6/7 doesn't have a default mac address in hardware (wilink8 does have one) so we need to assign one for it so It can work, even if not optimally until configured using the calibrator tool and a unique mac address is assigned to it. Best Regards, Eyal
RE: [v3] wl18xx: add missing nvs file name info for wilink8
Please ignore this patch. Wrong header. Submitted the correct one instead: https://patchwork.kernel.org/patch/9854809/ > -Original Message- > From: Reizer, Eyal > Sent: Thursday, July 20, 2017 3:13 PM > To: 'Kalle Valo'; ',Tony Lindgren'; 'linux-wirel...@vger.kernel.org'; 'linux- > ker...@vger.kernel.org' > Cc: 'sebastian.reic...@collabora.co.uk' > Subject: [v3] wl18xx: add missing nvs file name info for wilink8 > > The following commits: > c815fde wlcore: spi: Populate config firmware data > d776fc8 wlcore: sdio: Populate config firmware data > > Populated the nvs entry for wilink6 and wilink7 only while it is > still needed for wilink8 as well. > This broke user space backward compatibility when upgrading from older > kernels, as the alternate mac address would not be read from the nvs that is > already present in the file system > (lib/firmware/ti-connectivity/wl1271-nvs.bin) > causing mac address change of the wlan interface. > > This patch fix this and update the structure field with the same default nvs > file > name that has been used before. > > In addition, some distros hold a default wl1271-nvs.bin in the file > system with a bogus mac address (deadbeef...) that for a wl18xx device > also overrides the mac address that is stored inside the device. > Warn users about this bogus mac address. > > Cc: stable <sta...@vger.kernel.org> > Signed-off-by: Eyal Reizer <ey...@ti.com> > --- > v2->v3: add a check for default deadbeef... mac address and warn about it > > drivers/net/wireless/ti/wlcore/main.c | 10 ++ > drivers/net/wireless/ti/wlcore/sdio.c | 1 + > drivers/net/wireless/ti/wlcore/spi.c | 1 + > 3 files changed, 12 insertions(+) > > diff --git a/drivers/net/wireless/ti/wlcore/main.c > b/drivers/net/wireless/ti/wlcore/main.c > index 60aaa85..37c35aa 100644 > --- a/drivers/net/wireless/ti/wlcore/main.c > +++ b/drivers/net/wireless/ti/wlcore/main.c > @@ -5961,6 +5961,16 @@ static void wl12xx_derive_mac_addresses(struct > wl1271 *wl, u32 oui, u32 nic) > if (nic + WLCORE_NUM_MAC_ADDRESSES - wl->num_mac_addr > > 0xff) > wl1271_warning("NIC part of the MAC address wraps > around!"); > > + if (oui == 0xdeadbe && nic == 0xef) > + wl1271_warning("Detected unconfigured mac address in > nvs.\n" > + "in case of using a wl12xx device, your " > + "device performance may not be optimized.\n" > + "Please use the calibrator tool to configure " > + "your device.\n" > + "When using a wl18xx device the nvs file can " > + "be removed as a default mac address is " > + "stored internally.\n"); > + > for (i = 0; i < wl->num_mac_addr; i++) { > wl->addresses[i].addr[0] = (u8)(oui >> 16); > wl->addresses[i].addr[1] = (u8)(oui >> 8); > diff --git a/drivers/net/wireless/ti/wlcore/sdio.c > b/drivers/net/wireless/ti/wlcore/sdio.c > index 2fb3871..f8a1fea 100644 > --- a/drivers/net/wireless/ti/wlcore/sdio.c > +++ b/drivers/net/wireless/ti/wlcore/sdio.c > @@ -230,6 +230,7 @@ static const struct wilink_family_data wl128x_data = { > static const struct wilink_family_data wl18xx_data = { > .name = "wl18xx", > .cfg_name = "ti-connectivity/wl18xx-conf.bin", > + .nvs_name = "ti-connectivity/wl1271-nvs.bin", > }; > > static const struct of_device_id wlcore_sdio_of_match_table[] = { > diff --git a/drivers/net/wireless/ti/wlcore/spi.c > b/drivers/net/wireless/ti/wlcore/spi.c > index fdabb92..62ce54a 100644 > --- a/drivers/net/wireless/ti/wlcore/spi.c > +++ b/drivers/net/wireless/ti/wlcore/spi.c > @@ -92,6 +92,7 @@ static const struct wilink_family_data wl128x_data = { > static const struct wilink_family_data wl18xx_data = { > .name = "wl18xx", > .cfg_name = "ti-connectivity/wl18xx-conf.bin", > + .nvs_name = "ti-connectivity/wl1271-nvs.bin", > }; > > struct wl12xx_spi_glue { > -- > 2.7.4 Best Regards, Eyal
RE: [v3] wl18xx: add missing nvs file name info for wilink8
Please ignore this patch. Wrong header. Submitted the correct one instead: https://patchwork.kernel.org/patch/9854809/ > -Original Message- > From: Reizer, Eyal > Sent: Thursday, July 20, 2017 3:13 PM > To: 'Kalle Valo'; ',Tony Lindgren'; 'linux-wirel...@vger.kernel.org'; 'linux- > ker...@vger.kernel.org' > Cc: 'sebastian.reic...@collabora.co.uk' > Subject: [v3] wl18xx: add missing nvs file name info for wilink8 > > The following commits: > c815fde wlcore: spi: Populate config firmware data > d776fc8 wlcore: sdio: Populate config firmware data > > Populated the nvs entry for wilink6 and wilink7 only while it is > still needed for wilink8 as well. > This broke user space backward compatibility when upgrading from older > kernels, as the alternate mac address would not be read from the nvs that is > already present in the file system > (lib/firmware/ti-connectivity/wl1271-nvs.bin) > causing mac address change of the wlan interface. > > This patch fix this and update the structure field with the same default nvs > file > name that has been used before. > > In addition, some distros hold a default wl1271-nvs.bin in the file > system with a bogus mac address (deadbeef...) that for a wl18xx device > also overrides the mac address that is stored inside the device. > Warn users about this bogus mac address. > > Cc: stable > Signed-off-by: Eyal Reizer > --- > v2->v3: add a check for default deadbeef... mac address and warn about it > > drivers/net/wireless/ti/wlcore/main.c | 10 ++ > drivers/net/wireless/ti/wlcore/sdio.c | 1 + > drivers/net/wireless/ti/wlcore/spi.c | 1 + > 3 files changed, 12 insertions(+) > > diff --git a/drivers/net/wireless/ti/wlcore/main.c > b/drivers/net/wireless/ti/wlcore/main.c > index 60aaa85..37c35aa 100644 > --- a/drivers/net/wireless/ti/wlcore/main.c > +++ b/drivers/net/wireless/ti/wlcore/main.c > @@ -5961,6 +5961,16 @@ static void wl12xx_derive_mac_addresses(struct > wl1271 *wl, u32 oui, u32 nic) > if (nic + WLCORE_NUM_MAC_ADDRESSES - wl->num_mac_addr > > 0xff) > wl1271_warning("NIC part of the MAC address wraps > around!"); > > + if (oui == 0xdeadbe && nic == 0xef) > + wl1271_warning("Detected unconfigured mac address in > nvs.\n" > + "in case of using a wl12xx device, your " > + "device performance may not be optimized.\n" > + "Please use the calibrator tool to configure " > + "your device.\n" > + "When using a wl18xx device the nvs file can " > + "be removed as a default mac address is " > + "stored internally.\n"); > + > for (i = 0; i < wl->num_mac_addr; i++) { > wl->addresses[i].addr[0] = (u8)(oui >> 16); > wl->addresses[i].addr[1] = (u8)(oui >> 8); > diff --git a/drivers/net/wireless/ti/wlcore/sdio.c > b/drivers/net/wireless/ti/wlcore/sdio.c > index 2fb3871..f8a1fea 100644 > --- a/drivers/net/wireless/ti/wlcore/sdio.c > +++ b/drivers/net/wireless/ti/wlcore/sdio.c > @@ -230,6 +230,7 @@ static const struct wilink_family_data wl128x_data = { > static const struct wilink_family_data wl18xx_data = { > .name = "wl18xx", > .cfg_name = "ti-connectivity/wl18xx-conf.bin", > + .nvs_name = "ti-connectivity/wl1271-nvs.bin", > }; > > static const struct of_device_id wlcore_sdio_of_match_table[] = { > diff --git a/drivers/net/wireless/ti/wlcore/spi.c > b/drivers/net/wireless/ti/wlcore/spi.c > index fdabb92..62ce54a 100644 > --- a/drivers/net/wireless/ti/wlcore/spi.c > +++ b/drivers/net/wireless/ti/wlcore/spi.c > @@ -92,6 +92,7 @@ static const struct wilink_family_data wl128x_data = { > static const struct wilink_family_data wl18xx_data = { > .name = "wl18xx", > .cfg_name = "ti-connectivity/wl18xx-conf.bin", > + .nvs_name = "ti-connectivity/wl1271-nvs.bin", > }; > > struct wl12xx_spi_glue { > -- > 2.7.4 Best Regards, Eyal
RE: [v3] wl18xx: add missing nvs file name info for wilink8
> The following commits: > c815fde wlcore: spi: Populate config firmware data > d776fc8 wlcore: sdio: Populate config firmware data > > Populated the nvs entry for wilink6 and wilink7 only while it is > still needed for wilink8 as well. > This broke user space backward compatibility when upgrading from older > kernels, as the alternate mac address would not be read from the nvs that is > already present in the file system > (lib/firmware/ti-connectivity/wl1271-nvs.bin) > causing mac address change of the wlan interface. > > This patch fix this and update the structure field with the same default nvs > file > name that has been used before. > > In addition, some distros hold a default wl1271-nvs.bin in the file > system with a bogus mac address (deadbeef...) that for a wl18xx device > also overrides the mac address that is stored inside the device. > Warn users about this bogus mac address. > > Cc: stable> Signed-off-by: Eyal Reizer > --- > v2->v3: add a check for default deadbeef... mac address and warn about it > > drivers/net/wireless/ti/wlcore/main.c | 10 ++ > drivers/net/wireless/ti/wlcore/sdio.c | 1 + > drivers/net/wireless/ti/wlcore/spi.c | 1 + > 3 files changed, 12 insertions(+) > > diff --git a/drivers/net/wireless/ti/wlcore/main.c > b/drivers/net/wireless/ti/wlcore/main.c > index 60aaa85..37c35aa 100644 > --- a/drivers/net/wireless/ti/wlcore/main.c > +++ b/drivers/net/wireless/ti/wlcore/main.c > @@ -5961,6 +5961,16 @@ static void wl12xx_derive_mac_addresses(struct > wl1271 *wl, u32 oui, u32 nic) > if (nic + WLCORE_NUM_MAC_ADDRESSES - wl->num_mac_addr > > 0xff) > wl1271_warning("NIC part of the MAC address wraps > around!"); > > + if (oui == 0xdeadbe && nic == 0xef) > + wl1271_warning("Detected unconfigured mac address in > nvs.\n" > + "in case of using a wl12xx device, your " > + "device performance may not be optimized.\n" > + "Please use the calibrator tool to configure " > + "your device.\n" > + "When using a wl18xx device the nvs file can " > + "be removed as a default mac address is " > + "stored internally.\n"); > + > for (i = 0; i < wl->num_mac_addr; i++) { > wl->addresses[i].addr[0] = (u8)(oui >> 16); > wl->addresses[i].addr[1] = (u8)(oui >> 8); > diff --git a/drivers/net/wireless/ti/wlcore/sdio.c > b/drivers/net/wireless/ti/wlcore/sdio.c > index 2fb3871..f8a1fea 100644 > --- a/drivers/net/wireless/ti/wlcore/sdio.c > +++ b/drivers/net/wireless/ti/wlcore/sdio.c > @@ -230,6 +230,7 @@ static const struct wilink_family_data wl128x_data = { > static const struct wilink_family_data wl18xx_data = { > .name = "wl18xx", > .cfg_name = "ti-connectivity/wl18xx-conf.bin", > + .nvs_name = "ti-connectivity/wl1271-nvs.bin", > }; > > static const struct of_device_id wlcore_sdio_of_match_table[] = { > diff --git a/drivers/net/wireless/ti/wlcore/spi.c > b/drivers/net/wireless/ti/wlcore/spi.c > index fdabb92..62ce54a 100644 > --- a/drivers/net/wireless/ti/wlcore/spi.c > +++ b/drivers/net/wireless/ti/wlcore/spi.c > @@ -92,6 +92,7 @@ static const struct wilink_family_data wl128x_data = { > static const struct wilink_family_data wl18xx_data = { > .name = "wl18xx", > .cfg_name = "ti-connectivity/wl18xx-conf.bin", > + .nvs_name = "ti-connectivity/wl1271-nvs.bin", > }; > > struct wl12xx_spi_glue { > -- > 2.7.4 Please ignore. Wrong patch name. Best Regards, Eyal Reizer
RE: [v3] wl18xx: add missing nvs file name info for wilink8
> The following commits: > c815fde wlcore: spi: Populate config firmware data > d776fc8 wlcore: sdio: Populate config firmware data > > Populated the nvs entry for wilink6 and wilink7 only while it is > still needed for wilink8 as well. > This broke user space backward compatibility when upgrading from older > kernels, as the alternate mac address would not be read from the nvs that is > already present in the file system > (lib/firmware/ti-connectivity/wl1271-nvs.bin) > causing mac address change of the wlan interface. > > This patch fix this and update the structure field with the same default nvs > file > name that has been used before. > > In addition, some distros hold a default wl1271-nvs.bin in the file > system with a bogus mac address (deadbeef...) that for a wl18xx device > also overrides the mac address that is stored inside the device. > Warn users about this bogus mac address. > > Cc: stable > Signed-off-by: Eyal Reizer > --- > v2->v3: add a check for default deadbeef... mac address and warn about it > > drivers/net/wireless/ti/wlcore/main.c | 10 ++ > drivers/net/wireless/ti/wlcore/sdio.c | 1 + > drivers/net/wireless/ti/wlcore/spi.c | 1 + > 3 files changed, 12 insertions(+) > > diff --git a/drivers/net/wireless/ti/wlcore/main.c > b/drivers/net/wireless/ti/wlcore/main.c > index 60aaa85..37c35aa 100644 > --- a/drivers/net/wireless/ti/wlcore/main.c > +++ b/drivers/net/wireless/ti/wlcore/main.c > @@ -5961,6 +5961,16 @@ static void wl12xx_derive_mac_addresses(struct > wl1271 *wl, u32 oui, u32 nic) > if (nic + WLCORE_NUM_MAC_ADDRESSES - wl->num_mac_addr > > 0xff) > wl1271_warning("NIC part of the MAC address wraps > around!"); > > + if (oui == 0xdeadbe && nic == 0xef) > + wl1271_warning("Detected unconfigured mac address in > nvs.\n" > + "in case of using a wl12xx device, your " > + "device performance may not be optimized.\n" > + "Please use the calibrator tool to configure " > + "your device.\n" > + "When using a wl18xx device the nvs file can " > + "be removed as a default mac address is " > + "stored internally.\n"); > + > for (i = 0; i < wl->num_mac_addr; i++) { > wl->addresses[i].addr[0] = (u8)(oui >> 16); > wl->addresses[i].addr[1] = (u8)(oui >> 8); > diff --git a/drivers/net/wireless/ti/wlcore/sdio.c > b/drivers/net/wireless/ti/wlcore/sdio.c > index 2fb3871..f8a1fea 100644 > --- a/drivers/net/wireless/ti/wlcore/sdio.c > +++ b/drivers/net/wireless/ti/wlcore/sdio.c > @@ -230,6 +230,7 @@ static const struct wilink_family_data wl128x_data = { > static const struct wilink_family_data wl18xx_data = { > .name = "wl18xx", > .cfg_name = "ti-connectivity/wl18xx-conf.bin", > + .nvs_name = "ti-connectivity/wl1271-nvs.bin", > }; > > static const struct of_device_id wlcore_sdio_of_match_table[] = { > diff --git a/drivers/net/wireless/ti/wlcore/spi.c > b/drivers/net/wireless/ti/wlcore/spi.c > index fdabb92..62ce54a 100644 > --- a/drivers/net/wireless/ti/wlcore/spi.c > +++ b/drivers/net/wireless/ti/wlcore/spi.c > @@ -92,6 +92,7 @@ static const struct wilink_family_data wl128x_data = { > static const struct wilink_family_data wl18xx_data = { > .name = "wl18xx", > .cfg_name = "ti-connectivity/wl18xx-conf.bin", > + .nvs_name = "ti-connectivity/wl1271-nvs.bin", > }; > > struct wl12xx_spi_glue { > -- > 2.7.4 Please ignore. Wrong patch name. Best Regards, Eyal Reizer
[v3] wl18xx: add missing nvs file name info for wilink8
The following commits: c815fde wlcore: spi: Populate config firmware data d776fc8 wlcore: sdio: Populate config firmware data Populated the nvs entry for wilink6 and wilink7 only while it is still needed for wilink8 as well. This broke user space backward compatibility when upgrading from older kernels, as the alternate mac address would not be read from the nvs that is already present in the file system (lib/firmware/ti-connectivity/wl1271-nvs.bin) causing mac address change of the wlan interface. This patch fix this and update the structure field with the same default nvs file name that has been used before. In addition, some distros hold a default wl1271-nvs.bin in the file system with a bogus mac address (deadbeef...) that for a wl18xx device also overrides the mac address that is stored inside the device. Warn users about this bogus mac address. Cc: stableSigned-off-by: Eyal Reizer --- v2->v3: add a check for default deadbeef... mac address and warn about it drivers/net/wireless/ti/wlcore/main.c | 10 ++ drivers/net/wireless/ti/wlcore/sdio.c | 1 + drivers/net/wireless/ti/wlcore/spi.c | 1 + 3 files changed, 12 insertions(+) diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 60aaa85..37c35aa 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c @@ -5961,6 +5961,16 @@ static void wl12xx_derive_mac_addresses(struct wl1271 *wl, u32 oui, u32 nic) if (nic + WLCORE_NUM_MAC_ADDRESSES - wl->num_mac_addr > 0xff) wl1271_warning("NIC part of the MAC address wraps around!"); + if (oui == 0xdeadbe && nic == 0xef) + wl1271_warning("Detected unconfigured mac address in nvs.\n" + "in case of using a wl12xx device, your " + "device performance may not be optimized.\n" + "Please use the calibrator tool to configure " + "your device.\n" + "When using a wl18xx device the nvs file can " + "be removed as a default mac address is " + "stored internally.\n"); + for (i = 0; i < wl->num_mac_addr; i++) { wl->addresses[i].addr[0] = (u8)(oui >> 16); wl->addresses[i].addr[1] = (u8)(oui >> 8); diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index 2fb3871..f8a1fea 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c @@ -230,6 +230,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; static const struct of_device_id wlcore_sdio_of_match_table[] = { diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index fdabb92..62ce54a 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -92,6 +92,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; struct wl12xx_spi_glue { -- 2.7.4
[v3] wl18xx: add missing nvs file name info for wilink8
The following commits: c815fde wlcore: spi: Populate config firmware data d776fc8 wlcore: sdio: Populate config firmware data Populated the nvs entry for wilink6 and wilink7 only while it is still needed for wilink8 as well. This broke user space backward compatibility when upgrading from older kernels, as the alternate mac address would not be read from the nvs that is already present in the file system (lib/firmware/ti-connectivity/wl1271-nvs.bin) causing mac address change of the wlan interface. This patch fix this and update the structure field with the same default nvs file name that has been used before. In addition, some distros hold a default wl1271-nvs.bin in the file system with a bogus mac address (deadbeef...) that for a wl18xx device also overrides the mac address that is stored inside the device. Warn users about this bogus mac address. Cc: stable Signed-off-by: Eyal Reizer --- v2->v3: add a check for default deadbeef... mac address and warn about it drivers/net/wireless/ti/wlcore/main.c | 10 ++ drivers/net/wireless/ti/wlcore/sdio.c | 1 + drivers/net/wireless/ti/wlcore/spi.c | 1 + 3 files changed, 12 insertions(+) diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 60aaa85..37c35aa 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c @@ -5961,6 +5961,16 @@ static void wl12xx_derive_mac_addresses(struct wl1271 *wl, u32 oui, u32 nic) if (nic + WLCORE_NUM_MAC_ADDRESSES - wl->num_mac_addr > 0xff) wl1271_warning("NIC part of the MAC address wraps around!"); + if (oui == 0xdeadbe && nic == 0xef) + wl1271_warning("Detected unconfigured mac address in nvs.\n" + "in case of using a wl12xx device, your " + "device performance may not be optimized.\n" + "Please use the calibrator tool to configure " + "your device.\n" + "When using a wl18xx device the nvs file can " + "be removed as a default mac address is " + "stored internally.\n"); + for (i = 0; i < wl->num_mac_addr; i++) { wl->addresses[i].addr[0] = (u8)(oui >> 16); wl->addresses[i].addr[1] = (u8)(oui >> 8); diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index 2fb3871..f8a1fea 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c @@ -230,6 +230,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; static const struct of_device_id wlcore_sdio_of_match_table[] = { diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index fdabb92..62ce54a 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -92,6 +92,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; struct wl12xx_spi_glue { -- 2.7.4
[v3] wlcore: add missing nvs file name info for wilink8
The following commits: c815fde wlcore: spi: Populate config firmware data d776fc8 wlcore: sdio: Populate config firmware data Populated the nvs entry for wilink6 and wilink7 only while it is still needed for wilink8 as well. This broke user space backward compatibility when upgrading from older kernels, as the alternate mac address would not be read from the nvs that is already present in the file system (lib/firmware/ti-connectivity/wl1271-nvs.bin) causing mac address change of the wlan interface. This patch fix this and update the structure field with the same default nvs file name that has been used before. In addition, some distros hold a default wl1271-nvs.bin in the file system with a bogus mac address (deadbeef...) that for a wl18xx device also overrides the mac address that is stored inside the device. Warn users about this bogus mac address. Cc: stableSigned-off-by: Eyal Reizer --- v2->v3: add a check for default deadbeef... mac address and warn about it drivers/net/wireless/ti/wlcore/main.c | 10 ++ drivers/net/wireless/ti/wlcore/sdio.c | 1 + drivers/net/wireless/ti/wlcore/spi.c | 1 + 3 files changed, 12 insertions(+) diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 60aaa85..37c35aa 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c @@ -5961,6 +5961,16 @@ static void wl12xx_derive_mac_addresses(struct wl1271 *wl, u32 oui, u32 nic) if (nic + WLCORE_NUM_MAC_ADDRESSES - wl->num_mac_addr > 0xff) wl1271_warning("NIC part of the MAC address wraps around!"); + if (oui == 0xdeadbe && nic == 0xef) + wl1271_warning("Detected unconfigured mac address in nvs.\n" + "in case of using a wl12xx device, your " + "device performance may not be optimized.\n" + "Please use the calibrator tool to configure " + "your device.\n" + "When using a wl18xx device the nvs file can " + "be removed as a default mac address is " + "stored internally.\n"); + for (i = 0; i < wl->num_mac_addr; i++) { wl->addresses[i].addr[0] = (u8)(oui >> 16); wl->addresses[i].addr[1] = (u8)(oui >> 8); diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index 2fb3871..f8a1fea 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c @@ -230,6 +230,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; static const struct of_device_id wlcore_sdio_of_match_table[] = { diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index fdabb92..62ce54a 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -92,6 +92,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; struct wl12xx_spi_glue { -- 2.7.4
[v3] wlcore: add missing nvs file name info for wilink8
The following commits: c815fde wlcore: spi: Populate config firmware data d776fc8 wlcore: sdio: Populate config firmware data Populated the nvs entry for wilink6 and wilink7 only while it is still needed for wilink8 as well. This broke user space backward compatibility when upgrading from older kernels, as the alternate mac address would not be read from the nvs that is already present in the file system (lib/firmware/ti-connectivity/wl1271-nvs.bin) causing mac address change of the wlan interface. This patch fix this and update the structure field with the same default nvs file name that has been used before. In addition, some distros hold a default wl1271-nvs.bin in the file system with a bogus mac address (deadbeef...) that for a wl18xx device also overrides the mac address that is stored inside the device. Warn users about this bogus mac address. Cc: stable Signed-off-by: Eyal Reizer --- v2->v3: add a check for default deadbeef... mac address and warn about it drivers/net/wireless/ti/wlcore/main.c | 10 ++ drivers/net/wireless/ti/wlcore/sdio.c | 1 + drivers/net/wireless/ti/wlcore/spi.c | 1 + 3 files changed, 12 insertions(+) diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 60aaa85..37c35aa 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c @@ -5961,6 +5961,16 @@ static void wl12xx_derive_mac_addresses(struct wl1271 *wl, u32 oui, u32 nic) if (nic + WLCORE_NUM_MAC_ADDRESSES - wl->num_mac_addr > 0xff) wl1271_warning("NIC part of the MAC address wraps around!"); + if (oui == 0xdeadbe && nic == 0xef) + wl1271_warning("Detected unconfigured mac address in nvs.\n" + "in case of using a wl12xx device, your " + "device performance may not be optimized.\n" + "Please use the calibrator tool to configure " + "your device.\n" + "When using a wl18xx device the nvs file can " + "be removed as a default mac address is " + "stored internally.\n"); + for (i = 0; i < wl->num_mac_addr; i++) { wl->addresses[i].addr[0] = (u8)(oui >> 16); wl->addresses[i].addr[1] = (u8)(oui >> 8); diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index 2fb3871..f8a1fea 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c @@ -230,6 +230,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; static const struct of_device_id wlcore_sdio_of_match_table[] = { diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index fdabb92..62ce54a 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -92,6 +92,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; struct wl12xx_spi_glue { -- 2.7.4
RE: [PATCH] wlcore: add missing nvs file name info for wilink8
> > > > On Wed, Jul 05, 2017 at 01:06:54AM -0700, Tony Lindgren wrote: > > > > > Not sure if this really is a regression as we've always had a bogus > > > > > wl1271-nvs.bin in linux-firmware.git. Sure would be nice to fix it, > > > > > but going back to using a generic wl1271-nvs.bin sure does not seem > > > > > like a good long term fix to me :) > > > > A lot of legacy here... > > > > Wl1271-nvs has been used mainly with wilink6/7 and indeed was device > specific > > > > Holding calibration info etc. > > > > When they started with wilink8 the device specific configuration that > > > > was > > > > Part of it has switched to wl18xx-conf.bin and using the wlaconf tool > > > > for > setting it. > > > > Also there is no calibration specific info per device with wilink8 so > > > > the > wl18xx-conf.bin > > > > The only thing left in wl1271-nvs.bin for wilink8 was the mac address > override. > > > > > > And the default wl1271-nvs.bin sets the mac address to a bogus deadbeef > address, > > > so it's wrong to use and totally broken for distros :( > > > > So use something like the following pseudo-code? > > > > if (fw->mac_address == deadbeef) { > > fw->mac_address = get_random_mac(); Deadbeef is a valid mac address, so I suggest detecting it and warning the user of the bogus (default) nvs but don't attempt to get a random mac address for him as it has to many rules (registered oui addresses etc.) > > dev_warn(dev, "Detected unconfigured wl1271-nvs.bin.\n" > > "Your device will run with limited performance.\n" > > "Please use ti-utils to configure your device.\n"); > > } > > Yeah something like that should do the trick :) > Seems logical, will submit a v3 using wl1271-nvs.bin for wl18xx while adding this Check/warn. Best Regards, Eyal
RE: [PATCH] wlcore: add missing nvs file name info for wilink8
> > > > On Wed, Jul 05, 2017 at 01:06:54AM -0700, Tony Lindgren wrote: > > > > > Not sure if this really is a regression as we've always had a bogus > > > > > wl1271-nvs.bin in linux-firmware.git. Sure would be nice to fix it, > > > > > but going back to using a generic wl1271-nvs.bin sure does not seem > > > > > like a good long term fix to me :) > > > > A lot of legacy here... > > > > Wl1271-nvs has been used mainly with wilink6/7 and indeed was device > specific > > > > Holding calibration info etc. > > > > When they started with wilink8 the device specific configuration that > > > > was > > > > Part of it has switched to wl18xx-conf.bin and using the wlaconf tool > > > > for > setting it. > > > > Also there is no calibration specific info per device with wilink8 so > > > > the > wl18xx-conf.bin > > > > The only thing left in wl1271-nvs.bin for wilink8 was the mac address > override. > > > > > > And the default wl1271-nvs.bin sets the mac address to a bogus deadbeef > address, > > > so it's wrong to use and totally broken for distros :( > > > > So use something like the following pseudo-code? > > > > if (fw->mac_address == deadbeef) { > > fw->mac_address = get_random_mac(); Deadbeef is a valid mac address, so I suggest detecting it and warning the user of the bogus (default) nvs but don't attempt to get a random mac address for him as it has to many rules (registered oui addresses etc.) > > dev_warn(dev, "Detected unconfigured wl1271-nvs.bin.\n" > > "Your device will run with limited performance.\n" > > "Please use ti-utils to configure your device.\n"); > > } > > Yeah something like that should do the trick :) > Seems logical, will submit a v3 using wl1271-nvs.bin for wl18xx while adding this Check/warn. Best Regards, Eyal
RE: [v2] wlcore: add missing nvs file name info for wilink8
Hi Tony, > > When working with wl18xx the nvs file is used for defining an alternate > > mac address and override the default mac address that is stored inside > > the wl18xx chip. > > > > The following commits: > > c815fde wlcore: spi: Populate config firmware data > > d776fc8 wlcore: sdio: Populate config firmware data > > > > Populated the nvs entry for wilink6 and wilink7 only while it is > > still needed for wilink8 as well. > > This broke user space backward compatibility when upgrading from older > > kernels, as the alternate mac address would not be read from the nvs that is > > already present in the file system (lib/firmware/ti-connectivity/wl1271- > nvs.bin) > > causing mac address change of the wlan interface. > > > > This patch fix this and update the structure field with the same default nvs > file > > name that has been used before. > > I think more checks on the nvs file being used are needed to avoid other > nasty issues, see the comments I just made in the earlier version of this > patch. > Just replied on your comments for v1 Best Regards, Eyal
RE: [v2] wlcore: add missing nvs file name info for wilink8
Hi Tony, > > When working with wl18xx the nvs file is used for defining an alternate > > mac address and override the default mac address that is stored inside > > the wl18xx chip. > > > > The following commits: > > c815fde wlcore: spi: Populate config firmware data > > d776fc8 wlcore: sdio: Populate config firmware data > > > > Populated the nvs entry for wilink6 and wilink7 only while it is > > still needed for wilink8 as well. > > This broke user space backward compatibility when upgrading from older > > kernels, as the alternate mac address would not be read from the nvs that is > > already present in the file system (lib/firmware/ti-connectivity/wl1271- > nvs.bin) > > causing mac address change of the wlan interface. > > > > This patch fix this and update the structure field with the same default nvs > file > > name that has been used before. > > I think more checks on the nvs file being used are needed to avoid other > nasty issues, see the comments I just made in the earlier version of this > patch. > Just replied on your comments for v1 Best Regards, Eyal
RE: [PATCH] wlcore: add missing nvs file name info for wilink8
Hi Tony, > > * Kalle Valo <kv...@codeaurora.org> [170703 04:30]: > > "Reizer, Eyal" <ey...@ti.com> writes: > > > > > When working with wl18xx the nvs file is used for defining an alternate > > > mac address and override the default mac address that is stored inside > > > the wl18xx chip. > > > update the structure field with the same default nvs file name that has > > > been used in the past, otherwise userspace backward compatibility is > > > broken when upgrading from older kernels, as the alternate mac address > > > would not be read from the nvs that is already present in the file system > > > (lib/firmware/ti-connectivity/wl1271-nvs.bin) causing mac address change > > > of the wlan interface. > > > > > > Signed-off-by: Eyal Reizer <ey...@ti.com> > > > > Should we also cc stable? And a Fixes line would be nice. > > Argh this mess again. I think there are few things to consider here. What > about booting the same rootfs on multiple devices for example with NFSroot? > > Not sure if this really is a regression as we've always had a bogus > wl1271-nvs.bin in linux-firmware.git. Sure would be nice to fix it, > but going back to using a generic wl1271-nvs.bin sure does not seem > like a good long term fix to me :) A lot of legacy here... Wl1271-nvs has been used mainly with wilink6/7 and indeed was device specific Holding calibration info etc. When they started with wilink8 the device specific configuration that was Part of it has switched to wl18xx-conf.bin and using the wlaconf tool for setting it. Also there is no calibration specific info per device with wilink8 so the wl18xx-conf.bin The only thing left in wl1271-nvs.bin for wilink8 was the mac address override. There are wilink8 customer using this feature which is the only reason for keeping This file for wilink8. So for wilink8 there is really not issue with having the same wl1271-nvs.bin On NFSroot. > > Isn't the nvs file supposed to be device specific? If so, we should not > provide it in linux-firmware.git at all because of the issues it causes.. > > And since it's provided, how are people supposed to know to remove it > from their file system and replace it with something board specific? I think the wl1271-nvs.bin should be removed from linux-firmware.git anyway. For wilink6/7 it is really device specific and for wilink8 if a customer Want an alternate mac address he can create this file on his file system. > > Maybe add a check to first try to find wl18xx-nvs.bin if it exists (and > not add it to linux-firmware.git), and if not found, then fall back to > wl1271-nvs.bin, but only if it's not the bogus generic file.. Produce > a warning if the bogux linux-firmware.git wl1271-nvs.bin is being used.. > Removing it from linux-firmware.git may be better instead of adding an additional check? People are already familiar with the wl1271-nvs.bin file as a mean for Mac address override for wilink8: http://processors.wiki.ti.com/index.php/WL18xx_Writing_MAC_address so I am not sure that a name change Here is really necessary and may only create confusion especially for Customers that already have products in the field and only updating Their kernel. Best Regards, Eyal
RE: [PATCH] wlcore: add missing nvs file name info for wilink8
Hi Tony, > > * Kalle Valo [170703 04:30]: > > "Reizer, Eyal" writes: > > > > > When working with wl18xx the nvs file is used for defining an alternate > > > mac address and override the default mac address that is stored inside > > > the wl18xx chip. > > > update the structure field with the same default nvs file name that has > > > been used in the past, otherwise userspace backward compatibility is > > > broken when upgrading from older kernels, as the alternate mac address > > > would not be read from the nvs that is already present in the file system > > > (lib/firmware/ti-connectivity/wl1271-nvs.bin) causing mac address change > > > of the wlan interface. > > > > > > Signed-off-by: Eyal Reizer > > > > Should we also cc stable? And a Fixes line would be nice. > > Argh this mess again. I think there are few things to consider here. What > about booting the same rootfs on multiple devices for example with NFSroot? > > Not sure if this really is a regression as we've always had a bogus > wl1271-nvs.bin in linux-firmware.git. Sure would be nice to fix it, > but going back to using a generic wl1271-nvs.bin sure does not seem > like a good long term fix to me :) A lot of legacy here... Wl1271-nvs has been used mainly with wilink6/7 and indeed was device specific Holding calibration info etc. When they started with wilink8 the device specific configuration that was Part of it has switched to wl18xx-conf.bin and using the wlaconf tool for setting it. Also there is no calibration specific info per device with wilink8 so the wl18xx-conf.bin The only thing left in wl1271-nvs.bin for wilink8 was the mac address override. There are wilink8 customer using this feature which is the only reason for keeping This file for wilink8. So for wilink8 there is really not issue with having the same wl1271-nvs.bin On NFSroot. > > Isn't the nvs file supposed to be device specific? If so, we should not > provide it in linux-firmware.git at all because of the issues it causes.. > > And since it's provided, how are people supposed to know to remove it > from their file system and replace it with something board specific? I think the wl1271-nvs.bin should be removed from linux-firmware.git anyway. For wilink6/7 it is really device specific and for wilink8 if a customer Want an alternate mac address he can create this file on his file system. > > Maybe add a check to first try to find wl18xx-nvs.bin if it exists (and > not add it to linux-firmware.git), and if not found, then fall back to > wl1271-nvs.bin, but only if it's not the bogus generic file.. Produce > a warning if the bogux linux-firmware.git wl1271-nvs.bin is being used.. > Removing it from linux-firmware.git may be better instead of adding an additional check? People are already familiar with the wl1271-nvs.bin file as a mean for Mac address override for wilink8: http://processors.wiki.ti.com/index.php/WL18xx_Writing_MAC_address so I am not sure that a name change Here is really necessary and may only create confusion especially for Customers that already have products in the field and only updating Their kernel. Best Regards, Eyal
[v2] wlcore: add missing nvs file name info for wilink8
When working with wl18xx the nvs file is used for defining an alternate mac address and override the default mac address that is stored inside the wl18xx chip. The following commits: c815fde wlcore: spi: Populate config firmware data d776fc8 wlcore: sdio: Populate config firmware data Populated the nvs entry for wilink6 and wilink7 only while it is still needed for wilink8 as well. This broke user space backward compatibility when upgrading from older kernels, as the alternate mac address would not be read from the nvs that is already present in the file system (lib/firmware/ti-connectivity/wl1271-nvs.bin) causing mac address change of the wlan interface. This patch fix this and update the structure field with the same default nvs file name that has been used before. Cc: stableSigned-off-by: Eyal Reizer --- drivers/net/wireless/ti/wlcore/sdio.c | 1 + drivers/net/wireless/ti/wlcore/spi.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index 2fb3871..f8a1fea 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c @@ -230,6 +230,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; static const struct of_device_id wlcore_sdio_of_match_table[] = { diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index fdabb92..62ce54a 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -92,6 +92,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; struct wl12xx_spi_glue { -- 2.7.4
[v2] wlcore: add missing nvs file name info for wilink8
When working with wl18xx the nvs file is used for defining an alternate mac address and override the default mac address that is stored inside the wl18xx chip. The following commits: c815fde wlcore: spi: Populate config firmware data d776fc8 wlcore: sdio: Populate config firmware data Populated the nvs entry for wilink6 and wilink7 only while it is still needed for wilink8 as well. This broke user space backward compatibility when upgrading from older kernels, as the alternate mac address would not be read from the nvs that is already present in the file system (lib/firmware/ti-connectivity/wl1271-nvs.bin) causing mac address change of the wlan interface. This patch fix this and update the structure field with the same default nvs file name that has been used before. Cc: stable Signed-off-by: Eyal Reizer --- drivers/net/wireless/ti/wlcore/sdio.c | 1 + drivers/net/wireless/ti/wlcore/spi.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index 2fb3871..f8a1fea 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c @@ -230,6 +230,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; static const struct of_device_id wlcore_sdio_of_match_table[] = { diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index fdabb92..62ce54a 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -92,6 +92,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; struct wl12xx_spi_glue { -- 2.7.4
[PATCH] wlcore: add missing nvs file name info for wilink8
When working with wl18xx the nvs file is used for defining an alternate mac address and override the default mac address that is stored inside the wl18xx chip. update the structure field with the same default nvs file name that has been used in the past, otherwise userspace backward compatibility is broken when upgrading from older kernels, as the alternate mac address would not be read from the nvs that is already present in the file system (lib/firmware/ti-connectivity/wl1271-nvs.bin) causing mac address change of the wlan interface. Signed-off-by: Eyal Reizer--- drivers/net/wireless/ti/wlcore/sdio.c | 1 + drivers/net/wireless/ti/wlcore/spi.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index 2fb3871..f8a1fea 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c @@ -230,6 +230,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; static const struct of_device_id wlcore_sdio_of_match_table[] = { diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index fdabb92..62ce54a 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -92,6 +92,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; struct wl12xx_spi_glue { -- 2.7.4
[PATCH] wlcore: add missing nvs file name info for wilink8
When working with wl18xx the nvs file is used for defining an alternate mac address and override the default mac address that is stored inside the wl18xx chip. update the structure field with the same default nvs file name that has been used in the past, otherwise userspace backward compatibility is broken when upgrading from older kernels, as the alternate mac address would not be read from the nvs that is already present in the file system (lib/firmware/ti-connectivity/wl1271-nvs.bin) causing mac address change of the wlan interface. Signed-off-by: Eyal Reizer --- drivers/net/wireless/ti/wlcore/sdio.c | 1 + drivers/net/wireless/ti/wlcore/spi.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index 2fb3871..f8a1fea 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c @@ -230,6 +230,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; static const struct of_device_id wlcore_sdio_of_match_table[] = { diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index fdabb92..62ce54a 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -92,6 +92,7 @@ static const struct wilink_family_data wl128x_data = { static const struct wilink_family_data wl18xx_data = { .name = "wl18xx", .cfg_name = "ti-connectivity/wl18xx-conf.bin", + .nvs_name = "ti-connectivity/wl1271-nvs.bin", }; struct wl12xx_spi_glue { -- 2.7.4
[PATCH] wlcore: spi: fix build warning caused by redundant variable
The ret variable is unused in wlcore_probe_of() Remove it for fixing build warning. Fixes: 01efe65aba65 ("wlcore: spi: add wl18xx support") Signed-off-by: Eyal Reizer--- drivers/net/wireless/ti/wlcore/spi.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index 73fbcf1..6d24040 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -454,7 +454,6 @@ static int wlcore_probe_of(struct spi_device *spi, struct wl12xx_spi_glue *glue, struct wlcore_platdev_data *pdev_data) { struct device_node *dt_node = spi->dev.of_node; - int ret; const struct of_device_id *of_id; of_id = of_match_node(wlcore_spi_of_match_table, dt_node); -- 2.7.4
[PATCH] wlcore: spi: fix build warning caused by redundant variable
The ret variable is unused in wlcore_probe_of() Remove it for fixing build warning. Fixes: 01efe65aba65 ("wlcore: spi: add wl18xx support") Signed-off-by: Eyal Reizer --- drivers/net/wireless/ti/wlcore/spi.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index 73fbcf1..6d24040 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -454,7 +454,6 @@ static int wlcore_probe_of(struct spi_device *spi, struct wl12xx_spi_glue *glue, struct wlcore_platdev_data *pdev_data) { struct device_node *dt_node = spi->dev.of_node; - int ret; const struct of_device_id *of_id; of_id = of_match_node(wlcore_spi_of_match_table, dt_node); -- 2.7.4
RE: [PATCHv8] 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 > > v5->v6: Add ACKs > > v6->v7: Mail format issues > > v7->v8: Remove redundant varaible from wlcore_probe_of > > I have already applied this patch, it's too late to send a new version. > Now you need to send a new patch, on top of wireless-drivers-next, which > removes the redundant variable. > Understood. Will submit shortly Best Regards, Eyal
RE: [PATCHv8] 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 > > v5->v6: Add ACKs > > v6->v7: Mail format issues > > v7->v8: Remove redundant varaible from wlcore_probe_of > > I have already applied this patch, it's too late to send a new version. > Now you need to send a new patch, on top of wireless-drivers-next, which > removes the redundant variable. > Understood. Will submit shortly Best Regards, Eyal
[PATCHv8] 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 v5->v6: Add ACKs v6->v7: Mail format issues v7->v8: Remove redundant varaible from wlcore_probe_of .../bindings/net/wireless/ti,wlcore,spi.txt| 41 +-- drivers/net/wireless/ti/wlcore/spi.c | 124 + 2 files changed, 137 insertions(+), 28 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..6d24040 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 =
[PATCHv8] 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 v5->v6: Add ACKs v6->v7: Mail format issues v7->v8: Remove redundant varaible from wlcore_probe_of .../bindings/net/wireless/ti,wlcore,spi.txt| 41 +-- drivers/net/wireless/ti/wlcore/spi.c | 124 + 2 files changed, 137 insertions(+), 28 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..6d24040 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);
RE: linux-next: build warning after merge of the wireless-drivers-next tree
Hi Stephen, > > After merging the wireless-drivers-next tree, today's linux-next build > (x86_64 allmodconfig) produced this warning: > > drivers/net/wireless/ti/wlcore/spi.c: In function 'wlcore_probe_of': > drivers/net/wireless/ti/wlcore/spi.c:457:6: warning: unused variable 'ret' [- > Wunused-variable] > int ret; > ^ > > Introduced by commit > > 01efe65aba65 ("wlcore: spi: add wl18xx support") > Of course you are right. It is indeed redundant now. Don't know how I have missed it. Don't remember seeing a warning from the tool chain I have used. Anyway ,will submit an amended patch soon. Best Regards, Eyal
RE: linux-next: build warning after merge of the wireless-drivers-next tree
Hi Stephen, > > After merging the wireless-drivers-next tree, today's linux-next build > (x86_64 allmodconfig) produced this warning: > > drivers/net/wireless/ti/wlcore/spi.c: In function 'wlcore_probe_of': > drivers/net/wireless/ti/wlcore/spi.c:457:6: warning: unused variable 'ret' [- > Wunused-variable] > int ret; > ^ > > Introduced by commit > > 01efe65aba65 ("wlcore: spi: add wl18xx support") > Of course you are right. It is indeed redundant now. Don't know how I have missed it. Don't remember seeing a warning from the tool chain I have used. Anyway ,will submit an amended patch soon. Best Regards, Eyal
RE: [PATCH v7] wlcore: spi: add wl18xx support
> > From: Eyal Reizer> > > > 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 > > This looks ok in patchwork: > > https://patchwork.kernel.org/patch/9235983/ > > Because you used ti.com in S-o-b I assume From should also use ti.com. I can > fix that before I apply but please confirm that's really the case? > Yes, S-o-b is ey...@ti.com. Thank you! -- Eyal Reizer
RE: [PATCH v7] wlcore: spi: add wl18xx support
> > From: Eyal Reizer > > > > 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 > > This looks ok in patchwork: > > https://patchwork.kernel.org/patch/9235983/ > > Because you used ti.com in S-o-b I assume From should also use ti.com. I can > fix that before I apply but please confirm that's really the case? > Yes, S-o-b is ey...@ti.com. Thank you! -- Eyal Reizer
[PATCH v6] 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 v2->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 v3->select number mismatch in wl1271 example v4->v5: Rebase on top of head of wireless-drivers-next v5->v6: Add ACKs .../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;
[PATCH v6] 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 v2->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 v3->select number mismatch in wl1271 example v4->v5: Rebase on top of head of wireless-drivers-next v5->v6: Add ACKs .../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 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 =
[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
[PATCH v4] 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 .../bindings/net/wireless/ti,wlcore,spi.txt| 41 +-- drivers/net/wireless/ti/wlcore/spi.c | 124 + 2 files changed, 137 insertions(+), 28 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 020ac1a..bd1253d 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 *cmd = kzalloc(WSPI_INIT_CMD_LEN,
[PATCH v4] 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 .../bindings/net/wireless/ti,wlcore,spi.txt| 41 +-- drivers/net/wireless/ti/wlcore/spi.c | 124 + 2 files changed, 137 insertions(+), 28 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 020ac1a..bd1253d 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 *cmd = kzalloc(WSPI_INIT_CMD_LEN, GFP_KERNEL);
RE: [PATCHv3] wlcore: spi: add wl18xx support
> > > > - 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 and puts the wilink chip into wspi mode. > > > > 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 > > > > .../bindings/net/wireless/ti,wlcore,spi.txt| 47 ++-- > > drivers/net/wireless/ti/wlcore/spi.c | 124 > > + > > 2 files changed, 145 insertions(+), 26 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..35467cf 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,10 +32,15 @@ Optional properties: > > > > Examples: > > > > +For wl12xx family: > > { > > - wl1271@1 { > > + status = "okay"; > > + pinctrl-names = "default"; > > + pinctrl-0 = <_pins>; > > + #address-cells = <1>; > > + #size-cells = <0>; > > None of this is really relevant to this binding. > Understood. Will remove in v4 > > + wlcore: wlcore@0 { > > Now your unit-address and reg value don't match. You are right. Will fix in v4 > > > compatible = "ti,wl1271"; > > - > > reg = <1>; > > spi-max-frequency = <4800>; > > clock-xtal; > > @@ -34,3 +50,20 @@ Examples: > > vwlan-supply = <_fixed>; > > }; > > }; > > + > > +For wl18xx family: > > + { > > + status = "okay"; > > + pinctrl-names = "default"; > > + pinctrl-0 = <_pins>; > > + #address-cells = <1>; > > + #size-cells = <0>; > > + wlcore: wlcore@0 { > > + compatible = "ti,wl1835"; > > + vwlan-supply = <_en_reg>; > > + spi-max-frequency = <4800>; > > + reg = <0>; > > + interrupt-parent = <>; > > + interrupts = <27 IRQ_TYPE_EDGE_RISING>; > > + }; > > +};
RE: [PATCHv3] wlcore: spi: add wl18xx support
> > > > - 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 and puts the wilink chip into wspi mode. > > > > 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 > > > > .../bindings/net/wireless/ti,wlcore,spi.txt| 47 ++-- > > drivers/net/wireless/ti/wlcore/spi.c | 124 > > + > > 2 files changed, 145 insertions(+), 26 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..35467cf 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,10 +32,15 @@ Optional properties: > > > > Examples: > > > > +For wl12xx family: > > { > > - wl1271@1 { > > + status = "okay"; > > + pinctrl-names = "default"; > > + pinctrl-0 = <_pins>; > > + #address-cells = <1>; > > + #size-cells = <0>; > > None of this is really relevant to this binding. > Understood. Will remove in v4 > > + wlcore: wlcore@0 { > > Now your unit-address and reg value don't match. You are right. Will fix in v4 > > > compatible = "ti,wl1271"; > > - > > reg = <1>; > > spi-max-frequency = <4800>; > > clock-xtal; > > @@ -34,3 +50,20 @@ Examples: > > vwlan-supply = <_fixed>; > > }; > > }; > > + > > +For wl18xx family: > > + { > > + status = "okay"; > > + pinctrl-names = "default"; > > + pinctrl-0 = <_pins>; > > + #address-cells = <1>; > > + #size-cells = <0>; > > + wlcore: wlcore@0 { > > + compatible = "ti,wl1835"; > > + vwlan-supply = <_en_reg>; > > + spi-max-frequency = <4800>; > > + reg = <0>; > > + interrupt-parent = <>; > > + interrupts = <27 IRQ_TYPE_EDGE_RISING>; > > + }; > > +};
[PATCHv3] 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 and puts the wilink chip into wspi mode. 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 .../bindings/net/wireless/ti,wlcore,spi.txt| 47 ++-- drivers/net/wireless/ti/wlcore/spi.c | 124 + 2 files changed, 145 insertions(+), 26 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..35467cf 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,10 +32,15 @@ Optional properties: Examples: +For wl12xx family: { - wl1271@1 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <_pins>; + #address-cells = <1>; + #size-cells = <0>; + wlcore: wlcore@0 { compatible = "ti,wl1271"; - reg = <1>; spi-max-frequency = <4800>; clock-xtal; @@ -34,3 +50,20 @@ Examples: vwlan-supply = <_fixed>; }; }; + +For wl18xx family: + { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <_pins>; + #address-cells = <1>; + #size-cells = <0>; + wlcore: wlcore@0 { + compatible = "ti,wl1835"; + vwlan-supply = <_en_reg>; + spi-max-frequency = <4800>; + reg = <0>; + interrupt-parent = <>; + interrupts = <27 IRQ_TYPE_EDGE_RISING>; + }; +}; diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index 020ac1a..bd1253d 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
[PATCHv3] 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 and puts the wilink chip into wspi mode. 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 .../bindings/net/wireless/ti,wlcore,spi.txt| 47 ++-- drivers/net/wireless/ti/wlcore/spi.c | 124 + 2 files changed, 145 insertions(+), 26 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..35467cf 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,10 +32,15 @@ Optional properties: Examples: +For wl12xx family: { - wl1271@1 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <_pins>; + #address-cells = <1>; + #size-cells = <0>; + wlcore: wlcore@0 { compatible = "ti,wl1271"; - reg = <1>; spi-max-frequency = <4800>; clock-xtal; @@ -34,3 +50,20 @@ Examples: vwlan-supply = <_fixed>; }; }; + +For wl18xx family: + { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <_pins>; + #address-cells = <1>; + #size-cells = <0>; + wlcore: wlcore@0 { + compatible = "ti,wl1835"; + vwlan-supply = <_en_reg>; + spi-max-frequency = <4800>; + reg = <0>; + interrupt-parent = <>; + interrupts = <27 IRQ_TYPE_EDGE_RISING>; + }; +}; diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index 020ac1a..bd1253d 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 *cmd =
RE: [PATCHv2] wlcore: spi: add wl18xx support
> > > Thanks! Glad the illustration helped. > > I will try it out again as if i recall cotrectly, i did try that l, and it > > didnt produce > the correct waveform, but perhaps i didnt understand the usage of > .cs_change correctly. > > Will double check anyway. > > It could also be a bug in your controller driver, it's common for them to not > handle cs_change correctly (at least those that open code the message loop, > obviously modern ones just factor this out into the core). Tried looking into using cs_change and not sure I understand how it would do what I need. According to, include/linux/spi/spi.h: * All SPI transfers start with the relevant chipselect active. Normally * it stays selected until after the last transfer in a message. Drivers * can affect the chipselect signal using cs_change. * * (i) If the transfer isn't the last one in the message, this flag is * used to make the chipselect briefly go inactive in the middle of the * message. Toggling chipselect in this way may be needed to terminate * a chip command, letting a single spi_message perform all of group of * chip transactions together. Now, in my case I need the CS pin to go inactive and stay inactive during the transfer of the next byte for completing the SPI init correctly (sending the extra clock cycles while CS is inactive) If I read the above correctly, CS will only briefly go inactive but will when the next byte is sent it will be active again. What am I missing? Best Regards, Eyal
RE: [PATCHv2] wlcore: spi: add wl18xx support
> > > Thanks! Glad the illustration helped. > > I will try it out again as if i recall cotrectly, i did try that l, and it > > didnt produce > the correct waveform, but perhaps i didnt understand the usage of > .cs_change correctly. > > Will double check anyway. > > It could also be a bug in your controller driver, it's common for them to not > handle cs_change correctly (at least those that open code the message loop, > obviously modern ones just factor this out into the core). Tried looking into using cs_change and not sure I understand how it would do what I need. According to, include/linux/spi/spi.h: * All SPI transfers start with the relevant chipselect active. Normally * it stays selected until after the last transfer in a message. Drivers * can affect the chipselect signal using cs_change. * * (i) If the transfer isn't the last one in the message, this flag is * used to make the chipselect briefly go inactive in the middle of the * message. Toggling chipselect in this way may be needed to terminate * a chip command, letting a single spi_message perform all of group of * chip transactions together. Now, in my case I need the CS pin to go inactive and stay inactive during the transfer of the next byte for completing the SPI init correctly (sending the extra clock cycles while CS is inactive) If I read the above correctly, CS will only briefly go inactive but will when the next byte is sent it will be active again. What am I missing? Best Regards, Eyal
RE: [PATCHv2] wlcore: spi: add wl18xx support
> > > > It is also part of the generic spi.h (include/Linux/spi/spi.h), > > > > already part of " struct spi_device" So it seemed redundant adding > > > > another mechanism for implementing the same. > > > > Platform that interact with a wilink need to use it, and platforms > > > > that don't have this capability will probably not interact with a > > > > wilink device > > > using SPI. > > > > > > The cs_gpio field in spi_device belongs to the spi host controller, > > > no other slave driver uses it. > > > > > > I wasn't asking for a duplication of this mechanism, but an > > > interface to use it properly. Internally, the spi core uses the > > > spi_set_cs() > function to pick a CS. > > > Find a way to use that rather than reimplementing it incorrectly. > > > > > > > Understood. As this special CS manipulation is unique to wspi (wilink > > spi) I think the best option is to move this gpio allocation into > > wlcore_spi as a new device tree entry used only by this driver. > > If you agree I will submit a v3. > > I don't think that can work either: aside of not solving the problem of wilink > devices on spi controllers that don't use gpio, it also doesn't solve the > problem of what happens when the driver manually triggers the gpio to hold > the CS signal while another driver talks to a different device using another > CS > on the same controller. > Ok, understood. Will look into it. Best Regards, Eyal
RE: [PATCHv2] wlcore: spi: add wl18xx support
> > > > It is also part of the generic spi.h (include/Linux/spi/spi.h), > > > > already part of " struct spi_device" So it seemed redundant adding > > > > another mechanism for implementing the same. > > > > Platform that interact with a wilink need to use it, and platforms > > > > that don't have this capability will probably not interact with a > > > > wilink device > > > using SPI. > > > > > > The cs_gpio field in spi_device belongs to the spi host controller, > > > no other slave driver uses it. > > > > > > I wasn't asking for a duplication of this mechanism, but an > > > interface to use it properly. Internally, the spi core uses the > > > spi_set_cs() > function to pick a CS. > > > Find a way to use that rather than reimplementing it incorrectly. > > > > > > > Understood. As this special CS manipulation is unique to wspi (wilink > > spi) I think the best option is to move this gpio allocation into > > wlcore_spi as a new device tree entry used only by this driver. > > If you agree I will submit a v3. > > I don't think that can work either: aside of not solving the problem of wilink > devices on spi controllers that don't use gpio, it also doesn't solve the > problem of what happens when the driver manually triggers the gpio to hold > the CS signal while another driver talks to a different device using another > CS > on the same controller. > Ok, understood. Will look into it. Best Regards, Eyal
RE: [PATCHv2] wlcore: spi: add wl18xx support
Arnd, > > > > > > > > - 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. > > > > - switch to controling the cs pin from the spi driver for achieveing the > > > > above. > > > > - the selected cs gpio is read from the spi device-tree node using the > > > > cs-gpios field and setup as a gpio. > > > > - See the example below for specifying the cs gpio using the cs-gpios > entry > > > >{ > > > > ... > > > > cs-gpios = < 5 0>; > > > > ... > > > > wlcore: wlcore@0 { > > > > compatible = "ti,wl1835"; > > > > ... > > > > ... > > > > }; > > > > }; > > > > > > > > Signed-off-by: Eyal Reizer> > > > > > I don't think this can work in general: not all SPI hosts uses GPIOs > > > for controlling CS, so the logic can't work, and it's also a > > > layering violation for the driver to look at the parent. > > > > > > I would suggest fixing this using a new API function from the SPI > > > core, if we don't already have a generic way to do it. > > > > > Originally this is what I have done until I was pointed to the generic > > cs-gpio mechanism in the SPI core. > > It is a generic mechanism already in the SPI core driver. > > See: Documentation/devicetree/bindings/spi/spi-bus.txt > > The cs-gpios property is documented as optional, it defines how you should > list the gpios if CS is implemented using gpio, but not all hardware does it > like > this. > > > It is also part of the generic spi.h (include/Linux/spi/spi.h), > > already part of " struct spi_device" So it seemed redundant adding > > another mechanism for implementing the same. > > Platform that interact with a wilink need to use it, and platforms > > that don't have this capability will probably not interact with a wilink > > device > using SPI. > > The cs_gpio field in spi_device belongs to the spi host controller, no other > slave driver uses it. > > I wasn't asking for a duplication of this mechanism, but an interface to use > it > properly. Internally, the spi core uses the spi_set_cs() function to pick a > CS. > Find a way to use that rather than reimplementing it incorrectly. > Understood. As this special CS manipulation is unique to wspi (wilink spi) I think the best option is to move this gpio allocation into wlcore_spi as a new device tree entry used only by this driver. If you agree I will submit a v3. Best Regards, Eyal
RE: [PATCHv2] wlcore: spi: add wl18xx support
Arnd, > > > > > > > > - 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. > > > > - switch to controling the cs pin from the spi driver for achieveing the > > > > above. > > > > - the selected cs gpio is read from the spi device-tree node using the > > > > cs-gpios field and setup as a gpio. > > > > - See the example below for specifying the cs gpio using the cs-gpios > entry > > > >{ > > > > ... > > > > cs-gpios = < 5 0>; > > > > ... > > > > wlcore: wlcore@0 { > > > > compatible = "ti,wl1835"; > > > > ... > > > > ... > > > > }; > > > > }; > > > > > > > > Signed-off-by: Eyal Reizer > > > > > > I don't think this can work in general: not all SPI hosts uses GPIOs > > > for controlling CS, so the logic can't work, and it's also a > > > layering violation for the driver to look at the parent. > > > > > > I would suggest fixing this using a new API function from the SPI > > > core, if we don't already have a generic way to do it. > > > > > Originally this is what I have done until I was pointed to the generic > > cs-gpio mechanism in the SPI core. > > It is a generic mechanism already in the SPI core driver. > > See: Documentation/devicetree/bindings/spi/spi-bus.txt > > The cs-gpios property is documented as optional, it defines how you should > list the gpios if CS is implemented using gpio, but not all hardware does it > like > this. > > > It is also part of the generic spi.h (include/Linux/spi/spi.h), > > already part of " struct spi_device" So it seemed redundant adding > > another mechanism for implementing the same. > > Platform that interact with a wilink need to use it, and platforms > > that don't have this capability will probably not interact with a wilink > > device > using SPI. > > The cs_gpio field in spi_device belongs to the spi host controller, no other > slave driver uses it. > > I wasn't asking for a duplication of this mechanism, but an interface to use > it > properly. Internally, the spi core uses the spi_set_cs() function to pick a > CS. > Find a way to use that rather than reimplementing it incorrectly. > Understood. As this special CS manipulation is unique to wspi (wilink spi) I think the best option is to move this gpio allocation into wlcore_spi as a new device tree entry used only by this driver. If you agree I will submit a v3. Best Regards, Eyal
RE: [PATCHv2] wlcore: spi: add wl18xx support
> > > > - 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. > > - switch to controling the cs pin from the spi driver for achieveing the > > above. > > - the selected cs gpio is read from the spi device-tree node using the > > cs-gpios field and setup as a gpio. > > - See the example below for specifying the cs gpio using the cs-gpios entry > >{ > > ... > > cs-gpios = < 5 0>; > > ... > > wlcore: wlcore@0 { > > compatible = "ti,wl1835"; > > ... > > ... > > }; > > }; > > > > Signed-off-by: Eyal Reizer> > I don't think this can work in general: not all SPI hosts uses GPIOs for > controlling CS, so the logic can't work, and it's also a layering violation > for the > driver to look at the parent. > > I would suggest fixing this using a new API function from the SPI core, if we > don't already have a generic way to do it. > Originally this is what I have done until I was pointed to the generic cs-gpio mechanism in the SPI core. It is a generic mechanism already in the SPI core driver. See: Documentation/devicetree/bindings/spi/spi-bus.txt It is also part of the generic spi.h (include/Linux/spi/spi.h), already part of " struct spi_device" So it seemed redundant adding another mechanism for implementing the same. Platform that interact with a wilink need to use it, and platforms that don't have this capability will probably not interact with a wilink device using SPI. Best Regards, Eyal
RE: [PATCHv2] wlcore: spi: add wl18xx support
> > > > - 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. > > - switch to controling the cs pin from the spi driver for achieveing the > > above. > > - the selected cs gpio is read from the spi device-tree node using the > > cs-gpios field and setup as a gpio. > > - See the example below for specifying the cs gpio using the cs-gpios entry > >{ > > ... > > cs-gpios = < 5 0>; > > ... > > wlcore: wlcore@0 { > > compatible = "ti,wl1835"; > > ... > > ... > > }; > > }; > > > > Signed-off-by: Eyal Reizer > > I don't think this can work in general: not all SPI hosts uses GPIOs for > controlling CS, so the logic can't work, and it's also a layering violation > for the > driver to look at the parent. > > I would suggest fixing this using a new API function from the SPI core, if we > don't already have a generic way to do it. > Originally this is what I have done until I was pointed to the generic cs-gpio mechanism in the SPI core. It is a generic mechanism already in the SPI core driver. See: Documentation/devicetree/bindings/spi/spi-bus.txt It is also part of the generic spi.h (include/Linux/spi/spi.h), already part of " struct spi_device" So it seemed redundant adding another mechanism for implementing the same. Platform that interact with a wilink need to use it, and platforms that don't have this capability will probably not interact with a wilink device using SPI. Best Regards, Eyal
[PATCHv2] 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. - switch to controling the cs pin from the spi driver for achieveing the above. - the selected cs gpio is read from the spi device-tree node using the cs-gpios field and setup as a gpio. - See the example below for specifying the cs gpio using the cs-gpios entry { ... cs-gpios = < 5 0>; ... wlcore: wlcore@0 { compatible = "ti,wl1835"; ... ... }; }; Signed-off-by: Eyal Reizer--- v1 -> v2: update device tree bindings documentation .../bindings/net/wireless/ti,wlcore,spi.txt| 50 +- drivers/net/wireless/ti/wlcore/spi.c | 176 +--- 2 files changed, 200 insertions(+), 26 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..912ab0c 100644 --- a/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt +++ b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt @@ -1,19 +1,31 @@ -* 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 +- cs-gpios :GPIO pin used as the spi chip select 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,10 +33,16 @@ Optional properties: Examples: +For wl12xx family: { - wl1271@1 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <_pins>; + cs-gpios = < 5 0>; + #address-cells = <1>; + #size-cells = <0>; + wlcore: wlcore@0 { compatible = "ti,wl1271"; - reg = <1>; spi-max-frequency = <4800>; clock-xtal; @@ -34,3 +52,21 @@ Examples: vwlan-supply = <_fixed>; }; }; + +For wl18xx family: + { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <_pins>; + cs-gpios = < 5 0>; + #address-cells = <1>; + #size-cells = <0>; + wlcore: wlcore@0 { + compatible = "ti,wl1835"; + vwlan-supply = <_en_reg>; + spi-max-frequency = <4800>; + reg = <0>; + interrupt-parent = <>; + interrupts = <27 IRQ_TYPE_EDGE_RISING>; + }; +}; diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index 020ac1a..fb48a0d 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -32,6 +32,7 @@ #include #include #include +#include #include "wlcore.h" #include "wl12xx_80211.h" @@ -70,16 +71,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
[PATCHv2] 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. - switch to controling the cs pin from the spi driver for achieveing the above. - the selected cs gpio is read from the spi device-tree node using the cs-gpios field and setup as a gpio. - See the example below for specifying the cs gpio using the cs-gpios entry { ... cs-gpios = < 5 0>; ... wlcore: wlcore@0 { compatible = "ti,wl1835"; ... ... }; }; Signed-off-by: Eyal Reizer --- v1 -> v2: update device tree bindings documentation .../bindings/net/wireless/ti,wlcore,spi.txt| 50 +- drivers/net/wireless/ti/wlcore/spi.c | 176 +--- 2 files changed, 200 insertions(+), 26 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..912ab0c 100644 --- a/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt +++ b/Documentation/devicetree/bindings/net/wireless/ti,wlcore,spi.txt @@ -1,19 +1,31 @@ -* 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 +- cs-gpios :GPIO pin used as the spi chip select 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,10 +33,16 @@ Optional properties: Examples: +For wl12xx family: { - wl1271@1 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <_pins>; + cs-gpios = < 5 0>; + #address-cells = <1>; + #size-cells = <0>; + wlcore: wlcore@0 { compatible = "ti,wl1271"; - reg = <1>; spi-max-frequency = <4800>; clock-xtal; @@ -34,3 +52,21 @@ Examples: vwlan-supply = <_fixed>; }; }; + +For wl18xx family: + { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <_pins>; + cs-gpios = < 5 0>; + #address-cells = <1>; + #size-cells = <0>; + wlcore: wlcore@0 { + compatible = "ti,wl1835"; + vwlan-supply = <_en_reg>; + spi-max-frequency = <4800>; + reg = <0>; + interrupt-parent = <>; + interrupts = <27 IRQ_TYPE_EDGE_RISING>; + }; +}; diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index 020ac1a..fb48a0d 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -32,6 +32,7 @@ #include #include #include +#include #include "wlcore.h" #include "wl12xx_80211.h" @@ -70,16 +71,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;