[PATCH 4/5] macb: implement alloc_packet & free_packet

Sascha Hauer s.hauer at pengutronix.de
Sun Mar 4 07:08:41 EST 2012


On Fri, Mar 02, 2012 at 07:20:09PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> We need to have a non cached buffer.
> Need when MMU enabled.
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
> ---
>  drivers/net/macb.c |   19 ++++++++++++++++---
>  1 files changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/macb.c b/drivers/net/macb.c
> index d79da72..9b54afa 100644
> --- a/drivers/net/macb.c
> +++ b/drivers/net/macb.c
> @@ -50,6 +50,7 @@
>  #include <mach/board.h>
>  #include <linux/clk.h>
>  #include <linux/err.h>
> +#include <asm/mmu.h>
>  
>  #include "macb.h"
>  
> @@ -391,6 +392,16 @@ static int macb_set_ethaddr(struct eth_device *edev, unsigned char *adr)
>  	return 0;
>  }
>  
> +static void *macb_alloc_packet(struct eth_device* edev)
> +{
> +	return dma_alloc_coherent(PKTSIZE);
> +}
> +
> +static void macb_free_packet(struct eth_device* edev, void *packet)
> +{
> +	dma_free_coherent(packet, PKTSIZE);
> +}

Why don't you use dma_flush_range/dma_clean_range like we do in other
drivers?

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list