|
@@ -31,6 +31,11 @@
|
|
#include "reg.h"
|
|
#include "reg.h"
|
|
#include "wl1251_spi.h"
|
|
#include "wl1251_spi.h"
|
|
|
|
|
|
|
|
+static struct spi_device *wl_to_spi(struct wl1251 *wl)
|
|
|
|
+{
|
|
|
|
+ return wl->if_priv;
|
|
|
|
+}
|
|
|
|
+
|
|
static void wl1251_spi_reset(struct wl1251 *wl)
|
|
static void wl1251_spi_reset(struct wl1251 *wl)
|
|
{
|
|
{
|
|
u8 *cmd;
|
|
u8 *cmd;
|
|
@@ -52,7 +57,7 @@ static void wl1251_spi_reset(struct wl1251 *wl)
|
|
t.len = WSPI_INIT_CMD_LEN;
|
|
t.len = WSPI_INIT_CMD_LEN;
|
|
spi_message_add_tail(&t, &m);
|
|
spi_message_add_tail(&t, &m);
|
|
|
|
|
|
- spi_sync(wl->spi, &m);
|
|
|
|
|
|
+ spi_sync(wl_to_spi(wl), &m);
|
|
|
|
|
|
wl1251_dump(DEBUG_SPI, "spi reset -> ", cmd, WSPI_INIT_CMD_LEN);
|
|
wl1251_dump(DEBUG_SPI, "spi reset -> ", cmd, WSPI_INIT_CMD_LEN);
|
|
}
|
|
}
|
|
@@ -106,7 +111,7 @@ static void wl1251_spi_wake(struct wl1251 *wl)
|
|
t.len = WSPI_INIT_CMD_LEN;
|
|
t.len = WSPI_INIT_CMD_LEN;
|
|
spi_message_add_tail(&t, &m);
|
|
spi_message_add_tail(&t, &m);
|
|
|
|
|
|
- spi_sync(wl->spi, &m);
|
|
|
|
|
|
+ spi_sync(wl_to_spi(wl), &m);
|
|
|
|
|
|
wl1251_dump(DEBUG_SPI, "spi init -> ", cmd, WSPI_INIT_CMD_LEN);
|
|
wl1251_dump(DEBUG_SPI, "spi init -> ", cmd, WSPI_INIT_CMD_LEN);
|
|
}
|
|
}
|
|
@@ -149,7 +154,7 @@ static void wl1251_spi_read(struct wl1251 *wl, int addr, void *buf,
|
|
t[2].len = len;
|
|
t[2].len = len;
|
|
spi_message_add_tail(&t[2], &m);
|
|
spi_message_add_tail(&t[2], &m);
|
|
|
|
|
|
- spi_sync(wl->spi, &m);
|
|
|
|
|
|
+ spi_sync(wl_to_spi(wl), &m);
|
|
|
|
|
|
/* FIXME: check busy words */
|
|
/* FIXME: check busy words */
|
|
|
|
|
|
@@ -182,13 +187,13 @@ static void wl1251_spi_write(struct wl1251 *wl, int addr, void *buf,
|
|
t[1].len = len;
|
|
t[1].len = len;
|
|
spi_message_add_tail(&t[1], &m);
|
|
spi_message_add_tail(&t[1], &m);
|
|
|
|
|
|
- spi_sync(wl->spi, &m);
|
|
|
|
|
|
+ spi_sync(wl_to_spi(wl), &m);
|
|
|
|
|
|
wl1251_dump(DEBUG_SPI, "spi_write cmd -> ", cmd, sizeof(*cmd));
|
|
wl1251_dump(DEBUG_SPI, "spi_write cmd -> ", cmd, sizeof(*cmd));
|
|
wl1251_dump(DEBUG_SPI, "spi_write buf -> ", buf, len);
|
|
wl1251_dump(DEBUG_SPI, "spi_write buf -> ", buf, len);
|
|
}
|
|
}
|
|
|
|
|
|
-const struct wl1251_if_operations wl1251_spi_ops = {
|
|
|
|
|
|
+static const struct wl1251_if_operations wl1251_spi_ops = {
|
|
.read = wl1251_spi_read,
|
|
.read = wl1251_spi_read,
|
|
.write = wl1251_spi_write,
|
|
.write = wl1251_spi_write,
|
|
.reset = wl1251_spi_reset_wake,
|
|
.reset = wl1251_spi_reset_wake,
|
|
@@ -215,7 +220,7 @@ static int __devinit wl1251_spi_probe(struct spi_device *spi)
|
|
|
|
|
|
SET_IEEE80211_DEV(hw, &spi->dev);
|
|
SET_IEEE80211_DEV(hw, &spi->dev);
|
|
dev_set_drvdata(&spi->dev, wl);
|
|
dev_set_drvdata(&spi->dev, wl);
|
|
- wl->spi = spi;
|
|
|
|
|
|
+ wl->if_priv = spi;
|
|
wl->if_ops = &wl1251_spi_ops;
|
|
wl->if_ops = &wl1251_spi_ops;
|
|
|
|
|
|
/* This is the only SPI value that we need to set here, the rest
|
|
/* This is the only SPI value that we need to set here, the rest
|