diff options
Diffstat (limited to 'drivers/net/wireless/b43/bus.c')
-rw-r--r-- | drivers/net/wireless/b43/bus.c | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/drivers/net/wireless/b43/bus.c b/drivers/net/wireless/b43/bus.c new file mode 100644 index 000000000000..4200713eb597 --- /dev/null +++ b/drivers/net/wireless/b43/bus.c | |||
@@ -0,0 +1,127 @@ | |||
1 | /* | ||
2 | |||
3 | Broadcom B43 wireless driver | ||
4 | Bus abstraction layer | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published by | ||
8 | the Free Software Foundation; either version 2 of the License, or | ||
9 | (at your option) any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; see the file COPYING. If not, write to | ||
18 | the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, | ||
19 | Boston, MA 02110-1301, USA. | ||
20 | |||
21 | */ | ||
22 | |||
23 | #include "b43.h" | ||
24 | #include "bus.h" | ||
25 | |||
26 | |||
27 | /* SSB */ | ||
28 | #ifdef CONFIG_B43_SSB | ||
29 | static inline int b43_bus_ssb_bus_may_powerdown(struct b43_bus_dev *dev) | ||
30 | { | ||
31 | return ssb_bus_may_powerdown(dev->sdev->bus); | ||
32 | } | ||
33 | static inline int b43_bus_ssb_bus_powerup(struct b43_bus_dev *dev, | ||
34 | bool dynamic_pctl) | ||
35 | { | ||
36 | return ssb_bus_powerup(dev->sdev->bus, dynamic_pctl); | ||
37 | } | ||
38 | static inline int b43_bus_ssb_device_is_enabled(struct b43_bus_dev *dev) | ||
39 | { | ||
40 | return ssb_device_is_enabled(dev->sdev); | ||
41 | } | ||
42 | static inline void b43_bus_ssb_device_enable(struct b43_bus_dev *dev, | ||
43 | u32 core_specific_flags) | ||
44 | { | ||
45 | ssb_device_enable(dev->sdev, core_specific_flags); | ||
46 | } | ||
47 | static inline void b43_bus_ssb_device_disable(struct b43_bus_dev *dev, | ||
48 | u32 core_specific_flags) | ||
49 | { | ||
50 | ssb_device_disable(dev->sdev, core_specific_flags); | ||
51 | } | ||
52 | |||
53 | static inline u16 b43_bus_ssb_read16(struct b43_bus_dev *dev, u16 offset) | ||
54 | { | ||
55 | return ssb_read16(dev->sdev, offset); | ||
56 | } | ||
57 | static inline u32 b43_bus_ssb_read32(struct b43_bus_dev *dev, u16 offset) | ||
58 | { | ||
59 | return ssb_read32(dev->sdev, offset); | ||
60 | } | ||
61 | static inline | ||
62 | void b43_bus_ssb_write16(struct b43_bus_dev *dev, u16 offset, u16 value) | ||
63 | { | ||
64 | ssb_write16(dev->sdev, offset, value); | ||
65 | } | ||
66 | static inline | ||
67 | void b43_bus_ssb_write32(struct b43_bus_dev *dev, u16 offset, u32 value) | ||
68 | { | ||
69 | ssb_write32(dev->sdev, offset, value); | ||
70 | } | ||
71 | static inline | ||
72 | void b43_bus_ssb_block_read(struct b43_bus_dev *dev, void *buffer, | ||
73 | size_t count, u16 offset, u8 reg_width) | ||
74 | { | ||
75 | ssb_block_read(dev->sdev, buffer, count, offset, reg_width); | ||
76 | } | ||
77 | static inline | ||
78 | void b43_bus_ssb_block_write(struct b43_bus_dev *dev, const void *buffer, | ||
79 | size_t count, u16 offset, u8 reg_width) | ||
80 | { | ||
81 | ssb_block_write(dev->sdev, buffer, count, offset, reg_width); | ||
82 | } | ||
83 | |||
84 | struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev) | ||
85 | { | ||
86 | struct b43_bus_dev *dev; | ||
87 | |||
88 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | ||
89 | if (!dev) | ||
90 | return NULL; | ||
91 | |||
92 | dev->bus_type = B43_BUS_SSB; | ||
93 | dev->sdev = sdev; | ||
94 | |||
95 | dev->bus_may_powerdown = b43_bus_ssb_bus_may_powerdown; | ||
96 | dev->bus_powerup = b43_bus_ssb_bus_powerup; | ||
97 | dev->device_is_enabled = b43_bus_ssb_device_is_enabled; | ||
98 | dev->device_enable = b43_bus_ssb_device_enable; | ||
99 | dev->device_disable = b43_bus_ssb_device_disable; | ||
100 | |||
101 | dev->read16 = b43_bus_ssb_read16; | ||
102 | dev->read32 = b43_bus_ssb_read32; | ||
103 | dev->write16 = b43_bus_ssb_write16; | ||
104 | dev->write32 = b43_bus_ssb_write32; | ||
105 | dev->block_read = b43_bus_ssb_block_read; | ||
106 | dev->block_write = b43_bus_ssb_block_write; | ||
107 | |||
108 | dev->dev = sdev->dev; | ||
109 | dev->dma_dev = sdev->dma_dev; | ||
110 | dev->irq = sdev->irq; | ||
111 | |||
112 | dev->board_vendor = sdev->bus->boardinfo.vendor; | ||
113 | dev->board_type = sdev->bus->boardinfo.type; | ||
114 | dev->board_rev = sdev->bus->boardinfo.rev; | ||
115 | |||
116 | dev->chip_id = sdev->bus->chip_id; | ||
117 | dev->chip_rev = sdev->bus->chip_rev; | ||
118 | dev->chip_pkg = sdev->bus->chip_package; | ||
119 | |||
120 | dev->bus_sprom = &sdev->bus->sprom; | ||
121 | |||
122 | dev->core_id = sdev->id.coreid; | ||
123 | dev->core_rev = sdev->id.revision; | ||
124 | |||
125 | return dev; | ||
126 | } | ||
127 | #endif /* CONFIG_B43_SSB */ | ||