diff options
Diffstat (limited to 'include/linux/bcma/bcma.h')
-rw-r--r-- | include/linux/bcma/bcma.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h index 08763e4e848..8c96654bef1 100644 --- a/include/linux/bcma/bcma.h +++ b/include/linux/bcma/bcma.h | |||
@@ -6,6 +6,7 @@ | |||
6 | 6 | ||
7 | #include <linux/bcma/bcma_driver_chipcommon.h> | 7 | #include <linux/bcma/bcma_driver_chipcommon.h> |
8 | #include <linux/bcma/bcma_driver_pci.h> | 8 | #include <linux/bcma/bcma_driver_pci.h> |
9 | #include <linux/ssb/ssb.h> /* SPROM sharing */ | ||
9 | 10 | ||
10 | #include "bcma_regs.h" | 11 | #include "bcma_regs.h" |
11 | 12 | ||
@@ -24,6 +25,11 @@ struct bcma_chipinfo { | |||
24 | u8 pkg; | 25 | u8 pkg; |
25 | }; | 26 | }; |
26 | 27 | ||
28 | enum bcma_clkmode { | ||
29 | BCMA_CLKMODE_FAST, | ||
30 | BCMA_CLKMODE_DYNAMIC, | ||
31 | }; | ||
32 | |||
27 | struct bcma_host_ops { | 33 | struct bcma_host_ops { |
28 | u8 (*read8)(struct bcma_device *core, u16 offset); | 34 | u8 (*read8)(struct bcma_device *core, u16 offset); |
29 | u16 (*read16)(struct bcma_device *core, u16 offset); | 35 | u16 (*read16)(struct bcma_device *core, u16 offset); |
@@ -31,6 +37,12 @@ struct bcma_host_ops { | |||
31 | void (*write8)(struct bcma_device *core, u16 offset, u8 value); | 37 | void (*write8)(struct bcma_device *core, u16 offset, u8 value); |
32 | void (*write16)(struct bcma_device *core, u16 offset, u16 value); | 38 | void (*write16)(struct bcma_device *core, u16 offset, u16 value); |
33 | void (*write32)(struct bcma_device *core, u16 offset, u32 value); | 39 | void (*write32)(struct bcma_device *core, u16 offset, u32 value); |
40 | #ifdef CONFIG_BCMA_BLOCKIO | ||
41 | void (*block_read)(struct bcma_device *core, void *buffer, | ||
42 | size_t count, u16 offset, u8 reg_width); | ||
43 | void (*block_write)(struct bcma_device *core, const void *buffer, | ||
44 | size_t count, u16 offset, u8 reg_width); | ||
45 | #endif | ||
34 | /* Agent ops */ | 46 | /* Agent ops */ |
35 | u32 (*aread32)(struct bcma_device *core, u16 offset); | 47 | u32 (*aread32)(struct bcma_device *core, u16 offset); |
36 | void (*awrite32)(struct bcma_device *core, u16 offset, u32 value); | 48 | void (*awrite32)(struct bcma_device *core, u16 offset, u32 value); |
@@ -117,6 +129,8 @@ struct bcma_device { | |||
117 | struct bcma_device_id id; | 129 | struct bcma_device_id id; |
118 | 130 | ||
119 | struct device dev; | 131 | struct device dev; |
132 | struct device *dma_dev; | ||
133 | unsigned int irq; | ||
120 | bool dev_registered; | 134 | bool dev_registered; |
121 | 135 | ||
122 | u8 core_index; | 136 | u8 core_index; |
@@ -179,6 +193,10 @@ struct bcma_bus { | |||
179 | 193 | ||
180 | struct bcma_drv_cc drv_cc; | 194 | struct bcma_drv_cc drv_cc; |
181 | struct bcma_drv_pci drv_pci; | 195 | struct bcma_drv_pci drv_pci; |
196 | |||
197 | /* We decided to share SPROM struct with SSB as long as we do not need | ||
198 | * any hacks for BCMA. This simplifies drivers code. */ | ||
199 | struct ssb_sprom sprom; | ||
182 | }; | 200 | }; |
183 | 201 | ||
184 | extern inline u32 bcma_read8(struct bcma_device *core, u16 offset) | 202 | extern inline u32 bcma_read8(struct bcma_device *core, u16 offset) |
@@ -208,6 +226,18 @@ void bcma_write32(struct bcma_device *core, u16 offset, u32 value) | |||
208 | { | 226 | { |
209 | core->bus->ops->write32(core, offset, value); | 227 | core->bus->ops->write32(core, offset, value); |
210 | } | 228 | } |
229 | #ifdef CONFIG_BCMA_BLOCKIO | ||
230 | extern inline void bcma_block_read(struct bcma_device *core, void *buffer, | ||
231 | size_t count, u16 offset, u8 reg_width) | ||
232 | { | ||
233 | core->bus->ops->block_read(core, buffer, count, offset, reg_width); | ||
234 | } | ||
235 | extern inline void bcma_block_write(struct bcma_device *core, const void *buffer, | ||
236 | size_t count, u16 offset, u8 reg_width) | ||
237 | { | ||
238 | core->bus->ops->block_write(core, buffer, count, offset, reg_width); | ||
239 | } | ||
240 | #endif | ||
211 | extern inline u32 bcma_aread32(struct bcma_device *core, u16 offset) | 241 | extern inline u32 bcma_aread32(struct bcma_device *core, u16 offset) |
212 | { | 242 | { |
213 | return core->bus->ops->aread32(core, offset); | 243 | return core->bus->ops->aread32(core, offset); |
@@ -218,7 +248,24 @@ void bcma_awrite32(struct bcma_device *core, u16 offset, u32 value) | |||
218 | core->bus->ops->awrite32(core, offset, value); | 248 | core->bus->ops->awrite32(core, offset, value); |
219 | } | 249 | } |
220 | 250 | ||
251 | #define bcma_mask32(cc, offset, mask) \ | ||
252 | bcma_write32(cc, offset, bcma_read32(cc, offset) & (mask)) | ||
253 | #define bcma_set32(cc, offset, set) \ | ||
254 | bcma_write32(cc, offset, bcma_read32(cc, offset) | (set)) | ||
255 | #define bcma_maskset32(cc, offset, mask, set) \ | ||
256 | bcma_write32(cc, offset, (bcma_read32(cc, offset) & (mask)) | (set)) | ||
257 | |||
221 | extern bool bcma_core_is_enabled(struct bcma_device *core); | 258 | extern bool bcma_core_is_enabled(struct bcma_device *core); |
259 | extern void bcma_core_disable(struct bcma_device *core, u32 flags); | ||
222 | extern int bcma_core_enable(struct bcma_device *core, u32 flags); | 260 | extern int bcma_core_enable(struct bcma_device *core, u32 flags); |
261 | extern void bcma_core_set_clockmode(struct bcma_device *core, | ||
262 | enum bcma_clkmode clkmode); | ||
263 | extern void bcma_core_pll_ctl(struct bcma_device *core, u32 req, u32 status, | ||
264 | bool on); | ||
265 | #define BCMA_DMA_TRANSLATION_MASK 0xC0000000 | ||
266 | #define BCMA_DMA_TRANSLATION_NONE 0x00000000 | ||
267 | #define BCMA_DMA_TRANSLATION_DMA32_CMT 0x40000000 /* Client Mode Translation for 32-bit DMA */ | ||
268 | #define BCMA_DMA_TRANSLATION_DMA64_CMT 0x80000000 /* Client Mode Translation for 64-bit DMA */ | ||
269 | extern u32 bcma_core_dma_translation(struct bcma_device *core); | ||
223 | 270 | ||
224 | #endif /* LINUX_BCMA_H_ */ | 271 | #endif /* LINUX_BCMA_H_ */ |