| @@ -956,7 +956,7 @@ static u32 cache_id_part_number_from_dt; · 955 unmodified lines |
| 956 | * @associativity: variable to return the calculated associativity in | 956 | * @associativity: variable to return the calculated associativity in |
| 957 | * @max_way_size: the maximum size in bytes for the cache ways | 957 | * @max_way_size: the maximum size in bytes for the cache ways |
| 958 | */ | 958 | */ |
| 959 | static void __init l2x0_cache_size_of_parse(const struct device_node *np, | 959 | static int __init l2x0_cache_size_of_parse(const struct device_node *np, |
| 960 | u32 *aux_val, u32 *aux_mask, | 960 | u32 *aux_val, u32 *aux_mask, |
| 961 | u32 *associativity, | 961 | u32 *associativity, |
| 962 | u32 max_way_size) | 962 | u32 max_way_size) |
| @@ -974,7 +974,7 @@ static void __init l2x0_cache_size_of_parse(const struct device_node *np, · 11 unmodified lines |
| 974 | of_property_read_u32(np, "cache-line-size", &line_size); | 974 | of_property_read_u32(np, "cache-line-size", &line_size); |
| 975 | | 975 | |
| 976 | if (!cache_size || !sets) | 976 | if (!cache_size || !sets) |
| 977 | return; | 977 | return -ENODEV; |
| 978 | | 978 | |
| 979 | /* All these l2 caches have the same line = block size actually */ | 979 | /* All these l2 caches have the same line = block size actually */ |
| 980 | if (!line_size) { | 980 | if (!line_size) { |
| @@ -1009,7 +1009,7 @@ static void __init l2x0_cache_size_of_parse(const struct device_node *np, · 28 unmodified lines |
| 1009 | | 1009 | |
| 1010 | if (way_size > max_way_size) { | 1010 | if (way_size > max_way_size) { |
| 1011 | pr_err("L2C OF: set size %dKB is too large\n", way_size); | 1011 | pr_err("L2C OF: set size %dKB is too large\n", way_size); |
| 1012 | return; | 1012 | return -EINVAL; |
| 1013 | } | 1013 | } |
| 1014 | | 1014 | |
| 1015 | pr_info("L2C OF: override cache size: %d bytes (%dKB)\n", | 1015 | pr_info("L2C OF: override cache size: %d bytes (%dKB)\n", |
| @@ -1027,7 +1027,7 @@ static void __init l2x0_cache_size_of_parse(const struct device_node *np, · 11 unmodified lines |
| 1027 | if (way_size_bits < 1 || way_size_bits > 6) { | 1027 | if (way_size_bits < 1 || way_size_bits > 6) { |
| 1028 | pr_err("L2C OF: cache way size illegal: %dKB is not mapped\n", | 1028 | pr_err("L2C OF: cache way size illegal: %dKB is not mapped\n", |
| 1029 | way_size); | 1029 | way_size); |
| 1030 | return; | 1030 | return -EINVAL; |
| 1031 | } | 1031 | } |
| 1032 | | 1032 | |
| 1033 | mask |= L2C_AUX_CTRL_WAY_SIZE_MASK; | 1033 | mask |= L2C_AUX_CTRL_WAY_SIZE_MASK; |
| @@ -1036,6 +1036,8 @@ static void __init l2x0_cache_size_of_parse(const struct device_node *np, · 2 unmodified lines |
| 1036 | *aux_val &= ~mask; | 1036 | *aux_val &= ~mask; |
| 1037 | *aux_val |= val; | 1037 | *aux_val |= val; |
| 1038 | *aux_mask &= ~mask; | 1038 | *aux_mask &= ~mask; |
| | 1039 | |
| | 1040 | return 0; |
| 1039 | } | 1041 | } |
| 1040 | | 1042 | |
| 1041 | static void __init l2x0_of_parse(const struct device_node *np, | 1043 | static void __init l2x0_of_parse(const struct device_node *np, |
| @@ -1046,6 +1048,7 @@ static void __init l2x0_of_parse(const struct device_node *np, · 4 unmodified lines |
| 1046 | u32 dirty = 0; | 1048 | u32 dirty = 0; |
| 1047 | u32 val = 0, mask = 0; | 1049 | u32 val = 0, mask = 0; |
| 1048 | u32 assoc; | 1050 | u32 assoc; |
| | 1051 | int ret; |
| 1049 | | 1052 | |
| 1050 | of_property_read_u32(np, "arm,tag-latency", &tag); | 1053 | of_property_read_u32(np, "arm,tag-latency", &tag); |
| 1051 | if (tag) { | 1054 | if (tag) { |
| @@ -1068,7 +1071,10 @@ static void __init l2x0_of_parse(const struct device_node *np, · 16 unmodified lines |
| 1068 | val |= (dirty - 1) << L2X0_AUX_CTRL_DIRTY_LATENCY_SHIFT; | 1071 | val |= (dirty - 1) << L2X0_AUX_CTRL_DIRTY_LATENCY_SHIFT; |
| 1069 | } | 1072 | } |
| 1070 | | 1073 | |
| 1071 | l2x0_cache_size_of_parse(np, aux_val, aux_mask, &assoc, SZ_256K); | 1074 | ret = l2x0_cache_size_of_parse(np, aux_val, aux_mask, &assoc, SZ_256K); |
| | 1075 | if (ret) |
| | 1076 | return; |
| | 1077 | |
| 1072 | if (assoc > 8) { | 1078 | if (assoc > 8) { |
| 1073 | pr_err("l2x0 of: cache setting yield too high associativity\n"); | 1079 | pr_err("l2x0 of: cache setting yield too high associativity\n"); |
| 1074 | pr_err("l2x0 of: %d calculated, max 8\n", assoc); | 1080 | pr_err("l2x0 of: %d calculated, max 8\n", assoc); |
| @@ -1125,6 +1131,7 @@ static void __init l2c310_of_parse(const struct device_node *np, · 50 unmodified lines |
| 1125 | u32 tag[3] = { 0, 0, 0 }; | 1131 | u32 tag[3] = { 0, 0, 0 }; |
| 1126 | u32 filter[2] = { 0, 0 }; | 1132 | u32 filter[2] = { 0, 0 }; |
| 1127 | u32 assoc; | 1133 | u32 assoc; |
| | 1134 | int ret; |
| 1128 | | 1135 | |
| 1129 | of_property_read_u32_array(np, "arm,tag-latency", tag, ARRAY_SIZE(tag)); | 1136 | of_property_read_u32_array(np, "arm,tag-latency", tag, ARRAY_SIZE(tag)); |
| 1130 | if (tag[0] && tag[1] && tag[2]) | 1137 | if (tag[0] && tag[1] && tag[2]) |
| @@ -1152,7 +1159,10 @@ static void __init l2c310_of_parse(const struct device_node *np, · 21 unmodified lines |
| 1152 | l2x0_base + L310_ADDR_FILTER_START); | 1159 | l2x0_base + L310_ADDR_FILTER_START); |
| 1153 | } | 1160 | } |
| 1154 | | 1161 | |
| 1155 | l2x0_cache_size_of_parse(np, aux_val, aux_mask, &assoc, SZ_512K); | 1162 | ret = l2x0_cache_size_of_parse(np, aux_val, aux_mask, &assoc, SZ_512K); |
| | 1163 | if (ret) |
| | 1164 | return; |
| | 1165 | |
| 1156 | switch (assoc) { | 1166 | switch (assoc) { |
| 1157 | case 16: | 1167 | case 16: |
| 1158 | *aux_val &= ~L2X0_AUX_CTRL_ASSOC_MASK; | 1168 | *aux_val &= ~L2X0_AUX_CTRL_ASSOC_MASK; |
| @@ -1164,8 +1174,8 @@ static void __init l2c310_of_parse(const struct device_node *np, · 5 unmodified lines |
| 1164 | *aux_mask &= ~L2X0_AUX_CTRL_ASSOC_MASK; | 1174 | *aux_mask &= ~L2X0_AUX_CTRL_ASSOC_MASK; |
| 1165 | break; | 1175 | break; |
| 1166 | default: | 1176 | default: |
| 1167 | pr_err("PL310 OF: cache setting yield illegal associativity\n"); | 1177 | pr_err("L2C-310 OF cache associativity %d invalid, only 8 or 16 permitted\n", |
| 1168 | pr_err("PL310 OF: %d calculated, only 8 and 16 legal\n", assoc); | 1178 | assoc); |
| 1169 | break; | 1179 | break; |
| 1170 | } | 1180 | } |
| 1171 | } | 1181 | } |