Re: how to specify dma_mask and coherent_dma_mask in hwmod

2012-07-04 Thread Russell King - ARM Linux
On Wed, Jul 04, 2012 at 11:47:35AM +, N, Mugunthan V wrote:
> > -Original Message-
> > From: Russell King - ARM Linux [mailto:li...@arm.linux.org.uk]
> > Sent: Wednesday, July 04, 2012 3:12 PM
> > To: N, Mugunthan V
> > Cc: linux-omap@vger.kernel.org; linux-arm-ker...@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 +, 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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: how to specify dma_mask and coherent_dma_mask in hwmod

2012-07-04 Thread N, Mugunthan V
> -Original Message-
> From: Russell King - ARM Linux [mailto:li...@arm.linux.org.uk]
> Sent: Wednesday, July 04, 2012 3:12 PM
> To: N, Mugunthan V
> Cc: linux-omap@vger.kernel.org; linux-arm-ker...@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 +, 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.

For allocating DMA memory space for davinci_cpdma, dma_alloc_coherent is 
used which requires dma_masks to be specified for the device.

To pass the dma_masks to the device following ways can be followed.
1. Extend omap_device_build arguments to hold dma_mask and coherent_dma_mask
   which will affect all other devices which uses omap_device_build api.
2. Hardcode the dma_mask and coherent_dma_mask in omap_device_build with 
   0x which can harm other devices
3. Specify the dma_mask and coherent_dma_mask after creating the device as
   done in musb device.
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=arch/a
rm/mach-omap2/usb-musb.c;h=c4a576856661014ea3bec9acc70f80e32d62c33b;hb=HEAD

Regards,
Mugunthan V N
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: how to specify dma_mask and coherent_dma_mask in hwmod

2012-07-04 Thread Russell King - ARM Linux
On Thu, Jun 07, 2012 at 04:22:17PM +, 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.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: how to specify dma_mask and coherent_dma_mask in hwmod

2012-07-04 Thread Paul Walmsley
On Mon, 2 Jul 2012, N, Mugunthan V wrote:

> Extending omap_device_build() to accommodate dma masks will endup with lot 
> of code changes in other modules

Why?


- Paul
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: how to specify dma_mask and coherent_dma_mask in hwmod

2012-07-02 Thread N, Mugunthan V
Hi Paul,

> -Original Message-
> From: Bedia, Vaibhav
> Sent: Friday, June 29, 2012 4:54 PM
> To: Paul Walmsley
> Cc: N, Mugunthan V; linux-omap@vger.kernel.org; linux-arm-
> ker...@lists.infradead.org; Cousson, Benoit; Hilman, Kevin
> Subject: RE: how to specify dma_mask and coherent_dma_mask in hwmod
> 
> Hi Paul,
> 
> On Thu, Jun 28, 2012 at 22:02:46, Paul Walmsley wrote:
> > On Thu, 28 Jun 2012, Bedia, Vaibhav wrote:
> >
> > > On Thu, Jun 28, 2012 at 21:22:54, Paul Walmsley wrote:
> > > [...]
> > > >
> > > > dma_mask and coherent_dma_mask can be specified during
> > > > device creation.  See usb_musb_init() in arch/arm/mach-omap2/usb-
> musb.c
> > > > for an example.
> > > >
> > >
> > > Thanks for pointing this out. Should omap_device_build() start
> handling this
> > > or would that be an overkill?
> >
> > If both dma_mask and coherent_dma_mask are always 0x on all
> OMAPs
> > and we can set that safely even for devices that don't use it, then yeah
> > it sounds like we should set it.
> >
> > Care to send a patch?
> >
> 
> I just grepped for the any other user of this under mach-omap2 and plat-
> omap
> and there are a few other places where it's getting used. All of them are
> setting it to 0x and same is the case with the CPSW driver.
> 
> I don't know much about the dma stuff so I am bit reluctant in setting
> this
> unconditionally. I looked at setting the mask based on a flag during
> omap_device_build() but an additional flag in the API will cause all the
> users
> to be changed. We could perhaps extend the omap_hwmod structure for
> passing on
> this information. Or for CPSW we could stick with approach that's been
> adopted
> in usb_musb_init(). Which approach sounds better to you?
> 
> Regards,
> Vaibhav B.

Extending omap_device_build() to accommodate dma masks will endup with lot 
of code changes in other modules, so will follow the same from 
usb_musd_init().

Regards,
Mugunthan V N.

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: how to specify dma_mask and coherent_dma_mask in hwmod

2012-06-29 Thread Bedia, Vaibhav
Hi Paul,

On Thu, Jun 28, 2012 at 22:02:46, Paul Walmsley wrote:
> On Thu, 28 Jun 2012, Bedia, Vaibhav wrote:
> 
> > On Thu, Jun 28, 2012 at 21:22:54, Paul Walmsley wrote:
> > [...]
> > > 
> > > dma_mask and coherent_dma_mask can be specified during 
> > > device creation.  See usb_musb_init() in arch/arm/mach-omap2/usb-musb.c 
> > > for an example.
> > > 
> > 
> > Thanks for pointing this out. Should omap_device_build() start handling this
> > or would that be an overkill?
> 
> If both dma_mask and coherent_dma_mask are always 0x on all OMAPs 
> and we can set that safely even for devices that don't use it, then yeah 
> it sounds like we should set it.
> 
> Care to send a patch?
> 

I just grepped for the any other user of this under mach-omap2 and plat-omap
and there are a few other places where it's getting used. All of them are
setting it to 0x and same is the case with the CPSW driver. 

I don't know much about the dma stuff so I am bit reluctant in setting this
unconditionally. I looked at setting the mask based on a flag during
omap_device_build() but an additional flag in the API will cause all the users
to be changed. We could perhaps extend the omap_hwmod structure for passing on
this information. Or for CPSW we could stick with approach that's been adopted
in usb_musb_init(). Which approach sounds better to you?

Regards,
Vaibhav B.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: how to specify dma_mask and coherent_dma_mask in hwmod

2012-06-28 Thread Bedia, Vaibhav
On Thu, Jun 28, 2012 at 22:02:46, Paul Walmsley wrote:
> On Thu, 28 Jun 2012, Bedia, Vaibhav wrote:
> 
> > On Thu, Jun 28, 2012 at 21:22:54, Paul Walmsley wrote:
> > [...]
> > > 
> > > dma_mask and coherent_dma_mask can be specified during 
> > > device creation.  See usb_musb_init() in arch/arm/mach-omap2/usb-musb.c 
> > > for an example.
> > > 
> > 
> > Thanks for pointing this out. Should omap_device_build() start handling this
> > or would that be an overkill?
> 
> If both dma_mask and coherent_dma_mask are always 0x on all OMAPs 
> and we can set that safely even for devices that don't use it, then yeah 
> it sounds like we should set it.
> 

I guess that's the case here also.
 
> Care to send a patch?
> 

Sure. Let me check with Mugunthan once.

Regards,
Vaibhav B.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: how to specify dma_mask and coherent_dma_mask in hwmod

2012-06-28 Thread Paul Walmsley
On Thu, 28 Jun 2012, Bedia, Vaibhav wrote:

> On Thu, Jun 28, 2012 at 21:22:54, Paul Walmsley wrote:
> [...]
> > 
> > dma_mask and coherent_dma_mask can be specified during 
> > device creation.  See usb_musb_init() in arch/arm/mach-omap2/usb-musb.c 
> > for an example.
> > 
> 
> Thanks for pointing this out. Should omap_device_build() start handling this
> or would that be an overkill?

If both dma_mask and coherent_dma_mask are always 0x on all OMAPs 
and we can set that safely even for devices that don't use it, then yeah 
it sounds like we should set it.

Care to send a patch?


- Paul
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: how to specify dma_mask and coherent_dma_mask in hwmod

2012-06-28 Thread Bedia, Vaibhav
Hi Paul,

On Thu, Jun 28, 2012 at 21:22:54, Paul Walmsley wrote:
[...]
> 
> dma_mask and coherent_dma_mask can be specified during 
> device creation.  See usb_musb_init() in arch/arm/mach-omap2/usb-musb.c 
> for an example.
> 

Thanks for pointing this out. Should omap_device_build() start handling this
or would that be an overkill?

Regards,
Vaibhav B.

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: how to specify dma_mask and coherent_dma_mask in hwmod

2012-06-28 Thread ABRAHAM, KISHON VIJAY
Hi,

On Wed, Jun 27, 2012 at 11:11 AM, N, Mugunthan V  wrote:
>> -Original Message-
>> From: N, Mugunthan V
>> Sent: Thursday, June 07, 2012 9:52 PM
>> To: 'linux-omap@vger.kernel.org'
>> Cc: 'linux-arm-ker...@lists.infradead.org'
>> Subject: how to specify dma_mask and coherent_dma_mask in hwmod
>>
>> Hi
>>
>> 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?
>
> Ping, any one has comment on this?
>
Nope. You can specify dma_mask after creating the device as done in
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=arch/arm/mach-omap2/usb-musb.c;h=c4a576856661014ea3bec9acc70f80e32d62c33b;hb=HEAD

Regards
Kishon
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: how to specify dma_mask and coherent_dma_mask in hwmod

2012-06-28 Thread Paul Walmsley
Hi

On Thu, 28 Jun 2012, Bedia, Vaibhav wrote:

> On Wed, Jun 27, 2012 at 11:11:32, N, Mugunthan V wrote:
> > > -Original Message-
> > > From: N, Mugunthan V
> > > Sent: Thursday, June 07, 2012 9:52 PM
> > > To: 'linux-omap@vger.kernel.org'
> > > Cc: 'linux-arm-ker...@lists.infradead.org'
> > > Subject: how to specify dma_mask and coherent_dma_mask in hwmod
> > > 
> > > 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?
> > 
> > Ping, any one has comment on this?
> 
> Right now there's no way of doing this in hwmod. But is omap_hwmod
> the right place for this? It would help if you could describe why
> the hwmod conversion is causing trouble for you.

dma_mask and coherent_dma_mask can be specified during 
device creation.  See usb_musb_init() in arch/arm/mach-omap2/usb-musb.c 
for an example.

I take it that you're just planning to set both of those to 0x?


- Paul
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: how to specify dma_mask and coherent_dma_mask in hwmod

2012-06-28 Thread Bedia, Vaibhav
+Paul, Benoit and Kevin

On Wed, Jun 27, 2012 at 11:11:32, N, Mugunthan V wrote:
> > -Original Message-
> > From: N, Mugunthan V
> > Sent: Thursday, June 07, 2012 9:52 PM
> > To: 'linux-omap@vger.kernel.org'
> > Cc: 'linux-arm-ker...@lists.infradead.org'
> > Subject: how to specify dma_mask and coherent_dma_mask in hwmod
> > 
> > Hi
> > 
> > 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?
> 
> Ping, any one has comment on this?

Right now there's no way of doing this in hwmod. But is omap_hwmod
the right place for this? It would help if you could describe why
the hwmod conversion is causing trouble for you.

Regards,
Vaibhav B.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: how to specify dma_mask and coherent_dma_mask in hwmod

2012-06-26 Thread N, Mugunthan V
> -Original Message-
> From: N, Mugunthan V
> Sent: Thursday, June 07, 2012 9:52 PM
> To: 'linux-omap@vger.kernel.org'
> Cc: 'linux-arm-ker...@lists.infradead.org'
> Subject: how to specify dma_mask and coherent_dma_mask in hwmod
> 
> Hi
> 
> 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?

Ping, any one has comment on this?

> 
> ---
> Regards,
> Mugunthan V N.

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html