Lines Matching full:pctrl
572 static u32 chv_pctrl_readl(struct intel_pinctrl *pctrl, unsigned int offset) in chv_pctrl_readl() argument
574 const struct intel_community *community = &pctrl->communities[0]; in chv_pctrl_readl()
579 static void chv_pctrl_writel(struct intel_pinctrl *pctrl, unsigned int offset, u32 value) in chv_pctrl_writel() argument
581 const struct intel_community *community = &pctrl->communities[0]; in chv_pctrl_writel()
589 static void __iomem *chv_padreg(struct intel_pinctrl *pctrl, unsigned int offset, in chv_padreg() argument
592 const struct intel_community *community = &pctrl->communities[0]; in chv_padreg()
601 static u32 chv_readl(struct intel_pinctrl *pctrl, unsigned int pin, unsigned int offset) in chv_readl() argument
603 return readl(chv_padreg(pctrl, pin, offset)); in chv_readl()
606 static void chv_writel(struct intel_pinctrl *pctrl, unsigned int pin, unsigned int offset, u32 valu… in chv_writel() argument
608 void __iomem *reg = chv_padreg(pctrl, pin, offset); in chv_writel()
621 static bool chv_pad_locked(struct intel_pinctrl *pctrl, unsigned int offset) in chv_pad_locked() argument
623 return chv_pad_is_locked(chv_readl(pctrl, offset, CHV_PADCTRL1)); in chv_pad_locked()
629 struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in chv_pin_dbg_show() local
633 ctrl0 = chv_readl(pctrl, offset, CHV_PADCTRL0); in chv_pin_dbg_show()
634 ctrl1 = chv_readl(pctrl, offset, CHV_PADCTRL1); in chv_pin_dbg_show()
664 struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in chv_pinmux_set_mux() local
665 struct device *dev = pctrl->dev; in chv_pinmux_set_mux()
669 grp = &pctrl->soc->groups[group]; in chv_pinmux_set_mux()
675 if (chv_pad_locked(pctrl, grp->grp.pins[i])) { in chv_pinmux_set_mux()
697 value = chv_readl(pctrl, pin, CHV_PADCTRL0); in chv_pinmux_set_mux()
703 chv_writel(pctrl, pin, CHV_PADCTRL0, value); in chv_pinmux_set_mux()
706 value = chv_readl(pctrl, pin, CHV_PADCTRL1) & ~CHV_PADCTRL1_INVRXTX_MASK; in chv_pinmux_set_mux()
709 chv_writel(pctrl, pin, CHV_PADCTRL1, value); in chv_pinmux_set_mux()
718 static void chv_gpio_clear_triggering(struct intel_pinctrl *pctrl, in chv_gpio_clear_triggering() argument
730 value = chv_readl(pctrl, offset, CHV_PADCTRL0); in chv_gpio_clear_triggering()
734 value = chv_readl(pctrl, offset, CHV_PADCTRL1); in chv_gpio_clear_triggering()
737 chv_writel(pctrl, offset, CHV_PADCTRL1, value); in chv_gpio_clear_triggering()
744 struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in chv_gpio_request_enable() local
749 if (chv_pad_locked(pctrl, offset)) { in chv_gpio_request_enable()
750 value = chv_readl(pctrl, offset, CHV_PADCTRL0); in chv_gpio_request_enable()
756 struct intel_community_context *cctx = &pctrl->context.communities[0]; in chv_gpio_request_enable()
768 chv_gpio_clear_triggering(pctrl, offset); in chv_gpio_request_enable()
770 value = chv_readl(pctrl, offset, CHV_PADCTRL0); in chv_gpio_request_enable()
784 chv_writel(pctrl, offset, CHV_PADCTRL0, value); in chv_gpio_request_enable()
794 struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in chv_gpio_disable_free() local
798 if (chv_pad_locked(pctrl, offset)) in chv_gpio_disable_free()
801 chv_gpio_clear_triggering(pctrl, offset); in chv_gpio_disable_free()
808 struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in chv_gpio_set_direction() local
813 ctrl0 = chv_readl(pctrl, offset, CHV_PADCTRL0) & ~CHV_PADCTRL0_GPIOCFG_MASK; in chv_gpio_set_direction()
818 chv_writel(pctrl, offset, CHV_PADCTRL0, ctrl0); in chv_gpio_set_direction()
836 struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in chv_config_get() local
843 ctrl0 = chv_readl(pctrl, pin, CHV_PADCTRL0); in chv_config_get()
844 ctrl1 = chv_readl(pctrl, pin, CHV_PADCTRL1); in chv_config_get()
917 static int chv_config_set_pull(struct intel_pinctrl *pctrl, unsigned int pin, in chv_config_set_pull() argument
924 ctrl0 = chv_readl(pctrl, pin, CHV_PADCTRL0); in chv_config_set_pull()
973 chv_writel(pctrl, pin, CHV_PADCTRL0, ctrl0); in chv_config_set_pull()
978 static int chv_config_set_oden(struct intel_pinctrl *pctrl, unsigned int pin, in chv_config_set_oden() argument
985 ctrl1 = chv_readl(pctrl, pin, CHV_PADCTRL1); in chv_config_set_oden()
992 chv_writel(pctrl, pin, CHV_PADCTRL1, ctrl1); in chv_config_set_oden()
1000 struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in chv_config_set() local
1001 struct device *dev = pctrl->dev; in chv_config_set()
1006 if (chv_pad_locked(pctrl, pin)) in chv_config_set()
1017 ret = chv_config_set_pull(pctrl, pin, param, arg); in chv_config_set()
1023 ret = chv_config_set_oden(pctrl, pin, false); in chv_config_set()
1029 ret = chv_config_set_oden(pctrl, pin, true); in chv_config_set()
1101 struct intel_pinctrl *pctrl = gpiochip_get_data(chip); in chv_gpio_get() local
1105 ctrl0 = chv_readl(pctrl, offset, CHV_PADCTRL0); in chv_gpio_get()
1117 struct intel_pinctrl *pctrl = gpiochip_get_data(chip); in chv_gpio_set() local
1122 ctrl0 = chv_readl(pctrl, offset, CHV_PADCTRL0); in chv_gpio_set()
1129 chv_writel(pctrl, offset, CHV_PADCTRL0, ctrl0); in chv_gpio_set()
1134 struct intel_pinctrl *pctrl = gpiochip_get_data(chip); in chv_gpio_get_direction() local
1138 ctrl0 = chv_readl(pctrl, offset, CHV_PADCTRL0); in chv_gpio_get_direction()
1175 struct intel_pinctrl *pctrl = gpiochip_get_data(gc); in chv_gpio_irq_ack() local
1181 intr_line = chv_readl(pctrl, hwirq, CHV_PADCTRL0); in chv_gpio_irq_ack()
1184 chv_pctrl_writel(pctrl, CHV_INTSTAT, BIT(intr_line)); in chv_gpio_irq_ack()
1189 struct intel_pinctrl *pctrl = gpiochip_get_data(gc); in chv_gpio_irq_mask_unmask() local
1194 intr_line = chv_readl(pctrl, hwirq, CHV_PADCTRL0); in chv_gpio_irq_mask_unmask()
1198 value = chv_pctrl_readl(pctrl, CHV_INTMASK); in chv_gpio_irq_mask_unmask()
1203 chv_pctrl_writel(pctrl, CHV_INTMASK, value); in chv_gpio_irq_mask_unmask()
1246 struct intel_pinctrl *pctrl = gpiochip_get_data(gc); in chv_gpio_irq_startup() local
1247 struct device *dev = pctrl->dev; in chv_gpio_irq_startup()
1248 struct intel_community_context *cctx = &pctrl->context.communities[0]; in chv_gpio_irq_startup()
1253 intsel = chv_readl(pctrl, hwirq, CHV_PADCTRL0); in chv_gpio_irq_startup()
1257 value = chv_readl(pctrl, hwirq, CHV_PADCTRL1); in chv_gpio_irq_startup()
1275 static int chv_gpio_set_intr_line(struct intel_pinctrl *pctrl, unsigned int pin) in chv_gpio_set_intr_line() argument
1277 struct device *dev = pctrl->dev; in chv_gpio_set_intr_line()
1278 struct intel_community_context *cctx = &pctrl->context.communities[0]; in chv_gpio_set_intr_line()
1279 const struct intel_community *community = &pctrl->communities[0]; in chv_gpio_set_intr_line()
1283 value = chv_readl(pctrl, pin, CHV_PADCTRL0); in chv_gpio_set_intr_line()
1305 if (chv_pad_locked(pctrl, pin)) in chv_gpio_set_intr_line()
1322 chv_writel(pctrl, pin, CHV_PADCTRL0, value); in chv_gpio_set_intr_line()
1331 struct intel_pinctrl *pctrl = gpiochip_get_data(gc); in chv_gpio_irq_type() local
1338 ret = chv_gpio_set_intr_line(pctrl, hwirq); in chv_gpio_irq_type()
1355 if (!chv_pad_locked(pctrl, hwirq)) { in chv_gpio_irq_type()
1356 value = chv_readl(pctrl, hwirq, CHV_PADCTRL1); in chv_gpio_irq_type()
1373 chv_writel(pctrl, hwirq, CHV_PADCTRL1, value); in chv_gpio_irq_type()
1398 struct intel_pinctrl *pctrl = gpiochip_get_data(gc); in chv_gpio_irq_handler() local
1399 struct device *dev = pctrl->dev; in chv_gpio_irq_handler()
1400 const struct intel_community *community = &pctrl->communities[0]; in chv_gpio_irq_handler()
1401 struct intel_community_context *cctx = &pctrl->context.communities[0]; in chv_gpio_irq_handler()
1409 pending = chv_pctrl_readl(pctrl, CHV_INTSTAT); in chv_gpio_irq_handler()
1472 struct intel_pinctrl *pctrl = gpiochip_get_data(chip); in chv_init_irq_valid_mask() local
1473 const struct intel_community *community = &pctrl->communities[0]; in chv_init_irq_valid_mask()
1477 for (i = 0; i < pctrl->soc->npins; i++) { in chv_init_irq_valid_mask()
1481 desc = &pctrl->soc->pins[i]; in chv_init_irq_valid_mask()
1483 intsel = chv_readl(pctrl, desc->number, CHV_PADCTRL0); in chv_init_irq_valid_mask()
1494 struct intel_pinctrl *pctrl = gpiochip_get_data(chip); in chv_gpio_irq_init_hw() local
1495 const struct intel_community *community = &pctrl->communities[0]; in chv_gpio_irq_init_hw()
1504 if (!pctrl->chip.irq.init_valid_mask) { in chv_gpio_irq_init_hw()
1509 chv_pctrl_writel(pctrl, CHV_INTMASK, GENMASK(31, community->nirqs)); in chv_gpio_irq_init_hw()
1513 chv_pctrl_writel(pctrl, CHV_INTSTAT, 0xffff); in chv_gpio_irq_init_hw()
1520 struct intel_pinctrl *pctrl = gpiochip_get_data(chip); in chv_gpio_add_pin_ranges() local
1521 struct device *dev = pctrl->dev; in chv_gpio_add_pin_ranges()
1522 const struct intel_community *community = &pctrl->communities[0]; in chv_gpio_add_pin_ranges()
1538 static int chv_gpio_probe(struct intel_pinctrl *pctrl, int irq) in chv_gpio_probe() argument
1540 const struct intel_community *community = &pctrl->communities[0]; in chv_gpio_probe()
1542 struct gpio_chip *chip = &pctrl->chip; in chv_gpio_probe()
1543 struct device *dev = pctrl->dev; in chv_gpio_probe()
1549 chip->ngpio = pctrl->soc->pins[pctrl->soc->npins - 1].number + 1; in chv_gpio_probe()
1555 pctrl->irq = irq; in chv_gpio_probe()
1561 chip->irq.parents = &pctrl->irq; in chv_gpio_probe()
1567 irq_base = devm_irq_alloc_descs(dev, -1, 0, pctrl->soc->npins, NUMA_NO_NODE); in chv_gpio_probe()
1574 ret = devm_gpiochip_add_data(dev, chip, pctrl); in chv_gpio_probe()
1597 struct intel_pinctrl *pctrl = region_context; in chv_pinctrl_mmio_access_handler() local
1602 chv_pctrl_writel(pctrl, address, *value); in chv_pinctrl_mmio_access_handler()
1604 *value = chv_pctrl_readl(pctrl, address); in chv_pinctrl_mmio_access_handler()
1617 struct intel_pinctrl *pctrl; in chv_pinctrl_probe() local
1626 pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL); in chv_pinctrl_probe()
1627 if (!pctrl) in chv_pinctrl_probe()
1630 pctrl->dev = dev; in chv_pinctrl_probe()
1631 pctrl->soc = soc_data; in chv_pinctrl_probe()
1633 pctrl->ncommunities = pctrl->soc->ncommunities; in chv_pinctrl_probe()
1634 pctrl->communities = devm_kmemdup(dev, pctrl->soc->communities, in chv_pinctrl_probe()
1635 pctrl->ncommunities * sizeof(*pctrl->communities), in chv_pinctrl_probe()
1637 if (!pctrl->communities) in chv_pinctrl_probe()
1640 community = &pctrl->communities[0]; in chv_pinctrl_probe()
1648 pctrl->context.pads = devm_kcalloc(dev, pctrl->soc->npins, in chv_pinctrl_probe()
1649 sizeof(*pctrl->context.pads), in chv_pinctrl_probe()
1651 if (!pctrl->context.pads) in chv_pinctrl_probe()
1655 pctrl->context.communities = devm_kcalloc(dev, pctrl->soc->ncommunities, in chv_pinctrl_probe()
1656 sizeof(*pctrl->context.communities), in chv_pinctrl_probe()
1658 if (!pctrl->context.communities) in chv_pinctrl_probe()
1661 cctx = &pctrl->context.communities[0]; in chv_pinctrl_probe()
1669 pctrl->pctldesc = chv_pinctrl_desc; in chv_pinctrl_probe()
1670 pctrl->pctldesc.name = dev_name(dev); in chv_pinctrl_probe()
1671 pctrl->pctldesc.pins = pctrl->soc->pins; in chv_pinctrl_probe()
1672 pctrl->pctldesc.npins = pctrl->soc->npins; in chv_pinctrl_probe()
1674 pctrl->pctldev = devm_pinctrl_register(dev, &pctrl->pctldesc, pctrl); in chv_pinctrl_probe()
1675 if (IS_ERR(pctrl->pctldev)) { in chv_pinctrl_probe()
1677 return PTR_ERR(pctrl->pctldev); in chv_pinctrl_probe()
1680 ret = chv_gpio_probe(pctrl, irq); in chv_pinctrl_probe()
1687 NULL, pctrl); in chv_pinctrl_probe()
1691 platform_set_drvdata(pdev, pctrl); in chv_pinctrl_probe()
1698 struct intel_pinctrl *pctrl = platform_get_drvdata(pdev); in chv_pinctrl_remove() local
1699 const struct intel_community *community = &pctrl->communities[0]; in chv_pinctrl_remove()
1708 struct intel_pinctrl *pctrl = dev_get_drvdata(dev); in chv_pinctrl_suspend_noirq() local
1709 struct intel_community_context *cctx = &pctrl->context.communities[0]; in chv_pinctrl_suspend_noirq()
1714 cctx->saved_intmask = chv_pctrl_readl(pctrl, CHV_INTMASK); in chv_pinctrl_suspend_noirq()
1716 for (i = 0; i < pctrl->soc->npins; i++) { in chv_pinctrl_suspend_noirq()
1718 struct intel_pad_context *ctx = &pctrl->context.pads[i]; in chv_pinctrl_suspend_noirq()
1720 desc = &pctrl->soc->pins[i]; in chv_pinctrl_suspend_noirq()
1721 if (chv_pad_locked(pctrl, desc->number)) in chv_pinctrl_suspend_noirq()
1724 ctx->padctrl0 = chv_readl(pctrl, desc->number, CHV_PADCTRL0); in chv_pinctrl_suspend_noirq()
1727 ctx->padctrl1 = chv_readl(pctrl, desc->number, CHV_PADCTRL1); in chv_pinctrl_suspend_noirq()
1735 struct intel_pinctrl *pctrl = dev_get_drvdata(dev); in chv_pinctrl_resume_noirq() local
1736 struct intel_community_context *cctx = &pctrl->context.communities[0]; in chv_pinctrl_resume_noirq()
1746 chv_pctrl_writel(pctrl, CHV_INTMASK, 0x0000); in chv_pinctrl_resume_noirq()
1748 for (i = 0; i < pctrl->soc->npins; i++) { in chv_pinctrl_resume_noirq()
1750 struct intel_pad_context *ctx = &pctrl->context.pads[i]; in chv_pinctrl_resume_noirq()
1753 desc = &pctrl->soc->pins[i]; in chv_pinctrl_resume_noirq()
1754 if (chv_pad_locked(pctrl, desc->number)) in chv_pinctrl_resume_noirq()
1758 val = chv_readl(pctrl, desc->number, CHV_PADCTRL0); in chv_pinctrl_resume_noirq()
1761 chv_writel(pctrl, desc->number, CHV_PADCTRL0, ctx->padctrl0); in chv_pinctrl_resume_noirq()
1763 chv_readl(pctrl, desc->number, CHV_PADCTRL0)); in chv_pinctrl_resume_noirq()
1766 val = chv_readl(pctrl, desc->number, CHV_PADCTRL1); in chv_pinctrl_resume_noirq()
1768 chv_writel(pctrl, desc->number, CHV_PADCTRL1, ctx->padctrl1); in chv_pinctrl_resume_noirq()
1770 chv_readl(pctrl, desc->number, CHV_PADCTRL1)); in chv_pinctrl_resume_noirq()
1778 chv_pctrl_writel(pctrl, CHV_INTSTAT, 0xffff); in chv_pinctrl_resume_noirq()
1779 chv_pctrl_writel(pctrl, CHV_INTMASK, cctx->saved_intmask); in chv_pinctrl_resume_noirq()