Skip to contentSkip to conversation

sh: Update dma-sh api

PATCH Superseded Nobuhiro Iwamatsu 3 participants 3 messages Feb 26, 2009 – Mar 2, 2009 SuperH

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sh: Update dma-sh api

Add DMA support of new SH CPU and the change of definition.

---
 arch/sh/drivers/dma/Kconfig              |    8 +-
 arch/sh/drivers/dma/dma-sh.c             |   99 +++++++++-----------
 arch/sh/drivers/dma/dma-sh.h             |   75 ---------------
 arch/sh/include/asm/dma-sh.h             |  151 ++++++++++++++++++++++++++++++
 arch/sh/include/asm/dma.h                |    8 +-
 arch/sh/include/cpu-sh3/cpu/dma.h        |   17 +--
 arch/sh/include/cpu-sh4/cpu/dma-sh4a.h   |   94 ++++++++++++++++++
 arch/sh/include/cpu-sh4/cpu/dma-sh7780.h |   39 --------
 arch/sh/include/cpu-sh4/cpu/dma.h        |   30 +++---
 9 files changed, 314 insertions(+), 207 deletions(-)
 delete mode 100644 arch/sh/drivers/dma/dma-sh.h
 create mode 100644 arch/sh/include/asm/dma-sh.h
 create mode 100644 arch/sh/include/cpu-sh4/cpu/dma-sh4a.h
 delete mode 100644 arch/sh/include/cpu-sh4/cpu/dma-sh7780.h
arch/sh/drivers/dma/Kconfig +4 -4
index 0193636..57d95fc 100644
@@ -12,10 +12,10 @@ config SH_DMA
 config NR_ONCHIP_DMA_CHANNELS
 	int
 	depends on SH_DMA
-	default "6" if CPU_SUBTYPE_SH7720 || CPU_SUBTYPE_SH7721
-	default "8" if CPU_SUBTYPE_SH7750R || CPU_SUBTYPE_SH7751R
-	default "12" if CPU_SUBTYPE_SH7780
-	default "4"
+	default "4" if CPU_SUBTYPE_SH7750 || CPU_SUBTYPE_SH7751 || CPU_SUBTYPE_SH7750S
+	default "8" if CPU_SUBTYPE_SH7750R || CPU_SUBTYPE_SH7751R || CPU_SUBTYPE_SH7760
+	default "12" if CPU_SUBTYPE_SH7723 || CPU_SUBTYPE_SH7780 || CPU_SUBTYPE_SH7785
+	default "6"
 	help
 	  This allows you to specify the number of channels that the on-chip
 	  DMAC supports. This will be 4 for SH7750/SH7751 and 8 for the
arch/sh/drivers/dma/dma-sh.c +43 -56

201 lines not on this page · raw message

arch/sh/drivers/dma/dma-sh.h deleted +0 -75

75 lines not on this page · raw message

arch/sh/include/asm/dma-sh.h new file +151 -0

151 lines not on this page · raw message

arch/sh/include/asm/dma.h +2 -6
index beca712..085e05a 100644
@@ -23,12 +23,8 @@
 /* But... */
 /* XXX: This is not applicable to SuperH, just needed for alloc_bootmem */
 #define MAX_DMA_ADDRESS		(PAGE_OFFSET+0x10000000)
-
-#ifdef CONFIG_NR_DMA_CHANNELS
-#  define MAX_DMA_CHANNELS	(CONFIG_NR_DMA_CHANNELS)
-#else
-#  define MAX_DMA_CHANNELS	(CONFIG_NR_ONCHIP_DMA_CHANNELS)
-#endif
+/* MAX DMA Channel */
+#define MAX_DMA_CHANNELS	(CONFIG_NR_ONCHIP_DMA_CHANNELS)
 
 /*
  * Read and write modes can mean drastically different things depending on the
arch/sh/include/cpu-sh3/cpu/dma.h +6 -11
index 6813c32..0ea15f3 100644
@@ -1,22 +1,17 @@
 #ifndef __ASM_CPU_SH3_DMA_H
 #define __ASM_CPU_SH3_DMA_H
 
-
 #if defined(CONFIG_CPU_SUBTYPE_SH7720) || \
-    defined(CONFIG_CPU_SUBTYPE_SH7721)
-#define SH_DMAC_BASE	0xa4010020
-#else
-#define SH_DMAC_BASE	0xa4000020
+    defined(CONFIG_CPU_SUBTYPE_SH7721) || \
+    defined(CONFIG_CPU_SUBTYPE_SH7710) || \
+    defined(CONFIG_CPU_SUBTYPE_SH7712)
+#define SH_DMAC_BASE0	0xa4010020
+#else /* SH7705/06/07/09 */
+#define SH_DMAC_BASE0	0xa4000020
 #endif
 
-#if defined(CONFIG_CPU_SUBTYPE_SH7720) || defined(CONFIG_CPU_SUBTYPE_SH7709)
 #define DMTE0_IRQ	48
-#define DMTE1_IRQ	49
-#define DMTE2_IRQ	50
-#define DMTE3_IRQ	51
 #define DMTE4_IRQ	76
-#define DMTE5_IRQ	77
-#endif
 
 /* Definitions for the SuperH DMAC */
 #define TM_BURST	0x00000020
arch/sh/include/cpu-sh4/cpu/dma-sh4a.h new file +94 -0

94 lines not on this page · raw message

arch/sh/include/cpu-sh4/cpu/dma-sh7780.h deleted +0 -39
deleted file mode 100644
index 71b426a..0000000
@@ -1,39 +0,0 @@
-#ifndef __ASM_SH_CPU_SH4_DMA_SH7780_H
-#define __ASM_SH_CPU_SH4_DMA_SH7780_H
-
-#define REQ_HE	0x000000C0
-#define REQ_H	0x00000080
-#define REQ_LE	0x00000040
-#define TM_BURST 0x0000020
-#define TS_8	0x00000000
-#define TS_16	0x00000008
-#define TS_32	0x00000010
-#define TS_16BLK	0x00000018
-#define TS_32BLK	0x00100000
-
-/*
- * The SuperH DMAC supports a number of transmit sizes, we list them here,
- * with their respective values as they appear in the CHCR registers.
- *
- * Defaults to a 64-bit transfer size.
- */
-enum {
-	XMIT_SZ_8BIT,
-	XMIT_SZ_16BIT,
-	XMIT_SZ_32BIT,
-	XMIT_SZ_128BIT,
-	XMIT_SZ_256BIT,
-};
-
-/*
- * The DMA count is defined as the number of bytes to transfer.
- */
-static unsigned int ts_shift[] __maybe_unused = {
-	[XMIT_SZ_8BIT]		= 0,
-	[XMIT_SZ_16BIT]		= 1,
-	[XMIT_SZ_32BIT]		= 2,
-	[XMIT_SZ_128BIT]	= 4,
-	[XMIT_SZ_256BIT]	= 5,
-};
-
-#endif /* __ASM_SH_CPU_SH4_DMA_SH7780_H */
arch/sh/include/cpu-sh4/cpu/dma.h +14 -16
index 235b7cd..bcb3024 100644
@@ -1,31 +1,29 @@
 #ifndef __ASM_CPU_SH4_DMA_H
 #define __ASM_CPU_SH4_DMA_H
 
-#define DMAOR_INIT	( 0x8000 | DMAOR_DME )
-
 /* SH7751/7760/7780 DMA IRQ sources */
-#define DMTE0_IRQ	34
-#define DMTE1_IRQ	35
-#define DMTE2_IRQ	36
-#define DMTE3_IRQ	37
-#define DMTE4_IRQ	44
-#define DMTE5_IRQ	45
-#define DMTE6_IRQ	46
-#define DMTE7_IRQ	47
-#define DMAE_IRQ	38
 
 #ifdef CONFIG_CPU_SH4A
-#define SH_DMAC_BASE	0xfc808020
 
+#define DMAOR_INIT	(DMAOR_DME)
 #define CHCR_TS_MASK	0x18
 #define CHCR_TS_SHIFT	3
 
-#include <cpu/dma-sh7780.h>
-#else
-#define SH_DMAC_BASE	0xffa00000
+#include <cpu/dma-sh4a.h>
+#else /* CONFIG_CPU_SH4A */
+/*
+ * SH7750/SH7751/SH7760
+ */
+#define DMTE0_IRQ	34
+#define DMTE4_IRQ	44
+#define DMTE6_IRQ	46
+#define DMAE0_IRQ	38
 
+#define DMAOR_INIT	(0x8000|DMAOR_DME)
+#define SH_DMAC_BASE0	0xffa00000
+#define SH_DMAC_BASE1	0xffa00070
 /* Definitions for the SuperH DMAC */
-#define TM_BURST	0x0000080
+#define TM_BURST	0x00000080
 #define TS_8		0x00000010
 #define TS_16		0x00000020
 #define TS_32		0x00000030

-- 1.5.6.5

#1 lore raw

Hi Iwamatsu-san,

Quoted 3 lines · Nobuhiro Iwamatsu

Add DMA support of new SH CPU and the change of definition.

Thanks for your work on this. I have one main question and a few nitpicking comments on your patch.

Question:

Does this patch build on top of the reworked sh775x, sh7780 and sh7785 interrupt vectors? The patchset pointed out below modifies the DMAC interrupt to only use a single linux interrupt instead of multiple with broken masking:

http://patchwork.kernel.org/patch/8592/

arch/sh/include/asm/dma-sh.h line 2

Quoted 5 lines
arch/sh/include/asm/dma-sh.h new file +2 -0
@@ -0,0 +1,151 @@
+/*
+ * arch/sh/drivers/dma/dma-sh.h

Header comment mismatch. =)

Cheers,

/ magnus

#2 lore raw
In reply to Nobuhiro Iwamatsu

Hi, Magnus .

2009/2/27 Magnus Damm <[email protected]>:

Quoted 11 lines

Hi Iwamatsu-san,

Quoted 3 lines · Nobuhiro Iwamatsu

Add DMA support of new SH CPU and the change of definition.

Thanks for your work on this. I have one main question and a few nitpicking comments on your patch.

Quoted 8 lines

Question:

Does this patch build on top of the reworked sh775x, sh7780 and sh7785 interrupt vectors? The patchset pointed out below modifies the DMAC interrupt to only use a single linux interrupt instead of multiple with broken masking:

http://patchwork.kernel.org/patch/8592/

I did not consider your patch.
I will read your patch and think.

Quoted 9 lines

arch/sh/include/asm/dma-sh.h line 2

Quoted 6 lines
arch/sh/include/asm/dma-sh.h new file +2 -0
@@ -0,0 +1,151 @@
+/*
+ * arch/sh/drivers/dma/dma-sh.h

Header comment mismatch. =)

Thanks, I will fixed next version.

Best regards,
Nobuhiro

Signature · 1 line
Nobuhiro Iwamatsu