Re: [PATCH] net/fec_mpc52xx: fix BUG on missing dma_ops
Thanks Becky. g. 2009/3/31 Becky Bruce bec...@kernel.crashing.org: On Mar 30, 2009, at 9:25 PM, Grant Likely wrote: From: Grant Likely grant.lik...@secretlab.ca The driver triggers a BUG_ON() when allocating DMA buffers if the arch/powerpc dma_ops from the of_platform device are not copied into net_device structure. Signed-off-by: Grant Likely grant.lik...@secretlab.ca --- Becky, does this look better to you? Reviewed-by: Becky Bruce bec...@kernel.crashing.org I think this is OK now, and Kumar agrees Thanks! B g. drivers/net/fec_mpc52xx.c | 19 --- 1 files changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c index 049b0a7..f99463f 100644 --- a/drivers/net/fec_mpc52xx.c +++ b/drivers/net/fec_mpc52xx.c @@ -129,7 +129,8 @@ static void mpc52xx_fec_free_rx_buffers(struct net_device *dev, struct bcom_task struct sk_buff *skb; skb = bcom_retrieve_buffer(s, NULL, (struct bcom_bd **)bd); - dma_unmap_single(dev-dev, bd-skb_pa, skb-len, DMA_FROM_DEVICE); + dma_unmap_single(dev-dev.parent, bd-skb_pa, skb-len, + DMA_FROM_DEVICE); kfree_skb(skb); } } @@ -150,7 +151,7 @@ static int mpc52xx_fec_alloc_rx_buffers(struct net_device *dev, struct bcom_task bd = (struct bcom_fec_bd *)bcom_prepare_next_buffer(rxtsk); bd-status = FEC_RX_BUFFER_SIZE; - bd-skb_pa = dma_map_single(dev-dev, skb-data, + bd-skb_pa = dma_map_single(dev-dev.parent, skb-data, FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE); bcom_submit_next_buffer(rxtsk, skb); @@ -388,7 +389,8 @@ static int mpc52xx_fec_hard_start_xmit(struct sk_buff *skb, struct net_device *d bcom_prepare_next_buffer(priv-tx_dmatsk); bd-status = skb-len | BCOM_FEC_TX_BD_TFD | BCOM_FEC_TX_BD_TC; - bd-skb_pa = dma_map_single(dev-dev, skb-data, skb-len, DMA_TO_DEVICE); + bd-skb_pa = dma_map_single(dev-dev.parent, skb-data, skb-len, + DMA_TO_DEVICE); bcom_submit_next_buffer(priv-tx_dmatsk, skb); @@ -430,7 +432,8 @@ static irqreturn_t mpc52xx_fec_tx_interrupt(int irq, void *dev_id) struct bcom_fec_bd *bd; skb = bcom_retrieve_buffer(priv-tx_dmatsk, NULL, (struct bcom_bd **)bd); - dma_unmap_single(dev-dev, bd-skb_pa, skb-len, DMA_TO_DEVICE); + dma_unmap_single(dev-dev.parent, bd-skb_pa, skb-len, + DMA_TO_DEVICE); dev_kfree_skb_irq(skb); } @@ -455,7 +458,8 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id) rskb = bcom_retrieve_buffer(priv-rx_dmatsk, status, (struct bcom_bd **)bd); - dma_unmap_single(dev-dev, bd-skb_pa, rskb-len, DMA_FROM_DEVICE); + dma_unmap_single(dev-dev.parent, bd-skb_pa, rskb-len, + DMA_FROM_DEVICE); /* Test for errors in received frame */ if (status BCOM_FEC_RX_BD_ERRORS) { @@ -464,7 +468,8 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id) bcom_prepare_next_buffer(priv-rx_dmatsk); bd-status = FEC_RX_BUFFER_SIZE; - bd-skb_pa = dma_map_single(dev-dev, rskb-data, + bd-skb_pa = dma_map_single(dev-dev.parent, + rskb-data, FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE); bcom_submit_next_buffer(priv-rx_dmatsk, rskb); @@ -499,7 +504,7 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id) bcom_prepare_next_buffer(priv-rx_dmatsk); bd-status = FEC_RX_BUFFER_SIZE; - bd-skb_pa = dma_map_single(dev-dev, skb-data, + bd-skb_pa = dma_map_single(dev-dev.parent, skb-data, FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE); bcom_submit_next_buffer(priv-rx_dmatsk, skb); -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH] net/fec_mpc52xx: fix BUG on missing dma_ops
On Mar 30, 2009, at 9:25 PM, Grant Likely wrote: From: Grant Likely grant.lik...@secretlab.ca The driver triggers a BUG_ON() when allocating DMA buffers if the arch/powerpc dma_ops from the of_platform device are not copied into net_device structure. Signed-off-by: Grant Likely grant.lik...@secretlab.ca --- Becky, does this look better to you? Reviewed-by: Becky Bruce bec...@kernel.crashing.org I think this is OK now, and Kumar agrees Thanks! B g. drivers/net/fec_mpc52xx.c | 19 --- 1 files changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c index 049b0a7..f99463f 100644 --- a/drivers/net/fec_mpc52xx.c +++ b/drivers/net/fec_mpc52xx.c @@ -129,7 +129,8 @@ static void mpc52xx_fec_free_rx_buffers(struct net_device *dev, struct bcom_task struct sk_buff *skb; skb = bcom_retrieve_buffer(s, NULL, (struct bcom_bd **)bd); - dma_unmap_single(dev-dev, bd-skb_pa, skb-len, DMA_FROM_DEVICE); + dma_unmap_single(dev-dev.parent, bd-skb_pa, skb-len, +DMA_FROM_DEVICE); kfree_skb(skb); } } @@ -150,7 +151,7 @@ static int mpc52xx_fec_alloc_rx_buffers(struct net_device *dev, struct bcom_task bd = (struct bcom_fec_bd *)bcom_prepare_next_buffer(rxtsk); bd-status = FEC_RX_BUFFER_SIZE; - bd-skb_pa = dma_map_single(dev-dev, skb-data, + bd-skb_pa = dma_map_single(dev-dev.parent, skb-data, FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE); bcom_submit_next_buffer(rxtsk, skb); @@ -388,7 +389,8 @@ static int mpc52xx_fec_hard_start_xmit(struct sk_buff *skb, struct net_device *d bcom_prepare_next_buffer(priv-tx_dmatsk); bd-status = skb-len | BCOM_FEC_TX_BD_TFD | BCOM_FEC_TX_BD_TC; - bd-skb_pa = dma_map_single(dev-dev, skb-data, skb-len, DMA_TO_DEVICE); + bd-skb_pa = dma_map_single(dev-dev.parent, skb-data, skb-len, + DMA_TO_DEVICE); bcom_submit_next_buffer(priv-tx_dmatsk, skb); @@ -430,7 +432,8 @@ static irqreturn_t mpc52xx_fec_tx_interrupt(int irq, void *dev_id) struct bcom_fec_bd *bd; skb = bcom_retrieve_buffer(priv-tx_dmatsk, NULL, (struct bcom_bd **)bd); - dma_unmap_single(dev-dev, bd-skb_pa, skb-len, DMA_TO_DEVICE); + dma_unmap_single(dev-dev.parent, bd-skb_pa, skb-len, +DMA_TO_DEVICE); dev_kfree_skb_irq(skb); } @@ -455,7 +458,8 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id) rskb = bcom_retrieve_buffer(priv-rx_dmatsk, status, (struct bcom_bd **)bd); - dma_unmap_single(dev-dev, bd-skb_pa, rskb-len, DMA_FROM_DEVICE); + dma_unmap_single(dev-dev.parent, bd-skb_pa, rskb-len, +DMA_FROM_DEVICE); /* Test for errors in received frame */ if (status BCOM_FEC_RX_BD_ERRORS) { @@ -464,7 +468,8 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id) bcom_prepare_next_buffer(priv-rx_dmatsk); bd-status = FEC_RX_BUFFER_SIZE; - bd-skb_pa = dma_map_single(dev-dev, rskb-data, + bd-skb_pa = dma_map_single(dev-dev.parent, + rskb-data, FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE); bcom_submit_next_buffer(priv-rx_dmatsk, rskb); @@ -499,7 +504,7 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id) bcom_prepare_next_buffer(priv-rx_dmatsk); bd-status = FEC_RX_BUFFER_SIZE; - bd-skb_pa = dma_map_single(dev-dev, skb-data, + bd-skb_pa = dma_map_single(dev-dev.parent, skb-data, FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE); bcom_submit_next_buffer(priv-rx_dmatsk, skb); ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH] net/fec_mpc52xx: fix BUG on missing dma_ops
From: Grant Likely grant.lik...@secretlab.ca The driver triggers a BUG_ON() when allocating DMA buffers if the arch/powerpc dma_ops from the of_platform device are not copied into net_device structure. Signed-off-by: Grant Likely grant.lik...@secretlab.ca --- David, do you want to pick this one up right away, or should I merge it through Ben's powerpc tree? g. drivers/net/fec_mpc52xx.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c index 049b0a7..215207d 100644 --- a/drivers/net/fec_mpc52xx.c +++ b/drivers/net/fec_mpc52xx.c @@ -928,6 +928,9 @@ mpc52xx_fec_probe(struct of_device *op, const struct of_device_id *match) if (!request_mem_region(mem.start, sizeof(struct mpc52xx_fec), DRIVER_NAME)) return -EBUSY; + /* Copy the PowerPC dma_ops from the of_device */ + set_dma_ops(ndev-dev, get_dma_ops(op-dev)); + /* Init ether ndev with what we have */ ndev-open = mpc52xx_fec_open; ndev-stop = mpc52xx_fec_close; ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
Re: [PATCH] net/fec_mpc52xx: fix BUG on missing dma_ops
On Mar 30, 2009, at 1:53 PM, Grant Likely wrote: From: Grant Likely grant.lik...@secretlab.ca The driver triggers a BUG_ON() when allocating DMA buffers if the arch/powerpc dma_ops from the of_platform device are not copied into net_device structure. Signed-off-by: Grant Likely grant.lik...@secretlab.ca --- David, do you want to pick this one up right away, or should I merge it through Ben's powerpc tree? Grant, I really think you need to do what Kumar did for gianfar (http://patchwork.ozlabs.org/patch/24562/ ) - your patch just fixes the dma_ops problem, not the problem with getting to the correct archdata, which contains an offset (dma_data) that is used to form a bus address used in the various dma operations. Grep for get_dma_direct_offset in arch/powerpc and you'll see it used in the various dma operations. Cheers, B g. drivers/net/fec_mpc52xx.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c index 049b0a7..215207d 100644 --- a/drivers/net/fec_mpc52xx.c +++ b/drivers/net/fec_mpc52xx.c @@ -928,6 +928,9 @@ mpc52xx_fec_probe(struct of_device *op, const struct of_device_id *match) if (!request_mem_region(mem.start, sizeof(struct mpc52xx_fec), DRIVER_NAME)) return -EBUSY; + /* Copy the PowerPC dma_ops from the of_device */ + set_dma_ops(ndev-dev, get_dma_ops(op-dev)); + /* Init ether ndev with what we have */ ndev-open = mpc52xx_fec_open; ndev-stop = mpc52xx_fec_close; ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev
[PATCH] net/fec_mpc52xx: fix BUG on missing dma_ops
From: Grant Likely grant.lik...@secretlab.ca The driver triggers a BUG_ON() when allocating DMA buffers if the arch/powerpc dma_ops from the of_platform device are not copied into net_device structure. Signed-off-by: Grant Likely grant.lik...@secretlab.ca --- Becky, does this look better to you? g. drivers/net/fec_mpc52xx.c | 19 --- 1 files changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c index 049b0a7..f99463f 100644 --- a/drivers/net/fec_mpc52xx.c +++ b/drivers/net/fec_mpc52xx.c @@ -129,7 +129,8 @@ static void mpc52xx_fec_free_rx_buffers(struct net_device *dev, struct bcom_task struct sk_buff *skb; skb = bcom_retrieve_buffer(s, NULL, (struct bcom_bd **)bd); - dma_unmap_single(dev-dev, bd-skb_pa, skb-len, DMA_FROM_DEVICE); + dma_unmap_single(dev-dev.parent, bd-skb_pa, skb-len, +DMA_FROM_DEVICE); kfree_skb(skb); } } @@ -150,7 +151,7 @@ static int mpc52xx_fec_alloc_rx_buffers(struct net_device *dev, struct bcom_task bd = (struct bcom_fec_bd *)bcom_prepare_next_buffer(rxtsk); bd-status = FEC_RX_BUFFER_SIZE; - bd-skb_pa = dma_map_single(dev-dev, skb-data, + bd-skb_pa = dma_map_single(dev-dev.parent, skb-data, FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE); bcom_submit_next_buffer(rxtsk, skb); @@ -388,7 +389,8 @@ static int mpc52xx_fec_hard_start_xmit(struct sk_buff *skb, struct net_device *d bcom_prepare_next_buffer(priv-tx_dmatsk); bd-status = skb-len | BCOM_FEC_TX_BD_TFD | BCOM_FEC_TX_BD_TC; - bd-skb_pa = dma_map_single(dev-dev, skb-data, skb-len, DMA_TO_DEVICE); + bd-skb_pa = dma_map_single(dev-dev.parent, skb-data, skb-len, + DMA_TO_DEVICE); bcom_submit_next_buffer(priv-tx_dmatsk, skb); @@ -430,7 +432,8 @@ static irqreturn_t mpc52xx_fec_tx_interrupt(int irq, void *dev_id) struct bcom_fec_bd *bd; skb = bcom_retrieve_buffer(priv-tx_dmatsk, NULL, (struct bcom_bd **)bd); - dma_unmap_single(dev-dev, bd-skb_pa, skb-len, DMA_TO_DEVICE); + dma_unmap_single(dev-dev.parent, bd-skb_pa, skb-len, +DMA_TO_DEVICE); dev_kfree_skb_irq(skb); } @@ -455,7 +458,8 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id) rskb = bcom_retrieve_buffer(priv-rx_dmatsk, status, (struct bcom_bd **)bd); - dma_unmap_single(dev-dev, bd-skb_pa, rskb-len, DMA_FROM_DEVICE); + dma_unmap_single(dev-dev.parent, bd-skb_pa, rskb-len, +DMA_FROM_DEVICE); /* Test for errors in received frame */ if (status BCOM_FEC_RX_BD_ERRORS) { @@ -464,7 +468,8 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id) bcom_prepare_next_buffer(priv-rx_dmatsk); bd-status = FEC_RX_BUFFER_SIZE; - bd-skb_pa = dma_map_single(dev-dev, rskb-data, + bd-skb_pa = dma_map_single(dev-dev.parent, + rskb-data, FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE); bcom_submit_next_buffer(priv-rx_dmatsk, rskb); @@ -499,7 +504,7 @@ static irqreturn_t mpc52xx_fec_rx_interrupt(int irq, void *dev_id) bcom_prepare_next_buffer(priv-rx_dmatsk); bd-status = FEC_RX_BUFFER_SIZE; - bd-skb_pa = dma_map_single(dev-dev, skb-data, + bd-skb_pa = dma_map_single(dev-dev.parent, skb-data, FEC_RX_BUFFER_SIZE, DMA_FROM_DEVICE); bcom_submit_next_buffer(priv-rx_dmatsk, skb); ___ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev