From patchwork Mon Aug 30 15:52:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 504565 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=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, 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 3EB1AC4320E for ; Mon, 30 Aug 2021 15:53:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2326B60FED for ; Mon, 30 Aug 2021 15:53:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237712AbhH3PyN (ORCPT ); Mon, 30 Aug 2021 11:54:13 -0400 Received: from mail-am6eur05on2057.outbound.protection.outlook.com ([40.107.22.57]:46753 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S237543AbhH3PyH (ORCPT ); Mon, 30 Aug 2021 11:54:07 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XwxKQCYoGhc/IDRYhRmtsR9HpnqBUuU8myUYYccnn6P8QkQNIBb5EKD1jknJCEozEcagNhoM2xwyBfjxWjbuky/KsX2mN9iacPo3co0s9pl7k3YUc+vb1EEvxYsF8DxLVgfA5yDtksd9Z/WFiRyPj0ofzIBsCQYG5ECOrYFfg+KYbhLRgH9TP0ww/MDnKGBAwV478gEi0IIDMRFX9BLujSOrsJS/ijAxVfCcyr4hrDh2LNP58SaAdWGzbLdhtzu7AqPt07FCq2pT0vlT1PnhHK1l2LW2dxPLpPR94iAMa2HV3qrfAdDZXaftFq9Jx4OHi7/uGi6gLvz/w3DbLI+FZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JW6+Fh6iuOZLDW33vQZPSijRAPq6yZY4LkCAWdWMRNw=; b=DG5nHwTg1lyIt5MgHubOV2bSag+hTdiL6jyF9VORiyCS8QtqQQVnh/7YdPvOBv/mgyQENOVGip6icAb+nsFpU+UOy9uV+adNwDyAS+aW8GgkP398mo0zlOFOsXdAqhfh6166dmzrzhP62vADSqVzkkV1BqnUxt580jBuIxksr08V3wOdcofEyduViTFm2985qe/ZZa52xnMnYoiAjuYcFaosqLty+kcFtUeDvJiyiBeOF9fPYvdSo8SP9prEOdtHMFX6zXjiZKOlg+pYnsQ5Jflq8mUH4SlhpxGksn52iazxA6uRXXL/M86GCtf0v2fqIJ940YzYgwLupdxizc55/w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JW6+Fh6iuOZLDW33vQZPSijRAPq6yZY4LkCAWdWMRNw=; b=LuBeAlkQAkLFgWl7BsGbf/bHnzEBQnvvNtCuu9zIo3sQE9/7Ot283yUPE1UNJuzcXbTKpv0o0TJTdg8TeU4F++wH1l4iX0s0hL+QjQzJ+E6fpNzX+ZSJzVW+SscOGndoS6HpwF7Vwcxw54LAxZ58RKBDH475YJr08ty1VtrY08g= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by VI1PR04MB4910.eurprd04.prod.outlook.com (2603:10a6:803:5c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.19; Mon, 30 Aug 2021 15:53:10 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::109:1995:3e6b:5bd0]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::109:1995:3e6b:5bd0%2]) with mapi id 15.20.4457.024; Mon, 30 Aug 2021 15:53:10 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Antoine Tenart , Quentin Schulz , Michael Walle , Heiner Kallweit , Andrew Lunn , Florian Fainelli , Russell King - ARM Linux admin , Ioana Ciornei , Maxim Kochetkov , Bjarni Jonasson , Steen Hegelund , UNGLinuxDriver@microchip.com, bcm-kernel-feedback-list@broadcom.com Subject: [RFC PATCH v2 net-next 3/5] net: phy: bcm84881: move the in-band capability check where it belongs Date: Mon, 30 Aug 2021 18:52:48 +0300 Message-Id: <20210830155250.4029923-4-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210830155250.4029923-1-vladimir.oltean@nxp.com> References: <20210830155250.4029923-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: PR1P264CA0024.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:19f::11) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (82.78.148.104) by PR1P264CA0024.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:19f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.17 via Frontend Transport; Mon, 30 Aug 2021 15:53:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e2a5c93a-e126-4e19-4a99-08d96bce448d X-MS-TrafficTypeDiagnostic: VI1PR04MB4910: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JnOjYr1irbvAH38uuCY2vY8HnZ0bw+EEL8+8IX6hNxY6uZfyq/OFDC4HVscLDx/V1201JRU+TXi3yfsSHD1fmexIELyTA3o15LoJIxcOg4F+Yl1p4AZMuDDYfkA+4fWxZLshO75Nzb7zMZphgEIKArphCWsBZ8kfh3zOFvUgVD9fD0vFVXDZgzN7BfMXUwGYbmahvVc5a6kHHJsNGRpt3q/H8rGkYjEYIt2k7Hag1VLt6wcnryvELz4qnshDoiU5g/TjYnwZ9dSU1PcnGftp6vX/vE8Vu61flFpfhOuuqMo/GJ/eLT4+oUTCDm9vLhWuZqiLkOjF9j1GwI2GTgObJSUz93n8gXFDbvqpfQsJPA3XD4FJEcfzZ5Rlg+Www4A0M8/n0TUAQCNw0hVIXfnbQpTZj41C0mx6Wr5sEZ8fH15TTQbVjYzOKef7l/owltE6nH3VB40HzjnqpiX1B+U7sAogVz3Aur+SRKuwHu5CDGFPfD8p/hQet4hupcU56uK7/RWMy9t6k9FsgBxJWwg7SpFo648UdWkZyZo1vlwC1oUDAxWY0WsA/YhcWKYXcJxMTL5rejhrMPilodZhfpyDSUbdMqCYpJHXwM7srdqXCm/iIjEk2aM6PWTcRstruTxBKYIACehT2qe3CTqUKR0fkMXpwTjjoXunSafMjKltT0tbWGdC44fEa2pRk8qWAfut X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5136.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(366004)(39860400002)(396003)(136003)(376002)(5660300002)(186003)(6512007)(86362001)(36756003)(7416002)(2616005)(956004)(1076003)(6916009)(66946007)(8936002)(6506007)(2906002)(6486002)(8676002)(66476007)(66556008)(6666004)(38100700002)(54906003)(38350700002)(4326008)(83380400001)(26005)(44832011)(316002)(52116002)(478600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NqALochk4380YfKw5AyzIwdttGaBOuwA0+Cl4Bg8wIMZZf9smm+4/2WC3ckOb+XkuxbWzyBv2OeLi1VX9k83ZPlMwFxNUjkrq9t4etjcOZGsh53dH89duhB1/tq4CFwidWufNPoZvIhxDtFV3shcIv4QZVytUmlgGFWzuCYy2nRvnqxWOTM74PpQ/V+HgBeG/rz1qAAHWWz+wmMeyoJzZM38my2IAca8os3vowHuUmYEj8mnA2npnZZR3yyGWSPHg0DeE7bALkX0fMYKaJhz27ndN13fcNWDUcKfNNwEeGEhQXxv2IubDI3YD5+bed7Pi2ZSMXe3I0rLj52FQ/Sy4HRpWN/WQg2rcYv+q8Uctst+FSft6orrh91Z6A3jYTpRsvpgitnu/xmklN0eJBqtcC+YL+Uja2dp8907pb7VZ+gfkS3AGuWIOnUu78XXjH+YvGLcPpSDchhZ0QEhPAXuwuwZAD5QDCjc0ULJep+JufzHuC2inJt0MwVmV9E568mlNoie2pG9bLyFzj8efY+EbHe/G151n/h75Bgdb4X2Sc4eC0EgPrnyWtLBa8svB3toUDTZYQ8W+l1KRGUjDWtEFUsyD8IuavVDT7sjS0nBqpA3sHPyF0mWL0mPd2uwUayGHI65xgKoBehAjoHQmSOzIWerSI86g5GYVLIwht2DNhzkAZ9I8lCDDM76yNAeeF3H5HEnOHOtcK2MD+qGklMUSaqf1KtaA/mr2CVJRgyDWDkqW5yr7ab+acjiEpMgU9EvGkTxXHWuuBz6VTiY8fjOkftCMnB977/Br92VOLVF1fB9LySUY4cxqmZ+FOkg7AfAnkNlAgblBgiKyqnPhIgE0AwC5Qps0AX6XL1CLxGOKgOB9WksQp50C1fPudXKK1/+GQ7pl603NqHAdzSwI/ONuW24h/hLkcR9iELR77Ux/GDn6LebzHQhfXqDRUf7IlA8jt2Oool8+ARpqHDx8+fgcUaqkwHz2YGhHcYObsUk48mQ8RXFJaAe2A2kBWpUvDn73e6IgkfVFXgniRkVDma3MzrFcL0mI/3DEELH8jDkRu9jwTNxHn3YfgKmZfFn8IylYNIQNU28whTSYKByBOsw92Gazn5lKCSGzp2/9qZOGkfWDKbPs92BdEFQbItcsrjAJmsJ+DiVuM6GPs+I+tCYwXyBGBqQPFA6/dcIzQSpWOyn9jUpgSMKCfnNbK/o39n0uKmU/2cVCBglFPo7gUokYtVITL3P1u5OKLNTySF0DZPpFFiafWOpRwHh7euNla4AnbrFGWMuC6RLgPM6xCoV+mGO6JviIlYvDcnW5dQiFamYIoEmDRZk4IBi1uYs4+zc X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e2a5c93a-e126-4e19-4a99-08d96bce448d X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2021 15:53:10.9030 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: cUH80Utb71uVrovv7ALSYzamGhUM82rCcRJzJUbj/dAOpd8wEhb8RuzOTr78+CyOnoLG6DnmcYX851Xr1PI9VQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4910 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Now that there is a generic interface through which phylink can query PHY drivers whether they support various forms of in-band autoneg, use that and delete the special case from phylink.c. Signed-off-by: Vladimir Oltean --- drivers/net/phy/bcm84881.c | 10 ++++++++++ drivers/net/phy/phylink.c | 17 ++--------------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/drivers/net/phy/bcm84881.c b/drivers/net/phy/bcm84881.c index 9717a1626f3f..5c0e4f85fc4e 100644 --- a/drivers/net/phy/bcm84881.c +++ b/drivers/net/phy/bcm84881.c @@ -223,6 +223,15 @@ static int bcm84881_read_status(struct phy_device *phydev) return genphy_c45_read_mdix(phydev); } +/* The Broadcom BCM84881 in the Methode DM7052 is unable to provide a SGMII + * or 802.3z control word, so inband will not work. + */ +static int bcm84881_validate_inband_aneg(struct phy_device *phydev, + phy_interface_t interface) +{ + return PHY_INBAND_ANEG_OFF; +} + static struct phy_driver bcm84881_drivers[] = { { .phy_id = 0xae025150, @@ -234,6 +243,7 @@ static struct phy_driver bcm84881_drivers[] = { .config_aneg = bcm84881_config_aneg, .aneg_done = bcm84881_aneg_done, .read_status = bcm84881_read_status, + .validate_inband_aneg = bcm84881_validate_inband_aneg, }, }; diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 6bded664ad86..7f4455b74569 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -2074,15 +2074,6 @@ int phylink_speed_up(struct phylink *pl) } EXPORT_SYMBOL_GPL(phylink_speed_up); -/* The Broadcom BCM84881 in the Methode DM7052 is unable to provide a SGMII - * or 802.3z control word, so inband will not work. - */ -static bool phylink_phy_no_inband(struct phy_device *phy) -{ - return phy->is_c45 && - (phy->c45_ids.device_ids[1] & 0xfffffff0) == 0xae025150; -} - static void phylink_sfp_attach(void *upstream, struct sfp_bus *bus) { struct phylink *pl = upstream; @@ -2141,14 +2132,10 @@ static int phylink_sfp_config(struct phylink *pl, struct phy_device *phy, if (phy) { ret = phy_validate_inband_aneg(phy, iface); if (ret == PHY_INBAND_ANEG_UNKNOWN) { - if (phylink_phy_no_inband(phy)) - mode = MLO_AN_PHY; - else - mode = MLO_AN_INBAND; + mode = MLO_AN_INBAND; phylink_dbg(pl, - "PHY driver does not report in-band autoneg capability, assuming %s\n", - phylink_autoneg_inband(mode) ? "true" : "false"); + "PHY driver does not report in-band autoneg capability, assuming true\n"); } else if (ret & PHY_INBAND_ANEG_ON) { mode = MLO_AN_INBAND; } else { From patchwork Mon Aug 30 15:52:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 504564 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=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, 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 46337C4320A for ; Mon, 30 Aug 2021 15:53:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2A5AA60F56 for ; Mon, 30 Aug 2021 15:53:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237725AbhH3PyP (ORCPT ); Mon, 30 Aug 2021 11:54:15 -0400 Received: from mail-am6eur05on2057.outbound.protection.outlook.com ([40.107.22.57]:46753 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S237691AbhH3PyJ (ORCPT ); Mon, 30 Aug 2021 11:54:09 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K1RmcyVsNHMuAqppiYNzZtytT7rhp+4Z/9q/ZEqcl50XYLGxtBgN3U7BbEq9i2dc/8iXrcsjRaaFUqL5clwJ10v4owEvFbyXWJBuSKh+S3hdBukFq2loroePAXco9L9qYAEBWO+CGv+mEkYjcTnoLdTwCh2nvz+Du8a9I+85h76PsvlWrHqH0xhZEHRHS+QoTbMa5luCmdZllBHjyfEpxulRqNvXAUxLXXYWVuONHot/0Fswv0K3PLSBBnGWnbRwC3faaZBDzK3Q4Ltdto+eWRI37/xCFsvx421SLsTIzq4Hw0isp+UY0c3ANwupZsIxL0EjnoQUrnbZGSRwQhoQMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CFwnuP72fDSu1A0m3Ja67ywLowhvFcDwBGDsS8yZ61A=; b=CF5OKwRq1fTqThTSLRKTcxqDV0wD4+tau+FtiCa/u20dUS5H795MVYwTIvomg4ONIwSLw+ZO+0rIg3Oi8lIbJyVTmd80v2SvEu4moeNFvqzKCSnsYqwdWxncu0oUzkFfY97IrxZ93/8uxn20cu17LFFOX9kT+Eg0Npkx/pf0e7hfikLu5QS8JIXa23ayDq7nzuLzEYsvd0x2Y/giYWI3v209OESWgBxUR2jx3Q/RQ4V0HeTuRMhAOEbFdUIq0oVRIB5TdORbphxgjZOU3xzGHKdszUB04lYdqN4stFijnEEs11scLo9pORze0KqZdHJ5ABv8HuFbmyUEt6q07HOEDQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CFwnuP72fDSu1A0m3Ja67ywLowhvFcDwBGDsS8yZ61A=; b=eUJRMNea9pgSSxVKLzoDTSmiGtvyodfutNM7ryFuWnIH23jaRq21oBI/stK3JEsgqwkxWoBITRpfwxYp3xQECwsDFF8GQXD8mE/SLdpUMTe5IHo7K+ajJl0mEWmDl50uRUPV5fG36y6B5Kc1lIcn+Lz8Tf1IWhr2YWm60Old5iw= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by VI1PR04MB4910.eurprd04.prod.outlook.com (2603:10a6:803:5c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.19; Mon, 30 Aug 2021 15:53:12 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::109:1995:3e6b:5bd0]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::109:1995:3e6b:5bd0%2]) with mapi id 15.20.4457.024; Mon, 30 Aug 2021 15:53:12 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Antoine Tenart , Quentin Schulz , Michael Walle , Heiner Kallweit , Andrew Lunn , Florian Fainelli , Russell King - ARM Linux admin , Ioana Ciornei , Maxim Kochetkov , Bjarni Jonasson , Steen Hegelund , UNGLinuxDriver@microchip.com, bcm-kernel-feedback-list@broadcom.com Subject: [RFC PATCH v2 net-next 4/5] net: phylink: explicitly configure in-band autoneg for PHYs that support it Date: Mon, 30 Aug 2021 18:52:49 +0300 Message-Id: <20210830155250.4029923-5-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210830155250.4029923-1-vladimir.oltean@nxp.com> References: <20210830155250.4029923-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: PR1P264CA0024.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:19f::11) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (82.78.148.104) by PR1P264CA0024.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:19f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.17 via Frontend Transport; Mon, 30 Aug 2021 15:53:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 99493d1a-0a10-4b97-ffd5-08d96bce4553 X-MS-TrafficTypeDiagnostic: VI1PR04MB4910: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Q+QpbCVNZMcduECHQXxVpqZSpMpxy/0CSV20GkjpVh8UD1WEREJ81sGJJImX4AiIU/D/xS0iryjme9alMMg1wWA3ClKVYF51ZkBgf7fywj/VG8glbZxmhyzxiXPZL5mytVmN0mJeqMKSAjClkuK9XVq8d6t1qoB13+00rg86GURqfFADnaFF55mSTbgjYm/Udy/rc60hH6QUCWnYQ4UEqQfCRiqnZ3wD5pQs54PkA0jFEdyxI84+Djy8293trpt+dzw0BvKlgSj4Mccm8HC+uGo8zZcjD8jFZMm64PqdP3ZpISytzu/mkio/1o9RiuxuG7HxkEy7KPWjnSDoP1okNBiTEHxppjcmuYQTFQLc06aN3CIzbAgy/wOrHE/yOdFUBaVNu3tWv37Zsh4Dmtr624kA3LcA2z0Q2ciFt/N5FCnAb1TZRPV2TQrYPrHjQ2rbLs6e4g4Q+icl8GJXfJDMW/Ln2rDGEjI3kJJUD73RegIrxm5+fHj5/x0bFILTbpnbCz0wyeW8BMp+b131XQW74gBHkwPtATvDZfYmSnOwDKnZl2PaV9/IRSOcmtf4ewj5CTVwr8CmS6Czj/ed8DNU9mJswEa9RL/SVQ7MpkkFjgM0iUjkJp0D+eevTUrS3HDFMBa5kVdi35Dc4YtT4BgmG1TIboZeilHv5VR3CsBVSYVcTKaatq6quFMHPXa4hiXKYPGYZPgK0csXMGDfJxxoFQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5136.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(366004)(39860400002)(396003)(136003)(376002)(5660300002)(186003)(6512007)(86362001)(36756003)(7416002)(2616005)(956004)(1076003)(6916009)(66946007)(8936002)(6506007)(2906002)(6486002)(8676002)(66476007)(66556008)(6666004)(38100700002)(54906003)(38350700002)(4326008)(83380400001)(26005)(44832011)(316002)(52116002)(478600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tvaZgzK+yjqmQNXLxfk5W0z7ajNI/ZlilxylOL3iFut4XNcJjNRtWQI1P95FqAWoX+BsjwLsEfumMnfTym/h1qoBZGjpm0TtzFu+NwIJnMf4IXsl3abACj23v3uRfcQGpzcsojXPC9sbaVvZ5AcD+diZzRDjKUGQ3DNXMJDnDX48GYFYZTpMZaMlpAMb6QFc/qDgXuUeCNzMoY2xFWprHL4vz5I/HwS94jG71zjDWZw+J5ALkmN5iM4hZm0F6MqpL1sC+zHO/9RPL+X439wZmBP3V7w2yDBjnsFTj8wSp76t3hmpUWgJaRrGiuUZqSbVlI6ChTEZ1tTC17TQyqnpEY0y0bUxAgJkElfQ+m3L1jHUISssWdVy0hZsKrU2SP6KAK+T/6glqjIWMm9MlZBtlBgAuloyPCuYic2V+OQOAMbHsfbgnXZK358jFdje4tbbhBB0C6a/UsSYXHSXLDZPJzO/mkST3/XlVyyREl2mvKNKK2f5taGwG6q8CZQVNm+SI6rXNd7m+hxsIZu0tNbJoHUFxlMtxapcjyxD6vSImx++HJFPzrJgfMIhVBy01q0V4dYvqplN3+CWUAwRmGkfNANXF2d6lNMbhfPDinFRV2psnVAH09PvEjhhXORQOVAR1ER12OSjCs4zRBnvwrGOFjEViUUaqXNIOg9cFh23DZsGFc1HyrrrCBd/0yUS0DKTUDGzFV+v3p/0cu9TzTjALj3aePx8kdcsGk35I2SjyTDoZ8jrsH2zjhlqgHhQro8mhXqn6hTIpf3WBF/9juM8O/O9CGlLw7CMFgtG5wsIfPwsYkIoCYIJHVkJ3FBvnbZ5xPMC5NMGgZQdz2XIza3cXEFq/20wUZb0lb798qniwwm0YAnBLKdOqoes+OscWGUnzw8j9FBAUr/KB1lcf9s1mTjSeEvH0v+hRQV5gHVI0QipAxebdrkaWATX/fKUzhlqb6cWY3R0e3qoQZdtF64viQflhzLVys9YEfYwBZyt2h6HwLgUqbNcfXB4dr35C+nPxT8fTKds8llbLFphO7nDISvaIx5U3P9nm2ugWK00jvnrfN7awGwjUSI/GdE5hjc1lWSBl1J8qenF2L0W0qhJ5h6jhtA4rBaE9+sSXGDQfsWxVy41Q20HJElr7GUIyvSERGTppUWxXmaBuAO6QbWdz6IVZzUvq7ArLm7h9FYFMgkuxVB0OlcgBbdw/Vamr/Hs/nYYglyFvnM6bBdp2EUxM1vuPWiJ9ShAv0D9DLOgBFIla3zrfhktuyKlxKOn476qfWKUj+uXt7Zh2XmaH3SqvFuC0D9/0WfNDiuLTBlEgRkDOKTKYSnXPPZHfzD2X3MU X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 99493d1a-0a10-4b97-ffd5-08d96bce4553 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2021 15:53:12.1572 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: iellzB6f9NVCmOE0/uCcO3uJFwJt9t723SO7rebujnYZAwJL7wSTsRE4WBXrPj8+DeQxNXnFe0T12CPSLT/dsA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4910 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Currently Linux has no control over whether a MAC-to-PHY interface uses in-band signaling or not, even though phylink has the managed = "in-band-status"; property which denotes that the MAC expects in-band signaling to be used. The problem is really that if the in-band signaling is configurable in both the PHY and the MAC, there is a risk that they are out of sync unless phylink manages them both. Most if not all in-band autoneg state machines follow IEEE 802.3 clause 37, which means that they will not change the operating mode of the SERDES lane from control to data mode unless in-band AN completed successfully. Therefore traffic will not work. It is particularly unpleasant that currently, we assume that PHYs which have configurable in-band AN come pre-configured from a prior boot stage such as U-Boot, because once the bootloader changes, all bets are off. Let's introduce a new PHY driver method for configuring in-band autoneg, and make phylink be its first user. The main PHY library does not call phy_config_inband_autoneg, because it does not know what to configure it to. Presumably, non-phylink drivers can also call phy_config_inband_autoneg individually. Signed-off-by: Vladimir Oltean --- drivers/net/phy/phy.c | 12 ++++++++++++ drivers/net/phy/phylink.c | 10 ++++++++++ include/linux/phy.h | 8 ++++++++ 3 files changed, 30 insertions(+) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 975ae3595f8f..3adc818db30d 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -763,6 +763,18 @@ int phy_validate_inband_aneg(struct phy_device *phydev, } EXPORT_SYMBOL_GPL(phy_validate_inband_aneg); +int phy_config_inband_aneg(struct phy_device *phydev, bool enabled) +{ + if (!phydev->drv) + return -EIO; + + if (!phydev->drv->config_inband_aneg) + return -EOPNOTSUPP; + + return phydev->drv->config_inband_aneg(phydev, enabled); +} +EXPORT_SYMBOL_GPL(phy_config_inband_aneg); + /** * phy_start_aneg - start auto-negotiation for this PHY device * @phydev: the phy_device struct diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 7f4455b74569..167f91c59e0d 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -954,6 +954,7 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy, { struct phylink_link_state config; __ETHTOOL_DECLARE_LINK_MODE_MASK(supported); + bool use_inband; char *irq_str; int ret; @@ -993,6 +994,15 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy, return ret; } + use_inband = phylink_autoneg_inband(pl->cur_link_an_mode); + + ret = phy_config_inband_aneg(phy, use_inband); + if (ret && ret != -EOPNOTSUPP) { + phylink_warn(pl, "failed to configure PHY in-band autoneg: %pe\n", + ERR_PTR(ret)); + return ret; + } + phy->phylink = pl; phy->phy_link_change = phylink_phy_change; diff --git a/include/linux/phy.h b/include/linux/phy.h index 4ac876f988ca..c81c6554d564 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -781,6 +781,13 @@ struct phy_driver { int (*validate_inband_aneg)(struct phy_device *phydev, phy_interface_t interface); + /** + * @config_inband_aneg: Enable or disable in-band auto-negotiation for + * the system-side interface if the PHY operates in a mode that + * requires it: (Q)SGMII, USXGMII, 1000Base-X, etc. + */ + int (*config_inband_aneg)(struct phy_device *phydev, bool enabled); + /** @aneg_done: Determines the auto negotiation result */ int (*aneg_done)(struct phy_device *phydev); @@ -1474,6 +1481,7 @@ int phy_config_aneg(struct phy_device *phydev); int phy_start_aneg(struct phy_device *phydev); int phy_validate_inband_aneg(struct phy_device *phydev, phy_interface_t interface); +int phy_config_inband_aneg(struct phy_device *phydev, bool enabled); int phy_aneg_done(struct phy_device *phydev); int phy_speed_down(struct phy_device *phydev, bool sync); int phy_speed_up(struct phy_device *phydev);