* [PATCHv2] dw_dmac: adjust slave_id accordingly to request line base
@ 2013-02-20 11:52 Andy Shevchenko
2013-02-20 13:36 ` Viresh Kumar
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Andy Shevchenko @ 2013-02-20 11:52 UTC (permalink / raw)
To: Vinod Koul, linux-kernel, spear-devel, Rafael J . Wysocki
Cc: Andy Shevchenko, Mika Westerberg, Viresh Kumar
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 came from the driver data provided by the platform_device_id table.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
---
Since v1:
- use driver_data instead of parsing IORESOURCE_DMA
drivers/dma/dw_dmac.c | 17 ++++++++++++++++-
drivers/dma/dw_dmac_regs.h | 1 +
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index 51c3ea2..67a868d 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -994,6 +994,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)
{
@@ -1008,6 +1015,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;
}
@@ -1637,6 +1645,7 @@ dw_dma_parse_dt(struct platform_device *pdev)
static int dw_probe(struct platform_device *pdev)
{
+ const struct platform_device_id *match;
struct dw_dma_platform_data *pdata;
struct resource *io;
struct dw_dma *dw;
@@ -1722,6 +1731,11 @@ static int dw_probe(struct platform_device *pdev)
memcpy(dw->data_width, pdata->data_width, 4);
}
+ /* Get the base request line if set */
+ match = platform_get_device_id(pdev);
+ if (match)
+ dw->request_line_base = (unsigned int)match->driver_data;
+
/* Calculate all channel mask before DMA setup */
dw->all_chan_mask = (1 << nr_channels) - 1;
@@ -1907,7 +1921,8 @@ MODULE_DEVICE_TABLE(of, dw_dma_id_table);
#endif
static const struct platform_device_id dw_dma_ids[] = {
- { "INTL9C60", 0 },
+ /* Name, Request Line Base */
+ { "INTL9C60", (kernel_ulong_t)16 },
{ }
};
diff --git a/drivers/dma/dw_dmac_regs.h b/drivers/dma/dw_dmac_regs.h
index 88dd8eb..3eeb766 100644
--- a/drivers/dma/dw_dmac_regs.h
+++ b/drivers/dma/dw_dmac_regs.h
@@ -248,6 +248,7 @@ struct dw_dma {
/* hardware configuration */
unsigned char nr_masters;
unsigned char data_width[4];
+ unsigned int request_line_base;
struct dw_dma_chan chan[0];
};
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCHv2] dw_dmac: adjust slave_id accordingly to request line base
2013-02-20 11:52 [PATCHv2] dw_dmac: adjust slave_id accordingly to request line base Andy Shevchenko
@ 2013-02-20 13:36 ` Viresh Kumar
2013-02-22 18:18 ` Andy Shevchenko
2013-03-04 5:02 ` Vinod Koul
2 siblings, 0 replies; 4+ messages in thread
From: Viresh Kumar @ 2013-02-20 13:36 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Vinod Koul, linux-kernel, spear-devel, Rafael J . Wysocki,
Mika Westerberg
On 20 February 2013 17:22, 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 came from the driver data provided by the platform_device_id table.
>
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCHv2] dw_dmac: adjust slave_id accordingly to request line base
2013-02-20 11:52 [PATCHv2] dw_dmac: adjust slave_id accordingly to request line base Andy Shevchenko
2013-02-20 13:36 ` Viresh Kumar
@ 2013-02-22 18:18 ` Andy Shevchenko
2013-03-04 5:02 ` Vinod Koul
2 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2013-02-22 18:18 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Vinod Koul, linux-kernel, spear-devel, Rafael J . Wysocki,
Mika Westerberg, Viresh Kumar
On Wed, Feb 20, 2013 at 1:52 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 came from the driver data provided by the platform_device_id table.
>
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Viresh Kumar <viresh.kumar@linaro.org>
Vinod, is it okay to go with this version?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCHv2] dw_dmac: adjust slave_id accordingly to request line base
2013-02-20 11:52 [PATCHv2] dw_dmac: adjust slave_id accordingly to request line base Andy Shevchenko
2013-02-20 13:36 ` Viresh Kumar
2013-02-22 18:18 ` Andy Shevchenko
@ 2013-03-04 5:02 ` Vinod Koul
2 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2013-03-04 5:02 UTC (permalink / raw)
To: Andy Shevchenko
Cc: linux-kernel, spear-devel, Rafael J . Wysocki, Mika Westerberg,
Viresh Kumar
On Wed, Feb 20, 2013 at 01:52:17PM +0200, Andy Shevchenko 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 came from the driver data provided by the platform_device_id table.
>
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Viresh Kumar <viresh.kumar@linaro.org>
Applied, Thanks
> ---
> Since v1:
> - use driver_data instead of parsing IORESOURCE_DMA
> drivers/dma/dw_dmac.c | 17 ++++++++++++++++-
> drivers/dma/dw_dmac_regs.h | 1 +
> 2 files changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
> index 51c3ea2..67a868d 100644
> --- a/drivers/dma/dw_dmac.c
> +++ b/drivers/dma/dw_dmac.c
> @@ -994,6 +994,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)
> {
> @@ -1008,6 +1015,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;
> }
> @@ -1637,6 +1645,7 @@ dw_dma_parse_dt(struct platform_device *pdev)
>
> static int dw_probe(struct platform_device *pdev)
> {
> + const struct platform_device_id *match;
> struct dw_dma_platform_data *pdata;
> struct resource *io;
> struct dw_dma *dw;
> @@ -1722,6 +1731,11 @@ static int dw_probe(struct platform_device *pdev)
> memcpy(dw->data_width, pdata->data_width, 4);
> }
>
> + /* Get the base request line if set */
> + match = platform_get_device_id(pdev);
> + if (match)
> + dw->request_line_base = (unsigned int)match->driver_data;
> +
> /* Calculate all channel mask before DMA setup */
> dw->all_chan_mask = (1 << nr_channels) - 1;
>
> @@ -1907,7 +1921,8 @@ MODULE_DEVICE_TABLE(of, dw_dma_id_table);
> #endif
>
> static const struct platform_device_id dw_dma_ids[] = {
> - { "INTL9C60", 0 },
> + /* Name, Request Line Base */
> + { "INTL9C60", (kernel_ulong_t)16 },
> { }
> };
>
> diff --git a/drivers/dma/dw_dmac_regs.h b/drivers/dma/dw_dmac_regs.h
> index 88dd8eb..3eeb766 100644
> --- a/drivers/dma/dw_dmac_regs.h
> +++ b/drivers/dma/dw_dmac_regs.h
> @@ -248,6 +248,7 @@ struct dw_dma {
> /* hardware configuration */
> unsigned char nr_masters;
> unsigned char data_width[4];
> + unsigned int request_line_base;
>
> struct dw_dma_chan chan[0];
> };
> --
> 1.7.10.4
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-03-04 5:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-20 11:52 [PATCHv2] dw_dmac: adjust slave_id accordingly to request line base Andy Shevchenko
2013-02-20 13:36 ` Viresh Kumar
2013-02-22 18:18 ` Andy Shevchenko
2013-03-04 5:02 ` Vinod Koul
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.