diff options
author | Birger Koblitz <git@birger-koblitz.de> | 2022-02-02 07:29:25 +0100 |
---|---|---|
committer | Daniel Golle <daniel@makrotopia.org> | 2022-02-17 15:21:47 +0000 |
commit | 0538dc693b54e52fdfb8b7cd052eb96b5eb65708 (patch) | |
tree | fbe6968dac4ec1bc3b7f36f6248514a931e96a9f /target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/common.c | |
parent | caaac9ab3bb34a067001595648f6fb6b57621202 (diff) | |
download | upstream-0538dc693b54e52fdfb8b7cd052eb96b5eb65708.tar.gz upstream-0538dc693b54e52fdfb8b7cd052eb96b5eb65708.tar.bz2 upstream-0538dc693b54e52fdfb8b7cd052eb96b5eb65708.zip |
realtek: add support for port led configuration on RTL93XX
Using the led-set attribute of a port in the dts we allow configuration
of the port leds. Each led-set is being defined in the led-set configuration
of the .dts, giving a specific configuration to steer the port LEDs via a serial
connection.
Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
Diffstat (limited to 'target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/common.c')
-rw-r--r-- | target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/common.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/common.c b/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/common.c index ea08ca12fc..9675ba88f1 100644 --- a/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/common.c +++ b/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/common.c @@ -8,6 +8,7 @@ #include <net/netevent.h> #include <linux/inetdevice.h> #include <linux/rhashtable.h> +#include <linux/of_net.h> #include <asm/mach-rtl838x/mach-rtl83xx.h> #include "rtl83xx.h" @@ -310,6 +311,9 @@ static int __init rtl83xx_mdio_probe(struct rtl838x_switch_priv *priv) } for_each_node_by_name(dn, "port") { + phy_interface_t interface; + u32 led_set; + if (of_property_read_u32(dn, "reg", &pn)) continue; @@ -321,6 +325,28 @@ static int __init rtl83xx_mdio_probe(struct rtl838x_switch_priv *priv) continue; } + pr_info("%s port %d has phandle\n", __func__, pn); + if (of_property_read_u32(phy_node, "sds", &priv->ports[pn].sds_num)) + priv->ports[pn].sds_num = -1; + else { + pr_info("%s sds port %d is %d\n", __func__, pn, + priv->ports[pn].sds_num); + } + pr_info("%s port %d has SDS\n", __func__, priv->ports[pn].sds_num); + + if (of_get_phy_mode(dn, &interface)) + interface = PHY_INTERFACE_MODE_NA; + if (interface == PHY_INTERFACE_MODE_HSGMII) + priv->ports[pn].is2G5 = true; + if (interface == PHY_INTERFACE_MODE_USXGMII) + priv->ports[pn].is2G5 = priv->ports[pn].is10G = true; + if (interface == PHY_INTERFACE_MODE_10GBASER) + priv->ports[pn].is10G = true; + + if (of_property_read_u32(dn, "led-set", &led_set)) + led_set = 0; + priv->ports[pn].led_set = led_set; + // Check for the integrated SerDes of the RTL8380M first if (of_property_read_bool(phy_node, "phy-is-integrated") && priv->id == 0x8380 && pn >= 24) { @@ -356,12 +382,6 @@ static int __init rtl83xx_mdio_probe(struct rtl838x_switch_priv *priv) } } - // TODO: Do this needs to come from the .dts - if (priv->family_id == RTL9300_FAMILY_ID) { - priv->ports[24].is2G5 = true; - priv->ports[25].is2G5 = true; - } - /* Disable MAC polling the PHY so that we can start configuration */ priv->r->set_port_reg_le(0ULL, priv->r->smi_poll_ctrl); |