u-boot/arch/arm/include/asm/arch-uniphier
Masahiro Yamada d6bc30af52 ARM: UniPhier: remove __packed that causes a problem on GCC 4.9
The DDR PHY training function, ddrphy_prepare_training() would not
work if compiled with GCC 4.9.

The struct ddrphy (arch/arm/include/asm/arch-uniphier/ddrphy-regs.h)
is specified with __packed because it represents a hardware register
mapping, but it turned out to cause a problem on GCC 4.9.

If -mno-unaligned-access is specified (yes, it is in
arch/arm/cpu/armv7/config.mk), GCC 4.9 is aware of the
__attribute__((packed)) and generates extra instructions to perform
the memory access in a way that does not cause unaligned access.
(Actually it is not need here because the register base, the first
argument of the ddrphy_prepare_training(), is always given with a
4-byte aligned address.)

Anyway, as a result, readl() / writel() is divided into byte-wise
accesses.  The problem is that this hardware only accepts 4-byte
register access.  Byte-wise accesses lead to unexpected behavior.

There are some options to avoid this problem.

[1] Remove -mno-unaligned-access
[2] Add __aligned(4) along with __packed to struct ddrphy
[3] Remove __packed from struct ddrphy

[1] solves the problem for ARMv7, but it does not for pre-ARMv6 and
ARMv6-M architectures where -mno-unaligned-access is default.
So, [1] does not seem reasonable in terms of code portability.

Both [2] and [3] work well, but [2] seems too much.  All the members
of struct ddrphy have the u32 type.  No padding would be inserted
even if __packed is dropped.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Tom Rini <trini@ti.com>
2015-01-23 00:44:17 +09:00
..
arm-mpcore.h ARM: UniPhier: add UniPhier SoC support code 2014-10-05 14:10:09 +09:00
bcu-regs.h ARM: UniPhier: add UniPhier SoC support code 2014-10-05 14:10:09 +09:00
board.h ARM: UniPhier: detect the number of flash banks at run-time 2014-12-09 00:08:33 +09:00
boot-device.h ARM: UniPhier: add UniPhier SoC support code 2014-10-05 14:10:09 +09:00
ddrphy-regs.h ARM: UniPhier: remove __packed that causes a problem on GCC 4.9 2015-01-23 00:44:17 +09:00
debug-uart.S ARM: UniPhier: add UART initialization routine for low-level debug 2015-01-08 23:01:56 +09:00
ehci-uniphier.h usb: UniPhier: add UniPhier on-chip EHCI host driver support 2014-11-12 00:21:28 +09:00
gpio.h ARM: UniPhier: add dummy gpio.h to enable CONFIG_OF_CONTROL 2014-11-28 02:17:21 +09:00
led.h ARM: UniPhier: add UniPhier SoC support code 2014-10-05 14:10:09 +09:00
mio-regs.h ARM: UniPhier: add MIO register file 2014-11-12 00:21:28 +09:00
platdevice.h usb: UniPhier: add UniPhier on-chip EHCI host driver support 2014-11-12 00:21:28 +09:00
sbc-regs.h ARM: UniPhier: enable output of system bus 2015-01-08 23:01:45 +09:00
sc-regs.h ARM: UniPhier: add UniPhier SoC support code 2014-10-05 14:10:09 +09:00
sg-regs.h ARM: UniPhier: add set_pinsel macro for use in assembly code 2014-11-12 00:22:23 +09:00
ssc-regs.h ARM: UniPhier: add UniPhier SoC support code 2014-10-05 14:10:09 +09:00
umc-regs.h ARM: UniPhier: add UniPhier SoC support code 2014-10-05 14:10:09 +09:00