b43: implement BCMA bus ops
authorRafał Miłecki <zajec5@gmail.com>
Wed, 6 Jul 2011 17:03:46 +0000 (19:03 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 8 Jul 2011 15:11:18 +0000 (11:11 -0400)
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/b43/bus.c
drivers/net/wireless/b43/bus.h
drivers/net/wireless/b43/main.c

index 4200713eb597cc2d35b5db1f0b84ac85b37c3d27..c45c76dc49c71583faa224e2fdbc73620ac4da86 100644 (file)
 #include "b43.h"
 #include "bus.h"
 
+/* BCMA */
+#ifdef CONFIG_B43_BCMA
+static int b43_bus_bcma_bus_may_powerdown(struct b43_bus_dev *dev)
+{
+       return 0; /* bcma_bus_may_powerdown(dev->bdev->bus); */
+}
+static int b43_bus_bcma_bus_powerup(struct b43_bus_dev *dev,
+                                         bool dynamic_pctl)
+{
+       return 0; /* bcma_bus_powerup(dev->sdev->bus, dynamic_pctl); */
+}
+static int b43_bus_bcma_device_is_enabled(struct b43_bus_dev *dev)
+{
+       return bcma_core_is_enabled(dev->bdev);
+}
+static void b43_bus_bcma_device_enable(struct b43_bus_dev *dev,
+                                            u32 core_specific_flags)
+{
+       bcma_core_enable(dev->bdev, core_specific_flags);
+}
+static void b43_bus_bcma_device_disable(struct b43_bus_dev *dev,
+                                             u32 core_specific_flags)
+{
+       bcma_core_disable(dev->bdev, core_specific_flags);
+}
+static u16 b43_bus_bcma_read16(struct b43_bus_dev *dev, u16 offset)
+{
+       return bcma_read16(dev->bdev, offset);
+}
+static u32 b43_bus_bcma_read32(struct b43_bus_dev *dev, u16 offset)
+{
+       return bcma_read32(dev->bdev, offset);
+}
+static
+void b43_bus_bcma_write16(struct b43_bus_dev *dev, u16 offset, u16 value)
+{
+       bcma_write16(dev->bdev, offset, value);
+}
+static
+void b43_bus_bcma_write32(struct b43_bus_dev *dev, u16 offset, u32 value)
+{
+       bcma_write32(dev->bdev, offset, value);
+}
+static
+void b43_bus_bcma_block_read(struct b43_bus_dev *dev, void *buffer,
+                            size_t count, u16 offset, u8 reg_width)
+{
+       bcma_block_read(dev->bdev, buffer, count, offset, reg_width);
+}
+static
+void b43_bus_bcma_block_write(struct b43_bus_dev *dev, const void *buffer,
+                             size_t count, u16 offset, u8 reg_width)
+{
+       bcma_block_write(dev->bdev, buffer, count, offset, reg_width);
+}
+
+struct b43_bus_dev *b43_bus_dev_bcma_init(struct bcma_device *core)
+{
+       struct b43_bus_dev *dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+       if (!dev)
+               return NULL;
+
+       dev->bus_type = B43_BUS_BCMA;
+       dev->bdev = core;
+
+       dev->bus_may_powerdown = b43_bus_bcma_bus_may_powerdown;
+       dev->bus_powerup = b43_bus_bcma_bus_powerup;
+       dev->device_is_enabled = b43_bus_bcma_device_is_enabled;
+       dev->device_enable = b43_bus_bcma_device_enable;
+       dev->device_disable = b43_bus_bcma_device_disable;
+
+       dev->read16 = b43_bus_bcma_read16;
+       dev->read32 = b43_bus_bcma_read32;
+       dev->write16 = b43_bus_bcma_write16;
+       dev->write32 = b43_bus_bcma_write32;
+       dev->block_read = b43_bus_bcma_block_read;
+       dev->block_write = b43_bus_bcma_block_write;
+
+       dev->dev = &core->dev;
+       dev->dma_dev = core->dma_dev;
+       dev->irq = core->irq;
+
+       /*
+       dev->board_vendor = core->bus->boardinfo.vendor;
+       dev->board_type = core->bus->boardinfo.type;
+       dev->board_rev = core->bus->boardinfo.rev;
+       */
+
+       dev->chip_id = core->bus->chipinfo.id;
+       dev->chip_rev = core->bus->chipinfo.rev;
+       dev->chip_pkg = core->bus->chipinfo.pkg;
+
+       dev->bus_sprom = &core->bus->sprom;
+
+       dev->core_id = core->id.id;
+       dev->core_rev = core->id.rev;
+
+       return dev;
+}
+#endif /* CONFIG_B43_BCMA */
 
 /* SSB */
 #ifdef CONFIG_B43_SSB
index 79a5ab4270c343b119f869b07b72c02dd941eae9..a70b7b9a550bd6d3dd71a443baf69c3c7b4e50b1 100644 (file)
@@ -2,12 +2,14 @@
 #define B43_BUS_H_
 
 enum b43_bus_type {
+       B43_BUS_BCMA,
        B43_BUS_SSB,
 };
 
 struct b43_bus_dev {
        enum b43_bus_type bus_type;
        union {
+               struct bcma_device *bdev;
                struct ssb_device *sdev;
        };
 
@@ -57,6 +59,7 @@ static inline bool b43_bus_host_is_sdio(struct b43_bus_dev *dev)
                dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO);
 }
 
+struct b43_bus_dev *b43_bus_dev_bcma_init(struct bcma_device *core);
 struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev);
 
 #endif /* B43_BUS_H_ */
index 410b77f29575ccabba24a305e320ffdd23c8c24f..b85a9737ecbe758151c52e33211ab7e4e51707a5 100644 (file)
@@ -5010,7 +5010,14 @@ static struct b43_wl *b43_wireless_init(struct b43_bus_dev *dev)
 #ifdef CONFIG_B43_BCMA
 static int b43_bcma_probe(struct bcma_device *core)
 {
+       struct b43_bus_dev *dev;
+
+       dev = b43_bus_dev_bcma_init(core);
+       if (!dev)
+               return -ENODEV;
+
        b43err(NULL, "BCMA is not supported yet!");
+       kfree(dev);
        return -EOPNOTSUPP;
 }