This patch adds dma-channel-mask property support not to reserve
some DMA channels for some reasons. (for example: a heterogeneous
CPU uses it.)

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda...@renesas.com>
---
 drivers/dma/sh/rcar-dmac.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
index 204160e..bae0fe8 100644
--- a/drivers/dma/sh/rcar-dmac.c
+++ b/drivers/dma/sh/rcar-dmac.c
@@ -1806,7 +1806,17 @@ static int rcar_dmac_parse_of(struct device *dev, struct 
rcar_dmac *dmac)
                return -EINVAL;
        }
 
-       dmac->channels_mask = GENMASK(dmac->n_channels - 1, 0);
+       /*
+        * If the driver is unable to read dma-channel-mask property,
+        * the driver assumes that it can use all channels.
+        */
+       ret = of_property_read_u32(np, "dma-channel-mask",
+                                  &dmac->channels_mask);
+       if (ret < 0)
+               dmac->channels_mask = GENMASK(dmac->n_channels - 1, 0);
+
+       /* If the property has out-of-channel mask, this driver clears it */
+       dmac->channels_mask &= GENMASK(dmac->n_channels - 1, 0);
 
        return 0;
 }
-- 
2.7.4

Reply via email to