Skip to contentSkip to conversation

ARM: s3c24xx: add dma_coherent_mask for DMA devices

PATCH New Vasily Khoruzhick 2 participants 12 messages May 3, 2015 – May 5, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 ARM: s3c24xx: add dma_coherent_mask for DMA devices

Otherwise dma_alloc_coherent() fails.

---
 arch/arm/mach-s3c24xx/common.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-s3c24xx/common.c +2 -0
index bf50328..7ed0853 100644
@@ -355,6 +355,7 @@ struct platform_device s3c2410_device_dma = {
 	.resource	= s3c2410_dma_resource,
 	.dev	= {
 		.platform_data	= &s3c2410_dma_platdata,
+		.coherent_dma_mask = ~0,
 	},
 };
 #endif
@@ -452,6 +453,7 @@ struct platform_device s3c2440_device_dma = {
 	.resource	= s3c2410_dma_resource,
 	.dev	= {
 		.platform_data	= &s3c2440_dma_platdata,
+		.coherent_dma_mask = ~0,
 	},
 };
 #endif
Signature · 1 line
2.3.5
#1 lore raw

PATCH 2/3 ARM: s3c24xx: Add DMA resources for SDI and I2S

---
 arch/arm/plat-samsung/devs.c | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/plat-samsung/devs.c +3 -0
index 83c7d15..62edcab 100644
@@ -564,6 +564,8 @@ void __init s3c_i2c7_set_platdata(struct s3c2410_platform_i2c *pd)
 #ifdef CONFIG_PLAT_S3C24XX
 static struct resource s3c_iis_resource[] = {
 	[0] = DEFINE_RES_MEM(S3C24XX_PA_IIS, S3C24XX_SZ_IIS),
+	[1] = DEFINE_RES_DMA(DMACH_I2S_OUT),
+	[2] = DEFINE_RES_DMA(DMACH_I2S_IN),
 };
 
 struct platform_device s3c_device_iis = {
@@ -863,6 +865,7 @@ struct platform_device s3c_device_rtc = {
 static struct resource s3c_sdi_resource[] = {
 	[0] = DEFINE_RES_MEM(S3C24XX_PA_SDI, S3C24XX_SZ_SDI),
 	[1] = DEFINE_RES_IRQ(IRQ_SDI),
+	[2] = DEFINE_RES_DMA(DMACH_SDI),
 };
 
 struct platform_device s3c_device_sdi = {
Signature · 1 line
2.3.5
#3 lore raw

PATCH 2/3 ARM: s3c24xx: Add DMA resources for SDI and I2S

Quoted 5 lines · Krzysztof Kozlowski

2015-05-04 3:15 GMT+09:00 Vasily Khoruzhick <[email protected]>:

Quoted 1 line

"Add DMA resources for SDI and I2S".,.. what for? why? The commit message would be appropriate place to put such details.

Because SDI and I2S drivers need these resources to setup DMA channel properly. Would you like me to resend the patch with this explanation?

Quoted 6 lines

The patch itself looks good.

Best regards,
Krzysztof

#4 lore raw

PATCH 2/3 ARM: s3c24xx: Add DMA resources for SDI and I2S

2015-05-05 3:10 GMT+09:00 Vasily Khoruzhick <[email protected]>:

Quoted 10 lines
Quoted 5 lines · Krzysztof Kozlowski

2015-05-04 3:15 GMT+09:00 Vasily Khoruzhick <[email protected]>:

Quoted 1 line

"Add DMA resources for SDI and I2S".,.. what for? why? The commit message would be appropriate place to put such details.

Because SDI and I2S drivers need these resources to setup DMA channel properly. Would you like me to resend the patch with this explanation?

Yes, please resend. The new explanation above is sufficient.

Best regards,
Krzysztof

#5 lore raw

PATCH 3/3 ARM: s3c24xx: H1940: Move gpiochip_add call into core_init() callback

In reply to Vasily Khoruzhick

gpiochip_add() allocates memory, however it's not possible anymore from machine map_io() callback thus it failed and prevented machine from booting properly.

---
 arch/arm/mach-s3c24xx/mach-h1940.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/mach-s3c24xx/mach-h1940.c +6 -1
index 86d9ec7..744aa4f 100644
@@ -777,9 +777,14 @@ static void __init h1940_map_io(void)
 
 	/* Add latch gpio chip, set latch initial value */
 	h1940_latch_control(0, 0);
-	WARN_ON(gpiochip_add(&h1940_latch_gpiochip));
 }
 
+static __init int h1940_gpiolib_init(void)
+{
+	return gpiochip_add(&h1940_latch_gpiochip);
+}
+core_initcall(h1940_gpiolib_init);
+
 static void __init h1940_init_time(void)
 {
 	s3c2410_init_clocks(12000000);
Signature · 1 line
2.3.5
#6 lore raw

PATCH 3/3 ARM: s3c24xx: H1940: Move gpiochip_add call into core_init() callback

2015-05-04 3:15 GMT+09:00 Vasily Khoruzhick <[email protected]>:

Quoted 1 line

gpiochip_add() allocates memory, however it's not possible anymore

"...to call it..."? Something is missing in the sentence.

Quoted 16 lines

from
machine map_io() callback thus it failed and prevented machine from booting properly.

---
 arch/arm/mach-s3c24xx/mach-h1940.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/mach-s3c24xx/mach-h1940.c +0 -0
index 86d9ec7..744aa4f 100644
@@ -777,9 +777,14 @@ static void __init h1940_map_io(void)
 
        /* Add latch gpio chip, set latch initial value */

arch/arm/mach-s3c24xx/mach-h1940.c static void __init h1940_map_io(void) · line 787

Quoted 10 lines
arch/arm/mach-s3c24xx/mach-h1940.c +6 -1
        h1940_latch_control(0, 0);
-       WARN_ON(gpiochip_add(&h1940_latch_gpiochip));
 }
 
+static __init int h1940_gpiolib_init(void)
+{
+       return gpiochip_add(&h1940_latch_gpiochip);
+}
+core_initcall(h1940_gpiolib_init);
+

arch_initcall() or init_machine() callback seems more appropriate. What do you think?

Best regards,
Krzysztof

#7 lore raw

PATCH 3/3 ARM: s3c24xx: H1940: Move gpiochip_add call into core_init() callback

Quoted 4 lines · Krzysztof Kozlowski

2015-05-04 3:15 GMT+09:00 Vasily Khoruzhick <[email protected]>:

Quoted 1 line

gpiochip_add() allocates memory, however it's not possible anymore

"...to call it..."? Something is missing in the sentence.

"it" replaces "memory allocation" here (kzalloc fails)

Quoted 20 lines
Quoted 20 lines

from
machine map_io() callback thus it failed and prevented machine from booting properly.

---
 arch/arm/mach-s3c24xx/mach-h1940.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/mach-s3c24xx/mach-h1940.c +0 -1
index 86d9ec7..744aa4f 100644
@@ -777,9 +777,14 @@ static void __init h1940_map_io(void)
 
        /* Add latch gpio chip, set latch initial value */
        h1940_latch_control(0, 0);
-       WARN_ON(gpiochip_add(&h1940_latch_gpiochip));
 }
 
Quoted 9 lines

arch/arm/mach-s3c24xx/mach-h1940.c static void __init h1940_map_io(void) · line 787

Quoted 6 lines
arch/arm/mach-s3c24xx/mach-h1940.c +6 -0
+static __init int h1940_gpiolib_init(void)
+{
+       return gpiochip_add(&h1940_latch_gpiochip);
+}
+core_initcall(h1940_gpiolib_init);
+

arch_initcall() or init_machine() callback seems more appropriate. What do you think?

I did the same way as Kukjin Kim did in samsung gpio driver.

Quoted 2 lines

Best regards,
Krzysztof

#8 lore raw

PATCH 3/3 ARM: s3c24xx: H1940: Move gpiochip_add call into core_init() callback

2015-05-05 3:27 GMT+09:00 Vasily Khoruzhick <[email protected]>:

Quoted 39 lines
Quoted 4 lines · Krzysztof Kozlowski

2015-05-04 3:15 GMT+09:00 Vasily Khoruzhick <[email protected]>:

Quoted 1 line

gpiochip_add() allocates memory, however it's not possible anymore

"...to call it..."? Something is missing in the sentence.

"it" replaces "memory allocation" here (kzalloc fails)

Quoted 20 lines
Quoted 20 lines

from
machine map_io() callback thus it failed and prevented machine from booting properly.

---
 arch/arm/mach-s3c24xx/mach-h1940.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/mach-s3c24xx/mach-h1940.c +0 -1
index 86d9ec7..744aa4f 100644
@@ -777,9 +777,14 @@ static void __init h1940_map_io(void)
 
        /* Add latch gpio chip, set latch initial value */
        h1940_latch_control(0, 0);
-       WARN_ON(gpiochip_add(&h1940_latch_gpiochip));
 }
 
Quoted 9 lines

arch/arm/mach-s3c24xx/mach-h1940.c static void __init h1940_map_io(void) · line 787

Quoted 6 lines
arch/arm/mach-s3c24xx/mach-h1940.c +6 -0
+static __init int h1940_gpiolib_init(void)
+{
+       return gpiochip_add(&h1940_latch_gpiochip);
+}
+core_initcall(h1940_gpiolib_init);
+

arch_initcall() or init_machine() callback seems more appropriate. What do you think?

Quoted 1 line

I did the same way as Kukjin Kim did in samsung gpio driver.

But that was almost years ago and actually this is not a core code but arch code. Anyway I think this shouldn't matter so I have no strong preference.

Best regards,
Krzysztof

#9 lore raw

PATCH 1/3 ARM: s3c24xx: add dma_coherent_mask for DMA devices

In reply to Vasily Khoruzhick

2015-05-04 3:15 GMT+09:00 Vasily Khoruzhick <[email protected]>:

Quoted 1 line

Otherwise dma_alloc_coherent() fails.

Could you say few more words about the failure?
Also the patch looks like a candidate for CC-stable along with Fixes tag.

Quoted 11 lines
---
 arch/arm/mach-s3c24xx/common.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-s3c24xx/common.c +0 -0
index bf50328..7ed0853 100644

arch/arm/mach-s3c24xx/common.c struct platform_device s3c2410_device_dma = { · line 358

Quoted 4 lines
arch/arm/mach-s3c24xx/common.c +1 -0
@@ -355,6 +355,7 @@ struct platform_device s3c2410_device_dma = {
        .resource       = s3c2410_dma_resource,
        .dev    = {
                .platform_data  = &s3c2410_dma_platdata,
+               .coherent_dma_mask = ~0,

DMA_BIT_MASK(32)?

arch/arm/mach-s3c24xx/common.c struct platform_device s3c2440_device_dma = { · line 456

Quoted 8 lines
arch/arm/mach-s3c24xx/common.c +1 -0
        },
 };
 #endif
@@ -452,6 +453,7 @@ struct platform_device s3c2440_device_dma = {
        .resource       = s3c2410_dma_resource,
        .dev    = {
                .platform_data  = &s3c2440_dma_platdata,
+               .coherent_dma_mask = ~0,

Ditto.

Best regards,
Krzysztof

#10 lore raw

PATCH 1/3 ARM: s3c24xx: add dma_coherent_mask for DMA devices

Quoted 5 lines · Krzysztof Kozlowski

2015-05-04 3:15 GMT+09:00 Vasily Khoruzhick <[email protected]>:

Quoted 1 line

Otherwise dma_alloc_coherent() fails.

Could you say few more words about the failure?
Also the patch looks like a candidate for CC-stable along with Fixes tag.

Hm, any call of dma_alloc_coherent() will fail for s3c24xx-dmac device. For example, asoc dmaengine driver. What exactly do you want me to precise?

Quoted 31 lines
Quoted 11 lines
---
 arch/arm/mach-s3c24xx/common.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-s3c24xx/common.c +0 -0
index bf50328..7ed0853 100644

arch/arm/mach-s3c24xx/common.c struct platform_device s3c2410_device_dma = { · line 358

Quoted 4 lines
arch/arm/mach-s3c24xx/common.c +1 -0
@@ -355,6 +355,7 @@ struct platform_device s3c2410_device_dma = {
        .resource       = s3c2410_dma_resource,
        .dev    = {
                .platform_data  = &s3c2410_dma_platdata,
+               .coherent_dma_mask = ~0,

DMA_BIT_MASK(32)?

arch/arm/mach-s3c24xx/common.c struct platform_device s3c2440_device_dma = { · line 456

Quoted 8 lines
arch/arm/mach-s3c24xx/common.c +1 -0
        },
 };
 #endif
@@ -452,6 +453,7 @@ struct platform_device s3c2440_device_dma = {
        .resource       = s3c2410_dma_resource,
        .dev    = {
                .platform_data  = &s3c2440_dma_platdata,
+               .coherent_dma_mask = ~0,

Ditto.

Best regards,
Krzysztof

#11 lore raw

PATCH 1/3 ARM: s3c24xx: add dma_coherent_mask for DMA devices

2015-05-05 2:54 GMT+09:00 Vasily Khoruzhick <[email protected]>:

Quoted 11 lines
Quoted 5 lines · Krzysztof Kozlowski

2015-05-04 3:15 GMT+09:00 Vasily Khoruzhick <[email protected]>:

Quoted 1 line

Otherwise dma_alloc_coherent() fails.

Could you say few more words about the failure?
Also the patch looks like a candidate for CC-stable along with Fixes tag.

Hm, any call of dma_alloc_coherent() will fail for s3c24xx-dmac device. For example, asoc dmaengine driver. What exactly do you want me to precise?

Anything more than just "fails" would be welcome. Especially for backporting to stable.

Best regards,
Krzysztof