[][kernel][common][eth][Add a Ethernet passive Mux support]
[Description]
Add a Ethernet passive Mux support.
If your board that XGMAC1 connects a 10G PHY and a SFP cage through a
passive Mux, please apply the patch as follows.
==============================================================
phy-handle = <&phy8>;
};
};
+
+ mux: mux-bus {
+ mux1: ethernet-mux@1 {
+ compatible = "mediatek,eth-mux";
+ reg = <1>;
+
+ chan-sel-gpios = <&pio 30 0>;
+ mod-def0-gpios = <&pio 82 1>;
+
+ channel0: channel@0 {
+ reg = <0>;
+ mac-type = "xgdm";
+ phy-mode = "usxgmii";
+ phy-handle = <&phy0>;
+ };
+
+ channel1: channel@1 {
+ reg = <1>;
+ mac-type = "xgdm";
+ phy-mode = "10gbase-kr";
+ managed = "in-band-status";
+ sfp = <&sfp_esp1>;
+ };
+ };
+ };
mdio: mdio-bus {
#address-cells = <1>;
#size-cells = <0>;
==============================================================
After applying this patch, the ETH driver has the ability to dynamically
switch the network interface via a passive Mux.
Without this patch, the ETH driver is unable to dynamically switch the
network interface between the 10G PHY and the SFP cage.
[Release-log]
N/A
Change-Id: I9d55370ca6952dd08d28e4151c1139737c4918a2
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/7979960
diff --git a/target/linux/mediatek/patches-5.4/999-2730-net-phy-sfp-change-shared-mod-def0.patch b/target/linux/mediatek/patches-5.4/999-2730-net-phy-sfp-change-shared-mod-def0.patch
new file mode 100644
index 0000000..479f58b
--- /dev/null
+++ b/target/linux/mediatek/patches-5.4/999-2730-net-phy-sfp-change-shared-mod-def0.patch
@@ -0,0 +1,43 @@
+From c576ce67488bc8b0285933f315cb183c9171f199 Mon Sep 17 00:00:00 2001
+From: Bo-Cun Chen <bc-bocun.chen@mediatek.com>
+Date: Thu, 7 Sep 2023 12:01:57 +0800
+Subject: [PATCH] 999-2730-net-phy-sfp-change-shared-mod-def0
+
+---
+ drivers/net/phy/sfp.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
+index 0c335b1..d49a825 100644
+--- a/drivers/net/phy/sfp.c
++++ b/drivers/net/phy/sfp.c
+@@ -152,7 +152,7 @@ static const char *gpio_of_names[] = {
+ };
+
+ static const enum gpiod_flags gpio_flags[] = {
+- GPIOD_IN,
++ GPIOD_IN | GPIOD_FLAGS_BIT_NONEXCLUSIVE,
+ GPIOD_IN,
+ GPIOD_IN,
+ GPIOD_ASIS,
+@@ -512,7 +512,7 @@ static unsigned int sfp_gpio_get_state(struct sfp *sfp)
+ unsigned int i, state, v;
+
+ for (i = state = 0; i < GPIO_MAX; i++) {
+- if (gpio_flags[i] != GPIOD_IN || !sfp->gpio[i])
++ if (((gpio_flags[i] & GPIOD_IN) != GPIOD_IN) || !sfp->gpio[i])
+ continue;
+
+ v = gpiod_get_value_cansleep(sfp->gpio[i]);
+@@ -2757,7 +2757,7 @@ static int sfp_probe(struct platform_device *pdev)
+ }
+
+ for (i = 0; i < GPIO_MAX; i++) {
+- if (gpio_flags[i] != GPIOD_IN || !sfp->gpio[i])
++ if (((gpio_flags[i] & GPIOD_IN) != GPIOD_IN) || !sfp->gpio[i])
+ continue;
+
+ sfp->gpio_irq[i] = gpiod_to_irq(sfp->gpio[i]);
+--
+2.18.0
+