diff options
Diffstat (limited to 'include/linux/ssb/ssb.h')
-rw-r--r-- | include/linux/ssb/ssb.h | 50 |
1 files changed, 45 insertions, 5 deletions
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h index db53defde5ee..50dfd0dc4093 100644 --- a/include/linux/ssb/ssb.h +++ b/include/linux/ssb/ssb.h | |||
@@ -72,10 +72,18 @@ struct ssb_device; | |||
72 | /* Lowlevel read/write operations on the device MMIO. | 72 | /* Lowlevel read/write operations on the device MMIO. |
73 | * Internal, don't use that outside of ssb. */ | 73 | * Internal, don't use that outside of ssb. */ |
74 | struct ssb_bus_ops { | 74 | struct ssb_bus_ops { |
75 | u8 (*read8)(struct ssb_device *dev, u16 offset); | ||
75 | u16 (*read16)(struct ssb_device *dev, u16 offset); | 76 | u16 (*read16)(struct ssb_device *dev, u16 offset); |
76 | u32 (*read32)(struct ssb_device *dev, u16 offset); | 77 | u32 (*read32)(struct ssb_device *dev, u16 offset); |
78 | void (*write8)(struct ssb_device *dev, u16 offset, u8 value); | ||
77 | void (*write16)(struct ssb_device *dev, u16 offset, u16 value); | 79 | void (*write16)(struct ssb_device *dev, u16 offset, u16 value); |
78 | void (*write32)(struct ssb_device *dev, u16 offset, u32 value); | 80 | void (*write32)(struct ssb_device *dev, u16 offset, u32 value); |
81 | #ifdef CONFIG_SSB_BLOCKIO | ||
82 | void (*block_read)(struct ssb_device *dev, void *buffer, | ||
83 | size_t count, u16 offset, u8 reg_width); | ||
84 | void (*block_write)(struct ssb_device *dev, const void *buffer, | ||
85 | size_t count, u16 offset, u8 reg_width); | ||
86 | #endif | ||
79 | }; | 87 | }; |
80 | 88 | ||
81 | 89 | ||
@@ -247,9 +255,9 @@ struct ssb_bus { | |||
247 | /* Pointer to the PCMCIA device (only if bustype == SSB_BUSTYPE_PCMCIA). */ | 255 | /* Pointer to the PCMCIA device (only if bustype == SSB_BUSTYPE_PCMCIA). */ |
248 | struct pcmcia_device *host_pcmcia; | 256 | struct pcmcia_device *host_pcmcia; |
249 | 257 | ||
250 | #ifdef CONFIG_SSB_PCIHOST | 258 | #ifdef CONFIG_SSB_SPROM |
251 | /* Mutex to protect the SPROM writing. */ | 259 | /* Mutex to protect the SPROM writing. */ |
252 | struct mutex pci_sprom_mutex; | 260 | struct mutex sprom_mutex; |
253 | #endif | 261 | #endif |
254 | 262 | ||
255 | /* ID information about the Chip. */ | 263 | /* ID information about the Chip. */ |
@@ -262,9 +270,6 @@ struct ssb_bus { | |||
262 | struct ssb_device devices[SSB_MAX_NR_CORES]; | 270 | struct ssb_device devices[SSB_MAX_NR_CORES]; |
263 | u8 nr_devices; | 271 | u8 nr_devices; |
264 | 272 | ||
265 | /* Reference count. Number of suspended devices. */ | ||
266 | u8 suspend_cnt; | ||
267 | |||
268 | /* Software ID number for this bus. */ | 273 | /* Software ID number for this bus. */ |
269 | unsigned int busnumber; | 274 | unsigned int busnumber; |
270 | 275 | ||
@@ -336,6 +341,13 @@ extern int ssb_bus_pcmciabus_register(struct ssb_bus *bus, | |||
336 | 341 | ||
337 | extern void ssb_bus_unregister(struct ssb_bus *bus); | 342 | extern void ssb_bus_unregister(struct ssb_bus *bus); |
338 | 343 | ||
344 | /* Suspend a SSB bus. | ||
345 | * Call this from the parent bus suspend routine. */ | ||
346 | extern int ssb_bus_suspend(struct ssb_bus *bus); | ||
347 | /* Resume a SSB bus. | ||
348 | * Call this from the parent bus resume routine. */ | ||
349 | extern int ssb_bus_resume(struct ssb_bus *bus); | ||
350 | |||
339 | extern u32 ssb_clockspeed(struct ssb_bus *bus); | 351 | extern u32 ssb_clockspeed(struct ssb_bus *bus); |
340 | 352 | ||
341 | /* Is the device enabled in hardware? */ | 353 | /* Is the device enabled in hardware? */ |
@@ -348,6 +360,10 @@ void ssb_device_disable(struct ssb_device *dev, u32 core_specific_flags); | |||
348 | 360 | ||
349 | 361 | ||
350 | /* Device MMIO register read/write functions. */ | 362 | /* Device MMIO register read/write functions. */ |
363 | static inline u8 ssb_read8(struct ssb_device *dev, u16 offset) | ||
364 | { | ||
365 | return dev->ops->read8(dev, offset); | ||
366 | } | ||
351 | static inline u16 ssb_read16(struct ssb_device *dev, u16 offset) | 367 | static inline u16 ssb_read16(struct ssb_device *dev, u16 offset) |
352 | { | 368 | { |
353 | return dev->ops->read16(dev, offset); | 369 | return dev->ops->read16(dev, offset); |
@@ -356,6 +372,10 @@ static inline u32 ssb_read32(struct ssb_device *dev, u16 offset) | |||
356 | { | 372 | { |
357 | return dev->ops->read32(dev, offset); | 373 | return dev->ops->read32(dev, offset); |
358 | } | 374 | } |
375 | static inline void ssb_write8(struct ssb_device *dev, u16 offset, u8 value) | ||
376 | { | ||
377 | dev->ops->write8(dev, offset, value); | ||
378 | } | ||
359 | static inline void ssb_write16(struct ssb_device *dev, u16 offset, u16 value) | 379 | static inline void ssb_write16(struct ssb_device *dev, u16 offset, u16 value) |
360 | { | 380 | { |
361 | dev->ops->write16(dev, offset, value); | 381 | dev->ops->write16(dev, offset, value); |
@@ -364,6 +384,19 @@ static inline void ssb_write32(struct ssb_device *dev, u16 offset, u32 value) | |||
364 | { | 384 | { |
365 | dev->ops->write32(dev, offset, value); | 385 | dev->ops->write32(dev, offset, value); |
366 | } | 386 | } |
387 | #ifdef CONFIG_SSB_BLOCKIO | ||
388 | static inline void ssb_block_read(struct ssb_device *dev, void *buffer, | ||
389 | size_t count, u16 offset, u8 reg_width) | ||
390 | { | ||
391 | dev->ops->block_read(dev, buffer, count, offset, reg_width); | ||
392 | } | ||
393 | |||
394 | static inline void ssb_block_write(struct ssb_device *dev, const void *buffer, | ||
395 | size_t count, u16 offset, u8 reg_width) | ||
396 | { | ||
397 | dev->ops->block_write(dev, buffer, count, offset, reg_width); | ||
398 | } | ||
399 | #endif /* CONFIG_SSB_BLOCKIO */ | ||
367 | 400 | ||
368 | 401 | ||
369 | /* Translation (routing) bits that need to be ORed to DMA | 402 | /* Translation (routing) bits that need to be ORed to DMA |
@@ -416,5 +449,12 @@ extern int ssb_bus_powerup(struct ssb_bus *bus, bool dynamic_pctl); | |||
416 | extern u32 ssb_admatch_base(u32 adm); | 449 | extern u32 ssb_admatch_base(u32 adm); |
417 | extern u32 ssb_admatch_size(u32 adm); | 450 | extern u32 ssb_admatch_size(u32 adm); |
418 | 451 | ||
452 | /* PCI device mapping and fixup routines. | ||
453 | * Called from the architecture pcibios init code. | ||
454 | * These are only available on SSB_EMBEDDED configurations. */ | ||
455 | #ifdef CONFIG_SSB_EMBEDDED | ||
456 | int ssb_pcibios_plat_dev_init(struct pci_dev *dev); | ||
457 | int ssb_pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin); | ||
458 | #endif /* CONFIG_SSB_EMBEDDED */ | ||
419 | 459 | ||
420 | #endif /* LINUX_SSB_H_ */ | 460 | #endif /* LINUX_SSB_H_ */ |