summaryrefslogtreecommitdiffstats
path: root/drivers/bcma/main.c
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2013-06-26 10:02:11 +0200
committerJohn W. Linville <linville@tuxdriver.com>2013-06-27 13:42:16 -0400
commit88f9b65d444794bb607f71644362ba0642585206 (patch)
tree79b35a37ff7dbff438e572ce39b0aa8c43b2ff24 /drivers/bcma/main.c
parent8960400eeefa73e7fe32dc2b6b5ac529d43a9593 (diff)
downloadlinux-88f9b65d444794bb607f71644362ba0642585206.tar.gz
linux-88f9b65d444794bb607f71644362ba0642585206.tar.bz2
linux-88f9b65d444794bb607f71644362ba0642585206.zip
bcma: add support for BCM43142
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/bcma/main.c')
-rw-r--r--drivers/bcma/main.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
index f72f52b4b1dd..0067422ec17d 100644
--- a/drivers/bcma/main.c
+++ b/drivers/bcma/main.c
@@ -93,6 +93,25 @@ struct bcma_device *bcma_find_core_unit(struct bcma_bus *bus, u16 coreid,
return NULL;
}
+bool bcma_wait_value(struct bcma_device *core, u16 reg, u32 mask, u32 value,
+ int timeout)
+{
+ unsigned long deadline = jiffies + timeout;
+ u32 val;
+
+ do {
+ val = bcma_read32(core, reg);
+ if ((val & mask) == value)
+ return true;
+ cpu_relax();
+ udelay(10);
+ } while (!time_after_eq(jiffies, deadline));
+
+ bcma_warn(core->bus, "Timeout waiting for register 0x%04X!\n", reg);
+
+ return false;
+}
+
static void bcma_release_core_dev(struct device *dev)
{
struct bcma_device *core = container_of(dev, struct bcma_device, dev);