From patchwork Mon Dec 6 10:13:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Schenker X-Patchwork-Id: 12657967 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 DCA83C433EF for ; Mon, 6 Dec 2021 10:13:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233044AbhLFKRY (ORCPT ); Mon, 6 Dec 2021 05:17:24 -0500 Received: from mail-zr0che01on2133.outbound.protection.outlook.com ([40.107.24.133]:8033 "EHLO CHE01-ZR0-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229712AbhLFKRX (ORCPT ); Mon, 6 Dec 2021 05:17:23 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e8ea6gNE64/Ir7iv8XjaXu3PvQH0mu1GmHMJGKKn9Viu1TDSGKeSZ+SrpxGl6PzImPFP+DzafqnATV9BIRq0tHVBDVmADJujxVawnFEwM264rKbG44c1C6qmYejL9C5k53UelpBpyvkv9VLqhJhFOAPu7ntwKepFxukQXytA+ZoLD5gSEcosSohQCl8u98NRewhEtHfkG+pXbwLUQakxemmwiCHg739eIXewU+xoMudNtVSkfZ4KE3ga/dKe7c1f8Xi/s+L1xX9GeTb59L7fkzD/hVl0f3MX+XZbCgnm9xdYMrK855qaCbyD23eg0uYob6m4m6egt1skH9t01ix2qg== 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=B8s4gAHONKxMoldr5/NAPbR/ozmxdC6buEjMMXauXhM=; b=nIdbBnlouWPcoajbQB8/4CHrhLqCWjc65MAb3Onob9gT9zYJxjeTAe0gb9NNBskZmZsJj2adOIoJYLtJdGs5tLlXJfWKDtD+grnoVa3LCaab6rqryR5hFs93vAxtTr+XSLqsOS8jjChWlhtoICkIaZkJze3jvucYCVIY65WCp0vqxXlk70vr+BwIQzz5No3eiHkg+HnCY+M/liOq6p20oPHtmP4t4kUX9VDxPY3iyzK8dRil2t3hEBYVe1mz4RTbgKdeGLvhmu8ekwhFaLSIzLDMHfEwn4DED8lq0l9vJyghtX4UBPB6iGAGuPeBa4ac5kDWPwne3sRsfQ9MVUqTZw== 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=B8s4gAHONKxMoldr5/NAPbR/ozmxdC6buEjMMXauXhM=; b=Ka5NjiTeCbl+u5vPbF7s0RE0bEXrSMYIPkBy0Hkt/qP47Q754r1GBO48fBnuwiIrKMHeSp5F/pyKzETZ8KicCD6fj2nRpSvvnQ2pMSxdyuJoCSRkPkW4EMAuZWJHRdmdgKzQT9RADZC0dgWRRVvK2jwlI/pWUb/IAWcl/hvZv8s= 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 ZRAP278MB0206.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:2e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16; Mon, 6 Dec 2021 10:13: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%9]) with mapi id 15.20.4755.022; Mon, 6 Dec 2021 10:13:52 +0000 From: Philippe Schenker To: netdev@vger.kernel.org, Joakim Zhang , Fabio Estevam , Fugang Duan , "David S . Miller" , Russell King , Andrew Lunn , Jakub Kicinski Cc: Philippe Schenker , linux-kernel@vger.kernel.org Subject: [RFC PATCH 0/2] Reset PHY in fec_resume if it got powered down Date: Mon, 6 Dec 2021 11:13:24 +0100 Message-Id: <20211206101326.1022527-1-philippe.schenker@toradex.com> X-Mailer: git-send-email 2.34.0 X-ClientProxiedBy: ZR0P278CA0183.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:44::13) To ZR0P278MB0377.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:34::14) MIME-Version: 1.0 Received: from philippe-pc.toradex.int (31.10.206.124) by ZR0P278CA0183.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:44::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.17 via Frontend Transport; Mon, 6 Dec 2021 10:13:52 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 45e87c8f-7fdd-42e6-19a4-08d9b8a11a78 X-MS-TrafficTypeDiagnostic: ZRAP278MB0206:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UjHniDJP1WMQzlQXkXUuBXAfdkUohJ4LyEmJ3Pphj6Pg8qSzpYtj903XzxaKU/BdANUx9VkMQzkaAV3QHeSrCwc6DcHrk4c3FtHhsON2/VsrB+4A3T7nUsxBcPletI+dDLvObxxSH0zVjR60JOeHQN//ZhcdcsLraMgs+kgmQSdSwhszWUWR3Bx/g6Y2/6yMhn0zIoUuXv57ghgYKjTEFWwRCJoXZYw4kXPpYrmfmzZhTSu1B71rgqUjxjyBcs7ONf2ftPucPXdarB2mWwrzMMxHI/sXpfSn3vFEYhcmVjrg5J9VtGYKy3s+uii3Nctwu87xzPlPyaUPaI0EbgJTnKOoqYy9+IIaI8CZY/e/Iwv+KhPk1yk7bw0P8ORNBhw7v3l6xbZdG0KU46me3fSYIGuY1yCwszvz9/BE1kUix25C+LOEgUppOusjbVdwMQ+QqQOqxNeH7MvzaMrD/LuRQ93HqTQ1ltVW2iJR/gUQbQHCVoNYQKneGdW9opqLjbi+d1cWgUz6IDJO4GNqVz8tVjsCj6ogwVvKDaCVZSS9MAog5XaZ8DnILcyOtcAZxhRXIfJx/XRc1Wm/iww5wePzNUJlLApDXDZc6W38y7tkFYs0xeCWrKC/f/PyGq/4o82Sl7k5sALxEGCr7tW6zq58chJpbLPLQYPeaznrQyTryWeyqn4q4gRLj+tyehTYrN/QGs+My9z5S28+bunpCDwQhORtXCy3LFHPJHQWj7rzVX1jC3H8MYYmIeSRBj/3FIfxjRlvtI13vv5w1GFv0UQDeVoeMe8AIAfyOSKCMOekC2N0QWrCU7fD+AAF+49XYJxV 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)(376002)(366004)(396003)(346002)(136003)(83380400001)(2616005)(66946007)(1076003)(86362001)(36756003)(2906002)(26005)(966005)(44832011)(956004)(6666004)(6512007)(66476007)(66556008)(4326008)(8676002)(6486002)(110136005)(508600001)(316002)(186003)(6506007)(5660300002)(38100700002)(8936002)(52116002)(38350700002)(16060500005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zEBc2wz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v5jw3BOZfT7+a9hen6bQZQ6PmjUfLcaJOGLG7OoRImwcTUmFCmQ/3W4y+VgGyg0iG4kXNbtMxwrRhzEO0cHVM54+RTiU1J5cJnPC5k30RyllYQCTEwc8iLA+gzpd6Imu9lwNYNywfD0xY5dfhUzZRDONAt5T3w7uZKYp91y4KtMejJIYnE3OYBnPKxUu0Og+HfGA++MfQBQbySkLXVmjaSXkKU1H5suQnLvtMkyaYFJzylybJGJR981/fGd7Tf0rIpDXfF6W/RX5ITAf5Lcul4cb2uerfDO17Qt/bLP32Dktxh0pkJv/iXKVkdhAi96GLRmHWrs/5qKmIXfJUrKr3JQl7hLa8KRRg4sYvtb23QN16jtWnjJbKLlrIbm+wrAcFtfX6/xFFUrTS/WD5K7man8dOT20hR9+VIecmsR6ZIJHnqOzU45bT0V+C75uL6h6ExAst5YKNkag8WgBOB9zpbhAkWMyxvztKdhPoO5ImCVcONZqMSQiIC3UKDlgpguimEyc6fKIymk1QanmM26QHytUMKy7uXLrVTiZCSu8CZpR0Qkxv3aEjNnwVlSRvzLdLjtZz2wfZQKjDFiItamMOOVcw8LLQ== X-OriginatorOrg: toradex.com X-MS-Exchange-CrossTenant-Network-Message-Id: 45e87c8f-7fdd-42e6-19a4-08d9b8a11a78 X-MS-Exchange-CrossTenant-AuthSource: ZR0P278MB0377.CHEP278.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2021 10:13:52.3885 (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: yl4o9RyV6ObP60tSZUJqV1HFHUk4lVCpvf8cOKLUQsylJ/aUlvRpNRRU0/or207lfKAUiEPTZ2xX85Dc0vqjLhN4pmxYMz0Pt68SuA/k7p0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: ZRAP278MB0206 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-State: RFC If a hardware-design is able to control power to the Ethernet PHY and relying on software to do a reset, the PHY does no longer work after resuming from suspend, given the PHY does need a hardware-reset. The Freescale fec driver does currently control the reset-signal of a phy but does not issue a reset on resume. On Toradex Apalis iMX8 board we do have such a design where we also don't place the RC circuit to delay the reset-line by hardware. Hence we fully rely on software to do so. Since I didn't manage to get the needed parts of Apalis iMX8 working with mainline this patchset was only tested on the downstream kernel toradex_5.4-2.3.x-imx. [1] This kernel is based on NXP's release imx_5.4.70_2.3.0. [2] The affected code is still the same on mainline kernel, which would actually make me comfortable merging this patch, but due to this fact I'm sending this as RFC maybe someone else is able to test this code. This patchset aims to change the behavior by resetting the ethernet PHY in fec_resume. A short description of the patches can be found below, please find a detailed description in the commit-messages of the respective patches. [PATCH 2/2] net: fec: reset phy in resume if it was powered down This patch calls fec_reset_phy just after regulator enable in fec_resume, when the phy is resumed [PATCH 1/2] net: fec: make fec_reset_phy not only usable once This patch prepares the function fec_reset_phy to be called multiple times. It stores the data around the reset-gpio in fec_enet_private. This patch aims to do no functional changes. [1] http://git.toradex.com/cgit/linux-toradex.git/log/?h=toradex_5.4-2.3.x-imx [2] https://source.codeaurora.org/external/imx/linux-imx/log/?h=imx_5.4.70_2.3.0 Philippe Schenker (2): net: fec: make fec_reset_phy not only usable once net: fec: reset phy in resume if it was powered down drivers/net/ethernet/freescale/fec.h | 6 ++ drivers/net/ethernet/freescale/fec_main.c | 98 ++++++++++++++++------- 2 files changed, 73 insertions(+), 31 deletions(-)