MIPS: Reinstate plat_map_dma_mem_page()
PATCH 1/2 MIPS: Reinstate plat_map_dma_mem_page()
[Patch is against linux-queue.git]
plat_map_dma_mem_page() is required in order to translate a "struct page" directly to a physical address. plat_map_dma_mem() is not effective on HIGHMEM pages.
Signed-off-by Kevin Cernekee <[email protected]>
--- .../include/asm/mach-cavium-octeon/dma-coherence.h | 6 ++++++ arch/mips/include/asm/mach-generic/dma-coherence.h | 6 ++++++ arch/mips/include/asm/mach-ip27/dma-coherence.h | 8 ++++++++ arch/mips/include/asm/mach-ip32/dma-coherence.h | 13 +++++++++++++ arch/mips/include/asm/mach-jazz/dma-coherence.h | 6 ++++++ .../mips/include/asm/mach-loongson/dma-coherence.h | 6 ++++++ arch/mips/include/asm/mach-powertv/dma-coherence.h | 6 ++++++ 7 files changed, 51 insertions(+), 0 deletions(-)
arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h +6 -0
@@ -23,6 +23,12 @@ static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,BUG (); } +static inline dma_addr_t plat_map_dma_mem_page (struct device *dev, +struct page *page) +{ +BUG (); +} +static inline unsigned long plat_dma_addr_to_phys (struct device *dev,dma_addr_t dma_addr) {
arch/mips/include/asm/mach-generic/dma-coherence.h +6 -0
@@ -17,6 +17,12 @@ static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,return virt_to_phys (addr); } +static inline dma_addr_t plat_map_dma_mem_page (struct device *dev, +struct page *page) +{ +return page_to_phys (page); +} +static inline unsigned long plat_dma_addr_to_phys (struct device *dev,dma_addr_t dma_addr) {
arch/mips/include/asm/mach-ip27/dma-coherence.h +8 -0
@@ -26,6 +26,14 @@ static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,return pa; } +static inline dma_addr_t plat_map_dma_mem_page (struct device *dev, +struct page *page) +{ +dma_addr_t pa =dev_to_baddr (dev,page_to_phys (page)); + +return pa; +} +static inline unsigned long plat_dma_addr_to_phys (struct device *dev,dma_addr_t dma_addr) {
arch/mips/include/asm/mach-ip32/dma-coherence.h +13 -0
@@ -37,6 +37,19 @@ static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,return pa; } +static inline dma_addr_t plat_map_dma_mem_page (struct device *dev, +struct page *page) +{ +dma_addr_t pa; + + pa =page_to_phys (page) &RAM_OFFSET_MASK ; + +if (dev ==NULL ) + pa +=CRIME_HI_MEM_BASE ; + +return pa; +} +/* This is almost certainly wrong but it's what dma-ip32.c used to use */ static inline unsigned long plat_dma_addr_to_phys (struct device *dev,dma_addr_t dma_addr)
arch/mips/include/asm/mach-jazz/dma-coherence.h +6 -0
@@ -17,6 +17,12 @@ static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, size_treturn vdma_alloc (virt_to_phys (addr), size); } +static inline dma_addr_t plat_map_dma_mem_page (struct device *dev, +struct page *page) +{ +return vdma_alloc (page_to_phys (page),PAGE_SIZE ); +} +static inline unsigned long plat_dma_addr_to_phys (struct device *dev,dma_addr_t dma_addr) {
arch/mips/include/asm/mach-loongson/dma-coherence.h +6 -0
@@ -19,6 +19,12 @@ static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,return virt_to_phys (addr) |0x80000000 ; } +static inline dma_addr_t plat_map_dma_mem_page (struct device *dev, +struct page *page) +{ +return page_to_phys (page) |0x80000000 ; +} +static inline unsigned long plat_dma_addr_to_phys (struct device *dev,dma_addr_t dma_addr) {
arch/mips/include/asm/mach-powertv/dma-coherence.h +6 -0
@@ -70,6 +70,12 @@ static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,return phys_to_dma (virt_to_phys (addr)); } +static inline dma_addr_t plat_map_dma_mem_page (struct device *dev, +struct page *page) +{ +return phys_to_dma (page_to_phys (page)); +} +static inline unsigned long plat_dma_addr_to_phys (struct device *dev,dma_addr_t dma_addr) {
Signature · 1 line
1.7.0.4
Quoted 5 lines · Kevin Cernekee
[Patch is against linux-queue.git]
plat_map_dma_mem_page()is required in order to translate a "struct page" directly to a physical address.plat_map_dma_mem()is not effective on HIGHMEM pages.
Seems to make sense. I've folded your patch into patch 6 of David Daney's series and fixed up the resulting reject in patch 8.
Thanks!
Ralf