From patchwork Wed Dec 20 15:55:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 13500294 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5D2DB41874 for ; Wed, 20 Dec 2023 15:55:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AjkLIo8M" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 440EEC433CC; Wed, 20 Dec 2023 15:55:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703087726; bh=Wax2RwcsMcZOhlsSJS8rQWRkaHqiXQOrD81pQbxBYDg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AjkLIo8MK+mSaKnZ+TCp9jnT3Neu5hYuwH2l44AVuOO/AhyjOSSejaCaWDlY6voIV sOLunPuxk214ZMiaSVoEAu7m3iosRstSqjB9GpguPCm2aqFbGYs7gGcCM373BXpXfD xam82m8eIk0o1iHgsIy/zedW7V2gFHFmHQUeguMgx98BTcYa1h0WZnuKbGZM42DoaV 0DkoLszhQghocmINSyhDmLtdPsUYRu6Bu+YYdLwl7EzQiGLpFn6embKxLNRDP99vru n9wKumzOMP3lSGg+M1ZqY68yRPVc988r7Swl+FYWVLiDhJRLhrBj9YZXmvEix9P6h/ OBZRek6wMl9Kg== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Andrew Lunn , "David S. Miller" , Jakub Kicinski , Paolo Abeni Cc: Russell King , Alexander Couzens , Daniel Golle , Heiner Kallweit , Willy Liu , Ioana Ciornei , =?utf-8?q?Marek_Moj=C3=ADk?= , =?utf-8?q?Maximili=C3=A1?= =?utf-8?q?n_Maliar?= , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH net-next 01/15] net: phy: fail early with error code if indirect MMD access fails Date: Wed, 20 Dec 2023 16:55:04 +0100 Message-ID: <20231220155518.15692-2-kabel@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231220155518.15692-1-kabel@kernel.org> References: <20231220155518.15692-1-kabel@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Check return values of __mdiobus_write() in mmd_phy_indirect() and return value of mmd_phy_indirect() itself. Signed-off-by: Marek Behún Reviewed-by: Russell King (Oracle) --- drivers/net/phy/phy-core.c | 52 +++++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/drivers/net/phy/phy-core.c b/drivers/net/phy/phy-core.c index 15f349e5995a..9318b65cca95 100644 --- a/drivers/net/phy/phy-core.c +++ b/drivers/net/phy/phy-core.c @@ -526,18 +526,50 @@ int phy_speed_down_core(struct phy_device *phydev) return 0; } -static void mmd_phy_indirect(struct mii_bus *bus, int phy_addr, int devad, - u16 regnum) +static int mmd_phy_indirect(struct mii_bus *bus, int phy_addr, int devad, + u16 regnum) { + int ret; + /* Write the desired MMD Devad */ - __mdiobus_write(bus, phy_addr, MII_MMD_CTRL, devad); + ret = __mdiobus_write(bus, phy_addr, MII_MMD_CTRL, devad); + if (ret < 0) + return ret; /* Write the desired MMD register address */ - __mdiobus_write(bus, phy_addr, MII_MMD_DATA, regnum); + ret = __mdiobus_write(bus, phy_addr, MII_MMD_DATA, regnum); + if (ret < 0) + return ret; /* Select the Function : DATA with no post increment */ - __mdiobus_write(bus, phy_addr, MII_MMD_CTRL, - devad | MII_MMD_CTRL_NOINCR); + return __mdiobus_write(bus, phy_addr, MII_MMD_CTRL, + devad | MII_MMD_CTRL_NOINCR); +} + +static int mmd_phy_read_indirect(struct mii_bus *bus, int phy_addr, int devad, + u32 regnum) +{ + int ret; + + ret = mmd_phy_indirect(bus, phy_addr, devad, regnum); + if (ret < 0) + return ret; + + /* Read the content of the MMD's selected register */ + return __mdiobus_read(bus, phy_addr, MII_MMD_DATA); +} + +static int mmd_phy_write_indirect(struct mii_bus *bus, int phy_addr, int devad, + u32 regnum, u16 val) +{ + int ret; + + ret = mmd_phy_indirect(bus, phy_addr, devad, regnum); + if (ret < 0) + return ret; + + /* Write the data into MMD's selected register */ + return __mdiobus_write(bus, phy_addr, MII_MMD_DATA, val); } static int mmd_phy_read(struct mii_bus *bus, int phy_addr, bool is_c45, @@ -546,9 +578,7 @@ static int mmd_phy_read(struct mii_bus *bus, int phy_addr, bool is_c45, if (is_c45) return __mdiobus_c45_read(bus, phy_addr, devad, regnum); - mmd_phy_indirect(bus, phy_addr, devad, regnum); - /* Read the content of the MMD's selected register */ - return __mdiobus_read(bus, phy_addr, MII_MMD_DATA); + return mmd_phy_read_indirect(bus, phy_addr, devad, regnum); } static int mmd_phy_write(struct mii_bus *bus, int phy_addr, bool is_c45, @@ -557,9 +587,7 @@ static int mmd_phy_write(struct mii_bus *bus, int phy_addr, bool is_c45, if (is_c45) return __mdiobus_c45_write(bus, phy_addr, devad, regnum, val); - mmd_phy_indirect(bus, phy_addr, devad, regnum); - /* Write the data into MMD's selected register */ - return __mdiobus_write(bus, phy_addr, MII_MMD_DATA, val); + return mmd_phy_write_indirect(bus, phy_addr, devad, regnum, val); } /** From patchwork Wed Dec 20 15:55:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 13500295 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E0B241874 for ; Wed, 20 Dec 2023 15:55:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gFWsTBNe" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43C00C433C7; Wed, 20 Dec 2023 15:55:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703087729; bh=dhIVe/qoWjws/D9aB1vERhcD2b2+SCRz3fSeSGdruyU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gFWsTBNeX3rn6REq/xl6XVzGfQNzlnyFUrVzyqkfiJeT8YKUcJzPRA3UbKyTZQScC fCOHpVvuiljuAL4jQXpPZMoxVnyoDfuMQcoJAY5hdCGu8w1w2iyhVku1uj7jojcu5X wABlpjiFXDkJpErulWvv1v4tKio7Q1/jDjANfCXrY9BusQY+GgYMiJahUBCQMgZZfO 0Z/qqWnLtT2uq9yu9TuN6zh4+sfYhmKnhvDlm8xx4+JERcMc+O4i416HN8p2sRKCzY V2wOlqq2I9wWf51h1Ewu2EvDu0GmBTpSkmbD4jvoIRlZr0N6PwZoF67TtMeI08ILHy VF+2SLQ4OVOyg== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Andrew Lunn , "David S. Miller" , Jakub Kicinski , Paolo Abeni Cc: Russell King , Alexander Couzens , Daniel Golle , Heiner Kallweit , Willy Liu , Ioana Ciornei , =?utf-8?q?Marek_Moj=C3=ADk?= , =?utf-8?q?Maximili=C3=A1?= =?utf-8?q?n_Maliar?= , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH net-next 02/15] net: phy: export indirect MMD register accessors Date: Wed, 20 Dec 2023 16:55:05 +0100 Message-ID: <20231220155518.15692-3-kabel@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231220155518.15692-1-kabel@kernel.org> References: <20231220155518.15692-1-kabel@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Export mmd_phy_read_indirect() and mmd_phy_write_indirect(), the indirect MMD accessors, so that the functions can be used from the .read_mmd / .write_mmd phy_driver methods. Add a __ prefix to these functions. Signed-off-by: Marek Behún Reviewed-by: Russell King (Oracle) --- drivers/net/phy/phy-core.c | 14 ++++++++------ include/linux/phy.h | 10 ++++++++++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/net/phy/phy-core.c b/drivers/net/phy/phy-core.c index 9318b65cca95..150020cfa593 100644 --- a/drivers/net/phy/phy-core.c +++ b/drivers/net/phy/phy-core.c @@ -546,8 +546,8 @@ static int mmd_phy_indirect(struct mii_bus *bus, int phy_addr, int devad, devad | MII_MMD_CTRL_NOINCR); } -static int mmd_phy_read_indirect(struct mii_bus *bus, int phy_addr, int devad, - u32 regnum) +int __mmd_phy_read_indirect(struct mii_bus *bus, int phy_addr, int devad, + u32 regnum) { int ret; @@ -558,9 +558,10 @@ static int mmd_phy_read_indirect(struct mii_bus *bus, int phy_addr, int devad, /* Read the content of the MMD's selected register */ return __mdiobus_read(bus, phy_addr, MII_MMD_DATA); } +EXPORT_SYMBOL(__mmd_phy_read_indirect); -static int mmd_phy_write_indirect(struct mii_bus *bus, int phy_addr, int devad, - u32 regnum, u16 val) +int __mmd_phy_write_indirect(struct mii_bus *bus, int phy_addr, int devad, + u32 regnum, u16 val) { int ret; @@ -571,6 +572,7 @@ static int mmd_phy_write_indirect(struct mii_bus *bus, int phy_addr, int devad, /* Write the data into MMD's selected register */ return __mdiobus_write(bus, phy_addr, MII_MMD_DATA, val); } +EXPORT_SYMBOL(__mmd_phy_write_indirect); static int mmd_phy_read(struct mii_bus *bus, int phy_addr, bool is_c45, int devad, u32 regnum) @@ -578,7 +580,7 @@ static int mmd_phy_read(struct mii_bus *bus, int phy_addr, bool is_c45, if (is_c45) return __mdiobus_c45_read(bus, phy_addr, devad, regnum); - return mmd_phy_read_indirect(bus, phy_addr, devad, regnum); + return __mmd_phy_read_indirect(bus, phy_addr, devad, regnum); } static int mmd_phy_write(struct mii_bus *bus, int phy_addr, bool is_c45, @@ -587,7 +589,7 @@ static int mmd_phy_write(struct mii_bus *bus, int phy_addr, bool is_c45, if (is_c45) return __mdiobus_c45_write(bus, phy_addr, devad, regnum, val); - return mmd_phy_write_indirect(bus, phy_addr, devad, regnum, val); + return __mmd_phy_write_indirect(bus, phy_addr, devad, regnum, val); } /** diff --git a/include/linux/phy.h b/include/linux/phy.h index e9e85d347587..65b79b155f3a 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1358,6 +1358,16 @@ int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum); __ret; \ }) +/* + * __mmd_phy_read_indirect, __mmd_phy_write_indirect - Convenience functions for + * indirectly accessing MMD registers via clause 22 registers 13 and 14. Can be + * used in phy_driver's .read_mmd and .write_mmd methods. + */ +int __mmd_phy_read_indirect(struct mii_bus *bus, int phy_addr, int devad, + u32 regnum); +int __mmd_phy_write_indirect(struct mii_bus *bus, int phy_addr, int devad, + u32 regnum, u16 val); + /* * __phy_read_mmd - Convenience function for reading a register * from an MMD on a given PHY. From patchwork Wed Dec 20 15:55:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 13500296 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0EAC34642E for ; Wed, 20 Dec 2023 15:55:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HMvWrzSi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4447BC433CB; Wed, 20 Dec 2023 15:55:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703087732; bh=q48rfmgbzT811gDqkKiHhQXF9wQraPE6WLfoJlZuu/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HMvWrzSi8nL04Emh4bVOdrl8LEjnOB3KZxp79jWTKYrh/h1x4Ndjsf+aOFwqLpZZN R86AEVxcZPGXX/i08/JBuFd/HknTdSrtq8pHnsGN/j8w/cY4GS7L7qSR/mpeIOYJmh nwWblPK0Kmt8aVIDi+Odb3RG5j4WNcUvikIF7NPKun57Qc0i1fwdW5qAtpUR+wpvkv yE2C7NrvggzUJJWFx1ys3N8AXIQTP6D8cKL0AiZ7p4snFdew7eYy5Rr7jI15klMbJm 8HkkaLDlotmGDlo8QCTlYDuvm8s/OfMkdDY5alWJ3QLPaHc6/MoY8FmghCM0mQyF/V zVPUUK9j2yFaw== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Andrew Lunn , "David S. Miller" , Jakub Kicinski , Paolo Abeni Cc: Russell King , Alexander Couzens , Daniel Golle , Heiner Kallweit , Willy Liu , Ioana Ciornei , =?utf-8?q?Marek_Moj=C3=ADk?= , =?utf-8?q?Maximili=C3=A1?= =?utf-8?q?n_Maliar?= , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH net-next 03/15] net: phy: realtek: rework MMD register access methods Date: Wed, 20 Dec 2023 16:55:06 +0100 Message-ID: <20231220155518.15692-4-kabel@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231220155518.15692-1-kabel@kernel.org> References: <20231220155518.15692-1-kabel@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org The .read_mmd() and .write_mmd() methods for rtlgen and rtl822x currently allow access to only 6 MMD registers, via a vendor specific mechanism (a paged read / write). The PHY specification explains that MMD registers for MMDs 1 to 30 can be accessed via the clause 22 indirect mechanism through registers 13 and 14, but this is not possible for MMD 31. A Realtek contact explained that MMD 31 registers can be accessed by setting clause 22 page register (register 31): page = mmd_reg >> 4 reg = 0x10 | ((mmd_reg & 0xf) >> 1) This mechanism is currently used in the driver. For example the .read_mmd() method accesses the PCS.EEE_ABLE register by setting page to 0xa5c and accessing register 0x12. By the formulas above, this corresponds to MMD register 31.a5c4. The Realtek contact confirmed that the PCS.EEE_ABLE register (3.0014) is also available via MMD alias 31.a5c4, and this is also true for the other registers: register name address page.reg alias PCS.EEE_ABLE 3.0x0014 0xa5c.12 31.0xa5c4 PCS.EEE_ABLE2 3.0x0015 0xa6e.16 31.0xa6ec AN.EEE_ADV 7.0x003c 0xa5d.10 31.0xa5d0 AN.EEE_LPABLE 7.0x003d 0xa5d.11 31.0xa5d2 AN.EEE_ADV2 7.0x003e 0xa6d.12 31.0xa6d4 AN.EEE_LPABLE2 7.0x003f 0xa6d.10 31.0xa6d0 Since the registers are also available at the true MMD addresses where they can be accessed via the indirect mechanism (via registers 13 and 14) we can rework the code to be more generic and allow access to all MMD registers. Rework the .read_mmd() and .write_mmd() methods for rtlgen and rtl822x PHYs: - use direct clause 45 access if the MDIO bus supports it - use the indirect access via clause 22 registers 13 and 14 for MMDs 1 to 30 - use the vendor specific method to access MMD 31 registers Signed-off-by: Marek Behún Reviewed-by: Russell King (Oracle) --- drivers/net/phy/realtek.c | 111 ++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 66 deletions(-) diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index 894172a3e15f..6e84f460a888 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -585,84 +585,63 @@ static int rtlgen_read_status(struct phy_device *phydev) return rtlgen_get_speed(phydev); } -static int rtlgen_read_mmd(struct phy_device *phydev, int devnum, u16 regnum) +static int rtlgen_read_mmd(struct phy_device *phydev, int dev, u16 reg) { - int ret; + struct mii_bus *bus = phydev->mdio.bus; + int addr = phydev->mdio.addr; + int page, ret; - if (devnum == MDIO_MMD_PCS && regnum == MDIO_PCS_EEE_ABLE) { - rtl821x_write_page(phydev, 0xa5c); - ret = __phy_read(phydev, 0x12); - rtl821x_write_page(phydev, 0); - } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV) { - rtl821x_write_page(phydev, 0xa5d); - ret = __phy_read(phydev, 0x10); - rtl821x_write_page(phydev, 0); - } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_LPABLE) { - rtl821x_write_page(phydev, 0xa5d); - ret = __phy_read(phydev, 0x11); - rtl821x_write_page(phydev, 0); - } else { - ret = -EOPNOTSUPP; - } + /* use c45 access if MDIO bus supports them */ + if (bus->read_c45) + return __mdiobus_c45_read(bus, addr, dev, reg); - return ret; -} + /* use c22 indirect access for MMD != 31 */ + if (dev != MDIO_MMD_VEND2) + return __mmd_phy_read_indirect(bus, addr, dev, reg); -static int rtlgen_write_mmd(struct phy_device *phydev, int devnum, u16 regnum, - u16 val) -{ - int ret; + /* MDIO_MMD_VEND2 registers need to be accessed in a different way */ + page = reg >> 4; + reg = 0x10 | ((reg & 0xf) >> 1); - if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV) { - rtl821x_write_page(phydev, 0xa5d); - ret = __phy_write(phydev, 0x10, val); - rtl821x_write_page(phydev, 0); - } else { - ret = -EOPNOTSUPP; - } + ret = rtl821x_write_page(phydev, page); + if (ret < 0) + return ret; - return ret; + ret = __phy_read(phydev, reg); + if (ret < 0) + return ret; + + return rtl821x_write_page(phydev, 0) ?: ret; } -static int rtl822x_read_mmd(struct phy_device *phydev, int devnum, u16 regnum) +static int rtlgen_write_mmd(struct phy_device *phydev, int dev, u16 reg, + u16 val) { - int ret = rtlgen_read_mmd(phydev, devnum, regnum); - - if (ret != -EOPNOTSUPP) - return ret; + struct mii_bus *bus = phydev->mdio.bus; + int addr = phydev->mdio.addr; + int page, ret; - if (devnum == MDIO_MMD_PCS && regnum == MDIO_PCS_EEE_ABLE2) { - rtl821x_write_page(phydev, 0xa6e); - ret = __phy_read(phydev, 0x16); - rtl821x_write_page(phydev, 0); - } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV2) { - rtl821x_write_page(phydev, 0xa6d); - ret = __phy_read(phydev, 0x12); - rtl821x_write_page(phydev, 0); - } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_LPABLE2) { - rtl821x_write_page(phydev, 0xa6d); - ret = __phy_read(phydev, 0x10); - rtl821x_write_page(phydev, 0); - } + /* use c45 access if MDIO bus supports them */ + if (bus->write_c45) + return __mdiobus_c45_write(bus, addr, dev, reg, val); - return ret; -} + /* use c22 indirect access for MMD != 31 */ + if (dev != MDIO_MMD_VEND2) + return __mmd_phy_write_indirect(bus, addr, dev, reg, val); -static int rtl822x_write_mmd(struct phy_device *phydev, int devnum, u16 regnum, - u16 val) -{ - int ret = rtlgen_write_mmd(phydev, devnum, regnum, val); + /* MDIO_MMD_VEND2 registers need to be accessed in a different way */ + page = reg >> 4; + reg = 0x10 | ((reg & 0xf) >> 1); - if (ret != -EOPNOTSUPP) + ret = rtl821x_write_page(phydev, page); + if (ret < 0) return ret; - if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV2) { - rtl821x_write_page(phydev, 0xa6d); - ret = __phy_write(phydev, 0x12, val); - rtl821x_write_page(phydev, 0); - } + ret = __phy_write(phydev, reg, val); + if (ret < 0) + return ret; - return ret; + return rtl821x_write_page(phydev, 0) ?: ret; } static int rtl822x_get_features(struct phy_device *phydev) @@ -993,8 +972,8 @@ static struct phy_driver realtek_drvs[] = { .resume = rtlgen_resume, .read_page = rtl821x_read_page, .write_page = rtl821x_write_page, - .read_mmd = rtl822x_read_mmd, - .write_mmd = rtl822x_write_mmd, + .read_mmd = rtlgen_read_mmd, + .write_mmd = rtlgen_write_mmd, }, { PHY_ID_MATCH_EXACT(0x001cc840), .name = "RTL8226B_RTL8221B 2.5Gbps PHY", @@ -1005,8 +984,8 @@ static struct phy_driver realtek_drvs[] = { .resume = rtlgen_resume, .read_page = rtl821x_read_page, .write_page = rtl821x_write_page, - .read_mmd = rtl822x_read_mmd, - .write_mmd = rtl822x_write_mmd, + .read_mmd = rtlgen_read_mmd, + .write_mmd = rtlgen_write_mmd, }, { PHY_ID_MATCH_EXACT(0x001cc838), .name = "RTL8226-CG 2.5Gbps PHY", From patchwork Wed Dec 20 15:55:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 13500297 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 12CF940BF0 for ; Wed, 20 Dec 2023 15:55:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fQaY7A0a" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48732C433CA; Wed, 20 Dec 2023 15:55:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703087735; bh=LDVFFU8cwSaSzDydsQFZt0H8tN+EUon5x7E9dsIwfb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fQaY7A0aw8E9u8/ZPTc8gWQMryCi/7t/29VuTbTW/7QHcU8VSdgVPIN6btmbU3/ho YGoOmSGFD+9nvJPhjLYovXRnQd8q05qCIZugFHpdQdxJ9YF4iBsOs+Zeh8ibVOHJoO CElTwqozKmXjGbIX5F1QGpwufGdbCzWRBChdlhXVDu2b3PM6HQBuwvKxxrITUfk1b0 IsWBElcH4HjibyNbTezBTW+14ogK/4bp5VbQfPMJzw9zJhV2UtR5QyqHCxUhcnzxb0 KiL0OGPsA8e9JuRnRPrawm7EH8WrGw8UwWsmnjO0/B2PbPPSbyKvodHB/O57Yco6Aj Y4Ct6knBOBrTQ== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Andrew Lunn , "David S. Miller" , Jakub Kicinski , Paolo Abeni Cc: Russell King , Alexander Couzens , Daniel Golle , Heiner Kallweit , Willy Liu , Ioana Ciornei , =?utf-8?q?Marek_Moj=C3=ADk?= , =?utf-8?q?Maximili=C3=A1?= =?utf-8?q?n_Maliar?= , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH net-next 04/15] net: phy: realtek: fill .read_mmd and .write_mmd methods for all rtl822x PHYs Date: Wed, 20 Dec 2023 16:55:07 +0100 Message-ID: <20231220155518.15692-5-kabel@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231220155518.15692-1-kabel@kernel.org> References: <20231220155518.15692-1-kabel@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Fill in the .read_mmd() and .write_mmd() methods for all rtl822x PHYs, so that we can start reimplementing rtl822x driver methods into using genphy_c45_* functions. Signed-off-by: Marek Behún Reviewed-by: Russell King (Oracle) --- drivers/net/phy/realtek.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index 6e84f460a888..8f11320b38a8 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -996,6 +996,8 @@ static struct phy_driver realtek_drvs[] = { .resume = rtlgen_resume, .read_page = rtl821x_read_page, .write_page = rtl821x_write_page, + .read_mmd = rtlgen_read_mmd, + .write_mmd = rtlgen_write_mmd, }, { PHY_ID_MATCH_EXACT(0x001cc848), .name = "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY", @@ -1006,6 +1008,8 @@ static struct phy_driver realtek_drvs[] = { .resume = rtlgen_resume, .read_page = rtl821x_read_page, .write_page = rtl821x_write_page, + .read_mmd = rtlgen_read_mmd, + .write_mmd = rtlgen_write_mmd, }, { PHY_ID_MATCH_EXACT(0x001cc849), .name = "RTL8221B-VB-CG 2.5Gbps PHY", @@ -1016,6 +1020,8 @@ static struct phy_driver realtek_drvs[] = { .resume = rtlgen_resume, .read_page = rtl821x_read_page, .write_page = rtl821x_write_page, + .read_mmd = rtlgen_read_mmd, + .write_mmd = rtlgen_write_mmd, }, { PHY_ID_MATCH_EXACT(0x001cc84a), .name = "RTL8221B-VM-CG 2.5Gbps PHY", @@ -1026,6 +1032,8 @@ static struct phy_driver realtek_drvs[] = { .resume = rtlgen_resume, .read_page = rtl821x_read_page, .write_page = rtl821x_write_page, + .read_mmd = rtlgen_read_mmd, + .write_mmd = rtlgen_write_mmd, }, { PHY_ID_MATCH_EXACT(0x001cc961), .name = "RTL8366RB Gigabit Ethernet", From patchwork Wed Dec 20 15:55:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 13500298 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6BCE740C09 for ; Wed, 20 Dec 2023 15:55:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lTDqzfxT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C4CCC433CB; Wed, 20 Dec 2023 15:55:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703087738; bh=E1x84bnuY9MBujh4fYbcWHnm3rDiud10CG9d0k2oNXs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lTDqzfxT01sHBbU/wvwWYBDkqmbnYTnARJv800R2f0mcCkWial14luLAnz4tpeiDH +Cf6AyqKf1G4Go8RvIm6IY/BnqiBBn6l3m2rQCiDVEaE+B2LfQOfBvFG+QiAlkx2Hd +pcEXyKUlAZPnCS/ylWgZOWJDD7GnL/wXeHyHkgRr3fbuBq8BCbw8ZP8ebSKzGMd7I SlOUjJuwlJhPyk08Cc+tCxVl/64/yF/tr2/nR3pmsh4S/Ld6ASH3RfuVCoGZHoxopl MDfKhM3RliSQanQ8IoEkxD3oo5PCGm5PgAMg8QKYcXvBqb2NNI8GxWauz9duQWnKc6 P75t2KCLyt0Sg== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Andrew Lunn , "David S. Miller" , Jakub Kicinski , Paolo Abeni Cc: Russell King , Alexander Couzens , Daniel Golle , Heiner Kallweit , Willy Liu , Ioana Ciornei , =?utf-8?q?Marek_Moj=C3=ADk?= , =?utf-8?q?Maximili=C3=A1?= =?utf-8?q?n_Maliar?= , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH net-next 05/15] net: mdio: add 2.5g and 5g related PMA speed constants Date: Wed, 20 Dec 2023 16:55:08 +0100 Message-ID: <20231220155518.15692-6-kabel@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231220155518.15692-1-kabel@kernel.org> References: <20231220155518.15692-1-kabel@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Add constants indicating 2.5g and 5g ability in the MMD PMA speed register. Signed-off-by: Marek Behún Reviewed-by: Russell King (Oracle) --- include/uapi/linux/mdio.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/uapi/linux/mdio.h b/include/uapi/linux/mdio.h index d03863da180e..3c9097502403 100644 --- a/include/uapi/linux/mdio.h +++ b/include/uapi/linux/mdio.h @@ -138,6 +138,8 @@ #define MDIO_PMA_SPEED_1000 0x0010 /* 1000M capable */ #define MDIO_PMA_SPEED_100 0x0020 /* 100M capable */ #define MDIO_PMA_SPEED_10 0x0040 /* 10M capable */ +#define MDIO_PMA_SPEED_2_5G 0x2000 /* 2.5G capable */ +#define MDIO_PMA_SPEED_5G 0x4000 /* 5G capable */ #define MDIO_PCS_SPEED_10P2B 0x0002 /* 10PASS-TS/2BASE-TL capable */ #define MDIO_PCS_SPEED_2_5G 0x0040 /* 2.5G capable */ #define MDIO_PCS_SPEED_5G 0x0080 /* 5G capable */ From patchwork Wed Dec 20 15:55:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 13500299 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7453F4123F for ; Wed, 20 Dec 2023 15:55:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MsRjgXTQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56FF4C433C8; Wed, 20 Dec 2023 15:55:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703087741; bh=YA4C2rvaNt3CD9I5+LSUNt6HD1Jzvog4UWBVauzIASg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MsRjgXTQvaNJV6Pn0wQ5v9GZ1sNoC8LhzuLUgT+2S5XIH9gONJCyTjC6C7HB+Q+2g gscP2EowsbU4sT16N2woumUILp6y7Wbj4yHC4Ug2yErMLgYzx9mvAK4gw8rZllEpgx h+x6zbDYbyVkmdUeqK0AoSp25MJdfCsW+ly/6yu0bOwzG+JBOd17IHWu5XRJbpr2wF BwMNxCjhCY7vTD2qmzwJ3YLp2aDh6RiBllEz3k99HJELq/R4UipC++HDQd1NRXRvCQ wzRL7KMb1O1Ncsrn0Eqj3m8PCZfBokKCPxVs0YOtadjR4nE/eiVvmtnBPryal1nMpC uXwc4h7HJE+zw== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Andrew Lunn , "David S. Miller" , Jakub Kicinski , Paolo Abeni Cc: Russell King , Alexander Couzens , Daniel Golle , Heiner Kallweit , Willy Liu , Ioana Ciornei , =?utf-8?q?Marek_Moj=C3=ADk?= , =?utf-8?q?Maximili=C3=A1?= =?utf-8?q?n_Maliar?= , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH net-next 06/15] net: phy: realtek: use generic MDIO constants Date: Wed, 20 Dec 2023 16:55:09 +0100 Message-ID: <20231220155518.15692-7-kabel@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231220155518.15692-1-kabel@kernel.org> References: <20231220155518.15692-1-kabel@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Drop the ad-hoc MDIO constants used in the driver and use generic constants instead. Signed-off-by: Marek Behún Reviewed-by: Russell King (Oracle) --- drivers/net/phy/realtek.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index 8f11320b38a8..52a7022d6a64 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -57,14 +57,6 @@ #define RTL8366RB_POWER_SAVE 0x15 #define RTL8366RB_POWER_SAVE_ON BIT(12) -#define RTL_SUPPORTS_5000FULL BIT(14) -#define RTL_SUPPORTS_2500FULL BIT(13) -#define RTL_SUPPORTS_10000FULL BIT(0) -#define RTL_ADV_2500FULL BIT(7) -#define RTL_LPADV_10000FULL BIT(11) -#define RTL_LPADV_5000FULL BIT(6) -#define RTL_LPADV_2500FULL BIT(5) - #define RTL9000A_GINMR 0x14 #define RTL9000A_GINMR_LINK_STATUS BIT(4) @@ -653,11 +645,11 @@ static int rtl822x_get_features(struct phy_device *phydev) return val; linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, - phydev->supported, val & RTL_SUPPORTS_2500FULL); + phydev->supported, val & MDIO_PMA_SPEED_2_5G); linkmode_mod_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT, - phydev->supported, val & RTL_SUPPORTS_5000FULL); + phydev->supported, val & MDIO_PMA_SPEED_5G); linkmode_mod_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT, - phydev->supported, val & RTL_SUPPORTS_10000FULL); + phydev->supported, val & MDIO_SPEED_10G); return genphy_read_abilities(phydev); } @@ -671,10 +663,11 @@ static int rtl822x_config_aneg(struct phy_device *phydev) if (linkmode_test_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, phydev->advertising)) - adv2500 = RTL_ADV_2500FULL; + adv2500 = MDIO_AN_10GBT_CTRL_ADV2_5G; ret = phy_modify_paged_changed(phydev, 0xa5d, 0x12, - RTL_ADV_2500FULL, adv2500); + MDIO_AN_10GBT_CTRL_ADV2_5G, + adv2500); if (ret < 0) return ret; } @@ -693,11 +686,14 @@ static int rtl822x_read_status(struct phy_device *phydev) return lpadv; linkmode_mod_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT, - phydev->lp_advertising, lpadv & RTL_LPADV_10000FULL); + phydev->lp_advertising, + lpadv & MDIO_AN_10GBT_STAT_LP10G); linkmode_mod_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT, - phydev->lp_advertising, lpadv & RTL_LPADV_5000FULL); + phydev->lp_advertising, + lpadv & MDIO_AN_10GBT_STAT_LP5G); linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, - phydev->lp_advertising, lpadv & RTL_LPADV_2500FULL); + phydev->lp_advertising, + lpadv & MDIO_AN_10GBT_STAT_LP2_5G); } ret = genphy_read_status(phydev); @@ -715,7 +711,7 @@ static bool rtlgen_supports_2_5gbps(struct phy_device *phydev) val = phy_read(phydev, 0x13); phy_write(phydev, RTL821x_PAGE_SELECT, 0); - return val >= 0 && val & RTL_SUPPORTS_2500FULL; + return val >= 0 && val & MDIO_PMA_SPEED_2_5G; } static int rtlgen_match_phy_device(struct phy_device *phydev) From patchwork Wed Dec 20 15:55:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 13500300 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 70E0B41758 for ; Wed, 20 Dec 2023 15:55:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cjsAg00g" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BA59C433C9; Wed, 20 Dec 2023 15:55:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703087745; bh=4wi0Pzg5Dp9u/oU82+P5NtJx5wTvAIqnpsYLXhis7M4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cjsAg00g+cjGNh5I3zGGL61PvyWv2wu30ZftFW8y7vCJ3ghbJZB7D/c7Pwz4d0d6I VXHpgTG9BrtJRgnImGPMKRN33gAG6J9HyQs30uIc3oFlqQAzC0fO5NV5BjzkR7P4dJ KESVjJxDgFmZWvfwpTwemafAO3WU46pALWXJDA6lw55kR1C3IRwYoC6M29baF4ymvH Fk3/iEA8JJHd7FjegnMhJY5GrYyCcy3pAcwamlPX77Kb9ni5rt0ud3kUXfGo10T7Gd gEdDz5YN2Y8EFWiByhs+XH3fJlKkx2tz2TxHjXbl5q9Dm8CiSHvrj6t8Dh2jKuKlaI ZnMq1TBUYDECQ== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Andrew Lunn , "David S. Miller" , Jakub Kicinski , Paolo Abeni Cc: Russell King , Alexander Couzens , Daniel Golle , Heiner Kallweit , Willy Liu , Ioana Ciornei , =?utf-8?q?Marek_Moj=C3=ADk?= , =?utf-8?q?Maximili=C3=A1?= =?utf-8?q?n_Maliar?= , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH net-next 07/15] net: phy: realtek: set is_c45 and fill in c45 IDs in PHY probe for rtl822x PHYs Date: Wed, 20 Dec 2023 16:55:10 +0100 Message-ID: <20231220155518.15692-8-kabel@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231220155518.15692-1-kabel@kernel.org> References: <20231220155518.15692-1-kabel@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org If the rtl822x was probed via clause 22 addressing, we need to set phydev->is_c45 and fill in phydev->c45_ids so that genphy_c45_* functions will work properly. Signed-off-by: Marek Behún --- drivers/net/phy/realtek.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index 52a7022d6a64..c621ce9378c5 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -636,6 +636,18 @@ static int rtlgen_write_mmd(struct phy_device *phydev, int dev, u16 reg, return rtl821x_write_page(phydev, 0) ?: ret; } +static int rtl822x_probe(struct phy_device *phydev) +{ + /* if the PHY was probed via c22, set is_c45 and fill in c45 IDs */ + if (!phydev->is_c45) { + phydev->is_c45 = true; + + return phy_get_c45_ids(phydev); + } + + return 0; +} + static int rtl822x_get_features(struct phy_device *phydev) { int val; @@ -961,6 +973,7 @@ static struct phy_driver realtek_drvs[] = { }, { .name = "RTL8226 2.5Gbps PHY", .match_phy_device = rtl8226_match_phy_device, + .probe = rtl822x_probe, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, @@ -973,6 +986,7 @@ static struct phy_driver realtek_drvs[] = { }, { PHY_ID_MATCH_EXACT(0x001cc840), .name = "RTL8226B_RTL8221B 2.5Gbps PHY", + .probe = rtl822x_probe, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, @@ -985,6 +999,7 @@ static struct phy_driver realtek_drvs[] = { }, { PHY_ID_MATCH_EXACT(0x001cc838), .name = "RTL8226-CG 2.5Gbps PHY", + .probe = rtl822x_probe, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, @@ -997,6 +1012,7 @@ static struct phy_driver realtek_drvs[] = { }, { PHY_ID_MATCH_EXACT(0x001cc848), .name = "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY", + .probe = rtl822x_probe, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, @@ -1009,6 +1025,7 @@ static struct phy_driver realtek_drvs[] = { }, { PHY_ID_MATCH_EXACT(0x001cc849), .name = "RTL8221B-VB-CG 2.5Gbps PHY", + .probe = rtl822x_probe, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, @@ -1021,6 +1038,7 @@ static struct phy_driver realtek_drvs[] = { }, { PHY_ID_MATCH_EXACT(0x001cc84a), .name = "RTL8221B-VM-CG 2.5Gbps PHY", + .probe = rtl822x_probe, .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, From patchwork Wed Dec 20 15:55:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 13500301 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B81241758 for ; Wed, 20 Dec 2023 15:55:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DLu3Cejp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EEB8C433C8; Wed, 20 Dec 2023 15:55:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703087748; bh=574Q5WY6nEhF+i8W6zW70DuyAHWLKf6J5HFpzxgr+tE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DLu3CejpfWauN4R34zDUUJ9jl6pGZFNVaES7s25vhhNZXYuP5WruoMDaSAWC6igBD snKc87/2u+rCS11UHQ+qsb5X4nwKmqpzzHohfwb/x8xu5BXuJMS0C1HkUdTGAz9dxC bopThn8rACuSq4y3eaLnNOKCI1BYrBrQVFKzvq67SOaBYXjCuyjcJgwW82Fp1mDOSk qDs07jJbRTzsGYuGqItSORxkTktqGwwUyOB3Gm6KKoUACHUZi5ANDQBkTQbGs9tdWm +4s7geyvV8sPw74NPJqlUMM/nNoH4uictLfRQd95KU3dkSCBL/hsVnQ6CBOjDFz36B Xfi/khtJrMjVg== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Andrew Lunn , "David S. Miller" , Jakub Kicinski , Paolo Abeni Cc: Russell King , Alexander Couzens , Daniel Golle , Heiner Kallweit , Willy Liu , Ioana Ciornei , =?utf-8?q?Marek_Moj=C3=ADk?= , =?utf-8?q?Maximili=C3=A1?= =?utf-8?q?n_Maliar?= , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH net-next 08/15] net: phy: realtek: use generic clause 45 feature reading for rtl822x PHYs Date: Wed, 20 Dec 2023 16:55:11 +0100 Message-ID: <20231220155518.15692-9-kabel@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231220155518.15692-1-kabel@kernel.org> References: <20231220155518.15692-1-kabel@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Now that rtl822x PHYs .read_mmd() and .write_mmd() methods support accessing all MMD registers, drop the .get_features() method so that phy_probe() will use the generic genphy_c45_pma_read_abilities(), which works properly on these trasceivers. Signed-off-by: Marek Behún --- drivers/net/phy/realtek.c | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index c621ce9378c5..66515981d2aa 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -648,24 +648,6 @@ static int rtl822x_probe(struct phy_device *phydev) return 0; } -static int rtl822x_get_features(struct phy_device *phydev) -{ - int val; - - val = phy_read_paged(phydev, 0xa61, 0x13); - if (val < 0) - return val; - - linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, - phydev->supported, val & MDIO_PMA_SPEED_2_5G); - linkmode_mod_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT, - phydev->supported, val & MDIO_PMA_SPEED_5G); - linkmode_mod_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT, - phydev->supported, val & MDIO_SPEED_10G); - - return genphy_read_abilities(phydev); -} - static int rtl822x_config_aneg(struct phy_device *phydev) { int ret = 0; @@ -974,7 +956,6 @@ static struct phy_driver realtek_drvs[] = { .name = "RTL8226 2.5Gbps PHY", .match_phy_device = rtl8226_match_phy_device, .probe = rtl822x_probe, - .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, .suspend = genphy_suspend, @@ -987,7 +968,6 @@ static struct phy_driver realtek_drvs[] = { PHY_ID_MATCH_EXACT(0x001cc840), .name = "RTL8226B_RTL8221B 2.5Gbps PHY", .probe = rtl822x_probe, - .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, .suspend = genphy_suspend, @@ -1000,7 +980,6 @@ static struct phy_driver realtek_drvs[] = { PHY_ID_MATCH_EXACT(0x001cc838), .name = "RTL8226-CG 2.5Gbps PHY", .probe = rtl822x_probe, - .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, .suspend = genphy_suspend, @@ -1013,7 +992,6 @@ static struct phy_driver realtek_drvs[] = { PHY_ID_MATCH_EXACT(0x001cc848), .name = "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY", .probe = rtl822x_probe, - .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, .suspend = genphy_suspend, @@ -1026,7 +1004,6 @@ static struct phy_driver realtek_drvs[] = { PHY_ID_MATCH_EXACT(0x001cc849), .name = "RTL8221B-VB-CG 2.5Gbps PHY", .probe = rtl822x_probe, - .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, .suspend = genphy_suspend, @@ -1039,7 +1016,6 @@ static struct phy_driver realtek_drvs[] = { PHY_ID_MATCH_EXACT(0x001cc84a), .name = "RTL8221B-VM-CG 2.5Gbps PHY", .probe = rtl822x_probe, - .get_features = rtl822x_get_features, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, .suspend = genphy_suspend, From patchwork Wed Dec 20 15:55:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 13500302 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B0B941844 for ; Wed, 20 Dec 2023 15:55:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="t2d6/7cA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DCB5C433CB; Wed, 20 Dec 2023 15:55:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703087751; bh=G8NYMSoxXsM+su2HLc3KV+Gn32NJ1REsm+1Kuxjlo2k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t2d6/7cAGPv3oNix8z2ulLzJ/rCFTZZs0sSIGEIZV/xfH3m10+6TBYDlAik+3X8rM r9cxUvpLvK9y5Ee35pF83b5b20acSj9zabqxlpI21JP8u1XQPij1xWFGp1XrV58mtK ZMaWRbt8olbA+Bc9g7wT3nqouwFVSJJn6M/lxaMT4wNz/FcUGmEE6+kOWEFYnwqypd T21dU59x+Z8cH20nI0X6Md3bqXWwVg3cQM5lzIub221ZR5WtvZtNQraOepXUA+NmOd Pbex1f07S+I+f9TSbqty5L0uGjcPk19hs76EE2tDES9zOHUWHXh7fwAmxxZ9Y+5d+D 20zrhv/IOka/A== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Andrew Lunn , "David S. Miller" , Jakub Kicinski , Paolo Abeni Cc: Russell King , Alexander Couzens , Daniel Golle , Heiner Kallweit , Willy Liu , Ioana Ciornei , =?utf-8?q?Marek_Moj=C3=ADk?= , =?utf-8?q?Maximili=C3=A1?= =?utf-8?q?n_Maliar?= , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH net-next 09/15] net: phy: realtek: read standard MMD register for rtlgen speed capability Date: Wed, 20 Dec 2023 16:55:12 +0100 Message-ID: <20231220155518.15692-10-kabel@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231220155518.15692-1-kabel@kernel.org> References: <20231220155518.15692-1-kabel@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Read the standard "PMA/PMD speed ability" register instead of it's vendor specific alias via paging in rtlgen_supports_2_5gbps(), which is used by the .match_phy_device method. Signed-off-by: Marek Behún --- drivers/net/phy/realtek.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index 66515981d2aa..0bb56d89157a 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -699,11 +699,7 @@ static int rtl822x_read_status(struct phy_device *phydev) static bool rtlgen_supports_2_5gbps(struct phy_device *phydev) { - int val; - - phy_write(phydev, RTL821x_PAGE_SELECT, 0xa61); - val = phy_read(phydev, 0x13); - phy_write(phydev, RTL821x_PAGE_SELECT, 0); + int val = rtlgen_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_SPEED); return val >= 0 && val & MDIO_PMA_SPEED_2_5G; } From patchwork Wed Dec 20 15:55:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 13500303 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22A484777F for ; Wed, 20 Dec 2023 15:55:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pEK+O7c3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E6D0C433C8; Wed, 20 Dec 2023 15:55:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703087754; bh=uN2oOY2uytuDyvfPFC7ZMgbdRr3OXmf+hM/f9Zp1z70=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pEK+O7c3IqEPGs+EapbwHmbTtm5s98EvlHC3AThMOQL4ISbIF454Igypnnql98IhD Y5Frg7YrR4l69aOipg0AB/wgz5K0C5kR9SJ0pJFI26vZ32WGBaoobMpcw+6D18SPQC L27f+F0rho1VCm9Tez/xZE/WnGwovQNnBDo6ma4TMB7KXoqafNYbo5apZeGxqFKlKz ukwxtuny+PHh/vbj2y4/UJDY7dOOFRyAT2L3PyaXSp+Ju3+aIsSyyIWEbBea0dt1Rn LHrTBi2F6Iw34iib1FYpSDE00+NpzyYW3w1XIaSD2tiiQVB8Gj6whMGVd59yp3cHKl /9nwp5t5i97Cw== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Andrew Lunn , "David S. Miller" , Jakub Kicinski , Paolo Abeni Cc: Russell King , Alexander Couzens , Daniel Golle , Heiner Kallweit , Willy Liu , Ioana Ciornei , =?utf-8?q?Marek_Moj=C3=ADk?= , =?utf-8?q?Maximili=C3=A1?= =?utf-8?q?n_Maliar?= , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH net-next 10/15] net: phy: realtek: use generic c45 AN config with 1000baseT vendor extension for rtl822x Date: Wed, 20 Dec 2023 16:55:13 +0100 Message-ID: <20231220155518.15692-11-kabel@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231220155518.15692-1-kabel@kernel.org> References: <20231220155518.15692-1-kabel@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Now that rtl822x PHYs .read_mmd() and .write_mmd() methods support accessing all MMD registers, use the generic clause 45 functions genphy_c45_an_config_aneg() and genphy_c45_pma_setup_forced() instead of the clause 22 for configuring autonegotiation for the rtl822x series. Because 802.3-2018 does not define MMD registers for configuring 1000baseT autonegotiation, use vendor specific MMD register for this, similar to how the marvell10g driver does it. Signed-off-by: Marek Behún --- drivers/net/phy/realtek.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index 0bb56d89157a..592de975248f 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -54,6 +54,8 @@ RTL8201F_ISR_LINK) #define RTL8201F_IER 0x13 +#define RTL8221_GBCR 0xa412 + #define RTL8366RB_POWER_SAVE 0x15 #define RTL8366RB_POWER_SAVE_ON BIT(12) @@ -650,23 +652,28 @@ static int rtl822x_probe(struct phy_device *phydev) static int rtl822x_config_aneg(struct phy_device *phydev) { - int ret = 0; + bool changed = false; + u16 val; + int ret; - if (phydev->autoneg == AUTONEG_ENABLE) { - u16 adv2500 = 0; + if (phydev->autoneg == AUTONEG_DISABLE) + return genphy_c45_pma_setup_forced(phydev); - if (linkmode_test_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, - phydev->advertising)) - adv2500 = MDIO_AN_10GBT_CTRL_ADV2_5G; + ret = genphy_c45_an_config_aneg(phydev); + if (ret < 0) + return ret; + if (ret > 0) + changed = true; - ret = phy_modify_paged_changed(phydev, 0xa5d, 0x12, - MDIO_AN_10GBT_CTRL_ADV2_5G, - adv2500); - if (ret < 0) - return ret; - } + val = linkmode_adv_to_mii_ctrl1000_t(phydev->advertising); + ret = phy_modify_mmd_changed(phydev, MDIO_MMD_VEND2, RTL8221_GBCR, + ADVERTISE_1000FULL, val); + if (ret < 0) + return ret; + if (ret > 0) + changed = true; - return __genphy_config_aneg(phydev, ret); + return genphy_c45_check_and_restart_aneg(phydev, changed); } static int rtl822x_read_status(struct phy_device *phydev) From patchwork Wed Dec 20 15:55:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 13500304 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22B0747A50 for ; Wed, 20 Dec 2023 15:55:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="E55suoDV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FECFC433C7; Wed, 20 Dec 2023 15:55:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703087757; bh=gTgkGMnEnms6TAHoMp/Q4RgVgXjpL1xtuZpFMscE8SQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E55suoDVp3qUeQ8H2/EsiA62GEfo/q4UANCFBnA/Xh5+5twr6TKpYjSM0NbJY+aKZ 3dO9d3Q976ZWJA9Eqb0vvjVYJeYNvvodWcj9KE2FhXvP2UOPUDKcb4SitB/ULDlZc8 c9diGfg7/oW58MEY/mSEobg9PrlB7mzAeQCJnnpMs3hwvT5B3cvqSNJP3b1F6RQ+FG ymEcjvV6gAkpjVA7bnsZAmTwNYV3J/4eY3mRPbngvligF+BOUiQCM/hZarHz8HvoJo 59qRDo09qyTEHpsU+3/fXh2whE589S1UIAU+CB4ZHcnoFfHMqv2DEB1HBSY485Pkpr AXelwFB5Ianvw== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Andrew Lunn , "David S. Miller" , Jakub Kicinski , Paolo Abeni Cc: Russell King , Alexander Couzens , Daniel Golle , Heiner Kallweit , Willy Liu , Ioana Ciornei , =?utf-8?q?Marek_Moj=C3=ADk?= , =?utf-8?q?Maximili=C3=A1?= =?utf-8?q?n_Maliar?= , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH net-next 11/15] net: phy: realtek: use generic c45 status reading with 1000baseT vendor extension for rtl822x Date: Wed, 20 Dec 2023 16:55:14 +0100 Message-ID: <20231220155518.15692-12-kabel@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231220155518.15692-1-kabel@kernel.org> References: <20231220155518.15692-1-kabel@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Now that rtl822x PHYs .read_mmd() and .write_mmd() methods support accessing all MMD registers, use the generic clause 45 function genphy_c45_read_status() instead of the current clause 22 version for reading status for the rtl822x series of Realtek transceivers. Because 802.3-2018 does not define MMD registers for reading 1000baseT autonegotiation status, use vendor specific MMD register for this. Signed-off-by: Marek Behún --- drivers/net/phy/realtek.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index 592de975248f..f36b2bfabe57 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -55,6 +55,7 @@ #define RTL8201F_IER 0x13 #define RTL8221_GBCR 0xa412 +#define RTL8221_GANLPAR 0xa414 #define RTL8366RB_POWER_SAVE 0x15 #define RTL8366RB_POWER_SAVE_ON BIT(12) @@ -678,30 +679,17 @@ static int rtl822x_config_aneg(struct phy_device *phydev) static int rtl822x_read_status(struct phy_device *phydev) { - int ret; + int val; if (phydev->autoneg == AUTONEG_ENABLE) { - int lpadv = phy_read_paged(phydev, 0xa5d, 0x13); - - if (lpadv < 0) - return lpadv; - - linkmode_mod_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT, - phydev->lp_advertising, - lpadv & MDIO_AN_10GBT_STAT_LP10G); - linkmode_mod_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT, - phydev->lp_advertising, - lpadv & MDIO_AN_10GBT_STAT_LP5G); - linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, - phydev->lp_advertising, - lpadv & MDIO_AN_10GBT_STAT_LP2_5G); - } + val = phy_read_mmd(phydev, MDIO_MMD_VEND2, RTL8221_GANLPAR); + if (val < 0) + return val; - ret = genphy_read_status(phydev); - if (ret < 0) - return ret; + mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, val); + } - return rtlgen_get_speed(phydev); + return genphy_c45_read_status(phydev); } static bool rtlgen_supports_2_5gbps(struct phy_device *phydev) From patchwork Wed Dec 20 15:55:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 13500305 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7FBD741875 for ; Wed, 20 Dec 2023 15:56:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ES0S4cDx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FEACC433C9; Wed, 20 Dec 2023 15:55:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703087760; bh=PzqSoS7JcvqSMbjEYVeKdFso7tqADg3bJ1pfbVXyVDU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ES0S4cDxOVXd+2Fl6uKtO1BKt0J/axd0o6ZbB4HPQevWUvAdmzb+ARCEXY5DvXVtL n5jd/cJsB5vU6CwUslQUOnJEeVv7xy+7DH5XmsP31/7WRj1Rie5vjCjIXiJsrGPXjx qbwoNsUzmc57NOGHQCYTOT6x+4Y0AAi/ZwFSagsUd87NKD87nk2XOLP6qRnNy95sg0 nxoO3xgDuwFyTKgXEGsXlaKEGsc+CKFG+DDlc5anuaFyO165mT4TOY/tvJp0VYtB7D PCy+UTFaKe5x+mSPy5KKG3ZM8p46HbnxZhdYJeZH/hc1bjmirRk2/tuFebojS2OgW4 RTiEyTlwEPG2A== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Andrew Lunn , "David S. Miller" , Jakub Kicinski , Paolo Abeni Cc: Russell King , Alexander Couzens , Daniel Golle , Heiner Kallweit , Willy Liu , Ioana Ciornei , =?utf-8?q?Marek_Moj=C3=ADk?= , =?utf-8?q?Maximili=C3=A1?= =?utf-8?q?n_Maliar?= , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH net-next 12/15] net: phy: realtek: use generic c45 suspend/resume for rtl822x Date: Wed, 20 Dec 2023 16:55:15 +0100 Message-ID: <20231220155518.15692-13-kabel@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231220155518.15692-1-kabel@kernel.org> References: <20231220155518.15692-1-kabel@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Now that rtl822x PHYs .read_mmd() and .write_mmd() methods support accessing all MMD registers, use the generic clause 45 functions genphy_c45_pma_suspend() and genphy_c45_pma_resume() for the rtl822x series of Realtek transceivers. Add a 20ms delay after resume, as done in the current resume implementation. Signed-off-by: Marek Behún --- drivers/net/phy/realtek.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index f36b2bfabe57..cf608d390aa5 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -651,6 +651,18 @@ static int rtl822x_probe(struct phy_device *phydev) return 0; } +static int rtl822x_resume(struct phy_device *phydev) +{ + int ret = genphy_c45_pma_resume(phydev); + + if (ret < 0) + return ret; + + msleep(20); + + return 0; +} + static int rtl822x_config_aneg(struct phy_device *phydev) { bool changed = false; @@ -949,8 +961,8 @@ static struct phy_driver realtek_drvs[] = { .probe = rtl822x_probe, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, - .suspend = genphy_suspend, - .resume = rtlgen_resume, + .suspend = genphy_c45_pma_suspend, + .resume = rtl822x_resume, .read_page = rtl821x_read_page, .write_page = rtl821x_write_page, .read_mmd = rtlgen_read_mmd, @@ -961,8 +973,8 @@ static struct phy_driver realtek_drvs[] = { .probe = rtl822x_probe, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, - .suspend = genphy_suspend, - .resume = rtlgen_resume, + .suspend = genphy_c45_pma_suspend, + .resume = rtl822x_resume, .read_page = rtl821x_read_page, .write_page = rtl821x_write_page, .read_mmd = rtlgen_read_mmd, @@ -973,8 +985,8 @@ static struct phy_driver realtek_drvs[] = { .probe = rtl822x_probe, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, - .suspend = genphy_suspend, - .resume = rtlgen_resume, + .suspend = genphy_c45_pma_suspend, + .resume = rtl822x_resume, .read_page = rtl821x_read_page, .write_page = rtl821x_write_page, .read_mmd = rtlgen_read_mmd, @@ -985,8 +997,8 @@ static struct phy_driver realtek_drvs[] = { .probe = rtl822x_probe, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, - .suspend = genphy_suspend, - .resume = rtlgen_resume, + .suspend = genphy_c45_pma_suspend, + .resume = rtl822x_resume, .read_page = rtl821x_read_page, .write_page = rtl821x_write_page, .read_mmd = rtlgen_read_mmd, @@ -997,8 +1009,8 @@ static struct phy_driver realtek_drvs[] = { .probe = rtl822x_probe, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, - .suspend = genphy_suspend, - .resume = rtlgen_resume, + .suspend = genphy_c45_pma_suspend, + .resume = rtl822x_resume, .read_page = rtl821x_read_page, .write_page = rtl821x_write_page, .read_mmd = rtlgen_read_mmd, @@ -1009,8 +1021,8 @@ static struct phy_driver realtek_drvs[] = { .probe = rtl822x_probe, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, - .suspend = genphy_suspend, - .resume = rtlgen_resume, + .suspend = genphy_c45_pma_suspend, + .resume = rtl822x_resume, .read_page = rtl821x_read_page, .write_page = rtl821x_write_page, .read_mmd = rtlgen_read_mmd, From patchwork Wed Dec 20 15:55:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 13500306 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 242C545C18 for ; Wed, 20 Dec 2023 15:56:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eyji8rs8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61A67C433CB; Wed, 20 Dec 2023 15:56:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703087763; bh=D24IxqQ8SbOHt1SLy+6Yt1Bwj3SMfAtFEcvcSNmoatg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eyji8rs81KJMljwUXb2whPzsQHRaXF4+n5GmHqwH4rGdLJijvGoCs+xUn/CYkcHs6 UgSPi5yLNPz+aLdpApP4f+5QgUUqUu80Rhq7mSq2M2jeGYxWvohOLyQeLlVbLRrkqD +wjU2gp9lAdTGpQc/taiqxS40hUT2Xu8m1GcE2qiaJb1X+CjZuwjREbjucKfrKqjDx F3tKWNrY+Y2k/0raASWinESdk4lHfI8uIMucbBRX9/XrPC7Cm4G2qTQBJT24CrqYaP 4qmPAY+8x70taCkM4LsJYo0uWHrG1TpJZVL56e9wJ9KOSs/j4GmI1sw2hXRKSCjRso Pse7Q3LIKxw4Q== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Andrew Lunn , "David S. Miller" , Jakub Kicinski , Paolo Abeni Cc: Russell King , Alexander Couzens , Daniel Golle , Heiner Kallweit , Willy Liu , Ioana Ciornei , =?utf-8?q?Marek_Moj=C3=ADk?= , =?utf-8?q?Maximili=C3=A1?= =?utf-8?q?n_Maliar?= , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH net-next 13/15] net: phy: realtek: drop .read_page and .write_page for rtl822x series Date: Wed, 20 Dec 2023 16:55:16 +0100 Message-ID: <20231220155518.15692-14-kabel@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231220155518.15692-1-kabel@kernel.org> References: <20231220155518.15692-1-kabel@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Drop the .read_page() and .write_page() methods for rtl822x series. The rtl822x driver methods are now reimplemented to only access clause 45 registers and these are the last methods that explicitly access clause 22 registers. If the underlying MDIO bus is clause 22, the paging mechanism is still used internally in the .read_mmd() and .write_mmd() methods when accessing registers in MMD 31. Signed-off-by: Marek Behún --- drivers/net/phy/realtek.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index cf608d390aa5..e2f68ac4b005 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -963,8 +963,6 @@ static struct phy_driver realtek_drvs[] = { .read_status = rtl822x_read_status, .suspend = genphy_c45_pma_suspend, .resume = rtl822x_resume, - .read_page = rtl821x_read_page, - .write_page = rtl821x_write_page, .read_mmd = rtlgen_read_mmd, .write_mmd = rtlgen_write_mmd, }, { @@ -975,8 +973,6 @@ static struct phy_driver realtek_drvs[] = { .read_status = rtl822x_read_status, .suspend = genphy_c45_pma_suspend, .resume = rtl822x_resume, - .read_page = rtl821x_read_page, - .write_page = rtl821x_write_page, .read_mmd = rtlgen_read_mmd, .write_mmd = rtlgen_write_mmd, }, { @@ -987,8 +983,6 @@ static struct phy_driver realtek_drvs[] = { .read_status = rtl822x_read_status, .suspend = genphy_c45_pma_suspend, .resume = rtl822x_resume, - .read_page = rtl821x_read_page, - .write_page = rtl821x_write_page, .read_mmd = rtlgen_read_mmd, .write_mmd = rtlgen_write_mmd, }, { @@ -999,8 +993,6 @@ static struct phy_driver realtek_drvs[] = { .read_status = rtl822x_read_status, .suspend = genphy_c45_pma_suspend, .resume = rtl822x_resume, - .read_page = rtl821x_read_page, - .write_page = rtl821x_write_page, .read_mmd = rtlgen_read_mmd, .write_mmd = rtlgen_write_mmd, }, { @@ -1011,8 +1003,6 @@ static struct phy_driver realtek_drvs[] = { .read_status = rtl822x_read_status, .suspend = genphy_c45_pma_suspend, .resume = rtl822x_resume, - .read_page = rtl821x_read_page, - .write_page = rtl821x_write_page, .read_mmd = rtlgen_read_mmd, .write_mmd = rtlgen_write_mmd, }, { @@ -1023,8 +1013,6 @@ static struct phy_driver realtek_drvs[] = { .read_status = rtl822x_read_status, .suspend = genphy_c45_pma_suspend, .resume = rtl822x_resume, - .read_page = rtl821x_read_page, - .write_page = rtl821x_write_page, .read_mmd = rtlgen_read_mmd, .write_mmd = rtlgen_write_mmd, }, { From patchwork Wed Dec 20 15:55:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 13500307 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 79D1146431 for ; Wed, 20 Dec 2023 15:56:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LwQRC6h5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 626C6C433C8; Wed, 20 Dec 2023 15:56:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703087766; bh=fJOcoCrVnWHXJUhYt4sGGXvqJoVC1RYLBBH/bRdKu3o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LwQRC6h5oemXqN+K/N263s5plu9XyoQtBmA+QXdHGMcGFqk0Y0Qq2b91xK/+N+ooF /2YganDC4lNuMlf2uq66LT1pHgFYSYIQTvTk7zDNbgw1oUpICia+QfB7kKYV8oPhW7 sbI1L5NKFFhB1e9AltvmizbkaCgJ/mC2LP4EdNvbkOHrr84LQEbmCYk+zJpqCVgNUp 4i+Vy9sqOla+7GJ47s+/7NM0/4YFAA5CdC35YYemaWuJJ+Vpo6Syz3s1bv7kH7gZep SLLe1atpe9F3LEDFtOVwrNES3rqxjLT+Wmo0rou/xzG616sPb5w2C8R4VcuPW7KThk zzqrPE6JXyPTg== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Andrew Lunn , "David S. Miller" , Jakub Kicinski , Paolo Abeni Cc: Russell King , Alexander Couzens , Daniel Golle , Heiner Kallweit , Willy Liu , Ioana Ciornei , =?utf-8?q?Marek_Moj=C3=ADk?= , =?utf-8?q?Maximili=C3=A1?= =?utf-8?q?n_Maliar?= , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH net-next 14/15] net: phy: realtek: configure SerDes mode for rtl822x PHYs Date: Wed, 20 Dec 2023 16:55:17 +0100 Message-ID: <20231220155518.15692-15-kabel@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231220155518.15692-1-kabel@kernel.org> References: <20231220155518.15692-1-kabel@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Alexander Couzens The rtl822x series support switching SerDes mode between 2500base-x and sgmii based on the negotiated copper speed. Configure this switching mode according to SerDes modes supported by host. Signed-off-by: Alexander Couzens [ refactored, dropped HiSGMII mode and changed commit message ] Signed-off-by: Marek Behún --- drivers/net/phy/realtek.c | 97 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 95 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index e2f68ac4b005..5d03c5b7afb5 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -54,6 +54,11 @@ RTL8201F_ISR_LINK) #define RTL8201F_IER 0x13 +#define RTL822X_VND1_SERDES_OPTION 0x697a +#define RTL822X_VND1_SERDES_OPTION_MODE_MASK GENMASK(5, 0) +#define RTL822X_VND1_SERDES_OPTION_MODE_2500BASEX_SGMII 0 +#define RTL822X_VND1_SERDES_OPTION_MODE_2500BASEX 2 + #define RTL8221_GBCR 0xa412 #define RTL8221_GANLPAR 0xa414 @@ -663,6 +668,60 @@ static int rtl822x_resume(struct phy_device *phydev) return 0; } +static int rtl822x_config_init(struct phy_device *phydev) +{ + bool has_2500, has_sgmii; + u16 mode; + int ret; + + has_2500 = test_bit(PHY_INTERFACE_MODE_2500BASEX, + phydev->host_interfaces) || + phydev->interface == PHY_INTERFACE_MODE_2500BASEX; + + has_sgmii = test_bit(PHY_INTERFACE_MODE_SGMII, + phydev->host_interfaces) || + phydev->interface == PHY_INTERFACE_MODE_SGMII; + + if (!has_2500 && !has_sgmii) + return 0; + + /* fill in possible interfaces */ + __assign_bit(PHY_INTERFACE_MODE_2500BASEX, phydev->possible_interfaces, + has_2500); + __assign_bit(PHY_INTERFACE_MODE_SGMII, phydev->possible_interfaces, + has_sgmii); + + /* determine SerDes option mode */ + if (has_2500 && !has_sgmii) + mode = RTL822X_VND1_SERDES_OPTION_MODE_2500BASEX; + else + mode = RTL822X_VND1_SERDES_OPTION_MODE_2500BASEX_SGMII; + + ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x75f3, 0); + if (ret < 0) + return ret; + + ret = phy_modify_mmd_changed(phydev, MDIO_MMD_VEND1, + RTL822X_VND1_SERDES_OPTION, + RTL822X_VND1_SERDES_OPTION_MODE_MASK, + mode); + if (ret < 0) + return ret; + + /* the following 3 writes into SerDes control are needed for 2500base-x + * mode to work properly + */ + ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x6a04, 0x0503); + if (ret < 0) + return ret; + + ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x6f10, 0xd455); + if (ret < 0) + return ret; + + return phy_write_mmd(phydev, MDIO_MMD_VEND1, 0x6f11, 0x8020); +} + static int rtl822x_config_aneg(struct phy_device *phydev) { bool changed = false; @@ -689,9 +748,31 @@ static int rtl822x_config_aneg(struct phy_device *phydev) return genphy_c45_check_and_restart_aneg(phydev, changed); } +static void rtl822x_update_interface(struct phy_device *phydev) +{ + /* PHY changes SerDes mode between 2500base-x and sgmii based on + * copper speed, if sgmii is supported + */ + if (!test_bit(PHY_INTERFACE_MODE_SGMII, phydev->possible_interfaces)) + return; + + switch (phydev->speed) { + case SPEED_2500: + phydev->interface = PHY_INTERFACE_MODE_2500BASEX; + break; + case SPEED_1000: + case SPEED_100: + case SPEED_10: + phydev->interface = PHY_INTERFACE_MODE_SGMII; + break; + default: + break; + } +} + static int rtl822x_read_status(struct phy_device *phydev) { - int val; + int ret, val; if (phydev->autoneg == AUTONEG_ENABLE) { val = phy_read_mmd(phydev, MDIO_MMD_VEND2, RTL8221_GANLPAR); @@ -701,7 +782,13 @@ static int rtl822x_read_status(struct phy_device *phydev) mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, val); } - return genphy_c45_read_status(phydev); + ret = genphy_c45_read_status(phydev); + if (ret < 0) + return ret; + + rtl822x_update_interface(phydev); + + return 0; } static bool rtlgen_supports_2_5gbps(struct phy_device *phydev) @@ -959,6 +1046,7 @@ static struct phy_driver realtek_drvs[] = { .name = "RTL8226 2.5Gbps PHY", .match_phy_device = rtl8226_match_phy_device, .probe = rtl822x_probe, + .config_init = rtl822x_config_init, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, .suspend = genphy_c45_pma_suspend, @@ -969,6 +1057,7 @@ static struct phy_driver realtek_drvs[] = { PHY_ID_MATCH_EXACT(0x001cc840), .name = "RTL8226B_RTL8221B 2.5Gbps PHY", .probe = rtl822x_probe, + .config_init = rtl822x_config_init, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, .suspend = genphy_c45_pma_suspend, @@ -979,6 +1068,7 @@ static struct phy_driver realtek_drvs[] = { PHY_ID_MATCH_EXACT(0x001cc838), .name = "RTL8226-CG 2.5Gbps PHY", .probe = rtl822x_probe, + .config_init = rtl822x_config_init, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, .suspend = genphy_c45_pma_suspend, @@ -989,6 +1079,7 @@ static struct phy_driver realtek_drvs[] = { PHY_ID_MATCH_EXACT(0x001cc848), .name = "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY", .probe = rtl822x_probe, + .config_init = rtl822x_config_init, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, .suspend = genphy_c45_pma_suspend, @@ -999,6 +1090,7 @@ static struct phy_driver realtek_drvs[] = { PHY_ID_MATCH_EXACT(0x001cc849), .name = "RTL8221B-VB-CG 2.5Gbps PHY", .probe = rtl822x_probe, + .config_init = rtl822x_config_init, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, .suspend = genphy_c45_pma_suspend, @@ -1009,6 +1101,7 @@ static struct phy_driver realtek_drvs[] = { PHY_ID_MATCH_EXACT(0x001cc84a), .name = "RTL8221B-VM-CG 2.5Gbps PHY", .probe = rtl822x_probe, + .config_init = rtl822x_config_init, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, .suspend = genphy_c45_pma_suspend, From patchwork Wed Dec 20 15:55:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 13500308 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 34DC545C1C for ; Wed, 20 Dec 2023 15:56:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rVhYxZmK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63280C433CB; Wed, 20 Dec 2023 15:56:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703087769; bh=1wX6ld6E465SbXb5F2GvWlHLP3etz9LG8PhFIooM3KI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rVhYxZmK1SPo/ZVl+cHg6H9SK9WGy/UHGPaI3002XRpSfN7QoDO7Ai0YV5R9VB10w /bm78KespLsrxvZSMLxN4vC6N+JcOVtL5ujbfqsnkqnUHwj0+q4v5/B/oV2t/0Wl9V ODA8jmWUWou1/oUun6YbPX6+a5oRN+8rVbXGznAU4klXoC1Rtr3zPFhn+cnGT1uMhl hTBDqmfg7dp4vXxNvwmDm9BQ7rPFsOS8LWN5f32NlmlpUOIOM8/9BCJtQb2e+kBcD2 vqrg8Djr4im75zmH+IpG4rnvV3r9JHHps8bA0VlS+hXw5leST2Hp6KYnBARyKlGxmK SPnBow37x6PIQ== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Andrew Lunn , "David S. Miller" , Jakub Kicinski , Paolo Abeni Cc: Russell King , Alexander Couzens , Daniel Golle , Heiner Kallweit , Willy Liu , Ioana Ciornei , =?utf-8?q?Marek_Moj=C3=ADk?= , =?utf-8?q?Maximili=C3=A1?= =?utf-8?q?n_Maliar?= , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH net-next 15/15] net: sfp: add quirk for another multigig RollBall transceiver Date: Wed, 20 Dec 2023 16:55:18 +0100 Message-ID: <20231220155518.15692-16-kabel@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231220155518.15692-1-kabel@kernel.org> References: <20231220155518.15692-1-kabel@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Add quirk for another RollBall copper transceiver: Turris RTSFP-2.5G, containing 2.5g capable RTL8221B PHY. Signed-off-by: Marek Behún --- drivers/net/phy/sfp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c index 3780a96d2caa..44ce8eba900a 100644 --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c @@ -499,6 +499,7 @@ static const struct sfp_quirk sfp_quirks[] = { SFP_QUIRK_M("OEM", "SFP-2.5G-T", sfp_quirk_oem_2_5g), SFP_QUIRK_F("OEM", "RTSFP-10", sfp_fixup_rollball_cc), SFP_QUIRK_F("OEM", "RTSFP-10G", sfp_fixup_rollball_cc), + SFP_QUIRK_F("Turris", "RTSFP-2.5G", sfp_fixup_rollball), SFP_QUIRK_F("Turris", "RTSFP-10", sfp_fixup_rollball), SFP_QUIRK_F("Turris", "RTSFP-10G", sfp_fixup_rollball), };