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 /arch/sparc/include | |
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 'arch/sparc/include')
-rw-r--r-- | arch/sparc/include/asm/sbus_32.h | 20 | ||||
-rw-r--r-- | arch/sparc/include/asm/sbus_64.h | 48 |
2 files changed, 23 insertions, 45 deletions
diff --git a/arch/sparc/include/asm/sbus_32.h b/arch/sparc/include/asm/sbus_32.h index a7b4fa21931d..61d99f1bb23c 100644 --- a/arch/sparc/include/asm/sbus_32.h +++ b/arch/sparc/include/asm/sbus_32.h | |||
@@ -109,8 +109,8 @@ extern void sbus_set_sbus64(struct sbus_dev *, int); | |||
109 | extern void sbus_fill_device_irq(struct sbus_dev *); | 109 | extern void sbus_fill_device_irq(struct sbus_dev *); |
110 | 110 | ||
111 | /* These yield IOMMU mappings in consistent mode. */ | 111 | /* These yield IOMMU mappings in consistent mode. */ |
112 | extern void *sbus_alloc_consistent(struct sbus_dev *, long, u32 *dma_addrp); | 112 | extern void *sbus_alloc_consistent(struct device *, long, u32 *dma_addrp); |
113 | extern void sbus_free_consistent(struct sbus_dev *, long, void *, u32); | 113 | extern void sbus_free_consistent(struct device *, long, void *, u32); |
114 | void prom_adjust_ranges(struct linux_prom_ranges *, int, | 114 | void prom_adjust_ranges(struct linux_prom_ranges *, int, |
115 | struct linux_prom_ranges *, int); | 115 | struct linux_prom_ranges *, int); |
116 | 116 | ||
@@ -120,18 +120,14 @@ void prom_adjust_ranges(struct linux_prom_ranges *, int, | |||
120 | #define SBUS_DMA_NONE DMA_NONE | 120 | #define SBUS_DMA_NONE DMA_NONE |
121 | 121 | ||
122 | /* All the rest use streaming mode mappings. */ | 122 | /* All the rest use streaming mode mappings. */ |
123 | extern dma_addr_t sbus_map_single(struct sbus_dev *, void *, size_t, int); | 123 | extern dma_addr_t sbus_map_single(struct device *, void *, size_t, int); |
124 | extern void sbus_unmap_single(struct sbus_dev *, dma_addr_t, size_t, int); | 124 | extern void sbus_unmap_single(struct device *, dma_addr_t, size_t, int); |
125 | extern int sbus_map_sg(struct sbus_dev *, struct scatterlist *, int, int); | 125 | extern int sbus_map_sg(struct device *, struct scatterlist *, int, int); |
126 | extern void sbus_unmap_sg(struct sbus_dev *, struct scatterlist *, int, int); | 126 | extern void sbus_unmap_sg(struct device *, struct scatterlist *, int, int); |
127 | 127 | ||
128 | /* Finally, allow explicit synchronization of streamable mappings. */ | 128 | /* Finally, allow explicit synchronization of streamable mappings. */ |
129 | extern void sbus_dma_sync_single_for_cpu(struct sbus_dev *, dma_addr_t, size_t, int); | 129 | extern void sbus_dma_sync_single_for_cpu(struct device *, dma_addr_t, size_t, int); |
130 | #define sbus_dma_sync_single sbus_dma_sync_single_for_cpu | 130 | extern void sbus_dma_sync_single_for_device(struct device *, dma_addr_t, size_t, int); |
131 | extern void sbus_dma_sync_single_for_device(struct sbus_dev *, dma_addr_t, size_t, int); | ||
132 | extern void sbus_dma_sync_sg_for_cpu(struct sbus_dev *, struct scatterlist *, int, int); | ||
133 | #define sbus_dma_sync_sg sbus_dma_sync_sg_for_cpu | ||
134 | extern void sbus_dma_sync_sg_for_device(struct sbus_dev *, struct scatterlist *, int, int); | ||
135 | 131 | ||
136 | /* Eric Brower (ebrower@usa.net) | 132 | /* Eric Brower (ebrower@usa.net) |
137 | * Translate SBus interrupt levels to ino values-- | 133 | * Translate SBus interrupt levels to ino values-- |
diff --git a/arch/sparc/include/asm/sbus_64.h b/arch/sparc/include/asm/sbus_64.h index b606c14343fb..b22e99da49d8 100644 --- a/arch/sparc/include/asm/sbus_64.h +++ b/arch/sparc/include/asm/sbus_64.h | |||
@@ -100,17 +100,16 @@ extern struct sbus_bus *sbus_root; | |||
100 | extern void sbus_set_sbus64(struct sbus_dev *, int); | 100 | extern void sbus_set_sbus64(struct sbus_dev *, int); |
101 | extern void sbus_fill_device_irq(struct sbus_dev *); | 101 | extern void sbus_fill_device_irq(struct sbus_dev *); |
102 | 102 | ||
103 | static inline void *sbus_alloc_consistent(struct sbus_dev *sdev , size_t size, | 103 | static inline void *sbus_alloc_consistent(struct device *dev , size_t size, |
104 | dma_addr_t *dma_handle) | 104 | dma_addr_t *dma_handle) |
105 | { | 105 | { |
106 | return dma_alloc_coherent(&sdev->ofdev.dev, size, | 106 | return dma_alloc_coherent(dev, size, dma_handle, GFP_ATOMIC); |
107 | dma_handle, GFP_ATOMIC); | ||
108 | } | 107 | } |
109 | 108 | ||
110 | static inline void sbus_free_consistent(struct sbus_dev *sdev, size_t size, | 109 | static inline void sbus_free_consistent(struct device *dev, size_t size, |
111 | void *vaddr, dma_addr_t dma_handle) | 110 | void *vaddr, dma_addr_t dma_handle) |
112 | { | 111 | { |
113 | return dma_free_coherent(&sdev->ofdev.dev, size, vaddr, dma_handle); | 112 | return dma_free_coherent(dev, size, vaddr, dma_handle); |
114 | } | 113 | } |
115 | 114 | ||
116 | #define SBUS_DMA_BIDIRECTIONAL DMA_BIDIRECTIONAL | 115 | #define SBUS_DMA_BIDIRECTIONAL DMA_BIDIRECTIONAL |
@@ -119,68 +118,51 @@ static inline void sbus_free_consistent(struct sbus_dev *sdev, size_t size, | |||
119 | #define SBUS_DMA_NONE DMA_NONE | 118 | #define SBUS_DMA_NONE DMA_NONE |
120 | 119 | ||
121 | /* All the rest use streaming mode mappings. */ | 120 | /* All the rest use streaming mode mappings. */ |
122 | static inline dma_addr_t sbus_map_single(struct sbus_dev *sdev, void *ptr, | 121 | static inline dma_addr_t sbus_map_single(struct device *dev, void *ptr, |
123 | size_t size, int direction) | 122 | size_t size, int direction) |
124 | { | 123 | { |
125 | return dma_map_single(&sdev->ofdev.dev, ptr, size, | 124 | return dma_map_single(dev, ptr, size, |
126 | (enum dma_data_direction) direction); | 125 | (enum dma_data_direction) direction); |
127 | } | 126 | } |
128 | 127 | ||
129 | static inline void sbus_unmap_single(struct sbus_dev *sdev, | 128 | static inline void sbus_unmap_single(struct device *dev, |
130 | dma_addr_t dma_addr, size_t size, | 129 | dma_addr_t dma_addr, size_t size, |
131 | int direction) | 130 | int direction) |
132 | { | 131 | { |
133 | dma_unmap_single(&sdev->ofdev.dev, dma_addr, size, | 132 | dma_unmap_single(dev, dma_addr, size, |
134 | (enum dma_data_direction) direction); | 133 | (enum dma_data_direction) direction); |
135 | } | 134 | } |
136 | 135 | ||
137 | static inline int sbus_map_sg(struct sbus_dev *sdev, struct scatterlist *sg, | 136 | static inline int sbus_map_sg(struct device *dev, struct scatterlist *sg, |
138 | int nents, int direction) | 137 | int nents, int direction) |
139 | { | 138 | { |
140 | return dma_map_sg(&sdev->ofdev.dev, sg, nents, | 139 | return dma_map_sg(dev, sg, nents, |
141 | (enum dma_data_direction) direction); | 140 | (enum dma_data_direction) direction); |
142 | } | 141 | } |
143 | 142 | ||
144 | static inline void sbus_unmap_sg(struct sbus_dev *sdev, struct scatterlist *sg, | 143 | static inline void sbus_unmap_sg(struct device *dev, struct scatterlist *sg, |
145 | int nents, int direction) | 144 | int nents, int direction) |
146 | { | 145 | { |
147 | dma_unmap_sg(&sdev->ofdev.dev, sg, nents, | 146 | dma_unmap_sg(dev, sg, nents, |
148 | (enum dma_data_direction) direction); | 147 | (enum dma_data_direction) direction); |
149 | } | 148 | } |
150 | 149 | ||
151 | /* Finally, allow explicit synchronization of streamable mappings. */ | 150 | /* Finally, allow explicit synchronization of streamable mappings. */ |
152 | static inline void sbus_dma_sync_single_for_cpu(struct sbus_dev *sdev, | 151 | static inline void sbus_dma_sync_single_for_cpu(struct device *dev, |
153 | dma_addr_t dma_handle, | 152 | dma_addr_t dma_handle, |
154 | size_t size, int direction) | 153 | size_t size, int direction) |
155 | { | 154 | { |
156 | dma_sync_single_for_cpu(&sdev->ofdev.dev, dma_handle, size, | 155 | dma_sync_single_for_cpu(dev, dma_handle, size, |
157 | (enum dma_data_direction) direction); | 156 | (enum dma_data_direction) direction); |
158 | } | 157 | } |
159 | #define sbus_dma_sync_single sbus_dma_sync_single_for_cpu | ||
160 | 158 | ||
161 | static inline void sbus_dma_sync_single_for_device(struct sbus_dev *sdev, | 159 | static inline void sbus_dma_sync_single_for_device(struct device *dev, |
162 | dma_addr_t dma_handle, | 160 | dma_addr_t dma_handle, |
163 | size_t size, int direction) | 161 | size_t size, int direction) |
164 | { | 162 | { |
165 | /* No flushing needed to sync cpu writes to the device. */ | 163 | /* No flushing needed to sync cpu writes to the device. */ |
166 | } | 164 | } |
167 | 165 | ||
168 | static inline void sbus_dma_sync_sg_for_cpu(struct sbus_dev *sdev, | ||
169 | struct scatterlist *sg, | ||
170 | int nents, int direction) | ||
171 | { | ||
172 | dma_sync_sg_for_cpu(&sdev->ofdev.dev, sg, nents, | ||
173 | (enum dma_data_direction) direction); | ||
174 | } | ||
175 | #define sbus_dma_sync_sg sbus_dma_sync_sg_for_cpu | ||
176 | |||
177 | static inline void sbus_dma_sync_sg_for_device(struct sbus_dev *sdev, | ||
178 | struct scatterlist *sg, | ||
179 | int nents, int direction) | ||
180 | { | ||
181 | /* No flushing needed to sync cpu writes to the device. */ | ||
182 | } | ||
183 | |||
184 | extern void sbus_arch_bus_ranges_init(struct device_node *, struct sbus_bus *); | 166 | extern void sbus_arch_bus_ranges_init(struct device_node *, struct sbus_bus *); |
185 | extern void sbus_setup_iommu(struct sbus_bus *, struct device_node *); | 167 | extern void sbus_setup_iommu(struct sbus_bus *, struct device_node *); |
186 | extern void sbus_setup_arch_props(struct sbus_bus *, struct device_node *); | 168 | extern void sbus_setup_arch_props(struct sbus_bus *, struct device_node *); |