On Wed, Jul 04, 2012 at 11:47:35AM +0000, N, Mugunthan V wrote: > > -----Original Message----- > > From: Russell King - ARM Linux [mailto:linux@xxxxxxxxxxxxxxxx] > > Sent: Wednesday, July 04, 2012 3:12 PM > > To: N, Mugunthan V > > Cc: linux-omap@xxxxxxxxxxxxxxx; linux-arm-kernel@xxxxxxxxxxxxxxxxxxx > > Subject: Re: how to specify dma_mask and coherent_dma_mask in hwmod > > > > On Thu, Jun 07, 2012 at 04:22:17PM +0000, N, Mugunthan V wrote: > > > While converting platform device registry to Hwmod for CPSW Ethernet > > > driver which is present in AM335X (OMAP2+), I am not finding a way > > > to specify dma_mask and coherent_dma_mask. > > > Is there a way to specify dma_mask and coherent_dma_mask in hwmod? > > > > Just remember that we're moving stuff to DMA engine, and that means > > the sDMA device has DMA masks, but none of the peripherals which make > > use of sDMA should have DMA masks set. > > > > The reason for this is because the device responsible for accessing > > memory is sDMA, not the peripheral device, and therefore any memory > > properties for DMA should come from the sDMA device, not the peripheral > > device. > > I agree that properties of DMA should come from sDMA device. In my case > (CPSW Ethernet) has a peripheral DMA (davinci_cpdma) which takes care of > transferring packet from memory to Ethernet IP and vice versa. Right, so you have two devices here. You have the Ethernet device, and you have the cpdma device. The cpdma device is the device actually performing the memory accesses on behalf of the Ethernet device. > For allocating DMA memory space for davinci_cpdma, dma_alloc_coherent is > used which requires dma_masks to be specified for the device. So, memory which you allocate for DMA purposes should use the struct device associated with the cpdma device, not the struct device associated with the Ethernet device. That becomes possible when DMA implementations are converted to use the DMA engine API, and with proper channel virtualization, device drivers can retain their virtual channel handle (and therefore access to the DMA engine struct device) indefinitely. -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html