diff mbox

[11/13] powerpc/5200: LocalPlus driver: move RAM DMA address from request to driver

Message ID 200912220810.20622.roman.fietze@telemotive.de (mailing list archive)
State Changes Requested
Delegated to: Grant Likely
Headers show

Commit Message

Roman Fietze Dec. 22, 2009, 7:10 a.m. UTC
Signed-off-by: Roman Fietze <roman.fietze@telemotive.de>
---
 arch/powerpc/include/asm/mpc52xx.h            |    1 -
 arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c |   13 +++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

Comments

Grant Likely Jan. 11, 2010, 8:20 p.m. UTC | #1
On Tue, Dec 22, 2009 at 12:10 AM, Roman Fietze
<roman.fietze@telemotive.de> wrote:
>
> Signed-off-by: Roman Fietze <roman.fietze@telemotive.de>

Please merge this change with the patch that adds the dma mapping

g.

> ---
>  arch/powerpc/include/asm/mpc52xx.h            |    1 -
>  arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c |   13 +++++++------
>  2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/mpc52xx.h b/arch/powerpc/include/asm/mpc52xx.h
> index 043458e..91c65d0 100644
> --- a/arch/powerpc/include/asm/mpc52xx.h
> +++ b/arch/powerpc/include/asm/mpc52xx.h
> @@ -347,7 +347,6 @@ struct mpc52xx_lpbfifo_request {
>
>        /* Memory address */
>        void *data;
> -       dma_addr_t data_dma;
>
>        /* Details of transfer */
>        size_t size;
> diff --git a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
> index cd8dc69..b2c92f5 100644
> --- a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
> +++ b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
> @@ -41,6 +41,7 @@ struct mpc52xx_lpbfifo {
>
>        /* Current state data */
>        struct mpc52xx_lpbfifo_request *req;
> +       dma_addr_t data_dma;
>        unsigned short irqs_pending;
>        int dma_irqs_enabled;
>  };
> @@ -49,7 +50,7 @@ struct mpc52xx_lpbfifo {
>  static struct mpc52xx_lpbfifo lpbfifo;
>
>
> -/* The order of the raised interrupts of SCLPC and BCOM cann not be
> +/* The order of the raised interrupts of SCLPC and BCOM cannot be
>  * predicted, because it depends on the individual BCOM and CPU
>  * loads. So in DMA mode we just wait for both until we finish the
>  * transaction. */
> @@ -160,7 +161,7 @@ static void mpc52xx_lpbfifo_kick(struct mpc52xx_lpbfifo_request *req)
>                        out_be32(&lpbfifo.regs->fifo_alarm, MPC52xx_SCLPC_FIFO_SIZE - 28);
>                        out_be32(&lpbfifo.regs->fifo_control, MPC52xx_SLPC_FIFO_CONTROL_GR(7));
>                        lpbfifo.bcom_cur_task = lpbfifo.bcom_tx_task;
> -                       req->data_dma = dma_map_single(lpbfifo.dev, req->data, req->size, DMA_TO_DEVICE);
> +                       lpbfifo.data_dma = dma_map_single(lpbfifo.dev, req->data, req->size, DMA_TO_DEVICE);
>                } else {
>                        out_be32(&lpbfifo.regs->fifo_alarm, MPC52xx_SCLPC_FIFO_SIZE - 1);
>                        out_be32(&lpbfifo.regs->fifo_control, MPC52xx_SLPC_FIFO_CONTROL_GR(0));
> @@ -177,7 +178,7 @@ static void mpc52xx_lpbfifo_kick(struct mpc52xx_lpbfifo_request *req)
>                                        lpbfifo.dma_irqs_enabled = 1;
>                                }
>                        }
> -                       req->data_dma = dma_map_single(lpbfifo.dev, req->data, req->size, DMA_FROM_DEVICE);
> +                       lpbfifo.data_dma = dma_map_single(lpbfifo.dev, req->data, req->size, DMA_FROM_DEVICE);
>                }
>
>                /* error irq & master enabled bit */
> @@ -187,7 +188,7 @@ static void mpc52xx_lpbfifo_kick(struct mpc52xx_lpbfifo_request *req)
>
>                bd = bcom_prepare_next_buffer(lpbfifo.bcom_cur_task);
>                bd->status = tc;
> -               bd->data[0] = req->data_dma + req->pos;
> +               bd->data[0] = lpbfifo.data_dma + req->pos;
>                bcom_submit_next_buffer(lpbfifo.bcom_cur_task, NULL);
>        }
>
> @@ -378,9 +379,9 @@ static irqreturn_t mpc52xx_lpbfifo_bcom_irq(int irq, void *dev_id)
>
>                if (req) {
>                        if (mpc52xx_lpbfifo_is_write(lpbfifo->req->flags))
> -                               dma_unmap_single(lpbfifo->dev, lpbfifo->req->data_dma, lpbfifo->req->size, DMA_TO_DEVICE);
> +                               dma_unmap_single(lpbfifo->dev, lpbfifo->data_dma, lpbfifo->req->size, DMA_TO_DEVICE);
>                        else
> -                               dma_unmap_single(lpbfifo->dev, lpbfifo->req->data_dma, lpbfifo->req->size, DMA_FROM_DEVICE);
> +                               dma_unmap_single(lpbfifo->dev, lpbfifo->data_dma, lpbfifo->req->size, DMA_FROM_DEVICE);
>
>                        lpbfifo->req = NULL;
>                        out_be32(&lpbfifo->regs->enable, MPC52xx_SCLPC_ENABLE_RC | MPC52xx_SCLPC_ENABLE_RF);
> --
> 1.6.5.5
>
>
>
> --
> Roman Fietze                Telemotive AG Büro Mühlhausen
> Breitwiesen                              73347 Mühlhausen
> Tel.: +49(0)7335/18493-45        http://www.telemotive.de
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>
diff mbox

Patch

diff --git a/arch/powerpc/include/asm/mpc52xx.h b/arch/powerpc/include/asm/mpc52xx.h
index 043458e..91c65d0 100644
--- a/arch/powerpc/include/asm/mpc52xx.h
+++ b/arch/powerpc/include/asm/mpc52xx.h
@@ -347,7 +347,6 @@  struct mpc52xx_lpbfifo_request {
 
 	/* Memory address */
 	void *data;
-	dma_addr_t data_dma;
 
 	/* Details of transfer */
 	size_t size;
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
index cd8dc69..b2c92f5 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
@@ -41,6 +41,7 @@  struct mpc52xx_lpbfifo {
 
 	/* Current state data */
 	struct mpc52xx_lpbfifo_request *req;
+	dma_addr_t data_dma;
 	unsigned short irqs_pending;
 	int dma_irqs_enabled;
 };
@@ -49,7 +50,7 @@  struct mpc52xx_lpbfifo {
 static struct mpc52xx_lpbfifo lpbfifo;
 
 
-/* The order of the raised interrupts of SCLPC and BCOM cann not be
+/* The order of the raised interrupts of SCLPC and BCOM cannot be
  * predicted, because it depends on the individual BCOM and CPU
  * loads. So in DMA mode we just wait for both until we finish the
  * transaction. */
@@ -160,7 +161,7 @@  static void mpc52xx_lpbfifo_kick(struct mpc52xx_lpbfifo_request *req)
 			out_be32(&lpbfifo.regs->fifo_alarm, MPC52xx_SCLPC_FIFO_SIZE - 28);
 			out_be32(&lpbfifo.regs->fifo_control, MPC52xx_SLPC_FIFO_CONTROL_GR(7));
 			lpbfifo.bcom_cur_task = lpbfifo.bcom_tx_task;
-			req->data_dma = dma_map_single(lpbfifo.dev, req->data, req->size, DMA_TO_DEVICE);
+			lpbfifo.data_dma = dma_map_single(lpbfifo.dev, req->data, req->size, DMA_TO_DEVICE);
 		} else {
 			out_be32(&lpbfifo.regs->fifo_alarm, MPC52xx_SCLPC_FIFO_SIZE - 1);
 			out_be32(&lpbfifo.regs->fifo_control, MPC52xx_SLPC_FIFO_CONTROL_GR(0));
@@ -177,7 +178,7 @@  static void mpc52xx_lpbfifo_kick(struct mpc52xx_lpbfifo_request *req)
 					lpbfifo.dma_irqs_enabled = 1;
 				}
 			}
-			req->data_dma = dma_map_single(lpbfifo.dev, req->data, req->size, DMA_FROM_DEVICE);
+			lpbfifo.data_dma = dma_map_single(lpbfifo.dev, req->data, req->size, DMA_FROM_DEVICE);
 		}
 
 		/* error irq & master enabled bit */
@@ -187,7 +188,7 @@  static void mpc52xx_lpbfifo_kick(struct mpc52xx_lpbfifo_request *req)
 
 		bd = bcom_prepare_next_buffer(lpbfifo.bcom_cur_task);
 		bd->status = tc;
-		bd->data[0] = req->data_dma + req->pos;
+		bd->data[0] = lpbfifo.data_dma + req->pos;
 		bcom_submit_next_buffer(lpbfifo.bcom_cur_task, NULL);
 	}
 
@@ -378,9 +379,9 @@  static irqreturn_t mpc52xx_lpbfifo_bcom_irq(int irq, void *dev_id)
 
 		if (req) {
 			if (mpc52xx_lpbfifo_is_write(lpbfifo->req->flags))
-				dma_unmap_single(lpbfifo->dev, lpbfifo->req->data_dma, lpbfifo->req->size, DMA_TO_DEVICE);
+				dma_unmap_single(lpbfifo->dev, lpbfifo->data_dma, lpbfifo->req->size, DMA_TO_DEVICE);
 			else
-				dma_unmap_single(lpbfifo->dev, lpbfifo->req->data_dma, lpbfifo->req->size, DMA_FROM_DEVICE);
+				dma_unmap_single(lpbfifo->dev, lpbfifo->data_dma, lpbfifo->req->size, DMA_FROM_DEVICE);
 
 			lpbfifo->req = NULL;
 			out_be32(&lpbfifo->regs->enable, MPC52xx_SCLPC_ENABLE_RC | MPC52xx_SCLPC_ENABLE_RF);