lkml.org 
[lkml]   [2013]   [Jan]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] dw_dmac: adjust slave_id accordingly to request line base
On Tue, Jan 29, 2013 at 10:29:43AM +0530, Viresh Kumar wrote:
> Next time, please direct these mails to my Linaro id :)
>
> On Mon, Jan 28, 2013 at 4:34 PM, Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On some hardware configurations we have got the request line with the offset.
> > The patch introduces convert_slave_id() helper for that cases. The request line
> > base is got from the platform device resources provided by the IORESOURCE_DMA
> > type.
>
> @Vinod: Is IORESOURCE_DMA suitable for this purpose?

We had a discusssion about this with Andy as well. The thing is that there
is no way in current resource to pass DMA request line numbers supported by
the controller to the driver in a generic way. We on the other hand have to
deal this somehow as we have a shared DMA controller on Lynxpoint where the
offset will start from 16 (but it might be something else as well).

Is there something which limits the usage of IORESOUCE_DMA to be only
usable for ISA DMA channels?

We have made supporting code that currently sits in linux-pm/linux-next
tree that parses an ACPI CSRT table and creates the platform devices with
suitable resources here: 13176bbf183c8 (ACPI: add support for CSRT table).

> > Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> > drivers/dma/dw_dmac.c | 13 +++++++++++++
> > drivers/dma/dw_dmac_regs.h | 1 +
> > 2 files changed, 14 insertions(+)
> >
> > diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
> > index 3155c11..8484ca1 100644
> > --- a/drivers/dma/dw_dmac.c
> > +++ b/drivers/dma/dw_dmac.c
> > @@ -995,6 +995,13 @@ static inline void convert_burst(u32 *maxburst)
> > *maxburst = 0;
> > }
> >
> > +static inline void convert_slave_id(struct dw_dma_chan *dwc)
> > +{
> > + struct dw_dma *dw = to_dw_dma(dwc->chan.device);
> > +
> > + dwc->dma_sconfig.slave_id -= dw->request_line_base;
> > +}
> > +
> > static int
> > set_runtime_config(struct dma_chan *chan, struct dma_slave_config *sconfig)
> > {
> > @@ -1009,6 +1016,7 @@ set_runtime_config(struct dma_chan *chan, struct dma_slave_config *sconfig)
> >
> > convert_burst(&dwc->dma_sconfig.src_maxburst);
> > convert_burst(&dwc->dma_sconfig.dst_maxburst);
> > + convert_slave_id(dwc);
> >
> > return 0;
> > }
> > @@ -1717,6 +1725,11 @@ static int dw_probe(struct platform_device *pdev)
> > memcpy(dw->data_width, pdata->data_width, 4);
> > }
> >
> > + /* Get the base request line if set */
> > + io = platform_get_resource(pdev, IORESOURCE_DMA, 0);
> > + if (io)
> > + dw->request_line_base = (unsigned int)io->start;
> > +
>
> How will it work in case of DT?

Can't the DT version do the same thing and pass IORESOURCE_DMA to the
driver? Or we can check dev->of_node and parse it directly from DT instead
of resource.


\
 
 \ /
  Last update: 2013-01-29 07:01    [W:0.126 / U:0.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site