> On 2011-02-24 3:29 PM, Felix Fietkau wrote:
> > 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 <[email protected]>
> >>> 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.
> Oh, I forgot one thing. This stuff needs an #ifdef CONFIG_PCI,
> otherwise
> it'll emit undefined references to pci_bus_type if PCI support is
> disabled.
> By the way, instead of checking for pci_bus_type directly, you can
> also
> include linux/pci.h and use the dev_is_pci() macro.
Ok. I will define macro inside the file for kernels older than 2.6.34 
and use it directly for newer.

Wojtek

> 
> - Felix
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to