From patchwork Sat Apr 30 17:30:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 12833378 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC6BDC433FE for ; Sat, 30 Apr 2022 17:31:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243825AbiD3Rec (ORCPT ); Sat, 30 Apr 2022 13:34:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233873AbiD3Rea (ORCPT ); Sat, 30 Apr 2022 13:34:30 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37F7C3701D for ; Sat, 30 Apr 2022 10:31:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:From:Sender:Reply-To:Subject:Date: Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=BioyjDVinakaLEAY/8tf/sHKY9WXKFdP50pgysMiSpU=; b=S44bQUUEQ1g261UCrgWrn/qliT zsZPtQWHT8XLc9iZz4FzkehorfP2iC0cB23ulY04iX2EobsBvMkRCaMdyVwtk8jMRuM4E1Z4L2f4r zIAqUi6c+jwoU29+2Ciwgk6td3kEXIDaKm8S5/gDLysbdOx6mJpbFu6c44jbKvb2ydqs=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1nkqvl-000eoH-5u; Sat, 30 Apr 2022 19:30:53 +0200 From: Andrew Lunn To: Jakub Kicinski Cc: Vladimir Oltean , Florian Fainelli , Jose Abreu , Heiner Kallweit , Russell King , bcm-kernel-feedback-list@broadcom.com, netdev , Andrew Lunn Subject: [PATCH net-next v1 1/5] net: phylink: Convert to mdiobus_c45_{read|write} Date: Sat, 30 Apr 2022 19:30:33 +0200 Message-Id: <20220430173037.156823-2-andrew@lunn.ch> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220430173037.156823-1-andrew@lunn.ch> References: <20220430173037.156823-1-andrew@lunn.ch> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Stop using the helpers to construct a special phy address which indicates C45. Instead use the C45 accessors, which will call the busses C45 specific read/write API. Signed-off-by: Andrew Lunn --- drivers/net/phy/phylink.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 33c285252584..83499481e793 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -2301,8 +2301,11 @@ static int phylink_phy_read(struct phylink *pl, unsigned int phy_id, if (mdio_phy_id_is_c45(phy_id)) { prtad = mdio_phy_id_prtad(phy_id); devad = mdio_phy_id_devad(phy_id); - devad = mdiobus_c45_addr(devad, reg); - } else if (phydev->is_c45) { + return mdiobus_c45_read(pl->phydev->mdio.bus, prtad, devad, + reg); + } + + if (phydev->is_c45) { switch (reg) { case MII_BMCR: case MII_BMSR: @@ -2324,12 +2327,11 @@ static int phylink_phy_read(struct phylink *pl, unsigned int phy_id, return -EINVAL; } prtad = phy_id; - devad = mdiobus_c45_addr(devad, reg); - } else { - prtad = phy_id; - devad = reg; + return mdiobus_c45_read(pl->phydev->mdio.bus, prtad, devad, + reg); } - return mdiobus_read(pl->phydev->mdio.bus, prtad, devad); + + return mdiobus_read(pl->phydev->mdio.bus, phy_id, reg); } static int phylink_phy_write(struct phylink *pl, unsigned int phy_id, @@ -2341,8 +2343,11 @@ static int phylink_phy_write(struct phylink *pl, unsigned int phy_id, if (mdio_phy_id_is_c45(phy_id)) { prtad = mdio_phy_id_prtad(phy_id); devad = mdio_phy_id_devad(phy_id); - devad = mdiobus_c45_addr(devad, reg); - } else if (phydev->is_c45) { + return mdiobus_c45_write(pl->phydev->mdio.bus, prtad, devad, + reg, val); + } + + if (phydev->is_c45) { switch (reg) { case MII_BMCR: case MII_BMSR: @@ -2363,14 +2368,11 @@ static int phylink_phy_write(struct phylink *pl, unsigned int phy_id, default: return -EINVAL; } - prtad = phy_id; - devad = mdiobus_c45_addr(devad, reg); - } else { - prtad = phy_id; - devad = reg; + return mdiobus_c45_write(pl->phydev->mdio.bus, phy_id, devad, + reg, val); } - return mdiobus_write(phydev->mdio.bus, prtad, devad, val); + return mdiobus_write(phydev->mdio.bus, phy_id, reg, val); } static int phylink_mii_read(struct phylink *pl, unsigned int phy_id, From patchwork Sat Apr 30 17:30:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 12833377 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F95AC433F5 for ; Sat, 30 Apr 2022 17:31:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243677AbiD3Reb (ORCPT ); Sat, 30 Apr 2022 13:34:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239200AbiD3Rea (ORCPT ); Sat, 30 Apr 2022 13:34:30 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40C2C37032 for ; Sat, 30 Apr 2022 10:31:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:From:Sender:Reply-To:Subject:Date: Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=ffO3OITprbENPiZxJ46yYqRQX0pSPU7tm7DzVKy9QR0=; b=H12x9uLZhn0JX9dPbOsiJT7y4i pCRAxsaFt8uh8SsvPJDmlI07CabcyZj9WSlrmty83dpky8zYHiqpFTOSCLaODqi0d2+B0dy/1fy3T Md/OfQZgcxH/MruajoNAHfx2c3YXA4tEnsU6EgBo3pJKr/ooZmQQK/9oCaMwuJZ0eJjY=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1nkqvl-000eoK-8D; Sat, 30 Apr 2022 19:30:53 +0200 From: Andrew Lunn To: Jakub Kicinski Cc: Vladimir Oltean , Florian Fainelli , Jose Abreu , Heiner Kallweit , Russell King , bcm-kernel-feedback-list@broadcom.com, netdev , Andrew Lunn Subject: [PATCH net-next v1 2/5] net: phy: Convert to mdiobus_c45_{read|write} Date: Sat, 30 Apr 2022 19:30:34 +0200 Message-Id: <20220430173037.156823-3-andrew@lunn.ch> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220430173037.156823-1-andrew@lunn.ch> References: <20220430173037.156823-1-andrew@lunn.ch> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Stop using the helpers to construct a special phy address which indicates C45. Instead use the C45 accessors, which will call the busses C45 specific read/write API. Signed-off-by: Andrew Lunn --- drivers/net/phy/phy.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index beb2b66da132..9034c6a8e18f 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -295,20 +295,20 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd) if (mdio_phy_id_is_c45(mii_data->phy_id)) { prtad = mdio_phy_id_prtad(mii_data->phy_id); devad = mdio_phy_id_devad(mii_data->phy_id); - devad = mdiobus_c45_addr(devad, mii_data->reg_num); + mii_data->val_out = mdiobus_c45_read( + phydev->mdio.bus, prtad, devad, + mii_data->reg_num); } else { - prtad = mii_data->phy_id; - devad = mii_data->reg_num; + mii_data->val_out = mdiobus_read( + phydev->mdio.bus, mii_data->phy_id, + mii_data->reg_num); } - mii_data->val_out = mdiobus_read(phydev->mdio.bus, prtad, - devad); return 0; case SIOCSMIIREG: if (mdio_phy_id_is_c45(mii_data->phy_id)) { prtad = mdio_phy_id_prtad(mii_data->phy_id); devad = mdio_phy_id_devad(mii_data->phy_id); - devad = mdiobus_c45_addr(devad, mii_data->reg_num); } else { prtad = mii_data->phy_id; devad = mii_data->reg_num; @@ -351,7 +351,11 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd) } } - mdiobus_write(phydev->mdio.bus, prtad, devad, val); + if (mdio_phy_id_is_c45(mii_data->phy_id)) + mdiobus_c45_write(phydev->mdio.bus, prtad, devad, + mii_data->reg_num, val); + else + mdiobus_write(phydev->mdio.bus, prtad, devad, val); if (prtad == phydev->mdio.addr && devad == MII_BMCR && From patchwork Sat Apr 30 17:30:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 12833376 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFD77C433EF for ; Sat, 30 Apr 2022 17:31:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243664AbiD3Rea (ORCPT ); Sat, 30 Apr 2022 13:34:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234049AbiD3Rea (ORCPT ); Sat, 30 Apr 2022 13:34:30 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39CA937022 for ; Sat, 30 Apr 2022 10:31:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:From:Sender:Reply-To:Subject:Date: Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=ol/uOEuFX2PVGfYZEYVS48n+1LQNiWko42V6PB5HjTc=; b=rNRH345lEMw++zKNUvVXTQ7Ngq BvqwQN70+A7SbVIkbJnVqt1NjOf85W0nqD8ThRxTJcB1Tk8x9NE4Hk+KN/CMt/0vBoJlO05wQ7nsW XKbMNcuwsawXWk3hxZlpaLEPkzlnz+Fl3TYTWUBfvUyEkUUgJKTZb++t6C4lq8ukUk70=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1nkqvl-000eoN-9q; Sat, 30 Apr 2022 19:30:53 +0200 From: Andrew Lunn To: Jakub Kicinski Cc: Vladimir Oltean , Florian Fainelli , Jose Abreu , Heiner Kallweit , Russell King , bcm-kernel-feedback-list@broadcom.com, netdev , Andrew Lunn Subject: [PATCH net-next v1 3/5] net: phy: bcm87xx: Use mmd helpers Date: Sat, 30 Apr 2022 19:30:35 +0200 Message-Id: <20220430173037.156823-4-andrew@lunn.ch> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220430173037.156823-1-andrew@lunn.ch> References: <20220430173037.156823-1-andrew@lunn.ch> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Rather than construct special phy device addresses to access C45 registers, use the mmd helpers. These will directly call the C45 API of the MDIO bus driver. Signed-off-by: Andrew Lunn --- drivers/net/phy/bcm87xx.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/drivers/net/phy/bcm87xx.c b/drivers/net/phy/bcm87xx.c index 313563482690..cc2858107668 100644 --- a/drivers/net/phy/bcm87xx.c +++ b/drivers/net/phy/bcm87xx.c @@ -10,12 +10,12 @@ #define PHY_ID_BCM8706 0x0143bdc1 #define PHY_ID_BCM8727 0x0143bff0 -#define BCM87XX_PMD_RX_SIGNAL_DETECT (MII_ADDR_C45 | 0x1000a) -#define BCM87XX_10GBASER_PCS_STATUS (MII_ADDR_C45 | 0x30020) -#define BCM87XX_XGXS_LANE_STATUS (MII_ADDR_C45 | 0x40018) +#define BCM87XX_PMD_RX_SIGNAL_DETECT 0x000a +#define BCM87XX_10GBASER_PCS_STATUS 0x0020 +#define BCM87XX_XGXS_LANE_STATUS 0x0018 -#define BCM87XX_LASI_CONTROL (MII_ADDR_C45 | 0x39002) -#define BCM87XX_LASI_STATUS (MII_ADDR_C45 | 0x39005) +#define BCM87XX_LASI_CONTROL 0x9002 +#define BCM87XX_LASI_STATUS 0x9005 #if IS_ENABLED(CONFIG_OF_MDIO) /* Set and/or override some configuration registers based on the @@ -54,11 +54,10 @@ static int bcm87xx_of_reg_init(struct phy_device *phydev) u16 reg = be32_to_cpup(paddr++); u16 mask = be32_to_cpup(paddr++); u16 val_bits = be32_to_cpup(paddr++); - u32 regnum = mdiobus_c45_addr(devid, reg); int val = 0; if (mask) { - val = phy_read(phydev, regnum); + val = phy_read_mmd(phydev, devid, reg); if (val < 0) { ret = val; goto err; @@ -67,7 +66,7 @@ static int bcm87xx_of_reg_init(struct phy_device *phydev) } val |= val_bits; - ret = phy_write(phydev, regnum, val); + ret = phy_write_mmd(phydev, devid, reg, val); if (ret < 0) goto err; } @@ -104,21 +103,24 @@ static int bcm87xx_read_status(struct phy_device *phydev) int pcs_status; int xgxs_lane_status; - rx_signal_detect = phy_read(phydev, BCM87XX_PMD_RX_SIGNAL_DETECT); + rx_signal_detect = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, + BCM87XX_PMD_RX_SIGNAL_DETECT); if (rx_signal_detect < 0) return rx_signal_detect; if ((rx_signal_detect & 1) == 0) goto no_link; - pcs_status = phy_read(phydev, BCM87XX_10GBASER_PCS_STATUS); + pcs_status = phy_read_mmd(phydev, MDIO_MMD_PCS, + BCM87XX_10GBASER_PCS_STATUS); if (pcs_status < 0) return pcs_status; if ((pcs_status & 1) == 0) goto no_link; - xgxs_lane_status = phy_read(phydev, BCM87XX_XGXS_LANE_STATUS); + xgxs_lane_status = phy_read_mmd(phydev, MDIO_MMD_PHYXS, + BCM87XX_XGXS_LANE_STATUS); if (xgxs_lane_status < 0) return xgxs_lane_status; @@ -139,25 +141,27 @@ static int bcm87xx_config_intr(struct phy_device *phydev) { int reg, err; - reg = phy_read(phydev, BCM87XX_LASI_CONTROL); + reg = phy_read_mmd(phydev, MDIO_MMD_PCS, BCM87XX_LASI_CONTROL); if (reg < 0) return reg; if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { - err = phy_read(phydev, BCM87XX_LASI_STATUS); + err = phy_read_mmd(phydev, MDIO_MMD_PCS, BCM87XX_LASI_STATUS); if (err) return err; reg |= 1; - err = phy_write(phydev, BCM87XX_LASI_CONTROL, reg); + err = phy_write_mmd(phydev, MDIO_MMD_PCS, + BCM87XX_LASI_CONTROL, reg); } else { reg &= ~1; - err = phy_write(phydev, BCM87XX_LASI_CONTROL, reg); + err = phy_write_mmd(phydev, MDIO_MMD_PCS, + BCM87XX_LASI_CONTROL, reg); if (err) return err; - err = phy_read(phydev, BCM87XX_LASI_STATUS); + err = phy_read_mmd(phydev, MDIO_MMD_PCS, BCM87XX_LASI_STATUS); } return err; From patchwork Sat Apr 30 17:30:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 12833379 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EEBADC433EF for ; Sat, 30 Apr 2022 17:31:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347195AbiD3Ree (ORCPT ); Sat, 30 Apr 2022 13:34:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243428AbiD3Rea (ORCPT ); Sat, 30 Apr 2022 13:34:30 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39D7A37026 for ; Sat, 30 Apr 2022 10:31:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:From:Sender:Reply-To:Subject:Date: Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=Nx5xclTdrr/YfggkjYJSuAcvuuAGzPLXZX1wzbDrH+A=; b=yBHfIfOaZcWdUo6fdqmLInbyGL pK+jAGXmBDYWbIxCfA5eCOG616wzORTCXJrxaueWRgyurGsZHKvLJMiDdEffOm7MOXLKU3j85FpY0 HOnY1z7RWsUcusQOeo5shD7KlSlUUvSG3jS+2L+3zeHwfU/cGTHEgr7N8570CxPjYfeU=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1nkqvl-000eoT-BT; Sat, 30 Apr 2022 19:30:53 +0200 From: Andrew Lunn To: Jakub Kicinski Cc: Vladimir Oltean , Florian Fainelli , Jose Abreu , Heiner Kallweit , Russell King , bcm-kernel-feedback-list@broadcom.com, netdev , Andrew Lunn Subject: [PATCH net-next v1 4/5] net: dsa: sja1105: Convert to mdiobus_c45_read Date: Sat, 30 Apr 2022 19:30:36 +0200 Message-Id: <20220430173037.156823-5-andrew@lunn.ch> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220430173037.156823-1-andrew@lunn.ch> References: <20220430173037.156823-1-andrew@lunn.ch> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Stop using the helpers to construct a special phy address which indicates C45. Instead use the C45 accessors, which will call the busses C45 specific read/write API. Reviewed-by: Vladimir Oltean Tested-by: Vladimir Oltean Signed-off-by: Andrew Lunn --- drivers/net/dsa/sja1105/sja1105_main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c index b33841c6507a..72b6fc1932b5 100644 --- a/drivers/net/dsa/sja1105/sja1105_main.c +++ b/drivers/net/dsa/sja1105/sja1105_main.c @@ -2252,14 +2252,13 @@ int sja1105_static_config_reload(struct sja1105_private *priv, * change it through the dynamic interface later. */ for (i = 0; i < ds->num_ports; i++) { - u32 reg_addr = mdiobus_c45_addr(MDIO_MMD_VEND2, MDIO_CTRL1); - speed_mbps[i] = sja1105_port_speed_to_ethtool(priv, mac[i].speed); mac[i].speed = priv->info->port_speed[SJA1105_SPEED_AUTO]; if (priv->xpcs[i]) - bmcr[i] = mdiobus_read(priv->mdio_pcs, i, reg_addr); + bmcr[i] = mdiobus_c45_read(priv->mdio_pcs, i, + MDIO_MMD_VEND2, MDIO_CTRL1); } /* No PTP operations can run right now */ From patchwork Sat Apr 30 17:30:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 12833380 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7D41C4332F for ; Sat, 30 Apr 2022 17:31:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348836AbiD3Ree (ORCPT ); Sat, 30 Apr 2022 13:34:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243505AbiD3Rea (ORCPT ); Sat, 30 Apr 2022 13:34:30 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B74C1377D1 for ; Sat, 30 Apr 2022 10:31:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:From:Sender:Reply-To:Subject:Date: Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=snEZR+sSkxgnvbyVxid62YEeNY5ZoAGZh4C3IJokK88=; b=KIEyF+BXen33CHOcQ5qDweiNlQ tIb4yMAXS7LX9Psl1dzYl1P+0hd64pjfvg7k8CWZGIXR8OaQU4bW2v5fSKRQZW96hQMSmxwU8633S pfjxmk30+Hbj9ckPDYDvq51lpwZ6vBeEj4iljf9ADl0I3J/HPOA1dDZGbHU0shNboXOU=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1nkqvl-000eoX-Cs; Sat, 30 Apr 2022 19:30:53 +0200 From: Andrew Lunn To: Jakub Kicinski Cc: Vladimir Oltean , Florian Fainelli , Jose Abreu , Heiner Kallweit , Russell King , bcm-kernel-feedback-list@broadcom.com, netdev , Andrew Lunn Subject: [PATCH net-next v1 5/5] net: pcs: pcs-xpcs: Convert to mdiobus_c45_read Date: Sat, 30 Apr 2022 19:30:37 +0200 Message-Id: <20220430173037.156823-6-andrew@lunn.ch> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220430173037.156823-1-andrew@lunn.ch> References: <20220430173037.156823-1-andrew@lunn.ch> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Stop using the helpers to construct a special mdio address which indicates C45. Instead use the C45 accessors, which will call the busses C45 specific read/write API. Reviewed-by: Vladimir Oltean Tested-by: Vladimir Oltean Signed-off-by: Andrew Lunn --- drivers/net/pcs/pcs-xpcs.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index 61418d4dc0cd..4cfd05c15aee 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -175,20 +175,18 @@ static bool __xpcs_linkmode_supported(const struct xpcs_compat *compat, int xpcs_read(struct dw_xpcs *xpcs, int dev, u32 reg) { - u32 reg_addr = mdiobus_c45_addr(dev, reg); struct mii_bus *bus = xpcs->mdiodev->bus; int addr = xpcs->mdiodev->addr; - return mdiobus_read(bus, addr, reg_addr); + return mdiobus_c45_read(bus, addr, dev, reg); } int xpcs_write(struct dw_xpcs *xpcs, int dev, u32 reg, u16 val) { - u32 reg_addr = mdiobus_c45_addr(dev, reg); struct mii_bus *bus = xpcs->mdiodev->bus; int addr = xpcs->mdiodev->addr; - return mdiobus_write(bus, addr, reg_addr, val); + return mdiobus_c45_write(bus, addr, dev, reg, val); } static int xpcs_read_vendor(struct dw_xpcs *xpcs, int dev, u32 reg)