diff options
| -rw-r--r-- | drivers/dma/k3dma.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c index e415c854e291..5737d92eaeeb 100644 --- a/drivers/dma/k3dma.c +++ b/drivers/dma/k3dma.c | |||
| @@ -111,6 +111,7 @@ struct k3_dma_dev { | |||
| 111 | struct dma_pool *pool; | 111 | struct dma_pool *pool; |
| 112 | u32 dma_channels; | 112 | u32 dma_channels; |
| 113 | u32 dma_requests; | 113 | u32 dma_requests; |
| 114 | u32 dma_channel_mask; | ||
| 114 | unsigned int irq; | 115 | unsigned int irq; |
| 115 | }; | 116 | }; |
| 116 | 117 | ||
| @@ -319,6 +320,9 @@ static void k3_dma_tasklet(unsigned long arg) | |||
| 319 | /* check new channel request in d->chan_pending */ | 320 | /* check new channel request in d->chan_pending */ |
| 320 | spin_lock_irq(&d->lock); | 321 | spin_lock_irq(&d->lock); |
| 321 | for (pch = 0; pch < d->dma_channels; pch++) { | 322 | for (pch = 0; pch < d->dma_channels; pch++) { |
| 323 | if (!(d->dma_channel_mask & (1 << pch))) | ||
| 324 | continue; | ||
| 325 | |||
| 322 | p = &d->phy[pch]; | 326 | p = &d->phy[pch]; |
| 323 | 327 | ||
| 324 | if (p->vchan == NULL && !list_empty(&d->chan_pending)) { | 328 | if (p->vchan == NULL && !list_empty(&d->chan_pending)) { |
| @@ -336,6 +340,9 @@ static void k3_dma_tasklet(unsigned long arg) | |||
| 336 | spin_unlock_irq(&d->lock); | 340 | spin_unlock_irq(&d->lock); |
| 337 | 341 | ||
| 338 | for (pch = 0; pch < d->dma_channels; pch++) { | 342 | for (pch = 0; pch < d->dma_channels; pch++) { |
| 343 | if (!(d->dma_channel_mask & (1 << pch))) | ||
| 344 | continue; | ||
| 345 | |||
| 339 | if (pch_alloc & (1 << pch)) { | 346 | if (pch_alloc & (1 << pch)) { |
| 340 | p = &d->phy[pch]; | 347 | p = &d->phy[pch]; |
| 341 | c = p->vchan; | 348 | c = p->vchan; |
| @@ -856,6 +863,13 @@ static int k3_dma_probe(struct platform_device *op) | |||
| 856 | "dma-channels", &d->dma_channels); | 863 | "dma-channels", &d->dma_channels); |
| 857 | of_property_read_u32((&op->dev)->of_node, | 864 | of_property_read_u32((&op->dev)->of_node, |
| 858 | "dma-requests", &d->dma_requests); | 865 | "dma-requests", &d->dma_requests); |
| 866 | ret = of_property_read_u32((&op->dev)->of_node, | ||
| 867 | "dma-channel-mask", &d->dma_channel_mask); | ||
| 868 | if (ret) { | ||
| 869 | dev_warn(&op->dev, | ||
| 870 | "dma-channel-mask doesn't exist, considering all as available.\n"); | ||
| 871 | d->dma_channel_mask = (u32)~0UL; | ||
| 872 | } | ||
| 859 | } | 873 | } |
| 860 | 874 | ||
| 861 | if (!(soc_data->flags & K3_FLAG_NOCLK)) { | 875 | if (!(soc_data->flags & K3_FLAG_NOCLK)) { |
| @@ -887,8 +901,12 @@ static int k3_dma_probe(struct platform_device *op) | |||
| 887 | return -ENOMEM; | 901 | return -ENOMEM; |
| 888 | 902 | ||
| 889 | for (i = 0; i < d->dma_channels; i++) { | 903 | for (i = 0; i < d->dma_channels; i++) { |
| 890 | struct k3_dma_phy *p = &d->phy[i]; | 904 | struct k3_dma_phy *p; |
| 905 | |||
| 906 | if (!(d->dma_channel_mask & BIT(i))) | ||
| 907 | continue; | ||
| 891 | 908 | ||
| 909 | p = &d->phy[i]; | ||
| 892 | p->idx = i; | 910 | p->idx = i; |
| 893 | p->base = d->base + i * 0x40; | 911 | p->base = d->base + i * 0x40; |
| 894 | } | 912 | } |
