diff options
author | Jan Luebbe <jlu@pengutronix.de> | 2017-08-28 17:25:16 +0200 |
---|---|---|
committer | Gregory CLEMENT <gregory.clement@free-electrons.com> | 2017-10-12 15:01:30 +0200 |
commit | 2bbbd96357ce76cc45ec722c00f654aa7b189112 (patch) | |
tree | 45980b752faf887d9e6e21e1a3da1d268fe99f67 /include | |
parent | ARM: dts: Fix I2C repeated start issue on Armada-38x (diff) | |
download | linux-2bbbd96357ce76cc45ec722c00f654aa7b189112.tar.xz linux-2bbbd96357ce76cc45ec722c00f654aa7b189112.zip |
bus: mbus: fix window size calculation for 4GB windows
At least the Armada XP SoC supports 4GB on a single DRAM window. Because
the size register values contain the actual size - 1, the MSB is set in
that case. For example, the SDRAM window's control register's value is
0xffffffe1 for 4GB (bits 31 to 24 contain the size).
The MBUS driver reads back each window's size from registers and
calculates the actual size as (control_reg | ~DDR_SIZE_MASK) + 1, which
overflows for 32 bit values, resulting in other miscalculations further
on (a bad RAM window for the CESA crypto engine calculated by
mvebu_mbus_setup_cpu_target_nooverlap() in my case).
This patch changes the type in 'struct mbus_dram_window' from u32 to
u64, which allows us to keep using the same register calculation code in
most MBUS-using drivers (which calculate ->size - 1 again).
Fixes: fddddb52a6c4 ("bus: introduce an Marvell EBU MBus driver")
CC: stable@vger.kernel.org
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/mbus.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/mbus.h b/include/linux/mbus.h index 0d3f14fd2621..4773145246ed 100644 --- a/include/linux/mbus.h +++ b/include/linux/mbus.h @@ -31,8 +31,8 @@ struct mbus_dram_target_info struct mbus_dram_window { u8 cs_index; u8 mbus_attr; - u32 base; - u32 size; + u64 base; + u64 size; } cs[4]; }; |