From patchwork Tue Apr 6 22:10: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: 12186127 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 52CC6C433ED for ; Tue, 6 Apr 2021 22:11:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 24D95613CF for ; Tue, 6 Apr 2021 22:11:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242515AbhDFWL5 (ORCPT ); Tue, 6 Apr 2021 18:11:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:52418 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232893AbhDFWLz (ORCPT ); Tue, 6 Apr 2021 18:11:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 52B21613D3; Tue, 6 Apr 2021 22:11:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617747106; bh=bSW+N5ry56/YWkLrCH8XHXA47hNF8phNSn+g3PtO5iM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NvIEEsvYlq2rUv7bQND8fO+MRFK5CuGBJQNHLQUnyV7o4kgujxKLkUklEXNDncG6j 8ldujklPNgwZKXTG3xNj/ngvstZps/nQrKWPweW4t6F4T+p9rimLJYOcixPBLieVnR IsMZFZtRtCe2wCC1xI+fpzers9ZSBr/zXiFwPklhyVFO4zdBfCzuDxPbdLB/8IHcN8 kvr2GlgnObX5++H/Ay98eeh/h5UNJsK7SsByIvMY/mBZlI8YAxi3aSwNP9jO73sP2/ 4CpUiyCE1DhEP2li4Iq+qSWdieTWUONBxM0G9gbt0+gq6A3MqkPctSntVso0rqeg0r EiJ4i/HCe7Q5g== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King Cc: "David S . Miller" , Florian Fainelli , Heiner Kallweit , kuba@kernel.org, =?utf-8?q?Marek_Be?= =?utf-8?q?h=C3=BAn?= Subject: [PATCH net-next v3 01/18] net: phy: marvell10g: rename register Date: Wed, 7 Apr 2021 00:10:50 +0200 Message-Id: <20210406221107.1004-2-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210406221107.1004-1-kabel@kernel.org> References: <20210406221107.1004-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 Tue Apr 6 22:10: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: 12186129 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 15BA7C433B4 for ; Tue, 6 Apr 2021 22:11:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E1449613DF for ; Tue, 6 Apr 2021 22:11:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242509AbhDFWL7 (ORCPT ); Tue, 6 Apr 2021 18:11:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:52454 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242471AbhDFWL4 (ORCPT ); Tue, 6 Apr 2021 18:11:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 02732613D7; Tue, 6 Apr 2021 22:11:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617747108; bh=lsPKnMie2e0T1Zwy/pWfYzquGPqebfg5m7AGMVjwbEw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BMynEwwWACF0lNW0EbZc9hLSorhsRwECsgtFe6aWFKfag4kYItcx73r5VyJop47p1 1M6llbsd7Mk9dOpPdBpGWryEiM9/t35DfuH8PToyHJhG4iOwgj08N55JTYUjM+KqKM lcQY4IVBu1Wu25rzAoTU7axEZpY6rw+gtPNw2OzXEZKSXIsuItUTA2VNAbFXzxmatS E00OfYi4NfvoTYpWZS1EwH7Ke0jqrqcMH6G2neydWFvIaNxiZLvwb2KMJU2JX9S3WA Qz31vG5GYyiLzm6NkIc1ErcpjfRkCD5tyLValMVul5ZObRHTDnox6j7hur5cyd8beJ s80Xq2AMxCUCg== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King Cc: "David S . Miller" , Florian Fainelli , Heiner Kallweit , kuba@kernel.org, =?utf-8?q?Marek_Be?= =?utf-8?q?h=C3=BAn?= Subject: [PATCH net-next v3 02/18] net: phy: marvell10g: fix typo Date: Wed, 7 Apr 2021 00:10:51 +0200 Message-Id: <20210406221107.1004-3-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210406221107.1004-1-kabel@kernel.org> References: <20210406221107.1004-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 Tue Apr 6 22:10: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: 12186131 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 0ABB7C433ED for ; Tue, 6 Apr 2021 22:11:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C3D9F613DE for ; Tue, 6 Apr 2021 22:11:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243644AbhDFWMD (ORCPT ); Tue, 6 Apr 2021 18:12:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:52464 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243573AbhDFWL6 (ORCPT ); Tue, 6 Apr 2021 18:11:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AFC59613D0; Tue, 6 Apr 2021 22:11:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617747110; bh=FOevhU8i3XRTM11GzF7iMvZTBmKxyy06ejTi2+SjdN0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nUU8Z9fy0bLqhDLZKKoOvrEFfNJ+CrSHu5OqdP+ON9VmjrvFV2uJAM28U3OD2PI0Y GrnAQfuT6+0ulNkR6O+wJ1fZXgZLarVy9kYIB/G7YojgaeP8MEt4Yshvyx9dhvUFlj NROPrwGgn1+5tNsMd3DuyujPwgK34tA7drSdPwW1chCtasL6JSAeiNA3fRjv/QYdV/ S/gmLwWz+EsOFS+Lo837si+AeUCtFwYCKDGAyJiq/VBtvnPi9r5oZsam27KxXOfcFq VPAYpa5M9k3dLwbFS2ibFkWoFwUHhG5D1ocHcgnk2NYKL1qbKaxBoi78F3lKGhjjr7 TVQBTGwBn3QsA== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King Cc: "David S . Miller" , Florian Fainelli , Heiner Kallweit , kuba@kernel.org, =?utf-8?q?Marek_Be?= =?utf-8?q?h=C3=BAn?= Subject: [PATCH net-next v3 03/18] net: phy: marvell10g: allow 5gbase-r and usxgmii Date: Wed, 7 Apr 2021 00:10:52 +0200 Message-Id: <20210406221107.1004-4-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210406221107.1004-1-kabel@kernel.org> References: <20210406221107.1004-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 Tue Apr 6 22:10: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: 12186133 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 9B059C433B4 for ; Tue, 6 Apr 2021 22:11:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 67ABF613CD for ; Tue, 6 Apr 2021 22:11:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242585AbhDFWMF (ORCPT ); Tue, 6 Apr 2021 18:12:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:52488 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242471AbhDFWMA (ORCPT ); Tue, 6 Apr 2021 18:12:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 66AC0613D5; Tue, 6 Apr 2021 22:11:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617747111; bh=nX4eoEhxrg3W0ZsogIGxXVicdpbr0rV/OQUgZvgLmAw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rcca1MOhDfY3XrP7WOcpEDEm1ZQxL8Qs50sG2H4y3MpuyIDz7qeEkrdSn7hEEJogq bKKsfo9PAsMjojcY1Q8KE/eurmXdRSCFxyJiODUz2Wpf4HjFG7XtNYGNy50aFr58q4 CuekGt5v4+0GwcPKy3fE2epvYMtuu2BcHTqqyPiyMNhvs5VH3TfCHsJQYeBoeDtIPh Lu9aJ7+ehIGZYjKi2NHtowoNwsz+We80x79TlbGJXd3ZbFnvVtEryCdYU4v5cBJ4I1 rJTgsFCq0sUlVfeujFvoc7NqAhTqtRECAhTxoOg/++r8123b4kL8v3emexdak1dLrs z7cPGxqwNX7Qw== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King Cc: "David S . Miller" , Florian Fainelli , Heiner Kallweit , kuba@kernel.org, =?utf-8?q?Marek_Be?= =?utf-8?q?h=C3=BAn?= Subject: [PATCH net-next v3 04/18] net: phy: marvell10g: indicate 88X33x0 only port control registers Date: Wed, 7 Apr 2021 00:10:53 +0200 Message-Id: <20210406221107.1004-5-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210406221107.1004-1-kabel@kernel.org> References: <20210406221107.1004-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 Tue Apr 6 22:10: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: 12186135 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 D578BC433B4 for ; Tue, 6 Apr 2021 22:12:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9F277613D0 for ; Tue, 6 Apr 2021 22:12:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243662AbhDFWMG (ORCPT ); Tue, 6 Apr 2021 18:12:06 -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 S243626AbhDFWMC (ORCPT ); Tue, 6 Apr 2021 18:12:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 170DF613E1; Tue, 6 Apr 2021 22:11:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617747113; bh=eW67JIbT4Cz8LO2mBfJgUwc0Bo463M4DkT7UiRNnQMI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZGE00XBarhZ0pFCeM/PuJB2+I62AhWQCcBXQlZ+9MP6JvuX8gxJNPNUpYZcE+t3Z0 jLnQcNl+WLjvEFe8R266VtiSIGYaHxzFLQdU5Z+Ojc8eFPF0V59z+V4AcRhOrEXXjN g49bEPwcNH3pwfAqNPO3VXS795siaB8v+iQTnuyc42TOeBY2jXwXnyVJtAqS0VGOK8 fC7YqeWy735evq46W7hEj+pZdKIoS2KO9U41SD+3l47hVYGI8G4SYxcTA7Qil4qnwu eE2OjU0wFNdyiYcBCwGRBFUYx7DHvadogQEq778N8JCayUASxnamLVCte0w6zzMow+ o3LJEoi0xzgdA== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King Cc: "David S . Miller" , Florian Fainelli , Heiner Kallweit , kuba@kernel.org, =?utf-8?q?Marek_Be?= =?utf-8?q?h=C3=BAn?= Subject: [PATCH net-next v3 05/18] net: phy: marvell10g: add all MACTYPE definitions for 88X33x0 Date: Wed, 7 Apr 2021 00:10:54 +0200 Message-Id: <20210406221107.1004-6-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210406221107.1004-1-kabel@kernel.org> References: <20210406221107.1004-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 Tue Apr 6 22:10:55 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: 12186137 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 097A0C433ED for ; Tue, 6 Apr 2021 22:12:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D4DFB613DF for ; Tue, 6 Apr 2021 22:12:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243653AbhDFWMJ (ORCPT ); Tue, 6 Apr 2021 18:12:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:52520 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243643AbhDFWMD (ORCPT ); Tue, 6 Apr 2021 18:12:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BB2AC613CF; Tue, 6 Apr 2021 22:11:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617747115; bh=I4nxHoJrkAa+c0GD2PcJsIKsqldCGduF2pxnr5ItC2U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XftRFH48hYSkepWOYi14ORhUTc+SBFB1TQOraldzfPMahxAa5Yq70jmLENjhCqXOx cypFM3QC84lnPjiYd/lcbdlxRVlBbjy4jwSn0NhQ77HqGEYWq6XRvU0tYFgeVodaTn YY/fzv8v+lnQ1x28aJcGxJHC+8dYVqBWBXlZz4Clg99UbXNkqEQlMMJkmMruLDM+Zy Q7oJKQvEQl1DMDjqH2X7bkLggGuCgngvpiKhZET/ipuazeUTVnQpdV6XXHqOo0xEZZ A//CYpncjW7WmsN8NeFlJUmSGcwTa0wAZHx/EXw+ergNq+5jIphT48py73Fg329qHB ZtIzd/jMCRziQ== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King Cc: "David S . Miller" , Florian Fainelli , Heiner Kallweit , kuba@kernel.org, =?utf-8?q?Marek_Be?= =?utf-8?q?h=C3=BAn?= Subject: [PATCH net-next v3 06/18] net: phy: marvell10g: add MACTYPE definitions for 88E21xx Date: Wed, 7 Apr 2021 00:10:55 +0200 Message-Id: <20210406221107.1004-7-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210406221107.1004-1-kabel@kernel.org> References: <20210406221107.1004-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 Tue Apr 6 22:10:56 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: 12186139 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 E2736C43461 for ; Tue, 6 Apr 2021 22:12:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C1253613D4 for ; Tue, 6 Apr 2021 22:12:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344055AbhDFWMK (ORCPT ); Tue, 6 Apr 2021 18:12:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:52564 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243590AbhDFWMF (ORCPT ); Tue, 6 Apr 2021 18:12:05 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 71E92613D8; Tue, 6 Apr 2021 22:11:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617747116; bh=QVenI/d07vlVHlu/lMBdEZLfwmzLW+U7iS2lH8ZNXrw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MCf4k6/TllSrzTwXyGvav/LpG7wyCp/iOjGBNtZJlxS/xIbFFjouNqtXjtJ2Xg9B0 cFbnsXiFd3sfzMD1kfuXlbpBZc+uPggwFbnPobbLY3Ha0MROEJVRJ0kUAkkMRQ5bdr GAYGqLNPidMAWuNpX1V/egdDyfIzvLsFGf6lTtDKdI5hq2UfBl9zH1qgErxAA04jmL xL7qNjqPsw4viqfgW6o21XHPzXxkxwwZpXisr0LKF78V0wmGSZQKZYD7LDtzSkeWZJ D/BsokjFwImhrN37dUOzH1dInjloxMgY5U7wj5n7EmA2y3ZfWllI/H+KUItn4pGfOM jbnyFmVGPuMLA== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King Cc: "David S . Miller" , Florian Fainelli , Heiner Kallweit , kuba@kernel.org, =?utf-8?q?Marek_Be?= =?utf-8?q?h=C3=BAn?= Subject: [PATCH net-next v3 07/18] net: phy: marvell10g: support all rate matching modes Date: Wed, 7 Apr 2021 00:10:56 +0200 Message-Id: <20210406221107.1004-8-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210406221107.1004-1-kabel@kernel.org> References: <20210406221107.1004-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). Signed-off-by: Marek Behún --- drivers/net/phy/marvell10g.c | 104 +++++++++++++++++++++++++++++++---- 1 file changed, 93 insertions(+), 11 deletions(-) diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index 556c9b43860e..fc298e53f165 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -108,14 +108,26 @@ 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 inline 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 +482,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 +561,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 +677,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 +858,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 +891,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 Tue Apr 6 22:10:57 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: 12186141 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 14F58C433ED for ; Tue, 6 Apr 2021 22:12:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E69F8613D5 for ; Tue, 6 Apr 2021 22:12:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344061AbhDFWML (ORCPT ); Tue, 6 Apr 2021 18:12:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:52590 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243661AbhDFWMH (ORCPT ); Tue, 6 Apr 2021 18:12:07 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 22D97613D0; Tue, 6 Apr 2021 22:11:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617747118; bh=KjeHCy6ouT9c+bCTIZJOaHe1DfphBon3RJTzNrKurBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iK+WAOH3mbRVjHCHYjKkYFtRAXSf7EBkRyrsZ7QWfjDD+RA0WHEGy+VkG9iXLyse3 fQ2CGz9Kh2shk7+CQbbF9VzAYQiBgY4GChKKGqy+5p5uYGsipjk8SGqMrQPWgH4Z+S V57w9dZoTcNK1JhIXhXDCjemFlmvGiA+/cLBdYMB7RrwIBEiDwaJ4zDub+W1CbPwle yJGehNh5X4AIZdkMGRABi6UyCk8uHHzHgcVx1tihFrGkHZZYDsqKkH+tbGqSD9l+lH 7MuJEhyB8/W/q2PmwGGZqcTeIQ3UuCWQu2+hf7teKuLHpj6C3QiDWxe+HDI8tZnLrK lzBc9YQdAIUDw== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King Cc: "David S . Miller" , Florian Fainelli , Heiner Kallweit , kuba@kernel.org, =?utf-8?q?Marek_Be?= =?utf-8?q?h=C3=BAn?= Subject: [PATCH net-next v3 08/18] include: add library helpers for variadic macro expansion Date: Wed, 7 Apr 2021 00:10:57 +0200 Message-Id: <20210406221107.1004-9-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210406221107.1004-1-kabel@kernel.org> References: <20210406221107.1004-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 a library with useful helpers to expand variadic macros. We have the macro DECLARE_BITMAP(name, bits), but no way of compile-time initialization of such bitmaps. Since C does not support consteval functions, this can only be done via macros. This macro library can be (among other things) used to implement a sane way for compile-time bitmap initialization, something like static DECLARE_BITMAP(bm, 100) = INITIALIZE_BITMAP(100, 7, 9, 66, 98); Signed-off-by: Marek Behún --- include/linux/variadic-macro.h | 221 +++++++++++++++++++++++++++++++++ 1 file changed, 221 insertions(+) create mode 100644 include/linux/variadic-macro.h diff --git a/include/linux/variadic-macro.h b/include/linux/variadic-macro.h new file mode 100644 index 000000000000..5b21a66884e4 --- /dev/null +++ b/include/linux/variadic-macro.h @@ -0,0 +1,221 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Helpers for expanding variadic macros in useful ways + * + * 2021 by Marek Behún + */ + +#ifndef __VARIADIC_MACRO_H__ +#define __VARIADIC_MACRO_H__ + +/* + * Helpers for variadic macros with up to 32 arguments. + * Pretty simple to extend. + */ + +#define _VM_GET_NTH_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, \ + _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, \ + _27, _28, _29, _30, _31, _32, N, ...) N + +#define _VM_HELP_0(_f, _d, ...) +#define _VM_HELP_1(_f, _d, x, ...) _f(x, _d) +#define _VM_HELP_2(_f, _d, x, ...) _f(x, _d) _VM_HELP_1(_f, _d, ##__VA_ARGS__) +#define _VM_HELP_3(_f, _d, x, ...) _f(x, _d) _VM_HELP_2(_f, _d, ##__VA_ARGS__) +#define _VM_HELP_4(_f, _d, x, ...) _f(x, _d) _VM_HELP_3(_f, _d, ##__VA_ARGS__) +#define _VM_HELP_5(_f, _d, x, ...) _f(x, _d) _VM_HELP_4(_f, _d, ##__VA_ARGS__) +#define _VM_HELP_6(_f, _d, x, ...) _f(x, _d) _VM_HELP_5(_f, _d, ##__VA_ARGS__) +#define _VM_HELP_7(_f, _d, x, ...) _f(x, _d) _VM_HELP_6(_f, _d, ##__VA_ARGS__) +#define _VM_HELP_8(_f, _d, x, ...) _f(x, _d) _VM_HELP_7(_f, _d, ##__VA_ARGS__) +#define _VM_HELP_9(_f, _d, x, ...) _f(x, _d) _VM_HELP_8(_f, _d, ##__VA_ARGS__) +#define _VM_HELP_10(_f, _d, x, ...) _f(x, _d) _VM_HELP_9(_f, _d, ##__VA_ARGS__) +#define _VM_HELP_11(_f, _d, x, ...) _f(x, _d) _VM_HELP_10(_f, _d, ##__VA_ARGS__) +#define _VM_HELP_12(_f, _d, x, ...) _f(x, _d) _VM_HELP_11(_f, _d, ##__VA_ARGS__) +#define _VM_HELP_13(_f, _d, x, ...) _f(x, _d) _VM_HELP_12(_f, _d, ##__VA_ARGS__) +#define _VM_HELP_14(_f, _d, x, ...) _f(x, _d) _VM_HELP_13(_f, _d, ##__VA_ARGS__) +#define _VM_HELP_15(_f, _d, x, ...) _f(x, _d) _VM_HELP_14(_f, _d, ##__VA_ARGS__) +#define _VM_HELP_16(_f, _d, x, ...) _f(x, _d) _VM_HELP_15(_f, _d, ##__VA_ARGS__) +#define _VM_HELP_17(_f, _d, x, ...) _f(x, _d) _VM_HELP_16(_f, _d, ##__VA_ARGS__) +#define _VM_HELP_18(_f, _d, x, ...) _f(x, _d) _VM_HELP_17(_f, _d, ##__VA_ARGS__) +#define _VM_HELP_19(_f, _d, x, ...) _f(x, _d) _VM_HELP_18(_f, _d, ##__VA_ARGS__) +#define _VM_HELP_20(_f, _d, x, ...) _f(x, _d) _VM_HELP_19(_f, _d, ##__VA_ARGS__) +#define _VM_HELP_21(_f, _d, x, ...) _f(x, _d) _VM_HELP_20(_f, _d, ##__VA_ARGS__) +#define _VM_HELP_22(_f, _d, x, ...) _f(x, _d) _VM_HELP_21(_f, _d, ##__VA_ARGS__) +#define _VM_HELP_23(_f, _d, x, ...) _f(x, _d) _VM_HELP_22(_f, _d, ##__VA_ARGS__) +#define _VM_HELP_24(_f, _d, x, ...) _f(x, _d) _VM_HELP_23(_f, _d, ##__VA_ARGS__) +#define _VM_HELP_25(_f, _d, x, ...) _f(x, _d) _VM_HELP_24(_f, _d, ##__VA_ARGS__) +#define _VM_HELP_26(_f, _d, x, ...) _f(x, _d) _VM_HELP_25(_f, _d, ##__VA_ARGS__) +#define _VM_HELP_27(_f, _d, x, ...) _f(x, _d) _VM_HELP_26(_f, _d, ##__VA_ARGS__) +#define _VM_HELP_28(_f, _d, x, ...) _f(x, _d) _VM_HELP_27(_f, _d, ##__VA_ARGS__) +#define _VM_HELP_29(_f, _d, x, ...) _f(x, _d) _VM_HELP_28(_f, _d, ##__VA_ARGS__) +#define _VM_HELP_30(_f, _d, x, ...) _f(x, _d) _VM_HELP_29(_f, _d, ##__VA_ARGS__) +#define _VM_HELP_31(_f, _d, x, ...) _f(x, _d) _VM_HELP_30(_f, _d, ##__VA_ARGS__) + +/* + * EXPAND_FOR_EACH(_functor, _data, args...) - expand a call to functor for + * each argument + * @_functor: name of the functor to expand a call to + * @_data: private data to apply to the functor + * @args...: for each of these arguments a call to functor will be expanded + * + * This macro will expand to a call to _functor(arg, _data) for all arguments + * after the _data argument, i.e. + * EXPAND_FOR_EACH(f, d, 1, 2, 3) + * will expand to + * f(1, d) f(2, d) f(3, d) + * + * ATTENTION: the functor cannot call EXPAND_FOR_EACH again. + * For recursive calls to EXPAND_FOR_EACH to be allowed, use EXPAND_FOR_EACH_R + * together with EXPAND_EVAL. + * Or you can call EXPAND_FOR_EACH in the functor for EXPAND_FOR_EACH_PASS_ARGS. + * + * Example: + * + * :: + * + * #define __BIT_OR(x, dummy) | BIT(x) + * #define BIT_OR(...) (0 EXPAND_FOR_EACH(__BIT_OR, dummy, ##__VA_ARGS__)) + * + * int x = BIT_OR(1, 7, 9, 13); + * assert(x == (BIT(1) | BIT(7) | BIT(9) | BIT(13))); + */ +#define EXPAND_FOR_EACH(_functor, _data, ...) \ + _VM_GET_NTH_ARG("", ##__VA_ARGS__, _VM_HELP_31, _VM_HELP_30, \ + _VM_HELP_29, _VM_HELP_28, _VM_HELP_27, _VM_HELP_26, _VM_HELP_25, \ + _VM_HELP_24, _VM_HELP_23, _VM_HELP_22, _VM_HELP_21, _VM_HELP_20, \ + _VM_HELP_19, _VM_HELP_18, _VM_HELP_17, _VM_HELP_16, _VM_HELP_15, \ + _VM_HELP_14, _VM_HELP_13, _VM_HELP_12, _VM_HELP_11, _VM_HELP_10, \ + _VM_HELP_9, _VM_HELP_8, _VM_HELP_7, _VM_HELP_6, _VM_HELP_5, \ + _VM_HELP_4, _VM_HELP_3, _VM_HELP_2, _VM_HELP_1, \ + _VM_HELP_0)(_functor, _data, ##__VA_ARGS__) + +/* + * Black magic to prevent macros from creating disabling contexts + */ +#define _VM_EMPTY(...) +#define _VM_DEFER(...) __VA_ARGS__ _VM_EMPTY() + +#define EXPAND_EVAL(...) _VM_EVAL1(_VM_EVAL1(_VM_EVAL1(__VA_ARGS__))) +#define _VM_EVAL1(...) _VM_EVAL2(_VM_EVAL2(_VM_EVAL2(__VA_ARGS__))) +#define _VM_EVAL2(...) _VM_EVAL3(_VM_EVAL3(_VM_EVAL3(__VA_ARGS__))) +#define _VM_EVAL3(...) __VA_ARGS__ + +#define _VM_APPLY(x, _functor, _data, ...) _functor(x, _data, ##__VA_ARGS__) +#define _VM_APPLY_INDIRECT() _VM_APPLY +#define _VM_APPLY_HELPER(x, __args) \ + _VM_DEFER(_VM_APPLY_INDIRECT)()(x, _VM_DEFER __args) + +#define _VM_EXPAND_FOR_EACH_INDIRECT() EXPAND_FOR_EACH + +/* + * EXPAND_FOR_EACH_R(_functor, _data, args...) - expand a call to functor for + * each argument, recursive calls + * allowed + * @_functor: name of the functor to expand a call to + * @_data: private data to apply to the functor + * @args...: for each of these arguments a call to functor will be expanded + * + * Does the same as EXPAND_FOR_EACH(_functor, _data, args...), but _functor is + * allowed to call EXPAND_FOR_EACH_R again. + * + * ATTENTION: in order for this to work, the outermost call to this macro must + * be wrapped inside the EXPAND_EVAL macro. + * + * Example: + * + * :: + * + * #define EXP_3(y, x) x ## y + * #define EXP_2(x, ...) EXPAND_FOR_EACH_R(EXP_3, x, ##__VA_ARGS__) + * #define EXP_1(x, dummy) EXP_2(x, 1, 2, 3) + * #define EXP(...) EXPAND_EVAL(EXPAND_FOR_EACH_R(EXP_1, dummy, ##__VA_ARGS__)) + * + * EXP(a, b, c) + * // expands to: a1 a2 a3 b1 b2 b3 c1 c2 c3 + */ +#define EXPAND_FOR_EACH_R _VM_DEFER(_VM_EXPAND_FOR_EACH_INDIRECT)() + +#define _VM_EXPAND_FOR_EACH_PASS_ARGS(_functor, _data, ...) \ + _VM_DEFER(_VM_EXPAND_FOR_EACH_INDIRECT)()(_VM_APPLY_HELPER, \ + (_functor, _data, ##__VA_ARGS__), ##__VA_ARGS__) + +/* + * EXPAND_FOR_EACH_PASS_ARGS(_functor, _data, args...) - + * expand a call to functor for each argument, pass all arguments to each call + * @_functor: name of the functor to expand a call to + * @_data: private data to apply to the functor + * @args...: for each of these arguments a call to functor will be expanded + * + * For each argument after the _data argument, a call to + * _functor(arg, _data, args...) will be expanded. + * This is similar to EXPAND_FOR_EACH, but each expanded call will also be + * passed all the original arguments, i.e. + * EXPAND_FOR_EACH_PASS_ARGS(f, d, 1, 2, 3) + * will expand to + * f(1, d, 1, 2, 3) f(2, d, 1, 2, 3) f(3, d, 1, 2, 3) + * + * This is useful when one needs to call EXPAND_FOR_EACH in the functor again, + * to expand all the arguments in some way for each argument. + * + * ATTENTION: the functor cannot call EXPAND_FOR_EACH_PASS_ARGS again. + * For recursive calls to EXPAND_FOR_EACH_PASS_ARGS to be allowed, use + * EXPAND_FOR_EACH_PASS_ARGS_R together with EXPAND_EVAL. + * + * Example (a mechanism to compile time bitmap initialization): + * + * :: + * + * #define __BIT_OR(x, dummy) | BIT(x) + * #define BIT_OR(...) (0 EXPAND_FOR_EACH(__BIT_OR, dummy, ##__VA_ARGS__)) + * #define BM_MEMB(bit) ((bit) / BITS_PER_LONG) + * #define BM_OR(bit, member) \ + * | (BM_MEMB(bit) == member ? BIT((bit) % BITS_PER_LONG) : 0) + * #define INIT_BITMAP_MEMBER(bit, dummy, ...) \ + * [BM_MEMB(bit)] = (0 EXPAND_FOR_EACH(BM_OR, BM_MEMB(bit), ##__VA_ARGS__)), + * #define INIT_BITMAP(...) \ + * { \ + * EXPAND_FOR_EACH_PASS_ARGS(INIT_BITMAP_MEMBER, dummy, ##__VA_ARGS__) \ + * } + * + * static const DECLARE_BITMAP(bm, 90) = + * INIT_BITMAP(1, 2, 15, 32, 36, 80); + */ +#define EXPAND_FOR_EACH_PASS_ARGS(_functor, _data, ...) \ + EXPAND_EVAL(_VM_EXPAND_FOR_EACH_PASS_ARGS(_functor, \ + _data, ##__VA_ARGS__)) + +#define _VM_EXPAND_FOR_EACH_PASS_ARGS_INDIRECT() _VM_EXPAND_FOR_EACH_PASS_ARGS + +/* + * EXPAND_FOR_EACH_PASS_ARGS_R(_functor, _data, args...) - + * expand a call to functor for each argument, pass all arguments to each + * call, recursive calls allowed + * @_functor: name of the functor to expand a call to + * @_data: private data to apply to the functor + * @args...: for each of these arguments a call to functor will be expanded + * + * Does the same as EXPAND_FOR_EACH_PASS_ARGS(_functor, _data, args...), but + * _functor is allowed to call EXPAND_FOR_EACH_PASS_ARGS_R again. + * + * ATTENTION: in order for this to work, the outermost call to this macro must + * be wrapped inside the EXPAND_EVAL macro. + * + * Example: + * + * :: + * + * #define EXP_4(xy, z) z ## xy + * #define EXP_3(y, x, ...) EXPAND_FOR_EACH(EXP_4, x ## y, ##__VA_ARGS__) + * #define EXP_2(x, ...) EXPAND_FOR_EACH_PASS_ARGS_R(EXP_3, x, ##__VA_ARGS__) + * #define EXP_1(x, dummy, ...) EXP_2(x, __VA_ARGS__) + * #define EXP(...) \ + * EXPAND_EVAL(EXPAND_FOR_EACH_PASS_ARGS_R(EXP_1, dummy, ##__VA_ARGS__)) + * + * EXP(a, b, c) + * // expands to: aaa aab aac aba abb abc aca acb acc + * // baa bab bac bba bbb bbc bca bcb bcc + * // caa cab cac cba cbb cbc cca ccb ccc + */ +#define EXPAND_FOR_EACH_PASS_ARGS_R \ + _VM_DEFER(_VM_EXPAND_FOR_EACH_PASS_ARGS_INDIRECT)() + +#endif /* __VARIADIC_MACRO_H__ */ From patchwork Tue Apr 6 22:10:58 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: 12186143 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 37E55C433ED for ; Tue, 6 Apr 2021 22:12:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E2D3D613DF for ; Tue, 6 Apr 2021 22:12:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344069AbhDFWMM (ORCPT ); Tue, 6 Apr 2021 18:12:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:52612 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243688AbhDFWMI (ORCPT ); Tue, 6 Apr 2021 18:12:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C6B6A613CF; Tue, 6 Apr 2021 22:11:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617747120; bh=024eEXW6rUm55DFWDo7bYXYV3B9uGF+OotVDi1OOyw0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bbSl9mFkXCsB8dy8iv1Q9wWTLkcdNAIY0PycXWrJZUPi80dFlKwncxK1ROVIPEVEG VYFYF9v/7+HMC+9ma1YqZEC7zec0jCuc+WU0XOoVL9nO1UkQCaG1XJJ13gWmup9hl6 bojskzaz2QinRc4Ww/BH6jqbjAAn1qAy5eeeKx6Hn+xrFAUqC82+8RoodSJ3hmZ1/p CR5kt45gY7mOCdF5AHmhfdTztCRySpWMlCeusvAzxpPpALkV9ayRWTFjoz2tXJfpCI Gy8cAzW3uS5UWLNdJD15WNt8Q7cVbcouVWgEteFQ9OXNa2diBeoLKh0soLi4ySxdA7 rTpQAcA9C/FfA== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King Cc: "David S . Miller" , Florian Fainelli , Heiner Kallweit , kuba@kernel.org, =?utf-8?q?Marek_Be?= =?utf-8?q?h=C3=BAn?= Subject: [PATCH net-next v3 09/18] include: bitmap: add macro for bitmap initialization Date: Wed, 7 Apr 2021 00:10:58 +0200 Message-Id: <20210406221107.1004-10-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210406221107.1004-1-kabel@kernel.org> References: <20210406221107.1004-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 Use the new variadic-macro.h library to implement macro INITIALIZE_BITMAP(nbits, ...), which can be used for compile time bitmap initialization in the form static DECLARE_BITMAP(bm, 100) = INITIALIZE_BITMAP(100, 7, 9, 66, 98); The macro uses the BUILD_BUG_ON_ZERO mechanism to ensure a compile-time error if an argument is out of range. Signed-off-by: Marek Behún --- include/linux/bitmap.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h index 70a932470b2d..a9e74d3420bf 100644 --- a/include/linux/bitmap.h +++ b/include/linux/bitmap.h @@ -8,6 +8,7 @@ #include #include #include +#include /* * bitmaps provide bit arrays that consume one or more unsigned @@ -114,6 +115,29 @@ * contain all bit positions from 0 to 'bits' - 1. */ +/** + * DOC: initialize bitmap + * The INITIALIZE_BITMAP(bits, args...) macro expands to a designated + * initializer for bitmap of length 'bits', setting each bit specified + * in 'args...'. + */ +#define _BIT_MEMBER(bit) ((bit) / BITS_PER_LONG) +#define _VERIFY_BIT(bit, nbits) \ + BUILD_BUG_ON_ZERO((bit) < 0 || (bit) >= (nbits)) +#define _INIT_BITMAP_MEMBER_VALUE(bit, member_bit) \ + | (_BIT_MEMBER(bit) == _BIT_MEMBER(member_bit) \ + ? BIT((bit) % BITS_PER_LONG) \ + : 0) +#define _INIT_BITMAP_MEMBER(bit, nbits, ...) \ + [_VERIFY_BIT((bit), (nbits)) + _BIT_MEMBER(bit)] = \ + (0 EXPAND_FOR_EACH(_INIT_BITMAP_MEMBER_VALUE, \ + (bit), ##__VA_ARGS__)), +#define INITIALIZE_BITMAP(nbits, ...) \ + { \ + EXPAND_FOR_EACH_PASS_ARGS(_INIT_BITMAP_MEMBER, (nbits), \ + ##__VA_ARGS__) \ + } + /* * Allocation and deallocation of bitmap. * Provided in lib/bitmap.c to avoid circular dependency. From patchwork Tue Apr 6 22:10:59 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: 12186145 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 EAB6CC433ED for ; Tue, 6 Apr 2021 22:12:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C4688613E1 for ; Tue, 6 Apr 2021 22:12:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344056AbhDFWMT (ORCPT ); Tue, 6 Apr 2021 18:12:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:52636 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344035AbhDFWMK (ORCPT ); Tue, 6 Apr 2021 18:12:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 786C5613CD; Tue, 6 Apr 2021 22:12:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617747121; bh=MgjaySJZ5hjvZRj353kL+XmRyamXl14agsejMbBtngA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MOSfM5PAfYJ2nhWs6exBAIMoD518m7brqdD81q4+Mbkv3MV+ghD1auzudkg+B+B63 iT7Ur5EoFdZ/2EKDkebjhyLMTVbssx1/+7nd6VUG2PJUilz+7tgh7OoGldhrCbKT2s bDHJqa10Vl1UWdQyDswLRDHpvXx/ljRNds6+YZjE1fcogT1uhgRWJL0bCERlq/mbMW dyENsmQl9VheDv20dQpY0V8PE9rdlJne8DzUWEI4zM22Nmz4LfNfok0nMXTRvaS8Tr 0tXWvHTSMzwKpJmoIR5e0oQx3RNXGXOM42H7EIXXezm2BReoMSi0V7p+ZIvWD0eZwa bCazsBzSyPniw== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King Cc: "David S . Miller" , Florian Fainelli , Heiner Kallweit , kuba@kernel.org, =?utf-8?q?Marek_Be?= =?utf-8?q?h=C3=BAn?= Subject: [PATCH net-next v3 10/18] net: phy: marvell10g: check for correct supported interface mode Date: Wed, 7 Apr 2021 00:10:59 +0200 Message-Id: <20210406221107.1004-11-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210406221107.1004-1-kabel@kernel.org> References: <20210406221107.1004-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 | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index fc298e53f165..e3ced38f40c9 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -109,6 +109,7 @@ enum { }; struct mv3310_chip { + DECLARE_BITMAP(supported_interfaces, PHY_INTERFACE_MODE_MAX); int (*get_mactype)(struct phy_device *phydev); int (*init_interface)(struct phy_device *phydev, int mactype); }; @@ -545,13 +546,7 @@ static int mv3310_config_init(struct phy_device *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, chip->supported_interfaces)) return -ENODEV; phydev->mdix_ctrl = ETH_TP_MDI_AUTO; @@ -859,11 +854,27 @@ static int mv3310_set_tunable(struct phy_device *phydev, } static const struct mv3310_chip mv3310_type = { + .supported_interfaces = + INITIALIZE_BITMAP(PHY_INTERFACE_MODE_MAX, + PHY_INTERFACE_MODE_SGMII, + PHY_INTERFACE_MODE_2500BASEX, + PHY_INTERFACE_MODE_5GBASER, + PHY_INTERFACE_MODE_XAUI, + PHY_INTERFACE_MODE_RXAUI, + PHY_INTERFACE_MODE_10GBASER, + PHY_INTERFACE_MODE_USXGMII), .get_mactype = mv3310_get_mactype, .init_interface = mv3310_init_interface, }; static const struct mv3310_chip mv2110_type = { + .supported_interfaces = + INITIALIZE_BITMAP(PHY_INTERFACE_MODE_MAX, + PHY_INTERFACE_MODE_SGMII, + PHY_INTERFACE_MODE_2500BASEX, + PHY_INTERFACE_MODE_5GBASER, + PHY_INTERFACE_MODE_10GBASER, + PHY_INTERFACE_MODE_USXGMII), .get_mactype = mv2110_get_mactype, .init_interface = mv2110_init_interface, }; From patchwork Tue Apr 6 22:11:00 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: 12186147 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 66E30C433B4 for ; Tue, 6 Apr 2021 22:12:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 363F5613D8 for ; Tue, 6 Apr 2021 22:12:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344110AbhDFWMW (ORCPT ); Tue, 6 Apr 2021 18:12:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:52668 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344049AbhDFWMM (ORCPT ); Tue, 6 Apr 2021 18:12:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 28172613CF; Tue, 6 Apr 2021 22:12:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617747123; bh=lDWVe8uJVyF4qQEWXYkk73NzJ4pq3P249B4bc1phhQg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TMO2rHYHpEj1DmLax3EJrwfQ2Ud4ghDF3q9x5B+y2z5lrOcCQXYdF1X6S2YHAmIQ9 jWvdC3sjWV/YSfohQGpVBOmO89OVrKG9urj460CPseUYjfLqARU6AiCWIisodWhDtt Ce8LnRA/aQ6Mg3FjE/eo7rkFwByGTrpGmNjCGmzziGHwAqpPtRt9M9qRaajm3Ndn4Q MiGxrXfw1f4LC7i/u07/9aK8Ake4p2eGnf4tLvp5VFZfO7s5JZO/EWLNxZH1iMoc+h pafSSkSleex5y9j/a2SCLZ/PP6P6SHZNDJFNEmxwpKfFVLugqITNrfhK3JjPJdkzYa 8+OdZim9Jv+EQ== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King Cc: "David S . Miller" , Florian Fainelli , Heiner Kallweit , kuba@kernel.org, =?utf-8?q?Marek_Be?= =?utf-8?q?h=C3=BAn?= Subject: [PATCH net-next v3 11/18] net: phy: marvell10g: store temperature read method in chip strucutre Date: Wed, 7 Apr 2021 00:11:00 +0200 Message-Id: <20210406221107.1004-12-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210406221107.1004-1-kabel@kernel.org> References: <20210406221107.1004-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 e3ced38f40c9..a7c7c87201fa 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -112,6 +112,10 @@ struct mv3310_chip { DECLARE_BITMAP(supported_interfaces, PHY_INTERFACE_MODE_MAX); 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 { @@ -151,18 +155,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) { @@ -171,7 +168,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; @@ -865,6 +862,10 @@ static const struct mv3310_chip mv3310_type = { PHY_INTERFACE_MODE_USXGMII), .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 = { @@ -877,6 +878,10 @@ static const struct mv3310_chip mv2110_type = { PHY_INTERFACE_MODE_USXGMII), .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 Tue Apr 6 22:11:01 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: 12186149 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 5FF68C433B4 for ; Tue, 6 Apr 2021 22:12:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3E270613CF for ; Tue, 6 Apr 2021 22:12:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242614AbhDFWMa (ORCPT ); Tue, 6 Apr 2021 18:12:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:52696 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344072AbhDFWMN (ORCPT ); Tue, 6 Apr 2021 18:12:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CCE99613D0; Tue, 6 Apr 2021 22:12:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617747125; bh=T5IlwtM8m9MQJwSEjJ13nFxx/s9cm5Py688W2zMXx5g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kKnbj1ZTIi3JCxORPoyG3w+rMd0Md9crk1ooVSkPB9djjO4JPoa4scl/TMxKOCfZ7 gLEOYI9MadVbnILXaLqAQKbXzHmCyt1ncJn5Uhws2sg9Fjr1jj6zexZrmNp2rN2mUj /z2uVxOGHwlZo3E3e62auC33N23bw6QHYD70IIJgpu1+EGjTFB1EvM+LcdzpbqYn1y 23oIjfOBqje0JF+GFNqT45+52N+1GgSK3aJBC8qOUt671Nw4JRYAmrbAVX9DlCuI3k /qi5It1z3uUXImrx0+1mYPzy2Yl4Nd5ga299LLNUpx67ioXB3eMdOkqLPMm4TR52EW E6YZolgadt6aQ== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King Cc: "David S . Miller" , Florian Fainelli , Heiner Kallweit , kuba@kernel.org, =?utf-8?q?Marek_Be?= =?utf-8?q?h=C3=BAn?= Subject: [PATCH net-next v3 12/18] net: phy: marvell10g: support other MACTYPEs Date: Wed, 7 Apr 2021 00:11:01 +0200 Message-Id: <20210406221107.1004-13-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210406221107.1004-1-kabel@kernel.org> References: <20210406221107.1004-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 a7c7c87201fa..2fd823318de8 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -508,10 +508,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; } @@ -527,12 +535,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; } @@ -558,8 +574,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); @@ -669,44 +687,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 Tue Apr 6 22:11:02 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: 12186151 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 2006BC43460 for ; Tue, 6 Apr 2021 22:12:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DA0BF613D0 for ; Tue, 6 Apr 2021 22:12:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344102AbhDFWMe (ORCPT ); Tue, 6 Apr 2021 18:12:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:52712 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243715AbhDFWMP (ORCPT ); Tue, 6 Apr 2021 18:12:15 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 86B3C613D3; Tue, 6 Apr 2021 22:12:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617747126; bh=Oxbky1DjlPg/IjygOXE6GbsGm7VjkphnlDIUjY5SVsk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kjf9rNl8drEgY2SpH5xfdDL1yIv3wYIjh3JNe2Mb2AJtyt+3oD0qOmsGhTzW3vyfG FgYRfLFMmGjpGLll4H5DXA1qhEEEsXSLcapBx3my75EoLK3/OltR0wTg7BM95cPHvy xcg8E7UiwyZfyj2frdgu36dj7XrZuDcvxCrwwo5RIe6FG+itaAqmc16EYDxMsB5KEi /9db4sQyHlzA3fWn64RYY+2XFfIJx9wVlFOfg/eobSiRulhRYD/y+QSO26rkYRIBWp HwywmxLyvOA6VyPWbbzb5Bp5hxaRUeO2HnwILly6Q4kwZVhDHTz8yLt3nAlL09rUmw +w8WXZmu1lXhA== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King Cc: "David S . Miller" , Florian Fainelli , Heiner Kallweit , kuba@kernel.org, =?utf-8?q?Marek_Be?= =?utf-8?q?h=C3=BAn?= Subject: [PATCH net-next v3 13/18] net: phy: marvell10g: add separate structure for 88X3340 Date: Wed, 7 Apr 2021 00:11:02 +0200 Message-Id: <20210406221107.1004-14-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210406221107.1004-1-kabel@kernel.org> References: <20210406221107.1004-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 | 55 ++++++++++++++++++++++++++++++++++-- include/linux/marvell_phy.h | 6 +++- 2 files changed, 58 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index 2fd823318de8..74a91853ef46 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -553,6 +553,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) { const struct mv3310_chip *chip = to_mv3310_chip(phydev); @@ -886,6 +901,23 @@ static const struct mv3310_chip mv3310_type = { #endif }; +static const struct mv3310_chip mv3340_type = { + .supported_interfaces = + INITIALIZE_BITMAP(PHY_INTERFACE_MODE_MAX, + PHY_INTERFACE_MODE_SGMII, + PHY_INTERFACE_MODE_2500BASEX, + PHY_INTERFACE_MODE_5GBASER, + PHY_INTERFACE_MODE_RXAUI, + PHY_INTERFACE_MODE_10GBASER, + PHY_INTERFACE_MODE_USXGMII), + .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 = { .supported_interfaces = INITIALIZE_BITMAP(PHY_INTERFACE_MODE_MAX, @@ -905,7 +937,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, @@ -921,6 +953,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, @@ -943,7 +993,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 Tue Apr 6 22:11:03 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: 12186153 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 DC6D9C43461 for ; Tue, 6 Apr 2021 22:12:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B763C613CF for ; Tue, 6 Apr 2021 22:12:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344047AbhDFWMf (ORCPT ); Tue, 6 Apr 2021 18:12:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:52734 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344063AbhDFWMR (ORCPT ); Tue, 6 Apr 2021 18:12:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 55347613D7; Tue, 6 Apr 2021 22:12:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617747128; bh=pQxFrHdhl1DiWoghPTu2qloZY6/sTlZQpu2SanSfzPA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N/gTY9rzrlK97EUxC+EoPyrHkZ2iNOd+OCZqivUJRtDgULk6wgIVKvTXZPeRcOMIW GFGBqiWPOjaAxiyuE1D3vHWNl2Ay3Yh/RApUfFFMyOt2xrnFfDA8JGix8JscIOjskP LcbMXYitjn/+v33VK5whRK6HrQcD4KQaIMfWnOXDZQnL2dsOpZO2TFqDYuxenNxJ4Q WreYN95c5okwktEjn+82zZVIvb9eMh25oVcCc5zBsedhFb5kLIZTbRzqbee6PXoizL gTq550fLSMo1OWRs5Fmdx8ciWVrEXwvMxWJRi4+FMleugG5sNNpvYWEqIuid9mA2ua EzQFqZjjOiGyQ== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King Cc: "David S . Miller" , Florian Fainelli , Heiner Kallweit , kuba@kernel.org, =?utf-8?q?Marek_Be?= =?utf-8?q?h=C3=BAn?= Subject: [PATCH net-next v3 14/18] net: phy: marvell10g: fix driver name for mv88e2110 Date: Wed, 7 Apr 2021 00:11:03 +0200 Message-Id: <20210406221107.1004-15-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210406221107.1004-1-kabel@kernel.org> References: <20210406221107.1004-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 74a91853ef46..51b7a5083bdf 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -974,7 +974,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 Tue Apr 6 22:11:04 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: 12186155 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 AFEEBC433B4 for ; Tue, 6 Apr 2021 22:12:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8C22A613D0 for ; Tue, 6 Apr 2021 22:12:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344106AbhDFWMg (ORCPT ); Tue, 6 Apr 2021 18:12:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:52740 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344099AbhDFWMS (ORCPT ); Tue, 6 Apr 2021 18:12:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2E69A613D4; Tue, 6 Apr 2021 22:12:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617747130; bh=ZFJurUnJK78TF7LRyAyoDsdJum1NzykQEtrffQ3FDZk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p8IuDPRewRI0Rn6Nlfri6vYd5/Gifb893zQn6Ekg4w8GNMPYA0elNNPTCpZ7F8D5l nCMGn1/lkBbbpKemlvYe8czdSLNATfhV9aA1NHq0aYVhP7R3VXxR8Nz8wX8Oe9F5hA LmB9A1Mu3GbumyhuvYsDQCtnaL73hJRbwi7OlrrlThqe0Ep1MM0CmRMRwgEccdT+v2 Sn+GQ0Y/5f2IqMCf/8W2ISH4O2tpik859upwA1GzYIuyiobNTcTDoQXHHGdc37lhz0 +hKyPmVfdXBEg4BtEZiO+p5Di+OE1mXJmhARdke4zsEUqqPbRnYxPGupvqAPXSmRGF UnXl348PtvD+A== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King Cc: "David S . Miller" , Florian Fainelli , Heiner Kallweit , kuba@kernel.org, =?utf-8?q?Marek_Be?= =?utf-8?q?h=C3=BAn?= Subject: [PATCH net-next v3 15/18] net: phy: add constants for 2.5G and 5G speed in PCS speed register Date: Wed, 7 Apr 2021 00:11:04 +0200 Message-Id: <20210406221107.1004-16-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210406221107.1004-1-kabel@kernel.org> References: <20210406221107.1004-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 Tue Apr 6 22:11:05 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: 12186157 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 EF7C7C433B4 for ; Tue, 6 Apr 2021 22:12:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BFDB1613CD for ; Tue, 6 Apr 2021 22:12:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344188AbhDFWMi (ORCPT ); Tue, 6 Apr 2021 18:12:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:52768 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243726AbhDFWMV (ORCPT ); Tue, 6 Apr 2021 18:12:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E8B0E613DF; Tue, 6 Apr 2021 22:12:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617747132; bh=WYleOevaHHI8e8w/cM4IhzUekfYlsL/IjsYmJuzRylM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sMbXuocKQw1iyHsdW+39JBNMxe+vi7T9BFy+xLncrYfC8TAVFSeKo7TqM2v0RLG6k 2VyGWeis7Aul8ygToJEj2p5IWcTX1yBzrKVQFkYx0COaperFuiBR93mWdI9n7ua5vN h4VZJaIdCY/bsYL5/HVT5dLUyYozcmEMeLul00sYsbBrwmYBzZL4M3pZABB3tWgNNS igP4hSdnWyzyLuUNKgfjmjQPb4TJtSqa3U5le6q/nCN44jcrW2e8ABysp9vS7vZmyh 1fOM2eOIJWjd3X2MA9dcixXhwxPKZqrXXyL1qxj/qvrQKO7qnPIL1FvV07udbS+7kN kMW0toAZDOYyQ== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King Cc: "David S . Miller" , Florian Fainelli , Heiner Kallweit , kuba@kernel.org, =?utf-8?q?Marek_Be?= =?utf-8?q?h=C3=BAn?= Subject: [PATCH net-next v3 16/18] net: phy: marvell10g: differentiate 88E2110 vs 88E2111 Date: Wed, 7 Apr 2021 00:11:05 +0200 Message-Id: <20210406221107.1004-17-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210406221107.1004-1-kabel@kernel.org> References: <20210406221107.1004-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 | 59 ++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index 51b7a5083bdf..6269b9041180 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -934,6 +934,46 @@ static const struct mv3310_chip mv2110_type = { #endif }; +static const struct mv3310_chip mv2111_type = { + .supported_interfaces = + INITIALIZE_BITMAP(PHY_INTERFACE_MODE_MAX, + PHY_INTERFACE_MODE_SGMII, + PHY_INTERFACE_MODE_2500BASEX, + PHY_INTERFACE_MODE_10GBASER, + PHY_INTERFACE_MODE_USXGMII), + .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, @@ -974,6 +1014,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, @@ -988,6 +1029,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 Tue Apr 6 22:11:06 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: 12186159 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 916EDC43460 for ; Tue, 6 Apr 2021 22:12:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4F115613CD for ; Tue, 6 Apr 2021 22:12:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344206AbhDFWMk (ORCPT ); Tue, 6 Apr 2021 18:12:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:52782 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344109AbhDFWMW (ORCPT ); Tue, 6 Apr 2021 18:12:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AD13F613D5; Tue, 6 Apr 2021 22:12:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617747134; bh=ph8C8CczmaefOw2MWVIpV67Ei+uohFYTsjx7Q69PAXA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BqXENkP6VVY6Jj3aj65SRuS1CBOT0YvrKDOOHpMZs93d5B/mrKrafOcLqtHbkpUqz 09ZNQjl5+V3lx4kiLzd8JqIM0i3TnRhqpdhj1hKu2MmZqHg/uYYQH6SNA/P/vqkxKy 2N+khGtg02iHXAAlxlqjbVAYVwQ2hzhliRk3rJxnTM2kqMsquliirKeidiQ0+Q55Ob dDVuTckq/e7DXYDBBXzMoDmGvAvGNdFZSBKX42SJ4dOBZivRvC5qcrwffGsELlJdDT iqo1DPLJfjc1sahK4vMFUnw2Fi/ekBD5CBGNqJGUfXzSWFC5KBcmhT3y3/Nb1f/7u8 fs1yyev1leZSw== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King Cc: "David S . Miller" , Florian Fainelli , Heiner Kallweit , kuba@kernel.org, =?utf-8?q?Marek_Be?= =?utf-8?q?h=C3=BAn?= Subject: [PATCH net-next v3 17/18] net: phy: marvell10g: change module description Date: Wed, 7 Apr 2021 00:11:06 +0200 Message-Id: <20210406221107.1004-18-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210406221107.1004-1-kabel@kernel.org> References: <20210406221107.1004-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 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 6269b9041180..8c3ec67c83cc 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -1058,5 +1058,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 Tue Apr 6 22:11:07 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: 12186161 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, 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 85F5DC433B4 for ; Tue, 6 Apr 2021 22:12:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 62022613D2 for ; Tue, 6 Apr 2021 22:12:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344074AbhDFWMm (ORCPT ); Tue, 6 Apr 2021 18:12:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:52796 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344115AbhDFWMY (ORCPT ); Tue, 6 Apr 2021 18:12:24 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 65C08613DE; Tue, 6 Apr 2021 22:12:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617747135; bh=jOgLdvDFW2zfR7Otnfjh5CaRO0BlvQ1igdZOgpzUOvA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OhohBSyiZCd+zN0DkvDrwTjycNYyNFDy+q49RXqym+j+0NqRfe21t7lWtXEElt8SZ d1hqC3zg2bd00Mv22LrS/gkClRMgohb24MiAInXhDSnP+3MJfb/sMe2dYUQY2NZzQW 6J/vE4rfjvniKaxtk1jBEtJKg6PaqJ4yr5Nbdd6Gwjf0oLKiyRn0D7p/BZimu8IkFK jFFBaA0le6GsJYUduFVWiRjj7nhIR9I7V3SZLFbLsJlyEfsX+AQyKIl8I3VQUMLAR3 UhEUL4WcNNsaHRkg9kpYwudfMAN7OnGJdHP83V0NEqoZXfhiud0hQdPEecrzJ2tj4S 9K76pbx7ocbfA== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Russell King Cc: "David S . Miller" , Florian Fainelli , Heiner Kallweit , kuba@kernel.org, =?utf-8?q?Marek_Be?= =?utf-8?q?h=C3=BAn?= Subject: [PATCH net-next v3 18/18] MAINTAINERS: add myself as maintainer of marvell10g driver Date: Wed, 7 Apr 2021 00:11:07 +0200 Message-Id: <20210406221107.1004-19-kabel@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210406221107.1004-1-kabel@kernel.org> References: <20210406221107.1004-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