From patchwork Tue Dec 14 12:16:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Schenker X-Patchwork-Id: 12675897 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 C7F6EC433EF for ; Tue, 14 Dec 2021 12:17:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229904AbhLNMQ5 (ORCPT ); Tue, 14 Dec 2021 07:16:57 -0500 Received: from mail-zr0che01on2122.outbound.protection.outlook.com ([40.107.24.122]:35264 "EHLO CHE01-ZR0-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231808AbhLNMQy (ORCPT ); Tue, 14 Dec 2021 07:16:54 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hfCPdq5Znvvu7G07d1KEP0A2NpL6r/iYOH3yBLJi8kuH53KuAKczhLkzIbTqHcTWilnvaqfKLbf7chkMbvcLwkRkfLNd6gNO8KXh+htZkfz28CYgMEDNTD1J6JhhbyHQjpobhmmAxrV/L6a+7DSqd+0cg57kLVw5TIrv0bzhWqUnN2jbu+38O7ZvxibhaqvvyBXorCyow1hsmKFxZhPtBDDQPQOhphv8+wKKOwNIRattslRzG9thpdOSsiM3Ln4h6ErjvMNtO6c3KZqPQw6o8rcMi2mcxGDIoN1THumBiQW5fRyDX5dNM5QqNXAQp5KBourIHcaZPW0dYV+ooCqKPA== 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=sxQ9vroGi8XCJhlxryfAysI5HU1US+RVSjmWZMbpSnw=; b=dqk8MT004Dc+gepiKGHH725xOgTbPxbbWnJqZM+s3vk5WPytb7XQHjFEuEZdoqVhS8Lrxtjy2MR06PRaot2r2A8VQupLttF11b4bw9hPqWgXSxygpE2kvYDFP8Tqdl4vNzEaoa4KN94xZyR8+/7L7qSHC+VAMdWQG5cKaH6wDxKcAWcBHpnAxSGMD5udGVSzboZ0jOUKMaRVvwokVQHODGg84gnMvEIfB2YQXgpwS02dWHE1zD2NFKoUiBL6iQvWZrII7NLPkmbcJsmXvetunbSdnQQ0V1dCSdLobcaTG6uKeSQuzMEKZ927lQcGyOV3lDmSXD3e928lPPDDfPT0yA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=toradex.com; dmarc=pass action=none header.from=toradex.com; dkim=pass header.d=toradex.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toradex.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sxQ9vroGi8XCJhlxryfAysI5HU1US+RVSjmWZMbpSnw=; b=rEVdwrSkyfZzDAQRS72KTw7qo37WCOqfosWQlxkYznW2mLPg0DQTmEScU68HQidUf6oBcEofCxkN0YhHGrpb6iBxJ454trC0EHDfkjoR8ODwaTVO8IKN2ueTmerrF2ITXG6AUMafePX37GYWziD9l74X5CpamF+uCnwp9NjgZ8U= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=toradex.com; Received: from ZR0P278MB0377.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:34::14) by ZR0P278MB0234.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:36::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Tue, 14 Dec 2021 12:16:52 +0000 Received: from ZR0P278MB0377.CHEP278.PROD.OUTLOOK.COM ([fe80::e5c4:5c29:1958:fbea]) by ZR0P278MB0377.CHEP278.PROD.OUTLOOK.COM ([fe80::e5c4:5c29:1958:fbea%8]) with mapi id 15.20.4778.018; Tue, 14 Dec 2021 12:16:51 +0000 From: Philippe Schenker To: netdev@vger.kernel.org, Joakim Zhang , "David S . Miller" , Russell King , Andrew Lunn Cc: Heiner Kallweit , Francesco Dolcini , Jakub Kicinski , Fabio Estevam , Fugang Duan , Philippe Schenker , linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/3] net: phy: add phy_reset_after_power_on() function Date: Tue, 14 Dec 2021 13:16:36 +0100 Message-Id: <20211214121638.138784-2-philippe.schenker@toradex.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20211214121638.138784-1-philippe.schenker@toradex.com> References: <20211214121638.138784-1-philippe.schenker@toradex.com> X-ClientProxiedBy: ZR0P278CA0167.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::15) To ZR0P278MB0377.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:34::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 59d61e07-b0d3-4d59-f77c-08d9befb9c52 X-MS-TrafficTypeDiagnostic: ZR0P278MB0234:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1443; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AP/VNhgu0IfSTTBJvtSzH25mKutIl19hEH9RVgQa7vlOxORAZScmdWbFsj3lNKRALk3gpNVAk3Mi6Agj3fhHqF2F8RiwZ6fFbpJdyMq2CrRZ1NKIUmdGk/xLihR12Aa7TuMwU/dWcuf+3MViZhQvPvxyh6rFKbnQNkmIu9DQE0lcBuT32kK6LTiAhBNAAhk5YHlsi31PRwlgZDa9yZAyjxKzNR5w/sEtH6QsrR+/M5JPydN8wckmUqz+KbeISA7o68cThQQyh3MeNsqg/HvqB+SfJqCjg/y/S7ahJlPOgyqKh42BnZjbU7BpkjnGiDtm9IDMN18wbn0rZWpEIr9QvqUzhNjMJVjZpOOUEzKAPp93PtSZXz/C0b1G0huuVszs/6LNOaxewRt6yHLTN6fXkIuwhxy54OQOyIwAoeDOqfGBwCsD9shtXvjnohNT7VOnqyuOyfs7nwR6Op/YOyfoiXoJMrWf141zYWfh5J33gTwID5bMOESb4BnJnplpXzVr6fMHuF2lMUZn6B/qFesyyNiPgPa15xCsDOrpn8ADN3GxXOyR8Z9zWfGG5+j6GX34gIkp2BdGwqd97R/xgXfKjYgxBsWTeIylTB2HcK1QURkAEHVyshu5064W9F37sUFV5+2WkTpRSs+qCgZC7a/25+T6FmCMfqLZ0CN+TuSP5NeGPUwQfDL+jaiWt+ugBhO0X/4rMLBi1ABrwxn0VcBLdA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:ZR0P278MB0377.CHEP278.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(39850400004)(346002)(376002)(396003)(136003)(366004)(8936002)(86362001)(6506007)(66946007)(52116002)(316002)(6486002)(54906003)(5660300002)(2616005)(1076003)(508600001)(38350700002)(38100700002)(4326008)(8676002)(186003)(6666004)(26005)(36756003)(6512007)(44832011)(66476007)(66556008)(7416002)(110136005)(2906002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ty1+hyeQhJgL2m0h+bzlj1R38aNmcZTwvpRkSMxifYlQs30QDeEAjy5WXBUZr6V93n0HSDmqTdwh3At7vYhz9ME84avN+ZYHq1N1PP/E0UKSzCMLUt2069oCRZoCxV2jKlKPb/pPBxBfhgBmshIzraVH9obcG75U6AAB8Bro+J31560oM1j8/kz3fO6OI5An24Twoey2wuAVcNaedB6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5x8483WuHCYuV0uatMemvV1cnKf28yL7j9xt7YogwuzRWypzd2FUtFATd++T7K8wnJ+72gb1zDBvNbf+ildTIoW7CCl+yU3g/jmI11RBbaDZl0l+gdAwxZvUhv8WNUlBXm+6djMpfzgzRuNzHryil7f0j98qODM5Ks1hHU6zB1+eEyMDld2Jaj+gb56cAd8uE2rj5PTCb0bYb541pag89vISzbchDvlfk4OMQefyi3KBdvvocPGI75ubgNIUaAavw17UUL+VHXjGM1KToQjsup1rg0qjJTBCWElfdVGJCmOKNZRTf2S+8QJzPS2uvY8bfLqyMxqI6g+Lpsc2tZWD8bZYX3MSHIO3dEKVRuop8AXjfqckI6mkbyO3T7D3/oGrDH0cV8hWyzhy5I2dmh9Boyg== X-OriginatorOrg: toradex.com X-MS-Exchange-CrossTenant-Network-Message-Id: 59d61e07-b0d3-4d59-f77c-08d9befb9c52 X-MS-Exchange-CrossTenant-AuthSource: ZR0P278MB0377.CHEP278.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2021 12:16:51.9313 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d9995866-0d9b-4251-8315-093f062abab4 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gXL72wuck8bMUKsCAnEqmsKQb7mHP376l38lnM9kqjTQafmLSZSnxrONxNEQeP2qlNfitnT+NRz0gML7LY8Xc2FJyeKoEfpFfZTrEnVxcrE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: ZR0P278MB0234 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Some PHY requires a reset after being powered on (e.g. KSZ9131), add a new function and related PHY_RST_AFTER_POWER_ON phy flag to be called after the PHY regulator is enabled. Signed-off-by: Philippe Schenker --- drivers/net/phy/phy_device.c | 24 ++++++++++++++++++++++++ include/linux/phy.h | 2 ++ 2 files changed, 26 insertions(+) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 74d8e1dc125f..bad836a7ee01 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -1878,6 +1878,30 @@ int phy_reset_after_clk_enable(struct phy_device *phydev) } EXPORT_SYMBOL(phy_reset_after_clk_enable); +/** + * phy_reset_after_power_on - perform a PHY reset if needed + * @phydev: target phy_device struct + * + * Description: Some PHYs or hardware design, need a reset after power was + * enabled and rely on that software reset. This function evaluates the flags + * and perform the reset if it's needed. + * Returns < 0 on error, 0 if the phy wasn't reset and 1 if the phy was reset. + */ +int phy_reset_after_power_on(struct phy_device *phydev) +{ + if (!phydev || !phydev->drv) + return -ENODEV; + + if (phydev->drv->flags & PHY_RST_AFTER_POWER_ON) { + phy_device_reset(phydev, 1); + phy_device_reset(phydev, 0); + return 1; + } + + return 0; +} +EXPORT_SYMBOL(phy_reset_after_power_on); + /* Generic PHY support and helper functions */ /** diff --git a/include/linux/phy.h b/include/linux/phy.h index cbf03a5f9cf5..0d88cdc97dbd 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -80,6 +80,7 @@ extern const int phy_10gbit_features_array[1]; #define PHY_IS_INTERNAL 0x00000001 #define PHY_RST_AFTER_CLK_EN 0x00000002 #define PHY_POLL_CABLE_TEST 0x00000004 +#define PHY_RST_AFTER_POWER_ON 0x00000008 #define MDIO_DEVICE_IS_PHY 0x80000000 /** @@ -1499,6 +1500,7 @@ int phy_speed_up(struct phy_device *phydev); int phy_restart_aneg(struct phy_device *phydev); int phy_reset_after_clk_enable(struct phy_device *phydev); +int phy_reset_after_power_on(struct phy_device *phydev); #if IS_ENABLED(CONFIG_PHYLIB) int phy_start_cable_test(struct phy_device *phydev, From patchwork Tue Dec 14 12:16:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Schenker X-Patchwork-Id: 12675899 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 E9693C433FE for ; Tue, 14 Dec 2021 12:17:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230463AbhLNMQ6 (ORCPT ); Tue, 14 Dec 2021 07:16:58 -0500 Received: from mail-zr0che01on2122.outbound.protection.outlook.com ([40.107.24.122]:35264 "EHLO CHE01-ZR0-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231834AbhLNMQz (ORCPT ); Tue, 14 Dec 2021 07:16:55 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WzbkLhtGVF//vHytvSRDV1HiKDenWq9TNomLaiHtdFx6NoPt1VMIDXXNKbx/UdK09rlELqMHufnz7D+2fqLc/5FeMcSUShOM+IJALg7LmBQ/C7zFeoDDanwXmJJYqNxKydbQihaUow2rwIqJwjAcvqru5P/hqlLxHwjEJRELTAYc5WeGI5j0h1gIByg3x6x5eYpPiNbUuo/cD0itCGDDBSPQ0H7Jk5Qko3cyCf1sZ5YIEROi5nYqJkaVaJjzdR5d0qXIDdBXYiFy1PcyB+6yloT2lWjybr2k/pSrHyzBsrG4axHg7E+3vn1DKlvKcQ8KekXJf2q+/LRfEWRWp9Soxw== 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=oCYBeG0n+h7qLcL13dQBpWTCEfcOAvbSoAZ6ijoSe/Q=; b=BAIJnuO87O05GY72lgILGQlBJusijO8E29hPtMwu0Iqk3EXsrnV/PDYUd+Jm4K7GkEkx5XtdHbinJ2jJbrD5bviP0zvys56ApoWuXBN46B602BCI/BvYIru9AQhw2yK+6I7nANTE7DgpQa6Iw7v9uHwsUus1aK+g03GUDtiuGguup7/7mBL0Qxu6Bwol+5JPfbS0GuWRlRm0M0YVXlaNg2nzHpIsiWZZfczzvAMWFB3XwIp0jX5Zcwad1ieB5ItuLwE6ypPIfQu3gdFwOoCBeIJozCjEGgNEsDs3T6qqyjr1/OMPDCLlpjQqWF//AloJouiQyI7+lveqmZ/zFd46Ew== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=toradex.com; dmarc=pass action=none header.from=toradex.com; dkim=pass header.d=toradex.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toradex.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oCYBeG0n+h7qLcL13dQBpWTCEfcOAvbSoAZ6ijoSe/Q=; b=bwRjEOj4aeVu3KgEJfiO0jaK/G+UAz68FBb9TXTYlzSRZ4AqPV3Ibj71HzEM/ekx1ZMp55flUYyfMaZCLXQ/aVMN9YMxIQnHCUo9loFMMvpLoKIFuano45o8038tgFmXaAmPDYjO96j28zgVoRRLNzYOqq1e9SnZdBu8/tgYi4Y= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=toradex.com; Received: from ZR0P278MB0377.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:34::14) by ZR0P278MB0234.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:36::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Tue, 14 Dec 2021 12:16:52 +0000 Received: from ZR0P278MB0377.CHEP278.PROD.OUTLOOK.COM ([fe80::e5c4:5c29:1958:fbea]) by ZR0P278MB0377.CHEP278.PROD.OUTLOOK.COM ([fe80::e5c4:5c29:1958:fbea%8]) with mapi id 15.20.4778.018; Tue, 14 Dec 2021 12:16:52 +0000 From: Philippe Schenker To: netdev@vger.kernel.org, Joakim Zhang , "David S . Miller" , Russell King , Andrew Lunn Cc: Heiner Kallweit , Francesco Dolcini , Jakub Kicinski , Fabio Estevam , Fugang Duan , Philippe Schenker , linux-kernel@vger.kernel.org Subject: [PATCH net-next 2/3] net: phy: micrel: add reset-after-power-on flag to ksz9x31 phys Date: Tue, 14 Dec 2021 13:16:37 +0100 Message-Id: <20211214121638.138784-3-philippe.schenker@toradex.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20211214121638.138784-1-philippe.schenker@toradex.com> References: <20211214121638.138784-1-philippe.schenker@toradex.com> X-ClientProxiedBy: ZR0P278CA0167.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::15) To ZR0P278MB0377.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:34::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6cebbdfe-2173-453c-0a5b-08d9befb9c9c X-MS-TrafficTypeDiagnostic: ZR0P278MB0234:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Fx5q2z+cybPtxlilCuxz2CjKdPiHacPYWxjlJ0iFJCS4i2mKQXc5s0EC4oYf/8yQN9sprc3DpSYoRYWHzda5TiY1/iiTIZRaWco9YYvnangy8yRNVLp0+A9tmaC6zT4xiZM+Gj1LBuq6c1hTJWpvpbBY9DOtZq3Y3IOCpF0gcJGJ7jfiSflnv1ggMRoyqSS9e4UQLviTF/CqL9vbrJdgs/3atoh7/XbAvX4os38v0bNNcACdiC5SpxIXw1vt/lJ11YEfRx8E9v9QpXKbMc+8i1BhRQJaBfUzHSt410P7x45tDGryuLNQZaCZ81DQDrwzOH3UY9+1emriTqz1ZoZhp9uG8ETZI1cWTafRTzkf2xVD7pVxquuq/i10Xyg1UjhbIL2LUPuMl9w92CiCANxBZKV+KO82m2kiIYexUNzWzvGzUdcaEhPoaS4ntyd5mNaEi72s3hR/62uQRvzuod1POuAjonkZomqwHySBUl2if/NXcKIWD6pRZ/lW5wlj2yMorhEBwDbegpuDf36nKgowaCb/5r/OO/hCKHI7FX5ZC2QfG7PG7CsMICLYr2cyvKIxGwYTqYOyblzE1cUEsW2G0qljwKi4touEUu6Hy8QHnU9HXtNAnUW0Ex70oXBmluyiNUK79thUaBsH7j04R9YHSsytibqPgevelml+u1z8fE+H1z7LCUkVvMrpLUzV62MKBlF0sO8vxedusyPbMJwvpA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:ZR0P278MB0377.CHEP278.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(39850400004)(346002)(376002)(396003)(136003)(366004)(8936002)(86362001)(6506007)(66946007)(52116002)(316002)(6486002)(54906003)(5660300002)(2616005)(1076003)(508600001)(38350700002)(38100700002)(4326008)(8676002)(186003)(6666004)(26005)(36756003)(6512007)(44832011)(66476007)(66556008)(7416002)(110136005)(2906002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OeTf2UJmvHYFJikXWV+xFcELr+TG0WvJ1IDOsAob51utbCV2i5ysGpzYlUWkNxYgaAAOKzHQhpZNOIKhjtxUaDYNuKBg5avjtnV7j4zS4hR/zE2WFN8CA0y57fTzqL/A18wR5wQFAQvLjGCeQvrKqRqse2PWCY1ySzWXx6DOUsk33LY4uIeOCDVUjVeCNFDUb3Y67Risb1itkAJJMe3NRce0bz6O3PTI8XsiB8R5UARslEoUkZugXKWX/M0WZ35enTWhX+IkbW0tjeddy4zzRa0Q586k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m3ZVQo+zD4V0zFriXPF1HPSgq+nnQEOFJJyQyzJFdiH5x1d7mN7FlMGj5EduzLdza2O3SRVjtoZiAMjXYlCU/Im0xTRdiM3UH8YnbmXXkuF7f7Hvk7uWWGBQ/q2dHVpIPYutH9jvjMxaPoxWsi4KAt2eSfs/p5Tp6l2GeYREeTpIu4u0pc5shkhfDwlkE0khcAKY3qF47gEdEJtW7OmkktKzvPr8wCWZEYDB1a9vC0mHWTIZgRZ5V63Xbp5krIjfd89aaoL2SHGuqFLlExIJLVELTo22dkQiU4m/Ay5/kVsTq1LnmR/qbDBiyfZTGo3vn5jrK4YQmd9C0bwi36A== X-OriginatorOrg: toradex.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6cebbdfe-2173-453c-0a5b-08d9befb9c9c X-MS-Exchange-CrossTenant-AuthSource: ZR0P278MB0377.CHEP278.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2021 12:16:52.4152 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d9995866-0d9b-4251-8315-093f062abab4 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: PTjuvjsN7bl4Z7Xrr9WTxLBIOkqMPrn0yM9mP7pq3MjwqDWZIwhU1Cy5wTM9d86W6zOqn6LJrMXUYbAhfVlntAQHQSn+S7JQ870lwE4t8HM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: ZR0P278MB0234 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org KSZ9031 and KSZ9131 do need a reset after power-on, set the PHY_RST_AFTER_POWER_ON flag to enable the phylib to do it in case the reset signal is controlled by software. Signed-off-by: Philippe Schenker --- drivers/net/phy/micrel.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 44a24b99c894..85ee3a61017b 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -1777,6 +1777,7 @@ static struct phy_driver ksphy_driver[] = { .phy_id_mask = MICREL_PHY_ID_MASK, .name = "Micrel KSZ9031 Gigabit PHY", .driver_data = &ksz9021_type, + .flags = PHY_RST_AFTER_POWER_ON, .probe = kszphy_probe, .get_features = ksz9031_get_features, .config_init = ksz9031_config_init, @@ -1822,6 +1823,7 @@ static struct phy_driver ksphy_driver[] = { .name = "Microchip KSZ9131 Gigabit PHY", /* PHY_GBIT_FEATURES */ .driver_data = &ksz9021_type, + .flags = PHY_RST_AFTER_POWER_ON, .probe = kszphy_probe, .config_init = ksz9131_config_init, .config_intr = kszphy_config_intr, From patchwork Tue Dec 14 12:16:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Schenker X-Patchwork-Id: 12675901 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 9743DC433F5 for ; Tue, 14 Dec 2021 12:17:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231834AbhLNMRE (ORCPT ); Tue, 14 Dec 2021 07:17:04 -0500 Received: from mail-zr0che01on2122.outbound.protection.outlook.com ([40.107.24.122]:35264 "EHLO CHE01-ZR0-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231878AbhLNMQ4 (ORCPT ); Tue, 14 Dec 2021 07:16:56 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iW1SWwnsQNDNNeeIYRQr8kGZp5xEmAsXq6VIT/S+KscBgsGLNwBmonIvdR8SPvBhfUO1qfVmkFhUExq/WTcCn8l42HJY338YET5riid0Y3zjVLmMQwu2iM/H+Pw44vWzhxBJIlVIGQlkFaXi1W9XInD0LwFoxj2HcH5ND9VNaUU2dHMJtZHwuTKffRYI2YZhsyYvjsEy4Z8EkaSMEz2t/EKw5dczxyIhSCiiTpVu26Vlk4mRm/i6Pz144BC6VyoAI1nPmM2xQ+tKii/DsaRkIbzMWKJf3ISFn6ngohXydudk1UZyvuUifQvDMgjFJJVGYVcvrpcvab2BK6QbmIO7/g== 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=v3eOj4qiai22fOPOt13QN1y/qp7600LQSeJ3J+9UUY0=; b=gQgrXGFNkAMz0+fdxfLHWUBN8/8db0HeW6cgYUjrCS7W9YSyFbqU0UiaL2XbdP9NoN97gUY3kAmzenJaUH7rCyAxZLu75GuHKRwcaRnYnaZDbrJ7Y6S0J+kakeS56XNxOV4XzhBIuEi+WbVItoQk1vOrZ1nct330FrJPvAco+AgBxOEniZZDeON57+0J+kNweoMyNpPWs4deRVbVJHVPwc+zU2IkKmtD8E/JYC6eJOmoL8pjsmgCjt2KijctevKHvBVPBIF6RdTUB6gDL72+/6gXm03KFVfFj4pqd84MAsEl/Yz+Y+At3/FB6cgtxycUAjO4TuPQeSeCizBcgCmTcg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=toradex.com; dmarc=pass action=none header.from=toradex.com; dkim=pass header.d=toradex.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toradex.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=v3eOj4qiai22fOPOt13QN1y/qp7600LQSeJ3J+9UUY0=; b=fIhhPaZG1dn8N9pZywGrOVJN2kUKK1Pw+ME/ammo3K6Fx/B/L0KAc+9DeSvBVvVc3+sMuLon4x2j2225fYjtccHBdXiT6p2OxfPQoovZviAoHOP776UojBLfdvSZcZ9QVDN2/IQP02IsEssrjIGlkh8pEmYBpnnPkbP/hVfEkv4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=toradex.com; Received: from ZR0P278MB0377.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:34::14) by ZR0P278MB0234.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:36::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Tue, 14 Dec 2021 12:16:52 +0000 Received: from ZR0P278MB0377.CHEP278.PROD.OUTLOOK.COM ([fe80::e5c4:5c29:1958:fbea]) by ZR0P278MB0377.CHEP278.PROD.OUTLOOK.COM ([fe80::e5c4:5c29:1958:fbea%8]) with mapi id 15.20.4778.018; Tue, 14 Dec 2021 12:16:52 +0000 From: Philippe Schenker To: netdev@vger.kernel.org, Joakim Zhang , "David S . Miller" , Russell King , Andrew Lunn Cc: Heiner Kallweit , Francesco Dolcini , Jakub Kicinski , Fabio Estevam , Fugang Duan , Philippe Schenker , linux-kernel@vger.kernel.org Subject: [PATCH net-next 3/3] net: fec: reset phy on resume after power-up Date: Tue, 14 Dec 2021 13:16:38 +0100 Message-Id: <20211214121638.138784-4-philippe.schenker@toradex.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20211214121638.138784-1-philippe.schenker@toradex.com> References: <20211214121638.138784-1-philippe.schenker@toradex.com> X-ClientProxiedBy: ZR0P278CA0167.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::15) To ZR0P278MB0377.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:34::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 69a714ce-cbc4-4997-bbd2-08d9befb9cde X-MS-TrafficTypeDiagnostic: ZR0P278MB0234:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z/eM5PKz5UDXQKWCP64iTAjpy0JANs40InVoAL5K0dYROIcJjGUBwDb8ZjG3QCICRDhMjQ9D1ISROfEkles/aj3hXQbie2bshc6zixniif1mxYZXXbAoShZGtyfU+gDbfV2rOM3g0h1wFWTqvzUdyqAWU/uv/HE+nN/hlxHar5AqytcLzHbbArsEsJ91G/l5nucJZUn+m/BCZ5OHqfwR5d1MRzLW1D6SyFCkCv6BIoKUMZ3lK1TFez5H5t/c73etUO5ckK5Xy/qaP7V9GU1Okjg8CzKhSMHoea5hg0RDR4naoad+IIOvH6vooONFssRxwC7MoH/4WXzuoRvXdFYmQ6mS2h/qaEurpGmshWTHAG203zVxjsnekCbE0minoEx6p82/SDxAzKi8Qms5G4f0gytYGeR1WpiqrsfOxcNHCnFAH+JClZpdiQk5piSkpGRQJJXP28Pa4dFdfZdf2jGk3EMzLkG7Ah/ySZNAKsw0gu944hSPdsSgo/PdHjH0HwO/Px0Mkro/6UmhHdWyx/ivcPN7YCNo2rG7qR5E7+WgvW7kF7/6v5O9EdExixHuktN/U3E9Jl/TYNG5WemCx9O9mcsxnjV/SVi3JF09uvgQr5Mp6CqUFEqiUNcJ3s82uO7T6aD1nMTrb/Q19v4KG5NscflkgaVN0RLwBuazNVIXt3+ZerwrolKLtdY1t0qgqP/FId8Vg+xTCHKSVl5DXjK/Mw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:ZR0P278MB0377.CHEP278.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(39850400004)(346002)(376002)(396003)(136003)(366004)(8936002)(86362001)(6506007)(66946007)(52116002)(316002)(6486002)(54906003)(5660300002)(2616005)(1076003)(508600001)(38350700002)(38100700002)(4326008)(8676002)(186003)(6666004)(26005)(36756003)(6512007)(44832011)(83380400001)(66476007)(66556008)(7416002)(4744005)(110136005)(2906002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WOWTzSg95kdKx8sSH3Ca17ldVG7nxAr6qc/T5luJopyVOL7DlJqS2K/dJvaK02LssLF4s+QNQUfhDh8EuwdXqeGpT8UDNlDy3OFg7pyy3fnLFnUGbyVEOgWjisx6LnflVZUThcBPYklwpdnhT4c2AkLucWyF1Yozix8h59rS2ISd0f1eV1z9JIYSq3bYrcwJwXgdebSq5+VPbHYEXox0efEGjbdGRZ7WpIOLrbJcFsPpvKIvXyS2UHenKTkV+Rlj3qEPdl8FuskH0aofLTd528m8pHNFYSPDsiXy51lG0wUt8M1JqQERB3D7rYCODAk4GREdOjORO3HBJf3nCpDfm6knX1kMmRHMK9DRKt/+r7EPVThxI6idS7R+XTk8JdRtY/mCTut9vBx7Ld3Ws9ozwozSxIjNEQpxbnvBjWq/n/hRCg3zV7XKcxJH370CzPcl8mB6ti8zkZty5tBHCdDoCfSKUCd1NTVp7EHJ/ux2iI4B1yiCnFps+3cSLJwOjPnkigRXHLcSD2q3dhb9cwCbDMpBN15VFnmx5fCDn0L6zXmSc0zMa613ZfR7K3TqCBVigbznYal+x3j9ELbVZlVnsJl3EWmU7Iyr9b6TuV9nvQ8HeO2vTeMK1qHkj/x49zk0RMcVOmg4Eji1v04hmZC+A8PUYt7NcRC46KMgEiToLWUiNKKj+SrKEGEbHMsOYTup/X6EkPP83t3AIsPgI5/BXqHZwREWUT4/EI2PemheLZ0d2dqWKrLPVJzo1xny0XlIEBNZBDtmguJ4na3fks2I2GtcGumj06e9VbC0EWiAV7ag+Cb14vW4+NKrJodix4q7IE0sbhNsALMkgZ9dSydpm+yxW1pBHg2J7Df3fA4Jc+hlN0INvO4jW7XETn0CE85KvS1a+T9r1kjkSb41kMn57kVPt9CJ0psPtt6NIlUePPD6XFZtnPimzCbAOgvOL81nqNDA+wsRSJBPYRFZ46kyWH/HmTQ7KCrzCRC8x2vinE7MFwml8H7B1wt+P5mWRsHFSO9NwkgDX+K05JzyEzK5qf3h3Afq6xuAHO2RmWzFFrgDqe89EY6sPmB+FQE5B45a+aP3PWVASmcZcf6b9WkkQHF/9wbJyPL1vEo0Dft42Gd7ZpwEfMFVYXYQehlWcEnXnEaij13Up1xIBevftmBtqv30WmVy6XMwetc6doyTIv6VQ9pj7uI5Iqf+OVUHgYUjA3Ds5eQwR9ZSu9chDFcotH9yRlWR9RM7ZP7PyiItYn9ZTeuYnBiMlkFzxq5fmyJMm9NR39IQ/PYENuR7djEysUBFt1ga9pZCsC/z+4biipgmu44+WrpjDi02gNY7rmATyZRKZtjDvEfBQo7OdQAwpIS94u/h64EPntlHFlYMVPLnhqwWetHFsvpOqWsTNS7Ir8jR6jRNG2VE4pIFW+LbVXk1CF5uO59+TnPcbPcmNkRgHxrGJy7QeN4XIInhX2zs2w/W0mPiDbNTVdCw9WvUHfvjW3XYCz7guDjzR/c1+CpU6mVxoYzKbD6Xu5SVFcmrmVsLwchK/FZwpZ6JbAKRASU98ci9J8shVid16y/CpR21MLhd5tl6KRd8Dg4llTQnBylXAIimEs2GdhcxejyVRwdUP//EdRSEPQATDpZ+XIXkoLQq6T6D76Il839eCt+NPIV5nYmSnasvvyJrTCNriQ== X-OriginatorOrg: toradex.com X-MS-Exchange-CrossTenant-Network-Message-Id: 69a714ce-cbc4-4997-bbd2-08d9befb9cde X-MS-Exchange-CrossTenant-AuthSource: ZR0P278MB0377.CHEP278.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2021 12:16:52.8413 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d9995866-0d9b-4251-8315-093f062abab4 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jHU/R5Xi7yCWxiaFwX1DDl5I6u/D2UF1L8h026ipOdwZFyWzQSgVx/ZHjLD2dtOi3fDP1SW5aJrMRpU3RyPxqeKIrIt1J/mLrM8zrp01pjI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: ZR0P278MB0234 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Reset the eth PHY after resume in case the power was switched off during suspend, this is required by some PHYs if the reset signal is controlled by software. Signed-off-by: Philippe Schenker --- drivers/net/ethernet/freescale/fec_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 1b1f7f2a6130..c29eddbb0155 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -4086,6 +4086,7 @@ static int __maybe_unused fec_resume(struct device *dev) ret = regulator_enable(fep->reg_phy); if (ret) return ret; + phy_reset_after_power_on(ndev->phydev); } rtnl_lock();