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

From
Vinod <vkoul@kernel.org>
Date
2018-07-09 17:00:00
Also in
dmaengine, linux-mips, lkml
Reply to
Paul Cercueil, 2018-07-03
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
Thread (50 messages) 50 messages, 6 authors, last reply 2018-07-18
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help