Lines Matching full:pctrl
51 struct wpcm450_pinctrl *pctrl; member
129 struct wpcm450_pinctrl *pctrl = gpio->pctrl; in wpcm450_gpio_irq_ack() local
137 raw_spin_lock_irqsave(&pctrl->lock, flags); in wpcm450_gpio_irq_ack()
138 iowrite32(BIT(bit), pctrl->gpio_base + WPCM450_GPEVST); in wpcm450_gpio_irq_ack()
139 raw_spin_unlock_irqrestore(&pctrl->lock, flags); in wpcm450_gpio_irq_ack()
146 struct wpcm450_pinctrl *pctrl = gpio->pctrl; in wpcm450_gpio_irq_mask() local
155 raw_spin_lock_irqsave(&pctrl->lock, flags); in wpcm450_gpio_irq_mask()
156 even = ioread32(pctrl->gpio_base + WPCM450_GPEVEN); in wpcm450_gpio_irq_mask()
158 iowrite32(even, pctrl->gpio_base + WPCM450_GPEVEN); in wpcm450_gpio_irq_mask()
159 raw_spin_unlock_irqrestore(&pctrl->lock, flags); in wpcm450_gpio_irq_mask()
168 struct wpcm450_pinctrl *pctrl = gpio->pctrl; in wpcm450_gpio_irq_unmask() local
179 raw_spin_lock_irqsave(&pctrl->lock, flags); in wpcm450_gpio_irq_unmask()
180 even = ioread32(pctrl->gpio_base + WPCM450_GPEVEN); in wpcm450_gpio_irq_unmask()
182 iowrite32(even, pctrl->gpio_base + WPCM450_GPEVEN); in wpcm450_gpio_irq_unmask()
183 raw_spin_unlock_irqrestore(&pctrl->lock, flags); in wpcm450_gpio_irq_unmask()
195 void __iomem *reg = gpio->pctrl->gpio_base + gpio->bank->datain; in wpcm450_gpio_get()
199 raw_spin_lock_irqsave(&gpio->pctrl->lock, flags); in wpcm450_gpio_get()
201 raw_spin_unlock_irqrestore(&gpio->pctrl->lock, flags); in wpcm450_gpio_get()
215 struct wpcm450_pinctrl *pctrl = gpio->pctrl; in wpcm450_gpio_fix_evpol() local
228 raw_spin_lock_irqsave(&pctrl->lock, flags); in wpcm450_gpio_fix_evpol()
229 evpol = ioread32(pctrl->gpio_base + WPCM450_GPEVPOL); in wpcm450_gpio_fix_evpol()
231 iowrite32(evpol, pctrl->gpio_base + WPCM450_GPEVPOL); in wpcm450_gpio_fix_evpol()
232 raw_spin_unlock_irqrestore(&pctrl->lock, flags); in wpcm450_gpio_fix_evpol()
241 struct wpcm450_pinctrl *pctrl = gpio->pctrl; in wpcm450_gpio_set_irq_type() local
253 raw_spin_lock_irqsave(&pctrl->lock, flags); in wpcm450_gpio_set_irq_type()
254 evtype = ioread32(pctrl->gpio_base + WPCM450_GPEVTYPE); in wpcm450_gpio_set_irq_type()
255 evpol = ioread32(pctrl->gpio_base + WPCM450_GPEVPOL); in wpcm450_gpio_set_irq_type()
256 __assign_bit(bit, &pctrl->both_edges, 0); in wpcm450_gpio_set_irq_type()
276 __assign_bit(bit, &pctrl->both_edges, 1); in wpcm450_gpio_set_irq_type()
281 iowrite32(evtype, pctrl->gpio_base + WPCM450_GPEVTYPE); in wpcm450_gpio_set_irq_type()
282 iowrite32(evpol, pctrl->gpio_base + WPCM450_GPEVPOL); in wpcm450_gpio_set_irq_type()
285 iowrite32(BIT(bit), pctrl->gpio_base + WPCM450_GPEVST); in wpcm450_gpio_set_irq_type()
287 raw_spin_unlock_irqrestore(&pctrl->lock, flags); in wpcm450_gpio_set_irq_type()
308 struct wpcm450_pinctrl *pctrl = gpio->pctrl; in wpcm450_gpio_irqhandler() local
317 raw_spin_lock_irqsave(&pctrl->lock, flags); in wpcm450_gpio_irqhandler()
319 pending = ioread32(pctrl->gpio_base + WPCM450_GPEVST); in wpcm450_gpio_irqhandler()
320 pending &= ioread32(pctrl->gpio_base + WPCM450_GPEVEN); in wpcm450_gpio_irqhandler()
323 raw_spin_unlock_irqrestore(&pctrl->lock, flags); in wpcm450_gpio_irqhandler()
325 if (pending & pctrl->both_edges) in wpcm450_gpio_irqhandler()
326 wpcm450_gpio_fix_evpol(gpio, pending & pctrl->both_edges); in wpcm450_gpio_irqhandler()
900 struct wpcm450_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in wpcm450_pinmux_set_mux() local
902 wpcm450_setfunc(pctrl->gcr_regmap, wpcm450_groups[group].pins, in wpcm450_pinmux_set_mux()
925 struct wpcm450_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in wpcm450_config_get() local
937 raw_spin_lock_irqsave(&pctrl->lock, flags); in wpcm450_config_get()
938 reg = ioread32(pctrl->gpio_base + WPCM450_GPEVDBNC); in wpcm450_config_get()
939 raw_spin_unlock_irqrestore(&pctrl->lock, flags); in wpcm450_config_get()
948 static int wpcm450_config_set_one(struct wpcm450_pinctrl *pctrl, in wpcm450_config_set_one() argument
965 raw_spin_lock_irqsave(&pctrl->lock, flags); in wpcm450_config_set_one()
966 reg = ioread32(pctrl->gpio_base + WPCM450_GPEVDBNC); in wpcm450_config_set_one()
968 iowrite32(reg, pctrl->gpio_base + WPCM450_GPEVDBNC); in wpcm450_config_set_one()
969 raw_spin_unlock_irqrestore(&pctrl->lock, flags); in wpcm450_config_set_one()
979 struct wpcm450_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in wpcm450_config_set() local
983 ret = wpcm450_config_set_one(pctrl, pin, *configs++); in wpcm450_config_set()
1012 return wpcm450_config_set_one(gpio->pctrl, offset, config); in wpcm450_gpio_set_config()
1020 return gpiochip_add_pin_range(&gpio->gc, dev_name(gpio->pctrl->dev), in wpcm450_gpio_add_pin_ranges()
1025 struct wpcm450_pinctrl *pctrl) in wpcm450_gpio_register() argument
1031 pctrl->gpio_base = devm_platform_ioremap_resource(pdev, 0); in wpcm450_gpio_register()
1032 if (IS_ERR(pctrl->gpio_base)) in wpcm450_gpio_register()
1033 return dev_err_probe(dev, PTR_ERR(pctrl->gpio_base), in wpcm450_gpio_register()
1058 gpio = &pctrl->gpio_bank[reg]; in wpcm450_gpio_register()
1059 gpio->pctrl = pctrl; in wpcm450_gpio_register()
1064 dat = pctrl->gpio_base + bank->datain; in wpcm450_gpio_register()
1066 set = pctrl->gpio_base + bank->dataout; in wpcm450_gpio_register()
1067 dirout = pctrl->gpio_base + bank->cfg0; in wpcm450_gpio_register()
1116 struct wpcm450_pinctrl *pctrl; in wpcm450_pinctrl_probe() local
1119 pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL); in wpcm450_pinctrl_probe()
1120 if (!pctrl) in wpcm450_pinctrl_probe()
1123 pctrl->dev = &pdev->dev; in wpcm450_pinctrl_probe()
1124 raw_spin_lock_init(&pctrl->lock); in wpcm450_pinctrl_probe()
1125 dev_set_drvdata(dev, pctrl); in wpcm450_pinctrl_probe()
1127 pctrl->gcr_regmap = in wpcm450_pinctrl_probe()
1129 if (IS_ERR(pctrl->gcr_regmap)) in wpcm450_pinctrl_probe()
1130 return dev_err_probe(dev, PTR_ERR(pctrl->gcr_regmap), in wpcm450_pinctrl_probe()
1133 pctrl->pctldev = devm_pinctrl_register(dev, in wpcm450_pinctrl_probe()
1134 &wpcm450_pinctrl_desc, pctrl); in wpcm450_pinctrl_probe()
1135 if (IS_ERR(pctrl->pctldev)) in wpcm450_pinctrl_probe()
1136 return dev_err_probe(dev, PTR_ERR(pctrl->pctldev), in wpcm450_pinctrl_probe()
1139 ret = wpcm450_gpio_register(pdev, pctrl); in wpcm450_pinctrl_probe()