From: Daniel Golle Date: Sun, 18 Jun 2023 01:22:51 +0000 (+0200) Subject: mediatek: prepare old rtk switch driver for use with Linux 6.1 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=0c5605b70c7853eff73e5a6d7dfb4b650e0b4420;p=openwrt%2Fstaging%2Fansuel.git mediatek: prepare old rtk switch driver for use with Linux 6.1 The old RealTek RTL8367S switch driver which is used for some MT7622 devices needs to be modified to no longer free the GPIO after reset has completed. This is due to Linux 5.19 removing devm_gpio_free via commit 2b038e786f83 ("gpiolib: devres: Get rid of unused devm_gpio_free()") Signed-off-by: Daniel Golle --- diff --git a/target/linux/mediatek/files/drivers/net/phy/rtk/rtl8367s_mdio.c b/target/linux/mediatek/files/drivers/net/phy/rtk/rtl8367s_mdio.c index ae958e8967..08d2b57d43 100644 --- a/target/linux/mediatek/files/drivers/net/phy/rtk/rtl8367s_mdio.c +++ b/target/linux/mediatek/files/drivers/net/phy/rtk/rtl8367s_mdio.c @@ -71,16 +71,10 @@ unsigned int mii_mgr_write(unsigned int phy_addr,unsigned int phy_register,unsig static int rtl8367s_hw_reset(void) { struct rtk_gsw *gsw = _gsw; - int ret; if (gsw->reset_pin < 0) return 0; - ret = devm_gpio_request(gsw->dev, gsw->reset_pin, "mediatek,reset-pin"); - - if (ret) - printk("fail to devm_gpio_request\n"); - gpio_direction_output(gsw->reset_pin, 0); usleep_range(1000, 1100); @@ -89,10 +83,7 @@ static int rtl8367s_hw_reset(void) mdelay(500); - devm_gpio_free(gsw->dev, gsw->reset_pin); - return 0; - } static int rtl8367s_vlan_config(int want_at_p0) @@ -235,6 +226,7 @@ static int rtk_gsw_probe(struct platform_device *pdev) struct mii_bus *mdio_bus; struct rtk_gsw *gsw; const char *pm; + int ret; mdio = of_parse_phandle(np, "mediatek,mdio", 0); @@ -256,6 +248,11 @@ static int rtk_gsw_probe(struct platform_device *pdev) gsw->bus = mdio_bus; gsw->reset_pin = of_get_named_gpio(np, "mediatek,reset-pin", 0); + if (gsw->reset_pin >= 0) { + ret = devm_gpio_request(gsw->dev, gsw->reset_pin, "mediatek,reset-pin"); + if (ret) + printk("fail to devm_gpio_request\n"); + } _gsw = gsw;