Skip to contentSkip to conversation

sh: add a resource name for shdma

PATCH In review Shimoda, Yoshihiro 2 participants 3 messages Jan 11, 2012 – Jan 12, 2012 SuperH

lore
Share & tools
lore
#0 lore raw

PATCH v4 2/6 sh: add a resource name for shdma

---
about v4:
- use defination macros for IRQ resource

 arch/sh/kernel/cpu/sh4a/setup-sh7722.c |    3 +++
 arch/sh/kernel/cpu/sh4a/setup-sh7724.c |    6 ++++++
 arch/sh/kernel/cpu/sh4a/setup-sh7757.c |   16 ++++++++++++++++
 arch/sh/kernel/cpu/sh4a/setup-sh7780.c |    2 ++
 arch/sh/kernel/cpu/sh4a/setup-sh7785.c |    2 ++
 arch/sh/kernel/cpu/sh4a/setup-sh7786.c |    2 ++
 6 files changed, 31 insertions(+), 0 deletions(-)
arch/sh/kernel/cpu/sh4a/setup-sh7722.c +3 -0
index 278a0e5..8d9c809 100644
@@ -147,18 +147,21 @@ static struct resource sh7722_dmae_resources[] = {
 	},
 	{
 		/* DMA error IRQ */
+		.name	= SH_DMA_IRQ_ERROR,
 		.start	= 78,
 		.end	= 78,
 		.flags	= IORESOURCE_IRQ,
 	},
 	{
 		/* IRQ for channels 0-3 */
+		.name	= SH_DMA_IRQ_CHANNEL,
 		.start	= 48,
 		.end	= 51,
 		.flags	= IORESOURCE_IRQ,
 	},
 	{
 		/* IRQ for channels 4-5 */
+		.name	= SH_DMA_IRQ_CHANNEL,
 		.start	= 76,
 		.end	= 77,
 		.flags	= IORESOURCE_IRQ,
arch/sh/kernel/cpu/sh4a/setup-sh7724.c +6 -0
index a37dd72..f657054 100644
@@ -215,18 +215,21 @@ static struct resource sh7724_dmae0_resources[] = {
 	},
 	{
 		/* DMA error IRQ */
+		.name	= SH_DMA_IRQ_ERROR,
 		.start	= 78,
 		.end	= 78,
 		.flags	= IORESOURCE_IRQ,
 	},
 	{
 		/* IRQ for channels 0-3 */
+		.name	= SH_DMA_IRQ_CHANNEL,
 		.start	= 48,
 		.end	= 51,
 		.flags	= IORESOURCE_IRQ,
 	},
 	{
 		/* IRQ for channels 4-5 */
+		.name	= SH_DMA_IRQ_CHANNEL,
 		.start	= 76,
 		.end	= 77,
 		.flags	= IORESOURCE_IRQ,
@@ -249,18 +252,21 @@ static struct resource sh7724_dmae1_resources[] = {
 	},
 	{
 		/* DMA error IRQ */
+		.name	= SH_DMA_IRQ_ERROR,
 		.start	= 74,
 		.end	= 74,
 		.flags	= IORESOURCE_IRQ,
 	},
 	{
 		/* IRQ for channels 0-3 */
+		.name	= SH_DMA_IRQ_CHANNEL,
 		.start	= 40,
 		.end	= 43,
 		.flags	= IORESOURCE_IRQ,
 	},
 	{
 		/* IRQ for channels 4-5 */
+		.name	= SH_DMA_IRQ_CHANNEL,
 		.start	= 72,
 		.end	= 73,
 		.flags	= IORESOURCE_IRQ,
arch/sh/kernel/cpu/sh4a/setup-sh7757.c +16 -0
index 0555929..cf2667a 100644
@@ -465,6 +465,7 @@ static struct resource sh7757_dmae0_resources[] = {
 		.flags	= IORESOURCE_MEM,
 	},
 	{
+		.name	= SH_DMA_IRQ_ERROR,
 		.start	= 34,
 		.end	= 34,
 		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
@@ -487,54 +488,63 @@ static struct resource sh7757_dmae1_resources[] = {
 	},
 	{
 		/* DMA error */
+		.name	= SH_DMA_IRQ_ERROR,
 		.start	= 34,
 		.end	= 34,
 		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
 	},
 	{
 		/* IRQ for channels 4 */
+		.name	= SH_DMA_IRQ_CHANNEL,
 		.start	= 46,
 		.end	= 46,
 		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
 	},
 	{
 		/* IRQ for channels 5 */
+		.name	= SH_DMA_IRQ_CHANNEL,
 		.start	= 46,
 		.end	= 46,
 		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
 	},
 	{
 		/* IRQ for channels 6 */
+		.name	= SH_DMA_IRQ_CHANNEL,
 		.start	= 88,
 		.end	= 88,
 		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
 	},
 	{
 		/* IRQ for channels 7 */
+		.name	= SH_DMA_IRQ_CHANNEL,
 		.start	= 88,
 		.end	= 88,
 		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
 	},
 	{
 		/* IRQ for channels 8 */
+		.name	= SH_DMA_IRQ_CHANNEL,
 		.start	= 88,
 		.end	= 88,
 		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
 	},
 	{
 		/* IRQ for channels 9 */
+		.name	= SH_DMA_IRQ_CHANNEL,
 		.start	= 88,
 		.end	= 88,
 		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
 	},
 	{
 		/* IRQ for channels 10 */
+		.name	= SH_DMA_IRQ_CHANNEL,
 		.start	= 88,
 		.end	= 88,
 		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
 	},
 	{
 		/* IRQ for channels 11 */
+		.name	= SH_DMA_IRQ_CHANNEL,
 		.start	= 88,
 		.end	= 88,
 		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
@@ -557,18 +567,21 @@ static struct resource sh7757_dmae2_resources[] = {
 	},
 	{
 		/* DMA error */
+		.name	= SH_DMA_IRQ_ERROR,
 		.start	= 323,
 		.end	= 323,
 		.flags	= IORESOURCE_IRQ,
 	},
 	{
 		/* IRQ for channels 12 to 16 */
+		.name	= SH_DMA_IRQ_CHANNEL,
 		.start	= 272,
 		.end	= 276,
 		.flags	= IORESOURCE_IRQ,
 	},
 	{
 		/* IRQ for channel 17 */
+		.name	= SH_DMA_IRQ_CHANNEL,
 		.start	= 279,
 		.end	= 279,
 		.flags	= IORESOURCE_IRQ,
@@ -591,18 +604,21 @@ static struct resource sh7757_dmae3_resources[] = {
 	},
 	{
 		/* DMA error */
+		.name	= SH_DMA_IRQ_ERROR,
 		.start	= 324,
 		.end	= 324,
 		.flags	= IORESOURCE_IRQ,
 	},
 	{
 		/* IRQ for channels 18 to 22 */
+		.name	= SH_DMA_IRQ_CHANNEL,
 		.start	= 280,
 		.end	= 284,
 		.flags	= IORESOURCE_IRQ,
 	},
 	{
 		/* IRQ for channel 23 */
+		.name	= SH_DMA_IRQ_CHANNEL,
 		.start	= 288,
 		.end	= 288,
 		.flags	= IORESOURCE_IRQ,
arch/sh/kernel/cpu/sh4a/setup-sh7780.c +2 -0
index 3d4d207..cd8d1e9 100644
@@ -322,6 +322,7 @@ static struct resource sh7780_dmae0_resources[] = {
 	},
 	{
 		/* Real DMA error IRQ is 38, and channel IRQs are 34-37, 44-45 */
+		.name	= SH_DMA_IRQ_ERROR,
 		.start	= 34,
 		.end	= 34,
 		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
@@ -338,6 +339,7 @@ static struct resource sh7780_dmae1_resources[] = {
 	/* DMAC1 has no DMARS */
 	{
 		/* Real DMA error IRQ is 38, and channel IRQs are 46-47, 92-95 */
+		.name	= SH_DMA_IRQ_ERROR,
 		.start	= 46,
 		.end	= 46,
 		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
arch/sh/kernel/cpu/sh4a/setup-sh7785.c +2 -0
index b29e634..1cdb9ec 100644
@@ -376,6 +376,7 @@ static struct resource sh7785_dmae0_resources[] = {
 	},
 	{
 		/* Real DMA error IRQ is 39, and channel IRQs are 33-38 */
+		.name	= SH_DMA_IRQ_ERROR,
 		.start	= 33,
 		.end	= 33,
 		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
@@ -392,6 +393,7 @@ static struct resource sh7785_dmae1_resources[] = {
 	/* DMAC1 has no DMARS */
 	{
 		/* Real DMA error IRQ is 58, and channel IRQs are 52-57 */
+		.name	= SH_DMA_IRQ_ERROR,
 		.start	= 52,
 		.end	= 52,
 		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
arch/sh/kernel/cpu/sh4a/setup-sh7786.c +2 -0
index dd5e709..6025d26 100644
@@ -519,11 +519,13 @@ static struct resource dmac0_resources[] = {
 		.flags	= IORESOURCE_MEM,
 	}, {
 		/* DMA error IRQ */
+		.name	= SH_DMA_IRQ_ERROR,
 		.start	= evt2irq(0x5c0),
 		.end	= evt2irq(0x5c0),
 		.flags	= IORESOURCE_IRQ,
 	}, {
 		/* IRQ for channels 0-5 */
+		.name	= SH_DMA_IRQ_CHANNEL,
 		.start	= evt2irq(0x500),
 		.end	= evt2irq(0x5a0),
 		.flags	= IORESOURCE_IRQ,
Signature · 1 line
1.7.1
#1 lore raw

Unrelated to your patch, just something that caught my eye:

Quoted 12 lines · Yoshihiro

---
about v4:
- use defination macros for IRQ resource

 arch/sh/kernel/cpu/sh4a/setup-sh7722.c |    3 +++
 arch/sh/kernel/cpu/sh4a/setup-sh7724.c |    6 ++++++
 arch/sh/kernel/cpu/sh4a/setup-sh7757.c |   16 ++++++++++++++++
 arch/sh/kernel/cpu/sh4a/setup-sh7780.c |    2 ++
 arch/sh/kernel/cpu/sh4a/setup-sh7785.c |    2 ++
 arch/sh/kernel/cpu/sh4a/setup-sh7786.c |    2 ++
 6 files changed, 31 insertions(+), 0 deletions(-)

[snip]

Quoted 33 lines
arch/sh/kernel/cpu/sh4a/setup-sh7780.c +2 -0
index 3d4d207..cd8d1e9 100644
@@ -322,6 +322,7 @@ static struct resource sh7780_dmae0_resources[] = {
 	},
 	{
 		/* Real DMA error IRQ is 38, and channel IRQs are 34-37, 44-45 */
+		.name	= SH_DMA_IRQ_ERROR,
 		.start	= 34,
 		.end	= 34,
 		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
@@ -338,6 +339,7 @@ static struct resource sh7780_dmae1_resources[] = {
 	/* DMAC1 has no DMARS */
 	{
 		/* Real DMA error IRQ is 38, and channel IRQs are 46-47, 92-95 */
+		.name	= SH_DMA_IRQ_ERROR,
 		.start	= 46,
 		.end	= 46,
 		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,
arch/sh/kernel/cpu/sh4a/setup-sh7785.c +1 -0
index b29e634..1cdb9ec 100644
@@ -376,6 +376,7 @@ static struct resource sh7785_dmae0_resources[] = {
 	},
 	{
 		/* Real DMA error IRQ is 39, and channel IRQs are 33-38 */
+		.name	= SH_DMA_IRQ_ERROR,
 		.start	= 33,
 		.end	= 33,
 		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,

arch/sh/kernel/cpu/sh4a/setup-sh7785.c static struct resource sh7785_dmae1_resources[] = { · line 399

Quoted 7 lines
arch/sh/kernel/cpu/sh4a/setup-sh7785.c +1 -0
@@ -392,6 +393,7 @@ static struct resource sh7785_dmae1_resources[] = {
 	/* DMAC1 has no DMARS */
 	{
 		/* Real DMA error IRQ is 58, and channel IRQs are 52-57 */
+		.name	= SH_DMA_IRQ_ERROR,
 		.start	= 52,
 		.end	= 52,
 		.flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_SHAREABLE,

The above two platforms seem incorrect. Back then, as I switched sh_dma.c to use resources for interrupts [1], I just reproduced the behaviour of the original driver, but a verification with the header or the datasheet shows, that sh7780 and sh7785 have separate interrupts per channel, so, if anyone cares about those platforms, they might need a fix.

Thanks
Guennadi

[1] http://thread.gmane.org/gmane.linux.ports.sh.devel/7269/focusr70
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#2 lore raw
In reply to Shimoda, Yoshihiro
Quoted 2 lines · Guennadi Liakhovetski

Unrelated to your patch, just something that caught my eye:

[ snip ]

Quoted 6 lines

The above two platforms seem incorrect. Back then, as I switched sh_dma.c to use resources for interrupts [1], I just reproduced the behaviour of the original driver, but a verification with the header or the datasheet shows, that sh7780 and sh7785 have separate interrupts per channel, so, if anyone cares about those platforms, they might need a fix.

The interrupts of SH7780 DMAC and Sh7785 DMAC are strange.
Would you check the commit bdaa6e8062 "sh: multiple vectors per irq - base"?

- The SH7780 and SH7785 have separate INTEVT per channel, but the INT2MSKR for the DMAC has one bit.
-- In this case, the commit log says:
"If multiple vectors shar the same enum then only the
first vector will be avilable as a linux irq."

- I think that the DMTE4_IRQ of SH7780 and SH7785 in
the "arch/sh/include/cpu-sh4/cpu/dma-sh4a.h" is breaking.
But, the old DMA API driver doesn't use this actually because the get_dmte_irq() in dma-sh.c will change the IRQ number...

Best regards,
Yoshihiro Shimoda

Quoted 9 lines

Thanks
Guennadi

[1] http://thread.gmane.org/gmane.linux.ports.sh.devel/7269/focusr70
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

Signature · 2 lines
Yoshihiro Shimoda <[email protected]>
EC No.