Lines Matching full:pctrl
569 static u32 chv_pctrl_readl(struct intel_pinctrl *pctrl, unsigned int offset) in chv_pctrl_readl() argument
571 const struct intel_community *community = &pctrl->communities[0]; in chv_pctrl_readl()
576 static void chv_pctrl_writel(struct intel_pinctrl *pctrl, unsigned int offset, u32 value) in chv_pctrl_writel() argument
578 const struct intel_community *community = &pctrl->communities[0]; in chv_pctrl_writel()
586 static void __iomem *chv_padreg(struct intel_pinctrl *pctrl, unsigned int offset, in chv_padreg() argument
589 const struct intel_community *community = &pctrl->communities[0]; in chv_padreg()
598 static u32 chv_readl(struct intel_pinctrl *pctrl, unsigned int pin, unsigned int offset) in chv_readl() argument
600 return readl(chv_padreg(pctrl, pin, offset)); in chv_readl()
603 static void chv_writel(struct intel_pinctrl *pctrl, unsigned int pin, unsigned int offset, u32 valu… in chv_writel() argument
605 void __iomem *reg = chv_padreg(pctrl, pin, offset); in chv_writel()
613 static bool chv_pad_locked(struct intel_pinctrl *pctrl, unsigned int offset) in chv_pad_locked() argument
615 return chv_readl(pctrl, offset, CHV_PADCTRL1) & CHV_PADCTRL1_CFGLOCK; in chv_pad_locked()
620 struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in chv_get_groups_count() local
622 return pctrl->soc->ngroups; in chv_get_groups_count()
628 struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in chv_get_group_name() local
630 return pctrl->soc->groups[group].grp.name; in chv_get_group_name()
636 struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in chv_get_group_pins() local
638 *pins = pctrl->soc->groups[group].grp.pins; in chv_get_group_pins()
639 *npins = pctrl->soc->groups[group].grp.npins; in chv_get_group_pins()
646 struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in chv_pin_dbg_show() local
653 ctrl0 = chv_readl(pctrl, offset, CHV_PADCTRL0); in chv_pin_dbg_show()
654 ctrl1 = chv_readl(pctrl, offset, CHV_PADCTRL1); in chv_pin_dbg_show()
655 locked = chv_pad_locked(pctrl, offset); in chv_pin_dbg_show()
685 struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in chv_get_functions_count() local
687 return pctrl->soc->nfunctions; in chv_get_functions_count()
693 struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in chv_get_function_name() local
695 return pctrl->soc->functions[function].name; in chv_get_function_name()
703 struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in chv_get_function_groups() local
705 *groups = pctrl->soc->functions[function].groups; in chv_get_function_groups()
706 *ngroups = pctrl->soc->functions[function].ngroups; in chv_get_function_groups()
713 struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in chv_pinmux_set_mux() local
714 struct device *dev = pctrl->dev; in chv_pinmux_set_mux()
719 grp = &pctrl->soc->groups[group]; in chv_pinmux_set_mux()
725 if (chv_pad_locked(pctrl, grp->grp.pins[i])) { in chv_pinmux_set_mux()
748 value = chv_readl(pctrl, pin, CHV_PADCTRL0); in chv_pinmux_set_mux()
754 chv_writel(pctrl, pin, CHV_PADCTRL0, value); in chv_pinmux_set_mux()
757 value = chv_readl(pctrl, pin, CHV_PADCTRL1) & ~CHV_PADCTRL1_INVRXTX_MASK; in chv_pinmux_set_mux()
760 chv_writel(pctrl, pin, CHV_PADCTRL1, value); in chv_pinmux_set_mux()
771 static void chv_gpio_clear_triggering(struct intel_pinctrl *pctrl, in chv_gpio_clear_triggering() argument
783 value = chv_readl(pctrl, offset, CHV_PADCTRL0); in chv_gpio_clear_triggering()
787 value = chv_readl(pctrl, offset, CHV_PADCTRL1); in chv_gpio_clear_triggering()
790 chv_writel(pctrl, offset, CHV_PADCTRL1, value); in chv_gpio_clear_triggering()
797 struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in chv_gpio_request_enable() local
803 if (chv_pad_locked(pctrl, offset)) { in chv_gpio_request_enable()
804 value = chv_readl(pctrl, offset, CHV_PADCTRL0); in chv_gpio_request_enable()
811 struct intel_community_context *cctx = &pctrl->context.communities[0]; in chv_gpio_request_enable()
823 chv_gpio_clear_triggering(pctrl, offset); in chv_gpio_request_enable()
825 value = chv_readl(pctrl, offset, CHV_PADCTRL0); in chv_gpio_request_enable()
839 chv_writel(pctrl, offset, CHV_PADCTRL0, value); in chv_gpio_request_enable()
851 struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in chv_gpio_disable_free() local
856 if (!chv_pad_locked(pctrl, offset)) in chv_gpio_disable_free()
857 chv_gpio_clear_triggering(pctrl, offset); in chv_gpio_disable_free()
866 struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in chv_gpio_set_direction() local
872 ctrl0 = chv_readl(pctrl, offset, CHV_PADCTRL0) & ~CHV_PADCTRL0_GPIOCFG_MASK; in chv_gpio_set_direction()
877 chv_writel(pctrl, offset, CHV_PADCTRL0, ctrl0); in chv_gpio_set_direction()
897 struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in chv_config_get() local
905 ctrl0 = chv_readl(pctrl, pin, CHV_PADCTRL0); in chv_config_get()
906 ctrl1 = chv_readl(pctrl, pin, CHV_PADCTRL1); in chv_config_get()
974 static int chv_config_set_pull(struct intel_pinctrl *pctrl, unsigned int pin, in chv_config_set_pull() argument
981 ctrl0 = chv_readl(pctrl, pin, CHV_PADCTRL0); in chv_config_set_pull()
1033 chv_writel(pctrl, pin, CHV_PADCTRL0, ctrl0); in chv_config_set_pull()
1039 static int chv_config_set_oden(struct intel_pinctrl *pctrl, unsigned int pin, in chv_config_set_oden() argument
1046 ctrl1 = chv_readl(pctrl, pin, CHV_PADCTRL1); in chv_config_set_oden()
1053 chv_writel(pctrl, pin, CHV_PADCTRL1, ctrl1); in chv_config_set_oden()
1062 struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in chv_config_set() local
1063 struct device *dev = pctrl->dev; in chv_config_set()
1068 if (chv_pad_locked(pctrl, pin)) in chv_config_set()
1079 ret = chv_config_set_pull(pctrl, pin, param, arg); in chv_config_set()
1085 ret = chv_config_set_oden(pctrl, pin, false); in chv_config_set()
1091 ret = chv_config_set_oden(pctrl, pin, true); in chv_config_set()
1163 struct intel_pinctrl *pctrl = gpiochip_get_data(chip); in chv_gpio_get() local
1168 ctrl0 = chv_readl(pctrl, offset, CHV_PADCTRL0); in chv_gpio_get()
1181 struct intel_pinctrl *pctrl = gpiochip_get_data(chip); in chv_gpio_set() local
1187 ctrl0 = chv_readl(pctrl, offset, CHV_PADCTRL0); in chv_gpio_set()
1194 chv_writel(pctrl, offset, CHV_PADCTRL0, ctrl0); in chv_gpio_set()
1201 struct intel_pinctrl *pctrl = gpiochip_get_data(chip); in chv_gpio_get_direction() local
1206 ctrl0 = chv_readl(pctrl, offset, CHV_PADCTRL0); in chv_gpio_get_direction()
1244 struct intel_pinctrl *pctrl = gpiochip_get_data(gc); in chv_gpio_irq_ack() local
1250 intr_line = chv_readl(pctrl, hwirq, CHV_PADCTRL0); in chv_gpio_irq_ack()
1253 chv_pctrl_writel(pctrl, CHV_INTSTAT, BIT(intr_line)); in chv_gpio_irq_ack()
1260 struct intel_pinctrl *pctrl = gpiochip_get_data(gc); in chv_gpio_irq_mask_unmask() local
1266 intr_line = chv_readl(pctrl, hwirq, CHV_PADCTRL0); in chv_gpio_irq_mask_unmask()
1270 value = chv_pctrl_readl(pctrl, CHV_INTMASK); in chv_gpio_irq_mask_unmask()
1275 chv_pctrl_writel(pctrl, CHV_INTMASK, value); in chv_gpio_irq_mask_unmask()
1312 struct intel_pinctrl *pctrl = gpiochip_get_data(gc); in chv_gpio_irq_startup() local
1313 struct device *dev = pctrl->dev; in chv_gpio_irq_startup()
1314 struct intel_community_context *cctx = &pctrl->context.communities[0]; in chv_gpio_irq_startup()
1321 intsel = chv_readl(pctrl, hwirq, CHV_PADCTRL0); in chv_gpio_irq_startup()
1325 value = chv_readl(pctrl, hwirq, CHV_PADCTRL1); in chv_gpio_irq_startup()
1344 static int chv_gpio_set_intr_line(struct intel_pinctrl *pctrl, unsigned int pin) in chv_gpio_set_intr_line() argument
1346 struct device *dev = pctrl->dev; in chv_gpio_set_intr_line()
1347 struct intel_community_context *cctx = &pctrl->context.communities[0]; in chv_gpio_set_intr_line()
1348 const struct intel_community *community = &pctrl->communities[0]; in chv_gpio_set_intr_line()
1352 value = chv_readl(pctrl, pin, CHV_PADCTRL0); in chv_gpio_set_intr_line()
1374 if (chv_pad_locked(pctrl, pin)) in chv_gpio_set_intr_line()
1391 chv_writel(pctrl, pin, CHV_PADCTRL0, value); in chv_gpio_set_intr_line()
1400 struct intel_pinctrl *pctrl = gpiochip_get_data(gc); in chv_gpio_irq_type() local
1408 ret = chv_gpio_set_intr_line(pctrl, hwirq); in chv_gpio_irq_type()
1425 if (!chv_pad_locked(pctrl, hwirq)) { in chv_gpio_irq_type()
1426 value = chv_readl(pctrl, hwirq, CHV_PADCTRL1); in chv_gpio_irq_type()
1443 chv_writel(pctrl, hwirq, CHV_PADCTRL1, value); in chv_gpio_irq_type()
1471 struct intel_pinctrl *pctrl = gpiochip_get_data(gc); in chv_gpio_irq_handler() local
1472 struct device *dev = pctrl->dev; in chv_gpio_irq_handler()
1473 const struct intel_community *community = &pctrl->communities[0]; in chv_gpio_irq_handler()
1474 struct intel_community_context *cctx = &pctrl->context.communities[0]; in chv_gpio_irq_handler()
1483 pending = chv_pctrl_readl(pctrl, CHV_INTSTAT); in chv_gpio_irq_handler()
1547 struct intel_pinctrl *pctrl = gpiochip_get_data(chip); in chv_init_irq_valid_mask() local
1548 const struct intel_community *community = &pctrl->communities[0]; in chv_init_irq_valid_mask()
1552 for (i = 0; i < pctrl->soc->npins; i++) { in chv_init_irq_valid_mask()
1556 desc = &pctrl->soc->pins[i]; in chv_init_irq_valid_mask()
1558 intsel = chv_readl(pctrl, desc->number, CHV_PADCTRL0); in chv_init_irq_valid_mask()
1569 struct intel_pinctrl *pctrl = gpiochip_get_data(chip); in chv_gpio_irq_init_hw() local
1570 const struct intel_community *community = &pctrl->communities[0]; in chv_gpio_irq_init_hw()
1579 if (!pctrl->chip.irq.init_valid_mask) { in chv_gpio_irq_init_hw()
1584 chv_pctrl_writel(pctrl, CHV_INTMASK, GENMASK(31, community->nirqs)); in chv_gpio_irq_init_hw()
1588 chv_pctrl_writel(pctrl, CHV_INTSTAT, 0xffff); in chv_gpio_irq_init_hw()
1595 struct intel_pinctrl *pctrl = gpiochip_get_data(chip); in chv_gpio_add_pin_ranges() local
1596 struct device *dev = pctrl->dev; in chv_gpio_add_pin_ranges()
1597 const struct intel_community *community = &pctrl->communities[0]; in chv_gpio_add_pin_ranges()
1613 static int chv_gpio_probe(struct intel_pinctrl *pctrl, int irq) in chv_gpio_probe() argument
1615 const struct intel_community *community = &pctrl->communities[0]; in chv_gpio_probe()
1617 struct gpio_chip *chip = &pctrl->chip; in chv_gpio_probe()
1618 struct device *dev = pctrl->dev; in chv_gpio_probe()
1624 chip->ngpio = pctrl->soc->pins[pctrl->soc->npins - 1].number + 1; in chv_gpio_probe()
1630 pctrl->irq = irq; in chv_gpio_probe()
1636 chip->irq.parents = &pctrl->irq; in chv_gpio_probe()
1642 irq_base = devm_irq_alloc_descs(dev, -1, 0, pctrl->soc->npins, NUMA_NO_NODE); in chv_gpio_probe()
1649 ret = devm_gpiochip_add_data(dev, chip, pctrl); in chv_gpio_probe()
1672 struct intel_pinctrl *pctrl = region_context; in chv_pinctrl_mmio_access_handler() local
1679 chv_pctrl_writel(pctrl, address, *value); in chv_pinctrl_mmio_access_handler()
1681 *value = chv_pctrl_readl(pctrl, address); in chv_pinctrl_mmio_access_handler()
1697 struct intel_pinctrl *pctrl; in chv_pinctrl_probe() local
1706 pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL); in chv_pinctrl_probe()
1707 if (!pctrl) in chv_pinctrl_probe()
1710 pctrl->dev = dev; in chv_pinctrl_probe()
1711 pctrl->soc = soc_data; in chv_pinctrl_probe()
1713 pctrl->ncommunities = pctrl->soc->ncommunities; in chv_pinctrl_probe()
1714 pctrl->communities = devm_kmemdup(dev, pctrl->soc->communities, in chv_pinctrl_probe()
1715 pctrl->ncommunities * sizeof(*pctrl->communities), in chv_pinctrl_probe()
1717 if (!pctrl->communities) in chv_pinctrl_probe()
1720 community = &pctrl->communities[0]; in chv_pinctrl_probe()
1728 pctrl->context.pads = devm_kcalloc(dev, pctrl->soc->npins, in chv_pinctrl_probe()
1729 sizeof(*pctrl->context.pads), in chv_pinctrl_probe()
1731 if (!pctrl->context.pads) in chv_pinctrl_probe()
1735 pctrl->context.communities = devm_kcalloc(dev, pctrl->soc->ncommunities, in chv_pinctrl_probe()
1736 sizeof(*pctrl->context.communities), in chv_pinctrl_probe()
1738 if (!pctrl->context.communities) in chv_pinctrl_probe()
1741 cctx = &pctrl->context.communities[0]; in chv_pinctrl_probe()
1749 pctrl->pctldesc = chv_pinctrl_desc; in chv_pinctrl_probe()
1750 pctrl->pctldesc.name = dev_name(dev); in chv_pinctrl_probe()
1751 pctrl->pctldesc.pins = pctrl->soc->pins; in chv_pinctrl_probe()
1752 pctrl->pctldesc.npins = pctrl->soc->npins; in chv_pinctrl_probe()
1754 pctrl->pctldev = devm_pinctrl_register(dev, &pctrl->pctldesc, pctrl); in chv_pinctrl_probe()
1755 if (IS_ERR(pctrl->pctldev)) { in chv_pinctrl_probe()
1757 return PTR_ERR(pctrl->pctldev); in chv_pinctrl_probe()
1760 ret = chv_gpio_probe(pctrl, irq); in chv_pinctrl_probe()
1767 NULL, pctrl); in chv_pinctrl_probe()
1771 platform_set_drvdata(pdev, pctrl); in chv_pinctrl_probe()
1778 struct intel_pinctrl *pctrl = platform_get_drvdata(pdev); in chv_pinctrl_remove() local
1779 const struct intel_community *community = &pctrl->communities[0]; in chv_pinctrl_remove()
1791 struct intel_pinctrl *pctrl = dev_get_drvdata(dev); in chv_pinctrl_suspend_noirq() local
1792 struct intel_community_context *cctx = &pctrl->context.communities[0]; in chv_pinctrl_suspend_noirq()
1798 cctx->saved_intmask = chv_pctrl_readl(pctrl, CHV_INTMASK); in chv_pinctrl_suspend_noirq()
1800 for (i = 0; i < pctrl->soc->npins; i++) { in chv_pinctrl_suspend_noirq()
1802 struct intel_pad_context *ctx = &pctrl->context.pads[i]; in chv_pinctrl_suspend_noirq()
1804 desc = &pctrl->soc->pins[i]; in chv_pinctrl_suspend_noirq()
1805 if (chv_pad_locked(pctrl, desc->number)) in chv_pinctrl_suspend_noirq()
1808 ctx->padctrl0 = chv_readl(pctrl, desc->number, CHV_PADCTRL0); in chv_pinctrl_suspend_noirq()
1811 ctx->padctrl1 = chv_readl(pctrl, desc->number, CHV_PADCTRL1); in chv_pinctrl_suspend_noirq()
1821 struct intel_pinctrl *pctrl = dev_get_drvdata(dev); in chv_pinctrl_resume_noirq() local
1822 struct intel_community_context *cctx = &pctrl->context.communities[0]; in chv_pinctrl_resume_noirq()
1833 chv_pctrl_writel(pctrl, CHV_INTMASK, 0x0000); in chv_pinctrl_resume_noirq()
1835 for (i = 0; i < pctrl->soc->npins; i++) { in chv_pinctrl_resume_noirq()
1837 struct intel_pad_context *ctx = &pctrl->context.pads[i]; in chv_pinctrl_resume_noirq()
1840 desc = &pctrl->soc->pins[i]; in chv_pinctrl_resume_noirq()
1841 if (chv_pad_locked(pctrl, desc->number)) in chv_pinctrl_resume_noirq()
1845 val = chv_readl(pctrl, desc->number, CHV_PADCTRL0); in chv_pinctrl_resume_noirq()
1848 chv_writel(pctrl, desc->number, CHV_PADCTRL0, ctx->padctrl0); in chv_pinctrl_resume_noirq()
1850 chv_readl(pctrl, desc->number, CHV_PADCTRL0)); in chv_pinctrl_resume_noirq()
1853 val = chv_readl(pctrl, desc->number, CHV_PADCTRL1); in chv_pinctrl_resume_noirq()
1855 chv_writel(pctrl, desc->number, CHV_PADCTRL1, ctx->padctrl1); in chv_pinctrl_resume_noirq()
1857 chv_readl(pctrl, desc->number, CHV_PADCTRL1)); in chv_pinctrl_resume_noirq()
1865 chv_pctrl_writel(pctrl, CHV_INTSTAT, 0xffff); in chv_pinctrl_resume_noirq()
1866 chv_pctrl_writel(pctrl, CHV_INTMASK, cctx->saved_intmask); in chv_pinctrl_resume_noirq()