public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Allen Martin <amartin@nvidia.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] USB: make usb_kbd obey USB DMA alignment requirements
Date: Mon, 22 Oct 2012 15:35:20 -0700	[thread overview]
Message-ID: <20121022223520.GC13201@badger> (raw)
In-Reply-To: <5085C1CF.4000805@wwwdotorg.org>

On Mon, Oct 22, 2012 at 02:59:43PM -0700, Stephen Warren wrote:
> On 10/22/2012 03:39 PM, Allen Martin wrote:
> > Change usb_kbd driver to obey alignment requirements for USB DMA on
> > the buffer used for data transfer.  This is necessary for
> > architectures that enable dcache and enable USB DMA.
> 
> > diff --git a/common/usb_kbd.c b/common/usb_kbd.c
> 
> >  struct usb_kbd_pdata {
> > +	uint8_t		new[8];
> > +	uint8_t		old[8];
> > +
> >  	uint32_t	repeat_delay;
> >  
> >  	uint32_t	usb_in_pointer;
> >  	uint32_t	usb_out_pointer;
> >  	uint8_t		usb_kbd_buffer[USB_KBD_BUFFER_LEN];
> >  
> > -	uint8_t		new[8];
> > -	uint8_t		old[8];
> > -
> >  	uint8_t		flags;
> > -};
> > +} __aligned(USB_DMA_MINALIGN);
> 
> Surely you need to edit the malloc() call in usb_kbd_probe() instead of
> adding __aligned to the type; does the alignment on the type really get
> propagated into malloc(), or as custom code at the call-site somehow?

Yes, you're right.  I misread the code and thought it came from a
static allocation.  I got reassured when I added the change and the
cache flush alignment warnings went away, but I guess these alignment
things are always a crapshoot anyway.

I'll fix, thanks for finding that.

-Allen
-- 
nvpublic

      reply	other threads:[~2012-10-22 22:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-22 21:39 [U-Boot] [PATCH 1/2] USB: make usb_kbd obey USB DMA alignment requirements Allen Martin
2012-10-22 21:39 ` [U-Boot] [PATCH 2/2] tegra: seaboard: Enable USB keyboard Allen Martin
2012-10-22 21:56   ` Stephen Warren
2012-10-22 22:58     ` Allen Martin
2012-10-22 23:13       ` Stephen Warren
2012-10-22 21:59 ` [U-Boot] [PATCH 1/2] USB: make usb_kbd obey USB DMA alignment requirements Stephen Warren
2012-10-22 22:35   ` Allen Martin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121022223520.GC13201@badger \
    --to=amartin@nvidia.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox