1 --- a/drivers/net/b44.c
2 +++ b/drivers/net/b44.c
3 @@ -135,7 +135,6 @@ static void b44_init_rings(struct b44 *)
5 static void b44_init_hw(struct b44 *, int);
7 -static int dma_desc_align_mask;
8 static int dma_desc_sync_size;
11 @@ -150,9 +149,8 @@ static inline void b44_sync_dma_desc_for
13 enum dma_data_direction dir)
15 - ssb_dma_sync_single_range_for_device(sdev, dma_base,
16 - offset & dma_desc_align_mask,
17 - dma_desc_sync_size, dir);
18 + dma_sync_single_for_device(sdev->dma_dev, dma_base + offset,
19 + dma_desc_sync_size, dir);
22 static inline void b44_sync_dma_desc_for_cpu(struct ssb_device *sdev,
23 @@ -160,9 +158,8 @@ static inline void b44_sync_dma_desc_for
25 enum dma_data_direction dir)
27 - ssb_dma_sync_single_range_for_cpu(sdev, dma_base,
28 - offset & dma_desc_align_mask,
29 - dma_desc_sync_size, dir);
30 + dma_sync_single_for_cpu(sdev->dma_dev, dma_base + offset,
31 + dma_desc_sync_size, dir);
34 static inline unsigned long br32(const struct b44 *bp, unsigned long reg)
35 @@ -608,10 +605,10 @@ static void b44_tx(struct b44 *bp)
39 - ssb_dma_unmap_single(bp->sdev,
43 + dma_unmap_single(bp->sdev->dma_dev,
48 dev_kfree_skb_irq(skb);
50 @@ -648,29 +645,29 @@ static int b44_alloc_rx_skb(struct b44 *
54 - mapping = ssb_dma_map_single(bp->sdev, skb->data,
57 + mapping = dma_map_single(bp->sdev->dma_dev, skb->data,
61 /* Hardware bug work-around, the chip is unable to do PCI DMA
62 to/from anything above 1GB :-( */
63 - if (ssb_dma_mapping_error(bp->sdev, mapping) ||
64 + if (dma_mapping_error(bp->sdev->dma_dev, mapping) ||
65 mapping + RX_PKT_BUF_SZ > DMA_BIT_MASK(30)) {
67 - if (!ssb_dma_mapping_error(bp->sdev, mapping))
68 - ssb_dma_unmap_single(bp->sdev, mapping,
69 + if (!dma_mapping_error(bp->sdev->dma_dev, mapping))
70 + dma_unmap_single(bp->sdev->dma_dev, mapping,
71 RX_PKT_BUF_SZ, DMA_FROM_DEVICE);
72 dev_kfree_skb_any(skb);
73 skb = __netdev_alloc_skb(bp->dev, RX_PKT_BUF_SZ, GFP_ATOMIC|GFP_DMA);
76 - mapping = ssb_dma_map_single(bp->sdev, skb->data,
79 - if (ssb_dma_mapping_error(bp->sdev, mapping) ||
80 - mapping + RX_PKT_BUF_SZ > DMA_BIT_MASK(30)) {
81 - if (!ssb_dma_mapping_error(bp->sdev, mapping))
82 - ssb_dma_unmap_single(bp->sdev, mapping, RX_PKT_BUF_SZ,DMA_FROM_DEVICE);
83 + mapping = dma_map_single(bp->sdev->dma_dev, skb->data,
86 + if (dma_mapping_error(bp->sdev->dma_dev, mapping) ||
87 + mapping + RX_PKT_BUF_SZ > DMA_BIT_MASK(30)) {
88 + if (!dma_mapping_error(bp->sdev->dma_dev, mapping))
89 + dma_unmap_single(bp->sdev->dma_dev, mapping, RX_PKT_BUF_SZ,DMA_FROM_DEVICE);
90 dev_kfree_skb_any(skb);
93 @@ -745,9 +742,9 @@ static void b44_recycle_rx(struct b44 *b
94 dest_idx * sizeof(*dest_desc),
97 - ssb_dma_sync_single_for_device(bp->sdev, dest_map->mapping,
100 + dma_sync_single_for_device(bp->sdev->dma_dev, dest_map->mapping,
105 static int b44_rx(struct b44 *bp, int budget)
106 @@ -767,9 +764,9 @@ static int b44_rx(struct b44 *bp, int bu
107 struct rx_header *rh;
110 - ssb_dma_sync_single_for_cpu(bp->sdev, map,
113 + dma_sync_single_for_cpu(bp->sdev->dma_dev, map,
116 rh = (struct rx_header *) skb->data;
117 len = le16_to_cpu(rh->len);
118 if ((len > (RX_PKT_BUF_SZ - RX_PKT_OFFSET)) ||
119 @@ -801,8 +798,8 @@ static int b44_rx(struct b44 *bp, int bu
120 skb_size = b44_alloc_rx_skb(bp, cons, bp->rx_prod);
123 - ssb_dma_unmap_single(bp->sdev, map,
124 - skb_size, DMA_FROM_DEVICE);
125 + dma_unmap_single(bp->sdev->dma_dev, map,
126 + skb_size, DMA_FROM_DEVICE);
127 /* Leave out rx_header */
128 skb_put(skb, len + RX_PKT_OFFSET);
129 skb_pull(skb, RX_PKT_OFFSET);
130 @@ -954,24 +951,24 @@ static netdev_tx_t b44_start_xmit(struct
134 - mapping = ssb_dma_map_single(bp->sdev, skb->data, len, DMA_TO_DEVICE);
135 - if (ssb_dma_mapping_error(bp->sdev, mapping) || mapping + len > DMA_BIT_MASK(30)) {
136 + mapping = dma_map_single(bp->sdev->dma_dev, skb->data, len, DMA_TO_DEVICE);
137 + if (dma_mapping_error(bp->sdev->dma_dev, mapping) || mapping + len > DMA_BIT_MASK(30)) {
138 struct sk_buff *bounce_skb;
140 /* Chip can't handle DMA to/from >1GB, use bounce buffer */
141 - if (!ssb_dma_mapping_error(bp->sdev, mapping))
142 - ssb_dma_unmap_single(bp->sdev, mapping, len,
143 + if (!dma_mapping_error(bp->sdev->dma_dev, mapping))
144 + dma_unmap_single(bp->sdev->dma_dev, mapping, len,
147 bounce_skb = __netdev_alloc_skb(dev, len, GFP_ATOMIC | GFP_DMA);
151 - mapping = ssb_dma_map_single(bp->sdev, bounce_skb->data,
152 - len, DMA_TO_DEVICE);
153 - if (ssb_dma_mapping_error(bp->sdev, mapping) || mapping + len > DMA_BIT_MASK(30)) {
154 - if (!ssb_dma_mapping_error(bp->sdev, mapping))
155 - ssb_dma_unmap_single(bp->sdev, mapping,
156 + mapping = dma_map_single(bp->sdev->dma_dev, bounce_skb->data,
157 + len, DMA_TO_DEVICE);
158 + if (dma_mapping_error(bp->sdev->dma_dev, mapping) || mapping + len > DMA_BIT_MASK(30)) {
159 + if (!dma_mapping_error(bp->sdev->dma_dev, mapping))
160 + dma_unmap_single(bp->sdev->dma_dev, mapping,
162 dev_kfree_skb_any(bounce_skb);
164 @@ -1068,8 +1065,8 @@ static void b44_free_rings(struct b44 *b
168 - ssb_dma_unmap_single(bp->sdev, rp->mapping, RX_PKT_BUF_SZ,
170 + dma_unmap_single(bp->sdev->dma_dev, rp->mapping, RX_PKT_BUF_SZ,
172 dev_kfree_skb_any(rp->skb);
175 @@ -1080,8 +1077,8 @@ static void b44_free_rings(struct b44 *b
179 - ssb_dma_unmap_single(bp->sdev, rp->mapping, rp->skb->len,
181 + dma_unmap_single(bp->sdev->dma_dev, rp->mapping, rp->skb->len,
183 dev_kfree_skb_any(rp->skb);
186 @@ -1103,14 +1100,12 @@ static void b44_init_rings(struct b44 *b
187 memset(bp->tx_ring, 0, B44_TX_RING_BYTES);
189 if (bp->flags & B44_FLAG_RX_RING_HACK)
190 - ssb_dma_sync_single_for_device(bp->sdev, bp->rx_ring_dma,
192 - DMA_BIDIRECTIONAL);
193 + dma_sync_single_for_device(bp->sdev->dma_dev, bp->rx_ring_dma,
194 + DMA_TABLE_BYTES, DMA_BIDIRECTIONAL);
196 if (bp->flags & B44_FLAG_TX_RING_HACK)
197 - ssb_dma_sync_single_for_device(bp->sdev, bp->tx_ring_dma,
200 + dma_sync_single_for_device(bp->sdev->dma_dev, bp->tx_ring_dma,
201 + DMA_TABLE_BYTES, DMA_TO_DEVICE);
203 for (i = 0; i < bp->rx_pending; i++) {
204 if (b44_alloc_rx_skb(bp, -1, i) < 0)
205 @@ -1130,27 +1125,23 @@ static void b44_free_consistent(struct b
206 bp->tx_buffers = NULL;
208 if (bp->flags & B44_FLAG_RX_RING_HACK) {
209 - ssb_dma_unmap_single(bp->sdev, bp->rx_ring_dma,
211 - DMA_BIDIRECTIONAL);
212 + dma_unmap_single(bp->sdev->dma_dev, bp->rx_ring_dma,
213 + DMA_TABLE_BYTES, DMA_BIDIRECTIONAL);
216 - ssb_dma_free_consistent(bp->sdev, DMA_TABLE_BYTES,
217 - bp->rx_ring, bp->rx_ring_dma,
219 + dma_free_coherent(bp->sdev->dma_dev, DMA_TABLE_BYTES,
220 + bp->rx_ring, bp->rx_ring_dma);
222 bp->flags &= ~B44_FLAG_RX_RING_HACK;
225 if (bp->flags & B44_FLAG_TX_RING_HACK) {
226 - ssb_dma_unmap_single(bp->sdev, bp->tx_ring_dma,
229 + dma_unmap_single(bp->sdev->dma_dev, bp->tx_ring_dma,
230 + DMA_TABLE_BYTES, DMA_TO_DEVICE);
233 - ssb_dma_free_consistent(bp->sdev, DMA_TABLE_BYTES,
234 - bp->tx_ring, bp->tx_ring_dma,
236 + dma_free_coherent(bp->sdev->dma_dev, DMA_TABLE_BYTES,
237 + bp->tx_ring, bp->tx_ring_dma);
239 bp->flags &= ~B44_FLAG_TX_RING_HACK;
241 @@ -1175,7 +1166,8 @@ static int b44_alloc_consistent(struct b
244 size = DMA_TABLE_BYTES;
245 - bp->rx_ring = ssb_dma_alloc_consistent(bp->sdev, size, &bp->rx_ring_dma, gfp);
246 + bp->rx_ring = dma_alloc_coherent(bp->sdev->dma_dev, size,
247 + &bp->rx_ring_dma, gfp);
249 /* Allocation may have failed due to pci_alloc_consistent
250 insisting on use of GFP_DMA, which is more restrictive
251 @@ -1187,11 +1179,11 @@ static int b44_alloc_consistent(struct b
255 - rx_ring_dma = ssb_dma_map_single(bp->sdev, rx_ring,
257 - DMA_BIDIRECTIONAL);
258 + rx_ring_dma = dma_map_single(bp->sdev->dma_dev, rx_ring,
260 + DMA_BIDIRECTIONAL);
262 - if (ssb_dma_mapping_error(bp->sdev, rx_ring_dma) ||
263 + if (dma_mapping_error(bp->sdev->dma_dev, rx_ring_dma) ||
264 rx_ring_dma + size > DMA_BIT_MASK(30)) {
267 @@ -1202,7 +1194,8 @@ static int b44_alloc_consistent(struct b
268 bp->flags |= B44_FLAG_RX_RING_HACK;
271 - bp->tx_ring = ssb_dma_alloc_consistent(bp->sdev, size, &bp->tx_ring_dma, gfp);
272 + bp->tx_ring = dma_alloc_coherent(bp->sdev->dma_dev, size,
273 + &bp->tx_ring_dma, gfp);
275 /* Allocation may have failed due to ssb_dma_alloc_consistent
276 insisting on use of GFP_DMA, which is more restrictive
277 @@ -1214,11 +1207,11 @@ static int b44_alloc_consistent(struct b
281 - tx_ring_dma = ssb_dma_map_single(bp->sdev, tx_ring,
284 + tx_ring_dma = dma_map_single(bp->sdev->dma_dev, tx_ring,
288 - if (ssb_dma_mapping_error(bp->sdev, tx_ring_dma) ||
289 + if (dma_mapping_error(bp->sdev->dma_dev, tx_ring_dma) ||
290 tx_ring_dma + size > DMA_BIT_MASK(30)) {
293 @@ -2176,12 +2169,14 @@ static int __devinit b44_init_one(struct
294 "Failed to powerup the bus\n");
295 goto err_out_free_dev;
297 - err = ssb_dma_set_mask(sdev, DMA_BIT_MASK(30));
300 + if (dma_set_mask(sdev->dma_dev, DMA_BIT_MASK(30)) ||
301 + dma_set_coherent_mask(sdev->dma_dev, DMA_BIT_MASK(30))) {
303 "Required 30BIT DMA mask unsupported by the system\n");
304 goto err_out_powerdown;
307 err = b44_get_invariants(bp);
310 @@ -2344,7 +2339,6 @@ static int __init b44_init(void)
313 /* Setup paramaters for syncing RX/TX DMA descriptors */
314 - dma_desc_align_mask = ~(dma_desc_align_size - 1);
315 dma_desc_sync_size = max_t(unsigned int, dma_desc_align_size, sizeof(struct dma_desc));
317 err = b44_pci_init();
318 --- a/drivers/ssb/driver_chipcommon.c
319 +++ b/drivers/ssb/driver_chipcommon.c
320 @@ -209,6 +209,24 @@ static void chipco_powercontrol_init(str
324 +/* http://bcm-v4.sipsolutions.net/802.11/PmuFastPwrupDelay */
325 +static u16 pmu_fast_powerup_delay(struct ssb_chipcommon *cc)
327 + struct ssb_bus *bus = cc->dev->bus;
329 + switch (bus->chip_id) {
341 +/* http://bcm-v4.sipsolutions.net/802.11/ClkctlFastPwrupDelay */
342 static void calc_fast_powerup_delay(struct ssb_chipcommon *cc)
344 struct ssb_bus *bus = cc->dev->bus;
345 @@ -218,6 +236,12 @@ static void calc_fast_powerup_delay(stru
347 if (bus->bustype != SSB_BUSTYPE_PCI)
350 + if (cc->capabilities & SSB_CHIPCO_CAP_PMU) {
351 + cc->fast_pwrup_delay = pmu_fast_powerup_delay(cc);
355 if (!(cc->capabilities & SSB_CHIPCO_CAP_PCTL))
358 @@ -235,6 +259,7 @@ void ssb_chipcommon_init(struct ssb_chip
359 return; /* We don't have a ChipCommon */
360 if (cc->dev->id.revision >= 11)
361 cc->status = chipco_read32(cc, SSB_CHIPCO_CHIPSTAT);
362 + ssb_dprintk(KERN_INFO PFX "chipcommon status is 0x%x\n", cc->status);
364 chipco_powercontrol_init(cc);
365 ssb_chipco_set_clockmode(cc, SSB_CLKMODE_FAST);
366 --- a/drivers/ssb/driver_chipcommon_pmu.c
367 +++ b/drivers/ssb/driver_chipcommon_pmu.c
368 @@ -502,9 +502,9 @@ static void ssb_pmu_resources_init(struc
369 chipco_write32(cc, SSB_CHIPCO_PMU_MAXRES_MSK, max_msk);
372 +/* http://bcm-v4.sipsolutions.net/802.11/SSB/PmuInit */
373 void ssb_pmu_init(struct ssb_chipcommon *cc)
375 - struct ssb_bus *bus = cc->dev->bus;
378 if (!(cc->capabilities & SSB_CHIPCO_CAP_PMU))
379 @@ -516,15 +516,12 @@ void ssb_pmu_init(struct ssb_chipcommon
380 ssb_dprintk(KERN_DEBUG PFX "Found rev %u PMU (capabilities 0x%08X)\n",
381 cc->pmu.rev, pmucap);
383 - if (cc->pmu.rev >= 1) {
384 - if ((bus->chip_id == 0x4325) && (bus->chip_rev < 2)) {
385 - chipco_mask32(cc, SSB_CHIPCO_PMU_CTL,
386 - ~SSB_CHIPCO_PMU_CTL_NOILPONW);
388 - chipco_set32(cc, SSB_CHIPCO_PMU_CTL,
389 - SSB_CHIPCO_PMU_CTL_NOILPONW);
392 + if (cc->pmu.rev == 1)
393 + chipco_mask32(cc, SSB_CHIPCO_PMU_CTL,
394 + ~SSB_CHIPCO_PMU_CTL_NOILPONW);
396 + chipco_set32(cc, SSB_CHIPCO_PMU_CTL,
397 + SSB_CHIPCO_PMU_CTL_NOILPONW);
398 ssb_pmu_pll_init(cc);
399 ssb_pmu_resources_init(cc);
401 --- a/drivers/ssb/main.c
402 +++ b/drivers/ssb/main.c
403 @@ -486,6 +486,7 @@ static int ssb_devices_register(struct s
404 #ifdef CONFIG_SSB_PCIHOST
405 sdev->irq = bus->host_pci->irq;
406 dev->parent = &bus->host_pci->dev;
407 + sdev->dma_dev = dev->parent;
410 case SSB_BUSTYPE_PCMCIA:
411 @@ -501,6 +502,7 @@ static int ssb_devices_register(struct s
413 case SSB_BUSTYPE_SSB:
414 dev->dma_mask = &dev->coherent_dma_mask;
415 + sdev->dma_dev = dev;
419 @@ -1226,80 +1228,6 @@ u32 ssb_dma_translation(struct ssb_devic
421 EXPORT_SYMBOL(ssb_dma_translation);
423 -int ssb_dma_set_mask(struct ssb_device *dev, u64 mask)
425 -#ifdef CONFIG_SSB_PCIHOST
429 - switch (dev->bus->bustype) {
430 - case SSB_BUSTYPE_PCI:
431 -#ifdef CONFIG_SSB_PCIHOST
432 - err = pci_set_dma_mask(dev->bus->host_pci, mask);
435 - err = pci_set_consistent_dma_mask(dev->bus->host_pci, mask);
438 - case SSB_BUSTYPE_SSB:
439 - return dma_set_mask(dev->dev, mask);
441 - __ssb_dma_not_implemented(dev);
445 -EXPORT_SYMBOL(ssb_dma_set_mask);
447 -void * ssb_dma_alloc_consistent(struct ssb_device *dev, size_t size,
448 - dma_addr_t *dma_handle, gfp_t gfp_flags)
450 - switch (dev->bus->bustype) {
451 - case SSB_BUSTYPE_PCI:
452 -#ifdef CONFIG_SSB_PCIHOST
453 - if (gfp_flags & GFP_DMA) {
454 - /* Workaround: The PCI API does not support passing
456 - return dma_alloc_coherent(&dev->bus->host_pci->dev,
457 - size, dma_handle, gfp_flags);
459 - return pci_alloc_consistent(dev->bus->host_pci, size, dma_handle);
461 - case SSB_BUSTYPE_SSB:
462 - return dma_alloc_coherent(dev->dev, size, dma_handle, gfp_flags);
464 - __ssb_dma_not_implemented(dev);
468 -EXPORT_SYMBOL(ssb_dma_alloc_consistent);
470 -void ssb_dma_free_consistent(struct ssb_device *dev, size_t size,
471 - void *vaddr, dma_addr_t dma_handle,
474 - switch (dev->bus->bustype) {
475 - case SSB_BUSTYPE_PCI:
476 -#ifdef CONFIG_SSB_PCIHOST
477 - if (gfp_flags & GFP_DMA) {
478 - /* Workaround: The PCI API does not support passing
480 - dma_free_coherent(&dev->bus->host_pci->dev,
481 - size, vaddr, dma_handle);
484 - pci_free_consistent(dev->bus->host_pci, size,
485 - vaddr, dma_handle);
488 - case SSB_BUSTYPE_SSB:
489 - dma_free_coherent(dev->dev, size, vaddr, dma_handle);
492 - __ssb_dma_not_implemented(dev);
495 -EXPORT_SYMBOL(ssb_dma_free_consistent);
497 int ssb_bus_may_powerdown(struct ssb_bus *bus)
499 struct ssb_chipcommon *cc;
500 --- a/drivers/ssb/pci.c
501 +++ b/drivers/ssb/pci.c
502 @@ -626,11 +626,22 @@ static int ssb_pci_sprom_get(struct ssb_
505 if (bus->chipco.dev) { /* can be unavailible! */
506 - bus->sprom_offset = (bus->chipco.dev->id.revision < 31) ?
507 - SSB_SPROM_BASE1 : SSB_SPROM_BASE31;
509 + * get SPROM offset: SSB_SPROM_BASE1 except for
510 + * chipcommon rev >= 31 or chip ID is 0x4312 and
511 + * chipcommon status & 3 == 2
513 + if (bus->chipco.dev->id.revision >= 31)
514 + bus->sprom_offset = SSB_SPROM_BASE31;
515 + else if (bus->chip_id == 0x4312 &&
516 + (bus->chipco.status & 0x03) == 2)
517 + bus->sprom_offset = SSB_SPROM_BASE31;
519 + bus->sprom_offset = SSB_SPROM_BASE1;
521 bus->sprom_offset = SSB_SPROM_BASE1;
523 + ssb_dprintk(KERN_INFO PFX "SPROM offset is 0x%x\n", bus->sprom_offset);
525 buf = kcalloc(SSB_SPROMSIZE_WORDS_R123, sizeof(u16), GFP_KERNEL);
527 --- a/include/linux/ssb/ssb.h
528 +++ b/include/linux/ssb/ssb.h
529 @@ -167,7 +167,7 @@ struct ssb_device {
530 * is an optimization. */
531 const struct ssb_bus_ops *ops;
533 - struct device *dev;
534 + struct device *dev, *dma_dev;
537 struct ssb_device_id id;
538 @@ -470,14 +470,6 @@ extern u32 ssb_dma_translation(struct ss
539 #define SSB_DMA_TRANSLATION_MASK 0xC0000000
540 #define SSB_DMA_TRANSLATION_SHIFT 30
542 -extern int ssb_dma_set_mask(struct ssb_device *dev, u64 mask);
544 -extern void * ssb_dma_alloc_consistent(struct ssb_device *dev, size_t size,
545 - dma_addr_t *dma_handle, gfp_t gfp_flags);
546 -extern void ssb_dma_free_consistent(struct ssb_device *dev, size_t size,
547 - void *vaddr, dma_addr_t dma_handle,
550 static inline void __cold __ssb_dma_not_implemented(struct ssb_device *dev)
552 #ifdef CONFIG_SSB_DEBUG
553 @@ -486,155 +478,6 @@ static inline void __cold __ssb_dma_not_
557 -static inline int ssb_dma_mapping_error(struct ssb_device *dev, dma_addr_t addr)
559 - switch (dev->bus->bustype) {
560 - case SSB_BUSTYPE_PCI:
561 -#ifdef CONFIG_SSB_PCIHOST
562 - return pci_dma_mapping_error(dev->bus->host_pci, addr);
565 - case SSB_BUSTYPE_SSB:
566 - return dma_mapping_error(dev->dev, addr);
570 - __ssb_dma_not_implemented(dev);
574 -static inline dma_addr_t ssb_dma_map_single(struct ssb_device *dev, void *p,
575 - size_t size, enum dma_data_direction dir)
577 - switch (dev->bus->bustype) {
578 - case SSB_BUSTYPE_PCI:
579 -#ifdef CONFIG_SSB_PCIHOST
580 - return pci_map_single(dev->bus->host_pci, p, size, dir);
583 - case SSB_BUSTYPE_SSB:
584 - return dma_map_single(dev->dev, p, size, dir);
588 - __ssb_dma_not_implemented(dev);
592 -static inline void ssb_dma_unmap_single(struct ssb_device *dev, dma_addr_t dma_addr,
593 - size_t size, enum dma_data_direction dir)
595 - switch (dev->bus->bustype) {
596 - case SSB_BUSTYPE_PCI:
597 -#ifdef CONFIG_SSB_PCIHOST
598 - pci_unmap_single(dev->bus->host_pci, dma_addr, size, dir);
602 - case SSB_BUSTYPE_SSB:
603 - dma_unmap_single(dev->dev, dma_addr, size, dir);
608 - __ssb_dma_not_implemented(dev);
611 -static inline void ssb_dma_sync_single_for_cpu(struct ssb_device *dev,
612 - dma_addr_t dma_addr,
614 - enum dma_data_direction dir)
616 - switch (dev->bus->bustype) {
617 - case SSB_BUSTYPE_PCI:
618 -#ifdef CONFIG_SSB_PCIHOST
619 - pci_dma_sync_single_for_cpu(dev->bus->host_pci, dma_addr,
624 - case SSB_BUSTYPE_SSB:
625 - dma_sync_single_for_cpu(dev->dev, dma_addr, size, dir);
630 - __ssb_dma_not_implemented(dev);
633 -static inline void ssb_dma_sync_single_for_device(struct ssb_device *dev,
634 - dma_addr_t dma_addr,
636 - enum dma_data_direction dir)
638 - switch (dev->bus->bustype) {
639 - case SSB_BUSTYPE_PCI:
640 -#ifdef CONFIG_SSB_PCIHOST
641 - pci_dma_sync_single_for_device(dev->bus->host_pci, dma_addr,
646 - case SSB_BUSTYPE_SSB:
647 - dma_sync_single_for_device(dev->dev, dma_addr, size, dir);
652 - __ssb_dma_not_implemented(dev);
655 -static inline void ssb_dma_sync_single_range_for_cpu(struct ssb_device *dev,
656 - dma_addr_t dma_addr,
657 - unsigned long offset,
659 - enum dma_data_direction dir)
661 - switch (dev->bus->bustype) {
662 - case SSB_BUSTYPE_PCI:
663 -#ifdef CONFIG_SSB_PCIHOST
664 - /* Just sync everything. That's all the PCI API can do. */
665 - pci_dma_sync_single_for_cpu(dev->bus->host_pci, dma_addr,
666 - offset + size, dir);
670 - case SSB_BUSTYPE_SSB:
671 - dma_sync_single_range_for_cpu(dev->dev, dma_addr, offset,
677 - __ssb_dma_not_implemented(dev);
680 -static inline void ssb_dma_sync_single_range_for_device(struct ssb_device *dev,
681 - dma_addr_t dma_addr,
682 - unsigned long offset,
684 - enum dma_data_direction dir)
686 - switch (dev->bus->bustype) {
687 - case SSB_BUSTYPE_PCI:
688 -#ifdef CONFIG_SSB_PCIHOST
689 - /* Just sync everything. That's all the PCI API can do. */
690 - pci_dma_sync_single_for_device(dev->bus->host_pci, dma_addr,
691 - offset + size, dir);
695 - case SSB_BUSTYPE_SSB:
696 - dma_sync_single_range_for_device(dev->dev, dma_addr, offset,
702 - __ssb_dma_not_implemented(dev);
706 #ifdef CONFIG_SSB_PCIHOST
707 /* PCI-host wrapper driver */
708 extern int ssb_pcihost_register(struct pci_driver *driver);