Skip to contentSkip to conversation

MXS DMA: add end of list sentinel to platform_id list

PATCH New Lothar Waßmann 4 participants 11 messages Apr 21, 2011 – Aug 16, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MXS DMA: add end of list sentinel to platform_id list

---
 drivers/dma/mxs-dma.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/dma/mxs-dma.c +2 -1
index e25209b..5b9b66a 100644
@@ -737,7 +737,8 @@ static struct platform_device_id mxs_dma_type[] = {
 	}, {
 		.name = "mxs-dma-apbx",
 		.driver_data = MXS_DMA_APBX,
-	}
+	},
+	{ /* end of list marker */ }
 };
 
 static struct platform_driver mxs_dma_driver = {
Signature · 1 line
1.5.6.5
#1 lore raw

PATCH 1/1 MXS DMA: enable CLKGATE before accessing registers

After calling mxs_dma_disable_chan() for a channel, that channel becomes unusable because some controller registers can only be written when the clock is enabled via CLKGATE.

---
 drivers/dma/mxs-dma.c |   45 ++++++++++++++++++++++++---------------------
 1 files changed, 24 insertions(+), 21 deletions(-)
drivers/dma/mxs-dma.c +24 -21
index 5b9b66a..329405c 100644
@@ -131,6 +131,23 @@ struct mxs_dma_engine {
 	int				irqmap[MXS_DMA_CHANNELS];
 };
 
+static inline void mxs_dma_clkgate(struct mxs_dma_chan *mxs_chan, int enable)
+{
+	struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
+	int chan_id = mxs_chan->chan.chan_id;
+	int set_clr = enable ? MXS_CLR_ADDR : MXS_SET_ADDR;
+
+	/* enable apbh channel clock */
+	if (dma_is_apbh()) {
+		if (apbh_is_old())
+			writel(1 << (chan_id + BP_APBH_CTRL0_CLKGATE_CHANNEL),
+				mxs_dma->base + HW_APBHX_CTRL0 + set_clr);
+		else
+			writel(1 << chan_id,
+				mxs_dma->base + HW_APBHX_CTRL0 + set_clr);
+	}
+}
+
 static void mxs_dma_reset_chan(struct mxs_dma_chan *mxs_chan)
 {
 	struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
@@ -149,38 +166,21 @@ static void mxs_dma_enable_chan(struct mxs_dma_chan *mxs_chan)
 	struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
 	int chan_id = mxs_chan->chan.chan_id;
 
+	/* clkgate needs to be enabled before writing other registers */
+	mxs_dma_clkgate(mxs_chan, 1);
+
 	/* set cmd_addr up */
 	writel(mxs_chan->ccw_phys,
 		mxs_dma->base + HW_APBHX_CHn_NXTCMDAR(chan_id));
 
-	/* enable apbh channel clock */
-	if (dma_is_apbh()) {
-		if (apbh_is_old())
-			writel(1 << (chan_id + BP_APBH_CTRL0_CLKGATE_CHANNEL),
-				mxs_dma->base + HW_APBHX_CTRL0 + MXS_CLR_ADDR);
-		else
-			writel(1 << chan_id,
-				mxs_dma->base + HW_APBHX_CTRL0 + MXS_CLR_ADDR);
-	}
-
 	/* write 1 to SEMA to kick off the channel */
 	writel(1, mxs_dma->base + HW_APBHX_CHn_SEMA(chan_id));
 }
 
 static void mxs_dma_disable_chan(struct mxs_dma_chan *mxs_chan)
 {
-	struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
-	int chan_id = mxs_chan->chan.chan_id;
-
 	/* disable apbh channel clock */
-	if (dma_is_apbh()) {
-		if (apbh_is_old())
-			writel(1 << (chan_id + BP_APBH_CTRL0_CLKGATE_CHANNEL),
-				mxs_dma->base + HW_APBHX_CTRL0 + MXS_SET_ADDR);
-		else
-			writel(1 << chan_id,
-				mxs_dma->base + HW_APBHX_CTRL0 + MXS_SET_ADDR);
-	}
+	mxs_dma_clkgate(mxs_chan, 0);
 
 	mxs_chan->status = DMA_SUCCESS;
 }
@@ -359,7 +359,10 @@ static int mxs_dma_alloc_chan_resources(struct dma_chan *chan)
 	if (ret)
 		goto err_clk;
 
+	/* clkgate needs to be enabled for reset to finish */
+	mxs_dma_clkgate(mxs_chan, 1);
 	mxs_dma_reset_chan(mxs_chan);
+	mxs_dma_clkgate(mxs_chan, 0);
 
 	dma_async_tx_descriptor_init(&mxs_chan->desc, chan);
 	mxs_chan->desc.tx_submit = mxs_dma_tx_submit;
Signature · 1 line
1.5.6.5
#2 lore raw

PATCH 1/1 MXS DMA: enable CLKGATE before accessing registers

Quoted 5 lines · Lothar Wa?mann

After calling mxs_dma_disable_chan() for a channel, that channel becomes unusable because some controller registers can only be written when the clock is enabled via CLKGATE.

However...

Quoted 76 lines
---
 drivers/dma/mxs-dma.c |   45 ++++++++++++++++++++++++---------------------
 1 files changed, 24 insertions(+), 21 deletions(-)
drivers/dma/mxs-dma.c +21 -21
index 5b9b66a..329405c 100644
@@ -131,6 +131,23 @@ struct mxs_dma_engine {
 	int				irqmap[MXS_DMA_CHANNELS];
 };
 
+static inline void mxs_dma_clkgate(struct mxs_dma_chan *mxs_chan, int enable)
+{
+	struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
+	int chan_id = mxs_chan->chan.chan_id;
+	int set_clr = enable ? MXS_CLR_ADDR : MXS_SET_ADDR;
+
+	/* enable apbh channel clock */
+	if (dma_is_apbh()) {
+		if (apbh_is_old())
+			writel(1 << (chan_id + BP_APBH_CTRL0_CLKGATE_CHANNEL),
+				mxs_dma->base + HW_APBHX_CTRL0 + set_clr);
+		else
+			writel(1 << chan_id,
+				mxs_dma->base + HW_APBHX_CTRL0 + set_clr);
+	}
+}
+
 static void mxs_dma_reset_chan(struct mxs_dma_chan *mxs_chan)
 {
 	struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
@@ -149,38 +166,21 @@ static void mxs_dma_enable_chan(struct mxs_dma_chan *mxs_chan)
 	struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
 	int chan_id = mxs_chan->chan.chan_id;
 
+	/* clkgate needs to be enabled before writing other registers */
+	mxs_dma_clkgate(mxs_chan, 1);
+
 	/* set cmd_addr up */
 	writel(mxs_chan->ccw_phys,
 		mxs_dma->base + HW_APBHX_CHn_NXTCMDAR(chan_id));
 
-	/* enable apbh channel clock */
-	if (dma_is_apbh()) {
-		if (apbh_is_old())
-			writel(1 << (chan_id + BP_APBH_CTRL0_CLKGATE_CHANNEL),
-				mxs_dma->base + HW_APBHX_CTRL0 + MXS_CLR_ADDR);
-		else
-			writel(1 << chan_id,
-				mxs_dma->base + HW_APBHX_CTRL0 + MXS_CLR_ADDR);
-	}
-
 	/* write 1 to SEMA to kick off the channel */
 	writel(1, mxs_dma->base + HW_APBHX_CHn_SEMA(chan_id));
 }
 
 static void mxs_dma_disable_chan(struct mxs_dma_chan *mxs_chan)
 {
-	struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
-	int chan_id = mxs_chan->chan.chan_id;
-
 	/* disable apbh channel clock */
-	if (dma_is_apbh()) {
-		if (apbh_is_old())
-			writel(1 << (chan_id + BP_APBH_CTRL0_CLKGATE_CHANNEL),
-				mxs_dma->base + HW_APBHX_CTRL0 + MXS_SET_ADDR);
-		else
-			writel(1 << chan_id,
-				mxs_dma->base + HW_APBHX_CTRL0 + MXS_SET_ADDR);
-	}
+	mxs_dma_clkgate(mxs_chan, 0);
 
 	mxs_chan->status = DMA_SUCCESS;
 }

drivers/dma/mxs-dma.c static int mxs_dma_alloc_chan_resources(struct dma_chan *chan) · line 364

Quoted 6 lines
drivers/dma/mxs-dma.c +2 -0
@@ -359,7 +359,10 @@ static int mxs_dma_alloc_chan_resources(struct dma_chan *chan)
 	if (ret)
 		goto err_clk;
 
+	/* clkgate needs to be enabled for reset to finish */
+	mxs_dma_clkgate(mxs_chan, 1);
 	mxs_dma_reset_chan(mxs_chan);

... I do not remember any special reason to call mxs_dma_reset_chan() here when I wrote the code. Now I start guessing it's not necessary.

Quoted 8 lines
drivers/dma/mxs-dma.c +1 -0
+	mxs_dma_clkgate(mxs_chan, 0);
 
 	dma_async_tx_descriptor_init(&mxs_chan->desc, chan);
 	mxs_chan->desc.tx_submit = mxs_dma_tx_submit;
Signature · 1 line
1.5.6.5
Signature · 2 lines
Regards,
Shawn
#3 lore raw

cover mxs-dma: Bugfixes for mxs-dma originally sent in April

In reply to Lothar Waßmann

Hi,

I'm resending two bugfixes for the mxs-dma driver, that I had originally sent in April which were acked by Shawn Guo and Uwe Kleine-König, but obviously were not picked up by any maintainer.

Best regards,
Lothar Waßmann

---
 drivers/dma/mxs-dma.c |    3 ++-
 drivers/dma/mxs-dma.c |   45 ++++++++++++++++++++++++---------------------
 2 files changed, 26 insertions(+), 22 deletions(-)
#4 lore raw

PATCH RESEND 1/2 mxs-dma: Add missing end of list marker for platform_id table

---
 drivers/dma/mxs-dma.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/dma/mxs-dma.c +2 -1
index 88aad4f..f2ddcbd 100644
@@ -707,7 +707,8 @@ static struct platform_device_id mxs_dma_type[] = {
 	}, {
 		.name = "mxs-dma-apbx",
 		.driver_data = MXS_DMA_APBX,
-	}
+	},
+	{ /* end of list marker */ }
 };
 
 static struct platform_driver mxs_dma_driver = {
Signature · 1 line
1.5.6.5
#5 lore raw

PATCH RESEND 2/2 mxs-dma: enable CLKGATE before accessing registers

After calling mxs_dma_disable_chan() for a channel, that channel becomes unusable because some controller registers can only be written when the clock is enabled via CLKGATE.

---
 drivers/dma/mxs-dma.c |   45 ++++++++++++++++++++++++---------------------
 1 files changed, 24 insertions(+), 21 deletions(-)
drivers/dma/mxs-dma.c +24 -21
index f2ddcbd..7deab8a 100644
@@ -130,6 +130,23 @@ struct mxs_dma_engine {
 	struct mxs_dma_chan		mxs_chans[MXS_DMA_CHANNELS];
 };
 
+static inline void mxs_dma_clkgate(struct mxs_dma_chan *mxs_chan, int enable)
+{
+	struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
+	int chan_id = mxs_chan->chan.chan_id;
+	int set_clr = enable ? MXS_CLR_ADDR : MXS_SET_ADDR;
+
+	/* enable apbh channel clock */
+	if (dma_is_apbh()) {
+		if (apbh_is_old())
+			writel(1 << (chan_id + BP_APBH_CTRL0_CLKGATE_CHANNEL),
+				mxs_dma->base + HW_APBHX_CTRL0 + set_clr);
+		else
+			writel(1 << chan_id,
+				mxs_dma->base + HW_APBHX_CTRL0 + set_clr);
+	}
+}
+
 static void mxs_dma_reset_chan(struct mxs_dma_chan *mxs_chan)
 {
 	struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
@@ -148,38 +165,21 @@ static void mxs_dma_enable_chan(struct mxs_dma_chan *mxs_chan)
 	struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
 	int chan_id = mxs_chan->chan.chan_id;
 
+	/* clkgate needs to be enabled before writing other registers */
+	mxs_dma_clkgate(mxs_chan, 1);
+
 	/* set cmd_addr up */
 	writel(mxs_chan->ccw_phys,
 		mxs_dma->base + HW_APBHX_CHn_NXTCMDAR(chan_id));
 
-	/* enable apbh channel clock */
-	if (dma_is_apbh()) {
-		if (apbh_is_old())
-			writel(1 << (chan_id + BP_APBH_CTRL0_CLKGATE_CHANNEL),
-				mxs_dma->base + HW_APBHX_CTRL0 + MXS_CLR_ADDR);
-		else
-			writel(1 << chan_id,
-				mxs_dma->base + HW_APBHX_CTRL0 + MXS_CLR_ADDR);
-	}
-
 	/* write 1 to SEMA to kick off the channel */
 	writel(1, mxs_dma->base + HW_APBHX_CHn_SEMA(chan_id));
 }
 
 static void mxs_dma_disable_chan(struct mxs_dma_chan *mxs_chan)
 {
-	struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
-	int chan_id = mxs_chan->chan.chan_id;
-
 	/* disable apbh channel clock */
-	if (dma_is_apbh()) {
-		if (apbh_is_old())
-			writel(1 << (chan_id + BP_APBH_CTRL0_CLKGATE_CHANNEL),
-				mxs_dma->base + HW_APBHX_CTRL0 + MXS_SET_ADDR);
-		else
-			writel(1 << chan_id,
-				mxs_dma->base + HW_APBHX_CTRL0 + MXS_SET_ADDR);
-	}
+	mxs_dma_clkgate(mxs_chan, 0);
 
 	mxs_chan->status = DMA_SUCCESS;
 }
@@ -336,7 +336,10 @@ static int mxs_dma_alloc_chan_resources(struct dma_chan *chan)
 	if (ret)
 		goto err_clk;
 
+	/* clkgate needs to be enabled for reset to finish */
+	mxs_dma_clkgate(mxs_chan, 1);
 	mxs_dma_reset_chan(mxs_chan);
+	mxs_dma_clkgate(mxs_chan, 0);
 
 	dma_async_tx_descriptor_init(&mxs_chan->desc, chan);
 	mxs_chan->desc.tx_submit = mxs_dma_tx_submit;
Signature · 1 line
1.5.6.5
#6 lore raw

Re: [RESEND][PATCH 0/2] mxs-dma: Bugfixes for mxs-dma originally sent in April

In reply to Lothar Waßmann
Quoted 5 lines · Lothar Waßmann

Hi,

I'm resending two bugfixes for the mxs-dma driver, that I had originally sent in April which were acked by Shawn Guo and Uwe Kleine-König, but obviously were not picked up by any maintainer.

Sorry about that, in case you received ack on same patch you can carry them when you resend.

Shawn, Uwe Kleine-König pls send your acks again, I will apply these

Quoted 13 lines

Best regards,
Lothar Waßmann

---
 drivers/dma/mxs-dma.c |    3 ++-
 drivers/dma/mxs-dma.c |   45 ++++++++++++++++++++++++---------------------
 2 files changed, 26 insertions(+), 22 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 1 line
~Vinod
#7 lore raw

Re: [RESEND][PATCH 0/2] mxs-dma: Bugfixes for mxs-dma originally sent in April

Quoted 10 lines · Vinod
Quoted 5 lines · Lothar Waßmann

Hi,

I'm resending two bugfixes for the mxs-dma driver, that I had originally sent in April which were acked by Shawn Guo and Uwe Kleine-König, but obviously were not picked up by any maintainer.

Sorry about that, in case you received ack on same patch you can carry them when you resend.

Shawn, Uwe Kleine-König pls send your acks again, I will apply these

I'm sure I acked patch 1 and didn't look deeply into patch 2.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#8 lore raw

Re: [RESEND][PATCH 0/2] mxs-dma: Bugfixes for mxs-dma originally sent in April

Quoted 4 lines · Uwe Kleine-König
Quoted 3 lines · Vinod
Quoted 2 lines · Lothar Waßmann

Hi,

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

I'm resending two bugfixes for the mxs-dma driver, that I had originally sent in April which were acked by Shawn Guo and Uwe Kleine-König, but obviously were not picked up by any maintainer.

Sorry about that, in case you received ack on same patch you can carry them when you resend.

Shawn, Uwe Kleine-König pls send your acks again, I will apply these

I'm sure I acked patch 1 and didn't look deeply into patch 2.

I have applied the patch 2/2. The patch 1/2 was no longer required as its same as patch by Axel

commit 2a9778ed83b142e88cb38acc496a573a3472d27f

Author: Axel Lin <[email protected]>
Date:   Tue Jul 12 18:53:52 2011 +0800

dma: mxs-dma: fix unterminated platform_device_id table

Signature · 1 line
~Vinod
#9 lore raw

PATCH 1/1 MXS DMA: add end of list sentinel to platform_id list

In reply to Lothar Waßmann
Quoted 1 line · Lothar Wa?mann

Thanks
Uwe

Quoted 22 lines
---
 drivers/dma/mxs-dma.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/dma/mxs-dma.c +2 -1
index e25209b..5b9b66a 100644
@@ -737,7 +737,8 @@ static struct platform_device_id mxs_dma_type[] = {
 	}, {
 		.name = "mxs-dma-apbx",
 		.driver_data = MXS_DMA_APBX,
-	}
+	},
+	{ /* end of list marker */ }
 };
 
 static struct platform_driver mxs_dma_driver = {
Signature · 1 line
1.5.6.5
Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |