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

staging: wilc1000: remove define WILC_OPTIMIZE_SLEEP_INT

Take the codes of WILC_OPTIMIZE_SLEEP_INT and remove codes inside ifndef.
Signed-off-by: default avatarGlen Lee <glen.lee@atmel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0c94df02
...@@ -3,9 +3,7 @@ ...@@ -3,9 +3,7 @@
#include "wilc_wfi_netdevice.h" #include "wilc_wfi_netdevice.h"
#include "wilc_wlan_cfg.h" #include "wilc_wlan_cfg.h"
#ifdef WILC_OPTIMIZE_SLEEP_INT
static inline void chip_allow_sleep(struct wilc *wilc); static inline void chip_allow_sleep(struct wilc *wilc);
#endif
static inline void chip_wakeup(struct wilc *wilc); static inline void chip_wakeup(struct wilc *wilc);
static u32 dbgflag = N_INIT | N_ERR | N_INTR | N_TXQ | N_RXQ; static u32 dbgflag = N_INIT | N_ERR | N_INTR | N_TXQ | N_RXQ;
...@@ -29,21 +27,14 @@ static CHIP_PS_STATE_T chip_ps_state = CHIP_WAKEDUP; ...@@ -29,21 +27,14 @@ static CHIP_PS_STATE_T chip_ps_state = CHIP_WAKEDUP;
static inline void acquire_bus(struct wilc *wilc, BUS_ACQUIRE_T acquire) static inline void acquire_bus(struct wilc *wilc, BUS_ACQUIRE_T acquire)
{ {
mutex_lock(&wilc->hif_cs); mutex_lock(&wilc->hif_cs);
#ifndef WILC_OPTIMIZE_SLEEP_INT
if (chip_ps_state != CHIP_WAKEDUP)
#endif
{
if (acquire == ACQUIRE_AND_WAKEUP) if (acquire == ACQUIRE_AND_WAKEUP)
chip_wakeup(wilc); chip_wakeup(wilc);
}
} }
static inline void release_bus(struct wilc *wilc, BUS_RELEASE_T release) static inline void release_bus(struct wilc *wilc, BUS_RELEASE_T release)
{ {
#ifdef WILC_OPTIMIZE_SLEEP_INT
if (release == RELEASE_ALLOW_SLEEP) if (release == RELEASE_ALLOW_SLEEP)
chip_allow_sleep(wilc); chip_allow_sleep(wilc);
#endif
mutex_unlock(&wilc->hif_cs); mutex_unlock(&wilc->hif_cs);
} }
...@@ -524,8 +515,6 @@ static struct rxq_entry_t *wilc_wlan_rxq_remove(struct wilc *wilc) ...@@ -524,8 +515,6 @@ static struct rxq_entry_t *wilc_wlan_rxq_remove(struct wilc *wilc)
return NULL; return NULL;
} }
#ifdef WILC_OPTIMIZE_SLEEP_INT
static inline void chip_allow_sleep(struct wilc *wilc) static inline void chip_allow_sleep(struct wilc *wilc)
{ {
u32 reg = 0; u32 reg = 0;
...@@ -538,7 +527,6 @@ static inline void chip_allow_sleep(struct wilc *wilc) ...@@ -538,7 +527,6 @@ static inline void chip_allow_sleep(struct wilc *wilc)
static inline void chip_wakeup(struct wilc *wilc) static inline void chip_wakeup(struct wilc *wilc)
{ {
u32 reg, clk_status_reg, trials = 0; u32 reg, clk_status_reg, trials = 0;
u32 sleep_time;
if ((wilc->io_type & 0x1) == HIF_SPI) { if ((wilc->io_type & 0x1) == HIF_SPI) {
do { do {
...@@ -597,66 +585,14 @@ static inline void chip_wakeup(struct wilc *wilc) ...@@ -597,66 +585,14 @@ static inline void chip_wakeup(struct wilc *wilc)
} }
chip_ps_state = CHIP_WAKEDUP; chip_ps_state = CHIP_WAKEDUP;
} }
#else
static inline void chip_wakeup(struct wilc *wilc)
{
u32 reg, trials = 0;
do {
if ((wilc->io_type & 0x1) == HIF_SPI) {
wilc->hif_func->hif_read_reg(wilc, 1, &reg);
wilc->hif_func->hif_write_reg(wilc, 1, reg & ~BIT(1));
wilc->hif_func->hif_write_reg(wilc, 1, reg | BIT(1));
wilc->hif_func->hif_write_reg(wilc, 1, reg & ~BIT(1));
} else if ((wilc->io_type & 0x1) == HIF_SDIO) {
wilc->hif_func->hif_read_reg(wilc, 0xf0, &reg);
wilc->hif_func->hif_write_reg(wilc, 0xf0,
reg & ~BIT(0));
wilc->hif_func->hif_write_reg(wilc, 0xf0,
reg | BIT(0));
wilc->hif_func->hif_write_reg(wilc, 0xf0,
reg & ~BIT(0));
}
do {
mdelay(3);
if ((wilc_get_chipid(wilc, true) == 0))
wilc_debug(N_ERR, "Couldn't read chip id. Wake up failed\n");
} while ((wilc_get_chipid(wilc, true) == 0) && ((++trials % 3) == 0));
} while (wilc_get_chipid(wilc, true) == 0);
if (chip_ps_state == CHIP_SLEEPING_MANUAL) {
wilc->hif_func->hif_read_reg(wilc, 0x1C0C, &reg);
reg &= ~BIT(0);
wilc->hif_func->hif_write_reg(wilc, 0x1C0C, reg);
if (wilc_get_chipid(wilc, false) >= 0x1002b0) {
u32 val32;
wilc->hif_func->hif_read_reg(wilc, 0x1e1c, &val32);
val32 |= BIT(6);
wilc->hif_func->hif_write_reg(wilc, 0x1e1c, val32);
wilc->hif_func->hif_read_reg(wilc, 0x1e9c, &val32);
val32 |= BIT(6);
wilc->hif_func->hif_write_reg(wilc, 0x1e9c, val32);
}
}
chip_ps_state = CHIP_WAKEDUP;
}
#endif
void wilc_chip_sleep_manually(struct wilc *wilc) void wilc_chip_sleep_manually(struct wilc *wilc)
{ {
if (chip_ps_state != CHIP_WAKEDUP) if (chip_ps_state != CHIP_WAKEDUP)
return; return;
acquire_bus(wilc, ACQUIRE_ONLY); acquire_bus(wilc, ACQUIRE_ONLY);
#ifdef WILC_OPTIMIZE_SLEEP_INT
chip_allow_sleep(wilc); chip_allow_sleep(wilc);
#endif
wilc->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;
...@@ -1041,9 +977,6 @@ static void wilc_pllupdate_isr_ext(struct wilc *wilc, u32 int_stats) ...@@ -1041,9 +977,6 @@ 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)
{ {
wilc->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
chip_ps_state = CHIP_SLEEPING_AUTO;
#endif
} }
static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status) static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status)
...@@ -1113,9 +1046,6 @@ void wilc_handle_isr(struct wilc *wilc) ...@@ -1113,9 +1046,6 @@ void wilc_handle_isr(struct wilc *wilc)
if (int_status & DATA_INT_EXT) { if (int_status & DATA_INT_EXT) {
wilc_wlan_handle_isr_ext(wilc, int_status); wilc_wlan_handle_isr_ext(wilc, int_status);
#ifndef WILC_OPTIMIZE_SLEEP_INT
chip_ps_state = CHIP_WAKEDUP;
#endif
} }
if (int_status & SLEEP_INT_EXT) if (int_status & SLEEP_INT_EXT)
wilc_sleeptimer_isr_ext(wilc, int_status); wilc_sleeptimer_isr_ext(wilc, int_status);
......
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