All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 1/5] pch_dma: fix dma direction issue for ML7213 IOH video-in
@ 2011-05-09  3:40 Tomoya MORINAGA
  2011-05-09  3:40 ` [PATCH V2 2/5] pch_dma: modify for checkpatch Tomoya MORINAGA
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Tomoya MORINAGA @ 2011-05-09  3:40 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>
---
V2: Update Koul-Vinod's comments
---
 drivers/dma/pch_dma.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c
index 8d8fef1..c84b18d 100644
--- a/drivers/dma/pch_dma.c
+++ b/drivers/dma/pch_dma.c
@@ -478,7 +478,6 @@ static int pd_alloc_chan_resources(struct dma_chan *chan)
 	spin_unlock_bh(&pd_chan->lock);
 
 	pdc_enable_irq(chan, 1);
-	pdc_set_dir(chan);
 
 	return pd_chan->descs_allocated;
 }
@@ -561,6 +560,9 @@ static struct dma_async_tx_descriptor *pd_prep_slave_sg(struct dma_chan *chan,
 	else
 		return NULL;
 
+	pd_chan->dir = direction;
+	pdc_set_dir(chan);
+
 	for_each_sg(sgl, sg, sg_len, i) {
 		desc = pdc_desc_get(pd_chan);
 
@@ -850,8 +852,6 @@ 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;
-
 		spin_lock_init(&pd_chan->lock);
 
 		INIT_LIST_HEAD(&pd_chan->active_list);
-- 
1.7.4


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

* [PATCH V2 2/5] pch_dma: modify for checkpatch
  2011-05-09  3:40 [PATCH V2 1/5] pch_dma: fix dma direction issue for ML7213 IOH video-in Tomoya MORINAGA
@ 2011-05-09  3:40 ` Tomoya MORINAGA
  2011-05-09  4:02   ` Joe Perches
  2011-05-09  3:40 ` [PATCH V2 3/5] pch_dma: Fix DMA setting issue Tomoya MORINAGA
  2011-05-09  3:40 ` [PATCH V2 4/5] pch_dma: Support I2S for ML7213 IOH Tomoya MORINAGA
  2 siblings, 1 reply; 6+ messages in thread
From: Tomoya MORINAGA @ 2011-05-09  3:40 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 c84b18d..f73686e 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 related	[flat|nested] 6+ messages in thread

* [PATCH V2 3/5] pch_dma: Fix DMA setting issue
  2011-05-09  3:40 [PATCH V2 1/5] pch_dma: fix dma direction issue for ML7213 IOH video-in Tomoya MORINAGA
  2011-05-09  3:40 ` [PATCH V2 2/5] pch_dma: modify for checkpatch Tomoya MORINAGA
@ 2011-05-09  3:40 ` Tomoya MORINAGA
  2011-05-09  3:40 ` [PATCH V2 4/5] pch_dma: Support I2S for ML7213 IOH Tomoya MORINAGA
  2 siblings, 0 replies; 6+ messages in thread
From: Tomoya MORINAGA @ 2011-05-09  3:40 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 f73686e..0ecf227 100644
--- a/drivers/dma/pch_dma.c
+++ b/drivers/dma/pch_dma.c
@@ -254,9 +254,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");
@@ -282,10 +279,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 related	[flat|nested] 6+ messages in thread

* [PATCH V2 4/5] pch_dma: Support I2S for ML7213 IOH
  2011-05-09  3:40 [PATCH V2 1/5] pch_dma: fix dma direction issue for ML7213 IOH video-in Tomoya MORINAGA
  2011-05-09  3:40 ` [PATCH V2 2/5] pch_dma: modify for checkpatch Tomoya MORINAGA
  2011-05-09  3:40 ` [PATCH V2 3/5] pch_dma: Fix DMA setting issue Tomoya MORINAGA
@ 2011-05-09  3:40 ` Tomoya MORINAGA
  2 siblings, 0 replies; 6+ messages in thread
From: Tomoya MORINAGA @ 2011-05-09  3:40 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 0ecf227..2c052bb 100644
--- a/drivers/dma/pch_dma.c
+++ b/drivers/dma/pch_dma.c
@@ -77,10 +77,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];
 };
@@ -130,6 +130,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
 
@@ -202,16 +203,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);
@@ -222,13 +237,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);
@@ -701,6 +729,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);
@@ -723,6 +752,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);
@@ -925,6 +955,7 @@ static void __devexit pch_dma_remove(struct pci_dev *pdev)
 #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
 
 static const struct pci_device_id pch_dma_id_table[] = {
 	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_EG20T_PCH_DMA_8CH), 8 },
@@ -932,6 +963,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 related	[flat|nested] 6+ messages in thread

* Re: [PATCH V2 2/5] pch_dma: modify for checkpatch
  2011-05-09  3:40 ` [PATCH V2 2/5] pch_dma: modify for checkpatch Tomoya MORINAGA
@ 2011-05-09  4:02   ` Joe Perches
  2011-05-09  5:27     ` Tomoya MORINAGA
  0 siblings, 1 reply; 6+ messages in thread
From: Joe Perches @ 2011-05-09  4:02 UTC (permalink / raw)
  To: Tomoya MORINAGA
  Cc: Dan Williams, Vinod Koul, linux-kernel, qi.wang, yong.y.wang,
	joel.clark, kok.howg.ewe, toshiharu-linux

On Mon, 2011-05-09 at 12:40 +0900, Tomoya MORINAGA wrote:
> Fix checkpatch warnings.
> Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
> diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c
[]
> @@ -138,7 +138,8 @@ struct pch_dma {
> -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)

I think these are better either not changed at all
or to either of the styles below:

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)




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

* RE: [PATCH V2 2/5] pch_dma: modify for checkpatch
  2011-05-09  4:02   ` Joe Perches
@ 2011-05-09  5:27     ` Tomoya MORINAGA
  0 siblings, 0 replies; 6+ messages in thread
From: Tomoya MORINAGA @ 2011-05-09  5:27 UTC (permalink / raw)
  To: 'Joe Perches'
  Cc: 'Dan Williams', 'Vinod Koul',
	linux-kernel, qi.wang, yong.y.wang, joel.clark, kok.howg.ewe,
	toshiharu-linux

Hi Joe,

On Monday, May 09, 2011 1:02 PM, Joe Perches wrote:
> > @@ -138,7 +138,8 @@ struct pch_dma {
> > -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)
> 
> I think these are better either not changed at all or to 
> either of the styles below:
> 
> 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)

 I will use the following.
> static inline
> struct pch_dma_desc *to_pd_desc(struct dma_async_tx_descriptor *txd)

Thanks,
-----------------------------------------
Tomoya MORINAGA
OKI SEMICONDUCTOR CO., LTD.


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

end of thread, other threads:[~2011-05-09  5:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-09  3:40 [PATCH V2 1/5] pch_dma: fix dma direction issue for ML7213 IOH video-in Tomoya MORINAGA
2011-05-09  3:40 ` [PATCH V2 2/5] pch_dma: modify for checkpatch Tomoya MORINAGA
2011-05-09  4:02   ` Joe Perches
2011-05-09  5:27     ` Tomoya MORINAGA
2011-05-09  3:40 ` [PATCH V2 3/5] pch_dma: Fix DMA setting issue Tomoya MORINAGA
2011-05-09  3:40 ` [PATCH V2 4/5] pch_dma: Support I2S for ML7213 IOH Tomoya MORINAGA

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.