Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp10038036rwr; Fri, 12 May 2023 02:58:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6zI+H3ZsTbVWR3Fk3oU4insQd8BxWZp+I+Nf85C5ieUPpdHuWDX6e9qUivdE40zuYJ4XAM X-Received: by 2002:a17:903:447:b0:1a6:82a7:6e60 with SMTP id iw7-20020a170903044700b001a682a76e60mr23496609plb.47.1683885511780; Fri, 12 May 2023 02:58:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1683885511; cv=pass; d=google.com; s=arc-20160816; b=NpcaYWEP+U6+2N80UkvUfpGrD/MHxgw7ZSXJKqjosYThYfXkDiiJ1Jf2zkZBTTCijQ vowHoMcpdLaL7JzpVsl9KqJjFk3t2QpJ+z3LkdW5uveEfJlk/g7HGQxTN0ooPNX7DuAX TAOt2wj6Yez1PJn8AKW5u4AI+fykgj28PF8LmiQHca3Tflue2IDCeBHx1cefz2y758CT vx5bNTkU2ftNpcP+xQAaP3SYH5FZFL7N1Ae9HtN4MVtZ0z2vDwz+XLsN2uPYkAdE67W1 ueWXQDBhldjQLil2U7nw4rnUVwkTP0ODB7DwUFH9OGqI2LUwGy17B1N7sv81VOWM+nhQ h3og== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:subject:user-agent:date :message-id:dkim-signature; bh=Ssy1hFHMDshgG5P9kzGaPzwK1cSgc4LzI1+yOtQqD0k=; b=Z44zTPAl6auZlsATBMCu5FKQMQqVFBNtp0tGKsrN4DVywRzynmTnoRB9crFc0aPm9Q AWMLaVKTWhOP7cUyfeWXkqOgzM4WNVdZxIFnUtV6zBcB8s9o890+zqtgZrapOsKUHLwM UCv3QCfKvMOho+rwidQQT9gV6I3L7oepgEgpmbcBxuyg+BkbSR3267hGAgkbJNauHIp5 RdWbqIDlywF3qddCcCMLRqBXn2pwB1hLsbjxnQjDu6l0FAfn5JLUFI7eoWgcr97kzDEA Z8SmcmlZNJz96t6g7xV3jYtun0ZXen+Jbbk1JEs2hX+df3hxO8k2kGbjtChhM6S1uVZY aAyw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@outlook.com header.s=selector1 header.b=UuSsgEot; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a5-20020a170902b58500b001ab13c7505asi8412012pls.125.2023.05.12.02.58.16; Fri, 12 May 2023 02:58:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@outlook.com header.s=selector1 header.b=UuSsgEot; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240357AbjELJuR (ORCPT + 99 others); Fri, 12 May 2023 05:50:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232260AbjELJuQ (ORCPT ); Fri, 12 May 2023 05:50:16 -0400 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01olkn2109.outbound.protection.outlook.com [40.92.107.109]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E13795255; Fri, 12 May 2023 02:50:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GQZKELfY8OKj5ehQ097egqcY4CSzRlah0GpwL4CGUDEcxuSO4AWQYlGA4zXQE5b1wABB4wPrveZm7OaEO2/8mxPzXMfu/I+eH8hQHGvKXmo/rEF+V6+lZer3nZIFhxTQZ5vRb1XI3qy+7dFv1YTLhkD9582ZImGLzJK7SVJW3Myfw3QmObQzzl4MUGERleqQtA+4Fz+8hJ9RQMpb4o/tJSaOpfn4KlKtLqWw1yYWZT2NOlMp7oqUc4fuFX5Q1J8UVpTRh+SICeq37OiKsJJsn/YAHdK23XIhURCxTARFk/OOMMz3GGnfQ6nNhIwGM6OCUGzJStvh6C5aAZxTJaMQxA== 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=Ssy1hFHMDshgG5P9kzGaPzwK1cSgc4LzI1+yOtQqD0k=; b=Yo9kiSqHFNPMVJxRKp96B+YdLJtbtTyH4sszgD1RP8Yl1SFAYIxjTahGP71QDTsDQ2HhoYSptR1yhIjF0Lbu0UXP++UZmRhazFlDPaJ19/iKZyG/QWAUaBhjTKNbkiheoBh4/bqaAmnfRRClGEFWcq/y6SuY3qivdxdmPfv1u+KhVKXB1DheRLx2cEXktaldh8s6bpyHR1boK1eCe9fWnZAbZxdLe8PbR2D4rbCcWInQ3CTnsYiQVSWobBFRqcZF7UWs9iSS9ebYXPrj3sogM59kqloZOgmJoEV/sq50DGBJ3fbWNTX22I2gVVZqLnNeEYjiY/ZWy87DBPiZ57opIw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ssy1hFHMDshgG5P9kzGaPzwK1cSgc4LzI1+yOtQqD0k=; b=UuSsgEotHats6F4BFKv7/TbwbqPpXDjekAUJVIJBUq/I2nUUvKobeqsEaRZh28rMInBBaSvagOY3LOld3lBiAIhJKCUh8eVXy1uPzZ6JBT5qLWT9YW/FK+VwaLLVYsUn11n3dwt38l2kCSN9ozwiyTfd/i1xviQ5poiIyHDLns+8qJx44g8ojwj98bZOWCaSIOD8isRL7wm4CEKYQrM8XUVygFgLywssOHCVFxvBfEuy7JNu42saviKRQOp/tWPHd0PF05BM6Lcex/xAc7xDykIJbJdcVCST/HBRG+N09mhxFEQDvB3G4W3ByUONfO+4HhIOjHFFJKq561RZnzyvNQ== Received: from KL1PR01MB5448.apcprd01.prod.exchangelabs.com (2603:1096:820:9a::12) by TYUPR01MB5236.apcprd01.prod.exchangelabs.com (2603:1096:400:35f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.33; Fri, 12 May 2023 09:50:10 +0000 Received: from KL1PR01MB5448.apcprd01.prod.exchangelabs.com ([fe80::93cb:1631:4c4c:1821]) by KL1PR01MB5448.apcprd01.prod.exchangelabs.com ([fe80::93cb:1631:4c4c:1821%4]) with mapi id 15.20.6387.018; Fri, 12 May 2023 09:50:10 +0000 Message-ID: Date: Fri, 12 May 2023 17:50:03 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v5] net: mdiobus: Add a function to deassert reset To: "Russell King (Oracle)" Cc: andrew@lunn.ch, hkallweit1@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: From: Yan Wang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TMN: [YEyoNMlRbsdaRczHA7xgW9Ge+pCLKx9s] X-ClientProxiedBy: TY2PR0101CA0033.apcprd01.prod.exchangelabs.com (2603:1096:404:8000::19) To KL1PR01MB5448.apcprd01.prod.exchangelabs.com (2603:1096:820:9a::12) X-Microsoft-Original-Message-ID: <35f118e6-83cb-f771-4bfa-f9c029bc0803@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: KL1PR01MB5448:EE_|TYUPR01MB5236:EE_ X-MS-Office365-Filtering-Correlation-Id: d694fe0b-3f29-402d-58ec-08db52ce4693 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AiPcmNvmFxN6cSRU1vc4TEWeEOP4x0Yperccl/hy5r5fA2JW0dA3nLmqNWEBVJsn0d8H3EKdnAQc5v48eY5JyQKlhP3LdSDmJf4ixsv1x4OleKB+9ns5Ec1Zppn4nlKtzGGNOBhLgh0giSHccuZ2pYZj6TtO1btOX9CQjE847YLZVmmw9IrMwocnOcnBwIBqiTx1LdbA0akHL7QrdbYvX/uYqUxAmha8i+NFS0bgLQcsedgddFns5Ig1micKMEcT0ZlNO2ehyWqPaGE/emMNyKAVm0/SaWdW1yXgNhIa829caC1eyBN4P8euCSc3j/+xKf8PU49d6yEAEBp0xE+wxzc9iAJeHeKu3IujFBVaXP9Nlz12PB9Ls7CLoT0ZMwHy/EytA+4KsSBOVOW92mKbOHfSvFy7DRsE/960qATfyAetoDY5U4No9K33cAkWEI0vzDeW1HpwwConllcemh0vuBEHoDGtgkerKZIkpDzZwY9maFBbtiz8sbCSuNLuX5VVFr4AzlaOUdd7sOkRWmhWEnia45vTDR4aaKWnAxlCnkgZzFkOF0Dw1XgvPa7nqstITiBEqx3KdDG1q8TtRFOiZ9BIWdn7SZ1qNu4oasL8IgCDSCZHuyTlU+TBJkKuMF6w X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-M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T2V4VlFuWXI2Qmt4QmUzOHlx?= =?utf-8?B?NWlUOGxOb0NwRXg1Wkc0alpabDBwaXBSZTJkaVpiMnlrZTN3dU1iaGppOWl1?= =?utf-8?B?UEk5UEhFYzlHczdvN3k1b21ubGVEYkxXZzBYaU9NS0R6eGhCNHVOMFkwYUlW?= =?utf-8?B?bEFJR25xSWpBMTlsbWhWM0RscmJ3eFgxTC8wNEU0VjN1UVhTRjVKTnJFaVo5?= =?utf-8?B?ZGNJOTZ0TWxUbjVaNWJkbUVnWStqU1VvZEpHRDlZaVJJVlpHUWRWcWw2aGUw?= =?utf-8?B?d0NYK2o4RkIxUnZvZU42YjJFNkxIZEJFQWxMZXZnb1JDVFJ6UVFucjQ2WlBK?= =?utf-8?B?K1FqTGExRXNoR3Y1UkwvZXNjbUJSWXRzb3FjN2trRnJ6ZWIyNkVzSHdIeEkv?= =?utf-8?B?cnpCUWNCSExJakZNQzdiRXByOTZwbFJsRTZkYlBtcXJOYjZ2Q0ZnRi9sMGcy?= =?utf-8?B?bmpXaXREdW8yWWdscElnT2h3T01HdmxkMG1vVWZ0aXRXR3lWbWkzdmNDL3F2?= =?utf-8?B?VmVtc1YzS3NNZHluL0RHdnl1L0x1OFpFYmJtbG5Rd2dqZUx1dThFM1FaSmRT?= =?utf-8?B?czFFQkhOejdPdkJvZHc1SDFmOEsxeXgrQXdkVjZtTHNtMDNTVmhETkFPR0pD?= =?utf-8?B?Lzg2Tmo3TTNpNFc3R2FzOGJLTEIxQzJMbENGazlRWG1FR2xDMDM5YmNsWjJP?= =?utf-8?B?YXNOQXBpYitOYTBEc0pWNWRCYnA2aE9yZGdVeFVxMThvOE40WEdKUHJ4T3pI?= =?utf-8?B?T21TUlRkZXdFdkR2R2lQb2doYUlWdmc9PQ==?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d694fe0b-3f29-402d-58ec-08db52ce4693 X-MS-Exchange-CrossTenant-AuthSource: KL1PR01MB5448.apcprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2023 09:50:10.5925 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYUPR01MB5236 X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_MUA_MOZILLA, FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/12/2023 5:41 PM, Russell King (Oracle) wrote: > On Fri, May 12, 2023 at 05:28:47PM +0800, Yan Wang wrote: >> >> On 5/12/2023 5:02 PM, Russell King (Oracle) wrote: >>> On Fri, May 12, 2023 at 03:08:53PM +0800, Yan Wang wrote: >>>> + gpiod_set_value_cansleep(reset, gpiod_is_active_low(reset)); >>>> + fsleep(reset_assert_delay); >>>> + gpiod_set_value_cansleep(reset, !gpiod_is_active_low(reset)); >>> Andrew, one of the phylib maintainers and thus is responsible for code >>> in the area you are touching. Andrew has complained about the above >>> which asserts and then deasserts reset on two occasions now, explained >>> why it is wrong, but still the code persists in doing this. >>> >>> I am going to add my voice as another phylib maintainer to this and say >>> NO to this code, for the exact same reasons that Andrew has given. >>> >>> You now have two people responsible for the code in question telling >>> you that this is the wrong approach. >>> >>> Until this is addressed in some way, it is pointless you posting >>> another version of this patch. >>> >>> Thanks. >>> >> I'm very sorry, I didn't have their previous intention. >> The meaning of the two assertions is reset and reset release. >> If you believe this is the wrong method, please ignore it. > As Andrew has told you twice: > > We do not want to be resetting the PHY while we are probing the bus, > and he has given one reason for it. > > The reason Andrew gave is that hardware resetting a PHY that was not > already in reset means that any link is immediately terminated, and > the PHY has to renegotiate with its link partner when your code > subsequently releases the reset signal. This is *not* the behaviour > that phylib maintainers want to see. > > The second problem that Andrew didn't mention is that always hardware > resetting the PHY will clear out any firmware setup that has happened > before the kernel has been booted. Again, that's a no-no. > > The final issue I have is that your patch is described as "add a > function do *DEASSERT* reset" not "add a function to *ALWAYS* *RESET*" > which is what you are actually doing here. So the commit message and > the code disagree with what's going on - the summary line is at best > misleading. > > If your hardware case is that the PHY is already in reset, then of > course you don't see any of the above as a problem, but that is not > universally true - and that is exactly why Andrew is bringing this > up. There are platforms out there where the reset is described in > the firmware hardware description, *but* when the kernel boots, the > reset signal is already deasserted. Raising it during kernel boot as > you are doing will terminate the PHY's link with the remote end, > and then deasserting it will cause it to renegotiate. > > Thanks. > Thank you very much for your explanation. I apologize to Andrew and I will handle it on my bootloader Best Regards