Re: [PATCH 3/7] dw_dmac: get number of channels from hardware ifpossible

From: Andy Shevchenko
Date: Thu Sep 20 2012 - 05:36:11 EST


On Tue, 2012-09-18 at 12:20 +0530, viresh kumar wrote:
> On Mon, Sep 17, 2012 at 1:09 PM, Andy Shevchenko
> <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
> > In case the controller has the encoded parameters feature enabled the driver
> > will use it to get the number of channels. In the future it will be used for
> > the other important parameters as well.

[snip]

> > @@ -1392,23 +1396,32 @@ static int __devinit dw_probe(struct platform_device *pdev)
> > if (irq < 0)
> > return irq;
> >
> > - size = sizeof(struct dw_dma);
> > - size += pdata->nr_channels * sizeof(struct dw_dma_chan);
> > + regs = devm_request_and_ioremap(&pdev->dev, io);
> > + if (!regs)
> > + return -EBUSY;
> > +
> > + dw_params = dma_raw_readl(regs, DW_PARAMS);
>
> Is this valid for every SoC implementation. What if this configuration
> is not valid
> for a particular SoC and it is invalid to access this address? Or this
> gives a invalid
> value instead of returning 0?
Actually I didn't get it clearly from the documentation. We have only
one test report from Hein until now.

> > diff --git a/drivers/dma/dw_dmac_regs.h b/drivers/dma/dw_dmac_regs.h
> > index 4633d39..0f96965 100644
> > --- a/drivers/dma/dw_dmac_regs.h
> > +++ b/drivers/dma/dw_dmac_regs.h
> > @@ -104,6 +104,10 @@ struct dw_dma_regs {
> > #define dma_raw_writel(addr, name, val) \
> > writel((val), (addr) + offsetof(struct dw_dma_regs, name))
> >
> > +/* Bitfields in DW_PARAMS */
> > +#define DW_PARAMS_NR_CHAN 8 /* number of channels */
> > +#define DW_PARAMS_EN 28 /* encoded parameters */
> > +
>
> Can you make this part of patch 2/7?
Do you mean to combine patch 2 and 3 together or only the parts related
to dw_dmac_regs.h?


--
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Intel Finland Oy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/