aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm/cache-l2x0.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2014-03-15 19:04:10 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2014-05-29 19:48:30 -0400
commit051334bdc5252362500a686100d9ec20cbfdcd8a (patch)
treed91cfe46a9b63ef6091164efa86e002524e51b58 /arch/arm/mm/cache-l2x0.c
parentcf9ea8f130e29915cb441e315f03ab4f64e0d73c (diff)
ARM: l2c: move type string into l2c_init_data structure
Rather than decoding this from the ID register, store it in the l2c_init_data structure. This simplifies things some more, and allows us to better provide further details as to how we're driving the cache. We print the cache ID value anyway should we need to precisely identify the cache hardware. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mm/cache-l2x0.c')
-rw-r--r--arch/arm/mm/cache-l2x0.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index c5d754912f96..b4dd2f4b491b 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -29,6 +29,7 @@
29#include "cache-aurora-l2.h" 29#include "cache-aurora-l2.h"
30 30
31struct l2c_init_data { 31struct l2c_init_data {
32 const char *type;
32 unsigned num_lock; 33 unsigned num_lock;
33 void (*of_parse)(const struct device_node *, u32 *, u32 *); 34 void (*of_parse)(const struct device_node *, u32 *, u32 *);
34 void (*enable)(void __iomem *, u32, unsigned); 35 void (*enable)(void __iomem *, u32, unsigned);
@@ -274,6 +275,7 @@ static void l2c210_resume(void)
274} 275}
275 276
276static const struct l2c_init_data l2c210_data __initconst = { 277static const struct l2c_init_data l2c210_data __initconst = {
278 .type = "L2C-210",
277 .num_lock = 1, 279 .num_lock = 1,
278 .enable = l2c_enable, 280 .enable = l2c_enable,
279 .outer_cache = { 281 .outer_cache = {
@@ -416,6 +418,7 @@ static void l2c220_sync(void)
416} 418}
417 419
418static const struct l2c_init_data l2c220_data = { 420static const struct l2c_init_data l2c220_data = {
421 .type = "L2C-220",
419 .num_lock = 1, 422 .num_lock = 1,
420 .enable = l2c_enable, 423 .enable = l2c_enable,
421 .outer_cache = { 424 .outer_cache = {
@@ -650,6 +653,7 @@ static void __init l2c310_fixup(void __iomem *base, u32 cache_id,
650} 653}
651 654
652static const struct l2c_init_data l2c310_init_fns __initconst = { 655static const struct l2c_init_data l2c310_init_fns __initconst = {
656 .type = "L2C-310",
653 .num_lock = 8, 657 .num_lock = 8,
654 .enable = l2c_enable, 658 .enable = l2c_enable,
655 .fixup = l2c310_fixup, 659 .fixup = l2c310_fixup,
@@ -674,7 +678,6 @@ static void __init __l2c_init(const struct l2c_init_data *data,
674 u32 way_size = 0; 678 u32 way_size = 0;
675 int ways; 679 int ways;
676 int way_size_shift = L2X0_WAY_SIZE_SHIFT; 680 int way_size_shift = L2X0_WAY_SIZE_SHIFT;
677 const char *type;
678 681
679 /* 682 /*
680 * It is strange to save the register state before initialisation, 683 * It is strange to save the register state before initialisation,
@@ -695,25 +698,21 @@ static void __init __l2c_init(const struct l2c_init_data *data,
695 ways = 16; 698 ways = 16;
696 else 699 else
697 ways = 8; 700 ways = 8;
698 type = "L310";
699 break; 701 break;
700 702
701 case L2X0_CACHE_ID_PART_L210: 703 case L2X0_CACHE_ID_PART_L210:
702 ways = (aux >> 13) & 0xf; 704 ways = (aux >> 13) & 0xf;
703 type = "L210";
704 break; 705 break;
705 706
706 case AURORA_CACHE_ID: 707 case AURORA_CACHE_ID:
707 ways = (aux >> 13) & 0xf; 708 ways = (aux >> 13) & 0xf;
708 ways = 2 << ((ways + 1) >> 2); 709 ways = 2 << ((ways + 1) >> 2);
709 way_size_shift = AURORA_WAY_SIZE_SHIFT; 710 way_size_shift = AURORA_WAY_SIZE_SHIFT;
710 type = "Aurora";
711 break; 711 break;
712 712
713 default: 713 default:
714 /* Assume unknown chips have 8 ways */ 714 /* Assume unknown chips have 8 ways */
715 ways = 8; 715 ways = 8;
716 type = "L2x0 series";
717 break; 716 break;
718 } 717 }
719 718
@@ -747,9 +746,9 @@ static void __init __l2c_init(const struct l2c_init_data *data,
747 outer_cache = fns; 746 outer_cache = fns;
748 747
749 pr_info("%s cache controller enabled, %d ways, %d kB\n", 748 pr_info("%s cache controller enabled, %d ways, %d kB\n",
750 type, ways, l2x0_size >> 10); 749 data->type, ways, l2x0_size >> 10);
751 pr_info("%s: CACHE_ID 0x%08x, AUX_CTRL 0x%08x\n", 750 pr_info("%s: CACHE_ID 0x%08x, AUX_CTRL 0x%08x\n",
752 type, cache_id, aux); 751 data->type, cache_id, aux);
753} 752}
754 753
755void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask) 754void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
@@ -821,6 +820,7 @@ static void __init l2x0_of_parse(const struct device_node *np,
821} 820}
822 821
823static const struct l2c_init_data of_l2c210_data __initconst = { 822static const struct l2c_init_data of_l2c210_data __initconst = {
823 .type = "L2C-210",
824 .num_lock = 1, 824 .num_lock = 1,
825 .of_parse = l2x0_of_parse, 825 .of_parse = l2x0_of_parse,
826 .enable = l2c_enable, 826 .enable = l2c_enable,
@@ -836,6 +836,7 @@ static const struct l2c_init_data of_l2c210_data __initconst = {
836}; 836};
837 837
838static const struct l2c_init_data of_l2c220_data __initconst = { 838static const struct l2c_init_data of_l2c220_data __initconst = {
839 .type = "L2C-220",
839 .num_lock = 1, 840 .num_lock = 1,
840 .of_parse = l2x0_of_parse, 841 .of_parse = l2x0_of_parse,
841 .enable = l2c_enable, 842 .enable = l2c_enable,
@@ -885,6 +886,7 @@ static void __init l2c310_of_parse(const struct device_node *np,
885} 886}
886 887
887static const struct l2c_init_data of_l2c310_data __initconst = { 888static const struct l2c_init_data of_l2c310_data __initconst = {
889 .type = "L2C-310",
888 .num_lock = 8, 890 .num_lock = 8,
889 .of_parse = l2c310_of_parse, 891 .of_parse = l2c310_of_parse,
890 .enable = l2c_enable, 892 .enable = l2c_enable,
@@ -1063,6 +1065,7 @@ static void __init aurora_of_parse(const struct device_node *np,
1063} 1065}
1064 1066
1065static const struct l2c_init_data of_aurora_with_outer_data __initconst = { 1067static const struct l2c_init_data of_aurora_with_outer_data __initconst = {
1068 .type = "Aurora",
1066 .num_lock = 4, 1069 .num_lock = 4,
1067 .of_parse = aurora_of_parse, 1070 .of_parse = aurora_of_parse,
1068 .enable = l2c_enable, 1071 .enable = l2c_enable,
@@ -1080,6 +1083,7 @@ static const struct l2c_init_data of_aurora_with_outer_data __initconst = {
1080}; 1083};
1081 1084
1082static const struct l2c_init_data of_aurora_no_outer_data __initconst = { 1085static const struct l2c_init_data of_aurora_no_outer_data __initconst = {
1086 .type = "Aurora",
1083 .num_lock = 4, 1087 .num_lock = 4,
1084 .of_parse = aurora_of_parse, 1088 .of_parse = aurora_of_parse,
1085 .enable = aurora_enable_no_outer, 1089 .enable = aurora_enable_no_outer,
@@ -1228,6 +1232,7 @@ static void bcm_flush_range(unsigned long start, unsigned long end)
1228 1232
1229/* Broadcom L2C-310 start from ARMs R3P2 or later, and require no fixups */ 1233/* Broadcom L2C-310 start from ARMs R3P2 or later, and require no fixups */
1230static const struct l2c_init_data of_bcm_l2x0_data __initconst = { 1234static const struct l2c_init_data of_bcm_l2x0_data __initconst = {
1235 .type = "BCM-L2C-310",
1231 .num_lock = 8, 1236 .num_lock = 8,
1232 .of_parse = l2c310_of_parse, 1237 .of_parse = l2c310_of_parse,
1233 .enable = l2c_enable, 1238 .enable = l2c_enable,
@@ -1266,6 +1271,7 @@ static void tauros3_resume(void)
1266} 1271}
1267 1272
1268static const struct l2c_init_data of_tauros3_data __initconst = { 1273static const struct l2c_init_data of_tauros3_data __initconst = {
1274 .type = "Tauros3",
1269 .num_lock = 8, 1275 .num_lock = 8,
1270 .enable = l2c_enable, 1276 .enable = l2c_enable,
1271 .save = tauros3_save, 1277 .save = tauros3_save,