linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: how to specify dma_mask and coherent_dma_mask in hwmod
Date: Wed, 4 Jul 2012 14:25:30 +0100	[thread overview]
Message-ID: <20120704132530.GA20496@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <EB1619762EAF8B4E97A227FB77B7E0293E9C1B55@DBDE01.ent.ti.com>

On Wed, Jul 04, 2012 at 11:47:35AM +0000, N, Mugunthan V wrote:
> > -----Original Message-----
> > From: Russell King - ARM Linux [mailto:linux at arm.linux.org.uk]
> > Sent: Wednesday, July 04, 2012 3:12 PM
> > To: N, Mugunthan V
> > Cc: linux-omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org
> > 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.

  reply	other threads:[~2012-07-04 13:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-07 16:22 how to specify dma_mask and coherent_dma_mask in hwmod N, Mugunthan V
2012-07-04  9:41 ` Russell King - ARM Linux
2012-07-04 11:47   ` N, Mugunthan V
2012-07-04 13:25     ` Russell King - ARM Linux [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-06-27  5:41 N, Mugunthan V
2012-06-28 15:27 ` Bedia, Vaibhav
2012-06-28 15:52   ` Paul Walmsley
2012-06-28 16:31     ` Bedia, Vaibhav
2012-06-28 16:32       ` Paul Walmsley
2012-06-28 16:42         ` Bedia, Vaibhav
2012-06-29 11:23         ` Bedia, Vaibhav
2012-07-02  7:16           ` N, Mugunthan V
2012-07-04  9:28             ` Paul Walmsley
2012-06-28 15:56 ` ABRAHAM, KISHON VIJAY
2012-06-28 15:58 ` ABRAHAM, KISHON VIJAY

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120704132530.GA20496@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).