Commit af9ae09a authored by Glen Lee's avatar Glen Lee Committed by Greg Kroah-Hartman

staging: wilc1000: wilc_wlan.c: remove hif_func of wilc_wlan_dev_t

hif_func of wilc_wlan_dev_t is duplicate because we have same struct
wilc_hif_func ops of struct wilc which is available in wilc_wlan.c.
Rename ops of struct wilc with hif_func and remove hif_func of wilc_wlan_dev_t,
and use wilc->hif_func instead of g_wlan.hif_func in all functions.
Signed-off-by: default avatarGlen Lee <glen.lee@atmel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9e6627ac
...@@ -750,9 +750,9 @@ void wilc1000_wlan_deinit(struct net_device *dev) ...@@ -750,9 +750,9 @@ void wilc1000_wlan_deinit(struct net_device *dev)
PRINT_D(INIT_DBG, "Disabling IRQ\n"); PRINT_D(INIT_DBG, "Disabling IRQ\n");
if (!wl->dev_irq_num && if (!wl->dev_irq_num &&
wl->ops->disable_interrupt) { wl->hif_func->disable_interrupt) {
mutex_lock(&wl->hif_cs); mutex_lock(&wl->hif_cs);
wl->ops->disable_interrupt(wl); wl->hif_func->disable_interrupt(wl);
mutex_unlock(&wl->hif_cs); mutex_unlock(&wl->hif_cs);
} }
if (&wl->txq_event) if (&wl->txq_event)
...@@ -770,12 +770,12 @@ void wilc1000_wlan_deinit(struct net_device *dev) ...@@ -770,12 +770,12 @@ void wilc1000_wlan_deinit(struct net_device *dev)
wilc_wlan_cleanup(dev); wilc_wlan_cleanup(dev);
#if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31) #if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || defined(PLAT_ALLWINNER_A31)
if (!wl->dev_irq_num && if (!wl->dev_irq_num &&
wl->ops->disable_interrupt) { wl->hif_func->disable_interrupt) {
PRINT_D(INIT_DBG, "Disabling IRQ 2\n"); PRINT_D(INIT_DBG, "Disabling IRQ 2\n");
mutex_lock(&wl->hif_cs); mutex_lock(&wl->hif_cs);
wl->ops->disable_interrupt(wl); wl->hif_func->disable_interrupt(wl);
mutex_unlock(&wl->hif_cs); mutex_unlock(&wl->hif_cs);
} }
#endif #endif
...@@ -911,8 +911,8 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) ...@@ -911,8 +911,8 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
} }
if (!wl->dev_irq_num && if (!wl->dev_irq_num &&
wl->ops->enable_interrupt && wl->hif_func->enable_interrupt &&
wl->ops->enable_interrupt(wl)) { wl->hif_func->enable_interrupt(wl)) {
PRINT_ER("couldn't initialize IRQ\n"); PRINT_ER("couldn't initialize IRQ\n");
ret = -EIO; ret = -EIO;
goto _fail_irq_init_; goto _fail_irq_init_;
...@@ -964,8 +964,8 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) ...@@ -964,8 +964,8 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
_fail_irq_enable_: _fail_irq_enable_:
if (!wl->dev_irq_num && if (!wl->dev_irq_num &&
wl->ops->disable_interrupt) wl->hif_func->disable_interrupt)
wl->ops->disable_interrupt(wl); wl->hif_func->disable_interrupt(wl);
_fail_irq_init_: _fail_irq_init_:
if (wl->dev_irq_num) if (wl->dev_irq_num)
deinit_irq(dev); deinit_irq(dev);
...@@ -1438,7 +1438,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, ...@@ -1438,7 +1438,7 @@ int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
*wilc = wl; *wilc = wl;
wl->io_type = io_type; wl->io_type = io_type;
wl->gpio = gpio; wl->gpio = gpio;
wl->ops = ops; wl->hif_func = ops;
register_inetaddr_notifier(&g_dev_notifier); register_inetaddr_notifier(&g_dev_notifier);
......
...@@ -156,7 +156,7 @@ struct wilc_vif { ...@@ -156,7 +156,7 @@ struct wilc_vif {
}; };
struct wilc { struct wilc {
const struct wilc_hif_func *ops; const struct wilc_hif_func *hif_func;
int io_type; int io_type;
int mac_status; int mac_status;
int gpio; int gpio;
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
typedef struct { typedef struct {
int quit; int quit;
int io_type; int io_type;
struct wilc_hif_func hif_func;
int cfg_frame_in_use; int cfg_frame_in_use;
struct wilc_cfg_frame cfg_frame; struct wilc_cfg_frame cfg_frame;
u32 cfg_frame_offset; u32 cfg_frame_offset;
...@@ -564,9 +563,9 @@ static inline void chip_allow_sleep(struct wilc *wilc) ...@@ -564,9 +563,9 @@ static inline void chip_allow_sleep(struct wilc *wilc)
{ {
u32 reg = 0; u32 reg = 0;
g_wlan.hif_func.hif_read_reg(wilc, 0xf0, &reg); wilc->hif_func->hif_read_reg(wilc, 0xf0, &reg);
g_wlan.hif_func.hif_write_reg(wilc, 0xf0, reg & ~BIT(0)); wilc->hif_func->hif_write_reg(wilc, 0xf0, reg & ~BIT(0));
} }
static inline void chip_wakeup(struct wilc *wilc) static inline void chip_wakeup(struct wilc *wilc)
...@@ -576,9 +575,9 @@ static inline void chip_wakeup(struct wilc *wilc) ...@@ -576,9 +575,9 @@ static inline void chip_wakeup(struct wilc *wilc)
if ((g_wlan.io_type & 0x1) == HIF_SPI) { if ((g_wlan.io_type & 0x1) == HIF_SPI) {
do { do {
g_wlan.hif_func.hif_read_reg(wilc, 1, &reg); wilc->hif_func->hif_read_reg(wilc, 1, &reg);
g_wlan.hif_func.hif_write_reg(wilc, 1, reg | BIT(1)); wilc->hif_func->hif_write_reg(wilc, 1, reg | BIT(1));
g_wlan.hif_func.hif_write_reg(wilc, 1, reg & ~BIT(1)); wilc->hif_func->hif_write_reg(wilc, 1, reg & ~BIT(1));
do { do {
usleep_range(2 * 1000, 2 * 1000); usleep_range(2 * 1000, 2 * 1000);
...@@ -589,44 +588,44 @@ static inline void chip_wakeup(struct wilc *wilc) ...@@ -589,44 +588,44 @@ static inline void chip_wakeup(struct wilc *wilc)
} while (wilc_get_chipid(wilc, true) == 0); } while (wilc_get_chipid(wilc, true) == 0);
} else if ((g_wlan.io_type & 0x1) == HIF_SDIO) { } else if ((g_wlan.io_type & 0x1) == HIF_SDIO) {
g_wlan.hif_func.hif_read_reg(wilc, 0xf0, &reg); wilc->hif_func->hif_read_reg(wilc, 0xf0, &reg);
do { do {
g_wlan.hif_func.hif_write_reg(wilc, 0xf0, wilc->hif_func->hif_write_reg(wilc, 0xf0,
reg | BIT(0)); reg | BIT(0));
g_wlan.hif_func.hif_read_reg(wilc, 0xf1, wilc->hif_func->hif_read_reg(wilc, 0xf1,
&clk_status_reg); &clk_status_reg);
while (((clk_status_reg & 0x1) == 0) && (((++trials) % 3) == 0)) { while (((clk_status_reg & 0x1) == 0) && (((++trials) % 3) == 0)) {
usleep_range(2 * 1000, 2 * 1000); usleep_range(2 * 1000, 2 * 1000);
g_wlan.hif_func.hif_read_reg(wilc, 0xf1, wilc->hif_func->hif_read_reg(wilc, 0xf1,
&clk_status_reg); &clk_status_reg);
if ((clk_status_reg & 0x1) == 0) if ((clk_status_reg & 0x1) == 0)
wilc_debug(N_ERR, "clocks still OFF. Wake up failed\n"); wilc_debug(N_ERR, "clocks still OFF. Wake up failed\n");
} }
if ((clk_status_reg & 0x1) == 0) { if ((clk_status_reg & 0x1) == 0) {
g_wlan.hif_func.hif_write_reg(wilc, 0xf0, wilc->hif_func->hif_write_reg(wilc, 0xf0,
reg & (~BIT(0))); reg & (~BIT(0)));
} }
} while ((clk_status_reg & 0x1) == 0); } while ((clk_status_reg & 0x1) == 0);
} }
if (chip_ps_state == CHIP_SLEEPING_MANUAL) { if (chip_ps_state == CHIP_SLEEPING_MANUAL) {
g_wlan.hif_func.hif_read_reg(wilc, 0x1C0C, &reg); wilc->hif_func->hif_read_reg(wilc, 0x1C0C, &reg);
reg &= ~BIT(0); reg &= ~BIT(0);
g_wlan.hif_func.hif_write_reg(wilc, 0x1C0C, reg); wilc->hif_func->hif_write_reg(wilc, 0x1C0C, reg);
if (wilc_get_chipid(wilc, false) >= 0x1002b0) { if (wilc_get_chipid(wilc, false) >= 0x1002b0) {
u32 val32; u32 val32;
g_wlan.hif_func.hif_read_reg(wilc, 0x1e1c, &val32); wilc->hif_func->hif_read_reg(wilc, 0x1e1c, &val32);
val32 |= BIT(6); val32 |= BIT(6);
g_wlan.hif_func.hif_write_reg(wilc, 0x1e1c, val32); wilc->hif_func->hif_write_reg(wilc, 0x1e1c, val32);
g_wlan.hif_func.hif_read_reg(wilc, 0x1e9c, &val32); wilc->hif_func->hif_read_reg(wilc, 0x1e9c, &val32);
val32 |= BIT(6); val32 |= BIT(6);
g_wlan.hif_func.hif_write_reg(wilc, 0x1e9c, val32); wilc->hif_func->hif_write_reg(wilc, 0x1e9c, val32);
} }
} }
chip_ps_state = CHIP_WAKEDUP; chip_ps_state = CHIP_WAKEDUP;
...@@ -638,17 +637,17 @@ static inline void chip_wakeup(struct wilc *wilc) ...@@ -638,17 +637,17 @@ static inline void chip_wakeup(struct wilc *wilc)
do { do {
if ((g_wlan.io_type & 0x1) == HIF_SPI) { if ((g_wlan.io_type & 0x1) == HIF_SPI) {
g_wlan.hif_func.hif_read_reg(wilc, 1, &reg); wilc->hif_func->hif_read_reg(wilc, 1, &reg);
g_wlan.hif_func.hif_write_reg(wilc, 1, reg & ~BIT(1)); wilc->hif_func->hif_write_reg(wilc, 1, reg & ~BIT(1));
g_wlan.hif_func.hif_write_reg(wilc, 1, reg | BIT(1)); wilc->hif_func->hif_write_reg(wilc, 1, reg | BIT(1));
g_wlan.hif_func.hif_write_reg(wilc, 1, reg & ~BIT(1)); wilc->hif_func->hif_write_reg(wilc, 1, reg & ~BIT(1));
} else if ((g_wlan.io_type & 0x1) == HIF_SDIO) { } else if ((g_wlan.io_type & 0x1) == HIF_SDIO) {
g_wlan.hif_func.hif_read_reg(wilc, 0xf0, &reg); wilc->hif_func->hif_read_reg(wilc, 0xf0, &reg);
g_wlan.hif_func.hif_write_reg(wilc, 0xf0, wilc->hif_func->hif_write_reg(wilc, 0xf0,
reg & ~BIT(0)); reg & ~BIT(0));
g_wlan.hif_func.hif_write_reg(wilc, 0xf0, wilc->hif_func->hif_write_reg(wilc, 0xf0,
reg | BIT(0)); reg | BIT(0));
g_wlan.hif_func.hif_write_reg(wilc, 0xf0, wilc->hif_func->hif_write_reg(wilc, 0xf0,
reg & ~BIT(0)); reg & ~BIT(0));
} }
...@@ -663,20 +662,20 @@ static inline void chip_wakeup(struct wilc *wilc) ...@@ -663,20 +662,20 @@ static inline void chip_wakeup(struct wilc *wilc)
} while (wilc_get_chipid(wilc, true) == 0); } while (wilc_get_chipid(wilc, true) == 0);
if (chip_ps_state == CHIP_SLEEPING_MANUAL) { if (chip_ps_state == CHIP_SLEEPING_MANUAL) {
g_wlan.hif_func.hif_read_reg(wilc, 0x1C0C, &reg); wilc->hif_func->hif_read_reg(wilc, 0x1C0C, &reg);
reg &= ~BIT(0); reg &= ~BIT(0);
g_wlan.hif_func.hif_write_reg(wilc, 0x1C0C, reg); wilc->hif_func->hif_write_reg(wilc, 0x1C0C, reg);
if (wilc_get_chipid(wilc, false) >= 0x1002b0) { if (wilc_get_chipid(wilc, false) >= 0x1002b0) {
u32 val32; u32 val32;
g_wlan.hif_func.hif_read_reg(wilc, 0x1e1c, &val32); wilc->hif_func->hif_read_reg(wilc, 0x1e1c, &val32);
val32 |= BIT(6); val32 |= BIT(6);
g_wlan.hif_func.hif_write_reg(wilc, 0x1e1c, val32); wilc->hif_func->hif_write_reg(wilc, 0x1e1c, val32);
g_wlan.hif_func.hif_read_reg(wilc, 0x1e9c, &val32); wilc->hif_func->hif_read_reg(wilc, 0x1e9c, &val32);
val32 |= BIT(6); val32 |= BIT(6);
g_wlan.hif_func.hif_write_reg(wilc, 0x1e9c, val32); wilc->hif_func->hif_write_reg(wilc, 0x1e9c, val32);
} }
} }
chip_ps_state = CHIP_WAKEDUP; chip_ps_state = CHIP_WAKEDUP;
...@@ -691,7 +690,7 @@ void wilc_chip_sleep_manually(struct wilc *wilc) ...@@ -691,7 +690,7 @@ void wilc_chip_sleep_manually(struct wilc *wilc)
#ifdef WILC_OPTIMIZE_SLEEP_INT #ifdef WILC_OPTIMIZE_SLEEP_INT
chip_allow_sleep(wilc); chip_allow_sleep(wilc);
#endif #endif
g_wlan.hif_func.hif_write_reg(wilc, 0x10a8, 1); wilc->hif_func->hif_write_reg(wilc, 0x10a8, 1);
chip_ps_state = CHIP_SLEEPING_MANUAL; chip_ps_state = CHIP_SLEEPING_MANUAL;
release_bus(wilc, RELEASE_ONLY); release_bus(wilc, RELEASE_ONLY);
...@@ -780,7 +779,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) ...@@ -780,7 +779,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
acquire_bus(wilc, ACQUIRE_AND_WAKEUP); acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
counter = 0; counter = 0;
do { do {
ret = p->hif_func.hif_read_reg(wilc, WILC_HOST_TX_CTRL, ret = wilc->hif_func->hif_read_reg(wilc, WILC_HOST_TX_CTRL,
&reg); &reg);
if (!ret) { if (!ret) {
wilc_debug(N_ERR, "[wilc txq]: fail can't read reg vmm_tbl_entry..\n"); wilc_debug(N_ERR, "[wilc txq]: fail can't read reg vmm_tbl_entry..\n");
...@@ -795,7 +794,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) ...@@ -795,7 +794,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
if (counter > 200) { if (counter > 200) {
counter = 0; counter = 0;
PRINT_D(TX_DBG, "Looping in tx ctrl , forcce quit\n"); PRINT_D(TX_DBG, "Looping in tx ctrl , forcce quit\n");
ret = p->hif_func.hif_write_reg(wilc, WILC_HOST_TX_CTRL, 0); ret = wilc->hif_func->hif_write_reg(wilc, WILC_HOST_TX_CTRL, 0);
break; break;
} }
PRINT_WRN(GENERIC_DBG, "[wilc txq]: warn, vmm table not clear yet, wait...\n"); PRINT_WRN(GENERIC_DBG, "[wilc txq]: warn, vmm table not clear yet, wait...\n");
...@@ -810,13 +809,13 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) ...@@ -810,13 +809,13 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
timeout = 200; timeout = 200;
do { do {
ret = p->hif_func.hif_block_tx(wilc, WILC_VMM_TBL_RX_SHADOW_BASE, (u8 *)vmm_table, ((i + 1) * 4)); ret = wilc->hif_func->hif_block_tx(wilc, WILC_VMM_TBL_RX_SHADOW_BASE, (u8 *)vmm_table, ((i + 1) * 4));
if (!ret) { if (!ret) {
wilc_debug(N_ERR, "ERR block TX of VMM table.\n"); wilc_debug(N_ERR, "ERR block TX of VMM table.\n");
break; break;
} }
ret = p->hif_func.hif_write_reg(wilc, WILC_HOST_VMM_CTL, ret = wilc->hif_func->hif_write_reg(wilc, WILC_HOST_VMM_CTL,
0x2); 0x2);
if (!ret) { if (!ret) {
wilc_debug(N_ERR, "[wilc txq]: fail can't write reg host_vmm_ctl..\n"); wilc_debug(N_ERR, "[wilc txq]: fail can't write reg host_vmm_ctl..\n");
...@@ -824,7 +823,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) ...@@ -824,7 +823,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
} }
do { do {
ret = p->hif_func.hif_read_reg(wilc, WILC_HOST_VMM_CTL, &reg); ret = wilc->hif_func->hif_read_reg(wilc, WILC_HOST_VMM_CTL, &reg);
if (!ret) { if (!ret) {
wilc_debug(N_ERR, "[wilc txq]: fail can't read reg host_vmm_ctl..\n"); wilc_debug(N_ERR, "[wilc txq]: fail can't read reg host_vmm_ctl..\n");
break; break;
...@@ -840,7 +839,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) ...@@ -840,7 +839,7 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
} }
} while (--timeout); } while (--timeout);
if (timeout <= 0) { if (timeout <= 0) {
ret = p->hif_func.hif_write_reg(wilc, WILC_HOST_VMM_CTL, 0x0); ret = wilc->hif_func->hif_write_reg(wilc, WILC_HOST_VMM_CTL, 0x0);
break; break;
} }
...@@ -850,13 +849,13 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) ...@@ -850,13 +849,13 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
if (entries == 0) { if (entries == 0) {
PRINT_WRN(GENERIC_DBG, "[wilc txq]: no more buffer in the chip (reg: %08x), retry later [[ %d, %x ]]\n", reg, i, vmm_table[i - 1]); PRINT_WRN(GENERIC_DBG, "[wilc txq]: no more buffer in the chip (reg: %08x), retry later [[ %d, %x ]]\n", reg, i, vmm_table[i - 1]);
ret = p->hif_func.hif_read_reg(wilc, WILC_HOST_TX_CTRL, &reg); ret = wilc->hif_func->hif_read_reg(wilc, WILC_HOST_TX_CTRL, &reg);
if (!ret) { if (!ret) {
wilc_debug(N_ERR, "[wilc txq]: fail can't read reg WILC_HOST_TX_CTRL..\n"); wilc_debug(N_ERR, "[wilc txq]: fail can't read reg WILC_HOST_TX_CTRL..\n");
break; break;
} }
reg &= ~BIT(0); reg &= ~BIT(0);
ret = p->hif_func.hif_write_reg(wilc, WILC_HOST_TX_CTRL, reg); ret = wilc->hif_func->hif_write_reg(wilc, WILC_HOST_TX_CTRL, reg);
if (!ret) { if (!ret) {
wilc_debug(N_ERR, "[wilc txq]: fail can't write reg WILC_HOST_TX_CTRL..\n"); wilc_debug(N_ERR, "[wilc txq]: fail can't write reg WILC_HOST_TX_CTRL..\n");
break; break;
...@@ -928,13 +927,13 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count) ...@@ -928,13 +927,13 @@ int wilc_wlan_handle_txq(struct net_device *dev, u32 *txq_count)
acquire_bus(wilc, ACQUIRE_AND_WAKEUP); acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
ret = p->hif_func.hif_clear_int_ext(wilc, ENABLE_TX_VMM); ret = wilc->hif_func->hif_clear_int_ext(wilc, ENABLE_TX_VMM);
if (!ret) { if (!ret) {
wilc_debug(N_ERR, "[wilc txq]: fail can't start tx VMM ...\n"); wilc_debug(N_ERR, "[wilc txq]: fail can't start tx VMM ...\n");
goto _end_; goto _end_;
} }
ret = p->hif_func.hif_block_tx_ext(wilc, 0, txb, offset); ret = wilc->hif_func->hif_block_tx_ext(wilc, 0, txb, offset);
if (!ret) { if (!ret) {
wilc_debug(N_ERR, "[wilc txq]: fail can't block tx ext...\n"); wilc_debug(N_ERR, "[wilc txq]: fail can't block tx ext...\n");
goto _end_; goto _end_;
...@@ -1053,14 +1052,14 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc) ...@@ -1053,14 +1052,14 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)
static void wilc_unknown_isr_ext(struct wilc *wilc) static void wilc_unknown_isr_ext(struct wilc *wilc)
{ {
g_wlan.hif_func.hif_clear_int_ext(wilc, 0); wilc->hif_func->hif_clear_int_ext(wilc, 0);
} }
static void wilc_pllupdate_isr_ext(struct wilc *wilc, u32 int_stats) static void wilc_pllupdate_isr_ext(struct wilc *wilc, u32 int_stats)
{ {
int trials = 10; int trials = 10;
g_wlan.hif_func.hif_clear_int_ext(wilc, PLL_INT_CLR); wilc->hif_func->hif_clear_int_ext(wilc, PLL_INT_CLR);
if (g_wlan.io_type == HIF_SDIO) if (g_wlan.io_type == HIF_SDIO)
mdelay(WILC_PLL_TO_SDIO); mdelay(WILC_PLL_TO_SDIO);
...@@ -1075,7 +1074,7 @@ static void wilc_pllupdate_isr_ext(struct wilc *wilc, u32 int_stats) ...@@ -1075,7 +1074,7 @@ static void wilc_pllupdate_isr_ext(struct wilc *wilc, u32 int_stats)
static void wilc_sleeptimer_isr_ext(struct wilc *wilc, u32 int_stats1) static void wilc_sleeptimer_isr_ext(struct wilc *wilc, u32 int_stats1)
{ {
g_wlan.hif_func.hif_clear_int_ext(wilc, SLEEP_INT_CLR); wilc->hif_func->hif_clear_int_ext(wilc, SLEEP_INT_CLR);
#ifndef WILC_OPTIMIZE_SLEEP_INT #ifndef WILC_OPTIMIZE_SLEEP_INT
chip_ps_state = CHIP_SLEEPING_AUTO; chip_ps_state = CHIP_SLEEPING_AUTO;
#endif #endif
...@@ -1097,7 +1096,7 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status) ...@@ -1097,7 +1096,7 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status)
u32 time = 0; u32 time = 0;
wilc_debug(N_ERR, "RX Size equal zero ... Trying to read it again for %d time\n", time++); wilc_debug(N_ERR, "RX Size equal zero ... Trying to read it again for %d time\n", time++);
p->hif_func.hif_read_size(wilc, &size); wilc->hif_func->hif_read_size(wilc, &size);
size = ((size & 0x7fff) << 2); size = ((size & 0x7fff) << 2);
retries++; retries++;
} }
...@@ -1113,9 +1112,9 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status) ...@@ -1113,9 +1112,9 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status)
goto _end_; goto _end_;
} }
p->hif_func.hif_clear_int_ext(wilc, wilc->hif_func->hif_clear_int_ext(wilc,
DATA_INT_CLR | ENABLE_RX_VMM); DATA_INT_CLR | ENABLE_RX_VMM);
ret = p->hif_func.hif_block_rx_ext(wilc, 0, buffer, size); ret = wilc->hif_func->hif_block_rx_ext(wilc, 0, buffer, size);
if (!ret) { if (!ret) {
wilc_debug(N_ERR, "[wilc isr]: fail block rx...\n"); wilc_debug(N_ERR, "[wilc isr]: fail block rx...\n");
...@@ -1142,7 +1141,7 @@ void wilc_handle_isr(struct wilc *wilc) ...@@ -1142,7 +1141,7 @@ void wilc_handle_isr(struct wilc *wilc)
u32 int_status; u32 int_status;
acquire_bus(wilc, ACQUIRE_AND_WAKEUP); acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
g_wlan.hif_func.hif_read_int(wilc, &int_status); wilc->hif_func->hif_read_int(wilc, &int_status);
if (int_status & PLL_INT_EXT) if (int_status & PLL_INT_EXT)
wilc_pllupdate_isr_ext(wilc, int_status); wilc_pllupdate_isr_ext(wilc, int_status);
...@@ -1165,7 +1164,6 @@ EXPORT_SYMBOL_GPL(wilc_handle_isr); ...@@ -1165,7 +1164,6 @@ EXPORT_SYMBOL_GPL(wilc_handle_isr);
int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer, u32 buffer_size) int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer, u32 buffer_size)
{ {
wilc_wlan_dev_t *p = &g_wlan;
u32 offset; u32 offset;
u32 addr, size, size2, blksz; u32 addr, size, size2, blksz;
u8 *dma_buffer; u8 *dma_buffer;
...@@ -1197,7 +1195,7 @@ int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer, u32 buffer_ ...@@ -1197,7 +1195,7 @@ int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer, u32 buffer_
size2 = blksz; size2 = blksz;
memcpy(dma_buffer, &buffer[offset], size2); memcpy(dma_buffer, &buffer[offset], size2);
ret = p->hif_func.hif_block_tx(wilc, addr, dma_buffer, ret = wilc->hif_func->hif_block_tx(wilc, addr, dma_buffer,
size2); size2);
if (!ret) if (!ret)
break; break;
...@@ -1239,7 +1237,7 @@ int wilc_wlan_start(struct wilc *wilc) ...@@ -1239,7 +1237,7 @@ int wilc_wlan_start(struct wilc *wilc)
reg = 1; reg = 1;
} }
acquire_bus(wilc, ACQUIRE_ONLY); acquire_bus(wilc, ACQUIRE_ONLY);
ret = p->hif_func.hif_write_reg(wilc, WILC_VMM_CORE_CFG, reg); ret = wilc->hif_func->hif_write_reg(wilc, WILC_VMM_CORE_CFG, reg);
if (!ret) { if (!ret) {
wilc_debug(N_ERR, "[wilc start]: fail write reg vmm_core_cfg...\n"); wilc_debug(N_ERR, "[wilc start]: fail write reg vmm_core_cfg...\n");
release_bus(wilc, RELEASE_ONLY); release_bus(wilc, RELEASE_ONLY);
...@@ -1273,7 +1271,7 @@ int wilc_wlan_start(struct wilc *wilc) ...@@ -1273,7 +1271,7 @@ int wilc_wlan_start(struct wilc *wilc)
reg |= WILC_HAVE_DISABLE_WILC_UART; reg |= WILC_HAVE_DISABLE_WILC_UART;
#endif #endif
ret = p->hif_func.hif_write_reg(wilc, WILC_GP_REG_1, reg); ret = wilc->hif_func->hif_write_reg(wilc, WILC_GP_REG_1, reg);
if (!ret) { if (!ret) {
wilc_debug(N_ERR, "[wilc start]: fail write WILC_GP_REG_1 ...\n"); wilc_debug(N_ERR, "[wilc start]: fail write WILC_GP_REG_1 ...\n");
release_bus(wilc, RELEASE_ONLY); release_bus(wilc, RELEASE_ONLY);
...@@ -1281,9 +1279,9 @@ int wilc_wlan_start(struct wilc *wilc) ...@@ -1281,9 +1279,9 @@ int wilc_wlan_start(struct wilc *wilc)
return ret; return ret;
} }
p->hif_func.hif_sync_ext(wilc, NUM_INT_EXT); wilc->hif_func->hif_sync_ext(wilc, NUM_INT_EXT);
ret = p->hif_func.hif_read_reg(wilc, 0x1000, &chipid); ret = wilc->hif_func->hif_read_reg(wilc, 0x1000, &chipid);
if (!ret) { if (!ret) {
wilc_debug(N_ERR, "[wilc start]: fail read reg 0x1000 ...\n"); wilc_debug(N_ERR, "[wilc start]: fail read reg 0x1000 ...\n");
release_bus(wilc, RELEASE_ONLY); release_bus(wilc, RELEASE_ONLY);
...@@ -1291,16 +1289,16 @@ int wilc_wlan_start(struct wilc *wilc) ...@@ -1291,16 +1289,16 @@ int wilc_wlan_start(struct wilc *wilc)
return ret; return ret;
} }
p->hif_func.hif_read_reg(wilc, WILC_GLB_RESET_0, &reg); wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, &reg);
if ((reg & BIT(10)) == BIT(10)) { if ((reg & BIT(10)) == BIT(10)) {
reg &= ~BIT(10); reg &= ~BIT(10);
p->hif_func.hif_write_reg(wilc, WILC_GLB_RESET_0, reg); wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0, reg);
p->hif_func.hif_read_reg(wilc, WILC_GLB_RESET_0, &reg); wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, &reg);
} }
reg |= BIT(10); reg |= BIT(10);
ret = p->hif_func.hif_write_reg(wilc, WILC_GLB_RESET_0, reg); ret = wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0, reg);
p->hif_func.hif_read_reg(wilc, WILC_GLB_RESET_0, &reg); wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, &reg);
release_bus(wilc, RELEASE_ONLY); release_bus(wilc, RELEASE_ONLY);
return (ret < 0) ? ret : 0; return (ret < 0) ? ret : 0;
...@@ -1308,22 +1306,18 @@ int wilc_wlan_start(struct wilc *wilc) ...@@ -1308,22 +1306,18 @@ int wilc_wlan_start(struct wilc *wilc)
void wilc_wlan_global_reset(struct wilc *wilc) void wilc_wlan_global_reset(struct wilc *wilc)
{ {
wilc_wlan_dev_t *p = &g_wlan;
acquire_bus(wilc, ACQUIRE_AND_WAKEUP); acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
p->hif_func.hif_write_reg(wilc, WILC_GLB_RESET_0, 0x0); wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0, 0x0);
release_bus(wilc, RELEASE_ONLY); release_bus(wilc, RELEASE_ONLY);
} }
int wilc_wlan_stop(struct wilc *wilc) int wilc_wlan_stop(struct wilc *wilc)
{ {
wilc_wlan_dev_t *p = &g_wlan;
u32 reg = 0; u32 reg = 0;
int ret; int ret;
u8 timeout = 10; u8 timeout = 10;
acquire_bus(wilc, ACQUIRE_AND_WAKEUP); acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
ret = p->hif_func.hif_read_reg(wilc, WILC_GLB_RESET_0, &reg); ret = wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, &reg);
if (!ret) { if (!ret) {
PRINT_ER("Error while reading reg\n"); PRINT_ER("Error while reading reg\n");
release_bus(wilc, RELEASE_ALLOW_SLEEP); release_bus(wilc, RELEASE_ALLOW_SLEEP);
...@@ -1331,7 +1325,7 @@ int wilc_wlan_stop(struct wilc *wilc) ...@@ -1331,7 +1325,7 @@ int wilc_wlan_stop(struct wilc *wilc)
} }
reg &= ~BIT(10); reg &= ~BIT(10);
ret = p->hif_func.hif_write_reg(wilc, WILC_GLB_RESET_0, reg); ret = wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0, reg);
if (!ret) { if (!ret) {
PRINT_ER("Error while writing reg\n"); PRINT_ER("Error while writing reg\n");
release_bus(wilc, RELEASE_ALLOW_SLEEP); release_bus(wilc, RELEASE_ALLOW_SLEEP);
...@@ -1339,7 +1333,7 @@ int wilc_wlan_stop(struct wilc *wilc) ...@@ -1339,7 +1333,7 @@ int wilc_wlan_stop(struct wilc *wilc)
} }
do { do {
ret = p->hif_func.hif_read_reg(wilc, WILC_GLB_RESET_0, &reg); ret = wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, &reg);
if (!ret) { if (!ret) {
PRINT_ER("Error while reading reg\n"); PRINT_ER("Error while reading reg\n");
release_bus(wilc, RELEASE_ALLOW_SLEEP); release_bus(wilc, RELEASE_ALLOW_SLEEP);
...@@ -1352,13 +1346,13 @@ int wilc_wlan_stop(struct wilc *wilc) ...@@ -1352,13 +1346,13 @@ int wilc_wlan_stop(struct wilc *wilc)
PRINT_D(GENERIC_DBG, "Bit 10 not reset : Retry %d\n", PRINT_D(GENERIC_DBG, "Bit 10 not reset : Retry %d\n",
timeout); timeout);
reg &= ~BIT(10); reg &= ~BIT(10);
ret = p->hif_func.hif_write_reg(wilc, WILC_GLB_RESET_0, ret = wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0,
reg); reg);
timeout--; timeout--;
} else { } else {
PRINT_D(GENERIC_DBG, "Bit 10 reset after : Retry %d\n", PRINT_D(GENERIC_DBG, "Bit 10 reset after : Retry %d\n",
timeout); timeout);
ret = p->hif_func.hif_read_reg(wilc, WILC_GLB_RESET_0, ret = wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0,
&reg); &reg);
if (!ret) { if (!ret) {
PRINT_ER("Error while reading reg\n"); PRINT_ER("Error while reading reg\n");
...@@ -1374,10 +1368,10 @@ int wilc_wlan_stop(struct wilc *wilc) ...@@ -1374,10 +1368,10 @@ int wilc_wlan_stop(struct wilc *wilc)
reg = (BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(8) | BIT(9) | BIT(26) | reg = (BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(8) | BIT(9) | BIT(26) |
BIT(29) | BIT(30) | BIT(31)); BIT(29) | BIT(30) | BIT(31));
p->hif_func.hif_write_reg(wilc, WILC_GLB_RESET_0, reg); wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0, reg);
reg = (u32)~BIT(10); reg = (u32)~BIT(10);
ret = p->hif_func.hif_write_reg(wilc, WILC_GLB_RESET_0, reg); ret = wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0, reg);
release_bus(wilc, RELEASE_ALLOW_SLEEP); release_bus(wilc, RELEASE_ALLOW_SLEEP);
...@@ -1420,20 +1414,20 @@ void wilc_wlan_cleanup(struct net_device *dev) ...@@ -1420,20 +1414,20 @@ void wilc_wlan_cleanup(struct net_device *dev)
acquire_bus(wilc, ACQUIRE_AND_WAKEUP); acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
ret = p->hif_func.hif_read_reg(wilc, WILC_GP_REG_0, &reg); ret = wilc->hif_func->hif_read_reg(wilc, WILC_GP_REG_0, &reg);
if (!ret) { if (!ret) {
PRINT_ER("Error while reading reg\n"); PRINT_ER("Error while reading reg\n");
release_bus(wilc, RELEASE_ALLOW_SLEEP); release_bus(wilc, RELEASE_ALLOW_SLEEP);
} }
PRINT_ER("Writing ABORT reg\n"); PRINT_ER("Writing ABORT reg\n");
ret = p->hif_func.hif_write_reg(wilc, WILC_GP_REG_0, ret = wilc->hif_func->hif_write_reg(wilc, WILC_GP_REG_0,
(reg | ABORT_INT)); (reg | ABORT_INT));
if (!ret) { if (!ret) {
PRINT_ER("Error while writing reg\n"); PRINT_ER("Error while writing reg\n");
release_bus(wilc, RELEASE_ALLOW_SLEEP); release_bus(wilc, RELEASE_ALLOW_SLEEP);
} }
release_bus(wilc, RELEASE_ALLOW_SLEEP); release_bus(wilc, RELEASE_ALLOW_SLEEP);
p->hif_func.hif_deinit(NULL); wilc->hif_func->hif_deinit(NULL);
} }
static int wilc_wlan_cfg_commit(struct wilc *wilc, int type, u32 drv_handler) static int wilc_wlan_cfg_commit(struct wilc *wilc, int type, u32 drv_handler)
...@@ -1566,18 +1560,18 @@ static u32 init_chip(struct net_device *dev) ...@@ -1566,18 +1560,18 @@ static u32 init_chip(struct net_device *dev)
chipid = wilc_get_chipid(wilc, true); chipid = wilc_get_chipid(wilc, true);
if ((chipid & 0xfff) != 0xa0) { if ((chipid & 0xfff) != 0xa0) {
ret = g_wlan.hif_func.hif_read_reg(wilc, 0x1118, &reg); ret = wilc->hif_func->hif_read_reg(wilc, 0x1118, &reg);
if (!ret) { if (!ret) {
wilc_debug(N_ERR, "[wilc start]: fail read reg 0x1118 ...\n"); wilc_debug(N_ERR, "[wilc start]: fail read reg 0x1118 ...\n");
return ret; return ret;
} }
reg |= BIT(0); reg |= BIT(0);
ret = g_wlan.hif_func.hif_write_reg(wilc, 0x1118, reg); ret = wilc->hif_func->hif_write_reg(wilc, 0x1118, reg);
if (!ret) { if (!ret) {
wilc_debug(N_ERR, "[wilc start]: fail write reg 0x1118 ...\n"); wilc_debug(N_ERR, "[wilc start]: fail write reg 0x1118 ...\n");
return ret; return ret;
} }
ret = g_wlan.hif_func.hif_write_reg(wilc, 0xc0000, 0x71); ret = wilc->hif_func->hif_write_reg(wilc, 0xc0000, 0x71);
if (!ret) { if (!ret) {
wilc_debug(N_ERR, "[wilc start]: fail write reg 0xc0000 ...\n"); wilc_debug(N_ERR, "[wilc start]: fail write reg 0xc0000 ...\n");
return ret; return ret;
...@@ -1596,8 +1590,8 @@ u32 wilc_get_chipid(struct wilc *wilc, u8 update) ...@@ -1596,8 +1590,8 @@ u32 wilc_get_chipid(struct wilc *wilc, u8 update)
u32 rfrevid; u32 rfrevid;
if (chipid == 0 || update != 0) { if (chipid == 0 || update != 0) {
g_wlan.hif_func.hif_read_reg(wilc, 0x1000, &tempchipid); wilc->hif_func->hif_read_reg(wilc, 0x1000, &tempchipid);
g_wlan.hif_func.hif_read_reg(wilc, 0x13f4, &rfrevid); wilc->hif_func->hif_read_reg(wilc, 0x13f4, &rfrevid);
if (!ISWILC1000(tempchipid)) { if (!ISWILC1000(tempchipid)) {
chipid = 0; chipid = 0;
goto _fail_; goto _fail_;
...@@ -1634,8 +1628,7 @@ int wilc_wlan_init(struct net_device *dev) ...@@ -1634,8 +1628,7 @@ int wilc_wlan_init(struct net_device *dev)
memset((void *)&g_wlan, 0, sizeof(wilc_wlan_dev_t)); memset((void *)&g_wlan, 0, sizeof(wilc_wlan_dev_t));
g_wlan.io_type = wilc->io_type; g_wlan.io_type = wilc->io_type;
g_wlan.hif_func = *wilc->ops; if (!wilc->hif_func->hif_init(wilc, wilc_debug)) {
if (!g_wlan.hif_func.hif_init(wilc, wilc_debug)) {
ret = -EIO; ret = -EIO;
goto _fail_; goto _fail_;
} }
...@@ -1695,7 +1688,7 @@ u16 wilc_set_machw_change_vir_if(struct net_device *dev, bool value) ...@@ -1695,7 +1688,7 @@ u16 wilc_set_machw_change_vir_if(struct net_device *dev, bool value)
wilc = nic->wilc; wilc = nic->wilc;
mutex_lock(&wilc->hif_cs); mutex_lock(&wilc->hif_cs);
ret = (&g_wlan)->hif_func.hif_read_reg(wilc, WILC_CHANGING_VIR_IF, ret = wilc->hif_func->hif_read_reg(wilc, WILC_CHANGING_VIR_IF,
&reg); &reg);
if (!ret) if (!ret)
PRINT_ER("Error while Reading reg WILC_CHANGING_VIR_IF\n"); PRINT_ER("Error while Reading reg WILC_CHANGING_VIR_IF\n");
...@@ -1705,7 +1698,7 @@ u16 wilc_set_machw_change_vir_if(struct net_device *dev, bool value) ...@@ -1705,7 +1698,7 @@ u16 wilc_set_machw_change_vir_if(struct net_device *dev, bool value)
else else
reg &= ~BIT(31); reg &= ~BIT(31);
ret = (&g_wlan)->hif_func.hif_write_reg(wilc, WILC_CHANGING_VIR_IF, ret = wilc->hif_func->hif_write_reg(wilc, WILC_CHANGING_VIR_IF,
reg); reg);
if (!ret) if (!ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment