diff options
author | Zong Li <zong.li@sifive.com> | 2022-03-28 17:52:25 +0800 |
---|---|---|
committer | Vinod Koul <vkoul@kernel.org> | 2022-04-08 18:43:29 +0530 |
commit | e2dfce24f4175e8ba183d5800f669fc89843df54 (patch) | |
tree | 12f3efdbca27a0f6b0af2de2b69b6b7e0491a244 /drivers/dma/sf-pdma/sf-pdma.h | |
parent | 06006ad29abeee1f94d1793107309ce100067e46 (diff) |
dmaengine: sf-pdma: Get number of channel by device tree
It currently assumes that there are always four channels, it would
cause the error if there is actually less than four channels. Change
that by getting number of channel from device tree.
For backwards-compatibility, it uses the default value (i.e. 4) when
there is no 'dma-channels' information in dts.
Signed-off-by: Zong Li <zong.li@sifive.com>
Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Link: https://lore.kernel.org/r/f08a95b6582a51712c5b2c3cb859136d07bfa8b9.1648461096.git.zong.li@sifive.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/dma/sf-pdma/sf-pdma.h')
-rw-r--r-- | drivers/dma/sf-pdma/sf-pdma.h | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/dma/sf-pdma/sf-pdma.h b/drivers/dma/sf-pdma/sf-pdma.h index 0c20167b097d..dcb3687bd5da 100644 --- a/drivers/dma/sf-pdma/sf-pdma.h +++ b/drivers/dma/sf-pdma/sf-pdma.h @@ -22,11 +22,7 @@ #include "../dmaengine.h" #include "../virt-dma.h" -#define PDMA_NR_CH 4 - -#if (PDMA_NR_CH != 4) -#error "Please define PDMA_NR_CH to 4" -#endif +#define PDMA_MAX_NR_CH 4 #define PDMA_BASE_ADDR 0x3000000 #define PDMA_CHAN_OFFSET 0x1000 @@ -118,7 +114,7 @@ struct sf_pdma { void __iomem *membase; void __iomem *mappedbase; u32 n_chans; - struct sf_pdma_chan chans[PDMA_NR_CH]; + struct sf_pdma_chan chans[]; }; #endif /* _SF_PDMA_H */ |