diff options
author | David S. Miller <davem@davemloft.net> | 2008-08-27 21:37:58 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-08-29 05:13:12 -0400 |
commit | 7a715f46012f3552294154978aed59cba9804928 (patch) | |
tree | 9e7079ae4ad370b63ac6c8a4face573d6cf60533 /drivers/atm/fore200e.c | |
parent | 5778002874de0fb7e3d8c4a0a4afb6b1a6297069 (diff) |
sparc: Make SBUS DMA interfaces take struct device.
This is the first step in converting all the SBUS drivers
over to generic dma_*().
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/atm/fore200e.c')
-rw-r--r-- | drivers/atm/fore200e.c | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c index 73338d231db9..c5ab44fc13df 100644 --- a/drivers/atm/fore200e.c +++ b/drivers/atm/fore200e.c | |||
@@ -678,7 +678,9 @@ fore200e_sba_write(u32 val, volatile u32 __iomem *addr) | |||
678 | static u32 | 678 | static u32 |
679 | fore200e_sba_dma_map(struct fore200e* fore200e, void* virt_addr, int size, int direction) | 679 | fore200e_sba_dma_map(struct fore200e* fore200e, void* virt_addr, int size, int direction) |
680 | { | 680 | { |
681 | u32 dma_addr = sbus_map_single((struct sbus_dev*)fore200e->bus_dev, virt_addr, size, direction); | 681 | struct sbus_dev *sdev = fore200e->bus_dev; |
682 | struct device *dev = &sdev->ofdev.dev; | ||
683 | u32 dma_addr = sbus_map_single(dev, virt_addr, size, direction); | ||
682 | 684 | ||
683 | DPRINTK(3, "SBUS DVMA mapping: virt_addr = 0x%p, size = %d, direction = %d --> dma_addr = 0x%08x\n", | 685 | DPRINTK(3, "SBUS DVMA mapping: virt_addr = 0x%p, size = %d, direction = %d --> dma_addr = 0x%08x\n", |
684 | virt_addr, size, direction, dma_addr); | 686 | virt_addr, size, direction, dma_addr); |
@@ -690,27 +692,36 @@ fore200e_sba_dma_map(struct fore200e* fore200e, void* virt_addr, int size, int d | |||
690 | static void | 692 | static void |
691 | fore200e_sba_dma_unmap(struct fore200e* fore200e, u32 dma_addr, int size, int direction) | 693 | fore200e_sba_dma_unmap(struct fore200e* fore200e, u32 dma_addr, int size, int direction) |
692 | { | 694 | { |
695 | struct sbus_dev *sdev = fore200e->bus_dev; | ||
696 | struct device *dev = &sdev->ofdev.dev; | ||
697 | |||
693 | DPRINTK(3, "SBUS DVMA unmapping: dma_addr = 0x%08x, size = %d, direction = %d,\n", | 698 | DPRINTK(3, "SBUS DVMA unmapping: dma_addr = 0x%08x, size = %d, direction = %d,\n", |
694 | dma_addr, size, direction); | 699 | dma_addr, size, direction); |
695 | 700 | ||
696 | sbus_unmap_single((struct sbus_dev*)fore200e->bus_dev, dma_addr, size, direction); | 701 | sbus_unmap_single(dev, dma_addr, size, direction); |
697 | } | 702 | } |
698 | 703 | ||
699 | 704 | ||
700 | static void | 705 | static void |
701 | fore200e_sba_dma_sync_for_cpu(struct fore200e* fore200e, u32 dma_addr, int size, int direction) | 706 | fore200e_sba_dma_sync_for_cpu(struct fore200e* fore200e, u32 dma_addr, int size, int direction) |
702 | { | 707 | { |
708 | struct sbus_dev *sdev = fore200e->bus_dev; | ||
709 | struct device *dev = &sdev->ofdev.dev; | ||
710 | |||
703 | DPRINTK(3, "SBUS DVMA sync: dma_addr = 0x%08x, size = %d, direction = %d\n", dma_addr, size, direction); | 711 | DPRINTK(3, "SBUS DVMA sync: dma_addr = 0x%08x, size = %d, direction = %d\n", dma_addr, size, direction); |
704 | 712 | ||
705 | sbus_dma_sync_single_for_cpu((struct sbus_dev*)fore200e->bus_dev, dma_addr, size, direction); | 713 | sbus_dma_sync_single_for_cpu(dev, dma_addr, size, direction); |
706 | } | 714 | } |
707 | 715 | ||
708 | static void | 716 | static void |
709 | fore200e_sba_dma_sync_for_device(struct fore200e* fore200e, u32 dma_addr, int size, int direction) | 717 | fore200e_sba_dma_sync_for_device(struct fore200e* fore200e, u32 dma_addr, int size, int direction) |
710 | { | 718 | { |
719 | struct sbus_dev *sdev = fore200e->bus_dev; | ||
720 | struct device *dev = &sdev->ofdev.dev; | ||
721 | |||
711 | DPRINTK(3, "SBUS DVMA sync: dma_addr = 0x%08x, size = %d, direction = %d\n", dma_addr, size, direction); | 722 | DPRINTK(3, "SBUS DVMA sync: dma_addr = 0x%08x, size = %d, direction = %d\n", dma_addr, size, direction); |
712 | 723 | ||
713 | sbus_dma_sync_single_for_device((struct sbus_dev*)fore200e->bus_dev, dma_addr, size, direction); | 724 | sbus_dma_sync_single_for_device(dev, dma_addr, size, direction); |
714 | } | 725 | } |
715 | 726 | ||
716 | 727 | ||
@@ -721,11 +732,13 @@ static int | |||
721 | fore200e_sba_dma_chunk_alloc(struct fore200e* fore200e, struct chunk* chunk, | 732 | fore200e_sba_dma_chunk_alloc(struct fore200e* fore200e, struct chunk* chunk, |
722 | int size, int nbr, int alignment) | 733 | int size, int nbr, int alignment) |
723 | { | 734 | { |
735 | struct sbus_dev *sdev = (struct sbus_dev *) fore200e->bus_dev; | ||
736 | struct device *dev = &sdev->ofdev.dev; | ||
737 | |||
724 | chunk->alloc_size = chunk->align_size = size * nbr; | 738 | chunk->alloc_size = chunk->align_size = size * nbr; |
725 | 739 | ||
726 | /* returned chunks are page-aligned */ | 740 | /* returned chunks are page-aligned */ |
727 | chunk->alloc_addr = sbus_alloc_consistent((struct sbus_dev*)fore200e->bus_dev, | 741 | chunk->alloc_addr = sbus_alloc_consistent(dev, chunk->alloc_size, |
728 | chunk->alloc_size, | ||
729 | &chunk->dma_addr); | 742 | &chunk->dma_addr); |
730 | 743 | ||
731 | if ((chunk->alloc_addr == NULL) || (chunk->dma_addr == 0)) | 744 | if ((chunk->alloc_addr == NULL) || (chunk->dma_addr == 0)) |
@@ -742,10 +755,11 @@ fore200e_sba_dma_chunk_alloc(struct fore200e* fore200e, struct chunk* chunk, | |||
742 | static void | 755 | static void |
743 | fore200e_sba_dma_chunk_free(struct fore200e* fore200e, struct chunk* chunk) | 756 | fore200e_sba_dma_chunk_free(struct fore200e* fore200e, struct chunk* chunk) |
744 | { | 757 | { |
745 | sbus_free_consistent((struct sbus_dev*)fore200e->bus_dev, | 758 | struct sbus_dev *sdev = (struct sbus_dev *) fore200e->bus_dev; |
746 | chunk->alloc_size, | 759 | struct device *dev = &sdev->ofdev.dev; |
747 | chunk->alloc_addr, | 760 | |
748 | chunk->dma_addr); | 761 | sbus_free_consistent(dev, chunk->alloc_size, |
762 | chunk->alloc_addr, chunk->dma_addr); | ||
749 | } | 763 | } |
750 | 764 | ||
751 | 765 | ||