History

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).

Jan Luebbe committed 9 years ago

Commit 2bbbd961 parent fbffee72 files · +3 −3Browse files

Showing the changes to include/linux (1 of 2 files). Show all

Unified · Split

include/linux/mbus.h+2−2
@@ -31,8 +31,8 @@ struct mbus_dram_target_info · 30 unmodified lines
31 struct mbus_dram_window {31 struct mbus_dram_window {
32 u8 cs_index;32 u8 cs_index;
33 u8 mbus_attr;33 u8 mbus_attr;
34 u32 base;34 u64 base;
35 u32 size;35 u64 size;
36 } cs[4];36 } cs[4];
37};37};
38 38

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t