aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ssb/ssb.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/ssb/ssb.h')
-rw-r--r--include/linux/ssb/ssb.h54
1 files changed, 49 insertions, 5 deletions
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 20add65215af..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. */
74struct ssb_bus_ops { 74struct 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
@@ -129,6 +137,10 @@ struct ssb_device {
129 const struct ssb_bus_ops *ops; 137 const struct ssb_bus_ops *ops;
130 138
131 struct device *dev; 139 struct device *dev;
140 /* Pointer to the device that has to be used for
141 * any DMA related operation. */
142 struct device *dma_dev;
143
132 struct ssb_bus *bus; 144 struct ssb_bus *bus;
133 struct ssb_device_id id; 145 struct ssb_device_id id;
134 146
@@ -243,9 +255,9 @@ struct ssb_bus {
243 /* Pointer to the PCMCIA device (only if bustype == SSB_BUSTYPE_PCMCIA). */ 255 /* Pointer to the PCMCIA device (only if bustype == SSB_BUSTYPE_PCMCIA). */
244 struct pcmcia_device *host_pcmcia; 256 struct pcmcia_device *host_pcmcia;
245 257
246#ifdef CONFIG_SSB_PCIHOST 258#ifdef CONFIG_SSB_SPROM
247 /* Mutex to protect the SPROM writing. */ 259 /* Mutex to protect the SPROM writing. */
248 struct mutex pci_sprom_mutex; 260 struct mutex sprom_mutex;
249#endif 261#endif
250 262
251 /* ID information about the Chip. */ 263 /* ID information about the Chip. */
@@ -258,9 +270,6 @@ struct ssb_bus {
258 struct ssb_device devices[SSB_MAX_NR_CORES]; 270 struct ssb_device devices[SSB_MAX_NR_CORES];
259 u8 nr_devices; 271 u8 nr_devices;
260 272
261 /* Reference count. Number of suspended devices. */
262 u8 suspend_cnt;
263
264 /* Software ID number for this bus. */ 273 /* Software ID number for this bus. */
265 unsigned int busnumber; 274 unsigned int busnumber;
266 275
@@ -332,6 +341,13 @@ extern int ssb_bus_pcmciabus_register(struct ssb_bus *bus,
332 341
333extern void ssb_bus_unregister(struct ssb_bus *bus); 342extern void ssb_bus_unregister(struct ssb_bus *bus);
334 343
344/* Suspend a SSB bus.
345 * Call this from the parent bus suspend routine. */
346extern int ssb_bus_suspend(struct ssb_bus *bus);
347/* Resume a SSB bus.
348 * Call this from the parent bus resume routine. */
349extern int ssb_bus_resume(struct ssb_bus *bus);
350
335extern u32 ssb_clockspeed(struct ssb_bus *bus); 351extern u32 ssb_clockspeed(struct ssb_bus *bus);
336 352
337/* Is the device enabled in hardware? */ 353/* Is the device enabled in hardware? */
@@ -344,6 +360,10 @@ void ssb_device_disable(struct ssb_device *dev, u32 core_specific_flags);
344 360
345 361
346/* Device MMIO register read/write functions. */ 362/* Device MMIO register read/write functions. */
363static inline u8 ssb_read8(struct ssb_device *dev, u16 offset)
364{
365 return dev->ops->read8(dev, offset);
366}
347static inline u16 ssb_read16(struct ssb_device *dev, u16 offset) 367static inline u16 ssb_read16(struct ssb_device *dev, u16 offset)
348{ 368{
349 return dev->ops->read16(dev, offset); 369 return dev->ops->read16(dev, offset);
@@ -352,6 +372,10 @@ static inline u32 ssb_read32(struct ssb_device *dev, u16 offset)
352{ 372{
353 return dev->ops->read32(dev, offset); 373 return dev->ops->read32(dev, offset);
354} 374}
375static inline void ssb_write8(struct ssb_device *dev, u16 offset, u8 value)
376{
377 dev->ops->write8(dev, offset, value);
378}
355static inline void ssb_write16(struct ssb_device *dev, u16 offset, u16 value) 379static inline void ssb_write16(struct ssb_device *dev, u16 offset, u16 value)
356{ 380{
357 dev->ops->write16(dev, offset, value); 381 dev->ops->write16(dev, offset, value);
@@ -360,6 +384,19 @@ static inline void ssb_write32(struct ssb_device *dev, u16 offset, u32 value)
360{ 384{
361 dev->ops->write32(dev, offset, value); 385 dev->ops->write32(dev, offset, value);
362} 386}
387#ifdef CONFIG_SSB_BLOCKIO
388static 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
394static 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 */
363 400
364 401
365/* Translation (routing) bits that need to be ORed to DMA 402/* Translation (routing) bits that need to be ORed to DMA
@@ -412,5 +449,12 @@ extern int ssb_bus_powerup(struct ssb_bus *bus, bool dynamic_pctl);
412extern u32 ssb_admatch_base(u32 adm); 449extern u32 ssb_admatch_base(u32 adm);
413extern u32 ssb_admatch_size(u32 adm); 450extern u32 ssb_admatch_size(u32 adm);
414 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
456int ssb_pcibios_plat_dev_init(struct pci_dev *dev);
457int ssb_pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
458#endif /* CONFIG_SSB_EMBEDDED */
415 459
416#endif /* LINUX_SSB_H_ */ 460#endif /* LINUX_SSB_H_ */