diff options
author | Gerald Baeza <gerald.baeza@stericsson.com> | 2012-09-21 15:21:37 -0400 |
---|---|---|
committer | Fabio Baltieri <fabio.baltieri@linaro.org> | 2013-01-14 04:50:44 -0500 |
commit | 47db92f4a63499b1605b4c66f9347ba5479e7b19 (patch) | |
tree | a3e9510a1b3cec21147f11641f09bd984c2afb0a /drivers/dma | |
parent | f000df8c5a0e2002acc5989aad99a97d32a24718 (diff) |
dmaengine: ste_dma40: physical channels number correction
DMAC_ICFG[0:2]=SCHNB only allows to count 'multiple of 4' physical
channels so it was ok with platforms having 8 channels but cannot be
used for next versions (with 10 or 14 channels). This patch allows to
provide the number of physical channels for a DMA device via
platform_data, or still rely on SCHNB if platform_data announces 0
channel.
Signed-off-by: Gerald Baeza <gerald.baeza@stericsson.com>
Reviewed-by: Per Forlin <per.forlin@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Diffstat (limited to 'drivers/dma')
-rw-r--r-- | drivers/dma/ste_dma40.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 5feab7db9449..ca18117def0a 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c | |||
@@ -3004,14 +3004,21 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev) | |||
3004 | * ? has revision 1 | 3004 | * ? has revision 1 |
3005 | * DB8500v1 has revision 2 | 3005 | * DB8500v1 has revision 2 |
3006 | * DB8500v2 has revision 3 | 3006 | * DB8500v2 has revision 3 |
3007 | * AP9540v1 has revision 4 | ||
3008 | * DB8540v1 has revision 4 | ||
3007 | */ | 3009 | */ |
3008 | rev = AMBA_REV_BITS(pid); | 3010 | rev = AMBA_REV_BITS(pid); |
3009 | 3011 | ||
3012 | plat_data = pdev->dev.platform_data; | ||
3013 | |||
3010 | /* The number of physical channels on this HW */ | 3014 | /* The number of physical channels on this HW */ |
3011 | num_phy_chans = 4 * (readl(virtbase + D40_DREG_ICFG) & 0x7) + 4; | 3015 | if (plat_data->num_of_phy_chans) |
3016 | num_phy_chans = plat_data->num_of_phy_chans; | ||
3017 | else | ||
3018 | num_phy_chans = 4 * (readl(virtbase + D40_DREG_ICFG) & 0x7) + 4; | ||
3012 | 3019 | ||
3013 | dev_info(&pdev->dev, "hardware revision: %d @ 0x%x\n", | 3020 | dev_info(&pdev->dev, "hardware revision: %d @ 0x%x with %d physical channels\n", |
3014 | rev, res->start); | 3021 | rev, res->start, num_phy_chans); |
3015 | 3022 | ||
3016 | if (rev < 2) { | 3023 | if (rev < 2) { |
3017 | d40_err(&pdev->dev, "hardware revision: %d is not supported", | 3024 | d40_err(&pdev->dev, "hardware revision: %d is not supported", |
@@ -3019,8 +3026,6 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev) | |||
3019 | goto failure; | 3026 | goto failure; |
3020 | } | 3027 | } |
3021 | 3028 | ||
3022 | plat_data = pdev->dev.platform_data; | ||
3023 | |||
3024 | /* Count the number of logical channels in use */ | 3029 | /* Count the number of logical channels in use */ |
3025 | for (i = 0; i < plat_data->dev_len; i++) | 3030 | for (i = 0; i < plat_data->dev_len; i++) |
3026 | if (plat_data->dev_rx[i] != 0) | 3031 | if (plat_data->dev_rx[i] != 0) |