diff options
Diffstat (limited to 'include/linux/ssb/ssb.h')
-rw-r--r-- | include/linux/ssb/ssb.h | 159 |
1 files changed, 1 insertions, 158 deletions
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h index a2608bff9c78..623b704fdc42 100644 --- a/include/linux/ssb/ssb.h +++ b/include/linux/ssb/ssb.h | |||
@@ -167,7 +167,7 @@ struct ssb_device { | |||
167 | * is an optimization. */ | 167 | * is an optimization. */ |
168 | const struct ssb_bus_ops *ops; | 168 | const struct ssb_bus_ops *ops; |
169 | 169 | ||
170 | struct device *dev; | 170 | struct device *dev, *dma_dev; |
171 | 171 | ||
172 | struct ssb_bus *bus; | 172 | struct ssb_bus *bus; |
173 | struct ssb_device_id id; | 173 | struct ssb_device_id id; |
@@ -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 | ||
473 | extern int ssb_dma_set_mask(struct ssb_device *dev, u64 mask); | ||
474 | |||
475 | extern void * ssb_dma_alloc_consistent(struct ssb_device *dev, size_t size, | ||
476 | dma_addr_t *dma_handle, gfp_t gfp_flags); | ||
477 | extern 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 | |||
481 | static inline void __cold __ssb_dma_not_implemented(struct ssb_device *dev) | 473 | static 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 | ||
489 | static 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 | |||
506 | static 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 | |||
524 | static 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 | |||
543 | static 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 | |||
565 | static 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 | |||
587 | static 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 | |||
612 | static 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 */ |
640 | extern int ssb_pcihost_register(struct pci_driver *driver); | 483 | extern int ssb_pcihost_register(struct pci_driver *driver); |