aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2010-06-03 22:37:44 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-06-04 16:00:42 -0400
commit467429b475e56f154f93b3b14fd75f238d14597a (patch)
tree8c12b9b8aee222e55852659ef3f753e73084339b
parent39a6f4bce6b437046edf042f78f7a0529e253bff (diff)
ssb: remove the ssb DMA API
Now they are unnecessary. We can use the generic DMA API with any bus. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: Michael Buesch <mb@bu3sch.de> Cc: Gary Zambrano <zambrano@broadcom.com> Cc: Stefano Brivio <stefano.brivio@polimi.it> Cc: Larry Finger <Larry.Finger@lwfinger.net> Cc: John W. Linville <linville@tuxdriver.com> Cc: David S. Miller <davem@davemloft.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/ssb/main.c74
-rw-r--r--include/linux/ssb/ssb.h157
2 files changed, 0 insertions, 231 deletions
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c
index a732b396e602..7cee7f4eb60b 100644
--- a/drivers/ssb/main.c
+++ b/drivers/ssb/main.c
@@ -1228,80 +1228,6 @@ u32 ssb_dma_translation(struct ssb_device *dev)
1228} 1228}
1229EXPORT_SYMBOL(ssb_dma_translation); 1229EXPORT_SYMBOL(ssb_dma_translation);
1230 1230
1231int ssb_dma_set_mask(struct ssb_device *dev, u64 mask)
1232{
1233#ifdef CONFIG_SSB_PCIHOST
1234 int err;
1235#endif
1236
1237 switch (dev->bus->bustype) {
1238 case SSB_BUSTYPE_PCI:
1239#ifdef CONFIG_SSB_PCIHOST
1240 err = pci_set_dma_mask(dev->bus->host_pci, mask);
1241 if (err)
1242 return err;
1243 err = pci_set_consistent_dma_mask(dev->bus->host_pci, mask);
1244 return err;
1245#endif
1246 case SSB_BUSTYPE_SSB:
1247 return dma_set_mask(dev->dev, mask);
1248 default:
1249 __ssb_dma_not_implemented(dev);
1250 }
1251 return -ENOSYS;
1252}
1253EXPORT_SYMBOL(ssb_dma_set_mask);
1254
1255void * ssb_dma_alloc_consistent(struct ssb_device *dev, size_t size,
1256 dma_addr_t *dma_handle, gfp_t gfp_flags)
1257{
1258 switch (dev->bus->bustype) {
1259 case SSB_BUSTYPE_PCI:
1260#ifdef CONFIG_SSB_PCIHOST
1261 if (gfp_flags & GFP_DMA) {
1262 /* Workaround: The PCI API does not support passing
1263 * a GFP flag. */
1264 return dma_alloc_coherent(&dev->bus->host_pci->dev,
1265 size, dma_handle, gfp_flags);
1266 }
1267 return pci_alloc_consistent(dev->bus->host_pci, size, dma_handle);
1268#endif
1269 case SSB_BUSTYPE_SSB:
1270 return dma_alloc_coherent(dev->dev, size, dma_handle, gfp_flags);
1271 default:
1272 __ssb_dma_not_implemented(dev);
1273 }
1274 return NULL;
1275}
1276EXPORT_SYMBOL(ssb_dma_alloc_consistent);
1277
1278void ssb_dma_free_consistent(struct ssb_device *dev, size_t size,
1279 void *vaddr, dma_addr_t dma_handle,
1280 gfp_t gfp_flags)
1281{
1282 switch (dev->bus->bustype) {
1283 case SSB_BUSTYPE_PCI:
1284#ifdef CONFIG_SSB_PCIHOST
1285 if (gfp_flags & GFP_DMA) {
1286 /* Workaround: The PCI API does not support passing
1287 * a GFP flag. */
1288 dma_free_coherent(&dev->bus->host_pci->dev,
1289 size, vaddr, dma_handle);
1290 return;
1291 }
1292 pci_free_consistent(dev->bus->host_pci, size,
1293 vaddr, dma_handle);
1294 return;
1295#endif
1296 case SSB_BUSTYPE_SSB:
1297 dma_free_coherent(dev->dev, size, vaddr, dma_handle);
1298 return;
1299 default:
1300 __ssb_dma_not_implemented(dev);
1301 }
1302}
1303EXPORT_SYMBOL(ssb_dma_free_consistent);
1304
1305int ssb_bus_may_powerdown(struct ssb_bus *bus) 1231int ssb_bus_may_powerdown(struct ssb_bus *bus)
1306{ 1232{
1307 struct ssb_chipcommon *cc; 1233 struct ssb_chipcommon *cc;
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 0d5f04316b35..623b704fdc42 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -470,14 +470,6 @@ extern u32 ssb_dma_translation(struct ssb_device *dev);
470#define SSB_DMA_TRANSLATION_MASK 0xC0000000 470#define SSB_DMA_TRANSLATION_MASK 0xC0000000
471#define SSB_DMA_TRANSLATION_SHIFT 30 471#define SSB_DMA_TRANSLATION_SHIFT 30
472 472
473extern int ssb_dma_set_mask(struct ssb_device *dev, u64 mask);
474
475extern void * ssb_dma_alloc_consistent(struct ssb_device *dev, size_t size,
476 dma_addr_t *dma_handle, gfp_t gfp_flags);
477extern void ssb_dma_free_consistent(struct ssb_device *dev, size_t size,
478 void *vaddr, dma_addr_t dma_handle,
479 gfp_t gfp_flags);
480
481static inline void __cold __ssb_dma_not_implemented(struct ssb_device *dev) 473static inline void __cold __ssb_dma_not_implemented(struct ssb_device *dev)
482{ 474{
483#ifdef CONFIG_SSB_DEBUG 475#ifdef CONFIG_SSB_DEBUG
@@ -486,155 +478,6 @@ static inline void __cold __ssb_dma_not_implemented(struct ssb_device *dev)
486#endif /* DEBUG */ 478#endif /* DEBUG */
487} 479}
488 480
489static inline int ssb_dma_mapping_error(struct ssb_device *dev, dma_addr_t addr)
490{
491 switch (dev->bus->bustype) {
492 case SSB_BUSTYPE_PCI:
493#ifdef CONFIG_SSB_PCIHOST
494 return pci_dma_mapping_error(dev->bus->host_pci, addr);
495#endif
496 break;
497 case SSB_BUSTYPE_SSB:
498 return dma_mapping_error(dev->dev, addr);
499 default:
500 break;
501 }
502 __ssb_dma_not_implemented(dev);
503 return -ENOSYS;
504}
505
506static inline dma_addr_t ssb_dma_map_single(struct ssb_device *dev, void *p,
507 size_t size, enum dma_data_direction dir)
508{
509 switch (dev->bus->bustype) {
510 case SSB_BUSTYPE_PCI:
511#ifdef CONFIG_SSB_PCIHOST
512 return pci_map_single(dev->bus->host_pci, p, size, dir);
513#endif
514 break;
515 case SSB_BUSTYPE_SSB:
516 return dma_map_single(dev->dev, p, size, dir);
517 default:
518 break;
519 }
520 __ssb_dma_not_implemented(dev);
521 return 0;
522}
523
524static inline void ssb_dma_unmap_single(struct ssb_device *dev, dma_addr_t dma_addr,
525 size_t size, enum dma_data_direction dir)
526{
527 switch (dev->bus->bustype) {
528 case SSB_BUSTYPE_PCI:
529#ifdef CONFIG_SSB_PCIHOST
530 pci_unmap_single(dev->bus->host_pci, dma_addr, size, dir);
531 return;
532#endif
533 break;
534 case SSB_BUSTYPE_SSB:
535 dma_unmap_single(dev->dev, dma_addr, size, dir);
536 return;
537 default:
538 break;
539 }
540 __ssb_dma_not_implemented(dev);
541}
542
543static inline void ssb_dma_sync_single_for_cpu(struct ssb_device *dev,
544 dma_addr_t dma_addr,
545 size_t size,
546 enum dma_data_direction dir)
547{
548 switch (dev->bus->bustype) {
549 case SSB_BUSTYPE_PCI:
550#ifdef CONFIG_SSB_PCIHOST
551 pci_dma_sync_single_for_cpu(dev->bus->host_pci, dma_addr,
552 size, dir);
553 return;
554#endif
555 break;
556 case SSB_BUSTYPE_SSB:
557 dma_sync_single_for_cpu(dev->dev, dma_addr, size, dir);
558 return;
559 default:
560 break;
561 }
562 __ssb_dma_not_implemented(dev);
563}
564
565static inline void ssb_dma_sync_single_for_device(struct ssb_device *dev,
566 dma_addr_t dma_addr,
567 size_t size,
568 enum dma_data_direction dir)
569{
570 switch (dev->bus->bustype) {
571 case SSB_BUSTYPE_PCI:
572#ifdef CONFIG_SSB_PCIHOST
573 pci_dma_sync_single_for_device(dev->bus->host_pci, dma_addr,
574 size, dir);
575 return;
576#endif
577 break;
578 case SSB_BUSTYPE_SSB:
579 dma_sync_single_for_device(dev->dev, dma_addr, size, dir);
580 return;
581 default:
582 break;
583 }
584 __ssb_dma_not_implemented(dev);
585}
586
587static inline void ssb_dma_sync_single_range_for_cpu(struct ssb_device *dev,
588 dma_addr_t dma_addr,
589 unsigned long offset,
590 size_t size,
591 enum dma_data_direction dir)
592{
593 switch (dev->bus->bustype) {
594 case SSB_BUSTYPE_PCI:
595#ifdef CONFIG_SSB_PCIHOST
596 /* Just sync everything. That's all the PCI API can do. */
597 pci_dma_sync_single_for_cpu(dev->bus->host_pci, dma_addr,
598 offset + size, dir);
599 return;
600#endif
601 break;
602 case SSB_BUSTYPE_SSB:
603 dma_sync_single_range_for_cpu(dev->dev, dma_addr, offset,
604 size, dir);
605 return;
606 default:
607 break;
608 }
609 __ssb_dma_not_implemented(dev);
610}
611
612static inline void ssb_dma_sync_single_range_for_device(struct ssb_device *dev,
613 dma_addr_t dma_addr,
614 unsigned long offset,
615 size_t size,
616 enum dma_data_direction dir)
617{
618 switch (dev->bus->bustype) {
619 case SSB_BUSTYPE_PCI:
620#ifdef CONFIG_SSB_PCIHOST
621 /* Just sync everything. That's all the PCI API can do. */
622 pci_dma_sync_single_for_device(dev->bus->host_pci, dma_addr,
623 offset + size, dir);
624 return;
625#endif
626 break;
627 case SSB_BUSTYPE_SSB:
628 dma_sync_single_range_for_device(dev->dev, dma_addr, offset,
629 size, dir);
630 return;
631 default:
632 break;
633 }
634 __ssb_dma_not_implemented(dev);
635}
636
637
638#ifdef CONFIG_SSB_PCIHOST 481#ifdef CONFIG_SSB_PCIHOST
639/* PCI-host wrapper driver */ 482/* PCI-host wrapper driver */
640extern int ssb_pcihost_register(struct pci_driver *driver); 483extern int ssb_pcihost_register(struct pci_driver *driver);