From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Wed, 20 Jun 2012 23:15:26 +0200 Subject: [U-Boot] [PATCH v3 2/6] ehci-hcd.c, musb_core, usb.h: Add USB_DMA_MINALIGN define for cache alignment In-Reply-To: <20120620191537.GA2254@bill-the-cat> References: <1339710323-20014-1-git-send-email-trini@ti.com> <201206202100.46186.marex@denx.de> <20120620191537.GA2254@bill-the-cat> Message-ID: <201206202315.26984.marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Tom Rini, > On Wed, Jun 20, 2012 at 09:00:45PM +0200, Marek Vasut wrote: > > Dear Tom Rini, > > > > > The USB spec says that 32 bytes is the minimum required alignment. > > > However on some platforms we have a larger minimum requirement for > > > cache coherency. In those cases, use that value rather than the USB > > > spec minimum. We add a cpp check to to define > > > USB_DMA_MINALIGN and make use of it in ehci-hcd.c and musb_core.h. We > > > cannot use MAX() here as we are not allowed to have tests inside of > > > align(...). > > > > > > Cc: Marek Vasut > > > Signed-off-by: Tom Rini > > > > > > -- > > > Changes in v2: > > > - Move test to , expand comment. > > > --- > > > > > > drivers/usb/host/ehci-hcd.c | 13 +++++++------ > > > drivers/usb/musb/musb_core.h | 2 +- > > > include/usb.h | 10 ++++++++++ > > > 3 files changed, 18 insertions(+), 7 deletions(-) > > > > > > diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c > > > index 04300be..5a86117 100644 > > > --- a/drivers/usb/host/ehci-hcd.c > > > +++ b/drivers/usb/host/ehci-hcd.c > > > @@ -29,12 +29,13 @@ > > > > > > #include "ehci.h" > > > > > > -int rootdev; > > > -struct ehci_hccr *hccr; /* R/O registers, not need for volatile */ > > > -volatile struct ehci_hcor *hcor; > > > +int rootdev __attribute__((aligned(USB_DMA_MINALIGN))); > > > +/* R/O registers, not need for volatile */ > > > +struct ehci_hccr *hccr __attribute__((aligned(USB_DMA_MINALIGN))); > > > +volatile struct ehci_hcor *hcor > > > __attribute__((aligned(USB_DMA_MINALIGN))); > > > > ^ these need to be aligned too? > > Yes, these were the first and easy to spot ones in the cache flush > messages, I would swear. hcor and hccr are register locations though ... so it's pretty weird. Best regards, Marek Vasut