Lines Matching +full:vexpress +full:- +full:sysreg

1 // SPDX-License-Identifier: GPL-2.0-only
16 #include <linux/vexpress.h>
110 vexpress_config_find_prop(node, "arm,vexpress,site", site); in vexpress_config_get_topo()
114 return -EINVAL; in vexpress_config_get_topo()
115 vexpress_config_find_prop(node, "arm,vexpress,position", position); in vexpress_config_get_topo()
116 vexpress_config_find_prop(node, "arm,vexpress,dcc", dcc); in vexpress_config_get_topo()
124 struct vexpress_config_bridge *bridge = dev_get_drvdata(dev->parent); in vexpress_config_devres_release()
127 bridge->ops->regmap_exit(regmap, bridge->context); in vexpress_config_devres_release()
136 bridge = dev_get_drvdata(dev->parent); in devm_regmap_init_vexpress_config()
138 return ERR_PTR(-EINVAL); in devm_regmap_init_vexpress_config()
143 return ERR_PTR(-ENOMEM); in devm_regmap_init_vexpress_config()
145 regmap = (bridge->ops->regmap_init)(dev, bridge->context); in devm_regmap_init_vexpress_config()
161 struct vexpress_syscfg *syscfg = func->syscfg; in vexpress_syscfg_exec()
166 if (WARN_ON(index >= func->num_templates)) in vexpress_syscfg_exec()
167 return -EINVAL; in vexpress_syscfg_exec()
169 command = readl(syscfg->base + SYS_CFGCTRL); in vexpress_syscfg_exec()
171 return -EBUSY; in vexpress_syscfg_exec()
173 command = func->template[index]; in vexpress_syscfg_exec()
181 dev_dbg(syscfg->dev, "func %p, command %x, data %x\n", in vexpress_syscfg_exec()
183 writel(*data, syscfg->base + SYS_CFGDATA); in vexpress_syscfg_exec()
184 writel(0, syscfg->base + SYS_CFGSTAT); in vexpress_syscfg_exec()
185 writel(command, syscfg->base + SYS_CFGCTRL); in vexpress_syscfg_exec()
196 return -EINTR; in vexpress_syscfg_exec()
201 status = readl(syscfg->base + SYS_CFGSTAT); in vexpress_syscfg_exec()
203 return -EFAULT; in vexpress_syscfg_exec()
206 timeout -= 20; in vexpress_syscfg_exec()
207 } while (--tries && !(status & SYS_CFGSTAT_COMPLETE)); in vexpress_syscfg_exec()
209 return -ETIMEDOUT; in vexpress_syscfg_exec()
212 *data = readl(syscfg->base + SYS_CFGDATA); in vexpress_syscfg_exec()
213 dev_dbg(syscfg->dev, "func %p, read data %x\n", func, *data); in vexpress_syscfg_exec()
260 err = vexpress_config_get_topo(dev->of_node, &site, in vexpress_syscfg_regmap_init()
265 prop = of_find_property(dev->of_node, in vexpress_syscfg_regmap_init()
266 "arm,vexpress-sysreg,func", NULL); in vexpress_syscfg_regmap_init()
268 return ERR_PTR(-EINVAL); in vexpress_syscfg_regmap_init()
270 num = prop->length / sizeof(u32) / 2; in vexpress_syscfg_regmap_init()
271 val = prop->value; in vexpress_syscfg_regmap_init()
274 * "arm,vexpress-energy" function used to be described in vexpress_syscfg_regmap_init()
277 if (num == 1 && of_device_is_compatible(dev->of_node, in vexpress_syscfg_regmap_init()
278 "arm,vexpress-energy")) { in vexpress_syscfg_regmap_init()
289 return ERR_PTR(-ENOMEM); in vexpress_syscfg_regmap_init()
291 func->syscfg = syscfg; in vexpress_syscfg_regmap_init()
292 func->num_templates = num; in vexpress_syscfg_regmap_init()
304 func->template[i] = SYS_CFGCTRL_DCC(dcc); in vexpress_syscfg_regmap_init()
305 func->template[i] |= SYS_CFGCTRL_SITE(site); in vexpress_syscfg_regmap_init()
306 func->template[i] |= SYS_CFGCTRL_POSITION(position); in vexpress_syscfg_regmap_init()
307 func->template[i] |= SYS_CFGCTRL_FUNC(function); in vexpress_syscfg_regmap_init()
308 func->template[i] |= SYS_CFGCTRL_DEVICE(device); in vexpress_syscfg_regmap_init()
311 vexpress_syscfg_regmap_config.max_register = num - 1; in vexpress_syscfg_regmap_init()
313 func->regmap = regmap_init(dev, NULL, func, in vexpress_syscfg_regmap_init()
316 if (IS_ERR(func->regmap)) { in vexpress_syscfg_regmap_init()
317 void *err = func->regmap; in vexpress_syscfg_regmap_init()
323 list_add(&func->list, &syscfg->funcs); in vexpress_syscfg_regmap_init()
325 return func->regmap; in vexpress_syscfg_regmap_init()
335 list_for_each_entry_safe(func, tmp, &syscfg->funcs, list) { in vexpress_syscfg_regmap_exit()
336 if (func->regmap == regmap) { in vexpress_syscfg_regmap_exit()
337 list_del(&syscfg->funcs); in vexpress_syscfg_regmap_exit()
358 syscfg = devm_kzalloc(&pdev->dev, sizeof(*syscfg), GFP_KERNEL); in vexpress_syscfg_probe()
360 return -ENOMEM; in vexpress_syscfg_probe()
361 syscfg->dev = &pdev->dev; in vexpress_syscfg_probe()
362 INIT_LIST_HEAD(&syscfg->funcs); in vexpress_syscfg_probe()
364 syscfg->base = devm_platform_ioremap_resource(pdev, 0); in vexpress_syscfg_probe()
365 if (IS_ERR(syscfg->base)) in vexpress_syscfg_probe()
366 return PTR_ERR(syscfg->base); in vexpress_syscfg_probe()
368 bridge = devm_kmalloc(&pdev->dev, sizeof(*bridge), GFP_KERNEL); in vexpress_syscfg_probe()
370 return -ENOMEM; in vexpress_syscfg_probe()
372 bridge->ops = &vexpress_syscfg_bridge_ops; in vexpress_syscfg_probe()
373 bridge->context = syscfg; in vexpress_syscfg_probe()
375 dev_set_drvdata(&pdev->dev, bridge); in vexpress_syscfg_probe()
377 master = readl(syscfg->base + SYS_MISC) & SYS_MISC_MASTERSITE ? in vexpress_syscfg_probe()
383 u32 id = readl(syscfg->base + (master == VEXPRESS_SITE_DB1 ? in vexpress_syscfg_probe()
388 dev_warn(&pdev->dev, "DT HBI (%x) is not matching hardware (%x)!\n", in vexpress_syscfg_probe()
392 for_each_compatible_node(node, NULL, "arm,vexpress,config-bus") { in vexpress_syscfg_probe()
395 bridge_np = of_parse_phandle(node, "arm,vexpress,config-bridge", 0); in vexpress_syscfg_probe()
396 if (bridge_np != pdev->dev.parent->of_node) in vexpress_syscfg_probe()
399 of_platform_populate(node, NULL, NULL, &pdev->dev); in vexpress_syscfg_probe()
406 { "vexpress-syscfg", },
412 .driver.name = "vexpress-syscfg",