summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/wl12xx/sdio.c
AgeCommit message (Collapse)Author
2011-07-05wl12xx: one SDIO initialization is enoughOhad Ben-Cohen
Skip manual device power on in case runtime PM is enabled for our device. This eliminates a secondary & redundant SDIO init sequence. Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27wl12xx_sdio: enable wowlan only if enable_irq_wake() succeededEliad Peller
Some platforms don't support the wake_irq, so disable wowlan in this case, and avoid the "Unbalanced IRQ wake disable" warning on disable_irq_wake(). Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27wl12xx: don't bail if mmc isn't MMC_CAP_POWER_OFF_CARDOhad Ben-Cohen
If our SDIO function has its runtime PM disabled, don't try to manipulate its runtime PM status at all. This way we can still power on cards plugged to mmc hosts that are not MMC_CAP_POWER_OFF_CARD. Reported-and-tested-by: Tim Yamin <tim@kangatronix.co.uk> Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27wl12xx: remove unused crc7 referencesEliad Peller
crc7 is used only in wl12xx_spi. Remove redundant crc7.h includes, and update Kconfig to select CRC7 only if WL12XX_SPI is being selected. Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27net: wl12xx: remove the nopsFelipe Balbi
Nops aren't needed. When we actually need those calls, then we add them with meat and barbecue sauce. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27net: wl12xx: remove some unnecessary printsFelipe Balbi
Those have little value. Remove those to make the driver less noisy. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-06-27net: wl12xx: sdio: id_tables should be __devinitconstFelipe Balbi
That's only needed during init anyway, let's free some space after we're done probing. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-18wl12xx: fix compilation error when CONFIG_PM is not setLuciano Coelho
There was a compilation error when PM is not enabled: CC [M] drivers/net/wireless/wl12xx/main.o drivers/net/wireless/wl12xx/main.c:3653: error: unknown field 'suspend' specified in initializer drivers/net/wireless/wl12xx/main.c:3653: warning: initialization from incompatible pointer type drivers/net/wireless/wl12xx/main.c:3654: error: unknown field 'resume' specified in initializer drivers/net/wireless/wl12xx/main.c:3654: warning: initialization from incompatible pointer type Fix this by adding #ifdef's in the appropriate places. Cc: Eliad Peller <eliad@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-05-13wl12xx_sdio: declare support for NL80211_WOW_TRIGGER_ANYTHING triggerEliad Peller
Since wowlan requires the ability to stay awake while the host is suspended, declare support for NL80211_WOW_TRIGGER_ANYTHING if the MMC_PM_KEEP_POWER capability is being supported. Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-13wl12xx: prevent scheduling while suspending (WoW enabled)Eliad Peller
When WoW is enabled, the interface will stay up and the chip will be powered on, so we have to flush/cancel any remaining work, and prevent the irq handler from scheduling a new work until the system is resumed. Add 2 new flags: * WL1271_FLAG_SUSPENDED - the system is (about to be) suspended. * WL1271_FLAG_PENDING_WORK - there is a pending irq work which should be scheduled when the system is being resumed. In order to wake-up the system while getting an irq, we initialize the device as wakeup device, and calling pm_wakeup_event() upon getting the interrupt (while the system is about to be suspended) Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-13wl12xx_sdio: set MMC_PM_KEEP_POWER flag on suspendEliad Peller
if a wow trigger was configured, set the MMC_PM_KEEP_POWER flag on suspend, so our power will be kept while the system is suspended. We needed to set this flag on each suspend attempt (when we want to keep power) Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-05-13wl12xx_sdio: set interrupt as wake_up interruptEliad Peller
set the sdio interrupt as wake_up interrupt, so we will be able to wake up the suspended system (Wake-On-Wireless) Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19wl12xx: Handle platforms without level trigger interruptsIdo Yariv
Some platforms are incapable of triggering on level interrupts. Add a platform quirks member in the platform data structure, as well as an edge interrupt quirk which can be set on such platforms. When the interrupt is requested with IRQF_TRIGGER_RISING, IRQF_ONESHOT cannot be used, as we might miss interrupts that occur after the FW status is cleared and before the threaded interrupt handler exits. Moreover, when IRQF_ONESHOT is not set, iterating more than once in the threaded interrupt handler introduces a few race conditions between this handler and the hardirq handler. Currently this is worked around by limiting the loop to one iteration only. This workaround has an impact on performance. To remove to this restriction, the race conditions will need to be addressed. Signed-off-by: Ido Yariv <ido@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19wl12xx: Clean up the block size alignment codeIdo Yariv
Simplify and clean up the block size alignment code: 1. Set the block size according to the padding field type, as it cannot exceed the maximum value this field can hold. 2. Move the alignment code into a function instead of duplicating it in multiple places. 3. In the current implementation, the block_size member can be misleading because a zero value actually means that there's no need to align. Declare a block size alignment quirk instead. Signed-off-by: Ido Yariv <ido@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19wl12xx: Clamp byte mode transfers for 128x chipsArik Nemtsov
On wl128x based devices, when TX packets are aggregated, each packet size must be aligned to the SDIO block size, and sent using block mode transfers. The block size is set to 256 bytes, which is less than the maximum possible byte transfer. Thus, if two small packets (< 256 bytes) are aggregated, the aggregation buffer size would be 512, and will be sent using byte mode transfers. This can have undesired side effects. Fix this by setting the MMC_QUIRK_BLKSZ_FOR_BYTE_MODE mmc card quirk. For 127x chips this has no effect, as the block size is set to 512 bytes. Signed-off-by: Arik Nemtsov <arik@wizery.com> Signed-off-by: Ido Yariv <ido@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19wl12xx: 1281/1283 support - Use different FW file for AP mode wl127x/wl128x ↵Arik Nemtsov
chips Choose a different FW for AP-mode wl127x and wl128x chips, base on chip ID at boot time. Signed-off-by: Arik Nemtsov <arik@wizery.com> Reviewed-by: Luciano Coelho <coelho@ti.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19wl12xx: 1281/1283 support - New boot sequenceShahar Levi
Boot sequence support FREF clock and TCXO clock. WL128x has two clocks input - TCXO and FREF. TCXO is the main clock of the device, while FREF is used to sync between the GPS and the cellular modem. Auto-detection checks where TCXO is 32.736MHz or 16.368MHz, in that case the FREF will be used as the WLAN/BT main clock. [Use clock enumeration as defined in linux/wl12xx.h; remove unnecessary else block in wl128x_switch_fref; remove unnecessary change in main.c; remove some unnecessary debug prints and comments; fix potential use of uninitialized value (pll_config) -- Luca] Signed-off-by: Shahar Levi <shahar_levi@ti.com> Reviewed-by: Luciano Coelho <coelho@ti.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19wl12xx: 1281/1283 support - add block size handling for sdio and spiLuciano Coelho
Add the the set_block_size op in the SDIO and in the SPI modules. Since it is only used with SDIO, just explicitly set the op to NULL in spi.c Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-19wl12xx: 1281/1283 support - Add DefinitionsShahar Levi
Definitions to support wl128x: - New FW file name - Chip ID - New PLL Configuration Algorithm macros that will be used at wl128x boot stage - Rename NVS macro name: wl127x and wl128x are using the same NVS file name. However, the ini parameters between them are different. The driver will validate the correct NVS size in wl1271_boot_upload_nvs(). [Cleaned up some of the definitions. -- Luca] Signed-off-by: Shahar Levi <shahar_levi@ti.com> Reviewed-by: Luciano Coelho <coelho@ti.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-04-04wl12xx: fix module author's email address in the spi and sdio modulesLuciano Coelho
The MODULE_AUTHOR() macro in the main module (wl12xx) has been updated to reflect one of the author's new email address, but the wl12xx_spi and wl12xx_sdio modules haven't been updated. This patches updates them. Signed-off-by: Luciano Coelho <coelho@ti.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-03-03wl12xx: Switch to level trigger interruptsIdo Yariv
The interrupt of the wl12xx is a level interrupt in nature, since the interrupt line is not auto-reset. However, since resetting the interrupt requires bus transactions, this cannot be done from an interrupt context. Thus, requesting a level interrupt would require to disable the irq and re-enable it after the HW is acknowledged. Since we now request a threaded irq, this can also be done by specifying the IRQF_ONESHOT flag. Triggering on an edge can be problematic in some platforms, if the sampling frequency is not sufficient for detecting very frequent interrupts. In case an interrupt is missed, the driver will hang as the interrupt line will stay high until it is acknowledged by the driver, which will never happen. Fix this by requesting a level triggered interrupt, with the IRQF_ONESHOT flag. Signed-off-by: Ido Yariv <ido@wizery.com> Reviewed-by: Luciano Coelho <coelho@ti.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-03-03wl12xx: Switch to a threaded interrupt handlerIdo Yariv
To achieve maximal throughput, it is very important to react to interrupts as soon as possible. Currently the interrupt handler wakes up a worker for handling interrupts in process context. A cleaner and more efficient design would be to request a threaded interrupt handler. This handler's priority is very high, and can do blocking operations such as SDIO/SPI transactions. Some work can be deferred, mostly calls to mac80211 APIs (ieee80211_rx_ni and ieee80211_tx_status). By deferring such work to a different worker, we can keep the irq handler thread more I/O responsive. In addition, on multi-core systems the two threads can be scheduled on different cores, which will improve overall performance. The use of WL1271_FLAG_IRQ_PENDING & WL1271_FLAG_IRQ_RUNNING was changed. For simplicity, always query the FW for more pending interrupts. Since there are relatively long bursts of interrupts, the extra FW status read overhead is negligible. In addition, this enables registering the IRQ handler with the ONESHOT option. Signed-off-by: Ido Yariv <ido@wizery.com> Reviewed-by: Luciano Coelho <coelho@ti.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-03-03wl12xx: Change claiming of the SDIO busIdo Yariv
The SDIO bus is claimed and released for each SDIO transaction. In addition to the few CPU cycles it takes to claim and release the bus, it may also cause undesired side effects such as the MMC host stopping its internal clocks. Since only the wl12xx_sdio driver drives this SDIO card, it is safe to claim the SDIO host once (on power on), and release it only when turning the power off. This patch was inspired by Juuso Oikarinen's (juuso.oikarinen@nokia.com) patch "wl12xx: Change claiming of the (SDIO) bus". Signed-off-by: Ido Yariv <ido@wizery.com> Reviewed-by: Luciano Coelho <coelho@ti.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-03-03wl12xx: Don't rely on runtime PM for toggling powerIdo Yariv
Runtime PM might not always be enabled. Even if it is enabled in the running kernel, it can still be temporarily disabled, for instance during suspend. Runtime PM is opportunistic in nature, and should not be relied on for toggling power. In case the interface is removed and re-added while runtime PM is disabled, the FW will fail to boot, as it is mandatory to toggle power between boots. For instance, this can happen during suspend in case one of the devices fails to suspend before the MMC host suspends, but after mac80211 was suspended. The interface will be removed and reactivated without toggling the power. Fix this by calling mmc_power_save_host/mmc_power_restore_host in wl1271_sdio_power_on/off functions. It will toggle the power to the chip even if runtime PM is disabled. The runtime PM functions should still be called to make sure runtime PM does not opportunistically power the chip off (e.g. after resuming from system suspend). Signed-off-by: Ido Yariv <ido@wizery.com> Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
2011-01-24wl12xx: add missing MODULE_FIRMWARE statment for AP-mode FWArik Nemtsov
In wl12xx cards AP-mode requires a separate FW file. Add this file to the module info. Signed-off-by: Arik Nemtsov <arik@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
2010-11-22wl1271: Change wl12xx Files NamesShahar Levi
All files name prefix removed due to the fact that wl12xx driver supports wl1271 and wl1273. Also the definition in Kconfig and header files changed respectively. Signed-off-by: Shahar Levi <shahar_levi@ti.com> Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>