On 2011-02-24 12:46 PM, Wojciech Dubowik wrote:
>> On 2011-02-23 4:48 PM, Wojciech Dubowik wrote:
>> > Signed-off-by: Wojciech Dubowik <wojciech.dubo...@neratec.com>
>> Please make this dynamic. On the Fonera 2.0, PCI is used for USB 2.0
>> support and AHB is used for wireless.
>> 
>> - Felix
> Hello Felix, 
> 
> Will this do the trick for dma mapping?
> 
> --- a/arch/mips/include/asm/mach-ar231x/dma-coherence.h
> +++ b/arch/mips/include/asm/mach-ar231x/dma-coherence.h 
> @@ -12,16 +12,23 @@
>  
>  #define PCI_DMA_OFFSET       0x20000000
>  
> +extern struct bus_type pci_bus_type;
>  struct device;
>  
>  static dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, size_t 
> size)
>  {
> -     return virt_to_phys(addr) + (dev != NULL ? PCI_DMA_OFFSET : 0);
> +     if (dev == NULL)
> +             return virt_to_phys(addr);
> +     else
> +             return virt_to_phys(addr) + (dev->bus == &pci_bus_type ? 
> PCI_DMA_OFFSET : 0);
>  }
>  
>  static dma_addr_t plat_map_dma_mem_page(struct device *dev, struct page 
> *page)
>  {
> -     return page_to_phys(page) + (dev != NULL ? PCI_DMA_OFFSET : 0);
> +     if (dev == NULL)
> +             return page_to_phys(page);
> +     else
> +             return page_to_phys(page) + (dev->bus == &pci_bus_type ? 
> PCI_DMA_OFFSET : 0);
>  }
>  
>  static inline unsigned long plat_dma_addr_to_phys(struct device *dev,
> 
> I have tested it on my AR2315 with pci bus enabled. I don't have anything 
> attached to it 
> so I cannot say that pci dma really works.
I think this will work.

- Felix
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to