[U-Boot] [PATCH V3] net: fec_mxc: allow use with cache enabled

Marek Vasut marex at denx.de
Wed Mar 14 02:44:53 CET 2012


Dear Eric Nelson,

> On 03/13/2012 07:04 AM, Eric Nelson wrote:
> > 	ensure that transmit and receive buffers are cache-line aligned
> > 	
> >          invalidate cache for each packet as received
> > 	
> > 	update receive buffer descriptors one cache line at a time
> > 	
> >          flush cache before transmitting
> > 
> > Original patch by Marek:
> > 	http://lists.denx.de/pipermail/u-boot/2012-February/117695.html
> > 
> > Signed-off-by: Eric Nelson<eric.nelson at boundarydevices.com>
> > 
> > ---
> > 
> > V2 addresses some concerns from the ML:
> > 	- Use readl()/writel() instead of mapped data structure
> > 	
> > 	  accesses
> > 	
> > 	- Wrong comment style
> > 	-&rbd_base[0] == rbd_base
> > 	removed 'volatile' from fec_send().
> > 	
>  > <snip>
> > 
> > diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
> > index 1fdd071..94a3927 100644
> > --- a/drivers/net/fec_mxc.c
> > +++ b/drivers/net/fec_mxc.c
> 
> ...
> 
> > @@ -631,9 +682,11 @@ static void fec_halt(struct eth_device *dev)
> > 
> >    * @param[in] length Data count in bytes
> >    * @return 0 on success
> >    */
> > 
> > -static int fec_send(struct eth_device *dev, volatile void* packet, int
> > length) +static int fec_send(struct eth_device *dev, void *packet, int
> > length)
> > 
> >   {
> >   
> >   	unsigned int status;
> 
> I made this change to keep checkpatch happy (it doesn't like volatile),
> but the declaration of struct eth_device in include/net.h seems to want
> the volatile:
> 
> 	int  (*send) (struct eth_device*, volatile void* packet, int length);
> 
> I'd rather have a checkpatch warning than a compiler warning, so I'll fix
> this in V4...

I believe the volatile is there for a reason (not a reason meaningful for this 
device though). I believe on some boards, this was used to avoid some cache 
trouble or such.


Best regards,
Marek Vasut


More information about the U-Boot mailing list