|
|
@ -52,11 +52,10 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> |
|
|
|
#include <asm/scatterlist.h>
|
|
|
|
#include <asm/scatterlist.h>
|
|
|
|
#include <asm/dma-coherence.h>
|
|
|
|
#include <asm/dma-coherence.h>
|
|
|
|
#include <asm/cache.h>
|
|
|
|
#include <asm/cache.h>
|
|
|
|
@@ -10,14 +16,47 @@
|
|
|
|
@@ -12,12 +18,47 @@
|
|
|
|
#include <dma-coherence.h>
|
|
|
|
|
|
|
|
#endif
|
|
|
|
extern struct dma_map_ops *mips_dma_map_ops;
|
|
|
|
|
|
|
|
|
|
|
|
-extern struct dma_map_ops *mips_dma_map_ops;
|
|
|
|
|
|
|
|
+void __dma_sync(struct page *page, unsigned long offset, size_t size,
|
|
|
|
+void __dma_sync(struct page *page, unsigned long offset, size_t size,
|
|
|
|
+ enum dma_data_direction direction);
|
|
|
|
+ enum dma_data_direction direction);
|
|
|
|
+void *mips_dma_alloc_coherent(struct device *dev, size_t size,
|
|
|
|
+void *mips_dma_alloc_coherent(struct device *dev, size_t size,
|
|
|
@ -64,7 +63,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> |
|
|
|
+ struct dma_attrs *attrs);
|
|
|
|
+ struct dma_attrs *attrs);
|
|
|
|
+void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr,
|
|
|
|
+void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr,
|
|
|
|
+ dma_addr_t dma_handle, struct dma_attrs *attrs);
|
|
|
|
+ dma_addr_t dma_handle, struct dma_attrs *attrs);
|
|
|
|
|
|
|
|
+
|
|
|
|
static inline struct dma_map_ops *get_dma_ops(struct device *dev)
|
|
|
|
static inline struct dma_map_ops *get_dma_ops(struct device *dev)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
+#ifdef CONFIG_SYS_HAS_DMA_OPS
|
|
|
|
+#ifdef CONFIG_SYS_HAS_DMA_OPS
|
|
|
@ -101,7 +100,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
|
|
|
|
static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
|
|
|
|
@@ -30,12 +69,309 @@ static inline bool dma_capable(struct de
|
|
|
|
@@ -30,12 +71,309 @@ static inline bool dma_capable(struct de
|
|
|
|
|
|
|
|
|
|
|
|
static inline void dma_mark_clean(void *addr, size_t size) {}
|
|
|
|
static inline void dma_mark_clean(void *addr, size_t size) {}
|
|
|
|
|
|
|
|
|
|
|
@ -413,7 +412,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline int dma_mapping_error(struct device *dev, u64 mask)
|
|
|
|
static inline int dma_mapping_error(struct device *dev, u64 mask)
|
|
|
|
@@ -43,7 +379,9 @@ static inline int dma_mapping_error(stru
|
|
|
|
@@ -43,7 +381,9 @@ static inline int dma_mapping_error(stru
|
|
|
|
struct dma_map_ops *ops = get_dma_ops(dev);
|
|
|
|
struct dma_map_ops *ops = get_dma_ops(dev);
|
|
|
|
|
|
|
|
|
|
|
|
debug_dma_mapping_error(dev, mask);
|
|
|
|
debug_dma_mapping_error(dev, mask);
|
|
|
@ -424,7 +423,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
static inline int
|
|
|
|
@@ -69,7 +407,11 @@ static inline void *dma_alloc_attrs(stru
|
|
|
|
@@ -69,7 +409,11 @@ static inline void *dma_alloc_attrs(stru
|
|
|
|
void *ret;
|
|
|
|
void *ret;
|
|
|
|
struct dma_map_ops *ops = get_dma_ops(dev);
|
|
|
|
struct dma_map_ops *ops = get_dma_ops(dev);
|
|
|
|
|
|
|
|
|
|
|
@ -437,7 +436,7 @@ Signed-off-by: Felix Fietkau <nbd@openwrt.org> |
|
|
|
|
|
|
|
|
|
|
|
debug_dma_alloc_coherent(dev, size, *dma_handle, ret);
|
|
|
|
debug_dma_alloc_coherent(dev, size, *dma_handle, ret);
|
|
|
|
|
|
|
|
|
|
|
|
@@ -84,7 +426,10 @@ static inline void dma_free_attrs(struct
|
|
|
|
@@ -84,7 +428,10 @@ static inline void dma_free_attrs(struct
|
|
|
|
{
|
|
|
|
{
|
|
|
|
struct dma_map_ops *ops = get_dma_ops(dev);
|
|
|
|
struct dma_map_ops *ops = get_dma_ops(dev);
|
|
|
|
|
|
|
|
|
|
|
|