All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marek.vasut@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] ARM: cfi_flash: Avoid generation of unaligned accesses
Date: Sun, 28 Apr 2013 20:58:06 +0200	[thread overview]
Message-ID: <201304282058.07170.marek.vasut@gmail.com> (raw)
In-Reply-To: <1367145576-12748-1-git-send-email-andrew_gabbasov@mentor.com>

Dear Andrew Gabbasov,

> Packed structure cfi_qry contains unaligned 16- and 32-bits members,
> accessing which causes problems when cfi_flash driver is compiled with
> -munaligned-access option: flash initialization hangs, probably
> due to data error.
> 
> Since fixing the code to use some other way of accessing those fields
> seems quite expensive, just force the compiler to use
> -mno-unaligned-access.
> 
> Signed-off-by: Andrew Gabbasov <andrew_gabbasov@mentor.com>
> ---
>  drivers/mtd/Makefile |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
> index 543c845..a120f0b 100644
> --- a/drivers/mtd/Makefile
> +++ b/drivers/mtd/Makefile
> @@ -46,6 +46,9 @@ all:	$(LIB)
>  $(LIB):	$(obj).depend $(OBJS)
>  	$(call cmd_link_o_target, $(OBJS))
> 
> +# SEE README.arm-unaligned-accesses
> +$(obj)cfi_flash.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
> +
>  #########################################################################
> 
>  # defines $(obj).depend target

I'd say rather fix the structure than use this workaround. See, using

u8[3]
u16

will make unaligned access. The fix would be to split that u16 into two u8 and 
add a proper accessor. It'll be much larger effort, but it'd also be more 
correct.

Best regards,
Marek Vasut

  reply	other threads:[~2013-04-28 18:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-28 10:39 [U-Boot] [PATCH] ARM: cfi_flash: Avoid generation of unaligned accesses Andrew Gabbasov
2013-04-28 18:58 ` Marek Vasut [this message]
2013-04-29  9:40   ` Gabbasov, Andrew
2013-05-08 14:56     ` Gabbasov, Andrew

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=201304282058.07170.marek.vasut@gmail.com \
    --to=marek.vasut@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.