Lines Matching +full:pctl +full:- +full:regmap

8  * - U300 Pinctl drivers
9 * - Tegra Pinctl drivers
29 #include "pinctrl-spear.h"
31 #define DRIVER_NAME "spear-pinmux"
42 val = pmx_readl(pmx, muxreg->reg); in muxregs_endisable()
43 val &= ~muxreg->mask; in muxregs_endisable()
46 temp = muxreg->val; in muxregs_endisable()
48 temp = ~muxreg->val; in muxregs_endisable()
50 val |= muxreg->mask & temp; in muxregs_endisable()
51 pmx_writel(pmx, val, muxreg->reg); in muxregs_endisable()
61 if (!pmx->machdata->pmx_modes || !pmx->machdata->npmx_modes) in set_mode()
62 return -EINVAL; in set_mode()
64 for (i = 0; i < pmx->machdata->npmx_modes; i++) { in set_mode()
65 if (pmx->machdata->pmx_modes[i]->mode == (1 << mode)) { in set_mode()
66 pmx_mode = pmx->machdata->pmx_modes[i]; in set_mode()
72 return -EINVAL; in set_mode()
74 val = pmx_readl(pmx, pmx_mode->reg); in set_mode()
75 val &= ~pmx_mode->mask; in set_mode()
76 val |= pmx_mode->val; in set_mode()
77 pmx_writel(pmx, val, pmx_mode->reg); in set_mode()
79 pmx->machdata->mode = pmx_mode->mode; in set_mode()
80 dev_info(pmx->dev, "Configured Mode: %s with id: %x\n\n", in set_mode()
81 pmx_mode->name ? pmx_mode->name : "no_name", in set_mode()
82 pmx_mode->reg); in set_mode()
103 for (group = 0; group < machdata->ngroups; group++) { in pmx_init_addr()
104 pgroup = machdata->groups[group]; in pmx_init_addr()
106 for (i = 0; i < pgroup->nmodemuxs; i++) { in pmx_init_addr()
107 modemux = &pgroup->modemuxs[i]; in pmx_init_addr()
109 for (j = 0; j < modemux->nmuxregs; j++) in pmx_init_addr()
110 if (modemux->muxregs[j].reg == 0xFFFF) in pmx_init_addr()
111 modemux->muxregs[j].reg = reg; in pmx_init_addr()
120 return pmx->machdata->ngroups; in spear_pinctrl_get_groups_cnt()
128 return pmx->machdata->groups[group]->name; in spear_pinctrl_get_group_name()
136 *pins = pmx->machdata->groups[group]->pins; in spear_pinctrl_get_group_pins()
137 *num_pins = pmx->machdata->groups[group]->npins; in spear_pinctrl_get_group_pins()
177 dev_err(pmx->dev, "No child nodes passed via DT\n"); in spear_pinctrl_dt_node_to_map()
178 return -ENODEV; in spear_pinctrl_dt_node_to_map()
183 return -ENOMEM; in spear_pinctrl_dt_node_to_map()
220 return pmx->machdata->nfunctions; in spear_pinctrl_get_funcs_count()
228 return pmx->machdata->functions[function]->name; in spear_pinctrl_get_func_name()
237 *groups = pmx->machdata->functions[function]->groups; in spear_pinctrl_get_func_groups()
238 *ngroups = pmx->machdata->functions[function]->ngroups; in spear_pinctrl_get_func_groups()
252 pgroup = pmx->machdata->groups[group]; in spear_pinctrl_endisable()
254 for (i = 0; i < pgroup->nmodemuxs; i++) { in spear_pinctrl_endisable()
255 modemux = &pgroup->modemuxs[i]; in spear_pinctrl_endisable()
258 if (pmx->machdata->modes_supported) { in spear_pinctrl_endisable()
259 if (!(pmx->machdata->mode & modemux->modes)) in spear_pinctrl_endisable()
264 muxregs_endisable(pmx, modemux->muxregs, modemux->nmuxregs, in spear_pinctrl_endisable()
269 dev_err(pmx->dev, "pinmux group: %s not supported\n", in spear_pinctrl_endisable()
270 pgroup->name); in spear_pinctrl_endisable()
271 return -ENODEV; in spear_pinctrl_endisable()
290 if (!pmx->machdata->gpio_pingroups) in get_gpio_pingroup()
293 for (i = 0; i < pmx->machdata->ngpio_pingroups; i++) { in get_gpio_pingroup()
294 gpio_pingroup = &pmx->machdata->gpio_pingroups[i]; in get_gpio_pingroup()
296 for (j = 0; j < gpio_pingroup->npins; j++) { in get_gpio_pingroup()
297 if (gpio_pingroup->pins[j] == pin) in get_gpio_pingroup()
309 struct spear_pinctrl_machdata *machdata = pmx->machdata; in gpio_request_endisable()
318 muxregs_endisable(pmx, gpio_pingroup->muxregs, in gpio_request_endisable()
319 gpio_pingroup->nmuxregs, enable); in gpio_request_endisable()
325 if (machdata->gpio_request_endisable) in gpio_request_endisable()
326 machdata->gpio_request_endisable(pmx, offset, enable); in gpio_request_endisable()
362 struct device_node *np = pdev->dev.of_node; in spear_pinctrl_probe()
366 return -ENODEV; in spear_pinctrl_probe()
368 pmx = devm_kzalloc(&pdev->dev, sizeof(*pmx), GFP_KERNEL); in spear_pinctrl_probe()
370 return -ENOMEM; in spear_pinctrl_probe()
372 pmx->regmap = device_node_to_regmap(np); in spear_pinctrl_probe()
373 if (IS_ERR(pmx->regmap)) { in spear_pinctrl_probe()
374 dev_err(&pdev->dev, "Init regmap failed (%pe).\n", in spear_pinctrl_probe()
375 pmx->regmap); in spear_pinctrl_probe()
376 return PTR_ERR(pmx->regmap); in spear_pinctrl_probe()
379 pmx->dev = &pdev->dev; in spear_pinctrl_probe()
380 pmx->machdata = machdata; in spear_pinctrl_probe()
383 if (machdata->modes_supported) { in spear_pinctrl_probe()
386 if (of_property_read_u32(np, "st,pinmux-mode", &mode)) { in spear_pinctrl_probe()
387 dev_err(&pdev->dev, "OF: pinmux mode not passed\n"); in spear_pinctrl_probe()
388 return -EINVAL; in spear_pinctrl_probe()
392 dev_err(&pdev->dev, "OF: Couldn't configure mode: %x\n", in spear_pinctrl_probe()
394 return -EINVAL; in spear_pinctrl_probe()
400 spear_pinctrl_desc.pins = machdata->pins; in spear_pinctrl_probe()
401 spear_pinctrl_desc.npins = machdata->npins; in spear_pinctrl_probe()
403 pmx->pctl = devm_pinctrl_register(&pdev->dev, &spear_pinctrl_desc, pmx); in spear_pinctrl_probe()
404 if (IS_ERR(pmx->pctl)) { in spear_pinctrl_probe()
405 dev_err(&pdev->dev, "Couldn't register pinctrl driver\n"); in spear_pinctrl_probe()
406 return PTR_ERR(pmx->pctl); in spear_pinctrl_probe()