On 03-07-18, 14:32, Paul Cercueil wrote:
quoted hunk ↗ jump to hunk
struct jz4780_dma_dev {
struct dma_device dma_device;
void __iomem *base;
struct clk *clk;
unsigned int irq;
+ unsigned int nb_channels;
+ enum jz_version version;
uint32_t chan_reserved;
- struct jz4780_dma_chan chan[JZ_DMA_NR_CHANNELS];
+ struct jz4780_dma_chan chan[];
why array, why not channel pointer?
quoted hunk ↗ jump to hunk
+static const unsigned int jz4780_dma_nb_channels[] = {
+ [ID_JZ4780] = 32,
+};
+
+static const struct of_device_id jz4780_dma_dt_match[] = {
+ { .compatible = "ingenic,jz4780-dma", .data = (void *)ID_JZ4780 },
+ {},
+};
Looking at description I was hoping that channels would be in DT,
channels is hardware information, so should come from DT rather than
coding the kernel...
quoted hunk ↗ jump to hunk
- jzdma = devm_kzalloc(dev, sizeof(*jzdma), GFP_KERNEL);
+ if (of_id)
+ version = (enum jz_version)of_id->data;
+ else
+ version = ID_JZ4780; /* Default when not probed from DT */
where else would it be probed from.... ?
--
~Vinod