Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 193751
b: refs/heads/master
c: 3f9e750
h: refs/heads/master
i:
  193749: 47a7127
  193747: 51c56a6
  193743: a7fe606
v: v3
  • Loading branch information
Grazvydas Ignotas authored and John W. Linville committed Mar 15, 2010
1 parent fe88766 commit 2c3f4e1
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3c9cb9c38a1368b1e3f187f23c1a56883ec656c2
refs/heads/master: 3f9e750d130b4a4d9f8226642b46ed17d8357f40
2 changes: 2 additions & 0 deletions trunk/drivers/net/wireless/wl12xx/wl1251.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ struct wl1251_debugfs {
struct wl1251_if_operations {
void (*read)(struct wl1251 *wl, int addr, void *buf, size_t len);
void (*write)(struct wl1251 *wl, int addr, void *buf, size_t len);
void (*read_elp)(struct wl1251 *wl, int addr, u32 *val);
void (*write_elp)(struct wl1251 *wl, int addr, u32 val);
void (*reset)(struct wl1251 *wl);
void (*enable_irq)(struct wl1251 *wl);
void (*disable_irq)(struct wl1251 *wl);
Expand Down
20 changes: 20 additions & 0 deletions trunk/drivers/net/wireless/wl12xx/wl1251_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,26 @@ static inline void wl1251_write32(struct wl1251 *wl, int addr, u32 val)
wl->if_ops->write(wl, addr, &val, sizeof(u32));
}

static inline u32 wl1251_read_elp(struct wl1251 *wl, int addr)
{
u32 response;

if (wl->if_ops->read_elp)
wl->if_ops->read_elp(wl, addr, &response);
else
wl->if_ops->read(wl, addr, &response, sizeof(u32));

return response;
}

static inline void wl1251_write_elp(struct wl1251 *wl, int addr, u32 val)
{
if (wl->if_ops->write_elp)
wl->if_ops->write_elp(wl, addr, val);
else
wl->if_ops->write(wl, addr, &val, sizeof(u32));
}

/* Memory target IO, address is translated to partition 0 */
void wl1251_mem_read(struct wl1251 *wl, int addr, void *buf, size_t len);
void wl1251_mem_write(struct wl1251 *wl, int addr, void *buf, size_t len);
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/net/wireless/wl12xx/wl1251_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ static void wl1251_fw_wakeup(struct wl1251 *wl)
u32 elp_reg;

elp_reg = ELPCTRL_WAKE_UP;
wl1251_write32(wl, HW_ACCESS_ELP_CTRL_REG_ADDR, elp_reg);
elp_reg = wl1251_read32(wl, HW_ACCESS_ELP_CTRL_REG_ADDR);
wl1251_write_elp(wl, HW_ACCESS_ELP_CTRL_REG_ADDR, elp_reg);
elp_reg = wl1251_read_elp(wl, HW_ACCESS_ELP_CTRL_REG_ADDR);

if (!(elp_reg & ELPCTRL_WLAN_READY))
wl1251_warning("WLAN not ready");
Expand Down
8 changes: 4 additions & 4 deletions trunk/drivers/net/wireless/wl12xx/wl1251_ps.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void wl1251_elp_work(struct work_struct *work)
goto out;

wl1251_debug(DEBUG_PSM, "chip to elp");
wl1251_write32(wl, HW_ACCESS_ELP_CTRL_REG_ADDR, ELPCTRL_SLEEP);
wl1251_write_elp(wl, HW_ACCESS_ELP_CTRL_REG_ADDR, ELPCTRL_SLEEP);
wl->elp = true;

out:
Expand Down Expand Up @@ -79,9 +79,9 @@ int wl1251_ps_elp_wakeup(struct wl1251 *wl)
start = jiffies;
timeout = jiffies + msecs_to_jiffies(WL1251_WAKEUP_TIMEOUT);

wl1251_write32(wl, HW_ACCESS_ELP_CTRL_REG_ADDR, ELPCTRL_WAKE_UP);
wl1251_write_elp(wl, HW_ACCESS_ELP_CTRL_REG_ADDR, ELPCTRL_WAKE_UP);

elp_reg = wl1251_read32(wl, HW_ACCESS_ELP_CTRL_REG_ADDR);
elp_reg = wl1251_read_elp(wl, HW_ACCESS_ELP_CTRL_REG_ADDR);

/*
* FIXME: we should wait for irq from chip but, as a temporary
Expand All @@ -93,7 +93,7 @@ int wl1251_ps_elp_wakeup(struct wl1251 *wl)
return -ETIMEDOUT;
}
msleep(1);
elp_reg = wl1251_read32(wl, HW_ACCESS_ELP_CTRL_REG_ADDR);
elp_reg = wl1251_read_elp(wl, HW_ACCESS_ELP_CTRL_REG_ADDR);
}

wl1251_debug(DEBUG_PSM, "wakeup time: %u ms",
Expand Down
28 changes: 28 additions & 0 deletions trunk/drivers/net/wireless/wl12xx/wl1251_sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,32 @@ static void wl1251_sdio_write(struct wl1251 *wl, int addr,
sdio_release_host(func);
}

static void wl1251_sdio_read_elp(struct wl1251 *wl, int addr, u32 *val)
{
int ret = 0;
struct sdio_func *func = wl_to_func(wl);

sdio_claim_host(func);
*val = sdio_readb(func, addr, &ret);
sdio_release_host(func);

if (ret)
wl1251_error("sdio_readb failed (%d)", ret);
}

static void wl1251_sdio_write_elp(struct wl1251 *wl, int addr, u32 val)
{
int ret = 0;
struct sdio_func *func = wl_to_func(wl);

sdio_claim_host(func);
sdio_writeb(func, val, addr, &ret);
sdio_release_host(func);

if (ret)
wl1251_error("sdio_writeb failed (%d)", ret);
}

static void wl1251_sdio_reset(struct wl1251 *wl)
{
}
Expand Down Expand Up @@ -111,6 +137,8 @@ static void wl1251_sdio_set_power(bool enable)
static const struct wl1251_if_operations wl1251_sdio_ops = {
.read = wl1251_sdio_read,
.write = wl1251_sdio_write,
.write_elp = wl1251_sdio_write_elp,
.read_elp = wl1251_sdio_read_elp,
.reset = wl1251_sdio_reset,
.enable_irq = wl1251_sdio_enable_irq,
.disable_irq = wl1251_sdio_disable_irq,
Expand Down

0 comments on commit 2c3f4e1

Please sign in to comment.