Lines Matching refs:pinctrl
314 struct nsp_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctrl_dev); in nsp_get_groups_count() local
316 return pinctrl->num_groups; in nsp_get_groups_count()
322 struct nsp_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctrl_dev); in nsp_get_group_name() local
324 return pinctrl->groups[selector].name; in nsp_get_group_name()
331 struct nsp_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctrl_dev); in nsp_get_group_pins() local
333 *pins = pinctrl->groups[selector].pins; in nsp_get_group_pins()
334 *num_pins = pinctrl->groups[selector].num_pins; in nsp_get_group_pins()
356 struct nsp_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctrl_dev); in nsp_get_functions_count() local
358 return pinctrl->num_functions; in nsp_get_functions_count()
364 struct nsp_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctrl_dev); in nsp_get_function_name() local
366 return pinctrl->functions[selector].name; in nsp_get_function_name()
374 struct nsp_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctrl_dev); in nsp_get_function_groups() local
376 *groups = pinctrl->functions[selector].groups; in nsp_get_function_groups()
377 *num_groups = pinctrl->functions[selector].num_groups; in nsp_get_function_groups()
382 static int nsp_pinmux_set(struct nsp_pinctrl *pinctrl, in nsp_pinmux_set() argument
393 for (i = 0; i < pinctrl->num_groups; i++) { in nsp_pinmux_set()
407 dev_err(pinctrl->dev, in nsp_pinmux_set()
409 dev_err(pinctrl->dev, "func:%s grp:%s\n", in nsp_pinmux_set()
416 if (i == pinctrl->num_groups) in nsp_pinmux_set()
425 base_address = pinctrl->base0; in nsp_pinmux_set()
429 base_address = pinctrl->base1; in nsp_pinmux_set()
433 base_address = pinctrl->base2; in nsp_pinmux_set()
440 spin_lock_irqsave(&pinctrl->lock, flags); in nsp_pinmux_set()
445 spin_unlock_irqrestore(&pinctrl->lock, flags); in nsp_pinmux_set()
453 struct nsp_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctrl_dev); in nsp_pinmux_enable() local
457 if (grp_select >= pinctrl->num_groups || in nsp_pinmux_enable()
458 func_select >= pinctrl->num_functions) in nsp_pinmux_enable()
461 func = &pinctrl->functions[func_select]; in nsp_pinmux_enable()
462 grp = &pinctrl->groups[grp_select]; in nsp_pinmux_enable()
470 return nsp_pinmux_set(pinctrl, func, grp, pinctrl->mux_log); in nsp_pinmux_enable()
478 struct nsp_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctrl_dev); in nsp_gpio_request_enable() local
483 spin_lock_irqsave(&pinctrl->lock, flags); in nsp_gpio_request_enable()
484 val = readl(pinctrl->base0); in nsp_gpio_request_enable()
488 writel(val, pinctrl->base0); in nsp_gpio_request_enable()
490 spin_unlock_irqrestore(&pinctrl->lock, flags); in nsp_gpio_request_enable()
499 struct nsp_pinctrl *pinctrl = pinctrl_dev_get_drvdata(pctrl_dev); in nsp_gpio_disable_free() local
504 spin_lock_irqsave(&pinctrl->lock, flags); in nsp_gpio_disable_free()
505 val = readl(pinctrl->base0); in nsp_gpio_disable_free()
510 writel(val, pinctrl->base0); in nsp_gpio_disable_free()
512 spin_unlock_irqrestore(&pinctrl->lock, flags); in nsp_gpio_disable_free()
530 static int nsp_mux_log_init(struct nsp_pinctrl *pinctrl) in nsp_mux_log_init() argument
536 pinctrl->mux_log = devm_kcalloc(pinctrl->dev, no_of_groups, in nsp_mux_log_init()
539 if (!pinctrl->mux_log) in nsp_mux_log_init()
543 log = &pinctrl->mux_log[i]; in nsp_mux_log_init()
555 struct nsp_pinctrl *pinctrl; in nsp_pinmux_probe() local
561 pinctrl = devm_kzalloc(&pdev->dev, sizeof(*pinctrl), GFP_KERNEL); in nsp_pinmux_probe()
562 if (!pinctrl) in nsp_pinmux_probe()
564 pinctrl->dev = &pdev->dev; in nsp_pinmux_probe()
565 platform_set_drvdata(pdev, pinctrl); in nsp_pinmux_probe()
566 spin_lock_init(&pinctrl->lock); in nsp_pinmux_probe()
568 pinctrl->base0 = devm_platform_ioremap_resource(pdev, 0); in nsp_pinmux_probe()
569 if (IS_ERR(pinctrl->base0)) in nsp_pinmux_probe()
570 return PTR_ERR(pinctrl->base0); in nsp_pinmux_probe()
575 pinctrl->base1 = devm_ioremap(&pdev->dev, res->start, in nsp_pinmux_probe()
577 if (!pinctrl->base1) { in nsp_pinmux_probe()
582 pinctrl->base2 = devm_platform_ioremap_resource(pdev, 2); in nsp_pinmux_probe()
583 if (IS_ERR(pinctrl->base2)) in nsp_pinmux_probe()
584 return PTR_ERR(pinctrl->base2); in nsp_pinmux_probe()
586 ret = nsp_mux_log_init(pinctrl); in nsp_pinmux_probe()
602 pinctrl->groups = nsp_pin_groups; in nsp_pinmux_probe()
603 pinctrl->num_groups = ARRAY_SIZE(nsp_pin_groups); in nsp_pinmux_probe()
604 pinctrl->functions = nsp_pin_functions; in nsp_pinmux_probe()
605 pinctrl->num_functions = ARRAY_SIZE(nsp_pin_functions); in nsp_pinmux_probe()
609 pinctrl->pctl = devm_pinctrl_register(&pdev->dev, &nsp_pinctrl_desc, in nsp_pinmux_probe()
610 pinctrl); in nsp_pinmux_probe()
611 if (IS_ERR(pinctrl->pctl)) { in nsp_pinmux_probe()
613 return PTR_ERR(pinctrl->pctl); in nsp_pinmux_probe()