Patchwork [U-Boot,01/11] dma: apbh: Add special circular mode for LCD

login
register
mail settings
Submitter Marek Vasut
Date July 30, 2013, 9:37 p.m.
Message ID <1375220281-11132-2-git-send-email-marex@denx.de>
Download mbox | patch
Permalink /patch/263531/
State Accepted
Delegated to: Anatolij Gustschin
Headers show

Comments

Marek Vasut - July 30, 2013, 9:37 p.m.
Add special function that executes a specially crafted circular
DMA descriptor. The function doesn't wait for the descriptor to
finish the transfer, since the descritor never finishes. This is
useful when operating a SmartLCD through the LCDIF interface, as
the LCDIF does not give us any means to have continuous refresh
of the SmartLCD. Instead, the RUN bit in the LCDIF CTRL register
must be triggered manually. This can be worked around by starting
an DMA transfer which continuously sets the RUN bit. This function
allows starting exactly such transfer.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Otavio Salvador <otavio@ossystems.com.br>
Cc: Stefano Babic <sbabic@denx.de>
---
 arch/arm/include/asm/imx-common/dma.h |    2 ++
 drivers/dma/apbh_dma.c                |   22 ++++++++++++++++++++++
 2 files changed, 24 insertions(+)
Anatolij Gustschin - Aug. 9, 2013, 7:50 p.m.
On Tue, 30 Jul 2013 23:37:51 +0200
Marek Vasut <marex@denx.de> wrote:

> Add special function that executes a specially crafted circular
> DMA descriptor. The function doesn't wait for the descriptor to
> finish the transfer, since the descritor never finishes. This is
> useful when operating a SmartLCD through the LCDIF interface, as
> the LCDIF does not give us any means to have continuous refresh
> of the SmartLCD. Instead, the RUN bit in the LCDIF CTRL register
> must be triggered manually. This can be worked around by starting
> an DMA transfer which continuously sets the RUN bit. This function
> allows starting exactly such transfer.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Anatolij Gustschin <agust@denx.de>
> Cc: Fabio Estevam <fabio.estevam@freescale.com>
> Cc: Otavio Salvador <otavio@ossystems.com.br>
> Cc: Stefano Babic <sbabic@denx.de>
> ---
>  arch/arm/include/asm/imx-common/dma.h |    2 ++
>  drivers/dma/apbh_dma.c                |   22 ++++++++++++++++++++++
>  2 files changed, 24 insertions(+)

Applied to u-boot-video/master. Thanks!

Anatolij

Patch

diff --git a/arch/arm/include/asm/imx-common/dma.h b/arch/arm/include/asm/imx-common/dma.h
index cb74528..435aa94 100644
--- a/arch/arm/include/asm/imx-common/dma.h
+++ b/arch/arm/include/asm/imx-common/dma.h
@@ -174,4 +174,6 @@  void mxs_dma_init(void);
 int mxs_dma_init_channel(int chan);
 int mxs_dma_release(int chan);
 
+void mxs_dma_circ_start(int chan, struct mxs_dma_desc *pdesc);
+
 #endif	/* __DMA_H__ */
diff --git a/drivers/dma/apbh_dma.c b/drivers/dma/apbh_dma.c
index 510cb28..f55fbc5 100644
--- a/drivers/dma/apbh_dma.c
+++ b/drivers/dma/apbh_dma.c
@@ -557,6 +557,28 @@  int mxs_dma_go(int chan)
 }
 
 /*
+ * Execute a continuously running circular DMA descriptor.
+ * NOTE: This is not intended for general use, but rather
+ *	 for the LCD driver in Smart-LCD mode. It allows
+ *	 continuous triggering of the RUN bit there.
+ */
+void mxs_dma_circ_start(int chan, struct mxs_dma_desc *pdesc)
+{
+	struct mxs_apbh_regs *apbh_regs =
+		(struct mxs_apbh_regs *)MXS_APBH_BASE;
+
+	mxs_dma_flush_desc(pdesc);
+
+	mxs_dma_enable_irq(chan, 1);
+
+	writel(mxs_dma_cmd_address(pdesc),
+		&apbh_regs->ch[chan].hw_apbh_ch_nxtcmdar);
+	writel(1, &apbh_regs->ch[chan].hw_apbh_ch_sema);
+	writel(1 << (chan + APBH_CTRL0_CLKGATE_CHANNEL_OFFSET),
+		&apbh_regs->hw_apbh_ctrl0_clr);
+}
+
+/*
  * Initialize the DMA hardware
  */
 void mxs_dma_init(void)