From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joel Fernandes Date: Wed, 4 Sep 2013 16:30:57 -0500 Subject: [U-Boot] [PATCH] usb: gadget: Fix data aborts during USB ethernet boot In-Reply-To: <201308271552.13540.marex@denx.de> References: <1377041578-9149-1-git-send-email-joelf@ti.com> <201308271552.13540.marex@denx.de> Message-ID: <5227A691.1080602@ti.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 08/27/2013 08:52 AM, Marek Vasut wrote: > Dear Joel Fernandes, > >> As seen on GCC 4.6 Linaro compiler, control_req buffer is not aligned >> on 4 byte boundaray causing data aborts in eth_setup -> conf_buf >> during dhcp boot over usb_ether. Fix the issue my aligning control_req >> buffer to 4-byte boundary. >> >> Tested on am335x_evm platform (beaglebone). >> Applies on 2013.10-rc1 branch. >> >> Cc: Tom Rini >> Signed-off-by: Joel Fernandes > > Please keep me in the CC next time. Ok. >> --- >> drivers/usb/gadget/ether.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c >> index 579893c..251d7b2 100644 >> --- a/drivers/usb/gadget/ether.c >> +++ b/drivers/usb/gadget/ether.c >> @@ -849,7 +849,7 @@ static struct usb_gadget_strings stringtab = { >> }; >> >> /*======================================================================== >> ====*/ -static u8 control_req[USB_BUFSIZ]; >> +static u8 control_req[USB_BUFSIZ] __attribute__ ((aligned(4))); > > Please make this cacheline aligned, so we get rid of bounce buffering of the > requests on stupid hardware. >> #if defined(CONFIG_USB_ETH_CDC) || defined(CONFIG_USB_ETH_RNDIS) >> static u8 status_req[STATUS_BYTECOUNT] __attribute__ ((aligned(4))); > > This could also use fixing, but the STATUS_BYTECOUNT would need to be up-aligned > as well then. Some DEFINE_CACHE_ALIGN_BUFFER might help in both cases here. Ok, how about __aligned(CONFIG_SYS_CACHELINE_SIZE) instead of defining a new DEFINE_CACHE_ALIGN_BUFFER macro? Can you explain what you meant by STATUS_BYTECOUNT up-aligned and why its needed to be up-aligned? Regards, -Joel > >> #endif > > Best regards, > Marek Vasut >