aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/include
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-08-27 21:37:58 -0400
committerDavid S. Miller <davem@davemloft.net>2008-08-29 05:13:12 -0400
commit7a715f46012f3552294154978aed59cba9804928 (patch)
tree9e7079ae4ad370b63ac6c8a4face573d6cf60533 /arch/sparc/include
parent5778002874de0fb7e3d8c4a0a4afb6b1a6297069 (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.h20
-rw-r--r--arch/sparc/include/asm/sbus_64.h48
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);
109extern void sbus_fill_device_irq(struct sbus_dev *); 109extern 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. */
112extern void *sbus_alloc_consistent(struct sbus_dev *, long, u32 *dma_addrp); 112extern void *sbus_alloc_consistent(struct device *, long, u32 *dma_addrp);
113extern void sbus_free_consistent(struct sbus_dev *, long, void *, u32); 113extern void sbus_free_consistent(struct device *, long, void *, u32);
114void prom_adjust_ranges(struct linux_prom_ranges *, int, 114void 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. */
123extern dma_addr_t sbus_map_single(struct sbus_dev *, void *, size_t, int); 123extern dma_addr_t sbus_map_single(struct device *, void *, size_t, int);
124extern void sbus_unmap_single(struct sbus_dev *, dma_addr_t, size_t, int); 124extern void sbus_unmap_single(struct device *, dma_addr_t, size_t, int);
125extern int sbus_map_sg(struct sbus_dev *, struct scatterlist *, int, int); 125extern int sbus_map_sg(struct device *, struct scatterlist *, int, int);
126extern void sbus_unmap_sg(struct sbus_dev *, struct scatterlist *, int, int); 126extern 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. */
129extern void sbus_dma_sync_single_for_cpu(struct sbus_dev *, dma_addr_t, size_t, int); 129extern 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 130extern void sbus_dma_sync_single_for_device(struct device *, dma_addr_t, size_t, int);
131extern void sbus_dma_sync_single_for_device(struct sbus_dev *, dma_addr_t, size_t, int);
132extern 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
134extern 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;
100extern void sbus_set_sbus64(struct sbus_dev *, int); 100extern void sbus_set_sbus64(struct sbus_dev *, int);
101extern void sbus_fill_device_irq(struct sbus_dev *); 101extern void sbus_fill_device_irq(struct sbus_dev *);
102 102
103static inline void *sbus_alloc_consistent(struct sbus_dev *sdev , size_t size, 103static 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
110static inline void sbus_free_consistent(struct sbus_dev *sdev, size_t size, 109static 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. */
122static inline dma_addr_t sbus_map_single(struct sbus_dev *sdev, void *ptr, 121static 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
129static inline void sbus_unmap_single(struct sbus_dev *sdev, 128static 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
137static inline int sbus_map_sg(struct sbus_dev *sdev, struct scatterlist *sg, 136static 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
144static inline void sbus_unmap_sg(struct sbus_dev *sdev, struct scatterlist *sg, 143static 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. */
152static inline void sbus_dma_sync_single_for_cpu(struct sbus_dev *sdev, 151static 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
161static inline void sbus_dma_sync_single_for_device(struct sbus_dev *sdev, 159static 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
168static 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
177static 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
184extern void sbus_arch_bus_ranges_init(struct device_node *, struct sbus_bus *); 166extern void sbus_arch_bus_ranges_init(struct device_node *, struct sbus_bus *);
185extern void sbus_setup_iommu(struct sbus_bus *, struct device_node *); 167extern void sbus_setup_iommu(struct sbus_bus *, struct device_node *);
186extern void sbus_setup_arch_props(struct sbus_bus *, struct device_node *); 168extern void sbus_setup_arch_props(struct sbus_bus *, struct device_node *);