[PATCH] powerpc: Add DMA mask to MPSC serial and network and UART device to serial

STALE6029d

5 messages, 2 authors, 2010-02-02 · open the first message on its own page

[PATCH] powerpc: Add DMA mask to MPSC serial and network and UART device to serial

From: Corey Minyard <hidden>
Date: 2010-01-30 01:04:36

From: Corey Minyard <redacted>

The MPSC drivers that use DMA need to set coherent_dma_mask to allow
dma_alloc_xxx routines to work properly.  Also, the mpsc serial driver
needed to set pi->port.dev to register properly.  With these fixes,
the MPSC drivers seem to work again.

Signed-off-by: Corey Minyard <redacted>
---
I'm not really sure about where to set the coherent_dma_mask, it seems
like a more general place would be better but I couldn't find it.

Without these, the console stops working after the switchover and
the network driver fails to allocate buffers.  With these, my board
boots up and works fine.

Index: linux-2.6.31/drivers/serial/mpsc.c
===================================================================
--- linux-2.6.31.orig/drivers/serial/mpsc.c
+++ linux-2.6.31/drivers/serial/mpsc.c
@@ -2071,6 +2071,9 @@ static int mpsc_drv_probe(struct platfor
 		if (!(rc = mpsc_drv_map_regs(pi, dev))) {
 			mpsc_drv_get_platform_data(pi, dev, dev->id);
 
+			dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
+			pi->port.dev = &dev->dev;
+
 			if (!(rc = mpsc_make_ready(pi))) {
 				spin_lock_init(&pi->tx_lock);
 				if (!(rc = uart_add_one_port(&mpsc_reg,
Index: linux-2.6.31/drivers/net/mv643xx_eth.c
===================================================================
--- linux-2.6.31.orig/drivers/net/mv643xx_eth.c
+++ linux-2.6.31/drivers/net/mv643xx_eth.c
@@ -2916,7 +2916,7 @@ static int mv643xx_eth_probe(struct plat
 	mp->shared = platform_get_drvdata(pd->shared);
 	mp->base = mp->shared->base + 0x0400 + (pd->port_number << 10);
 	mp->port_num = pd->port_number;
-
+	pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
 	mp->dev = dev;
 
 	set_params(mp, pd);

Re: [PATCH] powerpc: Add DMA mask to MPSC serial and network and UART device to serial

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2010-02-01 04:58:54

On Fri, 2010-01-29 at 18:04 -0600, Corey Minyard wrote:
From: Corey Minyard <redacted>

The MPSC drivers that use DMA need to set coherent_dma_mask to allow
dma_alloc_xxx routines to work properly.  Also, the mpsc serial driver
needed to set pi->port.dev to register properly.  With these fixes,
the MPSC drivers seem to work again.

Signed-off-by: Corey Minyard <redacted>
---
Is that enough ? Since 2.6.31 we also need the dma ops to be filled
properly and obviously that isn't going to happen for random platform
devices... Or are those initialized elsewhere by your platform code ? In
which case it might be a good place to also set the coherent mask...

Maybe we should have a more generic way to set the "default" dma
information (including ops, masks etc...) for use by platform,
of_platform etc... devices.

Cheers,
Ben.
quoted hunk
I'm not really sure about where to set the coherent_dma_mask, it seems
like a more general place would be better but I couldn't find it.

Without these, the console stops working after the switchover and
the network driver fails to allocate buffers.  With these, my board
boots up and works fine.

Index: linux-2.6.31/drivers/serial/mpsc.c
===================================================================
--- linux-2.6.31.orig/drivers/serial/mpsc.c
+++ linux-2.6.31/drivers/serial/mpsc.c
@@ -2071,6 +2071,9 @@ static int mpsc_drv_probe(struct platfor
 		if (!(rc = mpsc_drv_map_regs(pi, dev))) {
 			mpsc_drv_get_platform_data(pi, dev, dev->id);
 
+			dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
+			pi->port.dev = &dev->dev;
+
 			if (!(rc = mpsc_make_ready(pi))) {
 				spin_lock_init(&pi->tx_lock);
 				if (!(rc = uart_add_one_port(&mpsc_reg,
Index: linux-2.6.31/drivers/net/mv643xx_eth.c
===================================================================
--- linux-2.6.31.orig/drivers/net/mv643xx_eth.c
+++ linux-2.6.31/drivers/net/mv643xx_eth.c
@@ -2916,7 +2916,7 @@ static int mv643xx_eth_probe(struct plat
 	mp->shared = platform_get_drvdata(pd->shared);
 	mp->base = mp->shared->base + 0x0400 + (pd->port_number << 10);
 	mp->port_num = pd->port_number;
-
+	pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
 	mp->dev = dev;
 
 	set_params(mp, pd);
_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH] powerpc: Add DMA mask to MPSC serial and network and UART device to serial

From: Corey Minyard <hidden>
Date: 2010-02-01 18:01:24

Benjamin Herrenschmidt wrote:
On Fri, 2010-01-29 at 18:04 -0600, Corey Minyard wrote:
  
quoted
From: Corey Minyard <redacted>

The MPSC drivers that use DMA need to set coherent_dma_mask to allow
dma_alloc_xxx routines to work properly.  Also, the mpsc serial driver
needed to set pi->port.dev to register properly.  With these fixes,
the MPSC drivers seem to work again.

Signed-off-by: Corey Minyard <redacted>
---
    
Is that enough ? Since 2.6.31 we also need the dma ops to be filled
properly and obviously that isn't going to happen for random platform
devices... Or are those initialized elsewhere by your platform code ? In
which case it might be a good place to also set the coherent mask...	
  
That's done in ppc_dflt_bus_notify(), but that didn't seem an appropriate
place to do this.  If it is, it's easy enough to add it there, but that 
would
mean it would get set for all devices on any type of ppc system.

-corey
Maybe we should have a more generic way to set the "default" dma
information (including ops, masks etc...) for use by platform,
of_platform etc... devices.

Cheers,
Ben.

  
quoted
I'm not really sure about where to set the coherent_dma_mask, it seems
like a more general place would be better but I couldn't find it.

Without these, the console stops working after the switchover andantipode
the network driver fails to allocate buffers.  With these, my board
boots up and works fine.

Index: linux-2.6.31/drivers/serial/mpsc.c
===================================================================
--- linux-2.6.31.orig/drivers/serial/mpsc.c
+++ linux-2.6.31/drivers/serial/mpsc.c
@@ -2071,6 +2071,9 @@ static int mpsc_drv_probe(struct platfor
 		if (!(rc = mpsc_drv_map_regs(pi, dev))) {
 			mpsc_drv_get_platform_data(pi, dev, dev->id);
 
+			dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
+			pi->port.dev = &dev->dev;
+
 			if (!(rc = mpsc_make_ready(pi))) {
 				spin_lock_init(&pi->tx_lock);
 				if (!(rc = uart_add_one_port(&mpsc_reg,
Index: linux-2.6.31/drivers/net/mv643xx_eth.c
===================================================================
--- linux-2.6.31.orig/drivers/net/mv643xx_eth.c
+++ linux-2.6.31/drivers/net/mv643xx_eth.c
@@ -2916,7 +2916,7 @@ static int mv643xx_eth_probe(struct plat
 	mp->shared = platform_get_drvdata(pd->shared);
 	mp->base = mp->shared->base + 0x0400 + (pd->port_number << 10);
 	mp->port_num = pd->port_number;
-
+	pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
 	mp->dev = dev;
 
 	set_params(mp, pd);
_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev
    

  

[PATCH] powerpc: Add coherent_dma_mask setting to platform devices

From: Corey Minyard <hidden>
Date: 2010-02-01 20:37:38

From: Corey Minyard <redacted>

DMA ops requires that coherent_dma_mask be set properly for a device,
but this was not being done for platform devices on powerpc.  The
MPSC drivers, in particular, need this for both serial and ethernet
or they won't be able to allocate memory.

Signed-off-by: Corey Minyard <redacted>
---
How about this patch?  It seems to work ok and I suppose this makes
sense.  I'll send the uart setting in another patch.

Index: linux-2.6/arch/powerpc/kernel/setup-common.c
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/setup-common.c
+++ linux-2.6/arch/powerpc/kernel/setup-common.c
@@ -681,6 +681,7 @@ static int ppc_dflt_bus_notify(struct no
 		return 0;
 
 	set_dma_ops(dev, &dma_direct_ops);
+	pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
 
 	return NOTIFY_DONE;
 }

Re: [PATCH] powerpc: Add DMA mask to MPSC serial and network and UART device to serial

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2010-02-02 07:38:36

On Mon, 2010-02-01 at 12:00 -0600, Corey Minyard wrote:
That's done in ppc_dflt_bus_notify(), but that didn't seem an
appropriate
place to do this.  If it is, it's easy enough to add it there, but
that would mean it would get set for all devices on any type of ppc
system.
Well, we are looking at setting up a sane default here. It can always be
overriden if necessary.

Cheers,
Ben.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help