Lines Matching full:pctrl
1849 static int npcm7xx_gpio_of(struct npcm7xx_pinctrl *pctrl) in npcm7xx_gpio_of() argument
1853 struct device *dev = pctrl->dev; in npcm7xx_gpio_of()
1867 pctrl->gpio_bank[id].base = ioremap(res.start, resource_size(&res)); in npcm7xx_gpio_of()
1868 if (!pctrl->gpio_bank[id].base) in npcm7xx_gpio_of()
1871 ret = bgpio_init(&pctrl->gpio_bank[id].gc, dev, 4, in npcm7xx_gpio_of()
1872 pctrl->gpio_bank[id].base + NPCM7XX_GP_N_DIN, in npcm7xx_gpio_of()
1873 pctrl->gpio_bank[id].base + NPCM7XX_GP_N_DOUT, in npcm7xx_gpio_of()
1876 pctrl->gpio_bank[id].base + NPCM7XX_GP_N_IEM, in npcm7xx_gpio_of()
1894 pctrl->gpio_bank[id].irq = ret; in npcm7xx_gpio_of()
1895 pctrl->gpio_bank[id].irqbase = id * NPCM7XX_GPIO_PER_BANK; in npcm7xx_gpio_of()
1896 pctrl->gpio_bank[id].pinctrl_id = args.args[0]; in npcm7xx_gpio_of()
1897 pctrl->gpio_bank[id].gc.base = args.args[1]; in npcm7xx_gpio_of()
1898 pctrl->gpio_bank[id].gc.ngpio = args.args[2]; in npcm7xx_gpio_of()
1899 pctrl->gpio_bank[id].gc.owner = THIS_MODULE; in npcm7xx_gpio_of()
1900 pctrl->gpio_bank[id].gc.parent = dev; in npcm7xx_gpio_of()
1901 pctrl->gpio_bank[id].gc.fwnode = child; in npcm7xx_gpio_of()
1902 pctrl->gpio_bank[id].gc.label = devm_kasprintf(dev, GFP_KERNEL, "%pfw", child); in npcm7xx_gpio_of()
1903 if (pctrl->gpio_bank[id].gc.label == NULL) in npcm7xx_gpio_of()
1906 pctrl->gpio_bank[id].gc.dbg_show = npcmgpio_dbg_show; in npcm7xx_gpio_of()
1907 pctrl->gpio_bank[id].direction_input = pctrl->gpio_bank[id].gc.direction_input; in npcm7xx_gpio_of()
1908 pctrl->gpio_bank[id].gc.direction_input = npcmgpio_direction_input; in npcm7xx_gpio_of()
1909 pctrl->gpio_bank[id].direction_output = pctrl->gpio_bank[id].gc.direction_output; in npcm7xx_gpio_of()
1910 pctrl->gpio_bank[id].gc.direction_output = npcmgpio_direction_output; in npcm7xx_gpio_of()
1911 pctrl->gpio_bank[id].request = pctrl->gpio_bank[id].gc.request; in npcm7xx_gpio_of()
1912 pctrl->gpio_bank[id].gc.request = npcmgpio_gpio_request; in npcm7xx_gpio_of()
1913 pctrl->gpio_bank[id].gc.free = pinctrl_gpio_free; in npcm7xx_gpio_of()
1917 pctrl->bank_num = id; in npcm7xx_gpio_of()
1921 static int npcm7xx_gpio_register(struct npcm7xx_pinctrl *pctrl) in npcm7xx_gpio_register() argument
1925 for (id = 0 ; id < pctrl->bank_num ; id++) { in npcm7xx_gpio_register()
1928 girq = &pctrl->gpio_bank[id].gc.irq; in npcm7xx_gpio_register()
1932 girq->parents = devm_kcalloc(pctrl->dev, 1, in npcm7xx_gpio_register()
1939 girq->parents[0] = pctrl->gpio_bank[id].irq; in npcm7xx_gpio_register()
1942 ret = devm_gpiochip_add_data(pctrl->dev, in npcm7xx_gpio_register()
1943 &pctrl->gpio_bank[id].gc, in npcm7xx_gpio_register()
1944 &pctrl->gpio_bank[id]); in npcm7xx_gpio_register()
1946 dev_err(pctrl->dev, "Failed to add GPIO chip %u\n", id); in npcm7xx_gpio_register()
1950 ret = gpiochip_add_pin_range(&pctrl->gpio_bank[id].gc, in npcm7xx_gpio_register()
1951 dev_name(pctrl->dev), in npcm7xx_gpio_register()
1952 pctrl->gpio_bank[id].pinctrl_id, in npcm7xx_gpio_register()
1953 pctrl->gpio_bank[id].gc.base, in npcm7xx_gpio_register()
1954 pctrl->gpio_bank[id].gc.ngpio); in npcm7xx_gpio_register()
1956 dev_err(pctrl->dev, "Failed to add GPIO bank %u\n", id); in npcm7xx_gpio_register()
1957 gpiochip_remove(&pctrl->gpio_bank[id].gc); in npcm7xx_gpio_register()
1966 gpiochip_remove(&pctrl->gpio_bank[id - 1].gc); in npcm7xx_gpio_register()
1973 struct npcm7xx_pinctrl *pctrl; in npcm7xx_pinctrl_probe() local
1976 pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL); in npcm7xx_pinctrl_probe()
1977 if (!pctrl) in npcm7xx_pinctrl_probe()
1980 pctrl->dev = &pdev->dev; in npcm7xx_pinctrl_probe()
1981 dev_set_drvdata(&pdev->dev, pctrl); in npcm7xx_pinctrl_probe()
1983 pctrl->gcr_regmap = in npcm7xx_pinctrl_probe()
1985 if (IS_ERR(pctrl->gcr_regmap)) { in npcm7xx_pinctrl_probe()
1986 dev_err(pctrl->dev, "didn't find nuvoton,npcm750-gcr\n"); in npcm7xx_pinctrl_probe()
1987 return PTR_ERR(pctrl->gcr_regmap); in npcm7xx_pinctrl_probe()
1990 ret = npcm7xx_gpio_of(pctrl); in npcm7xx_pinctrl_probe()
1992 dev_err(pctrl->dev, "Failed to gpio dt-binding %u\n", ret); in npcm7xx_pinctrl_probe()
1996 pctrl->pctldev = devm_pinctrl_register(&pdev->dev, in npcm7xx_pinctrl_probe()
1997 &npcm7xx_pinctrl_desc, pctrl); in npcm7xx_pinctrl_probe()
1998 if (IS_ERR(pctrl->pctldev)) { in npcm7xx_pinctrl_probe()
2000 return PTR_ERR(pctrl->pctldev); in npcm7xx_pinctrl_probe()
2003 ret = npcm7xx_gpio_register(pctrl); in npcm7xx_pinctrl_probe()
2005 dev_err(pctrl->dev, "Failed to register gpio %u\n", ret); in npcm7xx_pinctrl_probe()