Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

b43: implement BCMA bus ops

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Rafał Miłecki and committed by
John W. Linville
397915c3 d1507051

+110
+100
drivers/net/wireless/b43/bus.c
··· 23 23 #include "b43.h" 24 24 #include "bus.h" 25 25 26 + /* BCMA */ 27 + #ifdef CONFIG_B43_BCMA 28 + static int b43_bus_bcma_bus_may_powerdown(struct b43_bus_dev *dev) 29 + { 30 + return 0; /* bcma_bus_may_powerdown(dev->bdev->bus); */ 31 + } 32 + static int b43_bus_bcma_bus_powerup(struct b43_bus_dev *dev, 33 + bool dynamic_pctl) 34 + { 35 + return 0; /* bcma_bus_powerup(dev->sdev->bus, dynamic_pctl); */ 36 + } 37 + static int b43_bus_bcma_device_is_enabled(struct b43_bus_dev *dev) 38 + { 39 + return bcma_core_is_enabled(dev->bdev); 40 + } 41 + static void b43_bus_bcma_device_enable(struct b43_bus_dev *dev, 42 + u32 core_specific_flags) 43 + { 44 + bcma_core_enable(dev->bdev, core_specific_flags); 45 + } 46 + static void b43_bus_bcma_device_disable(struct b43_bus_dev *dev, 47 + u32 core_specific_flags) 48 + { 49 + bcma_core_disable(dev->bdev, core_specific_flags); 50 + } 51 + static u16 b43_bus_bcma_read16(struct b43_bus_dev *dev, u16 offset) 52 + { 53 + return bcma_read16(dev->bdev, offset); 54 + } 55 + static u32 b43_bus_bcma_read32(struct b43_bus_dev *dev, u16 offset) 56 + { 57 + return bcma_read32(dev->bdev, offset); 58 + } 59 + static 60 + void b43_bus_bcma_write16(struct b43_bus_dev *dev, u16 offset, u16 value) 61 + { 62 + bcma_write16(dev->bdev, offset, value); 63 + } 64 + static 65 + void b43_bus_bcma_write32(struct b43_bus_dev *dev, u16 offset, u32 value) 66 + { 67 + bcma_write32(dev->bdev, offset, value); 68 + } 69 + static 70 + void b43_bus_bcma_block_read(struct b43_bus_dev *dev, void *buffer, 71 + size_t count, u16 offset, u8 reg_width) 72 + { 73 + bcma_block_read(dev->bdev, buffer, count, offset, reg_width); 74 + } 75 + static 76 + void b43_bus_bcma_block_write(struct b43_bus_dev *dev, const void *buffer, 77 + size_t count, u16 offset, u8 reg_width) 78 + { 79 + bcma_block_write(dev->bdev, buffer, count, offset, reg_width); 80 + } 81 + 82 + struct b43_bus_dev *b43_bus_dev_bcma_init(struct bcma_device *core) 83 + { 84 + struct b43_bus_dev *dev = kzalloc(sizeof(*dev), GFP_KERNEL); 85 + if (!dev) 86 + return NULL; 87 + 88 + dev->bus_type = B43_BUS_BCMA; 89 + dev->bdev = core; 90 + 91 + dev->bus_may_powerdown = b43_bus_bcma_bus_may_powerdown; 92 + dev->bus_powerup = b43_bus_bcma_bus_powerup; 93 + dev->device_is_enabled = b43_bus_bcma_device_is_enabled; 94 + dev->device_enable = b43_bus_bcma_device_enable; 95 + dev->device_disable = b43_bus_bcma_device_disable; 96 + 97 + dev->read16 = b43_bus_bcma_read16; 98 + dev->read32 = b43_bus_bcma_read32; 99 + dev->write16 = b43_bus_bcma_write16; 100 + dev->write32 = b43_bus_bcma_write32; 101 + dev->block_read = b43_bus_bcma_block_read; 102 + dev->block_write = b43_bus_bcma_block_write; 103 + 104 + dev->dev = &core->dev; 105 + dev->dma_dev = core->dma_dev; 106 + dev->irq = core->irq; 107 + 108 + /* 109 + dev->board_vendor = core->bus->boardinfo.vendor; 110 + dev->board_type = core->bus->boardinfo.type; 111 + dev->board_rev = core->bus->boardinfo.rev; 112 + */ 113 + 114 + dev->chip_id = core->bus->chipinfo.id; 115 + dev->chip_rev = core->bus->chipinfo.rev; 116 + dev->chip_pkg = core->bus->chipinfo.pkg; 117 + 118 + dev->bus_sprom = &core->bus->sprom; 119 + 120 + dev->core_id = core->id.id; 121 + dev->core_rev = core->id.rev; 122 + 123 + return dev; 124 + } 125 + #endif /* CONFIG_B43_BCMA */ 26 126 27 127 /* SSB */ 28 128 #ifdef CONFIG_B43_SSB
+3
drivers/net/wireless/b43/bus.h
··· 2 2 #define B43_BUS_H_ 3 3 4 4 enum b43_bus_type { 5 + B43_BUS_BCMA, 5 6 B43_BUS_SSB, 6 7 }; 7 8 8 9 struct b43_bus_dev { 9 10 enum b43_bus_type bus_type; 10 11 union { 12 + struct bcma_device *bdev; 11 13 struct ssb_device *sdev; 12 14 }; 13 15 ··· 59 57 dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO); 60 58 } 61 59 60 + struct b43_bus_dev *b43_bus_dev_bcma_init(struct bcma_device *core); 62 61 struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev); 63 62 64 63 #endif /* B43_BUS_H_ */
+7
drivers/net/wireless/b43/main.c
··· 5010 5010 #ifdef CONFIG_B43_BCMA 5011 5011 static int b43_bcma_probe(struct bcma_device *core) 5012 5012 { 5013 + struct b43_bus_dev *dev; 5014 + 5015 + dev = b43_bus_dev_bcma_init(core); 5016 + if (!dev) 5017 + return -ENODEV; 5018 + 5013 5019 b43err(NULL, "BCMA is not supported yet!"); 5020 + kfree(dev); 5014 5021 return -EOPNOTSUPP; 5015 5022 } 5016 5023