Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pinctrl: microchip sgpio: use reset driver

On lan966x platform when the switch gets reseted then also the sgpio
gets reseted. The fix for this is to extend also the sgpio driver to
call the reset driver which will be reseted only once by the first
driver that is probed.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Reviewed-by: Steen Hegelund <steen.hegelund@microchip.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Link: https://lore.kernel.org/r/20211018085754.1066056-3-horatiu.vultur@microchip.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Horatiu Vultur and committed by
Linus Walleij
0b90315a 8a097ff4

+7
+7
drivers/pinctrl/pinctrl-microchip-sgpio.c
··· 17 17 #include <linux/pinctrl/pinmux.h> 18 18 #include <linux/platform_device.h> 19 19 #include <linux/property.h> 20 + #include <linux/reset.h> 20 21 21 22 #include "core.h" 22 23 #include "pinconf.h" ··· 804 803 int div_clock = 0, ret, port, i, nbanks; 805 804 struct device *dev = &pdev->dev; 806 805 struct fwnode_handle *fwnode; 806 + struct reset_control *reset; 807 807 struct sgpio_priv *priv; 808 808 struct clk *clk; 809 809 u32 val; ··· 814 812 return -ENOMEM; 815 813 816 814 priv->dev = dev; 815 + 816 + reset = devm_reset_control_get_optional_shared(&pdev->dev, "switch"); 817 + if (IS_ERR(reset)) 818 + return dev_err_probe(dev, PTR_ERR(reset), "Failed to get reset\n"); 819 + reset_control_reset(reset); 817 820 818 821 clk = devm_clk_get(dev, NULL); 819 822 if (IS_ERR(clk))