Re: [PATCH 01/14] dmaengine: dma-jz4780: Avoid hardcoding number of channels

From: Vinod
Date: Mon Jul 09 2018 - 13:00:00 EST


On 03-07-18, 14:32, Paul Cercueil wrote:

> 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?

> +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...

> - 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