diff options
Diffstat (limited to 'mac80211/compat_wl18xx/drivers/net/wireless/ti/wlcore')
5 files changed, 68 insertions, 10 deletions
diff --git a/mac80211/compat_wl18xx/drivers/net/wireless/ti/wlcore/debugfs.c b/mac80211/compat_wl18xx/drivers/net/wireless/ti/wlcore/debugfs.c index aba2dcba..754752a1 100644 --- a/mac80211/compat_wl18xx/drivers/net/wireless/ti/wlcore/debugfs.c +++ b/mac80211/compat_wl18xx/drivers/net/wireless/ti/wlcore/debugfs.c @@ -741,7 +741,7 @@ static ssize_t driver_state_read(struct file *file, char __user *user_buf, DRIVER_STATE_PRINT_INT(sg_enabled); DRIVER_STATE_PRINT_INT(enable_11a); DRIVER_STATE_PRINT_INT(noise); - DRIVER_STATE_PRINT_HEX(ap_fw_ps_map); + DRIVER_STATE_PRINT_LHEX(ap_fw_ps_map); DRIVER_STATE_PRINT_LHEX(ap_ps_map); DRIVER_STATE_PRINT_HEX(quirks); DRIVER_STATE_PRINT_HEX(irq); diff --git a/mac80211/compat_wl18xx/drivers/net/wireless/ti/wlcore/main.c b/mac80211/compat_wl18xx/drivers/net/wireless/ti/wlcore/main.c index d2e81018..2992aaab 100644 --- a/mac80211/compat_wl18xx/drivers/net/wireless/ti/wlcore/main.c +++ b/mac80211/compat_wl18xx/drivers/net/wireless/ti/wlcore/main.c @@ -333,7 +333,7 @@ static void wl12xx_irq_ps_regulate_link(struct wl1271 *wl, { bool fw_ps; - fw_ps = test_bit(hlid, (unsigned long *)&wl->ap_fw_ps_map); + fw_ps = test_bit(hlid, &wl->ap_fw_ps_map); /* * Wake up from high level PS if the STA is asleep with too little @@ -360,13 +360,13 @@ static void wl12xx_irq_update_links_status(struct wl1271 *wl, struct wl12xx_vif *wlvif, struct wl_fw_status *status) { - u32 cur_fw_ps_map; + unsigned long cur_fw_ps_map; u8 hlid; cur_fw_ps_map = status->link_ps_bitmap; if (wl->ap_fw_ps_map != cur_fw_ps_map) { wl1271_debug(DEBUG_PSM, - "link ps prev 0x%x cur 0x%x changed 0x%x", + "link ps prev 0x%lx cur 0x%lx changed 0x%lx", wl->ap_fw_ps_map, cur_fw_ps_map, wl->ap_fw_ps_map ^ cur_fw_ps_map); @@ -5002,7 +5002,7 @@ void wl1271_free_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 hlid) clear_bit(hlid, wlvif->ap.sta_hlid_map); __clear_bit(hlid, &wl->ap_ps_map); - __clear_bit(hlid, (unsigned long *)&wl->ap_fw_ps_map); + __clear_bit(hlid, &wl->ap_fw_ps_map); /* * save the last used PN in the private part of iee80211_sta, diff --git a/mac80211/compat_wl18xx/drivers/net/wireless/ti/wlcore/sdio.c b/mac80211/compat_wl18xx/drivers/net/wireless/ti/wlcore/sdio.c index 4ed5a156..c9249fe3 100644 --- a/mac80211/compat_wl18xx/drivers/net/wireless/ti/wlcore/sdio.c +++ b/mac80211/compat_wl18xx/drivers/net/wireless/ti/wlcore/sdio.c @@ -35,6 +35,7 @@ #include <linux/pm_runtime.h> #include <linux/printk.h> #include <linux/of.h> +#include <linux/of_irq.h> #include "wlcore.h" #include "wl12xx_80211.h" @@ -215,6 +216,49 @@ static struct wl1271_if_operations sdio_ops = { .set_block_size = wl1271_sdio_set_block_size, }; +#ifdef CONFIG_OF +/* backport dt parsing function from upstream */ +static struct wl12xx_platform_data *wlcore_probe_of(struct device *dev) +{ + struct device_node *np = dev->of_node; + struct wl12xx_platform_data *pdata; + bool need_put_node = false; + + if (!np || !of_device_is_compatible(np, "ti,wlcore")) { + np = of_find_compatible_node(NULL, NULL, "ti,wlcore"); + if (!np) { + dev_err(dev, "No platform data set\n"); + return NULL; + } + need_put_node = true; + } + + pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); + if (!pdata) { + dev_err(dev, "Can't allocate platform data\n"); + goto err; + } + + pdata->irq = irq_of_parse_and_map(np, 0); + if (!pdata->irq) { + dev_err(dev, "No irq in platform data\n"); + goto err; + } + + /* Optional fields */ + of_property_read_u32(np, "board-ref-clock", &pdata->board_ref_clock); + of_property_read_u32(np, "board-tcxo-clock", &pdata->board_tcxo_clock); + of_property_read_u32(np, "platform-quirks", &pdata->platform_quirks); + + return pdata; +err: + if (need_put_node) + of_node_put(np); + kfree(pdata); + return NULL; +} +#endif + static const struct of_device_id wlcore_of_match[] = { { .compatible = "wlcore", @@ -233,6 +277,12 @@ static struct wl12xx_platform_data *get_platform_data(struct device *dev) return kmemdup(pdata, sizeof(*pdata), GFP_KERNEL); #ifdef CONFIG_OF + /* first, try looking for "upstream" dt */ + pdata = wlcore_probe_of(dev); + if (pdata) + return pdata; + + /* if not found, look for our deprecated dt */ np = of_find_matching_node(NULL, wlcore_of_match); if (!np) { dev_err(dev, "No platform data set\n"); @@ -408,8 +458,16 @@ static int wl1271_suspend(struct device *dev) dev_dbg(dev, "wl1271 suspend. wow_enabled: %d\n", wl->wow_enabled); - /* check whether sdio should keep power */ - if (wl->wow_enabled) { + /* + * check whether sdio should keep power. + * due to some mmc layer issues, the system automatically + * powers us up on resume, which later cause issues when + * we try to restore_power again explicitly. + * workaround it by always asking to keep power. this is + * fine as the driver controls the chip power anyway. + * TODO: remove it when mmc issue is fixed. + */ + if (true || wl->wow_enabled) { sdio_flags = sdio_get_host_pm_caps(func); if (!(sdio_flags & MMC_PM_KEEP_POWER)) { diff --git a/mac80211/compat_wl18xx/drivers/net/wireless/ti/wlcore/tx.c b/mac80211/compat_wl18xx/drivers/net/wireless/ti/wlcore/tx.c index a07a4863..1a0dbe0c 100644 --- a/mac80211/compat_wl18xx/drivers/net/wireless/ti/wlcore/tx.c +++ b/mac80211/compat_wl18xx/drivers/net/wireless/ti/wlcore/tx.c @@ -126,7 +126,7 @@ static void wl1271_tx_regulate_link(struct wl1271 *wl, if (WARN_ON(!test_bit(hlid, wlvif->links_map))) return; - fw_ps = test_bit(hlid, (unsigned long *)&wl->ap_fw_ps_map); + fw_ps = test_bit(hlid, &wl->ap_fw_ps_map); tx_pkts = wl->links[hlid].allocated_pkts; /* diff --git a/mac80211/compat_wl18xx/drivers/net/wireless/ti/wlcore/wlcore.h b/mac80211/compat_wl18xx/drivers/net/wireless/ti/wlcore/wlcore.h index 1b3797ea..830f9c38 100644 --- a/mac80211/compat_wl18xx/drivers/net/wireless/ti/wlcore/wlcore.h +++ b/mac80211/compat_wl18xx/drivers/net/wireless/ti/wlcore/wlcore.h @@ -407,10 +407,10 @@ struct wl1271 { int active_link_count; /* Fast/slow links bitmap according to FW */ - u32 fw_fast_lnk_map; + unsigned long fw_fast_lnk_map; /* AP-mode - a bitmap of links currently in PS mode according to FW */ - u32 ap_fw_ps_map; + unsigned long ap_fw_ps_map; /* AP-mode - a bitmap of links currently in PS mode in mac80211 */ unsigned long ap_ps_map; |