Commit 4bd7baf0 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Greg Kroah-Hartman

staging/wilc1000: move wilc_wlan_inp_t into struct wilc

wilc_wlan_inp_t is an unnecessary indirection and requires linux_wlan.c
to have knowledge of the specific sdio and spi front-ends. This
removes the structure and places io_type directly inside the struct wilc.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 25ad41cb
...@@ -839,17 +839,6 @@ static int wlan_deinit_locks(struct net_device *dev) ...@@ -839,17 +839,6 @@ static int wlan_deinit_locks(struct net_device *dev)
return 0; return 0;
} }
static void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
{
PRINT_D(INIT_DBG, "Linux to Wlan services ...\n");
#ifdef WILC_SDIO
nwi->io_func.io_type = HIF_SDIO;
#else
nwi->io_func.io_type = HIF_SPI;
#endif
}
static int wlan_initialize_threads(struct net_device *dev) static int wlan_initialize_threads(struct net_device *dev)
{ {
perInterface_wlan_t *nic; perInterface_wlan_t *nic;
...@@ -893,7 +882,6 @@ static void wlan_deinitialize_threads(struct net_device *dev) ...@@ -893,7 +882,6 @@ static void wlan_deinitialize_threads(struct net_device *dev)
int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
{ {
wilc_wlan_inp_t nwi;
perInterface_wlan_t *nic = p_nic; perInterface_wlan_t *nic = p_nic;
int ret = 0; int ret = 0;
struct wilc *wl = nic->wilc; struct wilc *wl = nic->wilc;
...@@ -904,9 +892,12 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic) ...@@ -904,9 +892,12 @@ int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
wlan_init_locks(dev); wlan_init_locks(dev);
linux_to_wlan(&nwi, wl); #ifdef WILC_SDIO
wl->io_type = HIF_SDIO;
ret = wilc_wlan_init(dev, &nwi); #else
wl->io_type = HIF_SPI;
#endif
ret = wilc_wlan_init(dev);
if (ret < 0) { if (ret < 0) {
PRINT_ER("Initializing WILC_Wlan FAILED\n"); PRINT_ER("Initializing WILC_Wlan FAILED\n");
ret = -EIO; ret = -EIO;
......
...@@ -156,6 +156,7 @@ struct wilc_vif { ...@@ -156,6 +156,7 @@ struct wilc_vif {
}; };
struct wilc { struct wilc {
int io_type;
int mac_status; int mac_status;
bool initialized; bool initialized;
#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO) #if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
typedef struct { typedef struct {
int quit; int quit;
wilc_wlan_io_func_t io_func; int io_type;
struct wilc_hif_func hif_func; 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;
...@@ -576,7 +576,7 @@ static inline void chip_wakeup(void) ...@@ -576,7 +576,7 @@ static inline void chip_wakeup(void)
u32 reg, clk_status_reg, trials = 0; u32 reg, clk_status_reg, trials = 0;
u32 sleep_time; u32 sleep_time;
if ((g_wlan.io_func.io_type & 0x1) == HIF_SPI) { if ((g_wlan.io_type & 0x1) == HIF_SPI) {
do { do {
g_wlan.hif_func.hif_read_reg(1, &reg); g_wlan.hif_func.hif_read_reg(1, &reg);
g_wlan.hif_func.hif_write_reg(1, reg | BIT(1)); g_wlan.hif_func.hif_write_reg(1, reg | BIT(1));
...@@ -590,7 +590,7 @@ static inline void chip_wakeup(void) ...@@ -590,7 +590,7 @@ static inline void chip_wakeup(void)
} while ((wilc_get_chipid(true) == 0) && ((++trials % 3) == 0)); } while ((wilc_get_chipid(true) == 0) && ((++trials % 3) == 0));
} while (wilc_get_chipid(true) == 0); } while (wilc_get_chipid(true) == 0);
} else if ((g_wlan.io_func.io_type & 0x1) == HIF_SDIO) { } else if ((g_wlan.io_type & 0x1) == HIF_SDIO) {
g_wlan.hif_func.hif_read_reg(0xf0, &reg); g_wlan.hif_func.hif_read_reg(0xf0, &reg);
do { do {
g_wlan.hif_func.hif_write_reg(0xf0, reg | BIT(0)); g_wlan.hif_func.hif_write_reg(0xf0, reg | BIT(0));
...@@ -636,12 +636,12 @@ static inline void chip_wakeup(void) ...@@ -636,12 +636,12 @@ static inline void chip_wakeup(void)
u32 reg, trials = 0; u32 reg, trials = 0;
do { do {
if ((g_wlan.io_func.io_type & 0x1) == HIF_SPI) { if ((g_wlan.io_type & 0x1) == HIF_SPI) {
g_wlan.hif_func.hif_read_reg(1, &reg); g_wlan.hif_func.hif_read_reg(1, &reg);
g_wlan.hif_func.hif_write_reg(1, reg & ~BIT(1)); g_wlan.hif_func.hif_write_reg(1, reg & ~BIT(1));
g_wlan.hif_func.hif_write_reg(1, reg | BIT(1)); g_wlan.hif_func.hif_write_reg(1, reg | BIT(1));
g_wlan.hif_func.hif_write_reg(1, reg & ~BIT(1)); g_wlan.hif_func.hif_write_reg(1, reg & ~BIT(1));
} else if ((g_wlan.io_func.io_type & 0x1) == HIF_SDIO) { } else if ((g_wlan.io_type & 0x1) == HIF_SDIO) {
g_wlan.hif_func.hif_read_reg(0xf0, &reg); g_wlan.hif_func.hif_read_reg(0xf0, &reg);
g_wlan.hif_func.hif_write_reg(0xf0, reg & ~BIT(0)); g_wlan.hif_func.hif_write_reg(0xf0, reg & ~BIT(0));
g_wlan.hif_func.hif_write_reg(0xf0, reg | BIT(0)); g_wlan.hif_func.hif_write_reg(0xf0, reg | BIT(0));
...@@ -1252,10 +1252,10 @@ int wilc_wlan_start(void) ...@@ -1252,10 +1252,10 @@ int wilc_wlan_start(void)
int ret; int ret;
u32 chipid; u32 chipid;
if (p->io_func.io_type == HIF_SDIO) { if (p->io_type == HIF_SDIO) {
reg = 0; reg = 0;
reg |= BIT(3); reg |= BIT(3);
} else if (p->io_func.io_type == HIF_SPI) { } else if (p->io_type == HIF_SPI) {
reg = 1; reg = 1;
} }
acquire_bus(ACQUIRE_ONLY); acquire_bus(ACQUIRE_ONLY);
...@@ -1649,7 +1649,7 @@ u32 wilc_get_chipid(u8 update) ...@@ -1649,7 +1649,7 @@ u32 wilc_get_chipid(u8 update)
return chipid; return chipid;
} }
int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp) int wilc_wlan_init(struct net_device *dev)
{ {
int ret = 0; int ret = 0;
perInterface_wlan_t *nic = netdev_priv(dev); perInterface_wlan_t *nic = netdev_priv(dev);
...@@ -1660,8 +1660,7 @@ int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp) ...@@ -1660,8 +1660,7 @@ int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp)
PRINT_D(INIT_DBG, "Initializing WILC_Wlan ...\n"); PRINT_D(INIT_DBG, "Initializing WILC_Wlan ...\n");
memset((void *)&g_wlan, 0, sizeof(wilc_wlan_dev_t)); memset((void *)&g_wlan, 0, sizeof(wilc_wlan_dev_t));
memcpy((void *)&g_wlan.io_func, (void *)&inp->io_func, g_wlan.io_type = wilc->io_type;
sizeof(wilc_wlan_io_func_t));
#ifdef WILC_SDIO #ifdef WILC_SDIO
if (!wilc_hif_sdio.hif_init(wilc, wilc_debug)) { if (!wilc_hif_sdio.hif_init(wilc, wilc_debug)) {
......
...@@ -72,10 +72,6 @@ typedef struct { ...@@ -72,10 +72,6 @@ typedef struct {
u32 block_size; u32 block_size;
} sdio_cmd53_t; } sdio_cmd53_t;
typedef struct {
int io_type;
} wilc_wlan_io_func_t;
#define WILC_MAC_INDICATE_STATUS 0x1 #define WILC_MAC_INDICATE_STATUS 0x1
#define WILC_MAC_STATUS_INIT -1 #define WILC_MAC_STATUS_INIT -1
#define WILC_MAC_STATUS_READY 0 #define WILC_MAC_STATUS_READY 0
...@@ -83,10 +79,6 @@ typedef struct { ...@@ -83,10 +79,6 @@ typedef struct {
#define WILC_MAC_INDICATE_SCAN 0x2 #define WILC_MAC_INDICATE_SCAN 0x2
typedef struct {
wilc_wlan_io_func_t io_func;
} wilc_wlan_inp_t;
struct tx_complete_data { struct tx_complete_data {
int size; int size;
void *buff; void *buff;
...@@ -917,8 +909,7 @@ typedef enum { ...@@ -917,8 +909,7 @@ typedef enum {
WID_MAX = 0xFFFF WID_MAX = 0xFFFF
} WID_T; } WID_T;
int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp); int wilc_wlan_init(struct net_device *dev);
void wilc_bus_set_max_speed(void); void wilc_bus_set_max_speed(void);
void wilc_bus_set_default_speed(void); void wilc_bus_set_default_speed(void);
u32 wilc_get_chipid(u8 update); u32 wilc_get_chipid(u8 update);
......
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