#include "bh.h"
#include "hwio.h"
#include "wsm.h"
-#include "sbus.h"
+#include "hwbus.h"
#include "debug.h"
#include "fwio.h"
pr_debug("[BH] irq.\n");
/* Disable Interrupts! */
- /* NOTE: sbus_ops->lock already held */
+ /* NOTE: hwbus_ops->lock already held */
__cw1200_irq_enable(priv, 0);
if (/* WARN_ON */(priv->bh_error))
* to the NEXT Message length + 2 Bytes for SKB */
read_len = read_len + 2;
- alloc_len = priv->sbus_ops->align_size(
- priv->sbus_priv, read_len);
+ alloc_len = priv->hwbus_ops->align_size(
+ priv->hwbus_priv, read_len);
/* Check if not exceeding CW1200 capabilities */
if (WARN_ON_ONCE(alloc_len > EFFECTIVE_BUF_SIZE)) {
atomic_add(1, &priv->bh_tx);
- tx_len = priv->sbus_ops->align_size(
- priv->sbus_priv, tx_len);
+ tx_len = priv->hwbus_ops->align_size(
+ priv->hwbus_priv, tx_len);
/* Check if not exceeding CW1200 capabilities */
if (WARN_ON_ONCE(tx_len > EFFECTIVE_BUF_SIZE))
done:
/* Re-enable device interrupts */
- priv->sbus_ops->lock(priv->sbus_priv);
+ priv->hwbus_ops->lock(priv->hwbus_priv);
__cw1200_irq_enable(priv, 1);
- priv->sbus_ops->unlock(priv->sbus_priv);
+ priv->hwbus_ops->unlock(priv->hwbus_priv);
}
/* Explicitly disable device interrupts */
- priv->sbus_ops->lock(priv->sbus_priv);
+ priv->hwbus_ops->lock(priv->hwbus_priv);
__cw1200_irq_enable(priv, 0);
- priv->sbus_ops->unlock(priv->sbus_priv);
+ priv->hwbus_ops->unlock(priv->hwbus_priv);
if (!term) {
pr_err("[BH] Fatal error, exiting.\n");
#include "pm.h"
/* Forward declarations */
-struct sbus_ops;
+struct hwbus_ops;
struct task_struct;
struct cw1200_debug_priv;
struct firmware;
u8 mac_addr[ETH_ALEN];
/* Hardware interface */
- const struct sbus_ops *sbus_ops;
- struct sbus_priv *sbus_priv;
+ const struct hwbus_ops *hwbus_ops;
+ struct hwbus_priv *hwbus_priv;
/* Hardware information */
enum {
};
/* interfaces for the drivers */
-int cw1200_core_probe(const struct sbus_ops *sbus_ops,
- struct sbus_priv *sbus,
+int cw1200_core_probe(const struct hwbus_ops *hwbus_ops,
+ struct hwbus_priv *hwbus,
struct device *pdev,
struct cw1200_common **pself,
int ref_clk, const u8 *macaddr,
#include <net/mac80211.h>
#include "cw1200.h"
-#include "sbus.h"
+#include "hwbus.h"
#include <linux/cw1200_platform.h>
#include "hwio.h"
#define SDIO_BLOCK_SIZE (512)
-struct sbus_priv {
+struct hwbus_priv {
struct sdio_func *func;
struct cw1200_common *core;
const struct cw1200_platform_data_sdio *pdata;
{ /* 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,
void *dst, int 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,
const void *src, int 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);
}
-static void cw1200_sdio_unlock(struct sbus_priv *self)
+static void cw1200_sdio_unlock(struct hwbus_priv *self)
{
sdio_release_host(self->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. */
if (self->core)
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) {
sdio_claim_host(self->func);
}
}
-static int cw1200_request_irq(struct sbus_priv *self)
+static int cw1200_request_irq(struct hwbus_priv *self)
{
int ret;
const struct resource *irq = self->pdata->irq;
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;
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;
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)
size = round_up(size, SDIO_BLOCK_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;
return ret;
}
-static struct sbus_ops cw1200_sdio_sbus_ops = {
- .sbus_memcpy_fromio = cw1200_sdio_memcpy_fromio,
- .sbus_memcpy_toio = cw1200_sdio_memcpy_toio,
+static struct hwbus_ops cw1200_sdio_hwbus_ops = {
+ .hwbus_memcpy_fromio = cw1200_sdio_memcpy_fromio,
+ .hwbus_memcpy_toio = cw1200_sdio_memcpy_toio,
.lock = cw1200_sdio_lock,
.unlock = cw1200_sdio_unlock,
.align_size = cw1200_sdio_align_size,
static int cw1200_sdio_probe(struct sdio_func *func,
const struct sdio_device_id *id)
{
- struct sbus_priv *self;
+ struct hwbus_priv *self;
int status;
pr_info("cw1200_wlan_sdio: Probe called\n");
self = kzalloc(sizeof(*self), GFP_KERNEL);
if (!self) {
- pr_err("Can't allocate SDIO sbus_priv.\n");
+ pr_err("Can't allocate SDIO hwbus_priv.\n");
return -ENOMEM;
}
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->pdata->ref_clk,
self->pdata->macaddr,
* device is disconnected */
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) {
cw1200_sdio_irq_unsubscribe(self);
{
int ret;
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))
return -EAGAIN;
#include <linux/device.h>
#include "cw1200.h"
-#include "sbus.h"
+#include "hwbus.h"
#include <linux/cw1200_platform.h>
#include "hwio.h"
/* #define SPI_DEBUG */
-struct sbus_priv {
+struct hwbus_priv {
struct spi_device *func;
struct cw1200_common *core;
const struct cw1200_platform_data_spi *pdata;
*/
-static int cw1200_spi_memcpy_fromio(struct sbus_priv *self,
+static int cw1200_spi_memcpy_fromio(struct hwbus_priv *self,
unsigned int addr,
void *dst, int count)
{
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,
const void *src, int count)
{
return rval;
}
-static void cw1200_spi_lock(struct sbus_priv *self)
+static void cw1200_spi_lock(struct hwbus_priv *self)
{
unsigned long flags;
return;
}
-static void cw1200_spi_unlock(struct sbus_priv *self)
+static void cw1200_spi_unlock(struct hwbus_priv *self)
{
unsigned long flags;
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) {
cw1200_irq_handler(self->core);
}
}
-static int cw1200_spi_irq_subscribe(struct sbus_priv *self)
+static int cw1200_spi_irq_subscribe(struct hwbus_priv *self)
{
int 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;
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;
}
-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);
}
-static struct sbus_ops cw1200_spi_sbus_ops = {
- .sbus_memcpy_fromio = cw1200_spi_memcpy_fromio,
- .sbus_memcpy_toio = cw1200_spi_memcpy_toio,
+static struct hwbus_ops cw1200_spi_hwbus_ops = {
+ .hwbus_memcpy_fromio = cw1200_spi_memcpy_fromio,
+ .hwbus_memcpy_toio = cw1200_spi_memcpy_toio,
.lock = cw1200_spi_lock,
.unlock = cw1200_spi_unlock,
.align_size = cw1200_spi_align_size,
{
const struct cw1200_platform_data_spi *plat_data =
func->dev.platform_data;
- struct sbus_priv *self;
+ struct hwbus_priv *self;
int status;
/* Sanity check speed */
self = kzalloc(sizeof(*self), GFP_KERNEL);
if (!self) {
- pr_err("Can't allocate SPI sbus_priv.");
+ pr_err("Can't allocate SPI hwbus_priv.");
return -ENOMEM;
}
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->pdata->ref_clk,
self->pdata->macaddr,
/* Disconnect Function to be called by SPI stack when device is disconnected */
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) {
cw1200_spi_irq_unsubscribe(self);
#ifdef CONFIG_PM
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))
return -EAGAIN;
#include "cw1200.h"
#include "fwio.h"
#include "hwio.h"
-#include "sbus.h"
+#include "hwbus.h"
#include "bh.h"
static int cw1200_get_hw_type(u32 config_reg_val, int *major_revision)
}
/* Enable interrupt signalling */
- priv->sbus_ops->lock(priv->sbus_priv);
+ priv->hwbus_ops->lock(priv->hwbus_priv);
ret = __cw1200_irq_enable(priv, 1);
- priv->sbus_ops->unlock(priv->sbus_priv);
+ priv->hwbus_ops->unlock(priv->hwbus_priv);
if (ret < 0)
goto unsubscribe;
unsubscribe:
/* Disable interrupt signalling */
- priv->sbus_ops->lock(priv->sbus_priv);
+ priv->hwbus_ops->lock(priv->hwbus_priv);
ret = __cw1200_irq_enable(priv, 0);
- priv->sbus_ops->unlock(priv->sbus_priv);
+ priv->hwbus_ops->unlock(priv->hwbus_priv);
return ret;
}
--- /dev/null
+/*
+ * Common hwbus abstraction layer interface for cw1200 wireless driver
+ *
+ * Copyright (c) 2010, ST-Ericsson
+ * Author: Dmitry Tarnyagin <dmitry.tarnyagin@lockless.no>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef CW1200_HWBUS_H
+#define CW1200_HWBUS_H
+
+struct hwbus_priv;
+
+void cw1200_irq_handler(struct cw1200_common *priv);
+
+/* This MUST be wrapped with hwbus_ops->lock/unlock! */
+int __cw1200_irq_enable(struct cw1200_common *priv, int enable);
+
+struct hwbus_ops {
+ int (*hwbus_memcpy_fromio)(struct hwbus_priv *self, unsigned int addr,
+ void *dst, int count);
+ int (*hwbus_memcpy_toio)(struct hwbus_priv *self, unsigned int addr,
+ const void *src, int count);
+ void (*lock)(struct hwbus_priv *self);
+ void (*unlock)(struct hwbus_priv *self);
+ size_t (*align_size)(struct hwbus_priv *self, size_t size);
+ int (*power_mgmt)(struct hwbus_priv *self, bool suspend);
+};
+
+#endif /* CW1200_HWBUS_H */
#include "cw1200.h"
#include "hwio.h"
-#include "sbus.h"
+#include "hwbus.h"
/* Sdio addr is 4*spi_addr */
#define SPI_REG_ADDR_TO_SDIO(spi_reg_addr) ((spi_reg_addr) << 2)
addr_sdio = SPI_REG_ADDR_TO_SDIO(addr);
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,
buf, buf_len);
}
addr_sdio = SPI_REG_ADDR_TO_SDIO(addr);
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,
buf, buf_len);
}
size_t buf_len)
{
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);
- priv->sbus_ops->unlock(priv->sbus_priv);
+ priv->hwbus_ops->unlock(priv->hwbus_priv);
return ret;
}
size_t buf_len)
{
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);
- priv->sbus_ops->unlock(priv->sbus_priv);
+ priv->hwbus_ops->unlock(priv->hwbus_priv);
return ret;
}
int ret, retry = 1;
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) {
ret = __cw1200_reg_read(priv,
}
}
- priv->sbus_ops->unlock(priv->sbus_priv);
+ priv->hwbus_ops->unlock(priv->hwbus_priv);
return ret;
}
int ret, retry = 1;
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) {
ret = __cw1200_reg_write(priv,
}
}
- priv->sbus_ops->unlock(priv->sbus_priv);
+ priv->hwbus_ops->unlock(priv->hwbus_priv);
return ret;
}
goto out;
}
- priv->sbus_ops->lock(priv->sbus_priv);
+ priv->hwbus_ops->lock(priv->hwbus_priv);
/* Write address */
ret = __cw1200_reg_write_32(priv, ST90TDS_SRAM_BASE_ADDR_REG_ID, addr);
if (ret < 0) {
}
out:
- priv->sbus_ops->unlock(priv->sbus_priv);
+ priv->hwbus_ops->unlock(priv->hwbus_priv);
return ret;
}
return -EINVAL;
}
- priv->sbus_ops->lock(priv->sbus_priv);
+ priv->hwbus_ops->lock(priv->hwbus_priv);
/* Write address */
ret = __cw1200_reg_write_32(priv, ST90TDS_SRAM_BASE_ADDR_REG_ID, addr);
}
out:
- priv->sbus_ops->unlock(priv->sbus_priv);
+ priv->hwbus_ops->unlock(priv->hwbus_priv);
return ret;
}
#include "cw1200.h"
#include "txrx.h"
-#include "sbus.h"
+#include "hwbus.h"
#include "fwio.h"
#include "hwio.h"
#include "bh.h"
}
}
-int cw1200_core_probe(const struct sbus_ops *sbus_ops,
- struct sbus_priv *sbus,
+int cw1200_core_probe(const struct hwbus_ops *hwbus_ops,
+ struct hwbus_priv *hwbus,
struct device *pdev,
struct cw1200_common **core,
int ref_clk, const u8 *macaddr,
if (cw1200_sdd_path)
priv->sdd_path = cw1200_sdd_path;
- priv->sbus_ops = sbus_ops;
- priv->sbus_priv = sbus;
+ priv->hwbus_ops = hwbus_ops;
+ priv->hwbus_priv = hwbus;
priv->pdev = pdev;
SET_IEEE80211_DEV(priv->hw, pdev);
void cw1200_core_release(struct cw1200_common *self)
{
/* Disable device interrupts */
- self->sbus_ops->lock(self->sbus_priv);
+ self->hwbus_ops->lock(self->hwbus_priv);
__cw1200_irq_enable(self, 0);
- self->sbus_ops->unlock(self->sbus_priv);
+ self->hwbus_ops->unlock(self->hwbus_priv);
/* And then clean up */
cw1200_unregister_common(self->hw);
#include "pm.h"
#include "sta.h"
#include "bh.h"
-#include "sbus.h"
+#include "hwbus.h"
#define CW1200_BEACON_SKIPPING_MULTIPLIER 3
pm_state->suspend_state = state;
/* 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) {
wiphy_err(priv->hw->wiphy,
"PM request failed: %d. WoW is disabled.\n", ret);
pm_state->suspend_state = NULL;
/* 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
* in case when BSS_LOST command arrived the processing of the
+++ /dev/null
-/*
- * Common sbus abstraction layer interface for cw1200 wireless driver
- *
- * Copyright (c) 2010, ST-Ericsson
- * Author: Dmitry Tarnyagin <dmitry.tarnyagin@lockless.no>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#ifndef CW1200_SBUS_H
-#define CW1200_SBUS_H
-
-/*
- * sbus priv forward definition.
- * Implemented and instantiated in particular modules.
- */
-struct sbus_priv;
-
-void cw1200_irq_handler(struct cw1200_common *priv);
-
-/* This MUST be wrapped with sbus_ops->lock/unlock! */
-int __cw1200_irq_enable(struct cw1200_common *priv, int enable);
-
-struct sbus_ops {
- int (*sbus_memcpy_fromio)(struct sbus_priv *self, unsigned int addr,
- void *dst, int count);
- int (*sbus_memcpy_toio)(struct sbus_priv *self, unsigned int addr,
- const void *src, int count);
- void (*lock)(struct sbus_priv *self);
- void (*unlock)(struct sbus_priv *self);
- size_t (*align_size)(struct sbus_priv *self, size_t size);
- int (*power_mgmt)(struct sbus_priv *self, bool suspend);
-};
-
-#endif /* CW1200_SBUS_H */