From patchwork Thu Mar 25 13:12:39 2021 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: 12164101 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 X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE1D8C433E0 for ; Thu, 25 Mar 2021 13:14:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A5E3860249 for ; Thu, 25 Mar 2021 13:14:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230419AbhCYNNh (ORCPT ); Thu, 25 Mar 2021 09:13:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:52498 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230204AbhCYNN0 (ORCPT ); Thu, 25 Mar 2021 09:13:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7329861A1B; Thu, 25 Mar 2021 13:13:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616678005; bh=bSW+N5ry56/YWkLrCH8XHXA47hNF8phNSn+g3PtO5iM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tJ73AcVoahEUoOwFjt2t2rfE3Mq0CtbM8LXwpuTCopjBx0DV+5YQ8ihEkDfTNaM9+ FpIbHx1KFPrbZqHdThvi5FE7G28k1HWoJeYOhOZhQUSfvZnwiTQYur3m5799sibRzK kY9k1lv0bIoUUIvgeRIF7Yk9kTMwwp/e/7cUMiYEhlnTynbaLMgyf1FoHtToI9eR1N ut7tnvJtuPk8Gg40KlCuO9HndvghmHsxSthhtxzDFY1vS7lsAxxovQ4fBkQ5M7yJWJ Vha2+bk+2iTUHCwg4XAhdwGFmfoiia/JyumBlOuGFrkInC3ZIYJULCe/U+P5X5vI7Z KR+vNVnTiuFHQ== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Andrew Lunn , "David S . Miller" , Florian Fainelli , Heiner Kallweit , Russell King , kuba@kernel.org Cc: =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH net-next v2 01/12] net: phy: marvell10g: rename register Date: Thu, 25 Mar 2021 14:12:39 +0100 Message-Id: <20210325131250.15901-2-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210325131250.15901-1-kabel@kernel.org> References: <20210325131250.15901-1-kabel@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The MV_V2_PORT_MAC_TYPE_* is part of the CTRL register. Rename to MV_V2_PORT_CTRL_MACTYPE_*. Signed-off-by: Marek Behún --- drivers/net/phy/marvell10g.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index 74b64e52ffa2..9b514124af0d 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -80,8 +80,8 @@ enum { MV_V2_PORT_CTRL = 0xf001, MV_V2_PORT_CTRL_SWRST = BIT(15), MV_V2_PORT_CTRL_PWRDOWN = BIT(11), - MV_V2_PORT_MAC_TYPE_MASK = 0x7, - MV_V2_PORT_MAC_TYPE_RATE_MATCH = 0x6, + MV_V2_PORT_CTRL_MACTYPE_MASK = 0x7, + MV_V2_PORT_CTRL_MACTYPE_RATE_MATCH = 0x6, /* Temperature control/read registers (88X3310 only) */ MV_V2_TEMP_CTRL = 0xf08a, MV_V2_TEMP_CTRL_MASK = 0xc000, @@ -477,8 +477,8 @@ static int mv3310_config_init(struct phy_device *phydev) val = phy_read_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL); if (val < 0) return val; - priv->rate_match = ((val & MV_V2_PORT_MAC_TYPE_MASK) == - MV_V2_PORT_MAC_TYPE_RATE_MATCH); + priv->rate_match = ((val & MV_V2_PORT_CTRL_MACTYPE_MASK) == + MV_V2_PORT_CTRL_MACTYPE_RATE_MATCH); /* Enable EDPD mode - saving 600mW */ return mv3310_set_edpd(phydev, ETHTOOL_PHY_EDPD_DFLT_TX_MSECS); From patchwork Thu Mar 25 13:12:40 2021 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: 12164097 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 X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8884C433C1 for ; Thu, 25 Mar 2021 13:14:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8FA1D61A1B for ; Thu, 25 Mar 2021 13:14:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230439AbhCYNNi (ORCPT ); Thu, 25 Mar 2021 09:13:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:52514 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230337AbhCYNN2 (ORCPT ); Thu, 25 Mar 2021 09:13:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4925661A11; Thu, 25 Mar 2021 13:13:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616678007; bh=lsPKnMie2e0T1Zwy/pWfYzquGPqebfg5m7AGMVjwbEw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b4/h/Kgg+49X55wDJo3Gvvryx8j+lsy4+bcKIFfvXx0hO4RarZfEDxXZiyIuCy2CV rkR+SJfbvELtQO9/JBFPj8lF9InqBUEfSuVICG9T3ODdJ4J9KgJrA5dbvFC0BAOXoq agkUr+foacQNdWtdojxroHoFcIsEhm0W+Ka2+YkGPe8lUVsEqimM/n0BLSoL4ZnHhu l4WLrjJEepeFyRQUh/3BHcJlgFlw/5D5iOeVrkOAZSSALlBG/4PNJRHER1+1E2AQdK 1676B4gTPzVsRKhh/AL42rK4tMuFPBgEfufU7+yp9/PJwen1qVypJNbR3gvwAe7bV1 zHEZyBPyFf8kw== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Andrew Lunn , "David S . Miller" , Florian Fainelli , Heiner Kallweit , Russell King , kuba@kernel.org Cc: =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH net-next v2 02/12] net: phy: marvell10g: fix typo Date: Thu, 25 Mar 2021 14:12:40 +0100 Message-Id: <20210325131250.15901-3-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210325131250.15901-1-kabel@kernel.org> References: <20210325131250.15901-1-kabel@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This space should be a tab instead. Signed-off-by: Marek Behún --- drivers/net/phy/marvell10g.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index 9b514124af0d..f2f0da9717be 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -79,7 +79,7 @@ enum { /* Vendor2 MMD registers */ MV_V2_PORT_CTRL = 0xf001, MV_V2_PORT_CTRL_SWRST = BIT(15), - MV_V2_PORT_CTRL_PWRDOWN = BIT(11), + MV_V2_PORT_CTRL_PWRDOWN = BIT(11), MV_V2_PORT_CTRL_MACTYPE_MASK = 0x7, MV_V2_PORT_CTRL_MACTYPE_RATE_MATCH = 0x6, /* Temperature control/read registers (88X3310 only) */ From patchwork Thu Mar 25 13:12:41 2021 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: 12164103 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 X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA23DC433E2 for ; Thu, 25 Mar 2021 13:14:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B535161A26 for ; Thu, 25 Mar 2021 13:14:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230460AbhCYNNj (ORCPT ); Thu, 25 Mar 2021 09:13:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:52530 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230241AbhCYNN3 (ORCPT ); Thu, 25 Mar 2021 09:13:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 28B1A61A26; Thu, 25 Mar 2021 13:13:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616678009; bh=aEIqfBLBfaoi2rijCx0Z6Sl+e1sdvPs+1ZbqOwzkQ84=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K9oydgcSdl18RA3B1fEXHs7lk20xSaBCWCCQFlT3TrsM5YsAt/u4q36GlmTtV5R9v luyl1W8s1GqltacZgJCjpwgnVfVHCVwZeVqFMYQuGzn7hAzE77e+dnnL4OtgcACm59 XV0z78wvhulC/43hNydQLx+GFM0Wn7It8UbnpA6YbrSIt70fWiGywiFZbYqgrSU5Ga xrAwbgpIavf/bxQB+Tsa67HoMBuD3GVpuKE5a9QN+8PvFfm+4birgfxMhmJ/vqYnBO espxOdcEAR3r/XHYw9+53kNNHNJf47JS5LA+vI7jqsNZqA2D08BASad6aN0SHM8fbq lmNuwpZFuv7Qg== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Andrew Lunn , "David S . Miller" , Florian Fainelli , Heiner Kallweit , Russell King , kuba@kernel.org Cc: =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH net-next v2 03/12] net: phy: marvell10g: allow 5gbase-r and usxgmii Date: Thu, 25 Mar 2021 14:12:41 +0100 Message-Id: <20210325131250.15901-4-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210325131250.15901-1-kabel@kernel.org> References: <20210325131250.15901-1-kabel@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This modes are also supported by this PHYs. Signed-off-by: Marek Behún --- drivers/net/phy/marvell10g.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index f2f0da9717be..881a0717846e 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -462,9 +462,11 @@ static int mv3310_config_init(struct phy_device *phydev) /* Check that the PHY interface type is compatible */ if (phydev->interface != PHY_INTERFACE_MODE_SGMII && phydev->interface != PHY_INTERFACE_MODE_2500BASEX && + phydev->interface != PHY_INTERFACE_MODE_5GBASER && phydev->interface != PHY_INTERFACE_MODE_XAUI && phydev->interface != PHY_INTERFACE_MODE_RXAUI && - phydev->interface != PHY_INTERFACE_MODE_10GBASER) + phydev->interface != PHY_INTERFACE_MODE_10GBASER && + phydev->interface != PHY_INTERFACE_MODE_USXGMII) return -ENODEV; phydev->mdix_ctrl = ETH_TP_MDI_AUTO; @@ -599,6 +601,7 @@ static void mv3310_update_interface(struct phy_device *phydev) if ((phydev->interface == PHY_INTERFACE_MODE_SGMII || phydev->interface == PHY_INTERFACE_MODE_2500BASEX || + phydev->interface == PHY_INTERFACE_MODE_5GBASER || phydev->interface == PHY_INTERFACE_MODE_10GBASER) && phydev->link) { /* The PHY automatically switches its serdes interface (and @@ -611,6 +614,9 @@ static void mv3310_update_interface(struct phy_device *phydev) case SPEED_10000: phydev->interface = PHY_INTERFACE_MODE_10GBASER; break; + case SPEED_5000: + phydev->interface = PHY_INTERFACE_MODE_5GBASER; + break; case SPEED_2500: phydev->interface = PHY_INTERFACE_MODE_2500BASEX; break; From patchwork Thu Mar 25 13:12:42 2021 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: 12164107 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 X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1333C433E1 for ; Thu, 25 Mar 2021 13:14:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD1DF619A3 for ; Thu, 25 Mar 2021 13:14:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230332AbhCYNNm (ORCPT ); Thu, 25 Mar 2021 09:13:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:52544 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230348AbhCYNNb (ORCPT ); Thu, 25 Mar 2021 09:13:31 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F3E4D619FE; Thu, 25 Mar 2021 13:13:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616678011; bh=TLzjIiMW8gsFW9CarK+CjX5T4n1cnXSM8MHtXQS/g7s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d0r0KGH5DXHduUL6PGdWGkU8F9mUNRUJ86na4z1krZ4UdlIQ8U458605bW5jVWz5b r00bG1Ine1ky05r4vxiXBzpDhjFNYkRGSLJNqPCwUhU+aoGSCL7up0GhbkfHesCc6l cT00U5+tCTZwqZUqtvzxUCF+56FEdf12mhcxli9+CdPYzymH0+g3/TFMeU1CJTo25q hgejyMMmZlLOFMQ7C7X0y/4jZgu8obJip/kR/85708c7JvfcqGh+Wfg8ScwZsmbS4s eDw3DHc4pjgN1DcjHIzOvqpbOR+p2vX2iFHYLUHQizMlLIZIPom7rnSVKaHrU8l8pH RGrcTwdlOSgGw== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Andrew Lunn , "David S . Miller" , Florian Fainelli , Heiner Kallweit , Russell King , kuba@kernel.org Cc: =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH net-next v2 04/12] net: phy: marvell10g: indicate 88X33X0 only port control registers Date: Thu, 25 Mar 2021 14:12:42 +0100 Message-Id: <20210325131250.15901-5-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210325131250.15901-1-kabel@kernel.org> References: <20210325131250.15901-1-kabel@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Indicate via register names registers that are only valid for 88X33X0, not for 88E21X0. Signed-off-by: Marek Behún --- drivers/net/phy/marvell10g.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index 881a0717846e..7552a658a513 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -78,10 +78,10 @@ enum { /* Vendor2 MMD registers */ MV_V2_PORT_CTRL = 0xf001, - MV_V2_PORT_CTRL_SWRST = BIT(15), - MV_V2_PORT_CTRL_PWRDOWN = BIT(11), - MV_V2_PORT_CTRL_MACTYPE_MASK = 0x7, - MV_V2_PORT_CTRL_MACTYPE_RATE_MATCH = 0x6, + MV_V2_PORT_CTRL_PWRDOWN = BIT(11), + MV_V2_33X0_PORT_CTRL_SWRST = BIT(15), + MV_V2_33X0_PORT_CTRL_MACTYPE_MASK = 0x7, + MV_V2_33X0_PORT_CTRL_MACTYPE_RATE_MATCH = 0x6, /* Temperature control/read registers (88X3310 only) */ MV_V2_TEMP_CTRL = 0xf08a, MV_V2_TEMP_CTRL_MASK = 0xc000, @@ -268,7 +268,7 @@ static int mv3310_power_up(struct phy_device *phydev) return ret; return phy_set_bits_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL, - MV_V2_PORT_CTRL_SWRST); + MV_V2_33X0_PORT_CTRL_SWRST); } static int mv3310_reset(struct phy_device *phydev, u32 unit) @@ -479,8 +479,8 @@ static int mv3310_config_init(struct phy_device *phydev) val = phy_read_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL); if (val < 0) return val; - priv->rate_match = ((val & MV_V2_PORT_CTRL_MACTYPE_MASK) == - MV_V2_PORT_CTRL_MACTYPE_RATE_MATCH); + priv->rate_match = ((val & MV_V2_33X0_PORT_CTRL_MACTYPE_MASK) == + MV_V2_33X0_PORT_CTRL_MACTYPE_RATE_MATCH); /* Enable EDPD mode - saving 600mW */ return mv3310_set_edpd(phydev, ETHTOOL_PHY_EDPD_DFLT_TX_MSECS); From patchwork Thu Mar 25 13:12:43 2021 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: 12164105 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 X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD20BC433E3 for ; Thu, 25 Mar 2021 13:14:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C7FCE61A27 for ; Thu, 25 Mar 2021 13:14:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230186AbhCYNNl (ORCPT ); Thu, 25 Mar 2021 09:13:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:52560 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230115AbhCYNNd (ORCPT ); Thu, 25 Mar 2021 09:13:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CAC1661A1E; Thu, 25 Mar 2021 13:13:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616678013; bh=eW67JIbT4Cz8LO2mBfJgUwc0Bo463M4DkT7UiRNnQMI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NqCbTtaztMNiLV1NLEKfleyUNxeZegNE5MfoRyIA75db2I+1utyZgUYudsOZ8v1Jy fMDVttouzQ4msjSURCtZw5P4OtueQ1+JCb9y9WuLuApViFwIN2+L6q6QXz0pWupClq UrUQJPpwP6W8yGscwRMTkCOh8+yi0O53OsdlX1OxkkStJY8jBNpD/k8fQl257AHbci SK36lFkr21buxHwGQvJKl8kZBgV6jo7M8dmf/Ig7XW0EHwhLwyxp8+PN9x94AVSRNi 3+etf4nWldsJvr8RVv0j84cTYWvrsTzO/haf9JpKLQDxGj5cd0dbao0GFr3DQr7BUI sIwvOblutT6Kg== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Andrew Lunn , "David S . Miller" , Florian Fainelli , Heiner Kallweit , Russell King , kuba@kernel.org Cc: =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH net-next v2 05/12] net: phy: marvell10g: add MACTYPE definitions for 88X33X0/88X33X0P Date: Thu, 25 Mar 2021 14:12:43 +0100 Message-Id: <20210325131250.15901-6-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210325131250.15901-1-kabel@kernel.org> References: <20210325131250.15901-1-kabel@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add all MACTYPE definitions for 88X3310, 88X3310P, 88X3340 and 88X3340P. In order to have consistent naming, rename MV_V2_33X0_PORT_CTRL_MACTYPE_RATE_MATCH to MV_V2_33X0_PORT_CTRL_MACTYPE_10GBASER_RATE_MATCH. Signed-off-by: Marek Behún --- drivers/net/phy/marvell10g.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index 7552a658a513..7d9a45437b69 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -78,10 +78,18 @@ enum { /* Vendor2 MMD registers */ MV_V2_PORT_CTRL = 0xf001, - MV_V2_PORT_CTRL_PWRDOWN = BIT(11), - MV_V2_33X0_PORT_CTRL_SWRST = BIT(15), - MV_V2_33X0_PORT_CTRL_MACTYPE_MASK = 0x7, - MV_V2_33X0_PORT_CTRL_MACTYPE_RATE_MATCH = 0x6, + MV_V2_PORT_CTRL_PWRDOWN = BIT(11), + MV_V2_33X0_PORT_CTRL_SWRST = BIT(15), + MV_V2_33X0_PORT_CTRL_MACTYPE_MASK = 0x7, + MV_V2_33X0_PORT_CTRL_MACTYPE_RXAUI = 0x0, + MV_V2_3310_PORT_CTRL_MACTYPE_XAUI_RATE_MATCH = 0x1, + MV_V2_3340_PORT_CTRL_MACTYPE_RXAUI_NO_SGMII_AN = 0x1, + MV_V2_33X0_PORT_CTRL_MACTYPE_RXAUI_RATE_MATCH = 0x2, + MV_V2_3310_PORT_CTRL_MACTYPE_XAUI = 0x3, + MV_V2_33X0_PORT_CTRL_MACTYPE_10GBASER = 0x4, + MV_V2_33X0_PORT_CTRL_MACTYPE_10GBASER_NO_SGMII_AN = 0x5, + MV_V2_33X0_PORT_CTRL_MACTYPE_10GBASER_RATE_MATCH = 0x6, + MV_V2_33X0_PORT_CTRL_MACTYPE_USXGMII = 0x7, /* Temperature control/read registers (88X3310 only) */ MV_V2_TEMP_CTRL = 0xf08a, MV_V2_TEMP_CTRL_MASK = 0xc000, @@ -480,7 +488,7 @@ static int mv3310_config_init(struct phy_device *phydev) if (val < 0) return val; priv->rate_match = ((val & MV_V2_33X0_PORT_CTRL_MACTYPE_MASK) == - MV_V2_33X0_PORT_CTRL_MACTYPE_RATE_MATCH); + MV_V2_33X0_PORT_CTRL_MACTYPE_10GBASER_RATE_MATCH); /* Enable EDPD mode - saving 600mW */ return mv3310_set_edpd(phydev, ETHTOOL_PHY_EDPD_DFLT_TX_MSECS); From patchwork Thu Mar 25 13:12:44 2021 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: 12164111 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 X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F6F7C433E0 for ; Thu, 25 Mar 2021 13:14:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3027861A2D for ; Thu, 25 Mar 2021 13:14:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230481AbhCYNOH (ORCPT ); Thu, 25 Mar 2021 09:14:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:52622 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230358AbhCYNNf (ORCPT ); Thu, 25 Mar 2021 09:13:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A0786619EE; Thu, 25 Mar 2021 13:13:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616678015; bh=I4nxHoJrkAa+c0GD2PcJsIKsqldCGduF2pxnr5ItC2U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vQ8M48xkhJEEGScggkhOB7naUmBtJ+xUGYk7D3NIedVBuLLynVKp1/cUtCDt5mlbo s1VCQP+tzSIZlXYHiWqRGl/omjGaq7T5sM92ivVFrZ0cXejXwdhkt6MkqulHMrtR5I dsJNw03n5GO+7adXm32m3BPhmQtobn77hcv+il4STaiDCl8mGhsDcAG1Z8TTTp9TPc 15vNgx4g4P19reTnwddm3GU1xv/CiUoX7X9BJmalXBJfoiIbRZfYZ2ykZoi/uLNuaM e44c/jVFI1NUjpP81LPcaaXp5lr5/7kQw8TpY2lbmc0nEPJq/bTPvPbi2gwbH2OBqV JMF0Dtr4iMQeg== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Andrew Lunn , "David S . Miller" , Florian Fainelli , Heiner Kallweit , Russell King , kuba@kernel.org Cc: =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH net-next v2 06/12] net: phy: marvell10g: add MACTYPE definitions for 88E21XX Date: Thu, 25 Mar 2021 14:12:44 +0100 Message-Id: <20210325131250.15901-7-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210325131250.15901-1-kabel@kernel.org> References: <20210325131250.15901-1-kabel@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add all MACTYPE definitions for 88E2110, 88E2180, 88E2111 and 88E2181. Signed-off-by: Marek Behún --- drivers/net/phy/marvell10g.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index 7d9a45437b69..556c9b43860e 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -35,6 +35,15 @@ enum { MV_PMA_FW_VER0 = 0xc011, MV_PMA_FW_VER1 = 0xc012, + MV_PMA_21X0_PORT_CTRL = 0xc04a, + MV_PMA_21X0_PORT_CTRL_SWRST = BIT(15), + MV_PMA_21X0_PORT_CTRL_MACTYPE_MASK = 0x7, + MV_PMA_21X0_PORT_CTRL_MACTYPE_USXGMII = 0x0, + MV_PMA_2180_PORT_CTRL_MACTYPE_DXGMII = 0x1, + MV_PMA_2180_PORT_CTRL_MACTYPE_QXGMII = 0x2, + MV_PMA_21X0_PORT_CTRL_MACTYPE_5GBASER = 0x4, + MV_PMA_21X0_PORT_CTRL_MACTYPE_5GBASER_NO_SGMII_AN = 0x5, + MV_PMA_21X0_PORT_CTRL_MACTYPE_10GBASER_RATE_MATCH = 0x6, MV_PMA_BOOT = 0xc050, MV_PMA_BOOT_FATAL = BIT(0), From patchwork Thu Mar 25 13:12:45 2021 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: 12164109 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 X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 490E1C433DB for ; Thu, 25 Mar 2021 13:14:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1B8FB61A1E for ; Thu, 25 Mar 2021 13:14:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230093AbhCYNOK (ORCPT ); Thu, 25 Mar 2021 09:14:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:52692 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230260AbhCYNNh (ORCPT ); Thu, 25 Mar 2021 09:13:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 76F1961A40; Thu, 25 Mar 2021 13:13:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616678016; bh=HtnNEpMDvH9xaCq97fCpG41bYejqVE/v2dFNuPhpvy8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VPxE+AA+5rCwsB99SeVOzyIvtdjCIkBQJUUtgspXskhD7kj75vggGXnK7bnzyZEZx uFKlJ/ETjysEokh3MeWjc/AAUvnyREqnlIgCZiiXaOQ/ThugzHOy8s2QRuSzMzIGtp lycyBhD+9ylNlBrvHstDyM3ZkVB9vqtLhnfk+aitb7uLt2huhsEKA8hYcs25S/locx Aix6SmugwVG5L7X6Vp0clcrQTbKXC6t3yh0fO4asaqBJ0Uh0D9isyd+GNboRoNmgqW AxIheECta5EsZMUuWuv66NZEXkg53FUr2pt/PTJaipifiQhGz2IhuR6kAxwRHEyFDP OXPE/9TxCBEUg== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Andrew Lunn , "David S . Miller" , Florian Fainelli , Heiner Kallweit , Russell King , kuba@kernel.org Cc: =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH net-next v2 07/12] net: phy: marvell10g: add code to determine number of ports Date: Thu, 25 Mar 2021 14:12:45 +0100 Message-Id: <20210325131250.15901-8-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210325131250.15901-1-kabel@kernel.org> References: <20210325131250.15901-1-kabel@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add code to determine number of ports, from which we differentiate 88E211X from 88E218X and 88X3310 from 88X3340. Signed-off-by: Marek Behún --- drivers/net/phy/marvell10g.c | 44 +++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index 556c9b43860e..b49cff895cdd 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -78,6 +78,10 @@ enum { /* Temperature read register (88E2110 only) */ MV_PCS_TEMP = 0x8042, + MV_PCS_ID = 0xd00d, + MV_PCS_ID_NPORTS_MASK = 0x0380, + MV_PCS_ID_NPORTS_SHIFT = 7, + /* These registers appear at 0x800X and 0xa00X - the 0xa00X control * registers appear to set themselves to the 0x800X when AN is * restarted, but status registers appear readable from either. @@ -108,7 +112,17 @@ enum { MV_V2_TEMP_UNKNOWN = 0x9600, /* unknown function */ }; +enum mv3310_model { + MV_MODEL_NA = 0, + MV_MODEL_88E211X, + MV_MODEL_88E218X, + MV_MODEL_88X3310, + MV_MODEL_88X3340, +}; + struct mv3310_priv { + enum mv3310_model model; + u32 firmware_ver; bool rate_match; @@ -382,7 +396,7 @@ static int mv3310_probe(struct phy_device *phydev) { struct mv3310_priv *priv; u32 mmd_mask = MDIO_DEVS_PMAPMD | MDIO_DEVS_AN; - int ret; + int ret, nports; if (!phydev->is_c45 || (phydev->c45_ids.devices_in_package & mmd_mask) != mmd_mask) @@ -420,6 +434,34 @@ static int mv3310_probe(struct phy_device *phydev) priv->firmware_ver >> 24, (priv->firmware_ver >> 16) & 255, (priv->firmware_ver >> 8) & 255, priv->firmware_ver & 255); + ret = phy_read_mmd(phydev, MDIO_MMD_PCS, MV_PCS_ID); + if (ret < 0) + return ret; + + nports = ((ret & MV_PCS_ID_NPORTS_MASK) >> MV_PCS_ID_NPORTS_SHIFT) + 1; + + switch (phydev->drv->phy_id) { + case MARVELL_PHY_ID_88X3310: + if (nports == 4) + priv->model = MV_MODEL_88X3340; + else if (nports == 1) + priv->model = MV_MODEL_88X3310; + break; + case MARVELL_PHY_ID_88E2110: + if (nports == 8) + priv->model = MV_MODEL_88E218X; + else if (nports == 1) + priv->model = MV_MODEL_88E211X; + break; + default: + unreachable(); + } + + if (!priv->model) { + phydev_err(phydev, "unknown PHY model (nports = %i)\n", nports); + return -ENODEV; + } + /* Powering down the port when not in use saves about 600mW */ ret = mv3310_power_down(phydev); if (ret) From patchwork Thu Mar 25 13:12:46 2021 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: 12164113 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 X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B324C433E1 for ; Thu, 25 Mar 2021 13:14:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 43B7561A36 for ; Thu, 25 Mar 2021 13:14:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230505AbhCYNOK (ORCPT ); Thu, 25 Mar 2021 09:14:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:52710 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230447AbhCYNNj (ORCPT ); Thu, 25 Mar 2021 09:13:39 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4E600619AB; Thu, 25 Mar 2021 13:13:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616678018; bh=SU4/OBPxMwNPXzLqu65mukDmGKUUnfnnnaECcXsYwjo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c47bRiKJ0MIhhjijnITxedbXgf94FyIt8koK1Q6HYp0IRtdzpzW5yIPv6EP9kqgWP mEe34a8NrxSCTt917ciwQWhtsTBSZ6wTkgL1DnBPPZYNF+XH/w0wGMuXwQpBi9Br7s TjviWI/pF4CgqHqY3hHNefYwOHMo1NFnX0OmSHKCxiMK1QHsL8syxggxZh971jwhLN ErFi4azk9lRU3ZhskuTDLM4F3c5mFujoPcyGlH2JN6vfIZf7rw+3FxR6+grGrffoaH ReF43/uc3vWC9ULw9VKOSUrpgqDs7vtD1ZykCUoCsCy2jHNZ3a3zdTuSR+INZuwBkg dOzbEsFc+bT9g== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Andrew Lunn , "David S . Miller" , Florian Fainelli , Heiner Kallweit , Russell King , kuba@kernel.org Cc: =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH net-next v2 08/12] net: phy: marvell10g: support all rate matching modes Date: Thu, 25 Mar 2021 14:12:46 +0100 Message-Id: <20210325131250.15901-9-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210325131250.15901-1-kabel@kernel.org> References: <20210325131250.15901-1-kabel@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add support for all rate matching modes, not only for 10gbase-r. Signed-off-by: Marek Behún --- drivers/net/phy/marvell10g.c | 67 ++++++++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 10 deletions(-) diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index b49cff895cdd..025473512581 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -124,6 +124,7 @@ struct mv3310_priv { enum mv3310_model model; u32 firmware_ver; + phy_interface_t const_interface; bool rate_match; struct device *hwmon_dev; @@ -512,11 +513,56 @@ static bool mv3310_has_pma_ngbaset_quirk(struct phy_device *phydev) MV_PHY_ALASKA_NBT_QUIRK_MASK) == MV_PHY_ALASKA_NBT_QUIRK_REV; } -static int mv3310_config_init(struct phy_device *phydev) +static int mv2110_init_interface(struct phy_device *phydev) +{ + struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev); + int mactype; + + mactype = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MV_PMA_21X0_PORT_CTRL); + if (mactype < 0) + return mactype; + + mactype &= MV_PMA_21X0_PORT_CTRL_MACTYPE_MASK; + + if (mactype == MV_PMA_21X0_PORT_CTRL_MACTYPE_10GBASER_RATE_MATCH) { + priv->rate_match = true; + priv->const_interface = PHY_INTERFACE_MODE_10GBASER; + } + + return 0; +} + +static int mv3310_init_interface(struct phy_device *phydev) { struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev); + int mactype; + + mactype = phy_read_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL); + if (mactype < 0) + return mactype; + + mactype &= MV_V2_33X0_PORT_CTRL_MACTYPE_MASK; + + if (mactype == MV_V2_33X0_PORT_CTRL_MACTYPE_10GBASER_RATE_MATCH || + mactype == MV_V2_33X0_PORT_CTRL_MACTYPE_RXAUI_RATE_MATCH || + (mactype == MV_V2_3310_PORT_CTRL_MACTYPE_XAUI_RATE_MATCH && + priv->model == MV_MODEL_88X3310)) + priv->rate_match = true; + + if (mactype == MV_V2_33X0_PORT_CTRL_MACTYPE_10GBASER_RATE_MATCH) + priv->const_interface = PHY_INTERFACE_MODE_10GBASER; + else if (mactype == MV_V2_33X0_PORT_CTRL_MACTYPE_RXAUI_RATE_MATCH) + priv->const_interface = PHY_INTERFACE_MODE_RXAUI; + else if (priv->model == MV_MODEL_88X3310 && + mactype == MV_V2_3310_PORT_CTRL_MACTYPE_XAUI_RATE_MATCH) + priv->const_interface = PHY_INTERFACE_MODE_XAUI; + + return 0; +} + +static int mv3310_config_init(struct phy_device *phydev) +{ int err; - int val; /* Check that the PHY interface type is compatible */ if (phydev->interface != PHY_INTERFACE_MODE_SGMII && @@ -535,11 +581,12 @@ static int mv3310_config_init(struct phy_device *phydev) if (err) return err; - val = phy_read_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL); - if (val < 0) - return val; - priv->rate_match = ((val & MV_V2_33X0_PORT_CTRL_MACTYPE_MASK) == - MV_V2_33X0_PORT_CTRL_MACTYPE_10GBASER_RATE_MATCH); + if (phydev->drv->phy_id == MARVELL_PHY_ID_88E2110) + err = mv2110_init_interface(phydev); + else + err = mv3310_init_interface(phydev); + if (err < 0) + return err; /* Enable EDPD mode - saving 600mW */ return mv3310_set_edpd(phydev, ETHTOOL_PHY_EDPD_DFLT_TX_MSECS); @@ -649,12 +696,12 @@ static void mv3310_update_interface(struct phy_device *phydev) { struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev); - /* In "XFI with Rate Matching" mode the PHY interface is fixed at - * 10Gb. The PHY adapts the rate to actual wire speed with help of + /* In all of the "* with Rate Matching" modes the PHY interface is fixed + * at 10Gb. The PHY adapts the rate to actual wire speed with help of * internal 16KB buffer. */ if (priv->rate_match) { - phydev->interface = PHY_INTERFACE_MODE_10GBASER; + phydev->interface = priv->const_interface; return; } From patchwork Thu Mar 25 13:12:47 2021 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: 12164115 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 X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C157C433E2 for ; Thu, 25 Mar 2021 13:14:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 54F0B619CB for ; Thu, 25 Mar 2021 13:14:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230523AbhCYNOM (ORCPT ); Thu, 25 Mar 2021 09:14:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:52726 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230078AbhCYNNl (ORCPT ); Thu, 25 Mar 2021 09:13:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 271BB619FE; Thu, 25 Mar 2021 13:13:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616678020; bh=Dh8a329t1G45WAPNL3cfzHwBiAaBysqzITPpx1n4aHw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XYvNH4zcRKt/M1MEeQ0AQyF8tUVqf00OwUXG5tMHrUEH5M4m33YNtN2dTeuguHbbF wGWJJF1ZrcAOOS9wsdWpMx3JcuyxFmrP/douYljnNCRPK5OGMwpKuvpYsiUo0rBvQp SF8oGOKoDNmOwUhDYD4sjM7eAfhX0E68y3/cA5725eQJCb1HGa50i9V6/fp0PvlQrP OdruZzoS2RwSIB2gUUgIr8+Lbw74XDKAZUhtm/Wtgc9Pg9P82XxYlj2EDZG/LDK2wj I3N3ZyTy0hqJzk8C4uH6Hv4bGz0Mwh5vc3fuL7YcBlF2xype2IzWczfzTySER6elNq Vuypee3V0bMug== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Andrew Lunn , "David S . Miller" , Florian Fainelli , Heiner Kallweit , Russell King , kuba@kernel.org Cc: =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH net-next v2 09/12] net: phy: marvell10g: support other MACTYPEs Date: Thu, 25 Mar 2021 14:12:47 +0100 Message-Id: <20210325131250.15901-10-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210325131250.15901-1-kabel@kernel.org> References: <20210325131250.15901-1-kabel@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Currently the only "changing" MACTYPE we support is when the PHY changes between 10gbase-r / 5gbase-r / 2500base-x / sgmii Add support for xaui / 5gbase-r / 2500base-x / sgmii rxaui / 5gbase-r / 2500base-x / sgmii Signed-off-by: Marek Behún --- drivers/net/phy/marvell10g.c | 95 +++++++++++++++++++++++------------- 1 file changed, 60 insertions(+), 35 deletions(-) diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index 025473512581..6df67c12f012 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -524,10 +524,21 @@ static int mv2110_init_interface(struct phy_device *phydev) mactype &= MV_PMA_21X0_PORT_CTRL_MACTYPE_MASK; - if (mactype == MV_PMA_21X0_PORT_CTRL_MACTYPE_10GBASER_RATE_MATCH) { + if (mactype == MV_PMA_21X0_PORT_CTRL_MACTYPE_10GBASER_RATE_MATCH) priv->rate_match = true; + + if (mactype == MV_PMA_21X0_PORT_CTRL_MACTYPE_USXGMII || + (priv->model == MV_MODEL_88E218X && + (mactype == MV_PMA_2180_PORT_CTRL_MACTYPE_DXGMII || + mactype == MV_PMA_2180_PORT_CTRL_MACTYPE_QXGMII))) + priv->const_interface = PHY_INTERFACE_MODE_USXGMII; + else if (mactype == MV_PMA_21X0_PORT_CTRL_MACTYPE_10GBASER_RATE_MATCH) priv->const_interface = PHY_INTERFACE_MODE_10GBASER; - } + else if (mactype == MV_PMA_21X0_PORT_CTRL_MACTYPE_5GBASER || + mactype == MV_PMA_21X0_PORT_CTRL_MACTYPE_5GBASER_NO_SGMII_AN) + priv->const_interface = PHY_INTERFACE_MODE_NA; + else + return -EINVAL; return 0; } @@ -549,13 +560,23 @@ static int mv3310_init_interface(struct phy_device *phydev) priv->model == MV_MODEL_88X3310)) priv->rate_match = true; - if (mactype == MV_V2_33X0_PORT_CTRL_MACTYPE_10GBASER_RATE_MATCH) + if (mactype == MV_V2_33X0_PORT_CTRL_MACTYPE_USXGMII) + priv->const_interface = PHY_INTERFACE_MODE_USXGMII; + else if (mactype == MV_V2_33X0_PORT_CTRL_MACTYPE_10GBASER_RATE_MATCH || + mactype == MV_V2_33X0_PORT_CTRL_MACTYPE_10GBASER_NO_SGMII_AN || + mactype == MV_V2_33X0_PORT_CTRL_MACTYPE_10GBASER) priv->const_interface = PHY_INTERFACE_MODE_10GBASER; - else if (mactype == MV_V2_33X0_PORT_CTRL_MACTYPE_RXAUI_RATE_MATCH) + else if (mactype == MV_V2_33X0_PORT_CTRL_MACTYPE_RXAUI_RATE_MATCH || + mactype == MV_V2_33X0_PORT_CTRL_MACTYPE_RXAUI || + (mactype == MV_V2_3340_PORT_CTRL_MACTYPE_RXAUI_NO_SGMII_AN && + priv->model == MV_MODEL_88X3340)) priv->const_interface = PHY_INTERFACE_MODE_RXAUI; else if (priv->model == MV_MODEL_88X3310 && - mactype == MV_V2_3310_PORT_CTRL_MACTYPE_XAUI_RATE_MATCH) + (mactype == MV_V2_3310_PORT_CTRL_MACTYPE_XAUI_RATE_MATCH || + mactype == MV_V2_3310_PORT_CTRL_MACTYPE_XAUI)) priv->const_interface = PHY_INTERFACE_MODE_XAUI; + else + return -EINVAL; return 0; } @@ -585,8 +606,10 @@ static int mv3310_config_init(struct phy_device *phydev) err = mv2110_init_interface(phydev); else err = mv3310_init_interface(phydev); - if (err < 0) + if (err < 0) { + phydev_err(phydev, "MACTYPE configuration invalid\n"); return err; + } /* Enable EDPD mode - saving 600mW */ return mv3310_set_edpd(phydev, ETHTOOL_PHY_EDPD_DFLT_TX_MSECS); @@ -696,6 +719,9 @@ static void mv3310_update_interface(struct phy_device *phydev) { struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev); + if (!phydev->link) + return; + /* In all of the "* with Rate Matching" modes the PHY interface is fixed * at 10Gb. The PHY adapts the rate to actual wire speed with help of * internal 16KB buffer. @@ -705,35 +731,34 @@ static void mv3310_update_interface(struct phy_device *phydev) return; } - if ((phydev->interface == PHY_INTERFACE_MODE_SGMII || - phydev->interface == PHY_INTERFACE_MODE_2500BASEX || - phydev->interface == PHY_INTERFACE_MODE_5GBASER || - phydev->interface == PHY_INTERFACE_MODE_10GBASER) && - phydev->link) { - /* The PHY automatically switches its serdes interface (and - * active PHYXS instance) between Cisco SGMII, 10GBase-R and - * 2500BaseX modes according to the speed. Florian suggests - * setting phydev->interface to communicate this to the MAC. - * Only do this if we are already in one of the above modes. - */ - switch (phydev->speed) { - case SPEED_10000: - phydev->interface = PHY_INTERFACE_MODE_10GBASER; - break; - case SPEED_5000: - phydev->interface = PHY_INTERFACE_MODE_5GBASER; - break; - 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; - } + if (priv->const_interface == PHY_INTERFACE_MODE_USXGMII) { + phydev->interface = PHY_INTERFACE_MODE_USXGMII; + return; + } + + /* The PHY automatically switches its serdes interface (and active PHYXS + * instance) between Cisco SGMII, 2500BaseX, 5GBase-R and 10GBase-R / + * xaui / rxaui modes according to the speed. + * Florian suggests setting phydev->interface to communicate this to the + * MAC. Only do this if we are already in one of the above modes. + */ + switch (phydev->speed) { + case SPEED_10000: + phydev->interface = priv->const_interface; + break; + case SPEED_5000: + phydev->interface = PHY_INTERFACE_MODE_5GBASER; + break; + 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; } } From patchwork Thu Mar 25 13:12:48 2021 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: 12164117 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 X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA8A4C433E3 for ; Thu, 25 Mar 2021 13:14:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C632261A11 for ; Thu, 25 Mar 2021 13:14:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231131AbhCYNOO (ORCPT ); Thu, 25 Mar 2021 09:14:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:52748 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230339AbhCYNNm (ORCPT ); Thu, 25 Mar 2021 09:13:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F27D261A1E; Thu, 25 Mar 2021 13:13:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616678022; bh=ZFJurUnJK78TF7LRyAyoDsdJum1NzykQEtrffQ3FDZk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cl36vQldNpzyg73lqz6qO2hO3dTt0zyQPJRoS8nwPdqAEMZ9yX1PWotP5u6PHrjiZ FIMFj8rv2H3NhKZrThcQeQw/p28NshSwevClpw2WyfVuhF+Oyx3lbxy78kAnEnaVqz YK7dY6vKyHZJ6T3n4UfydxOvxWN8G3mcX40dl8N69FsKASRU5UvZsiG/Olxya4Js02 J0vTALZ623GiEj+DDV1yWEx342IQKHp24S2ixzPK0u7cPvSF2xNkyUS22QnjCvOSTI Zvolg2ahjJ5SZANHT8wH88zUIcTi2a60N0u45qiLeYdxn5O01p7aeHM9Pjhp2rK9mD iol3J0YiDRJIw== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Andrew Lunn , "David S . Miller" , Florian Fainelli , Heiner Kallweit , Russell King , kuba@kernel.org Cc: =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH net-next v2 10/12] net: phy: add constants for 2.5G and 5G speed in PCS speed register Date: Thu, 25 Mar 2021 14:12:48 +0100 Message-Id: <20210325131250.15901-11-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210325131250.15901-1-kabel@kernel.org> References: <20210325131250.15901-1-kabel@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add constants for 2.5G and 5G speed in PCS speed register into mdio.h. Signed-off-by: Marek Behún --- 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 3f302e2523b2..bdf77dffa5a4 100644 --- a/include/uapi/linux/mdio.h +++ b/include/uapi/linux/mdio.h @@ -120,6 +120,8 @@ #define MDIO_PMA_SPEED_100 0x0020 /* 100M capable */ #define MDIO_PMA_SPEED_10 0x0040 /* 10M 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 */ /* Device present registers. */ #define MDIO_DEVS_PRESENT(devad) (1 << (devad)) From patchwork Thu Mar 25 13:12:49 2021 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: 12164121 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 X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10718C433E4 for ; Thu, 25 Mar 2021 13:14:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D881961A1B for ; Thu, 25 Mar 2021 13:14:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231146AbhCYNOP (ORCPT ); Thu, 25 Mar 2021 09:14:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:52788 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230476AbhCYNNo (ORCPT ); Thu, 25 Mar 2021 09:13:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C8D23619FE; Thu, 25 Mar 2021 13:13:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616678024; bh=AGy39mxpzO9YbDrFrYnmmSNBQlvEaq72+Rxn1faWq4c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D0pke2gqmttyIwotCSWXB2zIg/GSXGezlItEzpigjbRpobDZENbF77ysZQqqkBoSC FNgNP9zYU6nb4qfdlC8Lvu1XYt2viRfMPpXwp8VNNdmPsjSOiKOgQxZHH8HPSl0qme qZMsWp0w/l4ZNXy8q1pMdEU1sYaMCcrtNZmjoGm0pZUt4tPS1KFM+w0NGdZeMU6BIA 20okar+ghQv6UMebBFBTLk+jvkaRW+bRZrbzEmE/GHWPELUtCwbmXyM0DMxH+2k/1p cF7MPKb75K8kOQmyB2n0ifyH+wXqtqzl3/Mx+f1F5XXhYa0Wu86s9Idh3T5GYXLZh0 gAGxwdV+R26dg== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Andrew Lunn , "David S . Miller" , Florian Fainelli , Heiner Kallweit , Russell King , kuba@kernel.org Cc: =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH net-next v2 11/12] net: phy: marvell10g: print exact model Date: Thu, 25 Mar 2021 14:12:49 +0100 Message-Id: <20210325131250.15901-12-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210325131250.15901-1-kabel@kernel.org> References: <20210325131250.15901-1-kabel@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Print exact mode, one of 88E2110 88E2111 88E2180 88E2181 88X3310 88X3310P 88X3340 88X3340P Signed-off-by: Marek Behún --- drivers/net/phy/marvell10g.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index 6df67c12f012..84f24fcb832c 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -33,6 +33,8 @@ #define MV_PHY_ALASKA_NBT_QUIRK_REV (MARVELL_PHY_ID_88X3310 | 0xa) enum { + MV_PMA_XGSTAT = 0xc001, + MV_PMA_XGSTAT_NO_MACSEC = BIT(12), MV_PMA_FW_VER0 = 0xc011, MV_PMA_FW_VER1 = 0xc012, MV_PMA_21X0_PORT_CTRL = 0xc04a, @@ -397,6 +399,7 @@ static int mv3310_probe(struct phy_device *phydev) { struct mv3310_priv *priv; u32 mmd_mask = MDIO_DEVS_PMAPMD | MDIO_DEVS_AN; + bool has_5g, has_macsec; int ret, nports; if (!phydev->is_c45 || @@ -443,12 +446,24 @@ static int mv3310_probe(struct phy_device *phydev) switch (phydev->drv->phy_id) { case MARVELL_PHY_ID_88X3310: + ret = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MV_PMA_XGSTAT); + if (ret < 0) + return ret; + + has_macsec = !(ret & MV_PMA_XGSTAT_NO_MACSEC); + if (nports == 4) priv->model = MV_MODEL_88X3340; else if (nports == 1) priv->model = MV_MODEL_88X3310; break; case MARVELL_PHY_ID_88E2110: + ret = phy_read_mmd(phydev, MDIO_MMD_PCS, MDIO_SPEED); + if (ret < 0) + return ret; + + has_5g = ret & MDIO_PCS_SPEED_5G; + if (nports == 8) priv->model = MV_MODEL_88E218X; else if (nports == 1) @@ -458,7 +473,17 @@ static int mv3310_probe(struct phy_device *phydev) unreachable(); } - if (!priv->model) { + switch (priv->model) { + case MV_MODEL_88E211X: + case MV_MODEL_88E218X: + phydev_info(phydev, "model 88E21%d%d\n", nports, !has_5g); + break; + case MV_MODEL_88X3310: + case MV_MODEL_88X3340: + phydev_info(phydev, "model 88X33%d0%s\n", nports, + has_macsec ? "P" : ""); + break; + default: phydev_err(phydev, "unknown PHY model (nports = %i)\n", nports); return -ENODEV; } From patchwork Thu Mar 25 13:12:50 2021 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: 12164119 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 X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C4E6C433E5 for ; Thu, 25 Mar 2021 13:14:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EC718619CB for ; Thu, 25 Mar 2021 13:14:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231183AbhCYNOP (ORCPT ); Thu, 25 Mar 2021 09:14:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:52808 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230163AbhCYNNq (ORCPT ); Thu, 25 Mar 2021 09:13:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9FBB1619A3; Thu, 25 Mar 2021 13:13:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616678026; bh=pYFKKdkwNtpe0POAWCWJVc+BLLceRhX5L8OI7ja2qt0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z3OH+Mgyi10kNKPKjllRXPcxe6rGpoBSz5aO8J92XjenT/ifZjXcfa9HYJIOeblgo ATqpkYIOI833BSPBcEr6lHyTMBP1BRxOvo6HPpygcdY7DV/54bcxkNSbKo2BjP+vz5 LsYqO3g6qIgAANO7HvKNOP3JHlSc34wbg4LSTJdlRKxsJH8zeFay85sWz2FqYwYp/o DE92d2BEfbNYV2Qg8P+70H8m9l3z+ivloRqLXX4nyZ0qPbmpfhQ+KiQiCIEoT4QXIi SGPBjTOR3w+y0PckiPEPJ/YLzel1ZiBJ8yi7m2LuO8Sm34aLozP242HWHb57vkg4Vu ZpWSd8ke+Gisg== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Andrew Lunn , "David S . Miller" , Florian Fainelli , Heiner Kallweit , Russell King , kuba@kernel.org Cc: =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH net-next v2 12/12] net: phy: marvell10g: better check for compatible interface Date: Thu, 25 Mar 2021 14:12:50 +0100 Message-Id: <20210325131250.15901-13-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210325131250.15901-1-kabel@kernel.org> References: <20210325131250.15901-1-kabel@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Do a model-specific check for compatible interface: - 88X3340 does not support XAUI - 88E21XX does not support XAUI and RXAUI - 88E21X1 does not support 5gbase-r Signed-off-by: Marek Behún --- drivers/net/phy/marvell10g.c | 38 ++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index 84f24fcb832c..510e27c766e6 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -124,6 +124,7 @@ enum mv3310_model { struct mv3310_priv { enum mv3310_model model; + bool has_5g; u32 firmware_ver; phy_interface_t const_interface; @@ -399,7 +400,7 @@ static int mv3310_probe(struct phy_device *phydev) { struct mv3310_priv *priv; u32 mmd_mask = MDIO_DEVS_PMAPMD | MDIO_DEVS_AN; - bool has_5g, has_macsec; + bool has_macsec; int ret, nports; if (!phydev->is_c45 || @@ -451,6 +452,7 @@ static int mv3310_probe(struct phy_device *phydev) return ret; has_macsec = !(ret & MV_PMA_XGSTAT_NO_MACSEC); + priv->has_5g = true; if (nports == 4) priv->model = MV_MODEL_88X3340; @@ -462,7 +464,7 @@ static int mv3310_probe(struct phy_device *phydev) if (ret < 0) return ret; - has_5g = ret & MDIO_PCS_SPEED_5G; + priv->has_5g = ret & MDIO_PCS_SPEED_5G; if (nports == 8) priv->model = MV_MODEL_88E218X; @@ -476,7 +478,7 @@ static int mv3310_probe(struct phy_device *phydev) switch (priv->model) { case MV_MODEL_88E211X: case MV_MODEL_88E218X: - phydev_info(phydev, "model 88E21%d%d\n", nports, !has_5g); + phydev_info(phydev, "model 88E21%d%d\n", nports, !priv->has_5g); break; case MV_MODEL_88X3310: case MV_MODEL_88X3340: @@ -543,6 +545,15 @@ static int mv2110_init_interface(struct phy_device *phydev) struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev); int mactype; + /* Check that the PHY interface type is compatible */ + if (phydev->interface != PHY_INTERFACE_MODE_SGMII && + phydev->interface != PHY_INTERFACE_MODE_2500BASEX && + (phydev->interface != PHY_INTERFACE_MODE_5GBASER || + !priv->has_5g) && + phydev->interface != PHY_INTERFACE_MODE_10GBASER && + phydev->interface != PHY_INTERFACE_MODE_USXGMII) + return -ENODEV; + mactype = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MV_PMA_21X0_PORT_CTRL); if (mactype < 0) return mactype; @@ -573,6 +584,17 @@ static int mv3310_init_interface(struct phy_device *phydev) struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev); int mactype; + /* Check that the PHY interface type is compatible */ + if (phydev->interface != PHY_INTERFACE_MODE_SGMII && + phydev->interface != PHY_INTERFACE_MODE_2500BASEX && + phydev->interface != PHY_INTERFACE_MODE_5GBASER && + (phydev->interface != PHY_INTERFACE_MODE_XAUI || + priv->model == MV_MODEL_88X3340) && + phydev->interface != PHY_INTERFACE_MODE_RXAUI && + phydev->interface != PHY_INTERFACE_MODE_10GBASER && + phydev->interface != PHY_INTERFACE_MODE_USXGMII) + return -ENODEV; + mactype = phy_read_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL); if (mactype < 0) return mactype; @@ -610,16 +632,6 @@ static int mv3310_config_init(struct phy_device *phydev) { int err; - /* Check that the PHY interface type is compatible */ - if (phydev->interface != PHY_INTERFACE_MODE_SGMII && - phydev->interface != PHY_INTERFACE_MODE_2500BASEX && - phydev->interface != PHY_INTERFACE_MODE_5GBASER && - phydev->interface != PHY_INTERFACE_MODE_XAUI && - phydev->interface != PHY_INTERFACE_MODE_RXAUI && - phydev->interface != PHY_INTERFACE_MODE_10GBASER && - phydev->interface != PHY_INTERFACE_MODE_USXGMII) - return -ENODEV; - phydev->mdix_ctrl = ETH_TP_MDI_AUTO; /* Power up so reset works */