mirror of
https://github.com/Heleguo/lede.git
synced 2025-12-16 19:01:32 +00:00
generic: backport support for Aeonsemi PHY
Backport support for Aeonsemi AS121xxx PHY. The PHY require dedicated firmware to be loaded to correctly work and support a big family of Aeonsemi PHY that provide from 1G to 10G speed. Automatically refresh all affected patch and file (rtl PHY). Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
This commit is contained in:
parent
5ea304007f
commit
0ac149ffc9
@ -469,10 +469,27 @@ endef
|
||||
$(eval $(call KernelPackage,phy-vitesse))
|
||||
|
||||
|
||||
define KernelPackage/phy-aeonsemi-as21xxx
|
||||
SUBMENU:=$(NETWORK_DEVICES_MENU)
|
||||
TITLE:=Aeonsemi AS21xxx 10G Ethernet PHY
|
||||
DEPENDS:=+aeonsemi-as21xxx-firmware +kmod-libphy
|
||||
KCONFIG:=CONFIG_AS21XXX_PHY
|
||||
FILES:= \
|
||||
$(LINUX_DIR)/drivers/net/phy/as21xxx.ko
|
||||
AUTOLOAD:=$(call AutoLoad,18,as21xxx)
|
||||
endef
|
||||
|
||||
define KernelPackage/phy-aeonsemi-as21xxx/description
|
||||
Kernel modules for Aeonsemi AS21x1x 10G Ethernet PHY
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,phy-aeonsemi-as21xxx))
|
||||
|
||||
|
||||
define KernelPackage/phy-airoha-en8811h
|
||||
SUBMENU:=$(NETWORK_DEVICES_MENU)
|
||||
TITLE:=Airoha EN8811H 2.5G Ethernet PHY
|
||||
DEPENDS:=+en8811h-firmware +kmod-libphy
|
||||
DEPENDS:=+airoha-en8811h-firmware +kmod-libphy
|
||||
KCONFIG:=CONFIG_AIR_EN8811H_PHY
|
||||
FILES:= \
|
||||
$(LINUX_DIR)/drivers/net/phy/air_en8811h.ko
|
||||
|
||||
@ -0,0 +1,303 @@
|
||||
From 31afd6bc55cc0093c3e5b0a368319e423d4de8ea Mon Sep 17 00:00:00 2001
|
||||
From: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Date: Sat, 17 May 2025 22:13:45 +0200
|
||||
Subject: [PATCH] net: phy: pass PHY driver to .match_phy_device OP
|
||||
|
||||
Pass PHY driver pointer to .match_phy_device OP in addition to phydev.
|
||||
Having access to the PHY driver struct might be useful to check the
|
||||
PHY ID of the driver is being matched for in case the PHY ID scanned in
|
||||
the phydev is not consistent.
|
||||
|
||||
A scenario for this is a PHY that change PHY ID after a firmware is
|
||||
loaded, in such case, the PHY ID stored in PHY device struct is not
|
||||
valid anymore and PHY will manually scan the ID in the match_phy_device
|
||||
function.
|
||||
|
||||
Having the PHY driver info is also useful for those PHY driver that
|
||||
implement multiple simple .match_phy_device OP to match specific MMD PHY
|
||||
ID. With this extra info if the parsing logic is the same, the matching
|
||||
function can be generalized by using the phy_id in the PHY driver
|
||||
instead of hardcoding.
|
||||
|
||||
Rust wrapper callback is updated to align to the new match_phy_device
|
||||
arguments.
|
||||
|
||||
Suggested-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
|
||||
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
|
||||
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Reviewed-by: Benno Lossin <lossin@kernel.org> # for Rust
|
||||
Reviewed-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
|
||||
Link: https://patch.msgid.link/20250517201353.5137-2-ansuelsmth@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/phy/bcm87xx.c | 6 ++++--
|
||||
drivers/net/phy/icplus.c | 6 ++++--
|
||||
drivers/net/phy/marvell10g.c | 12 ++++++++----
|
||||
drivers/net/phy/micrel.c | 6 ++++--
|
||||
drivers/net/phy/nxp-c45-tja11xx.c | 12 ++++++++----
|
||||
drivers/net/phy/nxp-tja11xx.c | 6 ++++--
|
||||
drivers/net/phy/phy_device.c | 2 +-
|
||||
drivers/net/phy/realtek/realtek_main.c | 27 +++++++++++++++++---------
|
||||
drivers/net/phy/teranetics.c | 3 ++-
|
||||
include/linux/phy.h | 3 ++-
|
||||
rust/kernel/net/phy.rs | 1 +
|
||||
11 files changed, 56 insertions(+), 28 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/bcm87xx.c
|
||||
+++ b/drivers/net/phy/bcm87xx.c
|
||||
@@ -185,12 +185,14 @@ static irqreturn_t bcm87xx_handle_interr
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
-static int bcm8706_match_phy_device(struct phy_device *phydev)
|
||||
+static int bcm8706_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return phydev->c45_ids.device_ids[4] == PHY_ID_BCM8706;
|
||||
}
|
||||
|
||||
-static int bcm8727_match_phy_device(struct phy_device *phydev)
|
||||
+static int bcm8727_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return phydev->c45_ids.device_ids[4] == PHY_ID_BCM8727;
|
||||
}
|
||||
--- a/drivers/net/phy/icplus.c
|
||||
+++ b/drivers/net/phy/icplus.c
|
||||
@@ -520,12 +520,14 @@ static int ip101a_g_match_phy_device(str
|
||||
return ip101a == !ret;
|
||||
}
|
||||
|
||||
-static int ip101a_match_phy_device(struct phy_device *phydev)
|
||||
+static int ip101a_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return ip101a_g_match_phy_device(phydev, true);
|
||||
}
|
||||
|
||||
-static int ip101g_match_phy_device(struct phy_device *phydev)
|
||||
+static int ip101g_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return ip101a_g_match_phy_device(phydev, false);
|
||||
}
|
||||
--- a/drivers/net/phy/marvell10g.c
|
||||
+++ b/drivers/net/phy/marvell10g.c
|
||||
@@ -1284,7 +1284,8 @@ static int mv3310_get_number_of_ports(st
|
||||
return ret + 1;
|
||||
}
|
||||
|
||||
-static int mv3310_match_phy_device(struct phy_device *phydev)
|
||||
+static int mv3310_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
if ((phydev->c45_ids.device_ids[MDIO_MMD_PMAPMD] &
|
||||
MARVELL_PHY_ID_MASK) != MARVELL_PHY_ID_88X3310)
|
||||
@@ -1293,7 +1294,8 @@ static int mv3310_match_phy_device(struc
|
||||
return mv3310_get_number_of_ports(phydev) == 1;
|
||||
}
|
||||
|
||||
-static int mv3340_match_phy_device(struct phy_device *phydev)
|
||||
+static int mv3340_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
if ((phydev->c45_ids.device_ids[MDIO_MMD_PMAPMD] &
|
||||
MARVELL_PHY_ID_MASK) != MARVELL_PHY_ID_88X3310)
|
||||
@@ -1317,12 +1319,14 @@ static int mv211x_match_phy_device(struc
|
||||
return !!(val & MDIO_PCS_SPEED_5G) == has_5g;
|
||||
}
|
||||
|
||||
-static int mv2110_match_phy_device(struct phy_device *phydev)
|
||||
+static int mv2110_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return mv211x_match_phy_device(phydev, true);
|
||||
}
|
||||
|
||||
-static int mv2111_match_phy_device(struct phy_device *phydev)
|
||||
+static int mv2111_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return mv211x_match_phy_device(phydev, false);
|
||||
}
|
||||
--- a/drivers/net/phy/micrel.c
|
||||
+++ b/drivers/net/phy/micrel.c
|
||||
@@ -768,7 +768,8 @@ static int ksz8051_ksz8795_match_phy_dev
|
||||
return !ret;
|
||||
}
|
||||
|
||||
-static int ksz8051_match_phy_device(struct phy_device *phydev)
|
||||
+static int ksz8051_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return ksz8051_ksz8795_match_phy_device(phydev, true);
|
||||
}
|
||||
@@ -888,7 +889,8 @@ static int ksz8061_config_init(struct ph
|
||||
return kszphy_config_init(phydev);
|
||||
}
|
||||
|
||||
-static int ksz8795_match_phy_device(struct phy_device *phydev)
|
||||
+static int ksz8795_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return ksz8051_ksz8795_match_phy_device(phydev, false);
|
||||
}
|
||||
--- a/drivers/net/phy/nxp-c45-tja11xx.c
|
||||
+++ b/drivers/net/phy/nxp-c45-tja11xx.c
|
||||
@@ -1944,13 +1944,15 @@ static int nxp_c45_macsec_ability(struct
|
||||
return macsec_ability;
|
||||
}
|
||||
|
||||
-static int tja1103_match_phy_device(struct phy_device *phydev)
|
||||
+static int tja1103_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return phy_id_compare(phydev->phy_id, PHY_ID_TJA_1103, PHY_ID_MASK) &&
|
||||
!nxp_c45_macsec_ability(phydev);
|
||||
}
|
||||
|
||||
-static int tja1104_match_phy_device(struct phy_device *phydev)
|
||||
+static int tja1104_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return phy_id_compare(phydev->phy_id, PHY_ID_TJA_1103, PHY_ID_MASK) &&
|
||||
nxp_c45_macsec_ability(phydev);
|
||||
--- a/drivers/net/phy/nxp-tja11xx.c
|
||||
+++ b/drivers/net/phy/nxp-tja11xx.c
|
||||
@@ -646,12 +646,14 @@ static int tja1102_match_phy_device(stru
|
||||
return !ret;
|
||||
}
|
||||
|
||||
-static int tja1102_p0_match_phy_device(struct phy_device *phydev)
|
||||
+static int tja1102_p0_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return tja1102_match_phy_device(phydev, true);
|
||||
}
|
||||
|
||||
-static int tja1102_p1_match_phy_device(struct phy_device *phydev)
|
||||
+static int tja1102_p1_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return tja1102_match_phy_device(phydev, false);
|
||||
}
|
||||
--- a/drivers/net/phy/phy_device.c
|
||||
+++ b/drivers/net/phy/phy_device.c
|
||||
@@ -600,7 +600,7 @@ static int phy_bus_match(struct device *
|
||||
return 0;
|
||||
|
||||
if (phydrv->match_phy_device)
|
||||
- return phydrv->match_phy_device(phydev);
|
||||
+ return phydrv->match_phy_device(phydev, phydrv);
|
||||
|
||||
if (phydev->is_c45) {
|
||||
for (i = 1; i < num_ids; i++) {
|
||||
--- a/drivers/net/phy/realtek/realtek_main.c
|
||||
+++ b/drivers/net/phy/realtek/realtek_main.c
|
||||
@@ -1343,13 +1343,15 @@ static bool rtlgen_supports_mmd(struct p
|
||||
return val > 0;
|
||||
}
|
||||
|
||||
-static int rtlgen_match_phy_device(struct phy_device *phydev)
|
||||
+static int rtlgen_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return phydev->phy_id == RTL_GENERIC_PHYID &&
|
||||
!rtlgen_supports_2_5gbps(phydev);
|
||||
}
|
||||
|
||||
-static int rtl8226_match_phy_device(struct phy_device *phydev)
|
||||
+static int rtl8226_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return phydev->phy_id == RTL_GENERIC_PHYID &&
|
||||
rtlgen_supports_2_5gbps(phydev) &&
|
||||
@@ -1365,32 +1367,38 @@ static int rtlgen_is_c45_match(struct ph
|
||||
return !is_c45 && (id == phydev->phy_id);
|
||||
}
|
||||
|
||||
-static int rtl8221b_match_phy_device(struct phy_device *phydev)
|
||||
+static int rtl8221b_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return phydev->phy_id == RTL_8221B && rtlgen_supports_mmd(phydev);
|
||||
}
|
||||
|
||||
-static int rtl8221b_vb_cg_c22_match_phy_device(struct phy_device *phydev)
|
||||
+static int rtl8221b_vb_cg_c22_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return rtlgen_is_c45_match(phydev, RTL_8221B_VB_CG, false);
|
||||
}
|
||||
|
||||
-static int rtl8221b_vb_cg_c45_match_phy_device(struct phy_device *phydev)
|
||||
+static int rtl8221b_vb_cg_c45_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return rtlgen_is_c45_match(phydev, RTL_8221B_VB_CG, true);
|
||||
}
|
||||
|
||||
-static int rtl8221b_vn_cg_c22_match_phy_device(struct phy_device *phydev)
|
||||
+static int rtl8221b_vn_cg_c22_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return rtlgen_is_c45_match(phydev, RTL_8221B_VN_CG, false);
|
||||
}
|
||||
|
||||
-static int rtl8221b_vn_cg_c45_match_phy_device(struct phy_device *phydev)
|
||||
+static int rtl8221b_vn_cg_c45_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return rtlgen_is_c45_match(phydev, RTL_8221B_VN_CG, true);
|
||||
}
|
||||
|
||||
-static int rtl_internal_nbaset_match_phy_device(struct phy_device *phydev)
|
||||
+static int rtl_internal_nbaset_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
if (phydev->is_c45)
|
||||
return false;
|
||||
@@ -1409,7 +1417,8 @@ static int rtl_internal_nbaset_match_phy
|
||||
return rtlgen_supports_2_5gbps(phydev) && !rtlgen_supports_mmd(phydev);
|
||||
}
|
||||
|
||||
-static int rtl8251b_c45_match_phy_device(struct phy_device *phydev)
|
||||
+static int rtl8251b_c45_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return rtlgen_is_c45_match(phydev, RTL_8251B, true);
|
||||
}
|
||||
--- a/drivers/net/phy/teranetics.c
|
||||
+++ b/drivers/net/phy/teranetics.c
|
||||
@@ -67,7 +67,8 @@ static int teranetics_read_status(struct
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int teranetics_match_phy_device(struct phy_device *phydev)
|
||||
+static int teranetics_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return phydev->c45_ids.device_ids[3] == PHY_ID_TN2020;
|
||||
}
|
||||
--- a/include/linux/phy.h
|
||||
+++ b/include/linux/phy.h
|
||||
@@ -1004,7 +1004,8 @@ struct phy_driver {
|
||||
* driver for the given phydev. If NULL, matching is based on
|
||||
* phy_id and phy_id_mask.
|
||||
*/
|
||||
- int (*match_phy_device)(struct phy_device *phydev);
|
||||
+ int (*match_phy_device)(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv);
|
||||
|
||||
/**
|
||||
* @set_wol: Some devices (e.g. qnap TS-119P II) require PHY
|
||||
--- a/rust/kernel/net/phy.rs
|
||||
+++ b/rust/kernel/net/phy.rs
|
||||
@@ -421,6 +421,7 @@ impl<T: Driver> Adapter<T> {
|
||||
/// `phydev` must be passed by the corresponding callback in `phy_driver`.
|
||||
unsafe extern "C" fn match_phy_device_callback(
|
||||
phydev: *mut bindings::phy_device,
|
||||
+ _phydrv: *const bindings::phy_driver,
|
||||
) -> crate::ffi::c_int {
|
||||
// SAFETY: This callback is called only in contexts
|
||||
// where we hold `phy_device->lock`, so the accessors on
|
||||
@ -0,0 +1,109 @@
|
||||
From d6c45707ac84c2d9f274ece1cea4dddb97996bde Mon Sep 17 00:00:00 2001
|
||||
From: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Date: Sat, 17 May 2025 22:13:48 +0200
|
||||
Subject: [PATCH 4/5] net: phy: introduce genphy_match_phy_device()
|
||||
|
||||
Introduce new API, genphy_match_phy_device(), to provide a way to check
|
||||
to match a PHY driver for a PHY device based on the info stored in the
|
||||
PHY device struct.
|
||||
|
||||
The function generalize the logic used in phy_bus_match() to check the
|
||||
PHY ID whether if C45 or C22 ID should be used for matching.
|
||||
|
||||
This is useful for custom .match_phy_device function that wants to use
|
||||
the generic logic under some condition. (example a PHY is already setup
|
||||
and provide the correct PHY ID)
|
||||
|
||||
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
|
||||
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Link: https://patch.msgid.link/20250517201353.5137-5-ansuelsmth@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/phy/phy_device.c | 52 +++++++++++++++++++++++++-----------
|
||||
include/linux/phy.h | 3 +++
|
||||
2 files changed, 40 insertions(+), 15 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/phy_device.c
|
||||
+++ b/drivers/net/phy/phy_device.c
|
||||
@@ -589,20 +589,26 @@ static int phy_scan_fixups(struct phy_de
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int phy_bus_match(struct device *dev, const struct device_driver *drv)
|
||||
+/**
|
||||
+ * genphy_match_phy_device - match a PHY device with a PHY driver
|
||||
+ * @phydev: target phy_device struct
|
||||
+ * @phydrv: target phy_driver struct
|
||||
+ *
|
||||
+ * Description: Checks whether the given PHY device matches the specified
|
||||
+ * PHY driver. For Clause 45 PHYs, iterates over the available device
|
||||
+ * identifiers and compares them against the driver's expected PHY ID,
|
||||
+ * applying the provided mask. For Clause 22 PHYs, a direct ID comparison
|
||||
+ * is performed.
|
||||
+ *
|
||||
+ * Return: 1 if the PHY device matches the driver, 0 otherwise.
|
||||
+ */
|
||||
+int genphy_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
- struct phy_device *phydev = to_phy_device(dev);
|
||||
- const struct phy_driver *phydrv = to_phy_driver(drv);
|
||||
- const int num_ids = ARRAY_SIZE(phydev->c45_ids.device_ids);
|
||||
- int i;
|
||||
-
|
||||
- if (!(phydrv->mdiodrv.flags & MDIO_DEVICE_IS_PHY))
|
||||
- return 0;
|
||||
-
|
||||
- if (phydrv->match_phy_device)
|
||||
- return phydrv->match_phy_device(phydev, phydrv);
|
||||
-
|
||||
if (phydev->is_c45) {
|
||||
+ const int num_ids = ARRAY_SIZE(phydev->c45_ids.device_ids);
|
||||
+ int i;
|
||||
+
|
||||
for (i = 1; i < num_ids; i++) {
|
||||
if (phydev->c45_ids.device_ids[i] == 0xffffffff)
|
||||
continue;
|
||||
@@ -611,11 +617,27 @@ static int phy_bus_match(struct device *
|
||||
phydrv->phy_id, phydrv->phy_id_mask))
|
||||
return 1;
|
||||
}
|
||||
+
|
||||
return 0;
|
||||
- } else {
|
||||
- return phy_id_compare(phydev->phy_id, phydrv->phy_id,
|
||||
- phydrv->phy_id_mask);
|
||||
}
|
||||
+
|
||||
+ return phy_id_compare(phydev->phy_id, phydrv->phy_id,
|
||||
+ phydrv->phy_id_mask);
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(genphy_match_phy_device);
|
||||
+
|
||||
+static int phy_bus_match(struct device *dev, const struct device_driver *drv)
|
||||
+{
|
||||
+ struct phy_device *phydev = to_phy_device(dev);
|
||||
+ const struct phy_driver *phydrv = to_phy_driver(drv);
|
||||
+
|
||||
+ if (!(phydrv->mdiodrv.flags & MDIO_DEVICE_IS_PHY))
|
||||
+ return 0;
|
||||
+
|
||||
+ if (phydrv->match_phy_device)
|
||||
+ return phydrv->match_phy_device(phydev, phydrv);
|
||||
+
|
||||
+ return genphy_match_phy_device(phydev, phydrv);
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
--- a/include/linux/phy.h
|
||||
+++ b/include/linux/phy.h
|
||||
@@ -1906,6 +1906,9 @@ char *phy_attached_info_irq(struct phy_d
|
||||
__malloc;
|
||||
void phy_attached_info(struct phy_device *phydev);
|
||||
|
||||
+int genphy_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv);
|
||||
+
|
||||
/* Clause 22 PHY */
|
||||
int genphy_read_abilities(struct phy_device *phydev);
|
||||
int genphy_setup_forced(struct phy_device *phydev);
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,273 @@
|
||||
From 31afd6bc55cc0093c3e5b0a368319e423d4de8ea Mon Sep 17 00:00:00 2001
|
||||
From: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Date: Sat, 17 May 2025 22:13:45 +0200
|
||||
Subject: [PATCH 1/5] net: phy: pass PHY driver to .match_phy_device OP
|
||||
|
||||
Pass PHY driver pointer to .match_phy_device OP in addition to phydev.
|
||||
Having access to the PHY driver struct might be useful to check the
|
||||
PHY ID of the driver is being matched for in case the PHY ID scanned in
|
||||
the phydev is not consistent.
|
||||
|
||||
A scenario for this is a PHY that change PHY ID after a firmware is
|
||||
loaded, in such case, the PHY ID stored in PHY device struct is not
|
||||
valid anymore and PHY will manually scan the ID in the match_phy_device
|
||||
function.
|
||||
|
||||
Having the PHY driver info is also useful for those PHY driver that
|
||||
implement multiple simple .match_phy_device OP to match specific MMD PHY
|
||||
ID. With this extra info if the parsing logic is the same, the matching
|
||||
function can be generalized by using the phy_id in the PHY driver
|
||||
instead of hardcoding.
|
||||
|
||||
Rust wrapper callback is updated to align to the new match_phy_device
|
||||
arguments.
|
||||
|
||||
Suggested-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
|
||||
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
|
||||
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Reviewed-by: Benno Lossin <lossin@kernel.org> # for Rust
|
||||
Reviewed-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
|
||||
Link: https://patch.msgid.link/20250517201353.5137-2-ansuelsmth@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/phy/bcm87xx.c | 6 ++++--
|
||||
drivers/net/phy/icplus.c | 6 ++++--
|
||||
drivers/net/phy/marvell10g.c | 12 ++++++++----
|
||||
drivers/net/phy/micrel.c | 6 ++++--
|
||||
drivers/net/phy/nxp-c45-tja11xx.c | 12 ++++++++----
|
||||
drivers/net/phy/nxp-tja11xx.c | 6 ++++--
|
||||
drivers/net/phy/phy_device.c | 2 +-
|
||||
drivers/net/phy/realtek/realtek_main.c | 27 +++++++++++++++++---------
|
||||
drivers/net/phy/teranetics.c | 3 ++-
|
||||
include/linux/phy.h | 3 ++-
|
||||
rust/kernel/net/phy.rs | 1 +
|
||||
11 files changed, 56 insertions(+), 28 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/bcm87xx.c
|
||||
+++ b/drivers/net/phy/bcm87xx.c
|
||||
@@ -185,12 +185,14 @@ static irqreturn_t bcm87xx_handle_interr
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
-static int bcm8706_match_phy_device(struct phy_device *phydev)
|
||||
+static int bcm8706_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return phydev->c45_ids.device_ids[4] == PHY_ID_BCM8706;
|
||||
}
|
||||
|
||||
-static int bcm8727_match_phy_device(struct phy_device *phydev)
|
||||
+static int bcm8727_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return phydev->c45_ids.device_ids[4] == PHY_ID_BCM8727;
|
||||
}
|
||||
--- a/drivers/net/phy/icplus.c
|
||||
+++ b/drivers/net/phy/icplus.c
|
||||
@@ -520,12 +520,14 @@ static int ip101a_g_match_phy_device(str
|
||||
return ip101a == !ret;
|
||||
}
|
||||
|
||||
-static int ip101a_match_phy_device(struct phy_device *phydev)
|
||||
+static int ip101a_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return ip101a_g_match_phy_device(phydev, true);
|
||||
}
|
||||
|
||||
-static int ip101g_match_phy_device(struct phy_device *phydev)
|
||||
+static int ip101g_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return ip101a_g_match_phy_device(phydev, false);
|
||||
}
|
||||
--- a/drivers/net/phy/marvell10g.c
|
||||
+++ b/drivers/net/phy/marvell10g.c
|
||||
@@ -1221,7 +1221,8 @@ static int mv3310_get_number_of_ports(st
|
||||
return ret + 1;
|
||||
}
|
||||
|
||||
-static int mv3310_match_phy_device(struct phy_device *phydev)
|
||||
+static int mv3310_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
if ((phydev->c45_ids.device_ids[MDIO_MMD_PMAPMD] &
|
||||
MARVELL_PHY_ID_MASK) != MARVELL_PHY_ID_88X3310)
|
||||
@@ -1230,7 +1231,8 @@ static int mv3310_match_phy_device(struc
|
||||
return mv3310_get_number_of_ports(phydev) == 1;
|
||||
}
|
||||
|
||||
-static int mv3340_match_phy_device(struct phy_device *phydev)
|
||||
+static int mv3340_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
if ((phydev->c45_ids.device_ids[MDIO_MMD_PMAPMD] &
|
||||
MARVELL_PHY_ID_MASK) != MARVELL_PHY_ID_88X3310)
|
||||
@@ -1254,12 +1256,14 @@ static int mv211x_match_phy_device(struc
|
||||
return !!(val & MDIO_PCS_SPEED_5G) == has_5g;
|
||||
}
|
||||
|
||||
-static int mv2110_match_phy_device(struct phy_device *phydev)
|
||||
+static int mv2110_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return mv211x_match_phy_device(phydev, true);
|
||||
}
|
||||
|
||||
-static int mv2111_match_phy_device(struct phy_device *phydev)
|
||||
+static int mv2111_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return mv211x_match_phy_device(phydev, false);
|
||||
}
|
||||
--- a/drivers/net/phy/micrel.c
|
||||
+++ b/drivers/net/phy/micrel.c
|
||||
@@ -670,7 +670,8 @@ static int ksz8051_ksz8795_match_phy_dev
|
||||
return !ret;
|
||||
}
|
||||
|
||||
-static int ksz8051_match_phy_device(struct phy_device *phydev)
|
||||
+static int ksz8051_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return ksz8051_ksz8795_match_phy_device(phydev, true);
|
||||
}
|
||||
@@ -790,7 +791,8 @@ static int ksz8061_config_init(struct ph
|
||||
return kszphy_config_init(phydev);
|
||||
}
|
||||
|
||||
-static int ksz8795_match_phy_device(struct phy_device *phydev)
|
||||
+static int ksz8795_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return ksz8051_ksz8795_match_phy_device(phydev, false);
|
||||
}
|
||||
--- a/drivers/net/phy/nxp-tja11xx.c
|
||||
+++ b/drivers/net/phy/nxp-tja11xx.c
|
||||
@@ -648,12 +648,14 @@ static int tja1102_match_phy_device(stru
|
||||
return !ret;
|
||||
}
|
||||
|
||||
-static int tja1102_p0_match_phy_device(struct phy_device *phydev)
|
||||
+static int tja1102_p0_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return tja1102_match_phy_device(phydev, true);
|
||||
}
|
||||
|
||||
-static int tja1102_p1_match_phy_device(struct phy_device *phydev)
|
||||
+static int tja1102_p1_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return tja1102_match_phy_device(phydev, false);
|
||||
}
|
||||
--- a/drivers/net/phy/phy_device.c
|
||||
+++ b/drivers/net/phy/phy_device.c
|
||||
@@ -533,7 +533,7 @@ static int phy_bus_match(struct device *
|
||||
return 0;
|
||||
|
||||
if (phydrv->match_phy_device)
|
||||
- return phydrv->match_phy_device(phydev);
|
||||
+ return phydrv->match_phy_device(phydev, phydrv);
|
||||
|
||||
if (phydev->is_c45) {
|
||||
for (i = 1; i < num_ids; i++) {
|
||||
--- a/drivers/net/phy/realtek/realtek_main.c
|
||||
+++ b/drivers/net/phy/realtek/realtek_main.c
|
||||
@@ -1315,13 +1315,15 @@ static bool rtlgen_supports_mmd(struct p
|
||||
return val > 0;
|
||||
}
|
||||
|
||||
-static int rtlgen_match_phy_device(struct phy_device *phydev)
|
||||
+static int rtlgen_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return phydev->phy_id == RTL_GENERIC_PHYID &&
|
||||
!rtlgen_supports_2_5gbps(phydev);
|
||||
}
|
||||
|
||||
-static int rtl8226_match_phy_device(struct phy_device *phydev)
|
||||
+static int rtl8226_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return phydev->phy_id == RTL_GENERIC_PHYID &&
|
||||
rtlgen_supports_2_5gbps(phydev) &&
|
||||
@@ -1337,32 +1339,38 @@ static int rtlgen_is_c45_match(struct ph
|
||||
return !is_c45 && (id == phydev->phy_id);
|
||||
}
|
||||
|
||||
-static int rtl8221b_match_phy_device(struct phy_device *phydev)
|
||||
+static int rtl8221b_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return phydev->phy_id == RTL_8221B && rtlgen_supports_mmd(phydev);
|
||||
}
|
||||
|
||||
-static int rtl8221b_vb_cg_c22_match_phy_device(struct phy_device *phydev)
|
||||
+static int rtl8221b_vb_cg_c22_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return rtlgen_is_c45_match(phydev, RTL_8221B_VB_CG, false);
|
||||
}
|
||||
|
||||
-static int rtl8221b_vb_cg_c45_match_phy_device(struct phy_device *phydev)
|
||||
+static int rtl8221b_vb_cg_c45_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return rtlgen_is_c45_match(phydev, RTL_8221B_VB_CG, true);
|
||||
}
|
||||
|
||||
-static int rtl8221b_vn_cg_c22_match_phy_device(struct phy_device *phydev)
|
||||
+static int rtl8221b_vn_cg_c22_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return rtlgen_is_c45_match(phydev, RTL_8221B_VN_CG, false);
|
||||
}
|
||||
|
||||
-static int rtl8221b_vn_cg_c45_match_phy_device(struct phy_device *phydev)
|
||||
+static int rtl8221b_vn_cg_c45_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return rtlgen_is_c45_match(phydev, RTL_8221B_VN_CG, true);
|
||||
}
|
||||
|
||||
-static int rtl_internal_nbaset_match_phy_device(struct phy_device *phydev)
|
||||
+static int rtl_internal_nbaset_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
if (phydev->is_c45)
|
||||
return false;
|
||||
@@ -1381,7 +1389,8 @@ static int rtl_internal_nbaset_match_phy
|
||||
return rtlgen_supports_2_5gbps(phydev) && !rtlgen_supports_mmd(phydev);
|
||||
}
|
||||
|
||||
-static int rtl8251b_c45_match_phy_device(struct phy_device *phydev)
|
||||
+static int rtl8251b_c45_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return rtlgen_is_c45_match(phydev, RTL_8251B, true);
|
||||
}
|
||||
--- a/drivers/net/phy/teranetics.c
|
||||
+++ b/drivers/net/phy/teranetics.c
|
||||
@@ -67,7 +67,8 @@ static int teranetics_read_status(struct
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int teranetics_match_phy_device(struct phy_device *phydev)
|
||||
+static int teranetics_match_phy_device(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv)
|
||||
{
|
||||
return phydev->c45_ids.device_ids[3] == PHY_ID_TN2020;
|
||||
}
|
||||
--- a/include/linux/phy.h
|
||||
+++ b/include/linux/phy.h
|
||||
@@ -972,7 +972,8 @@ struct phy_driver {
|
||||
* driver for the given phydev. If NULL, matching is based on
|
||||
* phy_id and phy_id_mask.
|
||||
*/
|
||||
- int (*match_phy_device)(struct phy_device *phydev);
|
||||
+ int (*match_phy_device)(struct phy_device *phydev,
|
||||
+ const struct phy_driver *phydrv);
|
||||
|
||||
/**
|
||||
* @set_wol: Some devices (e.g. qnap TS-119P II) require PHY
|
||||
@ -0,0 +1,109 @@
|
||||
From d6c45707ac84c2d9f274ece1cea4dddb97996bde Mon Sep 17 00:00:00 2001
|
||||
From: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Date: Sat, 17 May 2025 22:13:48 +0200
|
||||
Subject: [PATCH 4/5] net: phy: introduce genphy_match_phy_device()
|
||||
|
||||
Introduce new API, genphy_match_phy_device(), to provide a way to check
|
||||
to match a PHY driver for a PHY device based on the info stored in the
|
||||
PHY device struct.
|
||||
|
||||
The function generalize the logic used in phy_bus_match() to check the
|
||||
PHY ID whether if C45 or C22 ID should be used for matching.
|
||||
|
||||
This is useful for custom .match_phy_device function that wants to use
|
||||
the generic logic under some condition. (example a PHY is already setup
|
||||
and provide the correct PHY ID)
|
||||
|
||||
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
|
||||
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Link: https://patch.msgid.link/20250517201353.5137-5-ansuelsmth@gmail.com
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/phy/phy_device.c | 52 +++++++++++++++++++++++++-----------
|
||||
include/linux/phy.h | 3 +++
|
||||
2 files changed, 40 insertions(+), 15 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/phy_device.c
|
||||
+++ b/drivers/net/phy/phy_device.c
|
||||
@@ -522,20 +522,26 @@ static int phy_scan_fixups(struct phy_de
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int phy_bus_match(struct device *dev, struct device_driver *drv)
|
||||
+/**
|
||||
+ * genphy_match_phy_device - match a PHY device with a PHY driver
|
||||
+ * @phydev: target phy_device struct
|
||||
+ * @phydrv: target phy_driver struct
|
||||
+ *
|
||||
+ * Description: Checks whether the given PHY device matches the specified
|
||||
+ * PHY driver. For Clause 45 PHYs, iterates over the available device
|
||||
+ * identifiers and compares them against the driver's expected PHY ID,
|
||||
+ * applying the provided mask. For Clause 22 PHYs, a direct ID comparison
|
||||
+ * is performed.
|
||||
+ *
|
||||
+ * Return: 1 if the PHY device matches the driver, 0 otherwise.
|
||||
+ */
|
||||
+int genphy_match_phy_device(struct phy_device *phydev,
|
||||
+ struct phy_driver *phydrv)
|
||||
{
|
||||
- struct phy_device *phydev = to_phy_device(dev);
|
||||
- struct phy_driver *phydrv = to_phy_driver(drv);
|
||||
- const int num_ids = ARRAY_SIZE(phydev->c45_ids.device_ids);
|
||||
- int i;
|
||||
-
|
||||
- if (!(phydrv->mdiodrv.flags & MDIO_DEVICE_IS_PHY))
|
||||
- return 0;
|
||||
-
|
||||
- if (phydrv->match_phy_device)
|
||||
- return phydrv->match_phy_device(phydev, phydrv);
|
||||
-
|
||||
if (phydev->is_c45) {
|
||||
+ const int num_ids = ARRAY_SIZE(phydev->c45_ids.device_ids);
|
||||
+ int i;
|
||||
+
|
||||
for (i = 1; i < num_ids; i++) {
|
||||
if (phydev->c45_ids.device_ids[i] == 0xffffffff)
|
||||
continue;
|
||||
@@ -544,11 +550,27 @@ static int phy_bus_match(struct device *
|
||||
phydrv->phy_id, phydrv->phy_id_mask))
|
||||
return 1;
|
||||
}
|
||||
+
|
||||
return 0;
|
||||
- } else {
|
||||
- return phy_id_compare(phydev->phy_id, phydrv->phy_id,
|
||||
- phydrv->phy_id_mask);
|
||||
}
|
||||
+
|
||||
+ return phy_id_compare(phydev->phy_id, phydrv->phy_id,
|
||||
+ phydrv->phy_id_mask);
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(genphy_match_phy_device);
|
||||
+
|
||||
+static int phy_bus_match(struct device *dev, struct device_driver *drv)
|
||||
+{
|
||||
+ struct phy_device *phydev = to_phy_device(dev);
|
||||
+ struct phy_driver *phydrv = to_phy_driver(drv);
|
||||
+
|
||||
+ if (!(phydrv->mdiodrv.flags & MDIO_DEVICE_IS_PHY))
|
||||
+ return 0;
|
||||
+
|
||||
+ if (phydrv->match_phy_device)
|
||||
+ return phydrv->match_phy_device(phydev, phydrv);
|
||||
+
|
||||
+ return genphy_match_phy_device(phydev, phydrv);
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
--- a/include/linux/phy.h
|
||||
+++ b/include/linux/phy.h
|
||||
@@ -1812,6 +1812,9 @@ char *phy_attached_info_irq(struct phy_d
|
||||
__malloc;
|
||||
void phy_attached_info(struct phy_device *phydev);
|
||||
|
||||
+int genphy_match_phy_device(struct phy_device *phydev,
|
||||
+ struct phy_driver *phydrv);
|
||||
+
|
||||
/* Clause 22 PHY */
|
||||
int genphy_read_abilities(struct phy_device *phydev);
|
||||
int genphy_setup_forced(struct phy_device *phydev);
|
||||
File diff suppressed because it is too large
Load Diff
@ -27,9 +27,9 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
|
||||
--- a/drivers/net/phy/Kconfig
|
||||
+++ b/drivers/net/phy/Kconfig
|
||||
@@ -68,6 +68,11 @@ config SFP
|
||||
|
||||
comment "MII PHY device drivers"
|
||||
@@ -80,6 +80,11 @@ config AS21XXX_PHY
|
||||
AS21210PB1 that all register with the PHY ID 0x7500 0x7500
|
||||
before the firmware is loaded.
|
||||
|
||||
+config AIR_EN8811H_PHY
|
||||
+ tristate "Airoha EN8811H 2.5 Gigabit PHY"
|
||||
@ -48,7 +48,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
+obj-$(CONFIG_AIR_EN8811H_PHY) += air_en8811h.o
|
||||
obj-$(CONFIG_AMD_PHY) += amd.o
|
||||
obj-$(CONFIG_AQUANTIA_PHY) += aquantia/
|
||||
obj-$(CONFIG_AX88796B_PHY) += ax88796b.o
|
||||
obj-$(CONFIG_AS21XXX_PHY) += as21xxx.o
|
||||
--- /dev/null
|
||||
+++ b/drivers/net/phy/air_en8811h.c
|
||||
@@ -0,0 +1,1086 @@
|
||||
|
||||
@ -16,7 +16,7 @@ Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
|
||||
--- a/drivers/net/phy/Kconfig
|
||||
+++ b/drivers/net/phy/Kconfig
|
||||
@@ -74,9 +74,9 @@ config AIR_EN8811H_PHY
|
||||
@@ -86,9 +86,9 @@ config AIR_EN8811H_PHY
|
||||
Currently supports the Airoha EN8811H PHY.
|
||||
|
||||
config AMD_PHY
|
||||
|
||||
@ -28,7 +28,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
|
||||
--- a/drivers/net/phy/phy_device.c
|
||||
+++ b/drivers/net/phy/phy_device.c
|
||||
@@ -3202,6 +3202,7 @@ static int of_phy_led(struct phy_device
|
||||
@@ -3226,6 +3226,7 @@ static int of_phy_led(struct phy_device
|
||||
struct device *dev = &phydev->mdio.dev;
|
||||
struct led_init_data init_data = {};
|
||||
struct led_classdev *cdev;
|
||||
@ -36,7 +36,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
struct phy_led *phyled;
|
||||
u32 index;
|
||||
int err;
|
||||
@@ -3219,6 +3220,21 @@ static int of_phy_led(struct phy_device
|
||||
@@ -3243,6 +3244,21 @@ static int of_phy_led(struct phy_device
|
||||
if (index > U8_MAX)
|
||||
return -EINVAL;
|
||||
|
||||
@ -76,7 +76,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
/**
|
||||
* struct phy_driver - Driver structure for a particular PHY type
|
||||
*
|
||||
@@ -1146,6 +1155,19 @@ struct phy_driver {
|
||||
@@ -1144,6 +1153,19 @@ struct phy_driver {
|
||||
int (*led_hw_control_get)(struct phy_device *dev, u8 index,
|
||||
unsigned long *rules);
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
|
||||
--- a/drivers/net/phy/phy_device.c
|
||||
+++ b/drivers/net/phy/phy_device.c
|
||||
@@ -3220,11 +3220,17 @@ static int of_phy_led(struct phy_device
|
||||
@@ -3244,11 +3244,17 @@ static int of_phy_led(struct phy_device
|
||||
if (index > U8_MAX)
|
||||
return -EINVAL;
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
|
||||
--- a/drivers/net/phy/phy_device.c
|
||||
+++ b/drivers/net/phy/phy_device.c
|
||||
@@ -1247,6 +1247,8 @@ int phy_init_hw(struct phy_device *phyde
|
||||
@@ -1269,6 +1269,8 @@ int phy_init_hw(struct phy_device *phyde
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
||||
@ -92,7 +92,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
+
|
||||
comment "MII PHY device drivers"
|
||||
|
||||
config AIR_EN8811H_PHY
|
||||
config AS21XXX_PHY
|
||||
--- a/drivers/net/phy/Makefile
|
||||
+++ b/drivers/net/phy/Makefile
|
||||
@@ -27,6 +27,21 @@ libphy-$(CONFIG_OPEN_ALLIANCE_HELPERS) +
|
||||
|
||||
@ -92,7 +92,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
+
|
||||
comment "MII PHY device drivers"
|
||||
|
||||
config AIR_EN8811H_PHY
|
||||
config AS21XXX_PHY
|
||||
--- a/drivers/net/phy/Makefile
|
||||
+++ b/drivers/net/phy/Makefile
|
||||
@@ -26,6 +26,21 @@ libphy-$(CONFIG_LED_TRIGGER_PHY) += phy_
|
||||
|
||||
@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
|
||||
|
||||
--- a/drivers/net/phy/phy_device.c
|
||||
+++ b/drivers/net/phy/phy_device.c
|
||||
@@ -2015,6 +2015,9 @@ void phy_detach(struct phy_device *phyde
|
||||
@@ -2037,6 +2037,9 @@ void phy_detach(struct phy_device *phyde
|
||||
phydev->devlink = NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -49,4 +49,4 @@ Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
|
||||
+ }
|
||||
}
|
||||
|
||||
static int rtl8221b_match_phy_device(struct phy_device *phydev)
|
||||
static int rtl8221b_match_phy_device(struct phy_device *phydev,
|
||||
|
||||
@ -24,7 +24,7 @@ Signed-off-by: David Bauer <mail@david-bauer.net>
|
||||
|
||||
--- a/drivers/net/phy/Kconfig
|
||||
+++ b/drivers/net/phy/Kconfig
|
||||
@@ -139,7 +139,7 @@ config BROADCOM_PHY
|
||||
@@ -151,7 +151,7 @@ config BROADCOM_PHY
|
||||
tristate "Broadcom 54XX PHYs"
|
||||
select BCM_NET_PHYLIB
|
||||
select BCM_NET_PHYPTP if NETWORK_PHY_TIMESTAMPING
|
||||
|
||||
@ -11,9 +11,9 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
|
||||
|
||||
--- a/drivers/net/phy/phy_device.c
|
||||
+++ b/drivers/net/phy/phy_device.c
|
||||
@@ -1910,6 +1910,9 @@ void phy_detach(struct phy_device *phyde
|
||||
if (phydev->devlink)
|
||||
device_link_del(phydev->devlink);
|
||||
@@ -1934,6 +1934,9 @@ void phy_detach(struct phy_device *phyde
|
||||
phydev->devlink = NULL;
|
||||
}
|
||||
|
||||
+ if (phydev->drv && phydev->drv->detach)
|
||||
+ phydev->drv->detach(phydev);
|
||||
@ -23,7 +23,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
|
||||
sysfs_remove_link(&dev->dev.kobj, "phydev");
|
||||
--- a/include/linux/phy.h
|
||||
+++ b/include/linux/phy.h
|
||||
@@ -980,6 +980,12 @@ struct phy_driver {
|
||||
@@ -977,6 +977,12 @@ struct phy_driver {
|
||||
/** @handle_interrupt: Override default interrupt handling */
|
||||
irqreturn_t (*handle_interrupt)(struct phy_device *phydev);
|
||||
|
||||
|
||||
@ -49,4 +49,4 @@ Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
|
||||
+ }
|
||||
}
|
||||
|
||||
static int rtl8221b_match_phy_device(struct phy_device *phydev)
|
||||
static int rtl8221b_match_phy_device(struct phy_device *phydev,
|
||||
|
||||
@ -24,7 +24,7 @@ Signed-off-by: David Bauer <mail@david-bauer.net>
|
||||
|
||||
--- a/drivers/net/phy/Kconfig
|
||||
+++ b/drivers/net/phy/Kconfig
|
||||
@@ -113,7 +113,7 @@ config BROADCOM_PHY
|
||||
@@ -125,7 +125,7 @@ config BROADCOM_PHY
|
||||
tristate "Broadcom 54XX PHYs"
|
||||
select BCM_NET_PHYLIB
|
||||
select BCM_NET_PHYPTP if NETWORK_PHY_TIMESTAMPING
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
--- a/drivers/net/phy/Kconfig
|
||||
+++ b/drivers/net/phy/Kconfig
|
||||
@@ -431,6 +431,12 @@ config ROCKCHIP_PHY
|
||||
@@ -443,6 +443,12 @@ config ROCKCHIP_PHY
|
||||
help
|
||||
Currently supports the integrated Ethernet PHY.
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
select CRC16
|
||||
--- a/drivers/net/phy/Makefile
|
||||
+++ b/drivers/net/phy/Makefile
|
||||
@@ -113,6 +113,7 @@ obj-$(CONFIG_REALTEK_PHY) += realtek/
|
||||
@@ -114,6 +114,7 @@ obj-$(CONFIG_REALTEK_PHY) += realtek/
|
||||
obj-y += rtl8261n/
|
||||
obj-$(CONFIG_RENESAS_PHY) += uPD60620.o
|
||||
obj-$(CONFIG_ROCKCHIP_PHY) += rockchip.o
|
||||
|
||||
@ -14,9 +14,9 @@ Signed-off-by: Robert Marko <robert.marko@sartura.hr>
|
||||
|
||||
--- a/drivers/net/phy/Kconfig
|
||||
+++ b/drivers/net/phy/Kconfig
|
||||
@@ -153,6 +153,11 @@ endif # RTL8366_SMI
|
||||
|
||||
comment "MII PHY device drivers"
|
||||
@@ -165,6 +165,11 @@ config AS21XXX_PHY
|
||||
AS21210PB1 that all register with the PHY ID 0x7500 0x7500
|
||||
before the firmware is loaded.
|
||||
|
||||
+config AIROHA_EN8801SC_PHY
|
||||
+ tristate "Airoha EN8801SC Gigabit PHY"
|
||||
|
||||
@ -254,7 +254,7 @@ Christian Marangi (9):
|
||||
obj-$(CONFIG_MDIO_BCM_UNIMAC) += mdio-bcm-unimac.o
|
||||
--- a/drivers/net/phy/Kconfig
|
||||
+++ b/drivers/net/phy/Kconfig
|
||||
@@ -158,6 +158,11 @@ config AIROHA_EN8801SC_PHY
|
||||
@@ -170,6 +170,11 @@ config AIROHA_EN8801SC_PHY
|
||||
help
|
||||
Currently supports the Airoha EN8801SC PHY.
|
||||
|
||||
|
||||
@ -880,7 +880,7 @@ publishing the in-band capabilities from the BCM84881 PHY driver.
|
||||
* @get_rate_matching: Get the supported type of rate matching for a
|
||||
* particular phy interface. This is used by phy consumers to determine
|
||||
* whether to advertise lower-speed modes for that interface. It is
|
||||
@@ -1839,6 +1870,9 @@ int phy_config_aneg(struct phy_device *p
|
||||
@@ -1840,6 +1871,9 @@ int phy_config_aneg(struct phy_device *p
|
||||
int _phy_start_aneg(struct phy_device *phydev);
|
||||
int phy_start_aneg(struct phy_device *phydev);
|
||||
int phy_aneg_done(struct phy_device *phydev);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user