struct sysmmu_drvdata *drvdata)
{
const char *props_name = "sysmmu,tlb_property";
+ const char *slot_props_name = "sysmmu,slot_property";
struct tlb_props *tlb_props = &drvdata->tlb_props;
struct tlb_port_cfg *port_cfg = NULL;
+ unsigned int *slot_cfg = NULL;
int i, cnt, ret;
int port_id_cnt = 0;
+ cnt = of_property_count_u32_elems(sysmmu->of_node, slot_props_name);
+ if (cnt > 0) {
+ slot_cfg = kzalloc(sizeof(*slot_cfg) * cnt, GFP_KERNEL);
+ if (!slot_cfg)
+ return -ENOMEM;
+
+ for (i = 0; i < cnt; i++) {
+ ret = of_property_read_u32_index(sysmmu->of_node,
+ slot_props_name, i, &slot_cfg[i]);
+ if (ret) {
+ dev_err(sysmmu, "failed to get slot property."
+ "cnt = %d, ret = %d\n", i, ret);
+ ret = -EINVAL;
+ goto err_slot_prop;
+ }
+ }
+
+ tlb_props->port_props.slot_cnt = cnt;
+ tlb_props->port_props.slot_cfg = slot_cfg;
+ }
+
cnt = of_property_count_u32_elems(sysmmu->of_node, props_name);
if (!cnt || cnt < 0) {
dev_info(sysmmu, "No TLB port propeties found.\n");
}
port_cfg = kzalloc(sizeof(*port_cfg) * (cnt/2), GFP_KERNEL);
- if (!port_cfg)
- return -ENOMEM;
+ if (!port_cfg) {
+ ret = -ENOMEM;
+ goto err_slot_prop;
+ }
for (i = 0; i < cnt; i+=2) {
ret = of_property_read_u32_index(sysmmu->of_node,
err_port_prop:
kfree(port_cfg);
+err_slot_prop:
+ kfree(slot_cfg);
+
return ret;
}
struct tlb_props *tlb_props = &drvdata->tlb_props;
unsigned int i;
int port_id_cnt = tlb_props->port_props.port_id_cnt;
+ int slot_cnt = tlb_props->port_props.slot_cnt;
if (port_id_cnt > tlb_num) {
dev_warn(drvdata->sysmmu,
for (i = 0; i < port_id_cnt; i++)
__sysmmu_set_tlb_port(drvdata, i);
+
+ for (i = 0; i < slot_cnt; i++)
+ writel_relaxed(tlb_props->port_props.slot_cfg[i],
+ drvdata->sfrbase + REG_SLOT_RSV(i));
}
static void __sysmmu_init_config(struct sysmmu_drvdata *drvdata)
#define REG_CAPA1_SBB_VPN 0x8024
#define REG_CAPA1_SBB_LINK 0x8028
#define REG_CAPA1_SBB_ATTR 0x802C
+#define REG_SLOT_RSV(n) (0x4000 + ((n) * 0x20))
#define MMU_CAPA1_SET_TLB_READ_ENTRY(tid, set, way, line) \
((set) | ((way) << 8) | ((line) << 16) | ((tid) << 20))
#define MMU_TLB_CFG_MASK(reg) ((reg) & ((0x7 << 5) | (0x3 << 2) | (0x1 << 1)))
struct tlb_port_props {
int port_id_cnt;
+ int slot_cnt;
struct tlb_port_cfg *port_cfg;
+ unsigned int *slot_cfg;
};
struct tlb_props {