Lines Matching refs:ipctl

60 	struct imx_pinctrl *ipctl = pinctrl_dev_get_drvdata(pctldev);  in imx_dt_node_to_map()  local
61 const struct imx_pinctrl_soc_info *info = ipctl->info; in imx_dt_node_to_map()
75 dev_err(ipctl->dev, "unable to find group for node %pOFn\n", np); in imx_dt_node_to_map()
163 static int imx_pmx_set_one_pin_mmio(struct imx_pinctrl *ipctl, in imx_pmx_set_one_pin_mmio() argument
166 const struct imx_pinctrl_soc_info *info = ipctl->info; in imx_pmx_set_one_pin_mmio()
172 pin_reg = &ipctl->pin_regs[pin_id]; in imx_pmx_set_one_pin_mmio()
175 dev_dbg(ipctl->dev, "Pin(%s) does not support mux function\n", in imx_pmx_set_one_pin_mmio()
183 reg = readl(ipctl->base + pin_reg->mux_reg); in imx_pmx_set_one_pin_mmio()
186 writel(reg, ipctl->base + pin_reg->mux_reg); in imx_pmx_set_one_pin_mmio()
187 dev_dbg(ipctl->dev, "write: offset 0x%x val 0x%x\n", in imx_pmx_set_one_pin_mmio()
190 writel(pin_mmio->mux_mode, ipctl->base + pin_reg->mux_reg); in imx_pmx_set_one_pin_mmio()
191 dev_dbg(ipctl->dev, "write: offset 0x%x val 0x%x\n", in imx_pmx_set_one_pin_mmio()
218 val = readl(ipctl->base + pin_mmio->input_reg); in imx_pmx_set_one_pin_mmio()
221 writel(val, ipctl->base + pin_mmio->input_reg); in imx_pmx_set_one_pin_mmio()
227 if (ipctl->input_sel_base) in imx_pmx_set_one_pin_mmio()
228 writel(pin_mmio->input_val, ipctl->input_sel_base + in imx_pmx_set_one_pin_mmio()
231 writel(pin_mmio->input_val, ipctl->base + in imx_pmx_set_one_pin_mmio()
233 dev_dbg(ipctl->dev, in imx_pmx_set_one_pin_mmio()
244 struct imx_pinctrl *ipctl = pinctrl_dev_get_drvdata(pctldev); in imx_pmx_set() local
245 const struct imx_pinctrl_soc_info *info = ipctl->info; in imx_pmx_set()
266 dev_dbg(ipctl->dev, "enable function %s group %s\n", in imx_pmx_set()
277 err = imx_pmx_set_one_pin_mmio(ipctl, pin); in imx_pmx_set()
294 static u32 imx_pinconf_decode_generic_config(struct imx_pinctrl *ipctl, in imx_pinconf_decode_generic_config() argument
298 const struct imx_pinctrl_soc_info *info = ipctl->info; in imx_pinconf_decode_generic_config()
330 struct imx_pinctrl *ipctl) in imx_pinconf_parse_generic_config() argument
332 const struct imx_pinctrl_soc_info *info = ipctl->info; in imx_pinconf_parse_generic_config()
333 struct pinctrl_dev *pctl = ipctl->pctl; in imx_pinconf_parse_generic_config()
346 return imx_pinconf_decode_generic_config(ipctl, configs, num_configs); in imx_pinconf_parse_generic_config()
352 struct imx_pinctrl *ipctl = pinctrl_dev_get_drvdata(pctldev); in imx_pinconf_get_mmio() local
353 const struct imx_pinctrl_soc_info *info = ipctl->info; in imx_pinconf_get_mmio()
354 const struct imx_pin_reg *pin_reg = &ipctl->pin_regs[pin_id]; in imx_pinconf_get_mmio()
357 dev_err(ipctl->dev, "Pin(%s) does not support config function\n", in imx_pinconf_get_mmio()
362 *config = readl(ipctl->base + pin_reg->conf_reg); in imx_pinconf_get_mmio()
373 struct imx_pinctrl *ipctl = pinctrl_dev_get_drvdata(pctldev); in imx_pinconf_get() local
374 const struct imx_pinctrl_soc_info *info = ipctl->info; in imx_pinconf_get()
386 struct imx_pinctrl *ipctl = pinctrl_dev_get_drvdata(pctldev); in imx_pinconf_set_mmio() local
387 const struct imx_pinctrl_soc_info *info = ipctl->info; in imx_pinconf_set_mmio()
388 const struct imx_pin_reg *pin_reg = &ipctl->pin_regs[pin_id]; in imx_pinconf_set_mmio()
392 dev_err(ipctl->dev, "Pin(%s) does not support config function\n", in imx_pinconf_set_mmio()
397 dev_dbg(ipctl->dev, "pinconf set pin %s\n", in imx_pinconf_set_mmio()
403 reg = readl(ipctl->base + pin_reg->conf_reg); in imx_pinconf_set_mmio()
406 writel(reg, ipctl->base + pin_reg->conf_reg); in imx_pinconf_set_mmio()
407 dev_dbg(ipctl->dev, "write: offset 0x%x val 0x%x\n", in imx_pinconf_set_mmio()
410 writel(configs[i], ipctl->base + pin_reg->conf_reg); in imx_pinconf_set_mmio()
411 dev_dbg(ipctl->dev, "write: offset 0x%x val 0x%lx\n", in imx_pinconf_set_mmio()
423 struct imx_pinctrl *ipctl = pinctrl_dev_get_drvdata(pctldev); in imx_pinconf_set() local
424 const struct imx_pinctrl_soc_info *info = ipctl->info; in imx_pinconf_set()
437 struct imx_pinctrl *ipctl = pinctrl_dev_get_drvdata(pctldev); in imx_pinconf_dbg_show() local
438 const struct imx_pinctrl_soc_info *info = ipctl->info; in imx_pinconf_dbg_show()
446 dev_err(ipctl->dev, "failed to get %s pinconf\n", in imx_pinconf_dbg_show()
452 pin_reg = &ipctl->pin_regs[pin_id]; in imx_pinconf_dbg_show()
458 config = readl(ipctl->base + pin_reg->conf_reg); in imx_pinconf_dbg_show()
515 static void imx_pinctrl_parse_pin_mmio(struct imx_pinctrl *ipctl, in imx_pinctrl_parse_pin_mmio() argument
520 const struct imx_pinctrl_soc_info *info = ipctl->info; in imx_pinctrl_parse_pin_mmio()
541 pin_reg = &ipctl->pin_regs[*pin_id]; in imx_pinctrl_parse_pin_mmio()
551 pin_mmio->config = imx_pinconf_parse_generic_config(np, ipctl); in imx_pinctrl_parse_pin_mmio()
564 dev_dbg(ipctl->dev, "%s: 0x%x 0x%08lx", info->pins[*pin_id].name, in imx_pinctrl_parse_pin_mmio()
570 struct imx_pinctrl *ipctl, in imx_pinctrl_parse_groups() argument
573 const struct imx_pinctrl_soc_info *info = ipctl->info; in imx_pinctrl_parse_groups()
579 dev_dbg(ipctl->dev, "group(%d): %pOFn\n", index, np); in imx_pinctrl_parse_groups()
608 dev_err(ipctl->dev, in imx_pinctrl_parse_groups()
616 dev_err(ipctl->dev, "Invalid fsl,pins or pins property in node %pOF\n", np); in imx_pinctrl_parse_groups()
621 grp->data = devm_kcalloc(ipctl->dev, in imx_pinctrl_parse_groups()
624 grp->pins = devm_kcalloc(ipctl->dev, in imx_pinctrl_parse_groups()
633 info->imx_pinctrl_parse_pin(ipctl, &grp->pins[i], in imx_pinctrl_parse_groups()
636 imx_pinctrl_parse_pin_mmio(ipctl, &grp->pins[i], in imx_pinctrl_parse_groups()
644 struct imx_pinctrl *ipctl, in imx_pinctrl_parse_functions() argument
647 struct pinctrl_dev *pctl = ipctl->pctl; in imx_pinctrl_parse_functions()
663 dev_err(ipctl->dev, "no groups defined in %pOF\n", np); in imx_pinctrl_parse_functions()
666 func->group_names = devm_kcalloc(ipctl->dev, func->num_group_names, in imx_pinctrl_parse_functions()
674 grp = devm_kzalloc(ipctl->dev, sizeof(struct group_desc), in imx_pinctrl_parse_functions()
681 mutex_lock(&ipctl->mutex); in imx_pinctrl_parse_functions()
683 ipctl->group_index++, grp); in imx_pinctrl_parse_functions()
684 mutex_unlock(&ipctl->mutex); in imx_pinctrl_parse_functions()
686 imx_pinctrl_parse_groups(child, grp, ipctl, i++); in imx_pinctrl_parse_functions()
721 struct imx_pinctrl *ipctl) in imx_pinctrl_probe_dt() argument
725 struct pinctrl_dev *pctl = ipctl->pctl; in imx_pinctrl_probe_dt()
752 mutex_lock(&ipctl->mutex); in imx_pinctrl_probe_dt()
754 mutex_unlock(&ipctl->mutex); in imx_pinctrl_probe_dt()
758 ipctl->group_index = 0; in imx_pinctrl_probe_dt()
768 imx_pinctrl_parse_functions(np, ipctl, 0); in imx_pinctrl_probe_dt()
772 imx_pinctrl_parse_functions(child, ipctl, i++); in imx_pinctrl_probe_dt()
785 struct imx_pinctrl *ipctl; in imx_pinctrl_probe() local
801 ipctl = devm_kzalloc(&pdev->dev, sizeof(*ipctl), GFP_KERNEL); in imx_pinctrl_probe()
802 if (!ipctl) in imx_pinctrl_probe()
806 ipctl->pin_regs = devm_kmalloc_array(&pdev->dev, info->npins, in imx_pinctrl_probe()
807 sizeof(*ipctl->pin_regs), in imx_pinctrl_probe()
809 if (!ipctl->pin_regs) in imx_pinctrl_probe()
813 ipctl->pin_regs[i].mux_reg = -1; in imx_pinctrl_probe()
814 ipctl->pin_regs[i].conf_reg = -1; in imx_pinctrl_probe()
817 ipctl->base = devm_platform_ioremap_resource(pdev, 0); in imx_pinctrl_probe()
818 if (IS_ERR(ipctl->base)) in imx_pinctrl_probe()
819 return PTR_ERR(ipctl->base); in imx_pinctrl_probe()
828 ipctl->input_sel_base = of_iomap(np, 0); in imx_pinctrl_probe()
830 if (!ipctl->input_sel_base) { in imx_pinctrl_probe()
858 mutex_init(&ipctl->mutex); in imx_pinctrl_probe()
860 ipctl->info = info; in imx_pinctrl_probe()
861 ipctl->dev = &pdev->dev; in imx_pinctrl_probe()
862 platform_set_drvdata(pdev, ipctl); in imx_pinctrl_probe()
864 imx_pinctrl_desc, ipctl, in imx_pinctrl_probe()
865 &ipctl->pctl); in imx_pinctrl_probe()
871 ret = imx_pinctrl_probe_dt(pdev, ipctl); in imx_pinctrl_probe()
879 return pinctrl_enable(ipctl->pctl); in imx_pinctrl_probe()
885 struct imx_pinctrl *ipctl = dev_get_drvdata(dev); in imx_pinctrl_suspend() local
887 return pinctrl_force_sleep(ipctl->pctl); in imx_pinctrl_suspend()
892 struct imx_pinctrl *ipctl = dev_get_drvdata(dev); in imx_pinctrl_resume() local
894 return pinctrl_force_default(ipctl->pctl); in imx_pinctrl_resume()