#include "cache-tauros3.h"
#include "cache-aurora-l2.h"
+struct l2c_init_data {
+ void (*of_parse)(const struct device_node *, u32 *, u32 *);
+ void (*save)(void);
+ struct outer_cache_fns outer_cache;
+};
+
#define CACHE_LINE_SIZE 32
static void __iomem *l2x0_base;
struct l2x0_regs l2x0_saved_regs;
-struct l2x0_of_data {
- void (*setup)(const struct device_node *, u32 *, u32 *);
- void (*save)(void);
- struct outer_cache_fns outer_cache;
-};
-
static bool of_init = false;
static inline void cache_wait_way(void __iomem *reg, unsigned long mask)
new_end);
}
-static void __init l2x0_of_setup(const struct device_node *np,
+static void __init l2x0_of_parse(const struct device_node *np,
u32 *aux_val, u32 *aux_mask)
{
u32 data[2] = { 0, 0 };
*aux_mask &= ~mask;
}
-static void __init pl310_of_setup(const struct device_node *np,
+static void __init pl310_of_parse(const struct device_node *np,
u32 *aux_val, u32 *aux_mask)
{
u32 data[3] = { 0, 0, 0 };
isb();
}
-static void __init aurora_of_setup(const struct device_node *np,
+static void __init aurora_of_parse(const struct device_node *np,
u32 *aux_val, u32 *aux_mask)
{
u32 val = AURORA_ACR_REPLACEMENT_TYPE_SEMIPLRU;
*aux_mask &= ~mask;
}
-static const struct l2x0_of_data pl310_data __initconst = {
- .setup = pl310_of_setup,
+static const struct l2c_init_data of_pl310_data __initconst = {
+ .of_parse = pl310_of_parse,
.save = pl310_save,
.outer_cache = {
.inv_range = l2x0_inv_range,
},
};
-static const struct l2x0_of_data l2x0_data __initconst = {
- .setup = l2x0_of_setup,
+static const struct l2c_init_data of_l2x0_data __initconst = {
+ .of_parse = l2x0_of_parse,
.outer_cache = {
.inv_range = l2x0_inv_range,
.clean_range = l2x0_clean_range,
},
};
-static const struct l2x0_of_data aurora_with_outer_data __initconst = {
- .setup = aurora_of_setup,
+static const struct l2c_init_data of_aurora_with_outer_data __initconst = {
+ .of_parse = aurora_of_parse,
.save = aurora_save,
.outer_cache = {
.inv_range = aurora_inv_range,
},
};
-static const struct l2x0_of_data aurora_no_outer_data __initconst = {
- .setup = aurora_of_setup,
+static const struct l2c_init_data of_aurora_no_outer_data __initconst = {
+ .of_parse = aurora_of_parse,
.save = aurora_save,
.outer_cache = {
.resume = aurora_resume,
},
};
-static const struct l2x0_of_data tauros3_data __initconst = {
+static const struct l2c_init_data of_tauros3_data __initconst = {
.save = tauros3_save,
/* Tauros3 broadcasts L1 cache operations to L2 */
.outer_cache = {
},
};
-static const struct l2x0_of_data bcm_l2x0_data __initconst = {
- .setup = pl310_of_setup,
+static const struct l2c_init_data of_bcm_l2x0_data __initconst = {
+ .of_parse = pl310_of_parse,
.save = pl310_save,
.outer_cache = {
.inv_range = bcm_inv_range,
#define L2C_ID(name, fns) { .compatible = name, .data = (void *)&fns }
static const struct of_device_id l2x0_ids[] __initconst = {
- L2C_ID("arm,l210-cache", l2x0_data),
- L2C_ID("arm,l220-cache", l2x0_data),
- L2C_ID("arm,pl310-cache", pl310_data),
- L2C_ID("brcm,bcm11351-a2-pl310-cache", bcm_l2x0_data),
- L2C_ID("marvell,aurora-outer-cache", aurora_with_outer_data),
- L2C_ID("marvell,aurora-system-cache", aurora_no_outer_data),
- L2C_ID("marvell,tauros3-cache", tauros3_data),
+ L2C_ID("arm,l210-cache", of_l2x0_data),
+ L2C_ID("arm,l220-cache", of_l2x0_data),
+ L2C_ID("arm,pl310-cache", of_pl310_data),
+ L2C_ID("brcm,bcm11351-a2-pl310-cache", of_bcm_l2x0_data),
+ L2C_ID("marvell,aurora-outer-cache", of_aurora_with_outer_data),
+ L2C_ID("marvell,aurora-system-cache", of_aurora_no_outer_data),
+ L2C_ID("marvell,tauros3-cache", of_tauros3_data),
/* Deprecated IDs */
- L2C_ID("bcm,bcm11351-a2-pl310-cache", bcm_l2x0_data),
+ L2C_ID("bcm,bcm11351-a2-pl310-cache", of_bcm_l2x0_data),
{}
};
int __init l2x0_of_init(u32 aux_val, u32 aux_mask)
{
+ const struct l2c_init_data *data;
struct device_node *np;
- const struct l2x0_of_data *data;
struct resource res;
np = of_find_matching_node(NULL, l2x0_ids);
/* L2 configuration can only be changed if the cache is disabled */
if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN)) {
- if (data->setup)
- data->setup(np, &aux_val, &aux_mask);
+ if (data->of_parse)
+ data->of_parse(np, &aux_val, &aux_mask);
/* For aurora cache in no outer mode select the
* correct mode using the coprocessor*/
- if (data == &aurora_no_outer_data)
+ if (data == &of_aurora_no_outer_data)
aurora_broadcast_l2_commands();
}