Lines Matching refs:pmx

243 static inline u32 pmx_read(struct tz1090_pdc_pmx *pmx, u32 reg)  in pmx_read()  argument
245 return ioread32(pmx->regs + reg); in pmx_read()
248 static inline void pmx_write(struct tz1090_pdc_pmx *pmx, u32 val, u32 reg) in pmx_write() argument
250 iowrite32(val, pmx->regs + reg); in pmx_write()
531 static void tz1090_pdc_pinctrl_mux(struct tz1090_pdc_pmx *pmx, in tz1090_pdc_pinctrl_mux() argument
539 select = ((pmx->mux_en & ~pmx->gpio_en) >> pin_shift) & 1; in tz1090_pdc_pinctrl_mux()
543 reg = pmx_read(pmx, grp->reg); in tz1090_pdc_pinctrl_mux()
546 pmx_write(pmx, reg, grp->reg); in tz1090_pdc_pinctrl_mux()
554 struct tz1090_pdc_pmx *pmx = pinctrl_dev_get_drvdata(pctldev); in tz1090_pdc_pinctrl_set_mux() local
571 spin_lock(&pmx->lock); in tz1090_pdc_pinctrl_set_mux()
572 pmx->mux_en |= BIT(grp->pins[0]); in tz1090_pdc_pinctrl_set_mux()
573 tz1090_pdc_pinctrl_mux(pmx, grp); in tz1090_pdc_pinctrl_set_mux()
574 spin_unlock(&pmx->lock); in tz1090_pdc_pinctrl_set_mux()
579 struct tz1090_pdc_pmx *pmx, in find_mux_group() argument
604 struct tz1090_pdc_pmx *pmx = pinctrl_dev_get_drvdata(pctldev); in tz1090_pdc_pinctrl_gpio_request_enable() local
605 const struct tz1090_pdc_pingroup *grp = find_mux_group(pmx, pin); in tz1090_pdc_pinctrl_gpio_request_enable()
609 spin_lock(&pmx->lock); in tz1090_pdc_pinctrl_gpio_request_enable()
610 pmx->gpio_en |= BIT(pin); in tz1090_pdc_pinctrl_gpio_request_enable()
611 tz1090_pdc_pinctrl_mux(pmx, grp); in tz1090_pdc_pinctrl_gpio_request_enable()
612 spin_unlock(&pmx->lock); in tz1090_pdc_pinctrl_gpio_request_enable()
622 struct tz1090_pdc_pmx *pmx = pinctrl_dev_get_drvdata(pctldev); in tz1090_pdc_pinctrl_gpio_disable_free() local
623 const struct tz1090_pdc_pingroup *grp = find_mux_group(pmx, pin); in tz1090_pdc_pinctrl_gpio_disable_free()
627 spin_lock(&pmx->lock); in tz1090_pdc_pinctrl_gpio_disable_free()
628 pmx->gpio_en &= ~BIT(pin); in tz1090_pdc_pinctrl_gpio_disable_free()
629 tz1090_pdc_pinctrl_mux(pmx, grp); in tz1090_pdc_pinctrl_gpio_disable_free()
630 spin_unlock(&pmx->lock); in tz1090_pdc_pinctrl_gpio_disable_free()
687 struct tz1090_pdc_pmx *pmx = pinctrl_dev_get_drvdata(pctldev); in tz1090_pdc_pinconf_get() local
699 tmp = pmx_read(pmx, reg); in tz1090_pdc_pinconf_get()
716 struct tz1090_pdc_pmx *pmx = pinctrl_dev_get_drvdata(pctldev); in tz1090_pdc_pinconf_set() local
746 tmp = pmx_read(pmx, reg); in tz1090_pdc_pinconf_set()
750 pmx_write(pmx, tmp, reg); in tz1090_pdc_pinconf_set()
816 struct tz1090_pdc_pmx *pmx = pinctrl_dev_get_drvdata(pctldev); in tz1090_pdc_pinconf_group_get() local
830 val = pmx_read(pmx, reg); in tz1090_pdc_pinconf_group_get()
846 struct tz1090_pdc_pmx *pmx = pinctrl_dev_get_drvdata(pctldev); in tz1090_pdc_pinconf_group_set() local
888 val = pmx_read(pmx, reg); in tz1090_pdc_pinconf_group_set()
891 pmx_write(pmx, val, reg); in tz1090_pdc_pinconf_group_set()
930 struct tz1090_pdc_pmx *pmx; in tz1090_pdc_pinctrl_probe() local
933 pmx = devm_kzalloc(&pdev->dev, sizeof(*pmx), GFP_KERNEL); in tz1090_pdc_pinctrl_probe()
934 if (!pmx) { in tz1090_pdc_pinctrl_probe()
938 pmx->dev = &pdev->dev; in tz1090_pdc_pinctrl_probe()
939 spin_lock_init(&pmx->lock); in tz1090_pdc_pinctrl_probe()
946 pmx->regs = devm_ioremap_resource(&pdev->dev, res); in tz1090_pdc_pinctrl_probe()
947 if (IS_ERR(pmx->regs)) in tz1090_pdc_pinctrl_probe()
948 return PTR_ERR(pmx->regs); in tz1090_pdc_pinctrl_probe()
950 pmx->pctl = pinctrl_register(&tz1090_pdc_pinctrl_desc, &pdev->dev, pmx); in tz1090_pdc_pinctrl_probe()
951 if (!pmx->pctl) { in tz1090_pdc_pinctrl_probe()
956 platform_set_drvdata(pdev, pmx); in tz1090_pdc_pinctrl_probe()
965 struct tz1090_pdc_pmx *pmx = platform_get_drvdata(pdev); in tz1090_pdc_pinctrl_remove() local
967 pinctrl_unregister(pmx->pctl); in tz1090_pdc_pinctrl_remove()