Lines Matching full:pctrl
51 struct wpcm450_pinctrl *pctrl; member
130 struct wpcm450_pinctrl *pctrl = gpio->pctrl; in wpcm450_gpio_irq_ack() local
138 raw_spin_lock_irqsave(&pctrl->lock, flags); in wpcm450_gpio_irq_ack()
139 iowrite32(BIT(bit), pctrl->gpio_base + WPCM450_GPEVST); in wpcm450_gpio_irq_ack()
140 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()
165 struct wpcm450_pinctrl *pctrl = gpio->pctrl; in wpcm450_gpio_irq_unmask() local
174 raw_spin_lock_irqsave(&pctrl->lock, flags); in wpcm450_gpio_irq_unmask()
175 even = ioread32(pctrl->gpio_base + WPCM450_GPEVEN); in wpcm450_gpio_irq_unmask()
177 iowrite32(even, pctrl->gpio_base + WPCM450_GPEVEN); in wpcm450_gpio_irq_unmask()
178 raw_spin_unlock_irqrestore(&pctrl->lock, flags); in wpcm450_gpio_irq_unmask()
190 void __iomem *reg = gpio->pctrl->gpio_base + gpio->bank->datain; in wpcm450_gpio_get()
194 raw_spin_lock_irqsave(&gpio->pctrl->lock, flags); in wpcm450_gpio_get()
196 raw_spin_unlock_irqrestore(&gpio->pctrl->lock, flags); in wpcm450_gpio_get()
210 struct wpcm450_pinctrl *pctrl = gpio->pctrl; in wpcm450_gpio_fix_evpol() local
223 raw_spin_lock_irqsave(&pctrl->lock, flags); in wpcm450_gpio_fix_evpol()
224 evpol = ioread32(pctrl->gpio_base + WPCM450_GPEVPOL); in wpcm450_gpio_fix_evpol()
226 iowrite32(evpol, pctrl->gpio_base + WPCM450_GPEVPOL); in wpcm450_gpio_fix_evpol()
227 raw_spin_unlock_irqrestore(&pctrl->lock, flags); in wpcm450_gpio_fix_evpol()
236 struct wpcm450_pinctrl *pctrl = gpio->pctrl; in wpcm450_gpio_set_irq_type() local
248 raw_spin_lock_irqsave(&pctrl->lock, flags); in wpcm450_gpio_set_irq_type()
249 evtype = ioread32(pctrl->gpio_base + WPCM450_GPEVTYPE); in wpcm450_gpio_set_irq_type()
250 evpol = ioread32(pctrl->gpio_base + WPCM450_GPEVPOL); in wpcm450_gpio_set_irq_type()
251 __assign_bit(bit, &pctrl->both_edges, 0); in wpcm450_gpio_set_irq_type()
271 __assign_bit(bit, &pctrl->both_edges, 1); in wpcm450_gpio_set_irq_type()
276 iowrite32(evtype, pctrl->gpio_base + WPCM450_GPEVTYPE); in wpcm450_gpio_set_irq_type()
277 iowrite32(evpol, pctrl->gpio_base + WPCM450_GPEVPOL); in wpcm450_gpio_set_irq_type()
280 iowrite32(BIT(bit), pctrl->gpio_base + WPCM450_GPEVST); in wpcm450_gpio_set_irq_type()
282 raw_spin_unlock_irqrestore(&pctrl->lock, flags); in wpcm450_gpio_set_irq_type()
301 struct wpcm450_pinctrl *pctrl = gpio->pctrl; in wpcm450_gpio_irqhandler() local
310 raw_spin_lock_irqsave(&pctrl->lock, flags); in wpcm450_gpio_irqhandler()
312 pending = ioread32(pctrl->gpio_base + WPCM450_GPEVST); in wpcm450_gpio_irqhandler()
313 pending &= ioread32(pctrl->gpio_base + WPCM450_GPEVEN); in wpcm450_gpio_irqhandler()
316 raw_spin_unlock_irqrestore(&pctrl->lock, flags); in wpcm450_gpio_irqhandler()
318 if (pending & pctrl->both_edges) in wpcm450_gpio_irqhandler()
319 wpcm450_gpio_fix_evpol(gpio, pending & pctrl->both_edges); in wpcm450_gpio_irqhandler()
890 struct wpcm450_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in wpcm450_pinmux_set_mux() local
892 wpcm450_setfunc(pctrl->gcr_regmap, wpcm450_groups[group].pins, in wpcm450_pinmux_set_mux()
915 struct wpcm450_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in wpcm450_config_get() local
927 raw_spin_lock_irqsave(&pctrl->lock, flags); in wpcm450_config_get()
928 reg = ioread32(pctrl->gpio_base + WPCM450_GPEVDBNC); in wpcm450_config_get()
929 raw_spin_unlock_irqrestore(&pctrl->lock, flags); in wpcm450_config_get()
938 static int wpcm450_config_set_one(struct wpcm450_pinctrl *pctrl, in wpcm450_config_set_one() argument
955 raw_spin_lock_irqsave(&pctrl->lock, flags); in wpcm450_config_set_one()
956 reg = ioread32(pctrl->gpio_base + WPCM450_GPEVDBNC); in wpcm450_config_set_one()
958 iowrite32(reg, pctrl->gpio_base + WPCM450_GPEVDBNC); in wpcm450_config_set_one()
959 raw_spin_unlock_irqrestore(&pctrl->lock, flags); in wpcm450_config_set_one()
969 struct wpcm450_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); in wpcm450_config_set() local
973 ret = wpcm450_config_set_one(pctrl, pin, *configs++); in wpcm450_config_set()
1002 return wpcm450_config_set_one(gpio->pctrl, offset, config); in wpcm450_gpio_set_config()
1010 return gpiochip_add_pin_range(&gpio->gc, dev_name(gpio->pctrl->dev), in wpcm450_gpio_add_pin_ranges()
1015 struct wpcm450_pinctrl *pctrl) in wpcm450_gpio_register() argument
1021 pctrl->gpio_base = devm_platform_ioremap_resource(pdev, 0); in wpcm450_gpio_register()
1022 if (IS_ERR(pctrl->gpio_base)) in wpcm450_gpio_register()
1023 return dev_err_probe(dev, PTR_ERR(pctrl->gpio_base), in wpcm450_gpio_register()
1044 gpio = &pctrl->gpio_bank[reg]; in wpcm450_gpio_register()
1045 gpio->pctrl = pctrl; in wpcm450_gpio_register()
1054 dat = pctrl->gpio_base + bank->datain; in wpcm450_gpio_register()
1056 set = pctrl->gpio_base + bank->dataout; in wpcm450_gpio_register()
1057 dirout = pctrl->gpio_base + bank->cfg0; in wpcm450_gpio_register()
1107 struct wpcm450_pinctrl *pctrl; in wpcm450_pinctrl_probe() local
1110 pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL); in wpcm450_pinctrl_probe()
1111 if (!pctrl) in wpcm450_pinctrl_probe()
1114 pctrl->dev = &pdev->dev; in wpcm450_pinctrl_probe()
1115 raw_spin_lock_init(&pctrl->lock); in wpcm450_pinctrl_probe()
1116 dev_set_drvdata(dev, pctrl); in wpcm450_pinctrl_probe()
1118 pctrl->gcr_regmap = in wpcm450_pinctrl_probe()
1120 if (IS_ERR(pctrl->gcr_regmap)) in wpcm450_pinctrl_probe()
1121 return dev_err_probe(dev, PTR_ERR(pctrl->gcr_regmap), in wpcm450_pinctrl_probe()
1124 pctrl->pctldev = devm_pinctrl_register(dev, in wpcm450_pinctrl_probe()
1125 &wpcm450_pinctrl_desc, pctrl); in wpcm450_pinctrl_probe()
1126 if (IS_ERR(pctrl->pctldev)) in wpcm450_pinctrl_probe()
1127 return dev_err_probe(dev, PTR_ERR(pctrl->pctldev), in wpcm450_pinctrl_probe()
1130 ret = wpcm450_gpio_register(pdev, pctrl); in wpcm450_pinctrl_probe()