aboutsummaryrefslogtreecommitdiff
path: root/arch/sparc/include
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-08-27 18:37:58 -0700
committerDavid S. Miller <davem@davemloft.net>2008-08-29 02:13:12 -0700
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 a7b4fa21931..61d99f1bb23 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);
extern void sbus_fill_device_irq(struct sbus_dev *);
/* These yield IOMMU mappings in consistent mode. */
-extern void *sbus_alloc_consistent(struct sbus_dev *, long, u32 *dma_addrp);
-extern void sbus_free_consistent(struct sbus_dev *, long, void *, u32);
+extern void *sbus_alloc_consistent(struct device *, long, u32 *dma_addrp);
+extern void sbus_free_consistent(struct device *, long, void *, u32);
void prom_adjust_ranges(struct linux_prom_ranges *, int,
struct linux_prom_ranges *, int);
@@ -120,18 +120,14 @@ void prom_adjust_ranges(struct linux_prom_ranges *, int,
#define SBUS_DMA_NONE DMA_NONE
/* All the rest use streaming mode mappings. */
-extern dma_addr_t sbus_map_single(struct sbus_dev *, void *, size_t, int);
-extern void sbus_unmap_single(struct sbus_dev *, dma_addr_t, size_t, int);
-extern int sbus_map_sg(struct sbus_dev *, struct scatterlist *, int, int);
-extern void sbus_unmap_sg(struct sbus_dev *, struct scatterlist *, int, int);
+extern dma_addr_t sbus_map_single(struct device *, void *, size_t, int);
+extern void sbus_unmap_single(struct device *, dma_addr_t, size_t, int);
+extern int sbus_map_sg(struct device *, struct scatterlist *, int, int);
+extern void sbus_unmap_sg(struct device *, struct scatterlist *, int, int);
/* Finally, allow explicit synchronization of streamable mappings. */
-extern void sbus_dma_sync_single_for_cpu(struct sbus_dev *, dma_addr_t, size_t, int);
-#define sbus_dma_sync_single sbus_dma_sync_single_for_cpu
-extern void sbus_dma_sync_single_for_device(struct sbus_dev *, dma_addr_t, size_t, int);
-extern void sbus_dma_sync_sg_for_cpu(struct sbus_dev *, struct scatterlist *, int, int);
-#define sbus_dma_sync_sg sbus_dma_sync_sg_for_cpu
-extern void sbus_dma_sync_sg_for_device(struct sbus_dev *, struct scatterlist *, int, int);
+extern void sbus_dma_sync_single_for_cpu(struct device *, dma_addr_t, size_t, int);
+extern void sbus_dma_sync_single_for_device(struct device *, dma_addr_t, size_t, int);
/* Eric Brower (ebrower@usa.net)
* 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 b606c14343f..b22e99da49d 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;
extern void sbus_set_sbus64(struct sbus_dev *, int);
extern void sbus_fill_device_irq(struct sbus_dev *);
-static inline void *sbus_alloc_consistent(struct sbus_dev *sdev , size_t size,
+static inline void *sbus_alloc_consistent(struct device *dev , size_t size,
dma_addr_t *dma_handle)
{
- return dma_alloc_coherent(&sdev->ofdev.dev, size,
- dma_handle, GFP_ATOMIC);
+ return dma_alloc_coherent(dev, size, dma_handle, GFP_ATOMIC);
}
-static inline void sbus_free_consistent(struct sbus_dev *sdev, size_t size,
+static inline void sbus_free_consistent(struct device *dev, size_t size,
void *vaddr, dma_addr_t dma_handle)
{
- return dma_free_coherent(&sdev->ofdev.dev, size, vaddr, dma_handle);
+ return dma_free_coherent(dev, size, vaddr, dma_handle);
}
#define SBUS_DMA_BIDIRECTIONAL DMA_BIDIRECTIONAL
@@ -119,68 +118,51 @@ static inline void sbus_free_consistent(struct sbus_dev *sdev, size_t size,
#define SBUS_DMA_NONE DMA_NONE
/* All the rest use streaming mode mappings. */
-static inline dma_addr_t sbus_map_single(struct sbus_dev *sdev, void *ptr,
+static inline dma_addr_t sbus_map_single(struct device *dev, void *ptr,
size_t size, int direction)
{
- return dma_map_single(&sdev->ofdev.dev, ptr, size,
+ return dma_map_single(dev, ptr, size,
(enum dma_data_direction) direction);
}
-static inline void sbus_unmap_single(struct sbus_dev *sdev,
+static inline void sbus_unmap_single(struct device *dev,
dma_addr_t dma_addr, size_t size,
int direction)
{
- dma_unmap_single(&sdev->ofdev.dev, dma_addr, size,
+ dma_unmap_single(dev, dma_addr, size,
(enum dma_data_direction) direction);
}
-static inline int sbus_map_sg(struct sbus_dev *sdev, struct scatterlist *sg,
+static inline int sbus_map_sg(struct device *dev, struct scatterlist *sg,
int nents, int direction)
{
- return dma_map_sg(&sdev->ofdev.dev, sg, nents,
+ return dma_map_sg(dev, sg, nents,
(enum dma_data_direction) direction);
}
-static inline void sbus_unmap_sg(struct sbus_dev *sdev, struct scatterlist *sg,
+static inline void sbus_unmap_sg(struct device *dev, struct scatterlist *sg,
int nents, int direction)
{
- dma_unmap_sg(&sdev->ofdev.dev, sg, nents,
+ dma_unmap_sg(dev, sg, nents,
(enum dma_data_direction) direction);
}
/* Finally, allow explicit synchronization of streamable mappings. */
-static inline void sbus_dma_sync_single_for_cpu(struct sbus_dev *sdev,
+static inline void sbus_dma_sync_single_for_cpu(struct device *dev,
dma_addr_t dma_handle,
size_t size, int direction)
{
- dma_sync_single_for_cpu(&sdev->ofdev.dev, dma_handle, size,
+ dma_sync_single_for_cpu(dev, dma_handle, size,
(enum dma_data_direction) direction);
}
-#define sbus_dma_sync_single sbus_dma_sync_single_for_cpu
-static inline void sbus_dma_sync_single_for_device(struct sbus_dev *sdev,
+static inline void sbus_dma_sync_single_for_device(struct device *dev,
dma_addr_t dma_handle,
size_t size, int direction)
{
/* No flushing needed to sync cpu writes to the device. */
}
-static inline void sbus_dma_sync_sg_for_cpu(struct sbus_dev *sdev,
- struct scatterlist *sg,
- int nents, int direction)
-{
- dma_sync_sg_for_cpu(&sdev->ofdev.dev, sg, nents,
- (enum dma_data_direction) direction);
-}
-#define sbus_dma_sync_sg sbus_dma_sync_sg_for_cpu
-
-static inline void sbus_dma_sync_sg_for_device(struct sbus_dev *sdev,
- struct scatterlist *sg,
- int nents, int direction)
-{
- /* No flushing needed to sync cpu writes to the device. */
-}
-
extern void sbus_arch_bus_ranges_init(struct device_node *, struct sbus_bus *);
extern void sbus_setup_iommu(struct sbus_bus *, struct device_node *);
extern void sbus_setup_arch_props(struct sbus_bus *, struct device_node *);