From patchwork Fri Nov 18 00:01:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13047502 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15F2FC433FE for ; Fri, 18 Nov 2022 00:03:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239145AbiKRADE (ORCPT ); Thu, 17 Nov 2022 19:03:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235184AbiKRACh (ORCPT ); Thu, 17 Nov 2022 19:02:37 -0500 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80055.outbound.protection.outlook.com [40.107.8.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A744B85EE6 for ; Thu, 17 Nov 2022 16:02:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ReiOQpDe+44764rpNyKicRhUNH48cRSGaeb2MWRlXLwqOyDe+xx+ISzThGXgKiiDD8O+DiZaLZPD69k/il7y7h9kUU8R1m8MW2E4tsF8IgIa/8odI7QcZTG+3v8076bk7sVBbtve1G5bZp/gjpKWUze1Ov79gLKtshPcLlZ10d9SkObGa8AZxifK4O9nGjDLJhR2sRALtG77rCAhGkLwrRQU/8ukgZa7tLC/g0TFX1QWa8sMYgBv6Mlb1z1dlEbHoxutbLfS6gv2i0FOc1+ZQWdE40UY3g7wGUL0u7YXn9Btx4j6MgLCioMQ5lcA+0bbQkh4ukqv7McYkAhcLYnlKg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=D8PojE3JIbTS1j4f1EyOrFsVgSisa8C9hc4iU3XHaJU=; b=hSMuedZwadQRGRwJiioIJUy7dFBZD1Bo74nF0dZe0COHMR3BR8SKhDuIjAZ+5sfJKswhaLqhEnefSjQQ6jDbNOmI48kzyQuw7dvWpFWcriHqJogBV4x/gn0f7A5E8NEKyMkjKM9ZwMskRJ399NmV//KU+gC0C2aQjnglkp5OpAbiTkEqfqB65jLiVFGnsAKNDyFQk4lyrNvwPBfnCTjfQeYEfyauAZUGP+epI/hqgWqHcr+NKrIgTaN+LwIc9q8UIU0oFKrjupHwb5iJxy3RdgxTXL8c0S/30RMpOuDeiJNVe4BbqpoITwzg/BlLJPLGsI/Kak8X0t0T8NjJsfd8Ow== 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=D8PojE3JIbTS1j4f1EyOrFsVgSisa8C9hc4iU3XHaJU=; b=AlPhDEQ0iYcjvDSPb317jUMCjmqkDDmRp0Dksy5UoxeU3otTqwg0d4B7/2vv8OmwwFLEnv83PPI3EAM2ncowKih5ADrG9BpAYXjB1TddzZHbc+pA8k1BjRtn3jfthFCM2Amnvs0+CNiPd+UYYU8ZnU20/ymbY9l4degXadvE/oo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by PAXPR04MB8542.eurprd04.prod.outlook.com (2603:10a6:102:215::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.13; Fri, 18 Nov 2022 00:02:15 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::9317:77dc:9be2:63b]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::9317:77dc:9be2:63b%7]) with mapi id 15.20.5813.018; Fri, 18 Nov 2022 00:02:15 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Andrew Lunn , Russell King , Florian Fainelli , UNGLinuxDriver@microchip.com, bcm-kernel-feedback-list@broadcom.com, Madalin Bucur , Camelia Groza , Claudiu Manoil , Ioana Ciornei , Maxim Kochetkov , Sean Anderson , Antoine Tenart , Michael Walle , Raag Jadav , Siddharth Vadapalli , Ong Boon Leong , Colin Foster , Marek Behun Subject: [PATCH v4 net-next 7/8] net: phy: at803x: validate in-band autoneg for AT8031/AT8033 Date: Fri, 18 Nov 2022 02:01:23 +0200 Message-Id: <20221118000124.2754581-8-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221118000124.2754581-1-vladimir.oltean@nxp.com> References: <20221118000124.2754581-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: BEXP281CA0006.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10::16) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|PAXPR04MB8542:EE_ X-MS-Office365-Filtering-Correlation-Id: 429a3131-95d5-4ba3-ec1e-08dac8f826cb X-LD-Processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XaIe4XypwfYrB+gUk4CrvfQPsx7H4m+2SS42sLpN2Tzn+MVQRe4mwsrdotN7JPPAz/wmVcKJgnzSg7XNDBVwLtncCsTE0cvhw1cyVg+P43yZ/SCjvP679EQa8lvAuuC+Y9Su+dHbiJt/4xoqjYR72YDKc89mX1cYY6kolZ/QA4xaQMwZ/3xKZe7xM/HMJ9RAKI3vnzIbOP8SYbSEZCDJ5mpc4hzKrYVWcGa+C0hP3Rs9RtjKqB7LXYCrEfO4SXWxr02kzhcSwfuP5Nu6iSu/wptcal9/ZxcxnGLiozKHERI9V9l7UmvzWTCNiIq9LlEvseomFMrT3SGWGvrLIMQ1CRyakLxvRKDxJLZFz3yIgo1iffyRKt4nDl6ebAYi8G8KDNwe4yQAruqK7bIXE7OkYMJoHn5Vb0CbsI1PirmcapGISnpxpnHEGkuvqkdJ8lwhSngx9qqeGaBO71gH+65X/lzVDDvafXlS+fViNnJcdCQLqyPjvyy7orsMcLjImvQLgrAhH0ZuAuxKlnFRv9zaYhikof0IqQC+K2bdYDFfG7/Y5U2YhSMw20UAUVPuXMk/Kwcz+Sd54o8Mtcr96/jwX3zMyTpoIQL9CVhi4XYCrlTfhWnaH+d1cdelPmNZvWq+3w+l5WI7XTHJ4BN2Q1i2ujQ1Wr8lGSYbCGgUtt97Fq0kvXGU7DdsaC6+fYWJVcJPEmTTCbvtkl188xEKj6KSV11AnpIc13kc8xDpIlBgbKc= 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:(13230022)(4636009)(136003)(346002)(396003)(366004)(39860400002)(376002)(451199015)(478600001)(966005)(26005)(41300700001)(6506007)(6666004)(36756003)(8676002)(52116002)(6486002)(4326008)(38100700002)(44832011)(7416002)(8936002)(2616005)(66946007)(66556008)(38350700002)(15650500001)(6512007)(66476007)(186003)(316002)(1076003)(2906002)(54906003)(6916009)(86362001)(5660300002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: n+czTti1tdbncreoJ1K4hhgijUFZD7XCoVjJWNxCcSxh2Jin0U2U6IolQcVTQltSq3v9gUxGOeDPRcxinjalxT0OdoJEQMwTxPCBR+iOIgMtwYT2FPScNcNcWc9SptGD65iehAXsBN4+oULF+fyhgzvF8PemkTJpUHO+pTeKfp3sOjBssw94GNqryLNX0nb9c6Tq+tMrEChBpiVdrqPXcIMTDGYB6RmN+BrZ397GmhVnoRQYsfh8JpIL2RmRalLvUyEKDvNPgTID2qkpI1/4aJD0FCMhmtXtj+XLS1vYN/RYyg/MNulO9qqycG78SScFG/GpVMnkwKbqCKtHyh5UMvhvZ4DKvFgBcd4tTVgPaqlPH25RTSq8NSUD/0nW8+/8ZezgnGaDUcpdR4mBe9Twwr+HkDqanAezk9L0nll7ZTbPloZO6rbgxrKfSc0z2+FJbRHdLdCAm3CKFAaiDoj0lFZ/KUR0r+ZryGFbiI8Akj8Bptd/TbQTNRGX7OyqrLMXj/Ej235PU1jy+Aqte2LBQKK+XAjWl27AAJWu1mtnQHJdpb9ixJVtLewRe0WfTfJPOadoeMFGpeVn9U76bfLgTDaJ0ramj4KHDoT9lRC0Bd4Kt34o6zP1KFhTORBbazCKH+KRQRBJxSQLT8Id9ZVnNQaF/aZQ/E32VDp5ckJDUZLupRYLEbCWXA9E/gOtq6N1rQ+85P9CNO82TBhRf1Gp0M1pPxgRpJ4v1lPcsyvBCrNsvacfAAfgIgMwAFEgCy+vQPVvJiDBMxUmDSOYMUaXyuK5NN8Kgr0gn645XxZEIoYwJP1XPAmr6T1lT6354SF/EoPR+Y972JXRVwubByFf658We5Q0ULer3y8qpY8M9DYBN8540c71otNmYa/gc2v/QFBueGe2Wa9/4Xxl7MZrIqU8ZkKuqRbbxOZl3OKUMbou+Pjf8NBPVswIU0i1LQyqjsS+SXImN8KGUdWJWCnMfL9pvugha/ZJp0STCF9swBFfEb1L5DO71icp7Pzd+CW+85w/hiE1Pa3Twc/dbYSuq6MWPH4Ycx0gMkyAlwobuVoFMjuUV5ZZLOmQj1kuoZRp4KtpkDyWzUjbdgaVb8UeaS5JN6q23a6n2Z6gmm1/48jVsEWsjMlv1iHn7PSKr4XVwVvZUY3+0FvsLcuJYepg78Fuf3pq9G9qlgNFmSgdBpnackc+E1x4+iDH1nFjU3YKCNeYsfW0MJno+YE0R09wvtjcz3HT4F2Zr+f7YwGCH02QCR2EcT79DYCTXp/BQ3a2+ZccLDeKMVY2UpvJJ0BHLPIJQv8AdEWQ5AxdVXs8tzkMsYfm+NtIHLnOxiWhA2LeOV7+4WVmpe3xBUDGpviumcPGgGkBDfMaZqENs9u6xoeCfuBMDw5ZjfC+EDhCd0BiJJNojTD1fx0+fdc33I+LjvQ33fCweNihzuNNIzd0VvaR0iGXws7hBKjd7xWNaR4FYILgc3Bsf0XFfZiaehyzdcRwmTzueBNq9lJTZUnJJ2fNq3oDz4VmZVQO6R51RLX7R7qPZpsoCI7lrvl0XXgnul+nzQtdIX5dSc15RuQX1nj7bGNpss02GPXylix5MpIodv54ZhzBk+0glgxYMAB9Pw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 429a3131-95d5-4ba3-ec1e-08dac8f826cb X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2022 00:02:15.6876 (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: LWEM0mJZbHcILn3ViSezx+mgUK8HHPkqcw401NcpZLtF7b4R9YVY/FlS9fbgsnctCo7i1ZClyqOcnmE2wND4PQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8542 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Allow drivers which migrate from phylib to phylink and have old device tree blobs to work with the AR8031/AT8033 on-board PHY in the SGMII SERDES side mode. This would allow DT breakage like the one fixed by commit df392aefe96b ("arm64: dts: fsl-ls1028a-kontron-sl28: specify in-band mode for ENETC") to be avoided in the future. We know from experimentation with NXP SoCs that the PHY doesn't pass traffic if in-band autoneg is enabled but fails to complete. We also know that it is in principle possible to disable in-band autoneg in the PHY. This would require disabling autoneg in the fiber page, and then keeping the fiber and copper page speeds in sync, as explained by Michael Walle here: https://patchwork.kernel.org/project/netdevbpf/patch/20210212172341.3489046-2-olteanv@gmail.com/ But since the PHY driver does not currently handle the complexity of keeping those speeds in sync, we can safely say that no MAC attached to the AT8031/AT8033 in SGMII mode has in-band autoneg disabled. I have no motivation to add support for disabled in-band autoneg. I just need the driver to report that it requires this enabled, which will make phylink promote a MLO_AN_PHY connection to MLO_AN_INBAND. This is enough to keep everyone happy. These PHYs also support RGMII, and for that mode, we report that in-band AN is unknown, which means that phylink will not change the mode from the device tree. Since commit d73ffc08824d ("net: phylink: allow RGMII/RTBI in-band status"), RGMII in-band status is a thing, and I don't want to meddle with that unless I have a reason for it. Signed-off-by: Vladimir Oltean --- v3->v4: - s/inband_aneg/an_inband/ - drop unnecessary support for PHY_AN_INBAND_OFF drivers/net/phy/at803x.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 349b7b1dbbf2..2ef6ac92fecb 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -1355,6 +1355,15 @@ static int at803x_config_aneg(struct phy_device *phydev) return __genphy_config_aneg(phydev, ret); } +static int at803x_validate_an_inband(struct phy_device *phydev, + phy_interface_t interface) +{ + if (interface == PHY_INTERFACE_MODE_SGMII) + return PHY_AN_INBAND_ON; + + return PHY_AN_INBAND_UNKNOWN; +} + static int at803x_get_downshift(struct phy_device *phydev, u8 *d) { int val; @@ -2076,6 +2085,7 @@ static struct phy_driver at803x_driver[] = { .set_tunable = at803x_set_tunable, .cable_test_start = at803x_cable_test_start, .cable_test_get_status = at803x_cable_test_get_status, + .validate_an_inband = at803x_validate_an_inband, }, { /* Qualcomm Atheros AR8032 */ PHY_ID_MATCH_EXACT(ATH8032_PHY_ID),