[lkml]   [2020]   [Mar]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v2 2/3] MIPS: Loongson: Add DMA support for 7A1000
On 03/25/2020 09:27 PM, Christoph Hellwig wrote:
> On Mon, Mar 23, 2020 at 10:59:14AM +0800, Tiezhu Yang wrote:
>> Implement __phys_to_dma() and __dma_to_phys() according to the
>> node id offset in the 7A1000 DMA route config register.
> Can you please try to just use the dma_pfn_offset field in struct device
> for all loongson platforms? I'm pretty sure I asked for that last time
> around..

Oh, sorry, I don't quite understand what you mean last time.

Do you mean use the default implementation in include/linux/dma-direct.h
when CONFIG_ARCH_HAS_PHYS_TO_DMA is not set?

#include <asm/dma-direct.h>
static inline dma_addr_t __phys_to_dma(struct device *dev, phys_addr_t
dma_addr_t dev_addr = (dma_addr_t)paddr;

return dev_addr - ((dma_addr_t)dev->dma_pfn_offset << PAGE_SHIFT);

static inline phys_addr_t __dma_to_phys(struct device *dev, dma_addr_t
phys_addr_t paddr = (phys_addr_t)dev_addr;

return paddr + ((phys_addr_t)dev->dma_pfn_offset << PAGE_SHIFT);

If so, I will verify it used with the AMD RS780E and Loongson 7A1000
bridge chip.


Tiezhu Yang

 \ /
  Last update: 2020-03-26 03:44    [W:0.087 / U:1.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site