mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-31 00:24:12 +00:00
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 <daniel@makrotopia.org>
This commit is contained in:
parent
e386b279fd
commit
0c5605b70c
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user