Lines Matching full:l2
8 * Baikal-T1 CM2 L2-cache Control Block driver.
38 * struct l2_ctl - Baikal-T1 L2 Control block private data.
49 * enum l2_ctl_stall - Baikal-T1 L2-cache-RAM stall identifier.
61 * struct l2_ctl_device_attribute - Baikal-T1 L2-cache device attribute.
63 * @id: L2-cache stall field identifier.
77 static int l2_ctl_get_latency(struct l2_ctl *l2, enum l2_ctl_stall id, u32 *val) in l2_ctl_get_latency() argument
82 ret = regmap_read(l2->sys_regs, L2_CTL_REG, &data); in l2_ctl_get_latency()
103 static int l2_ctl_set_latency(struct l2_ctl *l2, enum l2_ctl_stall id, u32 val) in l2_ctl_set_latency() argument
130 ret = regmap_update_bits(l2->sys_regs, L2_CTL_REG, mask, data); in l2_ctl_set_latency()
134 return regmap_read_poll_timeout(l2->sys_regs, L2_CTL_REG, data, in l2_ctl_set_latency()
142 struct l2_ctl *l2 = data; in l2_ctl_clear_data() local
143 struct platform_device *pdev = to_platform_device(l2->dev); in l2_ctl_clear_data()
151 struct l2_ctl *l2; in l2_ctl_create_data() local
154 l2 = devm_kzalloc(dev, sizeof(*l2), GFP_KERNEL); in l2_ctl_create_data()
155 if (!l2) in l2_ctl_create_data()
158 ret = devm_add_action(dev, l2_ctl_clear_data, l2); in l2_ctl_create_data()
160 dev_err(dev, "Can't add L2 CTL data clear action\n"); in l2_ctl_create_data()
164 l2->dev = dev; in l2_ctl_create_data()
165 platform_set_drvdata(pdev, l2); in l2_ctl_create_data()
167 return l2; in l2_ctl_create_data()
170 static int l2_ctl_find_sys_regs(struct l2_ctl *l2) in l2_ctl_find_sys_regs() argument
172 l2->sys_regs = syscon_node_to_regmap(l2->dev->of_node->parent); in l2_ctl_find_sys_regs()
173 if (IS_ERR(l2->sys_regs)) { in l2_ctl_find_sys_regs()
174 dev_err(l2->dev, "Couldn't get L2 CTL register map\n"); in l2_ctl_find_sys_regs()
175 return PTR_ERR(l2->sys_regs); in l2_ctl_find_sys_regs()
181 static int l2_ctl_of_parse_property(struct l2_ctl *l2, enum l2_ctl_stall id, in l2_ctl_of_parse_property() argument
187 if (!of_property_read_u32(l2->dev->of_node, propname, &data)) { in l2_ctl_of_parse_property()
188 ret = l2_ctl_set_latency(l2, id, data); in l2_ctl_of_parse_property()
190 dev_err(l2->dev, "Invalid value of '%s'\n", propname); in l2_ctl_of_parse_property()
196 static int l2_ctl_of_parse(struct l2_ctl *l2) in l2_ctl_of_parse() argument
200 ret = l2_ctl_of_parse_property(l2, L2_WS_STALL, "baikal,l2-ws-latency"); in l2_ctl_of_parse()
204 ret = l2_ctl_of_parse_property(l2, L2_TAG_STALL, "baikal,l2-tag-latency"); in l2_ctl_of_parse()
208 return l2_ctl_of_parse_property(l2, L2_DATA_STALL, in l2_ctl_of_parse()
209 "baikal,l2-data-latency"); in l2_ctl_of_parse()
217 struct l2_ctl *l2 = dev_get_drvdata(dev); in l2_ctl_latency_show() local
221 ret = l2_ctl_get_latency(l2, devattr->id, &data); in l2_ctl_latency_show()
233 struct l2_ctl *l2 = dev_get_drvdata(dev); in l2_ctl_latency_store() local
240 ret = l2_ctl_set_latency(l2, devattr->id, data); in l2_ctl_latency_store()
261 struct l2_ctl *l2 = data; in l2_ctl_remove_sysfs() local
263 device_remove_groups(l2->dev, l2_ctl_sysfs_groups); in l2_ctl_remove_sysfs()
266 static int l2_ctl_init_sysfs(struct l2_ctl *l2) in l2_ctl_init_sysfs() argument
270 ret = device_add_groups(l2->dev, l2_ctl_sysfs_groups); in l2_ctl_init_sysfs()
272 dev_err(l2->dev, "Failed to create L2 CTL sysfs nodes\n"); in l2_ctl_init_sysfs()
276 ret = devm_add_action_or_reset(l2->dev, l2_ctl_remove_sysfs, l2); in l2_ctl_init_sysfs()
278 dev_err(l2->dev, "Can't add L2 CTL sysfs remove action\n"); in l2_ctl_init_sysfs()
285 struct l2_ctl *l2; in l2_ctl_probe() local
288 l2 = l2_ctl_create_data(pdev); in l2_ctl_probe()
289 if (IS_ERR(l2)) in l2_ctl_probe()
290 return PTR_ERR(l2); in l2_ctl_probe()
292 ret = l2_ctl_find_sys_regs(l2); in l2_ctl_probe()
296 ret = l2_ctl_of_parse(l2); in l2_ctl_probe()
300 ret = l2_ctl_init_sysfs(l2); in l2_ctl_probe()
308 { .compatible = "baikal,bt1-l2-ctl" },
316 .name = "bt1-l2-ctl",
323 MODULE_DESCRIPTION("Baikal-T1 L2-cache driver");