dw_dmac: absence of pdata isn't critical when autocfg is set
PATCH 1/1 dw_dmac: absence of pdata isn't critical when autocfg is set
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.
--- drivers/dma/dw_dmac.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/dma/dw_dmac.c +12 -3
@@ -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
Signature · 1 line
1.7.10.4
Quoted 16 lines · Andy Shevchenko
drivers/dma/dw_dmac.c +0
-3static 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 ;
drivers/dma/dw_dmac.c static int __devinit dw_probe(struct platform_device *pdev) · line 1629
Quoted 5 lines
drivers/dma/dw_dmac.c +2
-0@@ -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.
Quoted 21 lines · viresh kumar
Quoted 19 lines · Andy Shevchenko
drivers/dma/dw_dmac.c +0
-3static 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 ;
Quoted 6 lines
drivers/dma/dw_dmac.c static int __devinit dw_probe(struct platform_device *pdev) · line 1629
Quoted 2 lines
drivers/dma/dw_dmac.c +2
-0+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?
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Quoted 8 lines · Andy Shevchenko
Quoted 3 lines · viresh kumar
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
drivers/dma/dw_dmac.c static int __devinit dw_probe(struct platform_device *pdev) · line 1633
Quoted 6 lines · Andy Shevchenko
drivers/dma/dw_dmac.c +6
-0+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 :)