diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2011-07-06 13:03:46 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-07-08 11:11:18 -0400 |
commit | 397915c30731340ee3f348d1be597b22467acbdf (patch) | |
tree | e9e266588b2fd3e8cbdf7f341024d7d528bb06f8 /drivers/net/wireless | |
parent | d1507051bf6004c8ff0cf823fc5e115fc0a740b3 (diff) |
b43: implement BCMA bus ops
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/b43/bus.c | 100 | ||||
-rw-r--r-- | drivers/net/wireless/b43/bus.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/b43/main.c | 7 |
3 files changed, 110 insertions, 0 deletions
diff --git a/drivers/net/wireless/b43/bus.c b/drivers/net/wireless/b43/bus.c index 4200713eb597..c45c76dc49c7 100644 --- a/drivers/net/wireless/b43/bus.c +++ b/drivers/net/wireless/b43/bus.c | |||
@@ -23,6 +23,106 @@ | |||
23 | #include "b43.h" | 23 | #include "b43.h" |
24 | #include "bus.h" | 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 | /* SSB */ | 127 | /* SSB */ |
28 | #ifdef CONFIG_B43_SSB | 128 | #ifdef CONFIG_B43_SSB |
diff --git a/drivers/net/wireless/b43/bus.h b/drivers/net/wireless/b43/bus.h index 79a5ab4270c3..a70b7b9a550b 100644 --- a/drivers/net/wireless/b43/bus.h +++ b/drivers/net/wireless/b43/bus.h | |||
@@ -2,12 +2,14 @@ | |||
2 | #define B43_BUS_H_ | 2 | #define B43_BUS_H_ |
3 | 3 | ||
4 | enum b43_bus_type { | 4 | enum b43_bus_type { |
5 | B43_BUS_BCMA, | ||
5 | B43_BUS_SSB, | 6 | B43_BUS_SSB, |
6 | }; | 7 | }; |
7 | 8 | ||
8 | struct b43_bus_dev { | 9 | struct b43_bus_dev { |
9 | enum b43_bus_type bus_type; | 10 | enum b43_bus_type bus_type; |
10 | union { | 11 | union { |
12 | struct bcma_device *bdev; | ||
11 | struct ssb_device *sdev; | 13 | struct ssb_device *sdev; |
12 | }; | 14 | }; |
13 | 15 | ||
@@ -57,6 +59,7 @@ static inline bool b43_bus_host_is_sdio(struct b43_bus_dev *dev) | |||
57 | dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO); | 59 | dev->sdev->bus->bustype == SSB_BUSTYPE_SDIO); |
58 | } | 60 | } |
59 | 61 | ||
62 | struct b43_bus_dev *b43_bus_dev_bcma_init(struct bcma_device *core); | ||
60 | struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev); | 63 | struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev); |
61 | 64 | ||
62 | #endif /* B43_BUS_H_ */ | 65 | #endif /* B43_BUS_H_ */ |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 410b77f29575..b85a9737ecbe 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -5010,7 +5010,14 @@ static struct b43_wl *b43_wireless_init(struct b43_bus_dev *dev) | |||
5010 | #ifdef CONFIG_B43_BCMA | 5010 | #ifdef CONFIG_B43_BCMA |
5011 | static int b43_bcma_probe(struct bcma_device *core) | 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 | b43err(NULL, "BCMA is not supported yet!"); | 5019 | b43err(NULL, "BCMA is not supported yet!"); |
5020 | kfree(dev); | ||
5014 | return -EOPNOTSUPP; | 5021 | return -EOPNOTSUPP; |
5015 | } | 5022 | } |
5016 | 5023 | ||