From patchwork Wed Apr 7 20:22: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: 12189311 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.0 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,URIBL_BLOCKED,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 8810CC433ED for ; Wed, 7 Apr 2021 20:24:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4F98261184 for ; Wed, 7 Apr 2021 20:24:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356087AbhDGUYD (ORCPT ); Wed, 7 Apr 2021 16:24:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:55632 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356085AbhDGUXq (ORCPT ); Wed, 7 Apr 2021 16:23:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2C95A611C1; Wed, 7 Apr 2021 20:23:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617827016; bh=6wldpr+hTsALr9hUbIjmafvYQKRQa6/aGrR0cxZwLH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NL2f8AvFXFQ1mA0A2K02qxD8qaiN0t5immrPsjijPUvKNq49F35GwUvIzh44bDIN9 a/LKDMroPDHLjsGkyrayQioFwKkAilJ6Cg0PwAvZ39rzyfgnrQEfHKT9JNEwwuMVk7 kWu+Fjh/dj40zborKwJe3T9Nb7MK1zZCIOQBy5mJtY6xt87BsOgcLH95PeltqhqSXe UWYXKOfAf5Lg37tathrPf3Yz1qI2ktPHuKYGFhmMDjjOkiB26/pM79aluuy7nFJ6OZ YYE8eOn2d1XFfLkje0kvUXZYUqo2mGEeRiwoVqcGgpQDHnEZEL3NkG34IJNyrjJ4dG OgUtTZjJbcToQ== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King , Andrew Lunn Cc: "David S . Miller" , kuba@kernel.org, =?utf-8?q?Mar?= =?utf-8?q?ek_Beh=C3=BAn?= Subject: [PATCH net-next v4 01/16] net: phy: marvell10g: rename register Date: Wed, 7 Apr 2021 22:22:39 +0200 Message-Id: <20210407202254.29417-2-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210407202254.29417-1-kabel@kernel.org> References: <20210407202254.29417-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 Reviewed-by: Andrew Lunn --- 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 Wed Apr 7 20:22: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: 12189319 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.0 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,URIBL_BLOCKED,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 5BBE4C433B4 for ; Wed, 7 Apr 2021 20:24:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2626361184 for ; Wed, 7 Apr 2021 20:24:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356113AbhDGUYE (ORCPT ); Wed, 7 Apr 2021 16:24:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:55644 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356086AbhDGUXr (ORCPT ); Wed, 7 Apr 2021 16:23:47 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B1C186120E; Wed, 7 Apr 2021 20:23:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617827017; bh=hFLQmhj0ezwVUZzvrcnF7suIFqWuj3BoQv+SuX2CxlM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vPMjgPgcNbbr1Jysj3NodqD2A7wFrIFbfSoyfphTo491eaGcb/KQ9kdR4o8xtOdYA 4uwD9Jc+RfRx76Vj6uSxkoHKkpADUQT06k/cXaMz+9sl93kfjvylbuE8T1WSanlaFV ZxYGd3XJP3fRvCytZVRhkr5tWWpSLWiF4tWsHtcp2RSq94glknlsdxbQpTcsAX/uCu 8Ey5R8zopo+DrXJhxn0msa/YEguvFYvqNnPPo2LzBitXBeZJo6hNxLvYQInJ8wW/4R 7y/1SaUYkAhbJbDKcChr4nOgllh7BDoIo952gYsRT8DnASmgPdZ5ILY94NRquzXci/ yruVBQ1Apu1ww== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King , Andrew Lunn Cc: "David S . Miller" , kuba@kernel.org, =?utf-8?q?Mar?= =?utf-8?q?ek_Beh=C3=BAn?= Subject: [PATCH net-next v4 02/16] net: phy: marvell10g: fix typo Date: Wed, 7 Apr 2021 22:22:40 +0200 Message-Id: <20210407202254.29417-3-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210407202254.29417-1-kabel@kernel.org> References: <20210407202254.29417-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 Reviewed-by: Andrew Lunn --- 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 Wed Apr 7 20:22: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: 12189317 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.0 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,URIBL_BLOCKED,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 850B5C43460 for ; Wed, 7 Apr 2021 20:24:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4346961245 for ; Wed, 7 Apr 2021 20:24:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356124AbhDGUYG (ORCPT ); Wed, 7 Apr 2021 16:24:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:55656 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356088AbhDGUXt (ORCPT ); Wed, 7 Apr 2021 16:23:49 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 413E56124C; Wed, 7 Apr 2021 20:23:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617827019; bh=YnZ1WlkKxRhoo0AnsQAL/iHERvmV0/UdEzK9TPgfoUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NxPkKr2p1FW+loWzKw8cMPSsCqVCuroHTm/SQgFnim6mcSrHuPdlMS4iFfS+rQkVN 5UrMk/zdbS117bXWDBERd+PX9REu8iipKoJYsl3Qx6jbv328VH0WHJGC/KcA3IeBo5 DCaIsUqI3pknHi4Hs4r//CTR/2ltGAZ9MokgZYU+MR9E9NROrfqOBtU3gSnLKJ668l TxErsKi3o0dr90oagmr57P9T/+6hRSGU8fS8ajnFmjOqS+qQj/l4ET7zzh4bouZvqI xyDvVLeg9mtvsv9XrzFG7xzb+eJ2VbO00LwY+qv0X4WetiMynfekPqaRdIbKRINF9N GYqVZvpA5VakA== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King , Andrew Lunn Cc: "David S . Miller" , kuba@kernel.org, =?utf-8?q?Mar?= =?utf-8?q?ek_Beh=C3=BAn?= Subject: [PATCH net-next v4 03/16] net: phy: marvell10g: allow 5gbase-r and usxgmii Date: Wed, 7 Apr 2021 22:22:41 +0200 Message-Id: <20210407202254.29417-4-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210407202254.29417-1-kabel@kernel.org> References: <20210407202254.29417-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 These modes are also supported by these PHYs. Signed-off-by: Marek Behún Reviewed-by: Andrew Lunn --- 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 Wed Apr 7 20:22: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: 12189335 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.0 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 2930AC433B4 for ; Wed, 7 Apr 2021 20:25:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E5A626100A for ; Wed, 7 Apr 2021 20:25:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356280AbhDGUZY (ORCPT ); Wed, 7 Apr 2021 16:25:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:55668 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356089AbhDGUXv (ORCPT ); Wed, 7 Apr 2021 16:23:51 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C6771611CC; Wed, 7 Apr 2021 20:23:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617827021; bh=nX4eoEhxrg3W0ZsogIGxXVicdpbr0rV/OQUgZvgLmAw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uy0XiSdIvVN1Ru/I8I/ymCaYef+T4CIc/NhKWVEo4sQcfjakPi9l6LRCmFOTA674I Flg1J1XQVM6999YBpf4U8TZRtWLia0jDl4EIeRwJt60OFErSezdM08piptiO0BkxPE lXPrDfFmnY3Woiv0hGGmVXJ7wjabnT0cpDJfnwkWTa31Q2K1a/z/I4KlHEIUYOnulg iqPAwCF5LjZiQZyl385D1JLzmsicbRRLA2hGTwF9mlcf9TCth8wj3l+l/ZdxM7+JRw JpafZiX8HXtjYMQ/KZDRvt3p9oEuWcPQ0pjmuHu41N55U7FePD9j8N67OjZeZZHGQl KU5Pe/IF292ag== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King , Andrew Lunn Cc: "David S . Miller" , kuba@kernel.org, =?utf-8?q?Mar?= =?utf-8?q?ek_Beh=C3=BAn?= Subject: [PATCH net-next v4 04/16] net: phy: marvell10g: indicate 88X33x0 only port control registers Date: Wed, 7 Apr 2021 22:22:42 +0200 Message-Id: <20210407202254.29417-5-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210407202254.29417-1-kabel@kernel.org> References: <20210407202254.29417-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 Rename port control registers to indicate that they are valid only 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 Wed Apr 7 20:22: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: 12189337 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.0 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,URIBL_BLOCKED,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 F240FC433ED for ; Wed, 7 Apr 2021 20:25:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C3549611EE for ; Wed, 7 Apr 2021 20:25:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356205AbhDGUZX (ORCPT ); Wed, 7 Apr 2021 16:25:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:55656 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236539AbhDGUXw (ORCPT ); Wed, 7 Apr 2021 16:23:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6940561184; Wed, 7 Apr 2021 20:23:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617827022; bh=5qefKy3s6QKoiPklCW8pRP7HOwFxnURhDrcL6eb7OVY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kRs6Vv7bragxUe0KI0tydmrL/Jiuc8Orh+m7hpejfyU4lnT+/qNVCnZzYFIZ+EFrK D/zCdvsnuejCSJKooXeR/MFycqX9lgq180231bJBbm7vy8DRA8s9jaOuCIUn3b4zk/ LHFn0u+b7MYphLObfaE82ibjz1BI0bJZfhFj7Kv5OClgxYNZvl5Fq1nVbNhSN7z3XP jqa5Hcsbyx/XeP9FrdPsv07WEQdCdOP43qvDdZgsfH1YLyQh4yeHoZFyftD9Z8x2dC qw/Ixrj7hkCzWtxPFVspo/OCTF90ssYUXLdl5vwNibF0mhwcnyR4jtGWi2iWd0dy37 KEV5tVqIjB2zA== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King , Andrew Lunn Cc: "David S . Miller" , kuba@kernel.org, =?utf-8?q?Mar?= =?utf-8?q?ek_Beh=C3=BAn?= Subject: [PATCH net-next v4 05/16] net: phy: marvell10g: add all MACTYPE definitions for 88X33x0 Date: Wed, 7 Apr 2021 22:22:43 +0200 Message-Id: <20210407202254.29417-6-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210407202254.29417-1-kabel@kernel.org> References: <20210407202254.29417-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 Reviewed-by: Andrew Lunn --- 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 Wed Apr 7 20:22: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: 12189339 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.0 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,URIBL_BLOCKED,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 2FA1EC433B4 for ; Wed, 7 Apr 2021 20:25:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0F6E361184 for ; Wed, 7 Apr 2021 20:25:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356218AbhDGUZ1 (ORCPT ); Wed, 7 Apr 2021 16:25:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:55668 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356091AbhDGUXy (ORCPT ); Wed, 7 Apr 2021 16:23:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F250D611C1; Wed, 7 Apr 2021 20:23:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617827024; bh=hAvCfLCkBUvIsNZca5EkKhAM/mZQHGOhR0RQDN3T/FU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AUvIIF0X4hXF+ART5z+5SbEz84TJ71rltb6quvF522QS5m5PZeUh9hXzeDiZ2LlQv YfF8tvWGExf11eNb2SD8mGPxxpm2SajVEnfHolzvM0NJ31AK1Hqkzxx/v3zNMbzAZq i6eLpHx51MCKCdxdnaa8TzwDX2ldJejKMLyGdqL31s11ylNfA50PFMWrq1MtyitcZ/ R9+G31lFYcMLfbx4g1D0IjjZiUsjXn8I+zw4yTmipwfkptI6OZAB/Ceedktez4asqT 5jzaGfVOhLxB7tOWsFsu9VWvP9XW9Cg5UlB2RcCTw7JmAS+wGCzVw2bhW5hZqYN+Zb 3MOwOksAdfEDg== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King , Andrew Lunn Cc: "David S . Miller" , kuba@kernel.org, =?utf-8?q?Mar?= =?utf-8?q?ek_Beh=C3=BAn?= Subject: [PATCH net-next v4 06/16] net: phy: marvell10g: add MACTYPE definitions for 88E21xx Date: Wed, 7 Apr 2021 22:22:44 +0200 Message-Id: <20210407202254.29417-7-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210407202254.29417-1-kabel@kernel.org> References: <20210407202254.29417-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 Reviewed-by: Andrew Lunn --- 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 Wed Apr 7 20:22: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: 12189315 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.0 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 93C87C43461 for ; Wed, 7 Apr 2021 20:24:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 77DAE61184 for ; Wed, 7 Apr 2021 20:24:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356149AbhDGUYK (ORCPT ); Wed, 7 Apr 2021 16:24:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:55706 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356092AbhDGUXz (ORCPT ); Wed, 7 Apr 2021 16:23:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8397D61184; Wed, 7 Apr 2021 20:23:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617827025; bh=v1rvm3GmcERUJsNcXwqjjTt4y6wZDUDZDnGRj8Ktdm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V+SkEMcMOBjZBoUuVFIYcXJE6sCpMBPeXlS4AeSdbuXu8q1H0477x0zag0XAztWpQ TwmijqCKC57+C30AG8T+vezDbqOvWNfVZay553msrLbJ4GR6bw6gU8eO5ozUU4c0Eh DjecYgbh0O0MJ73N9y9myv02ZGAW5OPXPgmpAs92W65u5wI7e+FR51v1JnZuaTdv8y sRwyTJfhARYSr0mExOfIpMyt7wXizdt8O8ePu6vV7fIHipgiF4CjYj0dBpnYkwAkTW nXOXfFIFeyKc/M6DBqumS5N3D+AuZrFCguohSkalYu1i6tObJtsk5zovF4ooCHvRNB V59koJMHNTMbA== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King , Andrew Lunn Cc: "David S . Miller" , kuba@kernel.org, =?utf-8?q?Mar?= =?utf-8?q?ek_Beh=C3=BAn?= Subject: [PATCH net-next v4 07/16] net: phy: marvell10g: support all rate matching modes Date: Wed, 7 Apr 2021 22:22:45 +0200 Message-Id: <20210407202254.29417-8-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210407202254.29417-1-kabel@kernel.org> References: <20210407202254.29417-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 for 88X3310 (currently only 10gbase-r is supported, but xaui and rxaui can also be used). Add support for rate matching for 88E2110 (on 88E2110 the MACTYPE register is at a different place). Currently rate matching mode is selected by strapping pins (by setting the MACTYPE register). There is work in progress to enable this driver to deduce the best MACTYPE from the knowledge of which interface modes are supported by the host, but this work is not finished yet. Signed-off-by: Marek Behún Reviewed-by: Andrew Lunn --- drivers/net/phy/marvell10g.c | 103 +++++++++++++++++++++++++++++++---- 1 file changed, 92 insertions(+), 11 deletions(-) diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index 556c9b43860e..b0b3fccac65f 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -108,14 +108,25 @@ enum { MV_V2_TEMP_UNKNOWN = 0x9600, /* unknown function */ }; +struct mv3310_chip { + int (*get_mactype)(struct phy_device *phydev); + int (*init_interface)(struct phy_device *phydev, int mactype); +}; + struct mv3310_priv { u32 firmware_ver; bool rate_match; + phy_interface_t const_interface; struct device *hwmon_dev; char *hwmon_name; }; +static const struct mv3310_chip *to_mv3310_chip(struct phy_device *phydev) +{ + return phydev->drv->driver_data; +} + #ifdef CONFIG_HWMON static umode_t mv3310_hwmon_is_visible(const void *data, enum hwmon_sensor_types type, @@ -470,11 +481,67 @@ 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_get_mactype(struct phy_device *phydev) +{ + int mactype; + + mactype = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MV_PMA_21X0_PORT_CTRL); + if (mactype < 0) + return mactype; + + return mactype & MV_PMA_21X0_PORT_CTRL_MACTYPE_MASK; +} + +static int mv3310_get_mactype(struct phy_device *phydev) +{ + int mactype; + + mactype = phy_read_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL); + if (mactype < 0) + return mactype; + + return mactype & MV_V2_33X0_PORT_CTRL_MACTYPE_MASK; +} + +static int mv2110_init_interface(struct phy_device *phydev, int mactype) { struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev); - int err; - int val; + + priv->rate_match = false; + + 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, int mactype) +{ + struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev); + + priv->rate_match = false; + + 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->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 (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) +{ + const struct mv3310_chip *chip = to_mv3310_chip(phydev); + int err, mactype; /* Check that the PHY interface type is compatible */ if (phydev->interface != PHY_INTERFACE_MODE_SGMII && @@ -493,11 +560,13 @@ 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); + mactype = chip->get_mactype(phydev); + if (mactype < 0) + return mactype; + + err = chip->init_interface(phydev, mactype); + if (err) + return err; /* Enable EDPD mode - saving 600mW */ return mv3310_set_edpd(phydev, ETHTOOL_PHY_EDPD_DFLT_TX_MSECS); @@ -607,12 +676,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; } @@ -788,11 +857,22 @@ static int mv3310_set_tunable(struct phy_device *phydev, } } +static const struct mv3310_chip mv3310_type = { + .get_mactype = mv3310_get_mactype, + .init_interface = mv3310_init_interface, +}; + +static const struct mv3310_chip mv2110_type = { + .get_mactype = mv2110_get_mactype, + .init_interface = mv2110_init_interface, +}; + static struct phy_driver mv3310_drivers[] = { { .phy_id = MARVELL_PHY_ID_88X3310, .phy_id_mask = MARVELL_PHY_ID_MASK, .name = "mv88x3310", + .driver_data = &mv3310_type, .get_features = mv3310_get_features, .config_init = mv3310_config_init, .probe = mv3310_probe, @@ -810,6 +890,7 @@ static struct phy_driver mv3310_drivers[] = { .phy_id = MARVELL_PHY_ID_88E2110, .phy_id_mask = MARVELL_PHY_ID_MASK, .name = "mv88x2110", + .driver_data = &mv2110_type, .probe = mv3310_probe, .suspend = mv3310_suspend, .resume = mv3310_resume, From patchwork Wed Apr 7 20:22: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: 12189313 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.0 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 977B3C43470 for ; Wed, 7 Apr 2021 20:24:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 681176128A for ; Wed, 7 Apr 2021 20:24:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356137AbhDGUYI (ORCPT ); Wed, 7 Apr 2021 16:24:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:55718 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356093AbhDGUX5 (ORCPT ); Wed, 7 Apr 2021 16:23:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 157A6611C1; Wed, 7 Apr 2021 20:23:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617827027; bh=SOU+bSYobPOpQWz3m5IIcFdD5rItJj5CT5SwXjwCn9g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sjRJXmCrV6aYqTRGnVlZhlgV/yCqVeo317fNeBI8xBnw38tRRvoQuttUSIcex779T vhvGa004IDx1JJf9OrVrK/MI/qsTO/U15RSmFxpTZcDpLgRMN8mbUWu5So6gJ3ESZ7 18CHoKPJ4c9FeB9ND9akDVghIH4ZS+AFvfVvhg0f5G+PEPiwRGUimYR2VoNUpJwO2q TkD9U2wFulluVioMns0qJUAjYfZ0cmnTBirnV5s0i/7xC6sTiy3/wcVBxylpOmTJVa TZlumSCS3R9V16Y1a8XbQ1sHRp2fGOwiK3fXCnPxSZva1ja84LWxFrYMKe4rnmnKJ0 +mED+7Ca287Gw== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King , Andrew Lunn Cc: "David S . Miller" , kuba@kernel.org, =?utf-8?q?Mar?= =?utf-8?q?ek_Beh=C3=BAn?= Subject: [PATCH net-next v4 08/16] net: phy: marvell10g: check for correct supported interface mode Date: Wed, 7 Apr 2021 22:22:46 +0200 Message-Id: <20210407202254.29417-9-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210407202254.29417-1-kabel@kernel.org> References: <20210407202254.29417-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 88E2110 does not support xaui nor rxaui modes. Check for correct interface mode for different chips. Signed-off-by: Marek Behún Reviewed-by: Andrew Lunn --- drivers/net/phy/marvell10g.c | 37 +++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index b0b3fccac65f..a7c6b1944b05 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -109,11 +109,14 @@ enum { }; struct mv3310_chip { + void (*init_supported_interfaces)(unsigned long *mask); int (*get_mactype)(struct phy_device *phydev); int (*init_interface)(struct phy_device *phydev, int mactype); }; struct mv3310_priv { + DECLARE_BITMAP(supported_interfaces, PHY_INTERFACE_MODE_MAX); + u32 firmware_ver; bool rate_match; phy_interface_t const_interface; @@ -391,6 +394,7 @@ static const struct sfp_upstream_ops mv3310_sfp_ops = { static int mv3310_probe(struct phy_device *phydev) { + const struct mv3310_chip *chip = to_mv3310_chip(phydev); struct mv3310_priv *priv; u32 mmd_mask = MDIO_DEVS_PMAPMD | MDIO_DEVS_AN; int ret; @@ -440,6 +444,8 @@ static int mv3310_probe(struct phy_device *phydev) if (ret) return ret; + chip->init_supported_interfaces(priv->supported_interfaces); + return phy_sfp_probe(phydev, &mv3310_sfp_ops); } @@ -540,17 +546,12 @@ static int mv3310_init_interface(struct phy_device *phydev, int mactype) static int mv3310_config_init(struct phy_device *phydev) { + struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev); const struct mv3310_chip *chip = to_mv3310_chip(phydev); int err, 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 && - phydev->interface != PHY_INTERFACE_MODE_RXAUI && - phydev->interface != PHY_INTERFACE_MODE_10GBASER && - phydev->interface != PHY_INTERFACE_MODE_USXGMII) + if (!test_bit(phydev->interface, priv->supported_interfaces)) return -ENODEV; phydev->mdix_ctrl = ETH_TP_MDI_AUTO; @@ -857,12 +858,34 @@ static int mv3310_set_tunable(struct phy_device *phydev, } } +static void mv3310_init_supported_interfaces(unsigned long *mask) +{ + __set_bit(PHY_INTERFACE_MODE_SGMII, mask); + __set_bit(PHY_INTERFACE_MODE_2500BASEX, mask); + __set_bit(PHY_INTERFACE_MODE_5GBASER, mask); + __set_bit(PHY_INTERFACE_MODE_XAUI, mask); + __set_bit(PHY_INTERFACE_MODE_RXAUI, mask); + __set_bit(PHY_INTERFACE_MODE_10GBASER, mask); + __set_bit(PHY_INTERFACE_MODE_USXGMII, mask); +} + +static void mv2110_init_supported_interfaces(unsigned long *mask) +{ + __set_bit(PHY_INTERFACE_MODE_SGMII, mask); + __set_bit(PHY_INTERFACE_MODE_2500BASEX, mask); + __set_bit(PHY_INTERFACE_MODE_5GBASER, mask); + __set_bit(PHY_INTERFACE_MODE_10GBASER, mask); + __set_bit(PHY_INTERFACE_MODE_USXGMII, mask); +} + static const struct mv3310_chip mv3310_type = { + .init_supported_interfaces = mv3310_init_supported_interfaces, .get_mactype = mv3310_get_mactype, .init_interface = mv3310_init_interface, }; static const struct mv3310_chip mv2110_type = { + .init_supported_interfaces = mv2110_init_supported_interfaces, .get_mactype = mv2110_get_mactype, .init_interface = mv2110_init_interface, }; From patchwork Wed Apr 7 20:22: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: 12189321 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.0 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,URIBL_BLOCKED,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 BD29FC43462 for ; Wed, 7 Apr 2021 20:24:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 853EC61394 for ; Wed, 7 Apr 2021 20:24:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356156AbhDGUYL (ORCPT ); Wed, 7 Apr 2021 16:24:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:55734 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356096AbhDGUX6 (ORCPT ); Wed, 7 Apr 2021 16:23:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 988D761184; Wed, 7 Apr 2021 20:23:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617827028; bh=FOaVm68ZK4mqgmMoYHfIPoz9Nz1NL1YF216t71VEz7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uyLEQ+08nk8Z4hDKBJtlUgGrp6c0kU4l2yUogLbt9w2zXGdHR91PlTONxThHQgtyP gc8l4pY2vRMH9eXs2jZEKQrQQeq4P9Kn1dICNpbMStLuBVzutW8/LEwT0SNAyrq5cZ watOxl7HCTlhMYB9UsOIpqhgMz/79tJPnzHRZEvtgndhL7G4GItQYwV0lmIubBRb+m cVO6jfvJkbCLusPlz1QHM2+CZUb9Ii71RKWR67je5UhfUl2k6vAVds05K1DWTGSmQQ BCbSSi+1Uj2+Y9s1nxQNrygd45WHtYsQweYINyafxkQkKtH0QFLCsfZrerHOTU85Ag UewQlJFGM+7ag== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King , Andrew Lunn Cc: "David S . Miller" , kuba@kernel.org, =?utf-8?q?Mar?= =?utf-8?q?ek_Beh=C3=BAn?= Subject: [PATCH net-next v4 09/16] net: phy: marvell10g: store temperature read method in chip strucutre Date: Wed, 7 Apr 2021 22:22:47 +0200 Message-Id: <20210407202254.29417-10-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210407202254.29417-1-kabel@kernel.org> References: <20210407202254.29417-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 Now that we have a chip structure, we can store the temperature reading method in this structure (OOP style). Signed-off-by: Marek Behún Reviewed-by: Andrew Lunn --- drivers/net/phy/marvell10g.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index a7c6b1944b05..20d3e572c935 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -112,6 +112,10 @@ struct mv3310_chip { void (*init_supported_interfaces)(unsigned long *mask); int (*get_mactype)(struct phy_device *phydev); int (*init_interface)(struct phy_device *phydev, int mactype); + +#ifdef CONFIG_HWMON + int (*hwmon_read_temp_reg)(struct phy_device *phydev); +#endif }; struct mv3310_priv { @@ -152,18 +156,11 @@ static int mv2110_hwmon_read_temp_reg(struct phy_device *phydev) return phy_read_mmd(phydev, MDIO_MMD_PCS, MV_PCS_TEMP); } -static int mv10g_hwmon_read_temp_reg(struct phy_device *phydev) -{ - if (phydev->drv->phy_id == MARVELL_PHY_ID_88X3310) - return mv3310_hwmon_read_temp_reg(phydev); - else /* MARVELL_PHY_ID_88E2110 */ - return mv2110_hwmon_read_temp_reg(phydev); -} - static int mv3310_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr, int channel, long *value) { struct phy_device *phydev = dev_get_drvdata(dev); + const struct mv3310_chip *chip = to_mv3310_chip(phydev); int temp; if (type == hwmon_chip && attr == hwmon_chip_update_interval) { @@ -172,7 +169,7 @@ static int mv3310_hwmon_read(struct device *dev, enum hwmon_sensor_types type, } if (type == hwmon_temp && attr == hwmon_temp_input) { - temp = mv10g_hwmon_read_temp_reg(phydev); + temp = chip->hwmon_read_temp_reg(phydev); if (temp < 0) return temp; @@ -882,12 +879,20 @@ static const struct mv3310_chip mv3310_type = { .init_supported_interfaces = mv3310_init_supported_interfaces, .get_mactype = mv3310_get_mactype, .init_interface = mv3310_init_interface, + +#ifdef CONFIG_HWMON + .hwmon_read_temp_reg = mv3310_hwmon_read_temp_reg, +#endif }; static const struct mv3310_chip mv2110_type = { .init_supported_interfaces = mv2110_init_supported_interfaces, .get_mactype = mv2110_get_mactype, .init_interface = mv2110_init_interface, + +#ifdef CONFIG_HWMON + .hwmon_read_temp_reg = mv2110_hwmon_read_temp_reg, +#endif }; static struct phy_driver mv3310_drivers[] = { From patchwork Wed Apr 7 20:22: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: 12189341 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.0 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 BAF4AC43461 for ; Wed, 7 Apr 2021 20:25:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 92BFA611EE for ; Wed, 7 Apr 2021 20:25:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356164AbhDGUZ2 (ORCPT ); Wed, 7 Apr 2021 16:25:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:55748 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236623AbhDGUYA (ORCPT ); Wed, 7 Apr 2021 16:24:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2C4C9611EE; Wed, 7 Apr 2021 20:23:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617827030; bh=Zs82cGLnxFxhIAtLwCDJSiYDuwBto4zcdT7u/lF7VS8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T1YNgEbtRWK9sWbfi6mdnAkyOFjHWCCgHTYVlrUdYGjVT7Fa4PBRNelutrmoTNsU7 GeG/an+NmmjCJfNflNrq5/KTsxGykHdWwMXI/5Kuets5LhSDeVWto9a2VUofqJWchc LUQrXkMEYIWLUgle4vmAv3QMxS/pGUTdhYILiFU/f1APKgvGyCdDSV3Ka2MxsShQPi Oh8hIXG/IVJrpZ6kOUAOWSEIO7cIFGMYTGYiztAQuZQ4dcldRyEWfnQCoP0lynPRxb oh8JFIOZfd53X/SQVSYEnWcp3EBJiDnWg1M7Vqg+A7ONd4CLaJKJkRRJcaudv4Wpeu f/o/7g0hwkCPQ== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King , Andrew Lunn Cc: "David S . Miller" , kuba@kernel.org, =?utf-8?q?Mar?= =?utf-8?q?ek_Beh=C3=BAn?= Subject: [PATCH net-next v4 10/16] net: phy: marvell10g: support other MACTYPEs Date: Wed, 7 Apr 2021 22:22:48 +0200 Message-Id: <20210407202254.29417-11-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210407202254.29417-1-kabel@kernel.org> References: <20210407202254.29417-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 usxgmii xaui / 5gbase-r / 2500base-x / sgmii rxaui / 5gbase-r / 2500base-x / sgmii and also 5gbase-r / 2500base-x / sgmii for 88E2110. Signed-off-by: Marek Behún --- drivers/net/phy/marvell10g.c | 90 +++++++++++++++++++++--------------- 1 file changed, 54 insertions(+), 36 deletions(-) diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index 20d3e572c935..2dc1317e601e 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -512,10 +512,18 @@ static int mv2110_init_interface(struct phy_device *phydev, int mactype) priv->rate_match = false; - 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->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; } @@ -531,12 +539,20 @@ static int mv3310_init_interface(struct phy_device *phydev, int mactype) mactype == MV_V2_3310_PORT_CTRL_MACTYPE_XAUI_RATE_MATCH) 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) priv->const_interface = PHY_INTERFACE_MODE_RXAUI; - else if (mactype == MV_V2_3310_PORT_CTRL_MACTYPE_XAUI_RATE_MATCH) + else if (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; } @@ -563,8 +579,10 @@ static int mv3310_config_init(struct phy_device *phydev) return mactype; err = chip->init_interface(phydev, mactype); - if (err) + if (err) { + 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); @@ -674,44 +692,44 @@ 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. + * + * In USXGMII mode the PHY interface mode is also fixed. */ - if (priv->rate_match) { + if (priv->rate_match || + priv->const_interface == PHY_INTERFACE_MODE_USXGMII) { phydev->interface = priv->const_interface; 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; - } + /* 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 Wed Apr 7 20:22: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: 12189325 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.0 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 99992C433B4 for ; Wed, 7 Apr 2021 20:24:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6FDE86100A for ; Wed, 7 Apr 2021 20:24:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356098AbhDGUZA (ORCPT ); Wed, 7 Apr 2021 16:25:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:55760 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356074AbhDGUYC (ORCPT ); Wed, 7 Apr 2021 16:24:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B727861184; Wed, 7 Apr 2021 20:23:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617827031; bh=73osR7QFEQrPF5ItVECP08mtVAZVW7tuqBnie1Tz9zY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sWUj1fePDjUQu4XmFxI+JGlFbHD3oAGCaoCvnkeXHiNrDyPE878V9onoyKxpVp6CE m7FDCOfb2++kXbyEV+R7+hg15/U8H5HnF+6CCXQyeP/wLv6msG0bhU8IByutu+wO0o MXz1YHJAA9oTVdz5OKtJ8bGrkSc/9YNA+pHc6LPiawpNAPEpNf7VqaQxkS9Z5WJNUz DTi7m0Oi3hNhwNnA4Ke7fuPKDXPfGF5LTxVxrMESyGwV8jxgAC6qxRly2TTeYh3mxZ l1sck8PLOZAkzhJoEXxvuZynokpmIeQu8uDo+Kpnl8CEEl2IKjUt9zIkeaU9Rvrk88 0Szk1tqF4w6ZA== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King , Andrew Lunn Cc: "David S . Miller" , kuba@kernel.org, =?utf-8?q?Mar?= =?utf-8?q?ek_Beh=C3=BAn?= Subject: [PATCH net-next v4 11/16] net: phy: marvell10g: add separate structure for 88X3340 Date: Wed, 7 Apr 2021 22:22:49 +0200 Message-Id: <20210407202254.29417-12-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210407202254.29417-1-kabel@kernel.org> References: <20210407202254.29417-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 88X3340 contains 4 cores similar to 88X3310, but there is a difference: it does not support xaui host mode. Instead the corresponding MACTYPE means rxaui / 5gbase-r / 2500base-x / sgmii without AN Signed-off-by: Marek Behún Reviewed-by: Andrew Lunn --- drivers/net/phy/marvell10g.c | 58 ++++++++++++++++++++++++++++++++++-- include/linux/marvell_phy.h | 6 +++- 2 files changed, 61 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index 2dc1317e601e..f74dfd993d8b 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -557,6 +557,21 @@ static int mv3310_init_interface(struct phy_device *phydev, int mactype) return 0; } +static int mv3340_init_interface(struct phy_device *phydev, int mactype) +{ + struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev); + int err = 0; + + priv->rate_match = false; + + if (mactype == MV_V2_3340_PORT_CTRL_MACTYPE_RXAUI_NO_SGMII_AN) + priv->const_interface = PHY_INTERFACE_MODE_RXAUI; + else + err = mv3310_init_interface(phydev, mactype); + + return err; +} + static int mv3310_config_init(struct phy_device *phydev) { struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev); @@ -884,6 +899,16 @@ static void mv3310_init_supported_interfaces(unsigned long *mask) __set_bit(PHY_INTERFACE_MODE_USXGMII, mask); } +static void mv3340_init_supported_interfaces(unsigned long *mask) +{ + __set_bit(PHY_INTERFACE_MODE_SGMII, mask); + __set_bit(PHY_INTERFACE_MODE_2500BASEX, mask); + __set_bit(PHY_INTERFACE_MODE_5GBASER, mask); + __set_bit(PHY_INTERFACE_MODE_RXAUI, mask); + __set_bit(PHY_INTERFACE_MODE_10GBASER, mask); + __set_bit(PHY_INTERFACE_MODE_USXGMII, mask); +} + static void mv2110_init_supported_interfaces(unsigned long *mask) { __set_bit(PHY_INTERFACE_MODE_SGMII, mask); @@ -903,6 +928,16 @@ static const struct mv3310_chip mv3310_type = { #endif }; +static const struct mv3310_chip mv3340_type = { + .init_supported_interfaces = mv3340_init_supported_interfaces, + .get_mactype = mv3310_get_mactype, + .init_interface = mv3340_init_interface, + +#ifdef CONFIG_HWMON + .hwmon_read_temp_reg = mv3310_hwmon_read_temp_reg, +#endif +}; + static const struct mv3310_chip mv2110_type = { .init_supported_interfaces = mv2110_init_supported_interfaces, .get_mactype = mv2110_get_mactype, @@ -916,7 +951,7 @@ static const struct mv3310_chip mv2110_type = { static struct phy_driver mv3310_drivers[] = { { .phy_id = MARVELL_PHY_ID_88X3310, - .phy_id_mask = MARVELL_PHY_ID_MASK, + .phy_id_mask = MARVELL_PHY_ID_88X33X0_MASK, .name = "mv88x3310", .driver_data = &mv3310_type, .get_features = mv3310_get_features, @@ -932,6 +967,24 @@ static struct phy_driver mv3310_drivers[] = { .remove = mv3310_remove, .set_loopback = genphy_c45_loopback, }, + { + .phy_id = MARVELL_PHY_ID_88X3340, + .phy_id_mask = MARVELL_PHY_ID_88X33X0_MASK, + .name = "mv88x3340", + .driver_data = &mv3340_type, + .get_features = mv3310_get_features, + .config_init = mv3310_config_init, + .probe = mv3310_probe, + .suspend = mv3310_suspend, + .resume = mv3310_resume, + .config_aneg = mv3310_config_aneg, + .aneg_done = mv3310_aneg_done, + .read_status = mv3310_read_status, + .get_tunable = mv3310_get_tunable, + .set_tunable = mv3310_set_tunable, + .remove = mv3310_remove, + .set_loopback = genphy_c45_loopback, + }, { .phy_id = MARVELL_PHY_ID_88E2110, .phy_id_mask = MARVELL_PHY_ID_MASK, @@ -954,7 +1007,8 @@ static struct phy_driver mv3310_drivers[] = { module_phy_driver(mv3310_drivers); static struct mdio_device_id __maybe_unused mv3310_tbl[] = { - { MARVELL_PHY_ID_88X3310, MARVELL_PHY_ID_MASK }, + { MARVELL_PHY_ID_88X3310, MARVELL_PHY_ID_88X33X0_MASK }, + { MARVELL_PHY_ID_88X3340, MARVELL_PHY_ID_88X33X0_MASK }, { MARVELL_PHY_ID_88E2110, MARVELL_PHY_ID_MASK }, { }, }; diff --git a/include/linux/marvell_phy.h b/include/linux/marvell_phy.h index 274abd5fbac3..6b11a5411082 100644 --- a/include/linux/marvell_phy.h +++ b/include/linux/marvell_phy.h @@ -22,10 +22,14 @@ #define MARVELL_PHY_ID_88E1545 0x01410ea0 #define MARVELL_PHY_ID_88E1548P 0x01410ec0 #define MARVELL_PHY_ID_88E3016 0x01410e60 -#define MARVELL_PHY_ID_88X3310 0x002b09a0 #define MARVELL_PHY_ID_88E2110 0x002b09b0 #define MARVELL_PHY_ID_88X2222 0x01410f10 +/* PHY IDs and mask for Alaska 10G PHYs */ +#define MARVELL_PHY_ID_88X33X0_MASK 0xfffffff8 +#define MARVELL_PHY_ID_88X3310 0x002b09a0 +#define MARVELL_PHY_ID_88X3340 0x002b09a8 + /* Marvel 88E1111 in Finisar SFP module with modified PHY ID */ #define MARVELL_PHY_ID_88E1111_FINISAR 0x01ff0cc0 From patchwork Wed Apr 7 20:22: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: 12189323 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.0 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,URIBL_BLOCKED,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 C309CC43460 for ; Wed, 7 Apr 2021 20:24:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 918616100A for ; Wed, 7 Apr 2021 20:24:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356118AbhDGUYy (ORCPT ); Wed, 7 Apr 2021 16:24:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:55786 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356100AbhDGUYD (ORCPT ); Wed, 7 Apr 2021 16:24:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 50434611CC; Wed, 7 Apr 2021 20:23:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617827033; bh=hO82dqEarv1Q80hwH5YaNAVWHDQhUZEWqAWokHOIyks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NxmePKWwc6BVk6MRslgIKiV59Kn7NQev8OSfgZ/6PPP+EiMKIxkwIpMV1nK24Tjuq 17M4YFS6zifcB86bedkE296VXfixhubxfbH69iAHkMtb1pOROBulP1aFPIAjoi5sg5 NAScR3YNsoP5tSEY6mSYe+KTRMjbBCd/jKXbh1tiNWy/vnVLMpCFl+W+EIMyBXiidy 5Eh8nUsO+K4Ym3J3LRwaSl7mhvxEvR9tdYkF+58fZbloYaX3SmATqKUgJhPcMsEY0X vuI+LcVN3R/dDb4ilnutmC5F5CnlSOKJc0cx1EwTCdUOsrSYgMaq2fGtTHQtPPGE3R Y38hH78he4g3w== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King , Andrew Lunn Cc: "David S . Miller" , kuba@kernel.org, =?utf-8?q?Mar?= =?utf-8?q?ek_Beh=C3=BAn?= Subject: [PATCH net-next v4 12/16] net: phy: marvell10g: fix driver name for mv88e2110 Date: Wed, 7 Apr 2021 22:22:50 +0200 Message-Id: <20210407202254.29417-13-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210407202254.29417-1-kabel@kernel.org> References: <20210407202254.29417-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 driver name "mv88x2110" should be instead "mv88e2110". Signed-off-by: Marek Behún Reviewed-by: Andrew Lunn --- 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 f74dfd993d8b..3c99757f0306 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -988,7 +988,7 @@ static struct phy_driver mv3310_drivers[] = { { .phy_id = MARVELL_PHY_ID_88E2110, .phy_id_mask = MARVELL_PHY_ID_MASK, - .name = "mv88x2110", + .name = "mv88e2110", .driver_data = &mv2110_type, .probe = mv3310_probe, .suspend = mv3310_suspend, From patchwork Wed Apr 7 20:22:51 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: 12189327 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.0 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,URIBL_BLOCKED,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 2BA2CC433B4 for ; Wed, 7 Apr 2021 20:24:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0960461184 for ; Wed, 7 Apr 2021 20:24:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356112AbhDGUZC (ORCPT ); Wed, 7 Apr 2021 16:25:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:55800 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356115AbhDGUYE (ORCPT ); Wed, 7 Apr 2021 16:24:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D2BF4611C1; Wed, 7 Apr 2021 20:23:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617827035; bh=V+B246HTRginjGUts7jw9n9eZXQkaeCppYFShohkonQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PhVCUKO6QWdEwdTYiWqtMpIM4LvyscL8GDP9fEB9dKj8TPxv2JQSgQQmTSltvPRrD uM5ga9Iyd3K7MzEvJr85oLmdQ1HBB6DJ1cXGSdYc/7lwgEVlzdSu6AUEhHSy5ZIgeP 9f4TUvAFlbZNjv8gAF1ukUkYeKMNKyoWs2U0cKznMa2PhuYvEiO8iaEK8zkBPUibu7 9y6BPVPopMb4eM3GOuv+hkkaz0cx39ZFRr1U35tJaJ0bsZsWzingytIDKHhGHMN+eB +IF7oY18vAhfMmhAxNQqW14yJDt1obBYenHwQFG2Xp3HvHiwmJCuKcsUGwKPgu+l8Y gFkgzAXNQSKmQ== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King , Andrew Lunn Cc: "David S . Miller" , kuba@kernel.org, =?utf-8?q?Mar?= =?utf-8?q?ek_Beh=C3=BAn?= Subject: [PATCH net-next v4 13/16] net: phy: add constants for 2.5G and 5G speed in PCS speed register Date: Wed, 7 Apr 2021 22:22:51 +0200 Message-Id: <20210407202254.29417-14-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210407202254.29417-1-kabel@kernel.org> References: <20210407202254.29417-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 Reviewed-by: Andrew Lunn --- 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 Wed Apr 7 20:22:52 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: 12189331 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.0 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 B319BC433B4 for ; Wed, 7 Apr 2021 20:25:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8C299611EE for ; Wed, 7 Apr 2021 20:25:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356179AbhDGUZK (ORCPT ); Wed, 7 Apr 2021 16:25:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:55816 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356126AbhDGUYG (ORCPT ); Wed, 7 Apr 2021 16:24:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6602C6120E; Wed, 7 Apr 2021 20:23:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617827036; bh=OWgKSxpXldxyWVKEkM2CzIG2eKsKcCEDcwM5aQC46DM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bu/fDUBVYa3RhuQV5evGv1YSTTNjabqOL69PQJPCO4y8q3JgR6MmSC6sii4KQYrGn vE7zsmApO/8XgybFALeDmY2nxNxJbgyjX2Mcr7uVguLC6rf/z3CZ10BAvBqSY1kWnv 5vrd1/2cFhnUDt7Ph71kh6GOV6FgUFOSWekVJuzZg2yXCR/rJv8fl2OdWVkctNJ1rI zc1GvmQqJd/lp3dlOVB0RIrPKcI0Mg6MW7Yhx9WMOwHiRQZIZk515QicP9XLPzCLBl h3cwzyZtOjMMSzsOi2ycr2Xa1qTQLKWTYpnAwKxKTHAQO6T+WzkA2rC8dWGBl3fS8b nDcMoYUDUY2Bg== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King , Andrew Lunn Cc: "David S . Miller" , kuba@kernel.org, =?utf-8?q?Mar?= =?utf-8?q?ek_Beh=C3=BAn?= Subject: [PATCH net-next v4 14/16] net: phy: marvell10g: differentiate 88E2110 vs 88E2111 Date: Wed, 7 Apr 2021 22:22:52 +0200 Message-Id: <20210407202254.29417-15-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210407202254.29417-1-kabel@kernel.org> References: <20210407202254.29417-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 88E2111 is a variant of 88E2110 which does not support 5 gigabit speeds. Differentiate these variants via the match_phy_device() method, since they have the same PHY ID. Signed-off-by: Marek Behún Reviewed-by: Andrew Lunn --- drivers/net/phy/marvell10g.c | 62 ++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index 3c99757f0306..fcf4db4e5665 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -918,6 +918,14 @@ static void mv2110_init_supported_interfaces(unsigned long *mask) __set_bit(PHY_INTERFACE_MODE_USXGMII, mask); } +static void mv2111_init_supported_interfaces(unsigned long *mask) +{ + __set_bit(PHY_INTERFACE_MODE_SGMII, mask); + __set_bit(PHY_INTERFACE_MODE_2500BASEX, mask); + __set_bit(PHY_INTERFACE_MODE_10GBASER, mask); + __set_bit(PHY_INTERFACE_MODE_USXGMII, mask); +} + static const struct mv3310_chip mv3310_type = { .init_supported_interfaces = mv3310_init_supported_interfaces, .get_mactype = mv3310_get_mactype, @@ -948,6 +956,41 @@ static const struct mv3310_chip mv2110_type = { #endif }; +static const struct mv3310_chip mv2111_type = { + .init_supported_interfaces = mv2111_init_supported_interfaces, + .get_mactype = mv2110_get_mactype, + .init_interface = mv2110_init_interface, + +#ifdef CONFIG_HWMON + .hwmon_read_temp_reg = mv2110_hwmon_read_temp_reg, +#endif +}; + +static int mv211x_match_phy_device(struct phy_device *phydev, bool has_5g) +{ + int val; + + if ((phydev->c45_ids.device_ids[MDIO_MMD_PMAPMD] & + MARVELL_PHY_ID_MASK) != MARVELL_PHY_ID_88E2110) + return 0; + + val = phy_read_mmd(phydev, MDIO_MMD_PCS, MDIO_SPEED); + if (val < 0) + return val; + + return !!(val & MDIO_PCS_SPEED_5G) == has_5g; +} + +static int mv2110_match_phy_device(struct phy_device *phydev) +{ + return mv211x_match_phy_device(phydev, true); +} + +static int mv2111_match_phy_device(struct phy_device *phydev) +{ + return mv211x_match_phy_device(phydev, false); +} + static struct phy_driver mv3310_drivers[] = { { .phy_id = MARVELL_PHY_ID_88X3310, @@ -988,6 +1031,7 @@ static struct phy_driver mv3310_drivers[] = { { .phy_id = MARVELL_PHY_ID_88E2110, .phy_id_mask = MARVELL_PHY_ID_MASK, + .match_phy_device = mv2110_match_phy_device, .name = "mv88e2110", .driver_data = &mv2110_type, .probe = mv3310_probe, @@ -1002,6 +1046,24 @@ static struct phy_driver mv3310_drivers[] = { .remove = mv3310_remove, .set_loopback = genphy_c45_loopback, }, + { + .phy_id = MARVELL_PHY_ID_88E2110, + .phy_id_mask = MARVELL_PHY_ID_MASK, + .match_phy_device = mv2111_match_phy_device, + .name = "mv88e2111", + .driver_data = &mv2111_type, + .probe = mv3310_probe, + .suspend = mv3310_suspend, + .resume = mv3310_resume, + .config_init = mv3310_config_init, + .config_aneg = mv3310_config_aneg, + .aneg_done = mv3310_aneg_done, + .read_status = mv3310_read_status, + .get_tunable = mv3310_get_tunable, + .set_tunable = mv3310_set_tunable, + .remove = mv3310_remove, + .set_loopback = genphy_c45_loopback, + }, }; module_phy_driver(mv3310_drivers); From patchwork Wed Apr 7 20:22:53 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: 12189329 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.0 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,URIBL_BLOCKED,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 170C9C433B4 for ; Wed, 7 Apr 2021 20:25:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E392C6120E for ; Wed, 7 Apr 2021 20:24:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356169AbhDGUZH (ORCPT ); Wed, 7 Apr 2021 16:25:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:55826 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356131AbhDGUYI (ORCPT ); Wed, 7 Apr 2021 16:24:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F2258611CC; Wed, 7 Apr 2021 20:23:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617827038; bh=sbAz3qdE24QZw4jx1wPXMrKBFACJuPMLORHWu39dkY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PkIPzfSWZXpx7N4yYOLPNWbBoO1NsYY3UZvbPGsv/jhXYCvRs4ALCqXpICiO460Ic sfyHV54WlwedsU991MA3EjJN/yAyNZCXSDsUNQxUdleX+XU8UL6PFf2/BogszVTgYL tZXwPuBI5pbYgLvectStQYiXo/QhA8qu9t6WZKlUU9Y181kgxoGscEN7u4v/XBQ/3m ttTGALFMB0rx5y9XoR7fiEmobQPRWggGX/CRkO48nNtb+wHcnQyWiCTn9NooUKb9Sa hZCa9EUZDGFiDAa6Ngwmx2hC4DXz2lKH851rQTLCuxl7bKMQzKwn1KohBbvZJMJF6D ezhw7e6XADuPg== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King , Andrew Lunn Cc: "David S . Miller" , kuba@kernel.org, =?utf-8?q?Mar?= =?utf-8?q?ek_Beh=C3=BAn?= Subject: [PATCH net-next v4 15/16] net: phy: marvell10g: change module description Date: Wed, 7 Apr 2021 22:22:53 +0200 Message-Id: <20210407202254.29417-16-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210407202254.29417-1-kabel@kernel.org> References: <20210407202254.29417-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 module supports not only Alaska X, but also Alaska M. Change module description appropriately. Signed-off-by: Marek Behún Reviewed-by: Andrew Lunn --- 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 fcf4db4e5665..bbbc6ac8fa82 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -1075,5 +1075,5 @@ static struct mdio_device_id __maybe_unused mv3310_tbl[] = { { }, }; MODULE_DEVICE_TABLE(mdio, mv3310_tbl); -MODULE_DESCRIPTION("Marvell Alaska X 10Gigabit Ethernet PHY driver (MV88X3310)"); +MODULE_DESCRIPTION("Marvell Alaska X/M multi-gigabit Ethernet PHY driver"); MODULE_LICENSE("GPL"); From patchwork Wed Apr 7 20:22:54 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: 12189333 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=-16.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,UNWANTED_LANGUAGE_BODY, URIBL_BLOCKED,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 3D98CC433ED for ; Wed, 7 Apr 2021 20:25:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 14519611EE for ; Wed, 7 Apr 2021 20:25:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356269AbhDGUZO (ORCPT ); Wed, 7 Apr 2021 16:25:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:55840 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356143AbhDGUYJ (ORCPT ); Wed, 7 Apr 2021 16:24:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 818546100A; Wed, 7 Apr 2021 20:23:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617827039; bh=jOgLdvDFW2zfR7Otnfjh5CaRO0BlvQ1igdZOgpzUOvA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YoNKMd5pqosAh26a9az5XYXNqrSMPaTJnwMuVxs73FSWPf8ZX+gV7lV/cNXlUT6wB eevwLCFLrYco+yxtrSmteFJtUf7MtSci7wVOpkRIkREvmjEdp9A04VC0bTXtn56Ppv BybDv+c3ci8zSiUGxzX2Fo77Ui1BYdCNdcubQKWf4+zt6aSNLPvhzaBWy2ze1yXsRY jeGkRcL7yLB4Okle5LtQ4uMmjKCQl31HH1DfvYDQiPR6heD1cZEhQBKWXFnDStsV5O am5gTrwx+BkLti6xORvzgQ3gSzZt3YdHQ1Hwm9vyRRSaDapgnNqnhl9TMEeC4jLAd0 mX8xwTJVIX/mQ== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King , Andrew Lunn Cc: "David S . Miller" , kuba@kernel.org, =?utf-8?q?Mar?= =?utf-8?q?ek_Beh=C3=BAn?= Subject: [PATCH net-next v4 16/16] MAINTAINERS: add myself as maintainer of marvell10g driver Date: Wed, 7 Apr 2021 22:22:54 +0200 Message-Id: <20210407202254.29417-17-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210407202254.29417-1-kabel@kernel.org> References: <20210407202254.29417-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 myself as maintainer of the marvell10g ethernet PHY driver, in addition to Russell King. Signed-off-by: Marek Behún --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 217c7470bfa9..3ea9539821b5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -10695,6 +10695,7 @@ F: include/linux/mv643xx.h MARVELL MV88X3310 PHY DRIVER M: Russell King +M: Marek Behun L: netdev@vger.kernel.org S: Maintained F: drivers/net/phy/marvell10g.c