Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1399136rdb; Mon, 19 Feb 2024 14:32:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV032yXWZTPgb2hzuKq90At7ct7PxL+brezXztOViE57T6kg+aYcmEbOOHeM+pXYxUm737UrOqFe6xPriMHsWPUOlYsDyM2kl+do64xpw== X-Google-Smtp-Source: AGHT+IE8zgX+euEpQRpyjt/3/sWHdv5KmxQ36+LHEECzPgJih6O4cldsW8lv3COpzu97HNnkjKV7 X-Received: by 2002:aa7:cfd2:0:b0:564:5297:4fbc with SMTP id r18-20020aa7cfd2000000b0056452974fbcmr3468850edy.16.1708381937643; Mon, 19 Feb 2024 14:32:17 -0800 (PST) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id s28-20020a50d49c000000b005644479ae57si1880460edi.537.2024.02.19.14.32.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 14:32:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-72060-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@outlook.com header.s=selector1 header.b=UI4l7sN3; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-72060-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72060-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 221601F23352 for ; Mon, 19 Feb 2024 22:32:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 97E8556452; Mon, 19 Feb 2024 22:32:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b="UI4l7sN3" Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01olkn2031.outbound.protection.outlook.com [40.92.52.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6259620335; Mon, 19 Feb 2024 22:32:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.52.31 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708381925; cv=fail; b=S+4K/ZRupF7j5clcckvQsftWJnVf2OtFP3dTBBRD/DOqdS9t/dqW23Jn2nBNEgz2iq5qiP2ubnSdUvuse+TMwFpnuPZROqK2akF0Rmrv6tVdFzDABhMxlAziuNIEOK3nSqkZ/Nneb1Ev+83lLfR+sKml1dyGB2cLuygeL4VkOf8= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708381925; c=relaxed/simple; bh=xUsebm1ec0UtYUswG+zt5OVp6dfKzoP5MFd+T7emom0=; h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To: Content-Type:MIME-Version; b=KJb7jLHLd37XKZYYmknZVnCtS4EFYcyPnc0283kSoqMDl71hq6Ea5LIQGJzMcjAibA6tSuLhPrOxOAk4bsGwthk/mddSN1nWJgwIMbyfvd1ibaoKvtm4EmJn9uaS9MOYejRNXn5GfKRek8Yrre+HHpMy3qaPAp6PrCXHrqQsA/8= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com; spf=pass smtp.mailfrom=outlook.com; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b=UI4l7sN3; arc=fail smtp.client-ip=40.92.52.31 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=outlook.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eulVKpdKw9oDi00xK0VscXkJbb8y00TYFOcZYqFWwBAOau4nU+s0yEHL11xxpDaHkhK682f+H2aH00fWgYaVm2URYCus27xufmAnu6MIQe2R3lYyUOQVCU/Stz/N61SXz36zD/E+XyYEdqwRniNcaeJZYZD+vfYhnjLOgoWgF045yIzOk1GmxqtiqCotjn1L/3xNg9EF6unrl27nhbe5sc+Bq0tJUZvjA5fPz2YD7Mo2YJw6G2sS9aw0rwKoc1VkXI89s3zxYH6BFiDO/3B66aTGx6BWbE9wwBArnWiU0ARWNHhmstYlDvFJP+pwNhyVXO8SbY6qk3MQ2ukAZpukeA== 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=SpKl62wVKnisNKRcN0KJrKT8zc0WaNK7bdKvdebx3HI=; b=YX2UGvM2qFeZWVTxLL1Jlro9Eta7MPovkWI+1NwSZDwepC1KJGMMRGVxZ43VIqUwoVl+vLUNWtZTK48taFPM9x21SaY/S3xt6HYL16jSxrIi5MBcqIabaS72Ku4p11+ZFLO1Bu2NV0+Pt541+t9T1Mm0yVLHnuYEcMTevsKz5zVFAbzbc48He5Miyn4zidD7t0FQouvRGn7F1yTaMTDyiCeNm4FcfLzZwrFUj3RslGUf4iXpqCjoMawuWCScVaRTJ0BQkVq2m06AW6fPKym+CEoyQs4Qw92KnzWHuwAQVn0d/JetdVj2ZgQJYdo0fw2kNutkaDncch6ylKvl2awXEQ== 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=SpKl62wVKnisNKRcN0KJrKT8zc0WaNK7bdKvdebx3HI=; b=UI4l7sN3mAYlX6FoKA50FK0YKHIr0omYXg26vSsBunFXaOXGqybEtG6cnBy8tuscqmN3isee7O7lAosTqRxQMxPQbk1juMnX/6BjK+a0PIMCQ5V7q7HUprfWoKwEP0aRDUaKim1oj5F8Av69Qk7kc6uluR6cPtFfsaBcb0ONEbDPP3eOJ0zUR+PngctDBLiKf8jG+NBnwMN/HS1sXBRq98Cn4fFc+Wyuah4u+QBpA9PpI1x1aG0+pAt4W5hQ1zP19GQorMrblGvNGyWnD/5Y3tDlM/4r8Z8O+v17NlqD6u0fmNwl18CNlSy2dzkY9zpfsv67seGHiSm5lSlcWqkJPg== Received: from SEZPR06MB6959.apcprd06.prod.outlook.com (2603:1096:101:1ed::14) by SEZPR06MB5958.apcprd06.prod.outlook.com (2603:1096:101:e5::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.38; Mon, 19 Feb 2024 22:31:58 +0000 Received: from SEZPR06MB6959.apcprd06.prod.outlook.com ([fe80::53da:a8a:83cb:b9ad]) by SEZPR06MB6959.apcprd06.prod.outlook.com ([fe80::53da:a8a:83cb:b9ad%4]) with mapi id 15.20.7292.036; Mon, 19 Feb 2024 22:31:58 +0000 Message-ID: Date: Tue, 20 Feb 2024 06:31:51 +0800 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v3 3/6] net: hisilicon: add support for hisi_femac core on Hi3798MV200 Content-Language: en-US To: Andrew Lunn Cc: Yisen Zhuang , Salil Mehta , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiner Kallweit , Russell King , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org References: <20240220-net-v3-0-b68e5b75e765@outlook.com> <20240220-net-v3-3-b68e5b75e765@outlook.com> <29fc21f0-0e46-4d0f-8d4b-c4dbd1689c55@lunn.ch> <5572f4dd-dcf2-42ec-99c8-51bf4d1f28ba@lunn.ch> <0beab72d-2919-447f-88ff-fb7c92b28b61@lunn.ch> From: Yang Xiwen In-Reply-To: <0beab72d-2919-447f-88ff-fb7c92b28b61@lunn.ch> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TMN: [haGMHqRo7V5+MPHwr5ctdGFuvHeNObt4OH1ItYxDtypP28DXPdKYJc69SrMlsuF34ISbms9uC8c=] X-ClientProxiedBy: TY2PR01CA0021.jpnprd01.prod.outlook.com (2603:1096:404:a::33) To SEZPR06MB6959.apcprd06.prod.outlook.com (2603:1096:101:1ed::14) X-Microsoft-Original-Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB6959:EE_|SEZPR06MB5958:EE_ X-MS-Office365-Filtering-Correlation-Id: e403f00d-d0cb-4d96-679d-08dc319a955c X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aIXfUUPJMq6DDtBRfTz0bAkXMAbm4UG3YMCDlTJLBPDUDuQVomG/WFJde320tyt5MAY4dRK5Uhuh+cvUgM3vhgZj5d9tUxB4Z1uvEkSt4Ry6UGc+fgbj2MoUa23eZj5tQBJIkEyjZq3GLdnJmITWVQpCpEWLzfzq0qn75lTgKIGWdK1Gqs85E+it5RLdd/Dhz4MH/02U1ENrkhjKTD4ZnqWtZgTOBbfdv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cElqcXJWeFkzMGRGQmpyaWhkTHlBdzg5VGdPMmxObEhkN1c1QmhpbVNP?= =?utf-8?B?L1ZNYW5VQktxNm5BczdRa2xDbXl0alNwOG9YbUZyd1RVcVJYYnlFU093ZE1u?= =?utf-8?B?NVZhVUVkd09UZEExUGt0eW5tYjVoWjdFL3Y5cktqZXpiQlVBK0szWkRzTi9L?= =?utf-8?B?L2V3cnl4ZXl2UWRvaGt1TXVuVC9oNGhyVnpUdmRheSs1KzJCdjZ3RVhRL096?= =?utf-8?B?d2lZNGdyUmR2NHluL3ZGUWhIUHVoL3pzMEZDRmI4SFE0ZWd4T2Z0emdmUzlJ?= =?utf-8?Q?raDfM/gxWKia4ev1w8nv8b4sXZJEjuOB0HLPfJ6?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e403f00d-d0cb-4d96-679d-08dc319a955c X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB6959.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2024 22:31:58.1727 (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: SEZPR06MB5958 On 2/20/2024 6:05 AM, Andrew Lunn wrote: >> It's not MAC which behaves wrongly, it's the MDIO bus. If we don't follow >> the reset procedure properly. The MDIO bus fails to respond to any >> write/read commands. But i believe MAC controller and PHY are still working. >> I recalled that it can still transfer network packets, though it fails to >> read PHY registers from MDIO bus so only 10Mbps is available (And the phy id >> read out is always 0x0, normally it's 0x20669853). >> >> Maybe during initialization, PHY sent some garbage to MDIO bus and killed >> it. > MDIO bus masters are really simple things, not much more than a shift > register. I find it hard to believe the MDIO bus master breaks because > of reset order. If the MDIO pins went to SoC pins, it would be simple > to prove, a bus-pirate or similar can capture the signals and sigrok > can decode MDIO. > > To me, its more likely the PHY side of the MDIO bus is broken somehow. The MDIO pins are not accessible from outside, only PHY pins are exported. Maybe. I've tried many different approaches before i sent this patch. This is almost the only simple way i can implement to make it work. The downstream is also not telling us why it is needed to disable MAC controller before PHY reset. But it is mandatory. All i can do is to guess, unless HiSilicon people can join this conversion and tell us why. So the conclusion i got from trial and error is that MAC controller MUST be disabled during PHY reset, no matter what the reason is. I hope we can have the framework providing utilities for me to resolve this (e.g. provide a custom callback for PHY reset, in mdio_device_reset() function). Also it's very strange that, if the PHY is reset in a wrong order, (i.e. Now we can not operate MDIO bus), we have to do the PHY reset procedure once again, simply resetting MAC does not work. So it might also be the PHY which is broken (partially). > > Andrew -- Regards, Yang Xiwen