Skip to content

Commit 3e5b6a7

Browse files
gctuckergregkh
authored andcommitted
ARM: 9007/1: l2c: fix prefetch bits init in L2X0_AUX_CTRL using DT values
[ Upstream commit 8e007b3 ] The L310_PREFETCH_CTRL register bits 28 and 29 to enable data and instruction prefetch respectively can also be accessed via the L2X0_AUX_CTRL register. They appear to be actually wired together in hardware between the registers. Changing them in the prefetch register only will get undone when restoring the aux control register later on. For this reason, set these bits in both registers during initialisation according to the devicetree property values. Link: https://lore.kernel.org/lkml/76f2f3ad5e77e356e0a5b99ceee1e774a2842c25.1597061474.git.guillaume.tucker@collabora.com/ Fixes: ec3bd0e ("ARM: 8391/1: l2c: add options to overwrite prefetching behavior") Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent e7a9e70 commit 3e5b6a7

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

arch/arm/mm/cache-l2x0.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,20 +1249,28 @@ static void __init l2c310_of_parse(const struct device_node *np,
12491249

12501250
ret = of_property_read_u32(np, "prefetch-data", &val);
12511251
if (ret == 0) {
1252-
if (val)
1252+
if (val) {
12531253
prefetch |= L310_PREFETCH_CTRL_DATA_PREFETCH;
1254-
else
1254+
*aux_val |= L310_PREFETCH_CTRL_DATA_PREFETCH;
1255+
} else {
12551256
prefetch &= ~L310_PREFETCH_CTRL_DATA_PREFETCH;
1257+
*aux_val &= ~L310_PREFETCH_CTRL_DATA_PREFETCH;
1258+
}
1259+
*aux_mask &= ~L310_PREFETCH_CTRL_DATA_PREFETCH;
12561260
} else if (ret != -EINVAL) {
12571261
pr_err("L2C-310 OF prefetch-data property value is missing\n");
12581262
}
12591263

12601264
ret = of_property_read_u32(np, "prefetch-instr", &val);
12611265
if (ret == 0) {
1262-
if (val)
1266+
if (val) {
12631267
prefetch |= L310_PREFETCH_CTRL_INSTR_PREFETCH;
1264-
else
1268+
*aux_val |= L310_PREFETCH_CTRL_INSTR_PREFETCH;
1269+
} else {
12651270
prefetch &= ~L310_PREFETCH_CTRL_INSTR_PREFETCH;
1271+
*aux_val &= ~L310_PREFETCH_CTRL_INSTR_PREFETCH;
1272+
}
1273+
*aux_mask &= ~L310_PREFETCH_CTRL_INSTR_PREFETCH;
12661274
} else if (ret != -EINVAL) {
12671275
pr_err("L2C-310 OF prefetch-instr property value is missing\n");
12681276
}

0 commit comments

Comments
 (0)