* [PATCH] dw_dmac: absence of pdata isn't critical when autocfg is set
@ 2012-11-12 11:23 Andy Shevchenko
2012-11-12 13:54 ` viresh kumar
2012-11-12 14:03 ` viresh kumar
0 siblings, 2 replies; 5+ messages in thread
From: Andy Shevchenko @ 2012-11-12 11:23 UTC (permalink / raw)
To: Viresh Kumar, Vinod Koul, linux-kernel, spear-devel; +Cc: Andy Shevchenko
The patch allows to probe the device when platform data is absent and hardware
auto configuration is enabled. In that case the default platform data is used
where the channel allocation order is set to ascending, channel priority is set
to ascending, and private property is set to true.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/dma/dw_dmac.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index 2c8096d..0ec5c84 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -1585,6 +1585,12 @@ dw_dma_parse_dt(struct platform_device *pdev)
}
#endif
+static struct dw_dma_platform_data dw_dma_pdata = {
+ .is_private = true,
+ .chan_allocation_order = CHAN_ALLOCATION_ASCENDING,
+ .chan_priority = CHAN_PRIORITY_ASCENDING,
+};
+
static int __devinit dw_probe(struct platform_device *pdev)
{
struct dw_dma_platform_data *pdata;
@@ -1604,9 +1610,6 @@ static int __devinit dw_probe(struct platform_device *pdev)
if (!pdata)
pdata = dw_dma_parse_dt(pdev);
- if (!pdata || pdata->nr_channels > DW_DMA_MAX_NR_CHANNELS)
- return -EINVAL;
-
io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!io)
return -EINVAL;
@@ -1622,6 +1625,12 @@ static int __devinit dw_probe(struct platform_device *pdev)
dw_params = dma_read_byaddr(regs, DW_PARAMS);
autocfg = dw_params >> DW_PARAMS_EN & 0x1;
+ if (!pdata && autocfg)
+ pdata = &dw_dma_pdata;
+
+ if (!pdata || pdata->nr_channels > DW_DMA_MAX_NR_CHANNELS)
+ return -EINVAL;
+
if (autocfg)
nr_channels = (dw_params >> DW_PARAMS_NR_CHAN & 0x7) + 1;
else
--
1.7.10.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] dw_dmac: absence of pdata isn't critical when autocfg is set
2012-11-12 11:23 [PATCH] dw_dmac: absence of pdata isn't critical when autocfg is set Andy Shevchenko
@ 2012-11-12 13:54 ` viresh kumar
2012-11-12 13:58 ` Andy Shevchenko
2012-11-12 14:03 ` viresh kumar
1 sibling, 1 reply; 5+ messages in thread
From: viresh kumar @ 2012-11-12 13:54 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: Vinod Koul, linux-kernel, spear-devel
On Mon, Nov 12, 2012 at 4:53 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
> static int __devinit dw_probe(struct platform_device *pdev)
> {
> struct dw_dma_platform_data *pdata;
> @@ -1604,9 +1610,6 @@ static int __devinit dw_probe(struct platform_device *pdev)
> if (!pdata)
> pdata = dw_dma_parse_dt(pdev);
>
> - if (!pdata || pdata->nr_channels > DW_DMA_MAX_NR_CHANNELS)
> - return -EINVAL;
> -
> io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> if (!io)
> return -EINVAL;
> @@ -1622,6 +1625,12 @@ static int __devinit dw_probe(struct platform_device *pdev)
> dw_params = dma_read_byaddr(regs, DW_PARAMS);
> autocfg = dw_params >> DW_PARAMS_EN & 0x1;
>
> + if (!pdata && autocfg)
> + pdata = &dw_dma_pdata;
Allocate it dynamically to support multiple controllers with different
configuration
in a SoC.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] dw_dmac: absence of pdata isn't critical when autocfg is set
2012-11-12 13:54 ` viresh kumar
@ 2012-11-12 13:58 ` Andy Shevchenko
2012-11-12 14:00 ` Viresh Kumar
0 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2012-11-12 13:58 UTC (permalink / raw)
To: viresh kumar; +Cc: Vinod Koul, linux-kernel, spear-devel
On Mon, 2012-11-12 at 19:24 +0530, viresh kumar wrote:
> On Mon, Nov 12, 2012 at 4:53 PM, Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
>
> > static int __devinit dw_probe(struct platform_device *pdev)
> > {
> > struct dw_dma_platform_data *pdata;
> > @@ -1604,9 +1610,6 @@ static int __devinit dw_probe(struct platform_device *pdev)
> > if (!pdata)
> > pdata = dw_dma_parse_dt(pdev);
> >
> > - if (!pdata || pdata->nr_channels > DW_DMA_MAX_NR_CHANNELS)
> > - return -EINVAL;
> > -
> > io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > if (!io)
> > return -EINVAL;
> > @@ -1622,6 +1625,12 @@ static int __devinit dw_probe(struct platform_device *pdev)
> > dw_params = dma_read_byaddr(regs, DW_PARAMS);
> > autocfg = dw_params >> DW_PARAMS_EN & 0x1;
> >
> > + if (!pdata && autocfg)
> > + pdata = &dw_dma_pdata;
>
> Allocate it dynamically to support multiple controllers with different
> configuration
> in a SoC.
Like you did for device tree? No problem, but here is the question: what
the default values should be and where we can get them?
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] dw_dmac: absence of pdata isn't critical when autocfg is set
2012-11-12 13:58 ` Andy Shevchenko
@ 2012-11-12 14:00 ` Viresh Kumar
0 siblings, 0 replies; 5+ messages in thread
From: Viresh Kumar @ 2012-11-12 14:00 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: Vinod Koul, linux-kernel, spear-devel
On 12 November 2012 19:28, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Mon, 2012-11-12 at 19:24 +0530, viresh kumar wrote:
>> Allocate it dynamically to support multiple controllers with different
>> configuration
>> in a SoC.
>
> Like you did for device tree? No problem, but here is the question: what
> the default values should be and where we can get them?
Yes. Fill with the values you mentioned in your static definition :)
--
viresh
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] dw_dmac: absence of pdata isn't critical when autocfg is set
2012-11-12 11:23 [PATCH] dw_dmac: absence of pdata isn't critical when autocfg is set Andy Shevchenko
2012-11-12 13:54 ` viresh kumar
@ 2012-11-12 14:03 ` viresh kumar
1 sibling, 0 replies; 5+ messages in thread
From: viresh kumar @ 2012-11-12 14:03 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: Vinod Koul, linux-kernel, spear-devel
On Mon, Nov 12, 2012 at 4:53 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> + if (!pdata && autocfg)
> + pdata = &dw_dma_pdata;
> +
> + if (!pdata || pdata->nr_channels > DW_DMA_MAX_NR_CHANNELS)
> + return -EINVAL;
> +
Another thing: replace the second if with else if :)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-11-12 14:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-12 11:23 [PATCH] dw_dmac: absence of pdata isn't critical when autocfg is set Andy Shevchenko
2012-11-12 13:54 ` viresh kumar
2012-11-12 13:58 ` Andy Shevchenko
2012-11-12 14:00 ` Viresh Kumar
2012-11-12 14:03 ` viresh kumar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®