Commit 2254e776 authored by Etienne Carriere's avatar Etienne Carriere Committed by Linus Walleij

pinctrl: stm32: defer probe if reset resource is not yet ready

Defer probe when pin controller reset is defined in the system resources
but not yet probed.
Signed-off-by: default avatarEtienne Carriere <etienne.carriere@st.com>
Signed-off-by: default avatarAlexandre Torgue <alexandre.torgue@st.com>
Link: https://lore.kernel.org/r/20200615125407.27632-3-alexandre.torgue@st.comSigned-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent d888229e
...@@ -84,6 +84,7 @@ struct stm32_pinctrl_group { ...@@ -84,6 +84,7 @@ struct stm32_pinctrl_group {
struct stm32_gpio_bank { struct stm32_gpio_bank {
void __iomem *base; void __iomem *base;
struct clk *clk; struct clk *clk;
struct reset_control *rstc;
spinlock_t lock; spinlock_t lock;
struct gpio_chip gpio_chip; struct gpio_chip gpio_chip;
struct pinctrl_gpio_range range; struct pinctrl_gpio_range range;
...@@ -1202,13 +1203,11 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl, ...@@ -1202,13 +1203,11 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl,
struct of_phandle_args args; struct of_phandle_args args;
struct device *dev = pctl->dev; struct device *dev = pctl->dev;
struct resource res; struct resource res;
struct reset_control *rstc;
int npins = STM32_GPIO_PINS_PER_BANK; int npins = STM32_GPIO_PINS_PER_BANK;
int bank_nr, err; int bank_nr, err;
rstc = of_reset_control_get_exclusive(np, NULL); if (!IS_ERR(bank->rstc))
if (!IS_ERR(rstc)) reset_control_deassert(bank->rstc);
reset_control_deassert(rstc);
if (of_address_to_resource(np, 0, &res)) if (of_address_to_resource(np, 0, &res))
return -ENODEV; return -ENODEV;
...@@ -1516,6 +1515,11 @@ int stm32_pctl_probe(struct platform_device *pdev) ...@@ -1516,6 +1515,11 @@ int stm32_pctl_probe(struct platform_device *pdev)
struct stm32_gpio_bank *bank = &pctl->banks[i]; struct stm32_gpio_bank *bank = &pctl->banks[i];
if (of_property_read_bool(child, "gpio-controller")) { if (of_property_read_bool(child, "gpio-controller")) {
bank->rstc = of_reset_control_get_exclusive(child,
NULL);
if (PTR_ERR(bank->rstc) == -EPROBE_DEFER)
return -EPROBE_DEFER;
bank->clk = of_clk_get_by_name(child, NULL); bank->clk = of_clk_get_by_name(child, NULL);
if (IS_ERR(bank->clk)) { if (IS_ERR(bank->clk)) {
if (PTR_ERR(bank->clk) != -EPROBE_DEFER) if (PTR_ERR(bank->clk) != -EPROBE_DEFER)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment