2008-01-27 20:52:07

by Francis Moreau

[permalink] [raw]
Subject: Question about DMA

Hello,

I have 2 questions regarding set_dma_addr(unsigned int channel,
unsigned int addr) helper.

1/ Why does the function take only one address ? I would expect it
to take both a source and a destination address for the dma controller
to transfer data.

2/ The type of address parameter is an unsigned int. Why isn't it a dma_addr_t
type ?

Thanks !
--
Francis


2008-01-27 22:34:22

by Jiri Slaby

[permalink] [raw]
Subject: Re: Question about DMA

On 01/27/2008 09:51 PM, Francis Moreau wrote:
> Hello,
>
> I have 2 questions regarding set_dma_addr(unsigned int channel,
> unsigned int addr) helper.
>
> 1/ Why does the function take only one address ? I would expect it
> to take both a source and a destination address for the dma controller
> to transfer data.

since your device is responsible for sending data from/to local memory. ISA dma
controller has only 2 registers -- 16-bit address to put incoming data to (get
outcoming from) + 8-bit nonincrementing page and 16-bit counter.

> 2/ The type of address parameter is an unsigned int. Why isn't it a dma_addr_t
> type ?

since isa dma controller can address up to 2^24 (16-bit address + 8-bit page)
bytes of memory, i.e. 16M.

Are you sure, you want use this API?

2008-01-28 08:56:17

by Francis Moreau

[permalink] [raw]
Subject: Re: Question about DMA

Hello Jiri,

On Jan 27, 2008 11:34 PM, Jiri Slaby <[email protected]> wrote:
> On 01/27/2008 09:51 PM, Francis Moreau wrote:
> > 1/ Why does the function take only one address ? I would expect it
> > to take both a source and a destination address for the dma controller
> > to transfer data.
>
> since your device is responsible for sending data from/to local memory. ISA dma
> controller has only 2 registers -- 16-bit address to put incoming data to (get
> outcoming from) + 8-bit nonincrementing page and 16-bit counter.
>
> > 2/ The type of address parameter is an unsigned int. Why isn't it a dma_addr_t
> > type ?
>
> since isa dma controller can address up to 2^24 (16-bit address + 8-bit page)
> bytes of memory, i.e. 16M.
>
> Are you sure, you want use this API?
>
>

No ;)

My DMA controller has very little in common with ISA DMA one. But I'd like to
use it in a driver. This driver can do DMA but with the help of an external DMA
controller. It's only implement the "slave" side. So basically this driver needs
to configure one of the DMAC channels before transfering data.

What other API could I use in this case ? I don't think the DMA-mapping can
help in this case...

Thanks
--
Francis

2008-01-28 09:05:04

by Jiri Slaby

[permalink] [raw]
Subject: Re: Question about DMA

On 01/28/2008 09:55 AM, Francis Moreau wrote:
> No ;)

Heh :)

> My DMA controller has very little in common with ISA DMA one. But I'd like to
> use it in a driver. This driver can do DMA but with the help of an external DMA
> controller. It's only implement the "slave" side. So basically this driver needs
> to configure one of the DMAC channels before transfering data.

Which bus is it in this case?

> What other API could I use in this case ? I don't think the DMA-mapping can
> help in this case...

2008-01-28 09:22:04

by Haavard Skinnemoen

[permalink] [raw]
Subject: Re: Question about DMA

On Mon, 28 Jan 2008 09:55:58 +0100
"Francis Moreau" <[email protected]> wrote:

> My DMA controller has very little in common with ISA DMA one. But I'd like to
> use it in a driver. This driver can do DMA but with the help of an external DMA
> controller. It's only implement the "slave" side. So basically this driver needs
> to configure one of the DMAC channels before transfering data.

Have a look at this thread:

http://lkml.org/lkml/2007/11/23/79

I'm planning to post an updated patch set this week that addresses the
comments by Dan Williams, and that applies on top of the other DMA
Engine patches that have been posted since then.

Please let me know if you think this will work for your hardware. What
platform are you working on, btw?

Haavard

2008-01-28 10:20:54

by Francis Moreau

[permalink] [raw]
Subject: Re: Question about DMA

On Jan 28, 2008 10:04 AM, Jiri Slaby <[email protected]> wrote:
> On 01/28/2008 09:55 AM, Francis Moreau wrote:
> Which bus is it in this case?

Basically it's a bus which is used to access memories.

Thanks
--
Francis

2008-01-28 10:22:59

by Francis Moreau

[permalink] [raw]
Subject: Re: Question about DMA

Hello Haavard,

On Jan 28, 2008 10:21 AM, Haavard Skinnemoen <[email protected]> wrote:
> On Mon, 28 Jan 2008 09:55:58 +0100
> "Francis Moreau" <[email protected]> wrote:
>
> > My DMA controller has very little in common with ISA DMA one. But I'd like to
> > use it in a driver. This driver can do DMA but with the help of an external DMA
> > controller. It's only implement the "slave" side. So basically this driver needs
> > to configure one of the DMAC channels before transfering data.
>
> Have a look at this thread:
>
> http://lkml.org/lkml/2007/11/23/79
>
> I'm planning to post an updated patch set this week that addresses the
> comments by Dan Williams, and that applies on top of the other DMA
> Engine patches that have been posted since then.
>
> Please let me know if you think this will work for your hardware.

Thanks for pointing this out. I currently can't look at this but I'll
try to give it
a deep look this week.

> What platform are you working on, btw?
>

SH

Thanks.
--
Francis

2008-01-28 10:29:59

by Haavard Skinnemoen

[permalink] [raw]
Subject: Re: Question about DMA

On Mon, 28 Jan 2008 11:22:49 +0100
"Francis Moreau" <[email protected]> wrote:

> > Please let me know if you think this will work for your hardware.
>
> Thanks for pointing this out. I currently can't look at this but I'll
> try to give it
> a deep look this week.

Great. I'll Cc you on the next round of patches.

> > What platform are you working on, btw?
> >
>
> SH

Nice. That means we have potential users on three different
architectures (the other two being avr32 and arm; I wouldn't be too
surprised if powerpc and mips want a piece of the fun at some point
too.)

Haavard

2008-01-28 10:40:58

by Francis Moreau

[permalink] [raw]
Subject: Re: Question about DMA

[ Added Paul in CC ]

On Jan 28, 2008 11:29 AM, Haavard Skinnemoen <[email protected]> wrote:
> On Mon, 28 Jan 2008 11:22:49 +0100
> "Francis Moreau" <[email protected]> wrote:
>
> > > Please let me know if you think this will work for your hardware.
> >
> > Thanks for pointing this out. I currently can't look at this but I'll
> > try to give it
> > a deep look this week.
>
> Great. I'll Cc you on the next round of patches.
>
> > > What platform are you working on, btw?
> > >
> >
> > SH
>
> Nice. That means we have potential users on three different
> architectures (the other two being avr32 and arm; I wouldn't be too
> surprised if powerpc and mips want a piece of the fun at some point
> too.)
>

I think it's worth to CC Paul as well. He plans to move SH architecture to
use the dmaengine API soon, and he's definitively the right person who
can give you some useful feedbacks from SH architecture.

--
Francis