From 261fc64a700803935326bad8301bdde3f62e4f05 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Fri, 30 Sep 2022 16:56:09 +0200 Subject: [PATCH] ubnt: Changeset for 1.12.30 This commit represents the changeset for the UniFi Dream Machine firmware release version v1.12.30 compared to Linux v4.19.152 (with public patches applied). --- drivers/net/phy/realtek.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index 271e8adc39f1..d039a0fe8acf 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -16,6 +16,7 @@ #include #include #include +#include #define RTL821x_PHYSR 0x11 #define RTL821x_PHYSR_DUPLEX BIT(13) @@ -162,6 +163,33 @@ static int rtl8211c_config_init(struct phy_device *phydev) return genphy_config_init(phydev); } +static void rtl8211f_led_config(struct phy_device *phydev) +{ + struct device_node *node; + u32 led_config; + struct of_device_id of_realtek_table[] = { + {.compatible = "realtek,rtl8211fs"}, + { /* end of list */ }, + }; + + node = of_find_matching_node(NULL, of_realtek_table); + if (!node) { + /* rtl8211fs entry could not be found */ + return; + } + + dev_info(&phydev->mdio.dev, "rtl8211fs entry is found\n"); + /* configure LED setup accordingly */ + if (!of_property_read_u32(node, "led-mode", &led_config)) { + dev_info(&phydev->mdio.dev, "led-mode: 0x%04x\n", led_config); + phy_write(phydev, RTL821x_PAGE_SELECT, 0xd04); + phy_write(phydev, 0x10, led_config); + phy_write(phydev, RTL821x_PAGE_SELECT, 0x0); + } + + return; +} + static int rtl8211f_config_init(struct phy_device *phydev) { int ret; @@ -171,6 +199,8 @@ static int rtl8211f_config_init(struct phy_device *phydev) if (ret < 0) return ret; + rtl8211f_led_config(phydev); + /* enable TX-delay for rgmii-id and rgmii-txid, otherwise disable it */ if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)