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 12:47:54 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2014-05-29 19:47:29 -0400
commitc02642bc1010b7ef8a4b87763ab28f5e4ab1d823 (patch)
tree4c65545e7e9b3d158df524d64cb06aae7cfc193d /arch/arm/mm/cache-l2x0.c
parentce84130384badcad2cdbc1e825657d622165f0e6 (diff)
ARM: l2c: rename OF specific things, making l2x0_of_data available to all
Rename a few things to help distinguish their function(s): l2x0_of_data -> l2c_init_data setup -> of_parse add of_ prefix to OF specific data 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.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index 063e1787e8c3..d659c4ca46bb 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -28,6 +28,12 @@
28#include "cache-tauros3.h" 28#include "cache-tauros3.h"
29#include "cache-aurora-l2.h" 29#include "cache-aurora-l2.h"
30 30
31struct l2c_init_data {
32 void (*of_parse)(const struct device_node *, u32 *, u32 *);
33 void (*save)(void);
34 struct outer_cache_fns outer_cache;
35};
36
31#define CACHE_LINE_SIZE 32 37#define CACHE_LINE_SIZE 32
32 38
33static void __iomem *l2x0_base; 39static void __iomem *l2x0_base;
@@ -42,12 +48,6 @@ static u32 cache_id_part_number_from_dt;
42 48
43struct l2x0_regs l2x0_saved_regs; 49struct l2x0_regs l2x0_saved_regs;
44 50
45struct l2x0_of_data {
46 void (*setup)(const struct device_node *, u32 *, u32 *);
47 void (*save)(void);
48 struct outer_cache_fns outer_cache;
49};
50
51static bool of_init = false; 51static bool of_init = false;
52 52
53static inline void cache_wait_way(void __iomem *reg, unsigned long mask) 53static inline void cache_wait_way(void __iomem *reg, unsigned long mask)
@@ -664,7 +664,7 @@ static void bcm_flush_range(unsigned long start, unsigned long end)
664 new_end); 664 new_end);
665} 665}
666 666
667static void __init l2x0_of_setup(const struct device_node *np, 667static void __init l2x0_of_parse(const struct device_node *np,
668 u32 *aux_val, u32 *aux_mask) 668 u32 *aux_val, u32 *aux_mask)
669{ 669{
670 u32 data[2] = { 0, 0 }; 670 u32 data[2] = { 0, 0 };
@@ -698,7 +698,7 @@ static void __init l2x0_of_setup(const struct device_node *np,
698 *aux_mask &= ~mask; 698 *aux_mask &= ~mask;
699} 699}
700 700
701static void __init pl310_of_setup(const struct device_node *np, 701static void __init pl310_of_parse(const struct device_node *np,
702 u32 *aux_val, u32 *aux_mask) 702 u32 *aux_val, u32 *aux_mask)
703{ 703{
704 u32 data[3] = { 0, 0, 0 }; 704 u32 data[3] = { 0, 0, 0 };
@@ -851,7 +851,7 @@ static void __init aurora_broadcast_l2_commands(void)
851 isb(); 851 isb();
852} 852}
853 853
854static void __init aurora_of_setup(const struct device_node *np, 854static void __init aurora_of_parse(const struct device_node *np,
855 u32 *aux_val, u32 *aux_mask) 855 u32 *aux_val, u32 *aux_mask)
856{ 856{
857 u32 val = AURORA_ACR_REPLACEMENT_TYPE_SEMIPLRU; 857 u32 val = AURORA_ACR_REPLACEMENT_TYPE_SEMIPLRU;
@@ -873,8 +873,8 @@ static void __init aurora_of_setup(const struct device_node *np,
873 *aux_mask &= ~mask; 873 *aux_mask &= ~mask;
874} 874}
875 875
876static const struct l2x0_of_data pl310_data __initconst = { 876static const struct l2c_init_data of_pl310_data __initconst = {
877 .setup = pl310_of_setup, 877 .of_parse = pl310_of_parse,
878 .save = pl310_save, 878 .save = pl310_save,
879 .outer_cache = { 879 .outer_cache = {
880 .inv_range = l2x0_inv_range, 880 .inv_range = l2x0_inv_range,
@@ -887,8 +887,8 @@ static const struct l2x0_of_data pl310_data __initconst = {
887 }, 887 },
888}; 888};
889 889
890static const struct l2x0_of_data l2x0_data __initconst = { 890static const struct l2c_init_data of_l2x0_data __initconst = {
891 .setup = l2x0_of_setup, 891 .of_parse = l2x0_of_parse,
892 .outer_cache = { 892 .outer_cache = {
893 .inv_range = l2x0_inv_range, 893 .inv_range = l2x0_inv_range,
894 .clean_range = l2x0_clean_range, 894 .clean_range = l2x0_clean_range,
@@ -900,8 +900,8 @@ static const struct l2x0_of_data l2x0_data __initconst = {
900 }, 900 },
901}; 901};
902 902
903static const struct l2x0_of_data aurora_with_outer_data __initconst = { 903static const struct l2c_init_data of_aurora_with_outer_data __initconst = {
904 .setup = aurora_of_setup, 904 .of_parse = aurora_of_parse,
905 .save = aurora_save, 905 .save = aurora_save,
906 .outer_cache = { 906 .outer_cache = {
907 .inv_range = aurora_inv_range, 907 .inv_range = aurora_inv_range,
@@ -914,15 +914,15 @@ static const struct l2x0_of_data aurora_with_outer_data __initconst = {
914 }, 914 },
915}; 915};
916 916
917static const struct l2x0_of_data aurora_no_outer_data __initconst = { 917static const struct l2c_init_data of_aurora_no_outer_data __initconst = {
918 .setup = aurora_of_setup, 918 .of_parse = aurora_of_parse,
919 .save = aurora_save, 919 .save = aurora_save,
920 .outer_cache = { 920 .outer_cache = {
921 .resume = aurora_resume, 921 .resume = aurora_resume,
922 }, 922 },
923}; 923};
924 924
925static const struct l2x0_of_data tauros3_data __initconst = { 925static const struct l2c_init_data of_tauros3_data __initconst = {
926 .save = tauros3_save, 926 .save = tauros3_save,
927 /* Tauros3 broadcasts L1 cache operations to L2 */ 927 /* Tauros3 broadcasts L1 cache operations to L2 */
928 .outer_cache = { 928 .outer_cache = {
@@ -930,8 +930,8 @@ static const struct l2x0_of_data tauros3_data __initconst = {
930 }, 930 },
931}; 931};
932 932
933static const struct l2x0_of_data bcm_l2x0_data __initconst = { 933static const struct l2c_init_data of_bcm_l2x0_data __initconst = {
934 .setup = pl310_of_setup, 934 .of_parse = pl310_of_parse,
935 .save = pl310_save, 935 .save = pl310_save,
936 .outer_cache = { 936 .outer_cache = {
937 .inv_range = bcm_inv_range, 937 .inv_range = bcm_inv_range,
@@ -946,22 +946,22 @@ static const struct l2x0_of_data bcm_l2x0_data __initconst = {
946 946
947#define L2C_ID(name, fns) { .compatible = name, .data = (void *)&fns } 947#define L2C_ID(name, fns) { .compatible = name, .data = (void *)&fns }
948static const struct of_device_id l2x0_ids[] __initconst = { 948static const struct of_device_id l2x0_ids[] __initconst = {
949 L2C_ID("arm,l210-cache", l2x0_data), 949 L2C_ID("arm,l210-cache", of_l2x0_data),
950 L2C_ID("arm,l220-cache", l2x0_data), 950 L2C_ID("arm,l220-cache", of_l2x0_data),
951 L2C_ID("arm,pl310-cache", pl310_data), 951 L2C_ID("arm,pl310-cache", of_pl310_data),
952 L2C_ID("brcm,bcm11351-a2-pl310-cache", bcm_l2x0_data), 952 L2C_ID("brcm,bcm11351-a2-pl310-cache", of_bcm_l2x0_data),
953 L2C_ID("marvell,aurora-outer-cache", aurora_with_outer_data), 953 L2C_ID("marvell,aurora-outer-cache", of_aurora_with_outer_data),
954 L2C_ID("marvell,aurora-system-cache", aurora_no_outer_data), 954 L2C_ID("marvell,aurora-system-cache", of_aurora_no_outer_data),
955 L2C_ID("marvell,tauros3-cache", tauros3_data), 955 L2C_ID("marvell,tauros3-cache", of_tauros3_data),
956 /* Deprecated IDs */ 956 /* Deprecated IDs */
957 L2C_ID("bcm,bcm11351-a2-pl310-cache", bcm_l2x0_data), 957 L2C_ID("bcm,bcm11351-a2-pl310-cache", of_bcm_l2x0_data),
958 {} 958 {}
959}; 959};
960 960
961int __init l2x0_of_init(u32 aux_val, u32 aux_mask) 961int __init l2x0_of_init(u32 aux_val, u32 aux_mask)
962{ 962{
963 const struct l2c_init_data *data;
963 struct device_node *np; 964 struct device_node *np;
964 const struct l2x0_of_data *data;
965 struct resource res; 965 struct resource res;
966 966
967 np = of_find_matching_node(NULL, l2x0_ids); 967 np = of_find_matching_node(NULL, l2x0_ids);
@@ -981,12 +981,12 @@ int __init l2x0_of_init(u32 aux_val, u32 aux_mask)
981 981
982 /* L2 configuration can only be changed if the cache is disabled */ 982 /* L2 configuration can only be changed if the cache is disabled */
983 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN)) { 983 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN)) {
984 if (data->setup) 984 if (data->of_parse)
985 data->setup(np, &aux_val, &aux_mask); 985 data->of_parse(np, &aux_val, &aux_mask);
986 986
987 /* For aurora cache in no outer mode select the 987 /* For aurora cache in no outer mode select the
988 * correct mode using the coprocessor*/ 988 * correct mode using the coprocessor*/
989 if (data == &aurora_no_outer_data) 989 if (data == &of_aurora_no_outer_data)
990 aurora_broadcast_l2_commands(); 990 aurora_broadcast_l2_commands();
991 } 991 }
992 992