aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/ste_dma40.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dma/ste_dma40.c')
-rw-r--r--drivers/dma/ste_dma40.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 367ef15a3cd8..f25c9ccf28e8 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -45,6 +45,9 @@
45#define D40_LCLA_LINK_PER_EVENT_GRP 128 45#define D40_LCLA_LINK_PER_EVENT_GRP 128
46#define D40_LCLA_END D40_LCLA_LINK_PER_EVENT_GRP 46#define D40_LCLA_END D40_LCLA_LINK_PER_EVENT_GRP
47 47
48/* Max number of logical channels per physical channel */
49#define D40_MAX_LOG_CHAN_PER_PHY 32
50
48/* Attempts before giving up to trying to get pages that are aligned */ 51/* Attempts before giving up to trying to get pages that are aligned */
49#define MAX_LCLA_ALLOC_ATTEMPTS 256 52#define MAX_LCLA_ALLOC_ATTEMPTS 256
50 53
@@ -3210,6 +3213,8 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev)
3210 else 3213 else
3211 num_phy_chans = 4 * (readl(virtbase + D40_DREG_ICFG) & 0x7) + 4; 3214 num_phy_chans = 4 * (readl(virtbase + D40_DREG_ICFG) & 0x7) + 4;
3212 3215
3216 num_log_chans = num_phy_chans * D40_MAX_LOG_CHAN_PER_PHY;
3217
3213 dev_info(&pdev->dev, "hardware revision: %d @ 0x%x with %d physical channels\n", 3218 dev_info(&pdev->dev, "hardware revision: %d @ 0x%x with %d physical channels\n",
3214 rev, res->start, num_phy_chans); 3219 rev, res->start, num_phy_chans);
3215 3220
@@ -3219,15 +3224,6 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev)
3219 goto failure; 3224 goto failure;
3220 } 3225 }
3221 3226
3222 /* Count the number of logical channels in use */
3223 for (i = 0; i < plat_data->dev_len; i++)
3224 if (plat_data->dev_rx[i] != 0)
3225 num_log_chans++;
3226
3227 for (i = 0; i < plat_data->dev_len; i++)
3228 if (plat_data->dev_tx[i] != 0)
3229 num_log_chans++;
3230
3231 base = kzalloc(ALIGN(sizeof(struct d40_base), 4) + 3227 base = kzalloc(ALIGN(sizeof(struct d40_base), 4) +
3232 (num_phy_chans + num_log_chans + ARRAY_SIZE(dma40_memcpy_channels)) * 3228 (num_phy_chans + num_log_chans + ARRAY_SIZE(dma40_memcpy_channels)) *
3233 sizeof(struct d40_chan), GFP_KERNEL); 3229 sizeof(struct d40_chan), GFP_KERNEL);
@@ -3295,7 +3291,7 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev)
3295 * The max number of logical channels are event lines for all 3291 * The max number of logical channels are event lines for all
3296 * src devices and dst devices 3292 * src devices and dst devices
3297 */ 3293 */
3298 base->lookup_log_chans = kzalloc(plat_data->dev_len * 2 * 3294 base->lookup_log_chans = kzalloc(num_log_chans *
3299 sizeof(struct d40_chan *), 3295 sizeof(struct d40_chan *),
3300 GFP_KERNEL); 3296 GFP_KERNEL);
3301 if (!base->lookup_log_chans) 3297 if (!base->lookup_log_chans)