Commit 911373cc authored by Solomon Peachy's avatar Solomon Peachy Committed by John W. Linville

cw1200: Rename 'sbus' to 'hwbus'

This avoids problems when building on SPARC targets due to the driver
calling the bus abstraction layer 'sbus'.  Not that any SBUS-sporting
SPARC targets are likely to have an SDIO controller, but this is the
correct thing to do.

See http://kisskb.ellerman.id.au/kisskb/buildresult/8846508/Signed-off-by: default avatarSolomon Peachy <pizza@shaftnet.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 3e817f08
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include "bh.h" #include "bh.h"
#include "hwio.h" #include "hwio.h"
#include "wsm.h" #include "wsm.h"
#include "sbus.h" #include "hwbus.h"
#include "debug.h" #include "debug.h"
#include "fwio.h" #include "fwio.h"
...@@ -103,7 +103,7 @@ void cw1200_irq_handler(struct cw1200_common *priv) ...@@ -103,7 +103,7 @@ void cw1200_irq_handler(struct cw1200_common *priv)
pr_debug("[BH] irq.\n"); pr_debug("[BH] irq.\n");
/* Disable Interrupts! */ /* Disable Interrupts! */
/* NOTE: sbus_ops->lock already held */ /* NOTE: hwbus_ops->lock already held */
__cw1200_irq_enable(priv, 0); __cw1200_irq_enable(priv, 0);
if (/* WARN_ON */(priv->bh_error)) if (/* WARN_ON */(priv->bh_error))
...@@ -265,8 +265,8 @@ static int cw1200_bh_rx_helper(struct cw1200_common *priv, ...@@ -265,8 +265,8 @@ static int cw1200_bh_rx_helper(struct cw1200_common *priv,
* to the NEXT Message length + 2 Bytes for SKB */ * to the NEXT Message length + 2 Bytes for SKB */
read_len = read_len + 2; read_len = read_len + 2;
alloc_len = priv->sbus_ops->align_size( alloc_len = priv->hwbus_ops->align_size(
priv->sbus_priv, read_len); priv->hwbus_priv, read_len);
/* Check if not exceeding CW1200 capabilities */ /* Check if not exceeding CW1200 capabilities */
if (WARN_ON_ONCE(alloc_len > EFFECTIVE_BUF_SIZE)) { if (WARN_ON_ONCE(alloc_len > EFFECTIVE_BUF_SIZE)) {
...@@ -384,8 +384,8 @@ static int cw1200_bh_tx_helper(struct cw1200_common *priv, ...@@ -384,8 +384,8 @@ static int cw1200_bh_tx_helper(struct cw1200_common *priv,
atomic_add(1, &priv->bh_tx); atomic_add(1, &priv->bh_tx);
tx_len = priv->sbus_ops->align_size( tx_len = priv->hwbus_ops->align_size(
priv->sbus_priv, tx_len); priv->hwbus_priv, tx_len);
/* Check if not exceeding CW1200 capabilities */ /* Check if not exceeding CW1200 capabilities */
if (WARN_ON_ONCE(tx_len > EFFECTIVE_BUF_SIZE)) if (WARN_ON_ONCE(tx_len > EFFECTIVE_BUF_SIZE))
...@@ -597,15 +597,15 @@ static int cw1200_bh(void *arg) ...@@ -597,15 +597,15 @@ static int cw1200_bh(void *arg)
done: done:
/* Re-enable device interrupts */ /* Re-enable device interrupts */
priv->sbus_ops->lock(priv->sbus_priv); priv->hwbus_ops->lock(priv->hwbus_priv);
__cw1200_irq_enable(priv, 1); __cw1200_irq_enable(priv, 1);
priv->sbus_ops->unlock(priv->sbus_priv); priv->hwbus_ops->unlock(priv->hwbus_priv);
} }
/* Explicitly disable device interrupts */ /* Explicitly disable device interrupts */
priv->sbus_ops->lock(priv->sbus_priv); priv->hwbus_ops->lock(priv->hwbus_priv);
__cw1200_irq_enable(priv, 0); __cw1200_irq_enable(priv, 0);
priv->sbus_ops->unlock(priv->sbus_priv); priv->hwbus_ops->unlock(priv->hwbus_priv);
if (!term) { if (!term) {
pr_err("[BH] Fatal error, exiting.\n"); pr_err("[BH] Fatal error, exiting.\n");
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "pm.h" #include "pm.h"
/* Forward declarations */ /* Forward declarations */
struct sbus_ops; struct hwbus_ops;
struct task_struct; struct task_struct;
struct cw1200_debug_priv; struct cw1200_debug_priv;
struct firmware; struct firmware;
...@@ -109,8 +109,8 @@ struct cw1200_common { ...@@ -109,8 +109,8 @@ struct cw1200_common {
u8 mac_addr[ETH_ALEN]; u8 mac_addr[ETH_ALEN];
/* Hardware interface */ /* Hardware interface */
const struct sbus_ops *sbus_ops; const struct hwbus_ops *hwbus_ops;
struct sbus_priv *sbus_priv; struct hwbus_priv *hwbus_priv;
/* Hardware information */ /* Hardware information */
enum { enum {
...@@ -298,8 +298,8 @@ struct cw1200_sta_priv { ...@@ -298,8 +298,8 @@ struct cw1200_sta_priv {
}; };
/* interfaces for the drivers */ /* interfaces for the drivers */
int cw1200_core_probe(const struct sbus_ops *sbus_ops, int cw1200_core_probe(const struct hwbus_ops *hwbus_ops,
struct sbus_priv *sbus, struct hwbus_priv *hwbus,
struct device *pdev, struct device *pdev,
struct cw1200_common **pself, struct cw1200_common **pself,
int ref_clk, const u8 *macaddr, int ref_clk, const u8 *macaddr,
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include <net/mac80211.h> #include <net/mac80211.h>
#include "cw1200.h" #include "cw1200.h"
#include "sbus.h" #include "hwbus.h"
#include <linux/cw1200_platform.h> #include <linux/cw1200_platform.h>
#include "hwio.h" #include "hwio.h"
...@@ -29,7 +29,7 @@ MODULE_LICENSE("GPL"); ...@@ -29,7 +29,7 @@ MODULE_LICENSE("GPL");
#define SDIO_BLOCK_SIZE (512) #define SDIO_BLOCK_SIZE (512)
struct sbus_priv { struct hwbus_priv {
struct sdio_func *func; struct sdio_func *func;
struct cw1200_common *core; struct cw1200_common *core;
const struct cw1200_platform_data_sdio *pdata; const struct cw1200_platform_data_sdio *pdata;
...@@ -48,35 +48,35 @@ static const struct sdio_device_id cw1200_sdio_ids[] = { ...@@ -48,35 +48,35 @@ static const struct sdio_device_id cw1200_sdio_ids[] = {
{ /* end: all zeroes */ }, { /* end: all zeroes */ },
}; };
/* sbus_ops implemetation */ /* hwbus_ops implemetation */
static int cw1200_sdio_memcpy_fromio(struct sbus_priv *self, static int cw1200_sdio_memcpy_fromio(struct hwbus_priv *self,
unsigned int addr, unsigned int addr,
void *dst, int count) void *dst, int count)
{ {
return sdio_memcpy_fromio(self->func, dst, addr, count); return sdio_memcpy_fromio(self->func, dst, addr, count);
} }
static int cw1200_sdio_memcpy_toio(struct sbus_priv *self, static int cw1200_sdio_memcpy_toio(struct hwbus_priv *self,
unsigned int addr, unsigned int addr,
const void *src, int count) const void *src, int count)
{ {
return sdio_memcpy_toio(self->func, addr, (void *)src, count); return sdio_memcpy_toio(self->func, addr, (void *)src, count);
} }
static void cw1200_sdio_lock(struct sbus_priv *self) static void cw1200_sdio_lock(struct hwbus_priv *self)
{ {
sdio_claim_host(self->func); sdio_claim_host(self->func);
} }
static void cw1200_sdio_unlock(struct sbus_priv *self) static void cw1200_sdio_unlock(struct hwbus_priv *self)
{ {
sdio_release_host(self->func); sdio_release_host(self->func);
} }
static void cw1200_sdio_irq_handler(struct sdio_func *func) static void cw1200_sdio_irq_handler(struct sdio_func *func)
{ {
struct sbus_priv *self = sdio_get_drvdata(func); struct hwbus_priv *self = sdio_get_drvdata(func);
/* note: sdio_host already claimed here. */ /* note: sdio_host already claimed here. */
if (self->core) if (self->core)
...@@ -90,7 +90,7 @@ static irqreturn_t cw1200_gpio_hardirq(int irq, void *dev_id) ...@@ -90,7 +90,7 @@ static irqreturn_t cw1200_gpio_hardirq(int irq, void *dev_id)
static irqreturn_t cw1200_gpio_irq(int irq, void *dev_id) static irqreturn_t cw1200_gpio_irq(int irq, void *dev_id)
{ {
struct sbus_priv *self = dev_id; struct hwbus_priv *self = dev_id;
if (self->core) { if (self->core) {
sdio_claim_host(self->func); sdio_claim_host(self->func);
...@@ -102,7 +102,7 @@ static irqreturn_t cw1200_gpio_irq(int irq, void *dev_id) ...@@ -102,7 +102,7 @@ static irqreturn_t cw1200_gpio_irq(int irq, void *dev_id)
} }
} }
static int cw1200_request_irq(struct sbus_priv *self) static int cw1200_request_irq(struct hwbus_priv *self)
{ {
int ret; int ret;
const struct resource *irq = self->pdata->irq; const struct resource *irq = self->pdata->irq;
...@@ -140,7 +140,7 @@ static int cw1200_request_irq(struct sbus_priv *self) ...@@ -140,7 +140,7 @@ static int cw1200_request_irq(struct sbus_priv *self)
return ret; return ret;
} }
static int cw1200_sdio_irq_subscribe(struct sbus_priv *self) static int cw1200_sdio_irq_subscribe(struct hwbus_priv *self)
{ {
int ret = 0; int ret = 0;
...@@ -155,7 +155,7 @@ static int cw1200_sdio_irq_subscribe(struct sbus_priv *self) ...@@ -155,7 +155,7 @@ static int cw1200_sdio_irq_subscribe(struct sbus_priv *self)
return ret; return ret;
} }
static int cw1200_sdio_irq_unsubscribe(struct sbus_priv *self) static int cw1200_sdio_irq_unsubscribe(struct hwbus_priv *self)
{ {
int ret = 0; int ret = 0;
...@@ -237,7 +237,7 @@ static int cw1200_sdio_on(const struct cw1200_platform_data_sdio *pdata) ...@@ -237,7 +237,7 @@ static int cw1200_sdio_on(const struct cw1200_platform_data_sdio *pdata)
return 0; return 0;
} }
static size_t cw1200_sdio_align_size(struct sbus_priv *self, size_t size) static size_t cw1200_sdio_align_size(struct hwbus_priv *self, size_t size)
{ {
if (self->pdata->no_nptb) if (self->pdata->no_nptb)
size = round_up(size, SDIO_BLOCK_SIZE); size = round_up(size, SDIO_BLOCK_SIZE);
...@@ -247,7 +247,7 @@ static size_t cw1200_sdio_align_size(struct sbus_priv *self, size_t size) ...@@ -247,7 +247,7 @@ static size_t cw1200_sdio_align_size(struct sbus_priv *self, size_t size)
return size; return size;
} }
static int cw1200_sdio_pm(struct sbus_priv *self, bool suspend) static int cw1200_sdio_pm(struct hwbus_priv *self, bool suspend)
{ {
int ret = 0; int ret = 0;
...@@ -256,9 +256,9 @@ static int cw1200_sdio_pm(struct sbus_priv *self, bool suspend) ...@@ -256,9 +256,9 @@ static int cw1200_sdio_pm(struct sbus_priv *self, bool suspend)
return ret; return ret;
} }
static struct sbus_ops cw1200_sdio_sbus_ops = { static struct hwbus_ops cw1200_sdio_hwbus_ops = {
.sbus_memcpy_fromio = cw1200_sdio_memcpy_fromio, .hwbus_memcpy_fromio = cw1200_sdio_memcpy_fromio,
.sbus_memcpy_toio = cw1200_sdio_memcpy_toio, .hwbus_memcpy_toio = cw1200_sdio_memcpy_toio,
.lock = cw1200_sdio_lock, .lock = cw1200_sdio_lock,
.unlock = cw1200_sdio_unlock, .unlock = cw1200_sdio_unlock,
.align_size = cw1200_sdio_align_size, .align_size = cw1200_sdio_align_size,
...@@ -269,7 +269,7 @@ static struct sbus_ops cw1200_sdio_sbus_ops = { ...@@ -269,7 +269,7 @@ static struct sbus_ops cw1200_sdio_sbus_ops = {
static int cw1200_sdio_probe(struct sdio_func *func, static int cw1200_sdio_probe(struct sdio_func *func,
const struct sdio_device_id *id) const struct sdio_device_id *id)
{ {
struct sbus_priv *self; struct hwbus_priv *self;
int status; int status;
pr_info("cw1200_wlan_sdio: Probe called\n"); pr_info("cw1200_wlan_sdio: Probe called\n");
...@@ -280,7 +280,7 @@ static int cw1200_sdio_probe(struct sdio_func *func, ...@@ -280,7 +280,7 @@ static int cw1200_sdio_probe(struct sdio_func *func,
self = kzalloc(sizeof(*self), GFP_KERNEL); self = kzalloc(sizeof(*self), GFP_KERNEL);
if (!self) { if (!self) {
pr_err("Can't allocate SDIO sbus_priv.\n"); pr_err("Can't allocate SDIO hwbus_priv.\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -295,7 +295,7 @@ static int cw1200_sdio_probe(struct sdio_func *func, ...@@ -295,7 +295,7 @@ static int cw1200_sdio_probe(struct sdio_func *func,
status = cw1200_sdio_irq_subscribe(self); status = cw1200_sdio_irq_subscribe(self);
status = cw1200_core_probe(&cw1200_sdio_sbus_ops, status = cw1200_core_probe(&cw1200_sdio_hwbus_ops,
self, &func->dev, &self->core, self, &func->dev, &self->core,
self->pdata->ref_clk, self->pdata->ref_clk,
self->pdata->macaddr, self->pdata->macaddr,
...@@ -317,7 +317,7 @@ static int cw1200_sdio_probe(struct sdio_func *func, ...@@ -317,7 +317,7 @@ static int cw1200_sdio_probe(struct sdio_func *func,
* device is disconnected */ * device is disconnected */
static void cw1200_sdio_disconnect(struct sdio_func *func) static void cw1200_sdio_disconnect(struct sdio_func *func)
{ {
struct sbus_priv *self = sdio_get_drvdata(func); struct hwbus_priv *self = sdio_get_drvdata(func);
if (self) { if (self) {
cw1200_sdio_irq_unsubscribe(self); cw1200_sdio_irq_unsubscribe(self);
...@@ -338,7 +338,7 @@ static int cw1200_sdio_suspend(struct device *dev) ...@@ -338,7 +338,7 @@ static int cw1200_sdio_suspend(struct device *dev)
{ {
int ret; int ret;
struct sdio_func *func = dev_to_sdio_func(dev); struct sdio_func *func = dev_to_sdio_func(dev);
struct sbus_priv *self = sdio_get_drvdata(func); struct hwbus_priv *self = sdio_get_drvdata(func);
if (!cw1200_can_suspend(self->core)) if (!cw1200_can_suspend(self->core))
return -EAGAIN; return -EAGAIN;
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <linux/device.h> #include <linux/device.h>
#include "cw1200.h" #include "cw1200.h"
#include "sbus.h" #include "hwbus.h"
#include <linux/cw1200_platform.h> #include <linux/cw1200_platform.h>
#include "hwio.h" #include "hwio.h"
...@@ -35,7 +35,7 @@ MODULE_ALIAS("spi:cw1200_wlan_spi"); ...@@ -35,7 +35,7 @@ MODULE_ALIAS("spi:cw1200_wlan_spi");
/* #define SPI_DEBUG */ /* #define SPI_DEBUG */
struct sbus_priv { struct hwbus_priv {
struct spi_device *func; struct spi_device *func;
struct cw1200_common *core; struct cw1200_common *core;
const struct cw1200_platform_data_spi *pdata; const struct cw1200_platform_data_spi *pdata;
...@@ -58,7 +58,7 @@ struct sbus_priv { ...@@ -58,7 +58,7 @@ struct sbus_priv {
*/ */
static int cw1200_spi_memcpy_fromio(struct sbus_priv *self, static int cw1200_spi_memcpy_fromio(struct hwbus_priv *self,
unsigned int addr, unsigned int addr,
void *dst, int count) void *dst, int count)
{ {
...@@ -119,7 +119,7 @@ static int cw1200_spi_memcpy_fromio(struct sbus_priv *self, ...@@ -119,7 +119,7 @@ static int cw1200_spi_memcpy_fromio(struct sbus_priv *self,
return ret; return ret;
} }
static int cw1200_spi_memcpy_toio(struct sbus_priv *self, static int cw1200_spi_memcpy_toio(struct hwbus_priv *self,
unsigned int addr, unsigned int addr,
const void *src, int count) const void *src, int count)
{ {
...@@ -187,7 +187,7 @@ static int cw1200_spi_memcpy_toio(struct sbus_priv *self, ...@@ -187,7 +187,7 @@ static int cw1200_spi_memcpy_toio(struct sbus_priv *self,
return rval; return rval;
} }
static void cw1200_spi_lock(struct sbus_priv *self) static void cw1200_spi_lock(struct hwbus_priv *self)
{ {
unsigned long flags; unsigned long flags;
...@@ -209,7 +209,7 @@ static void cw1200_spi_lock(struct sbus_priv *self) ...@@ -209,7 +209,7 @@ static void cw1200_spi_lock(struct sbus_priv *self)
return; return;
} }
static void cw1200_spi_unlock(struct sbus_priv *self) static void cw1200_spi_unlock(struct hwbus_priv *self)
{ {
unsigned long flags; unsigned long flags;
...@@ -221,7 +221,7 @@ static void cw1200_spi_unlock(struct sbus_priv *self) ...@@ -221,7 +221,7 @@ static void cw1200_spi_unlock(struct sbus_priv *self)
static irqreturn_t cw1200_spi_irq_handler(int irq, void *dev_id) static irqreturn_t cw1200_spi_irq_handler(int irq, void *dev_id)
{ {
struct sbus_priv *self = dev_id; struct hwbus_priv *self = dev_id;
if (self->core) { if (self->core) {
cw1200_irq_handler(self->core); cw1200_irq_handler(self->core);
...@@ -231,7 +231,7 @@ static irqreturn_t cw1200_spi_irq_handler(int irq, void *dev_id) ...@@ -231,7 +231,7 @@ static irqreturn_t cw1200_spi_irq_handler(int irq, void *dev_id)
} }
} }
static int cw1200_spi_irq_subscribe(struct sbus_priv *self) static int cw1200_spi_irq_subscribe(struct hwbus_priv *self)
{ {
int ret; int ret;
...@@ -255,7 +255,7 @@ static int cw1200_spi_irq_subscribe(struct sbus_priv *self) ...@@ -255,7 +255,7 @@ static int cw1200_spi_irq_subscribe(struct sbus_priv *self)
return ret; return ret;
} }
static int cw1200_spi_irq_unsubscribe(struct sbus_priv *self) static int cw1200_spi_irq_unsubscribe(struct hwbus_priv *self)
{ {
int ret = 0; int ret = 0;
...@@ -331,19 +331,19 @@ static int cw1200_spi_on(const struct cw1200_platform_data_spi *pdata) ...@@ -331,19 +331,19 @@ static int cw1200_spi_on(const struct cw1200_platform_data_spi *pdata)
return 0; return 0;
} }
static size_t cw1200_spi_align_size(struct sbus_priv *self, size_t size) static size_t cw1200_spi_align_size(struct hwbus_priv *self, size_t size)
{ {
return size & 1 ? size + 1 : size; return size & 1 ? size + 1 : size;
} }
static int cw1200_spi_pm(struct sbus_priv *self, bool suspend) static int cw1200_spi_pm(struct hwbus_priv *self, bool suspend)
{ {
return irq_set_irq_wake(self->func->irq, suspend); return irq_set_irq_wake(self->func->irq, suspend);
} }
static struct sbus_ops cw1200_spi_sbus_ops = { static struct hwbus_ops cw1200_spi_hwbus_ops = {
.sbus_memcpy_fromio = cw1200_spi_memcpy_fromio, .hwbus_memcpy_fromio = cw1200_spi_memcpy_fromio,
.sbus_memcpy_toio = cw1200_spi_memcpy_toio, .hwbus_memcpy_toio = cw1200_spi_memcpy_toio,
.lock = cw1200_spi_lock, .lock = cw1200_spi_lock,
.unlock = cw1200_spi_unlock, .unlock = cw1200_spi_unlock,
.align_size = cw1200_spi_align_size, .align_size = cw1200_spi_align_size,
...@@ -355,7 +355,7 @@ static int cw1200_spi_probe(struct spi_device *func) ...@@ -355,7 +355,7 @@ static int cw1200_spi_probe(struct spi_device *func)
{ {
const struct cw1200_platform_data_spi *plat_data = const struct cw1200_platform_data_spi *plat_data =
func->dev.platform_data; func->dev.platform_data;
struct sbus_priv *self; struct hwbus_priv *self;
int status; int status;
/* Sanity check speed */ /* Sanity check speed */
...@@ -389,7 +389,7 @@ static int cw1200_spi_probe(struct spi_device *func) ...@@ -389,7 +389,7 @@ static int cw1200_spi_probe(struct spi_device *func)
self = kzalloc(sizeof(*self), GFP_KERNEL); self = kzalloc(sizeof(*self), GFP_KERNEL);
if (!self) { if (!self) {
pr_err("Can't allocate SPI sbus_priv."); pr_err("Can't allocate SPI hwbus_priv.");
return -ENOMEM; return -ENOMEM;
} }
...@@ -401,7 +401,7 @@ static int cw1200_spi_probe(struct spi_device *func) ...@@ -401,7 +401,7 @@ static int cw1200_spi_probe(struct spi_device *func)
status = cw1200_spi_irq_subscribe(self); status = cw1200_spi_irq_subscribe(self);
status = cw1200_core_probe(&cw1200_spi_sbus_ops, status = cw1200_core_probe(&cw1200_spi_hwbus_ops,
self, &func->dev, &self->core, self, &func->dev, &self->core,
self->pdata->ref_clk, self->pdata->ref_clk,
self->pdata->macaddr, self->pdata->macaddr,
...@@ -420,7 +420,7 @@ static int cw1200_spi_probe(struct spi_device *func) ...@@ -420,7 +420,7 @@ static int cw1200_spi_probe(struct spi_device *func)
/* Disconnect Function to be called by SPI stack when device is disconnected */ /* Disconnect Function to be called by SPI stack when device is disconnected */
static int cw1200_spi_disconnect(struct spi_device *func) static int cw1200_spi_disconnect(struct spi_device *func)
{ {
struct sbus_priv *self = spi_get_drvdata(func); struct hwbus_priv *self = spi_get_drvdata(func);
if (self) { if (self) {
cw1200_spi_irq_unsubscribe(self); cw1200_spi_irq_unsubscribe(self);
...@@ -438,7 +438,7 @@ static int cw1200_spi_disconnect(struct spi_device *func) ...@@ -438,7 +438,7 @@ static int cw1200_spi_disconnect(struct spi_device *func)
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int cw1200_spi_suspend(struct device *dev, pm_message_t state) static int cw1200_spi_suspend(struct device *dev, pm_message_t state)
{ {
struct sbus_priv *self = spi_get_drvdata(to_spi_device(dev)); struct hwbus_priv *self = spi_get_drvdata(to_spi_device(dev));
if (!cw1200_can_suspend(self->core)) if (!cw1200_can_suspend(self->core))
return -EAGAIN; return -EAGAIN;
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "cw1200.h" #include "cw1200.h"
#include "fwio.h" #include "fwio.h"
#include "hwio.h" #include "hwio.h"
#include "sbus.h" #include "hwbus.h"
#include "bh.h" #include "bh.h"
static int cw1200_get_hw_type(u32 config_reg_val, int *major_revision) static int cw1200_get_hw_type(u32 config_reg_val, int *major_revision)
...@@ -489,9 +489,9 @@ int cw1200_load_firmware(struct cw1200_common *priv) ...@@ -489,9 +489,9 @@ int cw1200_load_firmware(struct cw1200_common *priv)
} }
/* Enable interrupt signalling */ /* Enable interrupt signalling */
priv->sbus_ops->lock(priv->sbus_priv); priv->hwbus_ops->lock(priv->hwbus_priv);
ret = __cw1200_irq_enable(priv, 1); ret = __cw1200_irq_enable(priv, 1);
priv->sbus_ops->unlock(priv->sbus_priv); priv->hwbus_ops->unlock(priv->hwbus_priv);
if (ret < 0) if (ret < 0)
goto unsubscribe; goto unsubscribe;
...@@ -518,8 +518,8 @@ int cw1200_load_firmware(struct cw1200_common *priv) ...@@ -518,8 +518,8 @@ int cw1200_load_firmware(struct cw1200_common *priv)
unsubscribe: unsubscribe:
/* Disable interrupt signalling */ /* Disable interrupt signalling */
priv->sbus_ops->lock(priv->sbus_priv); priv->hwbus_ops->lock(priv->hwbus_priv);
ret = __cw1200_irq_enable(priv, 0); ret = __cw1200_irq_enable(priv, 0);
priv->sbus_ops->unlock(priv->sbus_priv); priv->hwbus_ops->unlock(priv->hwbus_priv);
return ret; return ret;
} }
/* /*
* Common sbus abstraction layer interface for cw1200 wireless driver * Common hwbus abstraction layer interface for cw1200 wireless driver
* *
* Copyright (c) 2010, ST-Ericsson * Copyright (c) 2010, ST-Ericsson
* Author: Dmitry Tarnyagin <dmitry.tarnyagin@lockless.no> * Author: Dmitry Tarnyagin <dmitry.tarnyagin@lockless.no>
...@@ -9,29 +9,25 @@ ...@@ -9,29 +9,25 @@
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#ifndef CW1200_SBUS_H #ifndef CW1200_HWBUS_H
#define CW1200_SBUS_H #define CW1200_HWBUS_H
/* struct hwbus_priv;
* sbus priv forward definition.
* Implemented and instantiated in particular modules.
*/
struct sbus_priv;
void cw1200_irq_handler(struct cw1200_common *priv); void cw1200_irq_handler(struct cw1200_common *priv);
/* This MUST be wrapped with sbus_ops->lock/unlock! */ /* This MUST be wrapped with hwbus_ops->lock/unlock! */
int __cw1200_irq_enable(struct cw1200_common *priv, int enable); int __cw1200_irq_enable(struct cw1200_common *priv, int enable);
struct sbus_ops { struct hwbus_ops {
int (*sbus_memcpy_fromio)(struct sbus_priv *self, unsigned int addr, int (*hwbus_memcpy_fromio)(struct hwbus_priv *self, unsigned int addr,
void *dst, int count); void *dst, int count);
int (*sbus_memcpy_toio)(struct sbus_priv *self, unsigned int addr, int (*hwbus_memcpy_toio)(struct hwbus_priv *self, unsigned int addr,
const void *src, int count); const void *src, int count);
void (*lock)(struct sbus_priv *self); void (*lock)(struct hwbus_priv *self);
void (*unlock)(struct sbus_priv *self); void (*unlock)(struct hwbus_priv *self);
size_t (*align_size)(struct sbus_priv *self, size_t size); size_t (*align_size)(struct hwbus_priv *self, size_t size);
int (*power_mgmt)(struct sbus_priv *self, bool suspend); int (*power_mgmt)(struct hwbus_priv *self, bool suspend);
}; };
#endif /* CW1200_SBUS_H */ #endif /* CW1200_HWBUS_H */
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "cw1200.h" #include "cw1200.h"
#include "hwio.h" #include "hwio.h"
#include "sbus.h" #include "hwbus.h"
/* Sdio addr is 4*spi_addr */ /* Sdio addr is 4*spi_addr */
#define SPI_REG_ADDR_TO_SDIO(spi_reg_addr) ((spi_reg_addr) << 2) #define SPI_REG_ADDR_TO_SDIO(spi_reg_addr) ((spi_reg_addr) << 2)
...@@ -46,7 +46,7 @@ static int __cw1200_reg_read(struct cw1200_common *priv, u16 addr, ...@@ -46,7 +46,7 @@ static int __cw1200_reg_read(struct cw1200_common *priv, u16 addr,
addr_sdio = SPI_REG_ADDR_TO_SDIO(addr); addr_sdio = SPI_REG_ADDR_TO_SDIO(addr);
sdio_reg_addr_17bit = SDIO_ADDR17BIT(buf_id, 0, 0, addr_sdio); sdio_reg_addr_17bit = SDIO_ADDR17BIT(buf_id, 0, 0, addr_sdio);
return priv->sbus_ops->sbus_memcpy_fromio(priv->sbus_priv, return priv->hwbus_ops->hwbus_memcpy_fromio(priv->hwbus_priv,
sdio_reg_addr_17bit, sdio_reg_addr_17bit,
buf, buf_len); buf, buf_len);
} }
...@@ -61,7 +61,7 @@ static int __cw1200_reg_write(struct cw1200_common *priv, u16 addr, ...@@ -61,7 +61,7 @@ static int __cw1200_reg_write(struct cw1200_common *priv, u16 addr,
addr_sdio = SPI_REG_ADDR_TO_SDIO(addr); addr_sdio = SPI_REG_ADDR_TO_SDIO(addr);
sdio_reg_addr_17bit = SDIO_ADDR17BIT(buf_id, 0, 0, addr_sdio); sdio_reg_addr_17bit = SDIO_ADDR17BIT(buf_id, 0, 0, addr_sdio);
return priv->sbus_ops->sbus_memcpy_toio(priv->sbus_priv, return priv->hwbus_ops->hwbus_memcpy_toio(priv->hwbus_priv,
sdio_reg_addr_17bit, sdio_reg_addr_17bit,
buf, buf_len); buf, buf_len);
} }
...@@ -100,9 +100,9 @@ int cw1200_reg_read(struct cw1200_common *priv, u16 addr, void *buf, ...@@ -100,9 +100,9 @@ int cw1200_reg_read(struct cw1200_common *priv, u16 addr, void *buf,
size_t buf_len) size_t buf_len)
{ {
int ret; int ret;
priv->sbus_ops->lock(priv->sbus_priv); priv->hwbus_ops->lock(priv->hwbus_priv);
ret = __cw1200_reg_read(priv, addr, buf, buf_len, 0); ret = __cw1200_reg_read(priv, addr, buf, buf_len, 0);
priv->sbus_ops->unlock(priv->sbus_priv); priv->hwbus_ops->unlock(priv->hwbus_priv);
return ret; return ret;
} }
...@@ -110,9 +110,9 @@ int cw1200_reg_write(struct cw1200_common *priv, u16 addr, const void *buf, ...@@ -110,9 +110,9 @@ int cw1200_reg_write(struct cw1200_common *priv, u16 addr, const void *buf,
size_t buf_len) size_t buf_len)
{ {
int ret; int ret;
priv->sbus_ops->lock(priv->sbus_priv); priv->hwbus_ops->lock(priv->hwbus_priv);
ret = __cw1200_reg_write(priv, addr, buf, buf_len, 0); ret = __cw1200_reg_write(priv, addr, buf, buf_len, 0);
priv->sbus_ops->unlock(priv->sbus_priv); priv->hwbus_ops->unlock(priv->hwbus_priv);
return ret; return ret;
} }
...@@ -121,7 +121,7 @@ int cw1200_data_read(struct cw1200_common *priv, void *buf, size_t buf_len) ...@@ -121,7 +121,7 @@ int cw1200_data_read(struct cw1200_common *priv, void *buf, size_t buf_len)
int ret, retry = 1; int ret, retry = 1;
int buf_id_rx = priv->buf_id_rx; int buf_id_rx = priv->buf_id_rx;
priv->sbus_ops->lock(priv->sbus_priv); priv->hwbus_ops->lock(priv->hwbus_priv);
while (retry <= MAX_RETRY) { while (retry <= MAX_RETRY) {
ret = __cw1200_reg_read(priv, ret = __cw1200_reg_read(priv,
...@@ -138,7 +138,7 @@ int cw1200_data_read(struct cw1200_common *priv, void *buf, size_t buf_len) ...@@ -138,7 +138,7 @@ int cw1200_data_read(struct cw1200_common *priv, void *buf, size_t buf_len)
} }
} }
priv->sbus_ops->unlock(priv->sbus_priv); priv->hwbus_ops->unlock(priv->hwbus_priv);
return ret; return ret;
} }
...@@ -148,7 +148,7 @@ int cw1200_data_write(struct cw1200_common *priv, const void *buf, ...@@ -148,7 +148,7 @@ int cw1200_data_write(struct cw1200_common *priv, const void *buf,
int ret, retry = 1; int ret, retry = 1;
int buf_id_tx = priv->buf_id_tx; int buf_id_tx = priv->buf_id_tx;
priv->sbus_ops->lock(priv->sbus_priv); priv->hwbus_ops->lock(priv->hwbus_priv);
while (retry <= MAX_RETRY) { while (retry <= MAX_RETRY) {
ret = __cw1200_reg_write(priv, ret = __cw1200_reg_write(priv,
...@@ -165,7 +165,7 @@ int cw1200_data_write(struct cw1200_common *priv, const void *buf, ...@@ -165,7 +165,7 @@ int cw1200_data_write(struct cw1200_common *priv, const void *buf,
} }
} }
priv->sbus_ops->unlock(priv->sbus_priv); priv->hwbus_ops->unlock(priv->hwbus_priv);
return ret; return ret;
} }
...@@ -181,7 +181,7 @@ int cw1200_indirect_read(struct cw1200_common *priv, u32 addr, void *buf, ...@@ -181,7 +181,7 @@ int cw1200_indirect_read(struct cw1200_common *priv, u32 addr, void *buf,
goto out; goto out;
} }
priv->sbus_ops->lock(priv->sbus_priv); priv->hwbus_ops->lock(priv->hwbus_priv);
/* Write address */ /* Write address */
ret = __cw1200_reg_write_32(priv, ST90TDS_SRAM_BASE_ADDR_REG_ID, addr); ret = __cw1200_reg_write_32(priv, ST90TDS_SRAM_BASE_ADDR_REG_ID, addr);
if (ret < 0) { if (ret < 0) {
...@@ -230,7 +230,7 @@ int cw1200_indirect_read(struct cw1200_common *priv, u32 addr, void *buf, ...@@ -230,7 +230,7 @@ int cw1200_indirect_read(struct cw1200_common *priv, u32 addr, void *buf,
} }
out: out:
priv->sbus_ops->unlock(priv->sbus_priv); priv->hwbus_ops->unlock(priv->hwbus_priv);
return ret; return ret;
} }
...@@ -244,7 +244,7 @@ int cw1200_apb_write(struct cw1200_common *priv, u32 addr, const void *buf, ...@@ -244,7 +244,7 @@ int cw1200_apb_write(struct cw1200_common *priv, u32 addr, const void *buf,
return -EINVAL; return -EINVAL;
} }
priv->sbus_ops->lock(priv->sbus_priv); priv->hwbus_ops->lock(priv->hwbus_priv);
/* Write address */ /* Write address */
ret = __cw1200_reg_write_32(priv, ST90TDS_SRAM_BASE_ADDR_REG_ID, addr); ret = __cw1200_reg_write_32(priv, ST90TDS_SRAM_BASE_ADDR_REG_ID, addr);
...@@ -262,7 +262,7 @@ int cw1200_apb_write(struct cw1200_common *priv, u32 addr, const void *buf, ...@@ -262,7 +262,7 @@ int cw1200_apb_write(struct cw1200_common *priv, u32 addr, const void *buf,
} }
out: out:
priv->sbus_ops->unlock(priv->sbus_priv); priv->hwbus_ops->unlock(priv->hwbus_priv);
return ret; return ret;
} }
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include "cw1200.h" #include "cw1200.h"
#include "txrx.h" #include "txrx.h"
#include "sbus.h" #include "hwbus.h"
#include "fwio.h" #include "fwio.h"
#include "hwio.h" #include "hwio.h"
#include "bh.h" #include "bh.h"
...@@ -528,8 +528,8 @@ u32 cw1200_dpll_from_clk(u16 clk_khz) ...@@ -528,8 +528,8 @@ u32 cw1200_dpll_from_clk(u16 clk_khz)
} }
} }
int cw1200_core_probe(const struct sbus_ops *sbus_ops, int cw1200_core_probe(const struct hwbus_ops *hwbus_ops,
struct sbus_priv *sbus, struct hwbus_priv *hwbus,
struct device *pdev, struct device *pdev,
struct cw1200_common **core, struct cw1200_common **core,
int ref_clk, const u8 *macaddr, int ref_clk, const u8 *macaddr,
...@@ -556,8 +556,8 @@ int cw1200_core_probe(const struct sbus_ops *sbus_ops, ...@@ -556,8 +556,8 @@ int cw1200_core_probe(const struct sbus_ops *sbus_ops,
if (cw1200_sdd_path) if (cw1200_sdd_path)
priv->sdd_path = cw1200_sdd_path; priv->sdd_path = cw1200_sdd_path;
priv->sbus_ops = sbus_ops; priv->hwbus_ops = hwbus_ops;
priv->sbus_priv = sbus; priv->hwbus_priv = hwbus;
priv->pdev = pdev; priv->pdev = pdev;
SET_IEEE80211_DEV(priv->hw, pdev); SET_IEEE80211_DEV(priv->hw, pdev);
...@@ -616,9 +616,9 @@ EXPORT_SYMBOL_GPL(cw1200_core_probe); ...@@ -616,9 +616,9 @@ EXPORT_SYMBOL_GPL(cw1200_core_probe);
void cw1200_core_release(struct cw1200_common *self) void cw1200_core_release(struct cw1200_common *self)
{ {
/* Disable device interrupts */ /* Disable device interrupts */
self->sbus_ops->lock(self->sbus_priv); self->hwbus_ops->lock(self->hwbus_priv);
__cw1200_irq_enable(self, 0); __cw1200_irq_enable(self, 0);
self->sbus_ops->unlock(self->sbus_priv); self->hwbus_ops->unlock(self->hwbus_priv);
/* And then clean up */ /* And then clean up */
cw1200_unregister_common(self->hw); cw1200_unregister_common(self->hw);
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "pm.h" #include "pm.h"
#include "sta.h" #include "sta.h"
#include "bh.h" #include "bh.h"
#include "sbus.h" #include "hwbus.h"
#define CW1200_BEACON_SKIPPING_MULTIPLIER 3 #define CW1200_BEACON_SKIPPING_MULTIPLIER 3
...@@ -264,7 +264,7 @@ int cw1200_wow_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) ...@@ -264,7 +264,7 @@ int cw1200_wow_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
pm_state->suspend_state = state; pm_state->suspend_state = state;
/* Enable IRQ wake */ /* Enable IRQ wake */
ret = priv->sbus_ops->power_mgmt(priv->sbus_priv, true); ret = priv->hwbus_ops->power_mgmt(priv->hwbus_priv, true);
if (ret) { if (ret) {
wiphy_err(priv->hw->wiphy, wiphy_err(priv->hw->wiphy,
"PM request failed: %d. WoW is disabled.\n", ret); "PM request failed: %d. WoW is disabled.\n", ret);
...@@ -313,7 +313,7 @@ int cw1200_wow_resume(struct ieee80211_hw *hw) ...@@ -313,7 +313,7 @@ int cw1200_wow_resume(struct ieee80211_hw *hw)
pm_state->suspend_state = NULL; pm_state->suspend_state = NULL;
/* Disable IRQ wake */ /* Disable IRQ wake */
priv->sbus_ops->power_mgmt(priv->sbus_priv, false); priv->hwbus_ops->power_mgmt(priv->hwbus_priv, false);
/* Scan.lock must be released before BH is resumed other way /* Scan.lock must be released before BH is resumed other way
* in case when BSS_LOST command arrived the processing of the * in case when BSS_LOST command arrived the processing of the
......
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