diff options
| -rw-r--r-- | arch/arm/mm/cache-l2x0.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c index 415efc3bee0d..e99a0ffd22d1 100644 --- a/arch/arm/mm/cache-l2x0.c +++ b/arch/arm/mm/cache-l2x0.c | |||
| @@ -755,13 +755,24 @@ static void __init __l2c_init(const struct l2c_init_data *data, | |||
| 755 | { | 755 | { |
| 756 | struct outer_cache_fns fns; | 756 | struct outer_cache_fns fns; |
| 757 | unsigned way_size_bits, ways; | 757 | unsigned way_size_bits, ways; |
| 758 | u32 aux; | 758 | u32 aux, old_aux; |
| 759 | 759 | ||
| 760 | aux = readl_relaxed(l2x0_base + L2X0_AUX_CTRL); | 760 | /* |
| 761 | * Sanity check the aux values. aux_mask is the bits we preserve | ||
| 762 | * from reading the hardware register, and aux_val is the bits we | ||
| 763 | * set. | ||
| 764 | */ | ||
| 765 | if (aux_val & aux_mask) | ||
| 766 | pr_alert("L2C: platform provided aux values permit register corruption.\n"); | ||
| 761 | 767 | ||
| 768 | old_aux = aux = readl_relaxed(l2x0_base + L2X0_AUX_CTRL); | ||
| 762 | aux &= aux_mask; | 769 | aux &= aux_mask; |
| 763 | aux |= aux_val; | 770 | aux |= aux_val; |
| 764 | 771 | ||
| 772 | if (old_aux != aux) | ||
| 773 | pr_warn("L2C: DT/platform modifies aux control register: 0x%08x -> 0x%08x\n", | ||
| 774 | old_aux, aux); | ||
| 775 | |||
| 765 | /* Determine the number of ways */ | 776 | /* Determine the number of ways */ |
| 766 | switch (cache_id & L2X0_CACHE_ID_PART_MASK) { | 777 | switch (cache_id & L2X0_CACHE_ID_PART_MASK) { |
| 767 | case L2X0_CACHE_ID_PART_L310: | 778 | case L2X0_CACHE_ID_PART_L310: |
| @@ -1392,7 +1403,7 @@ int __init l2x0_of_init(u32 aux_val, u32 aux_mask) | |||
| 1392 | const struct l2c_init_data *data; | 1403 | const struct l2c_init_data *data; |
| 1393 | struct device_node *np; | 1404 | struct device_node *np; |
| 1394 | struct resource res; | 1405 | struct resource res; |
| 1395 | u32 cache_id; | 1406 | u32 cache_id, old_aux; |
| 1396 | 1407 | ||
| 1397 | np = of_find_matching_node(NULL, l2x0_ids); | 1408 | np = of_find_matching_node(NULL, l2x0_ids); |
| 1398 | if (!np) | 1409 | if (!np) |
| @@ -1409,6 +1420,14 @@ int __init l2x0_of_init(u32 aux_val, u32 aux_mask) | |||
| 1409 | 1420 | ||
| 1410 | data = of_match_node(l2x0_ids, np)->data; | 1421 | data = of_match_node(l2x0_ids, np)->data; |
| 1411 | 1422 | ||
| 1423 | old_aux = readl_relaxed(l2x0_base + L2X0_AUX_CTRL); | ||
| 1424 | if (old_aux != ((old_aux & aux_mask) | aux_val)) { | ||
| 1425 | pr_warn("L2C: platform modifies aux control register: 0x%08x -> 0x%08x\n", | ||
| 1426 | old_aux, (old_aux & aux_mask) | aux_val); | ||
| 1427 | } else if (aux_mask != ~0U && aux_val != 0) { | ||
| 1428 | pr_alert("L2C: platform provided aux values match the hardware, so have no effect. Please remove them.\n"); | ||
| 1429 | } | ||
| 1430 | |||
| 1412 | /* All L2 caches are unified, so this property should be specified */ | 1431 | /* All L2 caches are unified, so this property should be specified */ |
| 1413 | if (!of_property_read_bool(np, "cache-unified")) | 1432 | if (!of_property_read_bool(np, "cache-unified")) |
| 1414 | pr_err("L2C: device tree omits to specify unified cache\n"); | 1433 | pr_err("L2C: device tree omits to specify unified cache\n"); |
