Lines Matching refs:pctrl
1861 static int npcm7xx_gpio_of(struct npcm7xx_pinctrl *pctrl) in npcm7xx_gpio_of() argument
1869 for_each_available_child_of_node(pctrl->dev->of_node, np) in npcm7xx_gpio_of()
1873 dev_err(pctrl->dev, in npcm7xx_gpio_of()
1878 pctrl->gpio_bank[id].base = in npcm7xx_gpio_of()
1883 dev_err(pctrl->dev, in npcm7xx_gpio_of()
1889 ret = bgpio_init(&pctrl->gpio_bank[id].gc, in npcm7xx_gpio_of()
1890 pctrl->dev, 4, in npcm7xx_gpio_of()
1891 pctrl->gpio_bank[id].base + in npcm7xx_gpio_of()
1893 pctrl->gpio_bank[id].base + in npcm7xx_gpio_of()
1897 pctrl->gpio_bank[id].base + in npcm7xx_gpio_of()
1901 dev_err(pctrl->dev, "bgpio_init() failed\n"); in npcm7xx_gpio_of()
1909 dev_err(pctrl->dev, in npcm7xx_gpio_of()
1915 pctrl->gpio_bank[id].irq = irq; in npcm7xx_gpio_of()
1916 pctrl->gpio_bank[id].irq_chip = npcmgpio_irqchip; in npcm7xx_gpio_of()
1917 pctrl->gpio_bank[id].gc.parent = pctrl->dev; in npcm7xx_gpio_of()
1918 pctrl->gpio_bank[id].irqbase = in npcm7xx_gpio_of()
1920 pctrl->gpio_bank[id].pinctrl_id = pinspec.args[0]; in npcm7xx_gpio_of()
1921 pctrl->gpio_bank[id].gc.base = pinspec.args[1]; in npcm7xx_gpio_of()
1922 pctrl->gpio_bank[id].gc.ngpio = pinspec.args[2]; in npcm7xx_gpio_of()
1923 pctrl->gpio_bank[id].gc.owner = THIS_MODULE; in npcm7xx_gpio_of()
1924 pctrl->gpio_bank[id].gc.label = in npcm7xx_gpio_of()
1925 devm_kasprintf(pctrl->dev, GFP_KERNEL, "%pOF", in npcm7xx_gpio_of()
1927 if (pctrl->gpio_bank[id].gc.label == NULL) in npcm7xx_gpio_of()
1930 pctrl->gpio_bank[id].gc.dbg_show = npcmgpio_dbg_show; in npcm7xx_gpio_of()
1931 pctrl->gpio_bank[id].direction_input = in npcm7xx_gpio_of()
1932 pctrl->gpio_bank[id].gc.direction_input; in npcm7xx_gpio_of()
1933 pctrl->gpio_bank[id].gc.direction_input = in npcm7xx_gpio_of()
1935 pctrl->gpio_bank[id].direction_output = in npcm7xx_gpio_of()
1936 pctrl->gpio_bank[id].gc.direction_output; in npcm7xx_gpio_of()
1937 pctrl->gpio_bank[id].gc.direction_output = in npcm7xx_gpio_of()
1939 pctrl->gpio_bank[id].request = in npcm7xx_gpio_of()
1940 pctrl->gpio_bank[id].gc.request; in npcm7xx_gpio_of()
1941 pctrl->gpio_bank[id].gc.request = npcmgpio_gpio_request; in npcm7xx_gpio_of()
1942 pctrl->gpio_bank[id].gc.free = npcmgpio_gpio_free; in npcm7xx_gpio_of()
1943 pctrl->gpio_bank[id].gc.of_node = np; in npcm7xx_gpio_of()
1947 pctrl->bank_num = id; in npcm7xx_gpio_of()
1951 static int npcm7xx_gpio_register(struct npcm7xx_pinctrl *pctrl) in npcm7xx_gpio_register() argument
1955 for (id = 0 ; id < pctrl->bank_num ; id++) { in npcm7xx_gpio_register()
1958 girq = &pctrl->gpio_bank[id].gc.irq; in npcm7xx_gpio_register()
1959 girq->chip = &pctrl->gpio_bank[id].irq_chip; in npcm7xx_gpio_register()
1962 girq->parents = devm_kcalloc(pctrl->dev, 1, in npcm7xx_gpio_register()
1969 girq->parents[0] = pctrl->gpio_bank[id].irq; in npcm7xx_gpio_register()
1972 ret = devm_gpiochip_add_data(pctrl->dev, in npcm7xx_gpio_register()
1973 &pctrl->gpio_bank[id].gc, in npcm7xx_gpio_register()
1974 &pctrl->gpio_bank[id]); in npcm7xx_gpio_register()
1976 dev_err(pctrl->dev, "Failed to add GPIO chip %u\n", id); in npcm7xx_gpio_register()
1980 ret = gpiochip_add_pin_range(&pctrl->gpio_bank[id].gc, in npcm7xx_gpio_register()
1981 dev_name(pctrl->dev), in npcm7xx_gpio_register()
1982 pctrl->gpio_bank[id].pinctrl_id, in npcm7xx_gpio_register()
1983 pctrl->gpio_bank[id].gc.base, in npcm7xx_gpio_register()
1984 pctrl->gpio_bank[id].gc.ngpio); in npcm7xx_gpio_register()
1986 dev_err(pctrl->dev, "Failed to add GPIO bank %u\n", id); in npcm7xx_gpio_register()
1987 gpiochip_remove(&pctrl->gpio_bank[id].gc); in npcm7xx_gpio_register()
1996 gpiochip_remove(&pctrl->gpio_bank[id - 1].gc); in npcm7xx_gpio_register()
2003 struct npcm7xx_pinctrl *pctrl; in npcm7xx_pinctrl_probe() local
2006 pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL); in npcm7xx_pinctrl_probe()
2007 if (!pctrl) in npcm7xx_pinctrl_probe()
2010 pctrl->dev = &pdev->dev; in npcm7xx_pinctrl_probe()
2011 dev_set_drvdata(&pdev->dev, pctrl); in npcm7xx_pinctrl_probe()
2013 pctrl->gcr_regmap = in npcm7xx_pinctrl_probe()
2015 if (IS_ERR(pctrl->gcr_regmap)) { in npcm7xx_pinctrl_probe()
2016 dev_err(pctrl->dev, "didn't find nuvoton,npcm750-gcr\n"); in npcm7xx_pinctrl_probe()
2017 return PTR_ERR(pctrl->gcr_regmap); in npcm7xx_pinctrl_probe()
2020 ret = npcm7xx_gpio_of(pctrl); in npcm7xx_pinctrl_probe()
2022 dev_err(pctrl->dev, "Failed to gpio dt-binding %u\n", ret); in npcm7xx_pinctrl_probe()
2026 pctrl->pctldev = devm_pinctrl_register(&pdev->dev, in npcm7xx_pinctrl_probe()
2027 &npcm7xx_pinctrl_desc, pctrl); in npcm7xx_pinctrl_probe()
2028 if (IS_ERR(pctrl->pctldev)) { in npcm7xx_pinctrl_probe()
2030 return PTR_ERR(pctrl->pctldev); in npcm7xx_pinctrl_probe()
2033 ret = npcm7xx_gpio_register(pctrl); in npcm7xx_pinctrl_probe()
2035 dev_err(pctrl->dev, "Failed to register gpio %u\n", ret); in npcm7xx_pinctrl_probe()