Repository navigation
Conversation
5b69b0c to
1fa5daf
Compare
strrs
left a comment
There was a problem hiding this comment.
I've been waiting for this for a long time. I've commented in a few places, as far as I can tell; please consider those if they're helpful. Thank you.
7d36d11 to
261ead1
Compare
|
My mistake, the GitHub suggestion blocks were malformed. My suggestions removed lines instead of replacing them because I didn't select all the lines that the change spans. |
261ead1 to
fde7588
Compare
fde7588 to
c9545a2
Compare
|
big thx to @ecsv Sven :-) main...carlosz1986:openwrt:hasivo_S1300WP-8XGT-4S-plus_clean |
|
Short note. Generic patch for RTL8261 suspend handling is incoming See #23386 |
openwrt-ai
left a comment
There was a problem hiding this comment.
Commit checks
04cfb0e5c1"generic: net: phy: realtek: add 5G and 10G PHY support" — bundles a one-line change totarget/linux/airoha/an7581/base-files/etc/init.d/airoha_fan(hwmon fallbackhwmon3→hwmon5) that the commit message body doesn't mention. The change is plausibly a downstream effect of the new realtek driver registering its own hwmon, but a reader of just the commit log can't tell. Either call it out in the message or split it off.
CI on 04cfb0e5c1 is still partly queued, but every completed run on this head is green — no CI-grounded comments. Many concerns raised earlier in the 46-thread review history have already been addressed by the author (range-check on us_diff, le16_to_cpu() for log fields, dropped phydev_info() spam, return values checked in rtl826x_config_init(), license fixed, patch filename typo fixed, eval-board package overshoot dropped, etc.) — not re-raising those.
Generated by Claude Code
| fi | ||
| done | ||
| echo "/sys/class/hwmon/hwmon3" # fallback | ||
| echo "/sys/class/hwmon/hwmon5" # fallback |
There was a problem hiding this comment.
nit: this hunk is bundled into commit 04cfb0e5c1 ("generic: net: phy: realtek: add 5G and 10G PHY support") but the commit body doesn't mention it. The bump is presumably needed because the new upstream realtek driver also calls rtl822x_hwmon_init()(viartl826x_probe()whenCONFIG_REALTEK_PHY_HWMONis enabled), registering an extra hwmon and shifting the nct7802 index — but a maintainer reading just the commit log won't see why this index moved. Worth either mentioning the cause in the commit message, or splitting this fan-script tweak into its own commit. Also, sincefind_nct7802()already walks every/sys/class/hwmon/hwmon*looking forname == "nct7802"`, this fallback only matters when the nct7802 driver isn't bound at all — in that case any hard-coded index is wrong, so this is only a stopgap.
Generated by Claude Code
There was a problem hiding this comment.
hey leave the ai alone :)
it often gives legitimately useful comments. this one, yeah just ignore it.
Ok, added @carlosz1986's changes to the last patch diff --git 1/./build_dir/target-mips_24kc_musl/linux-realtek_rtl930x/linux-6.18.26/drivers/net/phy/realtek/realtek_main.c 2/./build_dir/target-mips_24kc_musl/linux-realtek_rtl930x/linux-6.18.26/drivers/net/phy/realtek/realtek_main.c
index 114dd56cc3..31d1d2f3d0 100644
--- 1/./build_dir/target-mips_24kc_musl/linux-realtek_rtl930x/linux-6.18.26/drivers/net/phy/realtek/realtek_main.c
+++ 2/./build_dir/target-mips_24kc_musl/linux-realtek_rtl930x/linux-6.18.26/drivers/net/phy/realtek/realtek_main.c
@@ -2778,8 +2778,12 @@ static int rtl826x_probe(struct phy_device *phydev)
priv->pnswap_tx = device_property_read_bool(dev, "realtek,pnswap-tx");
priv->pnswap_rx = device_property_read_bool(dev, "realtek,pnswap-rx");
+ priv->enable_pma_low_power = device_property_read_bool(dev, "realtek,enable-pma-low-power");
phydev->priv = priv;
+ if (!priv->enable_pma_low_power)
+ phydev_warn(phydev, "PMA low-power suspend disabled\n");
+
/* Disable EEE due to link stability issues */
phy_disable_eee_mode(phydev, ETHTOOL_LINK_MODE_100baseT_Full_BIT);
phy_disable_eee_mode(phydev, ETHTOOL_LINK_MODE_1000baseT_Full_BIT);
@@ -2882,6 +2886,16 @@ static int rtl826x_config_init(struct phy_device *phydev)
return ret;
}
+static int rtl826x_suspend(struct phy_device *phydev)
+{
+ struct rtl826x_priv *priv = phydev->priv;
+
+ if (!priv->enable_pma_low_power)
+ return -EOPNOTSUPP;
+
+ return genphy_c45_pma_suspend(phydev);
+}
+
static int rtl826x_get_features(struct phy_device *phydev)
{
int ret;
@@ -3538,7 +3552,7 @@ static struct phy_driver realtek_drvs[] = {
.config_init = rtl826x_config_init,
.probe = rtl8261n_probe,
.get_features = rtl825xb_get_features,
- .suspend = genphy_c45_pma_suspend,
+ .suspend = rtl826x_suspend,
.resume = rtlgen_c45_resume,
.config_aneg = rtl826x_config_aneg,
.aneg_done = genphy_c45_aneg_done,
@@ -3555,7 +3569,7 @@ static struct phy_driver realtek_drvs[] = {
.config_init = rtl826x_config_init,
.probe = rtl8264b_probe,
.get_features = rtl825xb_get_features,
- .suspend = genphy_c45_pma_suspend,
+ .suspend = rtl826x_suspend,
.resume = rtlgen_c45_resume,
.config_aneg = rtl826x_config_aneg,
.aneg_done = genphy_c45_aneg_done,
@@ -3572,7 +3586,7 @@ static struct phy_driver realtek_drvs[] = {
.config_init = rtl826x_config_init,
.probe = rtl8261n_probe,
.get_features = rtl826x_get_features,
- .suspend = genphy_c45_pma_suspend,
+ .suspend = rtl826x_suspend,
.resume = rtlgen_c45_resume,
.config_aneg = rtl826x_config_aneg,
.aneg_done = genphy_c45_aneg_done,
@@ -3589,7 +3603,7 @@ static struct phy_driver realtek_drvs[] = {
.config_init = rtl826x_config_init,
.probe = rtl8261n_probe,
.get_features = rtl826x_get_features,
- .suspend = genphy_c45_pma_suspend,
+ .suspend = rtl826x_suspend,
.resume = rtlgen_c45_resume,
.config_aneg = rtl826x_config_aneg,
.aneg_done = genphy_c45_aneg_done,
@@ -3607,7 +3621,7 @@ static struct phy_driver realtek_drvs[] = {
.config_init = rtl826x_config_init,
.probe = rtl8264b_probe,
.get_features = rtl826x_get_features,
- .suspend = genphy_c45_pma_suspend,
+ .suspend = rtl826x_suspend,
.resume = rtlgen_c45_resume,
.config_aneg = rtl826x_config_aneg,
.aneg_done = genphy_c45_aneg_done,
@@ -3623,7 +3637,7 @@ static struct phy_driver realtek_drvs[] = {
.config_init = rtl826x_config_init,
.probe = rtl8264b_probe,
.get_features = rtl826x_get_features,
- .suspend = genphy_c45_pma_suspend,
+ .suspend = rtl826x_suspend,
.resume = rtlgen_c45_resume,
.config_aneg = rtl826x_config_aneg,
.aneg_done = genphy_c45_aneg_done, |
|
Thanks. This is too long in the making. Cannot keep every progress in my little brain. Sorry for not directly handing new PRs over here. Perhaps one day someone will say, "Attention—I'm pressing (the button)," and thereby finally trigger the merge. |
|
Agree completely. This driver is a significant step improvement over what is currently there (and it doesn't even remove the old driver like earlier iterations). All significant issues have long been resolved. It has been looked over, tested, reviewed, commented by, etc. literally by dozens of people now. The benefits of committing this now far exceed whatever measly gains can be achieved by letting this incubate further and exploding all our brains. |
openwrt-ai
left a comment
There was a problem hiding this comment.
Reviewed 1 new commit; no new issues found.
The only changes since the previous review at 04cfb0e5c1 are the new opt-in realtek,enable-pma-low-power DT property plus the rtl826x_suspend wrapper (both 6.12 and 6.18 hack patches), and the resulting hunk-offset refresh on 024-02 and 740. The design — default-off plus phydev_warn to alert non-Realtek consumers — matches what plappermaul explicitly asked for in PR #23386 review comment, so the warn-on-every-probe is intentional and not log spam to flag.
Generated by Claude Code
|
@robimarko @hauke It seems as if 20 participants agree that this is a step forward. Please push the button as you have never pushed before. |
|
Looking at the code I think we should not introduce new downstream vendor properties for things which are supportable using standard upstream properties. That means we need to get rid of |
|
This sounds like it can be done in a nice and small follow-up PR. I see no urge to force this in here. |
@dangowrt They are not new, they are there to get it to work with the existing codebase (which already uses
The only user of I can't test this myself but this would be my proposal for 6.18 diff --git i/target/linux/generic/hack-6.18/736-net-phy-realtek-add-5G-and-10G-PHY-support.patch w/target/linux/generic/hack-6.18/736-net-phy-realtek-add-5G-and-10G-PHY-support.patch
index 3929320c0b..49e3796a1b 100644
--- i/target/linux/generic/hack-6.18/736-net-phy-realtek-add-5G-and-10G-PHY-support.patch
+++ w/target/linux/generic/hack-6.18/736-net-phy-realtek-add-5G-and-10G-PHY-support.patch
@@ -33,7 +33,7 @@ Signed-off-by: Balázs Triszka <[email protected]>
obj-$(CONFIG_REALTEK_PHY) += realtek.o
--- a/drivers/net/phy/realtek/realtek.h
+++ b/drivers/net/phy/realtek/realtek.h
-@@ -5,6 +5,16 @@
+@@ -5,6 +5,14 @@
#include <linux/phy.h>
@@ -42,8 +42,6 @@ Signed-off-by: Balázs Triszka <[email protected]>
+
+struct rtl826x_priv {
+ struct rtlgen_phy_patch_db *patch;
-+ bool pnswap_tx:1;
-+ bool pnswap_rx:1;
+ bool enable_pma_low_power:1;
+};
+
@@ -52,7 +50,13 @@ Signed-off-by: Balázs Triszka <[email protected]>
#endif /* REALTEK_H */
--- a/drivers/net/phy/realtek/realtek_main.c
+++ b/drivers/net/phy/realtek/realtek_main.c
-@@ -16,6 +16,7 @@
+@@ -11,11 +11,13 @@
+ #include <linux/ethtool_netlink.h>
+ #include <linux/of.h>
+ #include <linux/phy.h>
++#include <linux/phy/phy-common-props.h>
+ #include <linux/pm_wakeirq.h>
+ #include <linux/netdevice.h>
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/clk.h>
@@ -60,7 +64,7 @@ Signed-off-by: Balázs Triszka <[email protected]>
#include <linux/string_choices.h>
#include <net/phy/realtek_phy.h>
-@@ -205,10 +206,26 @@
+@@ -205,10 +207,26 @@
#define RTL_8221B_VM_CG 0x001cc84a
#define RTL_8251B 0x001cc862
#define RTL_8261C 0x001cc890
@@ -87,7 +91,7 @@ Signed-off-by: Balázs Triszka <[email protected]>
MODULE_DESCRIPTION("Realtek PHY driver");
MODULE_AUTHOR("Johnson Leung");
MODULE_LICENSE("GPL");
-@@ -1993,6 +2010,125 @@ static int rtl8251b_c45_match_phy_device
+@@ -1993,6 +2011,125 @@ static int rtl8251b_c45_match_phy_device
return rtlgen_is_c45_match(phydev, RTL_8251B, true);
}
@@ -213,7 +217,7 @@ Signed-off-by: Balázs Triszka <[email protected]>
static int rtlgen_resume(struct phy_device *phydev)
{
int ret = genphy_resume(phydev);
-@@ -2214,6 +2350,478 @@ static int rtlgen_sfp_config_aneg(struct
+@@ -2214,6 +2351,493 @@ static int rtlgen_sfp_config_aneg(struct
return 0;
}
@@ -226,8 +230,6 @@ Signed-off-by: Balázs Triszka <[email protected]>
+ if (!priv)
+ return -ENOMEM;
+
-+ priv->pnswap_tx = device_property_read_bool(dev, "realtek,pnswap-tx");
-+ priv->pnswap_rx = device_property_read_bool(dev, "realtek,pnswap-rx");
+ priv->enable_pma_low_power = device_property_read_bool(dev, "realtek,enable-pma-low-power");
+ phydev->priv = priv;
+
@@ -274,9 +276,40 @@ Signed-off-by: Balázs Triszka <[email protected]>
+ return 0;
+}
+
++static int rtl826x_config_serdes_polarity(struct phy_device *phydev)
++{
++ struct device *dev = &phydev->mdio.dev;
++ unsigned int pol;
++ u16 mask = 0;
++ u16 set = 0;
++ int ret;
++
++ ret = phy_get_rx_polarity(dev_fwnode(dev), phy_modes(phydev->interface),
++ BIT(PHY_POL_NORMAL) | BIT(PHY_POL_INVERT),
++ PHY_POL_NORMAL, &pol);
++ if (ret)
++ return ret;
++
++ mask |= RTL826X_VEND1_SERDES_GLOBAL_CFG_HSI_INV;
++ if (pol == PHY_POL_INVERT)
++ set |= RTL826X_VEND1_SERDES_GLOBAL_CFG_HSI_INV;
++
++ ret = phy_get_tx_polarity(dev_fwnode(dev), phy_modes(phydev->interface),
++ BIT(PHY_POL_NORMAL) | BIT(PHY_POL_INVERT),
++ PHY_POL_NORMAL, &pol);
++ if (ret)
++ return ret;
++
++ mask |= RTL826X_VEND1_SERDES_GLOBAL_CFG_HSO_INV;
++ if (pol == PHY_POL_INVERT)
++ set |= RTL826X_VEND1_SERDES_GLOBAL_CFG_HSO_INV;
++
++ return phy_modify_mmd(phydev, MDIO_MMD_VEND1, RTL826X_VEND1_SERDES_GLOBAL_CFG,
++ mask, set);
++}
++
+static int rtl826x_config_init(struct phy_device *phydev)
+{
-+ struct rtl826x_priv *priv = phydev->priv;
+ const unsigned int max_dereset_tries = 5;
+ unsigned int tries = 0;
+ int ret;
@@ -319,21 +352,7 @@ Signed-off-by: Balázs Triszka <[email protected]>
+ return ret;
+ }
+
-+ if (priv->pnswap_tx) {
-+ ret = phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, RTL826X_VEND1_SERDES_GLOBAL_CFG,
-+ RTL826X_VEND1_SERDES_GLOBAL_CFG_HSO_INV);
-+ if (ret < 0)
-+ return ret;
-+ }
-+
-+ if (priv->pnswap_rx) {
-+ ret = phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, RTL826X_VEND1_SERDES_GLOBAL_CFG,
-+ RTL826X_VEND1_SERDES_GLOBAL_CFG_HSI_INV);
-+ if (ret < 0)
-+ return ret;
-+ }
-+
-+ return ret;
++ return rtl826x_config_serdes_polarity(phydev);
+}
+
+static int rtl826x_suspend(struct phy_device *phydev)
@@ -692,7 +711,7 @@ Signed-off-by: Balázs Triszka <[email protected]>
static struct phy_driver realtek_drvs[] = {
{
PHY_ID_MATCH_EXACT(0x00008201),
-@@ -2520,6 +3128,108 @@ static struct phy_driver realtek_drvs[]
+@@ -2520,6 +3144,108 @@ static struct phy_driver realtek_drvs[]
.resume = genphy_resume,
.read_mmd = genphy_read_mmd_unsupported,
.write_mmd = genphy_write_mmd_unsupported,
@@ -801,3 +820,13 @@ Signed-off-by: Balázs Triszka <[email protected]>
},
};
+--- a/drivers/net/phy/realtek/Kconfig
++++ b/drivers/net/phy/realtek/Kconfig
+@@ -1,6 +1,7 @@
+ # SPDX-License-Identifier: GPL-2.0-only
+ config REALTEK_PHY
+ tristate "Realtek PHYs"
++ select PHY_COMMON_PROPS
+ help
+ Currently supports RTL821x/RTL822x and fast ethernet PHYs
+
|
|
Sorry, but downstream properties are meant to be replaced by upstream handling if available. Introducing new downstream properties (and thereby encouraging their use) just to later remove them again (and then having to clean users) seems like extra work for me. If there is just one board using them, place make the effort and mitigate that now instead of later (I did the same here be0a49c for a similar case). Also, the Airoha target looks like 6.18 is almost ready. #21019 |
This is why I proposed to have the new properties for 6.18
This is an already existing property
It is just not building and break stuff. But ok, if you prefer it like this. And we already discussed this a weeks ago: #22563 (review)
As testing kernel... I think this PR will never end unless I end it myself. |
This is required by the realtek PHY driver for: * rtl8261n.bin (package "rtl8261n-firmware" or "rtl8261n-lp-firmware") - RTL8251L 5Gbps PHY - RTL8261BE 10Gbps PHY - RTL8261N 10Gbps PHY * rtl8264b.bin (package "rtl8264b-firmware") - RTL8254B 5Gbps PHY - RTL8264 10Gbps PHY - RTL8264B 10Gbps PHY These PHY chips need a sequence of register writes for initialization. These are provided as firmware files which are interpreted/applied by a new register patch engine. For the moment, the patch instructions in rtl8261-firmware and rtl8264b-firmware are the same as from the rtl8261n driver. This should make it possible to first evaluate the patch engine and driver development for switching over in adjusting the patch instructions. Signed-off-by: Balázs Triszka <[email protected]> [sven: rebase, split, fix package version/release, use conf from rtl8261n driver] Signed-off-by: Sven Eckelmann <[email protected]>
Newer Realtek PHY chips need a sequence of register writes for initialization. These sequences were extracted from the realtek-phy driver and can be found as firmware files in the packages: * rtl8261n-firmware * rtl8261n-lp-firmware * rtl8264b-firmware The patch engine will read these files and apply when the phy driver requests it during the probing of the PHY. Signed-off-by: Balázs Triszka <[email protected]> Co-authored-by: Semih Baskan <[email protected]> Signed-off-by: Semih Baskan <[email protected]> [sven: rebase, integrate suggestions from PR, split] Signed-off-by: Sven Eckelmann <[email protected]>
Use the upstream properties to describe the USXGMII PCS polarity as
the downstream realtek,pnswap{,-rx,tx} was dropped.
This board was the only user.
Signed-off-by: Daniel Golle <[email protected]>
[sven: adjust for w1700k as requested]
Signed-off-by: Sven Eckelmann <[email protected]>
|
Rebased to get rid of the conflicts. Here is the range-diff: And yes, it is normal that it doesn't build at the moment with the changes requested by @dangowrt. I don't want to see any comments about creating a PR which doesn't even build. |
|
I've now readded the 6.12 version (without the pnswap attributes) to not also loose TPlink-BE450 and Keenetic Kap-630. Hard enough that we have to kill the W1700k support for some "change of plan". |
|
Works well on w1700k, after recent changes. Thank you for your work |
Hm? It doesnt even build for me EDIT: Now read (in the next comment) that you are using 6.18 - something currently not in OpenWrt for Airoha. Please try to add this information. Because without it, it is quite confusing. But with this information, it is quite valuable for me because I couldn't test the polarity changes myself and now know that they are working (for you). |
|
Need to check for 6.12, but for 6.18 builds normally |
The 7.0 backports adding |
openwrt-ai
left a comment
There was a problem hiding this comment.
Reviewed 2 new commits (7b4ae69 adding the w1700k tx-polarity/rx-polarity migration, plus the rebase of 43c33fd switching the realtek hack patch from downstream realtek,pnswap-* reads to the upstream phy_get_rx_polarity() / phy_get_tx_polarity() API and adding select PHY_COMMON_PROPS on 6.18). The 6.12 patch correctly drops the polarity plumbing entirely (no PHY_COMMON_PROPS backport on 6.12 yet), matching what's described in the PR body. Hunk-offset refresh on 024-02/024-04/720/740/743 is mechanical.
The migration matches what dangowrt asked for in the earlier polarity discussion and what plappermaul flagged about the now-merged upstream backport at 18cbd83a14 - no new issues to flag.
CI on 43c33fd is mostly still queued and the one completed run was cancelled by a newer push, not by failure - no CI-grounded comments.
Generated by Claude Code
The functionality/support for 5G and 10G PHYs was extracted from the realtek-phy driver and ported to the upstream Linux realtek PHY driver. These PHY chips need a sequence of register writes (and similar operations) for initialization. These sequences are provided as firmware files which are interpreted/applied by a new register patch engine. By switching to the upstream driver, it should be possible to get rid of a large chunk of (from OpenWrt perspective) unmaintained code from Realtek. The actual Linux phy-core infrastructure from Linux can be mostly used and only the Realtek specific quirks need to be handled. The files which need to be provided are depending on the PHY: * rtl8261n.bin (package "rtl8261n-firmware" or "rtl8261n-lp-firmware") - RTL8251L 5Gbps PHY - RTL8261BE 10Gbps PHY - RTL8261N 10Gbps PHY * rtl8264b.bin (package "rtl8264b-firmware") - RTL8254B 5Gbps PHY - RTL8264 10Gbps PHY - RTL8264B 10Gbps PHY Files which are affected by this change (DEVICE_PACKAGES dependencies, hwmon paths, default kernel configurations, refresh of patches, ...) are updated at the same times. Signed-off-by: Balázs Triszka <[email protected]> Co-authored-by: Semih Baskan <[email protected]> Co-authored-by: Jonas Jelonek <[email protected]> Co-authored-by: Gilly1970 <[email protected]> Co-authored-by: Aleksander Jan Bajkowski <[email protected]> Co-authored-by: Carlo Szelinsky <[email protected]> [sven: rebase, integrate suggestions from PR, add device packages, split] Signed-off-by: Sven Eckelmann <[email protected]>
openwrt-ai
left a comment
There was a problem hiding this comment.
Reviewed 1 new commit; no new issues found.
The only delta since the previous review at 43c33fd is a 3-line cleanup in target/linux/generic/hack-6.12/736-net-phy-realtek-add-5G-and-10G-PHY-support.patch: removing the unused struct rtl826x_priv *priv = phydev->priv; declaration from rtl826x_config_init() in the 6.12 hack. After polarity plumbing was stripped from 6.12 in the prior rebase, that local was dead code (the 6.18 sibling never had it). priv is still correctly retained where it is actually dereferenced (rtl826x_suspend()).
CI on ef2b1a85a3 is still partly queued/pending and the prior heads ran clean - no CI-grounded comments.
Generated by Claude Code
|
I took the freedom and brought this into a shape which I'd be willing to merge in #23427 |
Diff: diff --git a/package/firmware/rtl826x-firmware/Makefile b/package/firmware/rtl826x-firmware/Makefile
index 661bc36c03..1c874438d3 100644
--- a/package/firmware/rtl826x-firmware/Makefile
+++ b/package/firmware/rtl826x-firmware/Makefile
@@ -27,12 +27,14 @@ define Package/rtl8261n-firmware
SECTION:=firmware
CATEGORY:=Firmware
TITLE:=Realtek RTL8251L/RTL8261BE/RTL8261N firmware
+ VERSION:=20221115
endef
define Package/rtl8261n-lp-firmware
SECTION:=firmware
CATEGORY:=Firmware
TITLE:=Realtek RTL8251L/RTL8261BE/RTL8261N low-power firmware
+ VERSION:=20221115
PROVIDES:=rtl8261n-firmware
CONFLICTS:=rtl8261n-firmware
endef
@@ -41,6 +43,7 @@ define Package/rtl8264b-firmware
SECTION:=firmware
CATEGORY:=Firmware
TITLE:=Realtek RTL8254B/RTL8264/RTL8264B firmware
+ VERSION:=20221215
endef
define Package/rtl8261n-firmware/install
diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk
index 092c12d131..a4d16a2dfb 100644
--- a/package/kernel/linux/modules/netdevices.mk
+++ b/package/kernel/linux/modules/netdevices.mk
@@ -579,7 +579,7 @@ define KernelPackage/phy-rtl8261n
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=Realtek RTL8261N NBASE-T PHY driver
KCONFIG:=CONFIG_RTL8261N_PHY
- DEPENDS:=+kmod-libphy
+ DEPENDS:=@LINUX_6_12 +kmod-libphy
FILES:=$(LINUX_DIR)/drivers/net/phy/rtl8261n/rtl8261n.ko
AUTOLOAD:=$(call AutoLoad,18,rtl8261n,1)
endef
diff --git a/target/linux/airoha/an7581/base-files/etc/init.d/airoha_fan b/target/linux/airoha/an7581/base-files/etc/init.d/airoha_fan
index d30205f546..ab9eeca83a 100755
--- a/target/linux/airoha/an7581/base-files/etc/init.d/airoha_fan
+++ b/target/linux/airoha/an7581/base-files/etc/init.d/airoha_fan
@@ -15,7 +15,7 @@ find_nct7802()
return
fi
done
- echo "/sys/class/hwmon/hwmon5" # fallback
+ echo "/sys/class/hwmon/hwmon3" # fallback
}
boot()
diff --git a/target/linux/airoha/image/an7581.mk b/target/linux/airoha/image/an7581.mk
index 1febf97db1..30a7b6e538 100644
--- a/target/linux/airoha/image/an7581.mk
+++ b/target/linux/airoha/image/an7581.mk
@@ -103,7 +103,7 @@ define Device/gemtek_w1700k-ubi
the end of flash. A reinstall including corrected chainloader is needed.
DEVICE_PACKAGES := airoha-en7581-mt7996-npu-firmware \
fitblk kmod-i2c-an7581 kmod-hwmon-nct7802 \
- kmod-mt7996-firmware kmod-phy-realtek rtl8261n-firmware \
+ kmod-mt7996-firmware kmod-phy-rtl8261n \
wpad-basic-mbedtls
UBINIZE_OPTS := -E 5
BLOCKSIZE := 128k
diff --git a/target/linux/generic/config-6.18 b/target/linux/generic/config-6.18
index 6373a39880..9f2699f248 100644
--- a/target/linux/generic/config-6.18
+++ b/target/linux/generic/config-6.18
@@ -5523,7 +5523,6 @@ CONFIG_RTC_SYSTOHC_DEVICE="rtc0"
# CONFIG_RTL8180 is not set
# CONFIG_RTL8187 is not set
# CONFIG_RTL8192E is not set
-# CONFIG_RTL8261N_PHY is not set
# CONFIG_RTL8306_PHY is not set
# CONFIG_RTL8366RB_PHY is not set
# CONFIG_RTL8366S_PHY is not set
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8261n/Kconfig b/target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/Kconfig
similarity index 100%
rename from target/linux/generic/files/drivers/net/phy/rtl8261n/Kconfig
rename to target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/Kconfig
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8261n/Makefile b/target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/Makefile
similarity index 100%
rename from target/linux/generic/files/drivers/net/phy/rtl8261n/Makefile
rename to target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/Makefile
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8261n/construct/conf_rtl8261n_c.c b/target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/construct/conf_rtl8261n_c.c
similarity index 100%
rename from target/linux/generic/files/drivers/net/phy/rtl8261n/construct/conf_rtl8261n_c.c
rename to target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/construct/conf_rtl8261n_c.c
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8261n/construct/conf_rtl8264b.c b/target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/construct/conf_rtl8264b.c
similarity index 100%
rename from target/linux/generic/files/drivers/net/phy/rtl8261n/construct/conf_rtl8264b.c
rename to target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/construct/conf_rtl8264b.c
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8261n/error.h b/target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/error.h
similarity index 100%
rename from target/linux/generic/files/drivers/net/phy/rtl8261n/error.h
rename to target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/error.h
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8261n/phy_patch.c b/target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/phy_patch.c
similarity index 100%
rename from target/linux/generic/files/drivers/net/phy/rtl8261n/phy_patch.c
rename to target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/phy_patch.c
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8261n/phy_patch.h b/target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/phy_patch.h
similarity index 100%
rename from target/linux/generic/files/drivers/net/phy/rtl8261n/phy_patch.h
rename to target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/phy_patch.h
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8261n/phy_rtl826xb_patch.c b/target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/phy_rtl826xb_patch.c
similarity index 100%
rename from target/linux/generic/files/drivers/net/phy/rtl8261n/phy_rtl826xb_patch.c
rename to target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/phy_rtl826xb_patch.c
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8261n/phy_rtl826xb_patch.h b/target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/phy_rtl826xb_patch.h
similarity index 100%
rename from target/linux/generic/files/drivers/net/phy/rtl8261n/phy_rtl826xb_patch.h
rename to target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/phy_rtl826xb_patch.h
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_osal.c b/target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/rtk_osal.c
similarity index 100%
rename from target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_osal.c
rename to target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/rtk_osal.c
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_osal.h b/target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/rtk_osal.h
similarity index 100%
rename from target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_osal.h
rename to target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/rtk_osal.h
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_phy.c b/target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/rtk_phy.c
similarity index 100%
rename from target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_phy.c
rename to target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/rtk_phy.c
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_phylib.c b/target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/rtk_phylib.c
similarity index 100%
rename from target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_phylib.c
rename to target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/rtk_phylib.c
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_phylib.h b/target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/rtk_phylib.h
similarity index 100%
rename from target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_phylib.h
rename to target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/rtk_phylib.h
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_phylib_def.h b/target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/rtk_phylib_def.h
similarity index 100%
rename from target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_phylib_def.h
rename to target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/rtk_phylib_def.h
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_phylib_rtl826xb.c b/target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/rtk_phylib_rtl826xb.c
similarity index 100%
rename from target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_phylib_rtl826xb.c
rename to target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/rtk_phylib_rtl826xb.c
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_phylib_rtl826xb.h b/target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/rtk_phylib_rtl826xb.h
similarity index 100%
rename from target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_phylib_rtl826xb.h
rename to target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/rtk_phylib_rtl826xb.h
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8261n/type.h b/target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/type.h
similarity index 100%
rename from target/linux/generic/files/drivers/net/phy/rtl8261n/type.h
rename to target/linux/generic/files-6.12/drivers/net/phy/rtl8261n/type.h
diff --git a/target/linux/generic/files/drivers/net/phy/realtek/phy_patch.c b/target/linux/generic/files/drivers/net/phy/realtek/phy_patch.c
deleted file mode 100644
index 5314823c79..0000000000
--- a/target/linux/generic/files/drivers/net/phy/realtek/phy_patch.c
+++ /dev/null
@@ -1,35 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-
-#include "phy_patch.h"
-
-#include <linux/errno.h>
-#include <linux/phy.h>
-
-#include "realtek.h"
-
-int rtlgen_phy_patch(struct phy_device *phydev)
-{
- struct rtl826x_priv *priv = phydev->priv;
- struct rtlgen_phy_patch_db *patch_db = priv->patch;
- size_t i;
- int ret;
-
- if (!patch_db || !patch_db->patch_op_exec) {
- phydev_err(phydev, "patch db or exec callback is NULL\n");
- return -EINVAL;
- }
-
- for (i = 0; i < patch_db->count; i++) {
- ret = patch_db->patch_op_exec(phydev, &patch_db->conf[i]);
- if (ret < 0) {
- phydev_err(phydev, "patch failed! %zu[%u][0x%X][0x%X][0x%X] ret=%d\n",
- i, patch_db->conf[i].patch_op,
- le16_to_cpu(patch_db->conf[i].pagemmd),
- le16_to_cpu(patch_db->conf[i].addr),
- le16_to_cpu(patch_db->conf[i].data), ret);
- return ret;
- }
- }
-
- return 0;
-}
diff --git a/target/linux/generic/files/drivers/net/phy/realtek/phy_patch.h b/target/linux/generic/files/drivers/net/phy/realtek/phy_patch.h
deleted file mode 100644
index dd7bd2ba88..0000000000
--- a/target/linux/generic/files/drivers/net/phy/realtek/phy_patch.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-
-#ifndef __PHY_PATCH_H__
-#define __PHY_PATCH_H__
-
-#include <linux/phy.h>
-#include <linux/types.h>
-
-enum rtlgen_phypatch_op {
- RTK_PATCH_OP_PHY,
- RTK_PATCH_OP_PHY_WAIT,
- RTK_PATCH_OP_PHY_WAIT_NOT,
- RTK_PATCH_OP_PHYOCP,
- RTK_PATCH_OP_PHYOCP_BC62,
- RTK_PATCH_OP_TOP,
- RTK_PATCH_OP_TOPOCP, // TODO unimplemented
- RTK_PATCH_OP_PSDS0,
- RTK_PATCH_OP_PSDS1, // TODO unimplemented
- RTK_PATCH_OP_MSDS, // TODO unimplemented
- RTK_PATCH_OP_MAC, // TODO unimplemented
- RTK_PATCH_OP_DELAY_MS
-};
-
-struct rtlgen_hwpatch {
- u8 patch_op;
- u8 portmask;
- __le16 pagemmd;
- __le16 addr;
- u8 msb;
- u8 lsb;
- __le16 data;
-} __packed;
-
-struct rtlgen_phy_patch_db {
- int (*patch_op_exec)(struct phy_device *phydev, const struct rtlgen_hwpatch *patch);
- size_t count;
- struct rtlgen_hwpatch conf[] __counted_by(count);
-};
-
-int rtlgen_phy_patch(struct phy_device *phydev);
-
-#endif
diff --git a/target/linux/generic/files/drivers/net/phy/realtek/phy_patch_rtl826x.c b/target/linux/generic/files/drivers/net/phy/realtek/phy_patch_rtl826x.c
deleted file mode 100644
index ebb126b3c4..0000000000
--- a/target/linux/generic/files/drivers/net/phy/realtek/phy_patch_rtl826x.c
+++ /dev/null
@@ -1,287 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-
-#include "phy_patch_rtl826x.h"
-
-#include <linux/bitops.h>
-#include <linux/bits.h>
-#include <linux/byteorder/generic.h>
-#include <linux/delay.h>
-#include <linux/errno.h>
-#include <linux/firmware.h>
-#include <linux/gfp.h>
-#include <linux/ktime.h>
-#include <linux/mdio.h>
-#include <linux/module.h>
-#include <linux/overflow.h>
-#include <linux/phy.h>
-#include <linux/slab.h>
-#include <linux/stddef.h>
-#include <linux/string.h>
-#include <linux/types.h>
-
-#include "phy_patch.h"
-#include "realtek.h"
-
-#define PHY_PATCH_WAIT_TIMEOUT 10000000
-
-static u16 rtl826x_mmd_convert(u16 page, u16 addr)
-{
- if (addr < 16)
- return 0xA400 + (page * 2);
-
- if (addr < 24)
- return (16 * page) + ((addr - 16) * 2);
-
- return 0xA430 + ((addr - 24) * 2);
-}
-
-static int rtl826x_phy_patch_wait(struct phy_device *phydev, u32 mmd_addr, u32 mmd_reg,
- u16 data, u16 mask, bool wait_equal)
-{
- s64 us_diff = 0;
- ktime_t start;
- ktime_t now;
- bool equal;
- int ret;
-
- start = ktime_get();
-
- do {
- ret = phy_read_mmd(phydev, mmd_addr, mmd_reg);
- if (ret < 0)
- return ret;
-
- equal = (ret & mask) == data;
- if (equal == wait_equal)
- break;
-
- msleep(1);
-
- now = ktime_get();
- us_diff = ktime_to_us(ktime_sub(now, start));
- } while (us_diff < PHY_PATCH_WAIT_TIMEOUT);
-
- if (us_diff >= PHY_PATCH_WAIT_TIMEOUT) {
- phydev_err(phydev, "826xb patch wait[%u,0x%X,0x%X,0x%X]:0x%X\n",
- mmd_addr, mmd_reg, mask, data, ret);
- return -ETIME;
- }
-
- return 0;
-}
-
-static int rtl826x_phy_patch_sds_get(struct phy_device *phydev, u32 sds_page, u32 sds_reg)
-{
- u32 sds_addr = 0x8000 + (sds_reg << 6) + sds_page;
- int ret;
-
- ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x143, sds_addr);
- if (ret < 0)
- return ret;
-
- ret = rtl826x_phy_patch_wait(phydev, MDIO_MMD_VEND1, 0x143, 0, BIT(15), true);
- if (ret < 0)
- return ret;
-
- return phy_read_mmd(phydev, MDIO_MMD_VEND1, 0x142);
-}
-
-static int rtl826x_phy_patch_sds_set(struct phy_device *phydev, u32 sds_page, u32 sds_reg,
- u32 data)
-{
- u32 sds_addr = 0x8800 + (sds_reg << 6) + sds_page;
- int ret;
-
- ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x141, data);
- if (ret < 0)
- return ret;
-
- ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x143, sds_addr);
- if (ret < 0)
- return ret;
-
- return rtl826x_phy_patch_wait(phydev, MDIO_MMD_VEND1, 0x143, 0, BIT(15), true);
-}
-
-static int rtl826x_phy_patch_sds_modify(struct phy_device *phydev, u32 sds_page, u32 sds_reg,
- u32 mask, u32 data)
-{
- int ret = 0;
-
- if (mask != GENMASK(15, 0)) {
- ret = rtl826x_phy_patch_sds_get(phydev, sds_page, sds_reg);
- if (ret < 0)
- return ret;
- }
-
- return rtl826x_phy_patch_sds_set(phydev, sds_page, sds_reg, (ret & ~mask) | data);
-}
-
-static int rtl826x_phy_patch_op(struct phy_device *phydev, const struct rtlgen_hwpatch *patch)
-{
- u32 mask = GENMASK(patch->msb, patch->lsb);
- u16 pagemmd = le16_to_cpu(patch->pagemmd);
- u16 addr = le16_to_cpu(patch->addr);
- u16 data = le16_to_cpu(patch->data);
- bool wait_equal;
- int ret = 0;
- int val;
- int cnt;
- u16 reg;
-
- phydev_dbg(phydev, "patch: op: %u pm: %x mmd: %x addr: %x mask: [%u, %u] data: %x\n",
- patch->patch_op, patch->portmask, pagemmd, addr,
- patch->msb, patch->lsb, data);
-
- switch (patch->patch_op) {
- case RTK_PATCH_OP_PHY:
- reg = rtl826x_mmd_convert(pagemmd, addr);
- if (mask != GENMASK(15, 0)) {
- ret = phy_modify_mmd(phydev, MDIO_MMD_VEND2, reg, mask,
- data << patch->lsb);
- if (ret < 0)
- return ret;
- } else {
- ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, reg,
- data << patch->lsb);
- if (ret < 0)
- return ret;
- }
- break;
-
- case RTK_PATCH_OP_PHY_WAIT:
- case RTK_PATCH_OP_PHY_WAIT_NOT:
- wait_equal = patch->patch_op == RTK_PATCH_OP_PHY_WAIT;
- reg = rtl826x_mmd_convert(pagemmd, addr);
- ret = rtl826x_phy_patch_wait(phydev, MDIO_MMD_VEND2, reg,
- data << patch->lsb, mask, wait_equal);
- if (ret < 0)
- return ret;
- break;
-
- case RTK_PATCH_OP_PHYOCP:
- if (mask != GENMASK(15, 0)) {
- ret = phy_modify_mmd(phydev, MDIO_MMD_VEND2, addr, mask,
- data << patch->lsb);
- if (ret < 0)
- return ret;
- } else {
- ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, addr,
- data << patch->lsb);
- if (ret < 0)
- return ret;
- }
- break;
-
- case RTK_PATCH_OP_PHYOCP_BC62:
- val = phy_read_mmd(phydev, MDIO_MMD_VEND2, 0xbc62);
- if (val < 0)
- return val;
-
- val = (val >> 8) & 0x1f;
- for (cnt = 0; cnt <= val; cnt++) {
- ret = phy_modify_mmd(phydev, MDIO_MMD_VEND2, 0xbc62,
- GENMASK(12, 8), cnt << 8);
- if (ret < 0)
- return ret;
- }
- break;
-
- case RTK_PATCH_OP_TOP:
- if (addr < 16)
- return -EINVAL;
-
- reg = (pagemmd * 8) + (addr - 16);
- if (mask != GENMASK(15, 0)) {
- ret = phy_modify_mmd(phydev, MDIO_MMD_VEND1, reg, mask,
- data << patch->lsb);
- if (ret < 0)
- return ret;
- } else {
- ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, reg, data << patch->lsb);
- if (ret < 0)
- return ret;
- }
- break;
-
- case RTK_PATCH_OP_PSDS0:
- ret = rtl826x_phy_patch_sds_modify(phydev, pagemmd, addr,
- mask, data << patch->lsb);
- if (ret < 0)
- return ret;
- break;
-
- case RTK_PATCH_OP_DELAY_MS:
- msleep(data);
- break;
-
- default:
- phydev_err(phydev, "%s: %u not implemented yet!\n", __func__, patch->patch_op);
- return -EINVAL;
- }
-
- return ret;
-}
-
-static int rtl826x_phy_patch_db_init(struct phy_device *phydev, const char *fw_name)
-{
- struct rtl826x_priv *priv = phydev->priv;
- struct device *dev = &phydev->mdio.dev;
- struct rtlgen_phy_patch_db *patch_db;
- struct rtlgen_hwpatch *patches;
- const struct firmware *fw;
- size_t count;
- int ret;
-
- ret = request_firmware_direct(&fw, fw_name, dev);
- if (ret) {
- if (ret == -ENOENT) {
- phydev_dbg(phydev, "Failed to request %s: defer probing\n", fw_name);
- return -EPROBE_DEFER;
- } else {
- phydev_err(phydev, "Failed to request %s: %d\n", fw_name, ret);
- return ret;
- }
- }
-
- if (!fw->size || fw->size % sizeof(*patches) != 0) {
- phydev_err(phydev, "Invalid firmware size %zu for %s\n",
- fw->size, fw_name);
- ret = -EINVAL;
- goto out;
- }
-
- patches = (struct rtlgen_hwpatch *)fw->data;
- count = fw->size / sizeof(*patches);
-
- patch_db = devm_kzalloc(dev, struct_size(patch_db, conf, count), GFP_KERNEL);
- if (!patch_db) {
- ret = -ENOMEM;
- goto out;
- }
-
- patch_db->count = count;
- patch_db->patch_op_exec = rtl826x_phy_patch_op;
-
- memcpy(patch_db->conf, patches, flex_array_size(patch_db, conf, count));
-
- priv->patch = patch_db;
-
-out:
- release_firmware(fw);
-
- return ret;
-}
-
-int rtl8261n_phy_patch_db_init(struct phy_device *phydev)
-{
- return rtl826x_phy_patch_db_init(phydev, "rtl8261n.bin");
-}
-
-int rtl8264b_phy_patch_db_init(struct phy_device *phydev)
-{
- return rtl826x_phy_patch_db_init(phydev, "rtl8264b.bin");
-}
-
-MODULE_FIRMWARE("rtl8261n.bin");
-MODULE_FIRMWARE("rtl8264b.bin");
diff --git a/target/linux/generic/files/drivers/net/phy/realtek/phy_patch_rtl826x.h b/target/linux/generic/files/drivers/net/phy/realtek/phy_patch_rtl826x.h
deleted file mode 100644
index b38c338536..0000000000
--- a/target/linux/generic/files/drivers/net/phy/realtek/phy_patch_rtl826x.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-
-#ifndef __PHY_PATCH_RTL826X_H__
-#define __PHY_PATCH_RTL826X_H__
-
-#include <linux/phy.h>
-
-int rtl8261n_phy_patch_db_init(struct phy_device *phydev);
-int rtl8264b_phy_patch_db_init(struct phy_device *phydev);
-
-#endif
diff --git a/target/linux/generic/hack-6.12/736-net-phy-realtek-add-5G-and-10G-PHY-support.patch b/target/linux/generic/hack-6.12/736-net-phy-realtek-add-5G-and-10G-PHY-support.patch
deleted file mode 100644
index ed1429a2f8..0000000000
--- a/target/linux/generic/hack-6.12/736-net-phy-realtek-add-5G-and-10G-PHY-support.patch
+++ /dev/null
@@ -1,802 +0,0 @@
-From: Balázs Triszka <[email protected]>
-Date: Sat, 18 Oct 2025 23:09:23 +0200
-Subject: net: phy: realtek: add 5G and 10G PHY support
-
-The functionality was extracted from the realtek-phy driver and ported to
-the upstream Linux realtek PHY driver.
-
-These PHY chips need a sequence of register writes for initialization.
-These are provided as firmware files which are interpreted/applied by a
-new register patch engine.
-
-The files which need to be provided are depending on the PHY:
-
-* rtl8261n.bin
- - RTL8251L 5Gbps PHY
- - RTL8261BE 10Gbps PHY
- - RTL8261N 10Gbps PHY
-* rtl8264b.bin
- - RTL8254B 5Gbps PHY
- - RTL8264 10Gbps PHY
- - RTL8264B 10Gbps PHY
-
-Signed-off-by: Balázs Triszka <[email protected]>
-
---- a/drivers/net/phy/realtek/Makefile
-+++ b/drivers/net/phy/realtek/Makefile
-@@ -1,4 +1,6 @@
- # SPDX-License-Identifier: GPL-2.0
- realtek-y += realtek_main.o
-+realtek-y += phy_patch.o
-+realtek-y += phy_patch_rtl826x.o
- realtek-$(CONFIG_REALTEK_PHY_HWMON) += realtek_hwmon.o
- obj-$(CONFIG_REALTEK_PHY) += realtek.o
---- a/drivers/net/phy/realtek/realtek.h
-+++ b/drivers/net/phy/realtek/realtek.h
-@@ -5,6 +5,16 @@
-
- #include <linux/phy.h>
-
-+#include "phy_patch.h"
-+#include "phy_patch_rtl826x.h"
-+
-+struct rtl826x_priv {
-+ struct rtlgen_phy_patch_db *patch;
-+ bool pnswap_tx:1;
-+ bool pnswap_rx:1;
-+ bool enable_pma_low_power:1;
-+};
-+
- int rtl822x_hwmon_init(struct phy_device *phydev);
-
- #endif /* REALTEK_H */
---- a/drivers/net/phy/realtek/realtek_main.c
-+++ b/drivers/net/phy/realtek/realtek_main.c
-@@ -16,6 +16,7 @@
- #include <linux/module.h>
- #include <linux/delay.h>
- #include <linux/clk.h>
-+#include <linux/crc32.h>
- #include <linux/string_choices.h>
- #include <net/phy/realtek_phy.h>
-
-@@ -205,10 +206,26 @@
- #define RTL_8221B_VM_CG 0x001cc84a
- #define RTL_8251B 0x001cc862
- #define RTL_8261C 0x001cc890
-+#define RTL_8261N 0x001ccaf3
-+#define RTL_8264 0x001ccaf2
-+#define RTL_8264B 0x001cc813
-
- /* RTL8211E and RTL8211F support up to three LEDs */
- #define RTL8211x_LED_COUNT 3
-
-+#define RTL826X_VEND1_SERDES_GLOBAL_CFG 0xc1
-+#define RTL826X_VEND1_SERDES_GLOBAL_CFG_HSI_INV BIT(6)
-+#define RTL826X_VEND1_SERDES_GLOBAL_CFG_HSO_INV BIT(7)
-+
-+#define RTL826X_VEND1_PKG_MODEL 0x103
-+#define RTL826X_VEND1_VERSION_ID 0x104
-+
-+#define RTL826X_VND2_INER 0xA424
-+#define RTL826X_VND2_INER_LINK_STATUS BIT(4)
-+#define RTL826X_VND2_INER_PME BIT(7)
-+
-+#define RTL826X_VND2_INSR 0xA43A
-+
- MODULE_DESCRIPTION("Realtek PHY driver");
- MODULE_AUTHOR("Johnson Leung");
- MODULE_LICENSE("GPL");
-@@ -1993,6 +2010,125 @@ static int rtl8251b_c45_match_phy_device
- return rtlgen_is_c45_match(phydev, RTL_8251B, true);
- }
-
-+static int rtl8251l_match_phy_device(struct phy_device *phydev,
-+ const struct phy_driver *phydrv)
-+{
-+ int data;
-+
-+ if (!rtlgen_is_c45_match(phydev, RTL_8261N, true))
-+ return 0;
-+
-+ if (!phydev->mdio.bus->read_c45)
-+ return 0;
-+
-+ data = phy_read_mmd(phydev, MDIO_MMD_VEND1, RTL826X_VEND1_PKG_MODEL);
-+ if (data < 0)
-+ return 0;
-+
-+ if (data != 0x8251)
-+ return 0;
-+
-+ return 1;
-+}
-+
-+static int rtl8254b_match_phy_device(struct phy_device *phydev,
-+ const struct phy_driver *phydrv)
-+{
-+ int data;
-+
-+ if (!rtlgen_is_c45_match(phydev, RTL_8264B, true))
-+ return 0;
-+
-+ if (!phydev->mdio.bus->read_c45)
-+ return 0;
-+
-+ data = phy_read_mmd(phydev, MDIO_MMD_VEND1, RTL826X_VEND1_PKG_MODEL);
-+ if (data < 0)
-+ return 0;
-+
-+ if (data != 0x8254)
-+ return 0;
-+
-+ return 1;
-+}
-+
-+static int rtl8261be_match_phy_device(struct phy_device *phydev,
-+ const struct phy_driver *phydrv)
-+{
-+ int data;
-+
-+ if (!rtlgen_is_c45_match(phydev, RTL_8261N, true))
-+ return 0;
-+
-+ if (!phydev->mdio.bus->read_c45)
-+ return 0;
-+
-+ data = phy_read_mmd(phydev, MDIO_MMD_VEND1, RTL826X_VEND1_PKG_MODEL);
-+ if (data < 0)
-+ return 0;
-+
-+ if (data == 0x8251)
-+ return 0;
-+
-+ data = phy_read_mmd(phydev, MDIO_MMD_VEND1, RTL826X_VEND1_VERSION_ID);
-+ if (data < 0)
-+ return 0;
-+
-+ if ((data & 0xFFC0) != 0x1140)
-+ return 0;
-+
-+ return 1;
-+}
-+
-+static int rtl8261n_match_phy_device(struct phy_device *phydev,
-+ const struct phy_driver *phydrv)
-+{
-+ int data;
-+
-+ if (!rtlgen_is_c45_match(phydev, RTL_8261N, true))
-+ return 0;
-+
-+ if (!phydev->mdio.bus->read_c45)
-+ return 0;
-+
-+ data = phy_read_mmd(phydev, MDIO_MMD_VEND1, RTL826X_VEND1_PKG_MODEL);
-+ if (data < 0)
-+ return 0;
-+
-+ if (data == 0x8251)
-+ return 0;
-+
-+ data = phy_read_mmd(phydev, MDIO_MMD_VEND1, RTL826X_VEND1_VERSION_ID);
-+ if (data < 0)
-+ return 0;
-+
-+ if ((data & 0xFFC0) == 0x1140)
-+ return 0;
-+
-+ return 1;
-+}
-+
-+static int rtl8264b_match_phy_device(struct phy_device *phydev,
-+ const struct phy_driver *phydrv)
-+{
-+ int data;
-+
-+ if (!rtlgen_is_c45_match(phydev, RTL_8264B, true))
-+ return 0;
-+
-+ if (!phydev->mdio.bus->read_c45)
-+ return 0;
-+
-+ data = phy_read_mmd(phydev, MDIO_MMD_VEND1, RTL826X_VEND1_PKG_MODEL);
-+ if (data < 0)
-+ return 0;
-+
-+ if (data == 0x8254)
-+ return 0;
-+
-+ return 1;
-+}
-+
- static int rtlgen_resume(struct phy_device *phydev)
- {
- int ret = genphy_resume(phydev);
-@@ -2214,6 +2350,477 @@ static int rtlgen_sfp_config_aneg(struct
- return 0;
- }
-
-+static int rtl826x_probe(struct phy_device *phydev)
-+{
-+ struct device *dev = &phydev->mdio.dev;
-+ struct rtl826x_priv *priv;
-+
-+ priv = devm_kzalloc(dev, sizeof(struct rtl826x_priv), GFP_KERNEL);
-+ if (!priv)
-+ return -ENOMEM;
-+
-+ priv->pnswap_tx = device_property_read_bool(dev, "realtek,pnswap-tx");
-+ priv->pnswap_rx = device_property_read_bool(dev, "realtek,pnswap-rx");
-+ priv->enable_pma_low_power = device_property_read_bool(dev, "realtek,enable-pma-low-power");
-+ phydev->priv = priv;
-+
-+ if (!priv->enable_pma_low_power)
-+ phydev_warn(phydev, "PMA low-power suspend disabled\n");
-+
-+ /* Disable EEE due to link stability issues */
-+ phydev->eee_broken_modes = MDIO_EEE_100TX | MDIO_EEE_1000T;
-+
-+ if (IS_ENABLED(CONFIG_REALTEK_PHY_HWMON))
-+ return rtl822x_hwmon_init(phydev);
-+
-+ return 0;
-+}
-+
-+static int rtl8261n_probe(struct phy_device *phydev)
-+{
-+ int ret;
-+
-+ ret = rtl826x_probe(phydev);
-+ if (ret < 0)
-+ return ret;
-+
-+ ret = rtl8261n_phy_patch_db_init(phydev);
-+ if (ret < 0)
-+ return ret;
-+
-+ return 0;
-+}
-+
-+static int rtl8264b_probe(struct phy_device *phydev)
-+{
-+ int ret;
-+
-+ ret = rtl826x_probe(phydev);
-+ if (ret < 0)
-+ return ret;
-+
-+ ret = rtl8264b_phy_patch_db_init(phydev);
-+ if (ret < 0)
-+ return ret;
-+
-+ return 0;
-+}
-+
-+static int rtl826x_config_init(struct phy_device *phydev)
-+{
-+ struct rtl826x_priv *priv = phydev->priv;
-+ const unsigned int max_dereset_tries = 5;
-+ unsigned int tries = 0;
-+ int ret;
-+
-+ /* Suppress PHY interrupt output before the hardware reset below.
-+ * The RTL8261N asserts its interrupt pin during power-on reset, which
-+ * races with phylib registering phy_interrupt. If the IRQ fires first
-+ * the kernel disables it permanently. rtl826x_config_intr() will
-+ * re-enable the interrupt correctly once phylib is ready.
-+ */
-+ ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, RTL826X_VND2_INER, 0);
-+ if (ret < 0)
-+ return ret;
-+
-+ ret = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, 0xE1, BIT(0));
-+ if (ret < 0)
-+ return ret;
-+
-+ /* toggle reset */
-+ ret = phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, 0x145, BIT(0));
-+ if (ret < 0)
-+ return ret;
-+
-+ do {
-+ msleep(30);
-+ tries++;
-+ ret = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, 0x145, BIT(0));
-+ } while (ret < 0 && tries <= max_dereset_tries);
-+
-+ if (ret < 0) {
-+ phydev_err(phydev, "deassert reset failed %d\n", ret);
-+ return ret;
-+ }
-+
-+ msleep(30);
-+
-+ ret = rtlgen_phy_patch(phydev);
-+ if (ret) {
-+ phydev_err(phydev, "patch failed!! %d\n", ret);
-+ return ret;
-+ }
-+
-+ if (priv->pnswap_tx) {
-+ ret = phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, RTL826X_VEND1_SERDES_GLOBAL_CFG,
-+ RTL826X_VEND1_SERDES_GLOBAL_CFG_HSO_INV);
-+ if (ret < 0)
-+ return ret;
-+ }
-+
-+ if (priv->pnswap_rx) {
-+ ret = phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, RTL826X_VEND1_SERDES_GLOBAL_CFG,
-+ RTL826X_VEND1_SERDES_GLOBAL_CFG_HSI_INV);
-+ if (ret < 0)
-+ return ret;
-+ }
-+
-+ return ret;
-+}
-+
-+static int rtl826x_suspend(struct phy_device *phydev)
-+{
-+ struct rtl826x_priv *priv = phydev->priv;
-+
-+ if (!priv->enable_pma_low_power)
-+ return -EOPNOTSUPP;
-+
-+ return genphy_c45_pma_suspend(phydev);
-+}
-+
-+static int rtl826x_get_features(struct phy_device *phydev)
-+{
-+ int ret;
-+
-+ ret = genphy_c45_pma_read_abilities(phydev);
-+ if (ret)
-+ return ret;
-+
-+ /* not support 10M modes */
-+ linkmode_clear_bit(ETHTOOL_LINK_MODE_10baseT_Half_BIT,
-+ phydev->supported);
-+ linkmode_clear_bit(ETHTOOL_LINK_MODE_10baseT_Full_BIT,
-+ phydev->supported);
-+
-+ return 0;
-+}
-+
-+static int rtl825xb_get_features(struct phy_device *phydev)
-+{
-+ int ret;
-+
-+ ret = genphy_c45_pma_read_abilities(phydev);
-+ if (ret)
-+ return ret;
-+
-+ /* not support 10M modes */
-+ linkmode_clear_bit(ETHTOOL_LINK_MODE_10baseT_Half_BIT,
-+ phydev->supported);
-+ linkmode_clear_bit(ETHTOOL_LINK_MODE_10baseT_Full_BIT,
-+ phydev->supported);
-+
-+ /* faulty rtl826x silicon having issues with 10G, sold as only 5G phy */
-+ linkmode_clear_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT,
-+ phydev->supported);
-+
-+ return 0;
-+}
-+
-+static int rtl826x_config_aneg(struct phy_device *phydev)
-+{
-+ bool changed = false;
-+ u16 reg;
-+ int ret;
-+
-+ phydev->mdix_ctrl = ETH_TP_MDI_AUTO;
-+ if (phydev->autoneg == AUTONEG_DISABLE)
-+ return genphy_c45_pma_setup_forced(phydev);
-+
-+ ret = genphy_c45_an_config_aneg(phydev);
-+ if (ret < 0)
-+ return ret;
-+ if (ret > 0)
-+ changed = true;
-+
-+ reg = 0;
-+ if (linkmode_test_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT,
-+ phydev->advertising))
-+ reg |= ADVERTISE_1000FULL;
-+
-+ if (linkmode_test_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT,
-+ phydev->advertising))
-+ reg |= ADVERTISE_1000HALF;
-+
-+ ret = phy_modify_mmd_changed(phydev, MDIO_MMD_VEND2,
-+ RTL822X_VND2_C22_REG(MII_CTRL1000),
-+ ADVERTISE_1000FULL | ADVERTISE_1000HALF, reg);
-+ if (ret < 0)
-+ return ret;
-+ if (ret > 0)
-+ changed = true;
-+
-+ return genphy_c45_check_and_restart_aneg(phydev, changed);
-+}
-+
-+static int rtl826x_read_status(struct phy_device *phydev)
-+{
-+ int status;
-+ int ret;
-+
-+ phydev->speed = SPEED_UNKNOWN;
-+ phydev->duplex = DUPLEX_UNKNOWN;
-+ phydev->pause = 0;
-+ phydev->asym_pause = 0;
-+
-+ ret = genphy_c45_read_link(phydev);
-+ if (ret)
-+ return ret;
-+
-+ if (phydev->autoneg == AUTONEG_ENABLE) {
-+ ret = genphy_c45_read_lpa(phydev);
-+ if (ret)
-+ return ret;
-+
-+ status = phy_read_mmd(phydev, MDIO_MMD_VEND2, RTL822X_VND2_C22_REG(MII_STAT1000));
-+ if (status < 0)
-+ return status;
-+
-+ mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, status);
-+
-+ phy_resolve_aneg_linkmode(phydev);
-+ } else {
-+ ret = genphy_c45_read_pma(phydev);
-+ if (ret < 0)
-+ return ret;
-+ }
-+
-+ return genphy_c45_read_mdix(phydev);
-+}
-+
-+static int rtl826x_config_intr(struct phy_device *phydev)
-+{
-+ u16 interrupts;
-+ int ret;
-+
-+ /* Disable all IMR */
-+ ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, 0xE1, 0);
-+ if (ret < 0)
-+ return ret;
-+ ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, 0xE3, 0);
-+ if (ret < 0)
-+ return ret;
-+
-+ /* source */
-+ ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, 0xE4, 0x1);
-+ if (ret < 0)
-+ return ret;
-+ ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, 0xE0, 0x2F);
-+ if (ret < 0)
-+ return ret;
-+
-+ /* init common link change & WOL */
-+ if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
-+ interrupts = RTL826X_VND2_INER_LINK_STATUS | RTL826X_VND2_INER_PME;
-+ else
-+ interrupts = 0;
-+
-+ ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, RTL826X_VND2_INER, interrupts);
-+ if (ret < 0)
-+ return ret;
-+
-+ /* clear status */
-+ phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x2DC, 0xFF);
-+
-+ return phy_modify_mmd(phydev, MDIO_MMD_VEND1, 0xE1, BIT(0),
-+ phydev->interrupts == PHY_INTERRUPT_ENABLED);
-+}
-+
-+static irqreturn_t rtl826x_handle_interrupt(struct phy_device *phydev)
-+{
-+ int irq_enabled;
-+ int irq_status;
-+
-+ irq_status = phy_read_mmd(phydev, MDIO_MMD_VEND2, RTL826X_VND2_INSR);
-+ if (irq_status < 0) {
-+ phy_error(phydev);
-+ return IRQ_NONE;
-+ }
-+
-+ if (phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x2DC, 0xFF) < 0) {
-+ phy_error(phydev);
-+ return IRQ_NONE;
-+ }
-+
-+ irq_enabled = phy_read_mmd(phydev, MDIO_MMD_VEND2, RTL826X_VND2_INER);
-+ if (irq_enabled < 0) {
-+ phy_error(phydev);
-+ return IRQ_NONE;
-+ }
-+
-+ if (!(irq_status & irq_enabled))
-+ return IRQ_NONE;
-+
-+ if (irq_status & RTL826X_VND2_INER_LINK_STATUS) {
-+ phydev_dbg(phydev, "RTK_PHY_INTR_LINK_CHANGE\n");
-+ phy_mac_interrupt(phydev);
-+ }
-+
-+ if (irq_status & RTL826X_VND2_INER_PME) {
-+ phydev_dbg(phydev, "RTK_PHY_INTR_WOL\n");
-+
-+ if (phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, 0xD8A2, BIT(15)) < 0)
-+ return IRQ_NONE;
-+
-+ if (phy_set_bits_mmd(phydev, MDIO_MMD_VEND2, 0xD8A2, BIT(15)) < 0)
-+ return IRQ_NONE;
-+ }
-+
-+ return IRQ_HANDLED;
-+}
-+
-+static int rtl826x_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol)
-+{
-+ static const u32 cfg_reg[4] = {0xD8C6, 0xD8C8, 0xD8CA, 0xD8CC};
-+ struct net_device *ndev = phydev->attached_dev;
-+ struct netdev_hw_addr *ha;
-+ u16 rtk_wolopts;
-+ size_t idx;
-+ u32 offset;
-+ int ret;
-+
-+ if (!ndev)
-+ return -EINVAL;
-+
-+ if (wol->wolopts & ~(WAKE_PHY | WAKE_MAGIC | WAKE_UCAST | WAKE_BCAST | WAKE_MCAST))
-+ return -EOPNOTSUPP;
-+
-+ if (wol->wolopts & (WAKE_MAGIC | WAKE_UCAST)) {
-+ const u8 *mac_addr = ndev->dev_addr;
-+
-+ ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, 0xD8C0,
-+ mac_addr[1] << 8 | mac_addr[0]);
-+ if (ret < 0)
-+ return ret;
-+
-+ ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, 0xD8C2,
-+ mac_addr[3] << 8 | mac_addr[2]);
-+ if (ret < 0)
-+ return ret;
-+
-+ ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, 0xD8C4,
-+ mac_addr[5] << 8 | mac_addr[4]);
-+ if (ret < 0)
-+ return ret;
-+ }
-+
-+ if (wol->wolopts & WAKE_MCAST) {
-+ for (idx = 0; idx < ARRAY_SIZE(cfg_reg); idx++) {
-+ ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, cfg_reg[idx], 0);
-+ if (ret < 0)
-+ return ret;
-+ }
-+
-+ if (!netdev_mc_empty(ndev)) {
-+ netdev_for_each_mc_addr(ha, ndev) {
-+ phydev_dbg(phydev, "mac: %pM\n", ha->addr);
-+
-+ offset = crc32_be(~0, ha->addr, 6) >> 26;
-+ idx = offset >> 4;
-+
-+ ret = phy_set_bits_mmd(phydev, MDIO_MMD_VEND2, cfg_reg[idx],
-+ BIT(offset & 0xF));
-+ if (ret < 0)
-+ return ret;
-+ }
-+ }
-+ }
-+
-+ rtk_wolopts = 0;
-+ if (wol->wolopts & WAKE_PHY)
-+ rtk_wolopts |= BIT(13);
-+ if (wol->wolopts & WAKE_MAGIC)
-+ rtk_wolopts |= BIT(12);
-+ if (wol->wolopts & WAKE_UCAST)
-+ rtk_wolopts |= BIT(10);
-+ if (wol->wolopts & WAKE_MCAST)
-+ rtk_wolopts |= BIT(9);
-+ if (wol->wolopts & WAKE_BCAST)
-+ rtk_wolopts |= BIT(8);
-+
-+ ret = phy_modify_mmd(phydev, MDIO_MMD_VEND2, 0xD8A0,
-+ GENMASK(13, 12) | GENMASK(10, 8), rtk_wolopts);
-+ if (ret < 0)
-+ return ret;
-+
-+ return 0;
-+}
-+
-+static void rtl826x_get_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol)
-+{
-+ int rtk_wolopts;
-+
-+ wol->supported = WAKE_PHY | WAKE_MAGIC | WAKE_UCAST | WAKE_BCAST | WAKE_MCAST;
-+ wol->wolopts = 0;
-+
-+ rtk_wolopts = phy_read_mmd(phydev, MDIO_MMD_VEND2, 0xD8A0);
-+ if (rtk_wolopts < 0)
-+ return;
-+
-+ if (rtk_wolopts & BIT(13))
-+ wol->wolopts |= WAKE_PHY;
-+ if (rtk_wolopts & BIT(12))
-+ wol->wolopts |= WAKE_MAGIC;
-+ if (rtk_wolopts & BIT(10))
-+ wol->wolopts |= WAKE_UCAST;
-+ if (rtk_wolopts & BIT(9))
-+ wol->wolopts |= WAKE_MCAST;
-+ if (rtk_wolopts & BIT(8))
-+ wol->wolopts |= WAKE_BCAST;
-+}
-+
-+static int rtl826x_get_tunable(struct phy_device *phydev, struct ethtool_tunable *tuna, void *data)
-+{
-+ int val;
-+
-+ switch (tuna->id) {
-+ case ETHTOOL_PHY_EDPD:
-+ val = phy_read_mmd(phydev, MDIO_MMD_VEND2, RTL8221B_PHYCR1);
-+ if (val < 0)
-+ return val;
-+
-+ *(u16 *)data = (!(val & RTL8221B_PHYCR1_ALDPS_EN)) ? ETHTOOL_PHY_EDPD_DISABLE :
-+ ETHTOOL_PHY_EDPD_DFLT_TX_MSECS;
-+ break;
-+
-+ default:
-+ return -EOPNOTSUPP;
-+ }
-+
-+ return 0;
-+}
-+
-+static int rtl826x_set_tunable(struct phy_device *phydev,
-+ struct ethtool_tunable *tuna, const void *data)
-+{
-+ int ret;
-+ u16 val;
-+
-+ switch (tuna->id) {
-+ case ETHTOOL_PHY_EDPD:
-+ switch (*(const u16 *)data) {
-+ case ETHTOOL_PHY_EDPD_DFLT_TX_MSECS:
-+ val = RTL8221B_PHYCR1_ALDPS_EN;
-+ break;
-+ case ETHTOOL_PHY_EDPD_DISABLE:
-+ val = 0;
-+ break;
-+ default:
-+ return -EINVAL;
-+ }
-+
-+ ret = phy_modify_mmd(phydev, MDIO_MMD_VEND2, RTL8221B_PHYCR1,
-+ RTL8221B_PHYCR1_ALDPS_EN, val);
-+ if (ret < 0)
-+ return ret;
-+ break;
-+
-+ default:
-+ return -EOPNOTSUPP;
-+ }
-+
-+ return 0;
-+}
-+
- static struct phy_driver realtek_drvs[] = {
- {
- PHY_ID_MATCH_EXACT(0x00008201),
-@@ -2520,6 +3127,108 @@ static struct phy_driver realtek_drvs[]
- .resume = genphy_resume,
- .read_mmd = genphy_read_mmd_unsupported,
- .write_mmd = genphy_write_mmd_unsupported,
-+ }, {
-+ .name = "RTL8251L 5Gbps PHY",
-+ .config_init = rtl826x_config_init,
-+ .probe = rtl8261n_probe,
-+ .get_features = rtl825xb_get_features,
-+ .suspend = rtl826x_suspend,
-+ .resume = rtlgen_c45_resume,
-+ .config_aneg = rtl826x_config_aneg,
-+ .aneg_done = genphy_c45_aneg_done,
-+ .read_status = rtl826x_read_status,
-+ .config_intr = rtl826x_config_intr,
-+ .handle_interrupt = rtl826x_handle_interrupt,
-+ .match_phy_device = rtl8251l_match_phy_device,
-+ .set_wol = rtl826x_set_wol,
-+ .get_wol = rtl826x_get_wol,
-+ .get_tunable = rtl826x_get_tunable,
-+ .set_tunable = rtl826x_set_tunable,
-+ }, {
-+ .name = "RTL8254B 5Gbps PHY",
-+ .config_init = rtl826x_config_init,
-+ .probe = rtl8264b_probe,
-+ .get_features = rtl825xb_get_features,
-+ .suspend = rtl826x_suspend,
-+ .resume = rtlgen_c45_resume,
-+ .config_aneg = rtl826x_config_aneg,
-+ .aneg_done = genphy_c45_aneg_done,
-+ .read_status = rtl826x_read_status,
-+ .config_intr = rtl826x_config_intr,
-+ .handle_interrupt = rtl826x_handle_interrupt,
-+ .match_phy_device = rtl8254b_match_phy_device,
-+ .set_wol = rtl826x_set_wol,
-+ .get_wol = rtl826x_get_wol,
-+ .get_tunable = rtl826x_get_tunable,
-+ .set_tunable = rtl826x_set_tunable,
-+ }, {
-+ .name = "RTL8261BE 10Gbps PHY",
-+ .config_init = rtl826x_config_init,
-+ .probe = rtl8261n_probe,
-+ .get_features = rtl826x_get_features,
-+ .suspend = rtl826x_suspend,
-+ .resume = rtlgen_c45_resume,
-+ .config_aneg = rtl826x_config_aneg,
-+ .aneg_done = genphy_c45_aneg_done,
-+ .read_status = rtl826x_read_status,
-+ .config_intr = rtl826x_config_intr,
-+ .handle_interrupt = rtl826x_handle_interrupt,
-+ .match_phy_device = rtl8261be_match_phy_device,
-+ .set_wol = rtl826x_set_wol,
-+ .get_wol = rtl826x_get_wol,
-+ .get_tunable = rtl826x_get_tunable,
-+ .set_tunable = rtl826x_set_tunable,
-+ }, {
-+ .name = "RTL8261N 10Gbps PHY",
-+ .config_init = rtl826x_config_init,
-+ .probe = rtl8261n_probe,
-+ .get_features = rtl826x_get_features,
-+ .suspend = rtl826x_suspend,
-+ .resume = rtlgen_c45_resume,
-+ .config_aneg = rtl826x_config_aneg,
-+ .aneg_done = genphy_c45_aneg_done,
-+ .read_status = rtl826x_read_status,
-+ .config_intr = rtl826x_config_intr,
-+ .handle_interrupt = rtl826x_handle_interrupt,
-+ .match_phy_device = rtl8261n_match_phy_device,
-+ .set_wol = rtl826x_set_wol,
-+ .get_wol = rtl826x_get_wol,
-+ .get_tunable = rtl826x_get_tunable,
-+ .set_tunable = rtl826x_set_tunable,
-+ }, {
-+ PHY_ID_MATCH_EXACT(RTL_8264),
-+ .name = "RTL8264 10Gbps PHY",
-+ .config_init = rtl826x_config_init,
-+ .probe = rtl8264b_probe,
-+ .get_features = rtl826x_get_features,
-+ .suspend = rtl826x_suspend,
-+ .resume = rtlgen_c45_resume,
-+ .config_aneg = rtl826x_config_aneg,
-+ .aneg_done = genphy_c45_aneg_done,
-+ .read_status = rtl826x_read_status,
-+ .config_intr = rtl826x_config_intr,
-+ .handle_interrupt = rtl826x_handle_interrupt,
-+ .set_wol = rtl826x_set_wol,
-+ .get_wol = rtl826x_get_wol,
-+ .get_tunable = rtl826x_get_tunable,
-+ .set_tunable = rtl826x_set_tunable,
-+ }, {
-+ .name = "RTL8264B 10Gbps PHY",
-+ .config_init = rtl826x_config_init,
-+ .probe = rtl8264b_probe,
-+ .get_features = rtl826x_get_features,
-+ .suspend = rtl826x_suspend,
-+ .resume = rtlgen_c45_resume,
-+ .config_aneg = rtl826x_config_aneg,
-+ .aneg_done = genphy_c45_aneg_done,
-+ .read_status = rtl826x_read_status,
-+ .config_intr = rtl826x_config_intr,
-+ .handle_interrupt = rtl826x_handle_interrupt,
-+ .match_phy_device = rtl8264b_match_phy_device,
-+ .set_wol = rtl826x_set_wol,
-+ .get_wol = rtl826x_get_wol,
-+ .get_tunable = rtl826x_get_tunable,
-+ .set_tunable = rtl826x_set_tunable,
- },
- };
-
diff --git a/target/linux/generic/pending-6.18/742-net-phy-realtek-add-5G-and-10G-PHY-support.patch b/target/linux/generic/pending-6.18/742-net-phy-realtek-add-5G-and-10G-PHY-support.patch
index 01dd93676c..71b025eefe 100644
--- a/target/linux/generic/pending-6.18/742-net-phy-realtek-add-5G-and-10G-PHY-support.patch
+++ b/target/linux/generic/pending-6.18/742-net-phy-realtek-add-5G-and-10G-PHY-support.patch
@@ -830,3 +830,390 @@ Signed-off-by: Balázs Triszka <[email protected]>
help
Currently supports RTL821x/RTL822x and fast ethernet PHYs
+--- /dev/null
++++ b/drivers/net/phy/realtek/phy_patch.c
+@@ -0,0 +1,35 @@
++// SPDX-License-Identifier: GPL-2.0
++
++#include "phy_patch.h"
++
++#include <linux/errno.h>
++#include <linux/phy.h>
++
++#include "realtek.h"
++
++int rtlgen_phy_patch(struct phy_device *phydev)
++{
++ struct rtl826x_priv *priv = phydev->priv;
++ struct rtlgen_phy_patch_db *patch_db = priv->patch;
++ size_t i;
++ int ret;
++
++ if (!patch_db || !patch_db->patch_op_exec) {
++ phydev_err(phydev, "patch db or exec callback is NULL\n");
++ return -EINVAL;
++ }
++
++ for (i = 0; i < patch_db->count; i++) {
++ ret = patch_db->patch_op_exec(phydev, &patch_db->conf[i]);
++ if (ret < 0) {
++ phydev_err(phydev, "patch failed! %zu[%u][0x%X][0x%X][0x%X] ret=%d\n",
++ i, patch_db->conf[i].patch_op,
++ le16_to_cpu(patch_db->conf[i].pagemmd),
++ le16_to_cpu(patch_db->conf[i].addr),
++ le16_to_cpu(patch_db->conf[i].data), ret);
++ return ret;
++ }
++ }
++
++ return 0;
++}
+--- /dev/null
++++ b/drivers/net/phy/realtek/phy_patch.h
+@@ -0,0 +1,42 @@
++/* SPDX-License-Identifier: GPL-2.0 */
++
++#ifndef __PHY_PATCH_H__
++#define __PHY_PATCH_H__
++
++#include <linux/phy.h>
++#include <linux/types.h>
++
++enum rtlgen_phypatch_op {
++ RTK_PATCH_OP_PHY,
++ RTK_PATCH_OP_PHY_WAIT,
++ RTK_PATCH_OP_PHY_WAIT_NOT,
++ RTK_PATCH_OP_PHYOCP,
++ RTK_PATCH_OP_PHYOCP_BC62,
++ RTK_PATCH_OP_TOP,
++ RTK_PATCH_OP_TOPOCP, // TODO unimplemented
++ RTK_PATCH_OP_PSDS0,
++ RTK_PATCH_OP_PSDS1, // TODO unimplemented
++ RTK_PATCH_OP_MSDS, // TODO unimplemented
++ RTK_PATCH_OP_MAC, // TODO unimplemented
++ RTK_PATCH_OP_DELAY_MS
++};
++
++struct rtlgen_hwpatch {
++ u8 patch_op;
++ u8 portmask;
++ __le16 pagemmd;
++ __le16 addr;
++ u8 msb;
++ u8 lsb;
++ __le16 data;
++} __packed;
++
++struct rtlgen_phy_patch_db {
++ int (*patch_op_exec)(struct phy_device *phydev, const struct rtlgen_hwpatch *patch);
++ size_t count;
++ struct rtlgen_hwpatch conf[] __counted_by(count);
++};
++
++int rtlgen_phy_patch(struct phy_device *phydev);
++
++#endif
+--- /dev/null
++++ b/drivers/net/phy/realtek/phy_patch_rtl826x.c
+@@ -0,0 +1,287 @@
++// SPDX-License-Identifier: GPL-2.0
++
++#include "phy_patch_rtl826x.h"
++
++#include <linux/bitops.h>
++#include <linux/bits.h>
++#include <linux/byteorder/generic.h>
++#include <linux/delay.h>
++#include <linux/errno.h>
++#include <linux/firmware.h>
++#include <linux/gfp.h>
++#include <linux/ktime.h>
++#include <linux/mdio.h>
++#include <linux/module.h>
++#include <linux/overflow.h>
++#include <linux/phy.h>
++#include <linux/slab.h>
++#include <linux/stddef.h>
++#include <linux/string.h>
++#include <linux/types.h>
++
++#include "phy_patch.h"
++#include "realtek.h"
++
++#define PHY_PATCH_WAIT_TIMEOUT 10000000
++
++static u16 rtl826x_mmd_convert(u16 page, u16 addr)
++{
++ if (addr < 16)
++ return 0xA400 + (page * 2);
++
++ if (addr < 24)
++ return (16 * page) + ((addr - 16) * 2);
++
++ return 0xA430 + ((addr - 24) * 2);
++}
++
++static int rtl826x_phy_patch_wait(struct phy_device *phydev, u32 mmd_addr, u32 mmd_reg,
++ u16 data, u16 mask, bool wait_equal)
++{
++ s64 us_diff = 0;
++ ktime_t start;
++ ktime_t now;
++ bool equal;
++ int ret;
++
++ start = ktime_get();
++
++ do {
++ ret = phy_read_mmd(phydev, mmd_addr, mmd_reg);
++ if (ret < 0)
++ return ret;
++
++ equal = (ret & mask) == data;
++ if (equal == wait_equal)
++ break;
++
++ msleep(1);
++
++ now = ktime_get();
++ us_diff = ktime_to_us(ktime_sub(now, start));
++ } while (us_diff < PHY_PATCH_WAIT_TIMEOUT);
++
++ if (us_diff >= PHY_PATCH_WAIT_TIMEOUT) {
++ phydev_err(phydev, "826xb patch wait[%u,0x%X,0x%X,0x%X]:0x%X\n",
++ mmd_addr, mmd_reg, mask, data, ret);
++ return -ETIME;
++ }
++
++ return 0;
++}
++
++static int rtl826x_phy_patch_sds_get(struct phy_device *phydev, u32 sds_page, u32 sds_reg)
++{
++ u32 sds_addr = 0x8000 + (sds_reg << 6) + sds_page;
++ int ret;
++
++ ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x143, sds_addr);
++ if (ret < 0)
++ return ret;
++
++ ret = rtl826x_phy_patch_wait(phydev, MDIO_MMD_VEND1, 0x143, 0, BIT(15), true);
++ if (ret < 0)
++ return ret;
++
++ return phy_read_mmd(phydev, MDIO_MMD_VEND1, 0x142);
++}
++
++static int rtl826x_phy_patch_sds_set(struct phy_device *phydev, u32 sds_page, u32 sds_reg,
++ u32 data)
++{
++ u32 sds_addr = 0x8800 + (sds_reg << 6) + sds_page;
++ int ret;
++
++ ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x141, data);
++ if (ret < 0)
++ return ret;
++
++ ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x143, sds_addr);
++ if (ret < 0)
++ return ret;
++
++ return rtl826x_phy_patch_wait(phydev, MDIO_MMD_VEND1, 0x143, 0, BIT(15), true);
++}
++
++static int rtl826x_phy_patch_sds_modify(struct phy_device *phydev, u32 sds_page, u32 sds_reg,
++ u32 mask, u32 data)
++{
++ int ret = 0;
++
++ if (mask != GENMASK(15, 0)) {
++ ret = rtl826x_phy_patch_sds_get(phydev, sds_page, sds_reg);
++ if (ret < 0)
++ return ret;
++ }
++
++ return rtl826x_phy_patch_sds_set(phydev, sds_page, sds_reg, (ret & ~mask) | data);
++}
++
++static int rtl826x_phy_patch_op(struct phy_device *phydev, const struct rtlgen_hwpatch *patch)
++{
++ u32 mask = GENMASK(patch->msb, patch->lsb);
++ u16 pagemmd = le16_to_cpu(patch->pagemmd);
++ u16 addr = le16_to_cpu(patch->addr);
++ u16 data = le16_to_cpu(patch->data);
++ bool wait_equal;
++ int ret = 0;
++ int val;
++ int cnt;
++ u16 reg;
++
++ phydev_dbg(phydev, "patch: op: %u pm: %x mmd: %x addr: %x mask: [%u, %u] data: %x\n",
++ patch->patch_op, patch->portmask, pagemmd, addr,
++ patch->msb, patch->lsb, data);
++
++ switch (patch->patch_op) {
++ case RTK_PATCH_OP_PHY:
++ reg = rtl826x_mmd_convert(pagemmd, addr);
++ if (mask != GENMASK(15, 0)) {
++ ret = phy_modify_mmd(phydev, MDIO_MMD_VEND2, reg, mask,
++ data << patch->lsb);
++ if (ret < 0)
++ return ret;
++ } else {
++ ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, reg,
++ data << patch->lsb);
++ if (ret < 0)
++ return ret;
++ }
++ break;
++
++ case RTK_PATCH_OP_PHY_WAIT:
++ case RTK_PATCH_OP_PHY_WAIT_NOT:
++ wait_equal = patch->patch_op == RTK_PATCH_OP_PHY_WAIT;
++ reg = rtl826x_mmd_convert(pagemmd, addr);
++ ret = rtl826x_phy_patch_wait(phydev, MDIO_MMD_VEND2, reg,
++ data << patch->lsb, mask, wait_equal);
++ if (ret < 0)
++ return ret;
++ break;
++
++ case RTK_PATCH_OP_PHYOCP:
++ if (mask != GENMASK(15, 0)) {
++ ret = phy_modify_mmd(phydev, MDIO_MMD_VEND2, addr, mask,
++ data << patch->lsb);
++ if (ret < 0)
++ return ret;
++ } else {
++ ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, addr,
++ data << patch->lsb);
++ if (ret < 0)
++ return ret;
++ }
++ break;
++
++ case RTK_PATCH_OP_PHYOCP_BC62:
++ val = phy_read_mmd(phydev, MDIO_MMD_VEND2, 0xbc62);
++ if (val < 0)
++ return val;
++
++ val = (val >> 8) & 0x1f;
++ for (cnt = 0; cnt <= val; cnt++) {
++ ret = phy_modify_mmd(phydev, MDIO_MMD_VEND2, 0xbc62,
++ GENMASK(12, 8), cnt << 8);
++ if (ret < 0)
++ return ret;
++ }
++ break;
++
++ case RTK_PATCH_OP_TOP:
++ if (addr < 16)
++ return -EINVAL;
++
++ reg = (pagemmd * 8) + (addr - 16);
++ if (mask != GENMASK(15, 0)) {
++ ret = phy_modify_mmd(phydev, MDIO_MMD_VEND1, reg, mask,
++ data << patch->lsb);
++ if (ret < 0)
++ return ret;
++ } else {
++ ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, reg, data << patch->lsb);
++ if (ret < 0)
++ return ret;
++ }
++ break;
++
++ case RTK_PATCH_OP_PSDS0:
++ ret = rtl826x_phy_patch_sds_modify(phydev, pagemmd, addr,
++ mask, data << patch->lsb);
++ if (ret < 0)
++ return ret;
++ break;
++
++ case RTK_PATCH_OP_DELAY_MS:
++ msleep(data);
++ break;
++
++ default:
++ phydev_err(phydev, "%s: %u not implemented yet!\n", __func__, patch->patch_op);
++ return -EINVAL;
++ }
++
++ return ret;
++}
++
++static int rtl826x_phy_patch_db_init(struct phy_device *phydev, const char *fw_name)
++{
++ struct rtl826x_priv *priv = phydev->priv;
++ struct device *dev = &phydev->mdio.dev;
++ struct rtlgen_phy_patch_db *patch_db;
++ struct rtlgen_hwpatch *patches;
++ const struct firmware *fw;
++ size_t count;
++ int ret;
++
++ ret = request_firmware_direct(&fw, fw_name, dev);
++ if (ret) {
++ if (ret == -ENOENT) {
++ phydev_dbg(phydev, "Failed to request %s: defer probing\n", fw_name);
++ return -EPROBE_DEFER;
++ } else {
++ phydev_err(phydev, "Failed to request %s: %d\n", fw_name, ret);
++ return ret;
++ }
++ }
++
++ if (!fw->size || fw->size % sizeof(*patches) != 0) {
++ phydev_err(phydev, "Invalid firmware size %zu for %s\n",
++ fw->size, fw_name);
++ ret = -EINVAL;
++ goto out;
++ }
++
++ patches = (struct rtlgen_hwpatch *)fw->data;
++ count = fw->size / sizeof(*patches);
++
++ patch_db = devm_kzalloc(dev, struct_size(patch_db, conf, count), GFP_KERNEL);
++ if (!patch_db) {
++ ret = -ENOMEM;
++ goto out;
++ }
++
++ patch_db->count = count;
++ patch_db->patch_op_exec = rtl826x_phy_patch_op;
++
++ memcpy(patch_db->conf, patches, flex_array_size(patch_db, conf, count));
++
++ priv->patch = patch_db;
++
++out:
++ release_firmware(fw);
++
++ return ret;
++}
++
++int rtl8261n_phy_patch_db_init(struct phy_device *phydev)
++{
++ return rtl826x_phy_patch_db_init(phydev, "rtl8261n.bin");
++}
++
++int rtl8264b_phy_patch_db_init(struct phy_device *phydev)
++{
++ return rtl826x_phy_patch_db_init(phydev, "rtl8264b.bin");
++}
++
++MODULE_FIRMWARE("rtl8261n.bin");
++MODULE_FIRMWARE("rtl8264b.bin");
+--- /dev/null
++++ b/drivers/net/phy/realtek/phy_patch_rtl826x.h
+@@ -0,0 +1,11 @@
++/* SPDX-License-Identifier: GPL-2.0 */
++
++#ifndef __PHY_PATCH_RTL826X_H__
++#define __PHY_PATCH_RTL826X_H__
++
++#include <linux/phy.h>
++
++int rtl8261n_phy_patch_db_init(struct phy_device *phydev);
++int rtl8264b_phy_patch_db_init(struct phy_device *phydev);
++
++#endif
diff --git a/target/linux/qualcommbe/image/ipq95xx.mk b/target/linux/qualcommbe/image/ipq95xx.mk
index 9693c4fac5..ba1b22e091 100644
--- a/target/linux/qualcommbe/image/ipq95xx.mk
+++ b/target/linux/qualcommbe/image/ipq95xx.mk
@@ -7,8 +7,7 @@ define Device/8devices_kiwi-dvk
DEVICE_MODEL := Kiwi-DVK
DEVICE_DTS_CONFIG := config@8dev-kiwi
SOC := ipq9570
- DEVICE_PACKAGES := kmod-ath12k ath12k-firmware-qcn9274 ipq-wifi-8devices_kiwi f2fsck mkf2fs kmod-sfp kmod-phy-maxlinear \
- kmod-phy-realtek rtl8261n-firmware
+ DEVICE_PACKAGES := kmod-ath12k ath12k-firmware-qcn9274 ipq-wifi-8devices_kiwi f2fsck mkf2fs kmod-sfp kmod-phy-maxlinear
IMAGE/factory.bin := qsdk-ipq-factory-nor
endef
TARGET_DEVICES += 8devices_kiwi-dvk
diff --git a/target/linux/qualcommbe/ipq95xx/config-default b/target/linux/qualcommbe/ipq95xx/config-default
index c479a19276..ab3bffac8f 100644
--- a/target/linux/qualcommbe/ipq95xx/config-default
+++ b/target/linux/qualcommbe/ipq95xx/config-default
@@ -57,6 +57,7 @@ CONFIG_REGULATOR_QCOM_SMD_RPM=y
CONFIG_REGULATOR_QCOM_SPMI=y
CONFIG_REGULATOR_USERSPACE_CONSUMER=y
CONFIG_RTC_DRV_PM8XXX=y
+CONFIG_RTL8261N_PHY=y
CONFIG_SPI_QPIC_SNAND=y
CONFIG_SPMI=y
# CONFIG_SPMI_HISI3670 is not set
Mostly:
|
The functionality/support for 5G and 10G PHYs was extracted from the realtek-phy driver and ported to the upstream Linux realtek PHY driver. These PHY chips need a sequence of register writes (and similar operations) for initialization. These sequences are provided as firmware files which are interpreted/applied by a new register patch engine.
By switching to the upstream driver, it should be possible to get rid of a large chunk of (from OpenWrt perspective) unmaintained code from Realtek. The actual Linux phy-core infrastructure from Linux can be mostly used and only the Realtek specific quirks need to be handled.
The files which need to be provided for the initialization are depending on the PHY:
If you have problems on Airoha (for example with Gemtek W1700K), please make sure you also apply the PRs
An u-boot PoC can be found at #20450 (comment) (tested on an MT7988B based prototype)
This PR supersedes #20450 because it wasn't updated anymore for a long period of time (see #20450 (comment)). It is basically the same thing you see over there - just with the feedback integrated (and maybe slightly better readable). It is not meant to add more features or support more HW than what balika001 already had in the original PR.
Things changed:
rtl8261nconf files (1:1 copy fromtarget/linux/generic/files/drivers/net/phy/rtl8261n/construct/conf_rtl826*topackage/firmware/rtl826x-firmware/srcas starting point - just to avoid regressions just because of different PHY patch sequencesDEVICE_PACKAGEfor (according to DTS or commit message) affected devicesrtl826XB_patch_rtk_conf/realtek,patch-rtk-serdespatch which was never applied even on thertl8261ndriver and is not needed with new realtek PCS driverThe old RTL8261N driver was not removed to keep the PR in a somewhat readable state and avoid unnecessary conflicts (for the moment). Later, it needs to be remove from:
target/linux/generic/files/drivers/net/phy/rtl8261n/(needs to be completely removed)package/kernel/linux/modules/netdevices.mk(onlyphy-rtl8261n)target/linux/generic/config-6.12(onlyCONFIG_RTL8261N_PHY)target/linux/generic/hack-6.12/735-net-phy-realtek-rtl8261n.patch(needs to be completely removed)genericmediatekqualcommberealteksiflower@dangowrt asked to already switch to the 6.18-only PHY polarity properties for the 6.12-only Gemtek W1700k. It is therefore expected that this PR doesn't even build anymore. I am really sorry about this but this is what was requested by the reviewer. I would have preferred to first get Airoha and all other RTL826x users from 6.12 to 6.18 before changing their device trees.
At the same time, this will also break IPQ95xx TPlink-BE450 and Keenetic Kap-630 because it doesn't have any driver for 6.12. This wouldn't have happened with the original plan...Added the 6.12 support again but with therealtek,pnswap*support removed.