mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/4] pch_dma: Modify for checkpatch
@ 2011-04-26 10:05 Tomoya MORINAGA
  2011-04-26 10:05 ` [PATCH 2/4] pch_dma: fix dma direction issue for ML7213 IOH video-in Tomoya MORINAGA
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Tomoya MORINAGA @ 2011-04-26 10:05 UTC (permalink / raw)
  To: Dan Williams, Vinod Koul, linux-kernel
  Cc: qi.wang, yong.y.wang, joel.clark, kok.howg.ewe, toshiharu-linux,
	Tomoya MORINAGA

Fix checkpatch warnings.

Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
---
 drivers/dma/pch_dma.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c
index 8d8fef1..9421ed5 100644
--- a/drivers/dma/pch_dma.c
+++ b/drivers/dma/pch_dma.c
@@ -138,7 +138,8 @@ struct pch_dma {
 #define dma_writel(pd, name, val) \
 	writel((val), (pd)->membase + PCH_DMA_##name)
 
-static inline struct pch_dma_desc *to_pd_desc(struct dma_async_tx_descriptor *txd)
+static inline struct pch_dma_desc *to_pd_desc(
+					struct dma_async_tx_descriptor *txd)
 {
 	return container_of(txd, struct pch_dma_desc, txd);
 }
@@ -163,13 +164,15 @@ static inline struct device *chan2parent(struct dma_chan *chan)
 	return chan->dev->device.parent;
 }
 
-static inline struct pch_dma_desc *pdc_first_active(struct pch_dma_chan *pd_chan)
+static inline struct pch_dma_desc *pdc_first_active(
+						struct pch_dma_chan *pd_chan)
 {
 	return list_first_entry(&pd_chan->active_list,
 				struct pch_dma_desc, desc_node);
 }
 
-static inline struct pch_dma_desc *pdc_first_queued(struct pch_dma_chan *pd_chan)
+static inline struct pch_dma_desc *pdc_first_queued(
+						struct pch_dma_chan *pd_chan)
 {
 	return list_first_entry(&pd_chan->queue,
 				struct pch_dma_desc, desc_node);
-- 
1.7.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/4] pch_dma: fix dma direction issue for ML7213 IOH video-in
  2011-04-26 10:05 [PATCH 1/4] pch_dma: Modify for checkpatch Tomoya MORINAGA
@ 2011-04-26 10:05 ` Tomoya MORINAGA
  2011-05-02  6:16   ` Koul, Vinod
  2011-04-26 10:05 ` [PATCH 3/4] pch_dma: Fix DMA setting issue Tomoya MORINAGA
  2011-04-26 10:05 ` [PATCH 4/4] pch_dma: Support I2S for ML7213 IOH Tomoya MORINAGA
  2 siblings, 1 reply; 5+ messages in thread
From: Tomoya MORINAGA @ 2011-04-26 10:05 UTC (permalink / raw)
  To: Dan Williams, Vinod Koul, linux-kernel
  Cc: qi.wang, yong.y.wang, joel.clark, kok.howg.ewe, toshiharu-linux,
	Tomoya MORINAGA

Currently, even-channel number is set as tx direction and odd is set as rx.
However, though video-in uses ch6, the direction is not tx but rx.
This patch sets video-in's DMA direction correctly.

Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
---
 drivers/dma/pch_dma.c |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c
index 9421ed5..cd7bf83 100644
--- a/drivers/dma/pch_dma.c
+++ b/drivers/dma/pch_dma.c
@@ -59,6 +59,14 @@
 #define DMA_DESC_FOLLOW_WITHOUT_IRQ	0x2
 #define DMA_DESC_FOLLOW_WITH_IRQ	0x3
 
+/* PCI Device ID of DMA device */
+#define PCI_VENDOR_ID_ROHM             0x10DB
+#define PCI_DEVICE_ID_EG20T_PCH_DMA_8CH        0x8810
+#define PCI_DEVICE_ID_EG20T_PCH_DMA_4CH        0x8815
+#define PCI_DEVICE_ID_ML7213_DMA1_8CH	0x8026
+#define PCI_DEVICE_ID_ML7213_DMA2_8CH	0x802B
+#define PCI_DEVICE_ID_ML7213_DMA3_4CH	0x8034
+
 #define MAX_CHAN_NR			8
 
 static unsigned int init_nr_desc_per_channel = 64;
@@ -853,7 +861,12 @@ static int __devinit pch_dma_probe(struct pci_dev *pdev,
 
 		pd_chan->membase = &regs->desc[i];
 
-		pd_chan->dir = (i % 2) ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
+		/* D10:F0 DMA ch6 "video input" is rx direction */
+		if ((id->device == PCI_DEVICE_ID_ML7213_DMA1_8CH) && (i == 6))
+			pd_chan->dir = DMA_FROM_DEVICE;
+		else
+			pd_chan->dir = (i % 2) ? DMA_FROM_DEVICE : \
+								DMA_TO_DEVICE;
 
 		spin_lock_init(&pd_chan->lock);
 
@@ -925,14 +938,6 @@ static void __devexit pch_dma_remove(struct pci_dev *pdev)
 	}
 }
 
-/* PCI Device ID of DMA device */
-#define PCI_VENDOR_ID_ROHM             0x10DB
-#define PCI_DEVICE_ID_EG20T_PCH_DMA_8CH        0x8810
-#define PCI_DEVICE_ID_EG20T_PCH_DMA_4CH        0x8815
-#define PCI_DEVICE_ID_ML7213_DMA1_8CH	0x8026
-#define PCI_DEVICE_ID_ML7213_DMA2_8CH	0x802B
-#define PCI_DEVICE_ID_ML7213_DMA3_4CH	0x8034
-
 static const struct pci_device_id pch_dma_id_table[] = {
 	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_EG20T_PCH_DMA_8CH), 8 },
 	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_EG20T_PCH_DMA_4CH), 4 },
-- 
1.7.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3/4] pch_dma: Fix DMA setting issue
  2011-04-26 10:05 [PATCH 1/4] pch_dma: Modify for checkpatch Tomoya MORINAGA
  2011-04-26 10:05 ` [PATCH 2/4] pch_dma: fix dma direction issue for ML7213 IOH video-in Tomoya MORINAGA
@ 2011-04-26 10:05 ` Tomoya MORINAGA
  2011-04-26 10:05 ` [PATCH 4/4] pch_dma: Support I2S for ML7213 IOH Tomoya MORINAGA
  2 siblings, 0 replies; 5+ messages in thread
From: Tomoya MORINAGA @ 2011-04-26 10:05 UTC (permalink / raw)
  To: Dan Williams, Vinod Koul, linux-kernel
  Cc: qi.wang, yong.y.wang, joel.clark, kok.howg.ewe, toshiharu-linux,
	Tomoya MORINAGA

Currently, Direct-Start mode(*) is enabled.
Our IOH's devices must not use this mode.
This causes unexpected behavior.
This patch deletes Direct-Start setting.
(*) This mode is used in order for CPU to generate the DMA request.

Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
---
 drivers/dma/pch_dma.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c
index cd7bf83..35b6e80 100644
--- a/drivers/dma/pch_dma.c
+++ b/drivers/dma/pch_dma.c
@@ -262,9 +262,6 @@ static bool pdc_is_idle(struct pch_dma_chan *pd_chan)
 
 static void pdc_dostart(struct pch_dma_chan *pd_chan, struct pch_dma_desc* desc)
 {
-	struct pch_dma *pd = to_pd(pd_chan->chan.device);
-	u32 val;
-
 	if (!pdc_is_idle(pd_chan)) {
 		dev_err(chan2dev(&pd_chan->chan),
 			"BUG: Attempt to start non-idle channel\n");
@@ -290,10 +287,6 @@ static void pdc_dostart(struct pch_dma_chan *pd_chan, struct pch_dma_desc* desc)
 		channel_writel(pd_chan, NEXT, desc->txd.phys);
 		pdc_set_mode(&pd_chan->chan, DMA_CTL0_SG);
 	}
-
-	val = dma_readl(pd, CTL2);
-	val |= 1 << (DMA_CTL2_START_SHIFT_BITS + pd_chan->chan.chan_id);
-	dma_writel(pd, CTL2, val);
 }
 
 static void pdc_chain_complete(struct pch_dma_chan *pd_chan,
-- 
1.7.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 4/4] pch_dma: Support I2S for ML7213 IOH
  2011-04-26 10:05 [PATCH 1/4] pch_dma: Modify for checkpatch Tomoya MORINAGA
  2011-04-26 10:05 ` [PATCH 2/4] pch_dma: fix dma direction issue for ML7213 IOH video-in Tomoya MORINAGA
  2011-04-26 10:05 ` [PATCH 3/4] pch_dma: Fix DMA setting issue Tomoya MORINAGA
@ 2011-04-26 10:05 ` Tomoya MORINAGA
  2 siblings, 0 replies; 5+ messages in thread
From: Tomoya MORINAGA @ 2011-04-26 10:05 UTC (permalink / raw)
  To: Dan Williams, Vinod Koul, linux-kernel
  Cc: qi.wang, yong.y.wang, joel.clark, kok.howg.ewe, toshiharu-linux,
	Tomoya MORINAGA

Support I2S device for ML7213 IOH

Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
---
 drivers/dma/pch_dma.c |   62 +++++++++++++++++++++++++++++++++++++------------
 1 files changed, 47 insertions(+), 15 deletions(-)

diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c
index 35b6e80..376a463 100644
--- a/drivers/dma/pch_dma.c
+++ b/drivers/dma/pch_dma.c
@@ -66,6 +66,7 @@
 #define PCI_DEVICE_ID_ML7213_DMA1_8CH	0x8026
 #define PCI_DEVICE_ID_ML7213_DMA2_8CH	0x802B
 #define PCI_DEVICE_ID_ML7213_DMA3_4CH	0x8034
+#define PCI_DEVICE_ID_ML7213_DMA4_12CH	0x8032
 
 #define MAX_CHAN_NR			8
 
@@ -85,10 +86,10 @@ struct pch_dma_regs {
 	u32	dma_ctl0;
 	u32	dma_ctl1;
 	u32	dma_ctl2;
-	u32	reserved1;
+	u32	dma_ctl3;
 	u32	dma_sts0;
 	u32	dma_sts1;
-	u32	reserved2;
+	u32	dma_sts2;
 	u32	reserved3;
 	struct pch_dma_desc_regs desc[MAX_CHAN_NR];
 };
@@ -138,6 +139,7 @@ struct pch_dma {
 #define PCH_DMA_CTL0	0x00
 #define PCH_DMA_CTL1	0x04
 #define PCH_DMA_CTL2	0x08
+#define PCH_DMA_CTL3	0x0C
 #define PCH_DMA_STS0	0x10
 #define PCH_DMA_STS1	0x14
 
@@ -210,16 +212,30 @@ static void pdc_set_dir(struct dma_chan *chan)
 	struct pch_dma *pd = to_pd(chan->device);
 	u32 val;
 
-	val = dma_readl(pd, CTL0);
+	if (chan->chan_id < 8) {
+		val = dma_readl(pd, CTL0);
 
-	if (pd_chan->dir == DMA_TO_DEVICE)
-		val |= 0x1 << (DMA_CTL0_BITS_PER_CH * chan->chan_id +
-			       DMA_CTL0_DIR_SHIFT_BITS);
-	else
-		val &= ~(0x1 << (DMA_CTL0_BITS_PER_CH * chan->chan_id +
-				 DMA_CTL0_DIR_SHIFT_BITS));
+		if (pd_chan->dir == DMA_TO_DEVICE)
+			val |= 0x1 << (DMA_CTL0_BITS_PER_CH * chan->chan_id +
+				       DMA_CTL0_DIR_SHIFT_BITS);
+		else
+			val &= ~(0x1 << (DMA_CTL0_BITS_PER_CH * chan->chan_id +
+					 DMA_CTL0_DIR_SHIFT_BITS));
+
+		dma_writel(pd, CTL0, val);
+	} else {
+		int ch = chan->chan_id - 8; /* ch8-->0 ch9-->1 ... ch11->3 */
+		val = dma_readl(pd, CTL3);
 
-	dma_writel(pd, CTL0, val);
+		if (pd_chan->dir == DMA_TO_DEVICE)
+			val |= 0x1 << (DMA_CTL0_BITS_PER_CH * ch +
+				       DMA_CTL0_DIR_SHIFT_BITS);
+		else
+			val &= ~(0x1 << (DMA_CTL0_BITS_PER_CH * ch +
+					 DMA_CTL0_DIR_SHIFT_BITS));
+
+		dma_writel(pd, CTL3, val);
+	}
 
 	dev_dbg(chan2dev(chan), "pdc_set_dir: chan %d -> %x\n",
 		chan->chan_id, val);
@@ -230,13 +246,26 @@ static void pdc_set_mode(struct dma_chan *chan, u32 mode)
 	struct pch_dma *pd = to_pd(chan->device);
 	u32 val;
 
-	val = dma_readl(pd, CTL0);
+	if (chan->chan_id < 8) {
+		val = dma_readl(pd, CTL0);
 
-	val &= ~(DMA_CTL0_MODE_MASK_BITS <<
-		(DMA_CTL0_BITS_PER_CH * chan->chan_id));
-	val |= mode << (DMA_CTL0_BITS_PER_CH * chan->chan_id);
+		val &= ~(DMA_CTL0_MODE_MASK_BITS <<
+			(DMA_CTL0_BITS_PER_CH * chan->chan_id));
+		val |= mode << (DMA_CTL0_BITS_PER_CH * chan->chan_id);
 
-	dma_writel(pd, CTL0, val);
+		dma_writel(pd, CTL0, val);
+	} else {
+		int ch = chan->chan_id - 8; /* ch8-->0 ch9-->1 ... ch11->3 */
+
+		val = dma_readl(pd, CTL3);
+
+		val &= ~(DMA_CTL0_MODE_MASK_BITS <<
+			(DMA_CTL0_BITS_PER_CH * ch));
+		val |= mode << (DMA_CTL0_BITS_PER_CH * ch);
+
+		dma_writel(pd, CTL3, val);
+
+	}
 
 	dev_dbg(chan2dev(chan), "pdc_set_mode: chan %d -> %x\n",
 		chan->chan_id, val);
@@ -707,6 +736,7 @@ static void pch_dma_save_regs(struct pch_dma *pd)
 	pd->regs.dma_ctl0 = dma_readl(pd, CTL0);
 	pd->regs.dma_ctl1 = dma_readl(pd, CTL1);
 	pd->regs.dma_ctl2 = dma_readl(pd, CTL2);
+	pd->regs.dma_ctl3 = dma_readl(pd, CTL3);
 
 	list_for_each_entry_safe(chan, _c, &pd->dma.channels, device_node) {
 		pd_chan = to_pd_chan(chan);
@@ -729,6 +759,7 @@ static void pch_dma_restore_regs(struct pch_dma *pd)
 	dma_writel(pd, CTL0, pd->regs.dma_ctl0);
 	dma_writel(pd, CTL1, pd->regs.dma_ctl1);
 	dma_writel(pd, CTL2, pd->regs.dma_ctl2);
+	dma_writel(pd, CTL3, pd->regs.dma_ctl3);
 
 	list_for_each_entry_safe(chan, _c, &pd->dma.channels, device_node) {
 		pd_chan = to_pd_chan(chan);
@@ -937,6 +968,7 @@ static const struct pci_device_id pch_dma_id_table[] = {
 	{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7213_DMA1_8CH), 8}, /* UART Video */
 	{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7213_DMA2_8CH), 8}, /* PCMIF SPI */
 	{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7213_DMA3_4CH), 4}, /* FPGA */
+	{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7213_DMA4_12CH), 12}, /* I2S */
 	{ 0, },
 };
 
-- 
1.7.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/4] pch_dma: fix dma direction issue for ML7213 IOH video-in
  2011-04-26 10:05 ` [PATCH 2/4] pch_dma: fix dma direction issue for ML7213 IOH video-in Tomoya MORINAGA
@ 2011-05-02  6:16   ` Koul, Vinod
  0 siblings, 0 replies; 5+ messages in thread
From: Koul, Vinod @ 2011-05-02  6:16 UTC (permalink / raw)
  To: Tomoya MORINAGA
  Cc: Dan Williams, linux-kernel, qi.wang, yong.y.wang, joel.clark,
	kok.howg.ewe, toshiharu-linux

On Tue, 2011-04-26 at 19:05 +0900, Tomoya MORINAGA wrote:
> Currently, even-channel number is set as tx direction and odd is set as rx.
> However, though video-in uses ch6, the direction is not tx but rx.
> This patch sets video-in's DMA direction correctly.
> 
> Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
> ---
>  drivers/dma/pch_dma.c |   23 ++++++++++++++---------
>  1 files changed, 14 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c
> index 9421ed5..cd7bf83 100644
> --- a/drivers/dma/pch_dma.c
> +++ b/drivers/dma/pch_dma.c
> @@ -59,6 +59,14 @@
>  #define DMA_DESC_FOLLOW_WITHOUT_IRQ	0x2
>  #define DMA_DESC_FOLLOW_WITH_IRQ	0x3
>  
> +/* PCI Device ID of DMA device */
> +#define PCI_VENDOR_ID_ROHM             0x10DB
> +#define PCI_DEVICE_ID_EG20T_PCH_DMA_8CH        0x8810
> +#define PCI_DEVICE_ID_EG20T_PCH_DMA_4CH        0x8815
> +#define PCI_DEVICE_ID_ML7213_DMA1_8CH	0x8026
> +#define PCI_DEVICE_ID_ML7213_DMA2_8CH	0x802B
> +#define PCI_DEVICE_ID_ML7213_DMA3_4CH	0x8034
> +
>  #define MAX_CHAN_NR			8
These additions does seem to match the patch description, Can you split
them appropriately...
>  
>  static unsigned int init_nr_desc_per_channel = 64;
> @@ -853,7 +861,12 @@ static int __devinit pch_dma_probe(struct pci_dev *pdev,
>  
>  		pd_chan->membase = &regs->desc[i];
>  
> -		pd_chan->dir = (i % 2) ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
> +		/* D10:F0 DMA ch6 "video input" is rx direction */
> +		if ((id->device == PCI_DEVICE_ID_ML7213_DMA1_8CH) && (i == 6))
> +			pd_chan->dir = DMA_FROM_DEVICE;
This kind of initialization is wrong....
Will you change again if video channel assignments change...
You should use the direction field in prep_xxx calls for setting this
> +		else
> +			pd_chan->dir = (i % 2) ? DMA_FROM_DEVICE : \
> +								DMA_TO_DEVICE;
>  
>  		spin_lock_init(&pd_chan->lock);
>  
> @@ -925,14 +938,6 @@ static void __devexit pch_dma_remove(struct pci_dev *pdev)
>  	}
>  }
>  
> -/* PCI Device ID of DMA device */
> -#define PCI_VENDOR_ID_ROHM             0x10DB
> -#define PCI_DEVICE_ID_EG20T_PCH_DMA_8CH        0x8810
> -#define PCI_DEVICE_ID_EG20T_PCH_DMA_4CH        0x8815
> -#define PCI_DEVICE_ID_ML7213_DMA1_8CH	0x8026
> -#define PCI_DEVICE_ID_ML7213_DMA2_8CH	0x802B
> -#define PCI_DEVICE_ID_ML7213_DMA3_4CH	0x8034
????

> -
>  static const struct pci_device_id pch_dma_id_table[] = {
>  	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_EG20T_PCH_DMA_8CH), 8 },
>  	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_EG20T_PCH_DMA_4CH), 4 },


-- 
~Vinod


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-05-02  6:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-26 10:05 [PATCH 1/4] pch_dma: Modify for checkpatch Tomoya MORINAGA
2011-04-26 10:05 ` [PATCH 2/4] pch_dma: fix dma direction issue for ML7213 IOH video-in Tomoya MORINAGA
2011-05-02  6:16   ` Koul, Vinod
2011-04-26 10:05 ` [PATCH 3/4] pch_dma: Fix DMA setting issue Tomoya MORINAGA
2011-04-26 10:05 ` [PATCH 4/4] pch_dma: Support I2S for ML7213 IOH Tomoya MORINAGA

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®