Skip to contentSkip to conversation

powerpc: Add proper reference to dma_mask

PATCH Vitaly Bordug 3 participants 4 messages Jul 7, 2008 – Jul 8, 2008 PowerPC

lore
Share & tools
lore
#0 lore raw

There is dma_mask in of_device that is being filled upon of_platform_device_create() but we don't properly set the struct device in there to point back to it. coherent_dma_mask wasn't set up either - these caused weird lock-ups and behavior of USB subsystem using of_device USB host drivers.

---

 arch/powerpc/kernel/of_platform.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
arch/powerpc/kernel/of_platform.c +3 -0
index e79ad8a..2bf4c04 100644
@@ -76,6 +76,9 @@ struct of_device* of_platform_device_create(struct device_node *np,
 		return NULL;
 
 	dev->dma_mask = 0xffffffffUL;
+	dev->dev.dma_mask = &dev->dma_mask;
+	dev->dev.coherent_dma_mask = DMA_32BIT_MASK;
+
 	dev->dev.bus = &of_platform_bus_type;
 
 	/* We do not fill the DMA ops for platform devices by default.
#1 lore raw

Hi Vitaly,

arch/powerpc/kernel/of_platform.c struct of_device* of_platform_device_create(struct device_node *np, · line 79

Quoted 7 lines · On Tue, 8 Jul 2008 03:12:56 +0400 Vitaly Bordug <[email protected]>…

+++ b/arch/powerpc/kernel/of_platform.c

arch/powerpc/kernel/of_platform.c +1 -0
@@ -76,6 +76,9 @@ struct of_device* of_platform_device_create(struct device_node *np,
 		return NULL;
 
 	dev->dma_mask = 0xffffffffUL;
+	dev->dev.dma_mask = &dev->dma_mask;

That is done in of_device_alloc which is called just above.

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
#2 lore raw
Quoted 4 lines · Stephen Rothwell

Hi Vitaly,

Quoted 1 line · On Tue, 8 Jul 2008 03:12:56 +0400 Vitaly Bordug <[email protected]>…
Quoted 8 lines

arch/powerpc/kernel/of_platform.c struct of_device* of_platform_device_create(struct device_node *np, · line 79

Quoted 6 lines

+++ b/arch/powerpc/kernel/of_platform.c

arch/powerpc/kernel/of_platform.c +1 -0
@@ -76,6 +76,9 @@ struct of_device* of_platform_device_create(struct device_node *np,
 		return NULL;
 
 	dev->dma_mask = 0xffffffffUL;
+	dev->dev.dma_mask = &dev->dma_mask;

That is done in of_device_alloc which is called just above.

So the problem might just be that coherent_dma_mask isn't set.

Ben.

#3 lore raw

=D0=92 Tue, 08 Jul 2008 14:28:11 +1000
Benjamin Herrenschmidt <[email protected]> =D0=BF=D0=B8=D1=88=D0=B5= =D1=82:

Quoted 14 lines · Stephen Rothwell
Quoted 5 lines

Hi Vitaly,
=20

Quoted 1 line · On Tue, 8 Jul 2008 03:12:56 +0400 Vitaly Bordug <[email protected]>…
Quoted 8 lines

Review

Quoted 6 lines

+++ b/arch/powerpc/kernel/of_platform.c

(quoted diff) +0 -0
@@ -76,6 +76,9 @@ struct of_device*
 of_platform_device_create(struct device_node *np, return NULL;

=20

(quoted diff) +1 -0
 	dev->dma_mask =3D 0xffffffffUL;
+	dev->dev.dma_mask =3D &dev->dma_mask;

=20
That is done in of_device_alloc which is called just above.

Quoted 3 lines

=20
So the problem might just be that coherent_dma_mask isn't set. =20

I'll check and resubmit, thanks

-Vitaly