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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AC46DC25B4E for ; Tue, 24 Jan 2023 13:12:48 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D30C18564B; Tue, 24 Jan 2023 14:12:45 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="YkZs0b7y"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0827F855EB; Tue, 24 Jan 2023 14:12:44 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2BC698564B for ; Tue, 24 Jan 2023 14:12:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=michal.simek@amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gUwhkmJMP+yCvSp/6lIqeJZEhuM833KR3Zh3cDcrTTkKzzG5qsKlEXcb3SwLlQ461Pah/LRtuS4uWNlDndZofzFD52de4oNQKV9CcX8F2eavlaPV12dbaqIMUQ3UuAkMJwkzMoiCX7GPDUSH9glYsQnosBxlTIm4DbZ3ePdn2zOpqpd9O3s68VU/56qo9bnmO44IHKGwVf9aa1doTefNgz3NKnmXSK+MfedN6nxmcSeQj+KEEvQYyVYZ+xFvW+9gbDfvOLEgkZued+TL0xyeth6rm6XalfNvl2Sqxch3SOnU10sHrlBfd2weDbiTrZp7Uoi6a5GKGKEcjrpE+pGtPQ== 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=BxJEtUJ+xi/J5cK6Dvu/kmMZACydQKOPQZc8WYCzcqI=; b=ORCUTCKFTFbYFJodX/Qa35po+wmS3naqz/+QWHB+LXV5TsaIUymjg+oXJhaNJgr30ei2YYqzzETfT+HhT5Y4ZhlmuWgZ5tuAyXcdJCHiMc62eF1RQm5XJlGRnTToSKj+3m3wjUjjOSBITHbxNP7bWPdVfC6Zys0Lua8Egrrd2iJE0O6r29jQpQcL8T/91+PemjIrEILZVtZcky61ls9QYGroo9mK0LlVILesvn5fv0rlwjA3acUHQFyMc1Hpo8+KedHjdb+jhT1MjcMgo7CN8Evkt1rS0u79UIsaRuVvzQgZUzEv3Opz5SjnpghqBsKTTgZ5XGO7RkwI4FmLim1Ptw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=denx.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BxJEtUJ+xi/J5cK6Dvu/kmMZACydQKOPQZc8WYCzcqI=; b=YkZs0b7ysEOHvhP7M2dINMOMk+LW/RVAVAo/FzZVtUF8hN3NLPWTcoL0pX8byEDkxt63vpZuTQfAF9uE5Y1H26zgANzeweuNB0t9FGCXR07Foe72jMjFGHsytg+AdrszPHGOTDlZg8WBVI8PQ9KEkz+KgWWBywJEb3mlvbB9nyo= Received: from DM6PR04CA0021.namprd04.prod.outlook.com (2603:10b6:5:334::26) by CY5PR12MB6622.namprd12.prod.outlook.com (2603:10b6:930:42::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.27; Tue, 24 Jan 2023 13:12:38 +0000 Received: from DM6NAM11FT108.eop-nam11.prod.protection.outlook.com (2603:10b6:5:334:cafe::ee) by DM6PR04CA0021.outlook.office365.com (2603:10b6:5:334::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33 via Frontend Transport; Tue, 24 Jan 2023 13:12:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT108.mail.protection.outlook.com (10.13.172.95) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6023.16 via Frontend Transport; Tue, 24 Jan 2023 13:12:37 +0000 Received: from [10.254.241.50] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 24 Jan 2023 07:12:34 -0600 Message-ID: Date: Tue, 24 Jan 2023 14:12:32 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Content-Language: en-US To: Stefan Roese , "Katakam, Harini" , "u-boot@lists.denx.de" CC: Ramon Fried , Sean Anderson , "Abbarapu, Venkatesh" References: <20230111073051.1248341-1-sr@denx.de> <6cd46669-8cae-af01-437a-b93b8a5bbd8f@denx.de> From: Michal Simek Subject: Re: [PATCH] net: zynq_gem: Add a 10ms delay in zynq_gem_init() In-Reply-To: <6cd46669-8cae-af01-437a-b93b8a5bbd8f@denx.de> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT108:EE_|CY5PR12MB6622:EE_ X-MS-Office365-Filtering-Correlation-Id: 361c07a8-4f98-46e2-3c69-08dafe0caa8b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: t5oyw8XaudStn7SHKMTnDz4F2UMr8CIz/a/PDf0/NmjAN1MHtJ6kZcL7pudhycZawsja3bjdJGpyaXaWJAWWQKWvI/fAizSDifALEVuFQ8bQUDhWKTgb4N0B7BBC4R9uHggUCTgXX1w1oagbJvYOv1kEuaVTn+VN7FYGYI3RKyFTA+TP3IRs9blr6fpR1r4wpqG+aEMKkux1SbUz3JFCBkI4Z04Vw+HC1olRzgimqofpva2Gi5qRlDdCY+eCcrPHfjOCMEnjMlm9Oc3x9prJev78W9Z8LlTiOPlxDeJQvnrnbyuG91vxNQW1SvFmZfOogl8Ja9UrLdDfp5z1jTD9p4qgBdFV3Po35mGCf3PYlrFfmiGrax3k3yamtxPNCRFCibNcGtFZKsaXx9LbfYmovkBtywleu2y7ScnMN/ZKuXFnbMnBCm+hnzPxvFmVhEWOl7C5U7jEjbl583HTKJ/csJ9t4bb5euJ5Vhe/4wZh1bG21cJRb77bxXNQFKdmuccp4KxYvEPXbL+iCR9TuPMzJof46mpSm/8TxD+WjeieB8DWS5CJ7CQTelBIQEMOBLFC6DC39e3WnLdUqzGHjzBA6g5dCBQ+Xyfw7h4qExrMFpDYZAmrzYyXsWegcacCCYDCRE1VNRCS+B5ZuoMxhGMHKkGJ1P3aZePVfsGSKSIK54WKAJz1yqGrcT86zz7ZmOjg3FGaeCgsn8B0rgpOdYJVereQKvXgLwx4H0u3ewl1vB1h0IycqZ+eR5WsfdPe+aelWkzU0DcSpG0kQ66YWZtbWQ== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(136003)(376002)(39860400002)(346002)(396003)(451199015)(46966006)(40470700004)(36840700001)(5660300002)(8936002)(31686004)(44832011)(8676002)(82310400005)(70206006)(4326008)(70586007)(53546011)(186003)(16576012)(26005)(2906002)(31696002)(54906003)(110136005)(16526019)(316002)(478600001)(36756003)(2616005)(36860700001)(83380400001)(41300700001)(86362001)(356005)(40480700001)(40460700003)(81166007)(82740400003)(47076005)(336012)(426003)(36900700001)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jan 2023 13:12:37.9723 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 361c07a8-4f98-46e2-3c69-08dafe0caa8b X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT108.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6622 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Hi Stefan, On 1/11/23 12:38, Stefan Roese wrote: > Hi Harini, > > On 1/11/23 12:20, Katakam, Harini wrote: >> + >> Hi Stefan, >> >>> -----Original Message----- >>> From: U-Boot On Behalf Of Stefan Roese >>> Sent: Wednesday, January 11, 2023 1:01 PM >>> To: u-boot@lists.denx.de >>> Cc: Michal Simek ; Ramon Fried >>> ; Sean Anderson >>> Subject: [PATCH] net: zynq_gem: Add a 10ms delay in zynq_gem_init() >>> >>> In our system using ZynqMP with an external SGMII PHY it's necessary to >>> wait a short while after the configuration in zynq_gem_init() before the xfer >>> starts. Otherwise the first packet(s) might get dropped, resulting in a delay at >>> the start of the ethernet transfers. >>> >>> This patch adds a minimal delay of 10ms which fixes problems of dropped >>> first packages. >>> >>> Signed-off-by: Stefan Roese >>> Cc: Michal Simek >>> Cc: Ramon Fried >>> Cc: Sean Anderson >>> --- >>>   drivers/net/zynq_gem.c | 7 +++++++ >>>   1 file changed, 7 insertions(+) >>> >>> diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c index >>> 507b19b75975..26e468766871 100644 >>> --- a/drivers/net/zynq_gem.c >>> +++ b/drivers/net/zynq_gem.c >>> @@ -522,6 +522,13 @@ static int zynq_gem_init(struct udevice *dev) >>>               return ret; >>>           } >>>       } >>> + >>> +    /* >>> +     * Some additional minimal delay seems to be needed so that >>> +     * the first packet will be sent correctly >>> +     */ >>> +    mdelay(10); >>> + >> >> Thanks for the patch. The PCS status check in your v1 seems valid. >> However, this delay of 10 msecs should not be necessary. If the PCS >> status (when autoneg is enabled with the external PHY on your board) >> shows link up, that's enough. > > Unfortunately this is not the case. Regardless of using the PCS check > from the v1 patch from yesterday, such a minimal delay is necessary on > our setup. > >> Could you please consider the following >> to investigate why initial packets are lost? >> -> If the external PHY on your board has a hardware reset please >> consider updating the reset-assert-us and reset-deassert-us properties >> to ensure PHY is ready before access. > > Not sure if this will help. See my comment at the end please for this. > >> -> Can you please check if there's any link stability issues in the initial >> msecs? Monitoring the serdes/GTR SGMII lane that's setup on ZynqMP >> will be useful. > > I tested 2 situations: > > a) Starting network traffic very early in U-Boot, before the aneg link > establishment has finished (preboot=ping 192.168.1.5): > > [8.448005 0.007878] Net: > [8.453711 0.005706] ZYNQ GEM: ff0d0000, mdio bus ff0d0000, phyaddr 0, interface > sgmii > [8.454449 0.000739] eth0: ethernet@ff0d0000 > [8.454752 0.000303] ethernet@ff0d0000 Waiting for PHY auto negotiation to > complete..... done > [10.915882 2.461130] Using ethernet@ff0d0000 device > [10.916228 0.000346] host 192.168.1.5 is alive > [10.917247 0.001019] Hit any key to stop autoboot:  0 > > b) Late in U-Boot, after waiting for some seconds (or even minutes, it > makes no difference) on the prompt  (preboot=sleep 10;ping 192.168.1.5): > > [4.655932 0.007849] Net: > [4.661612 0.005680] ZYNQ GEM: ff0d0000, mdio bus ff0d0000, phyaddr 0, interface > sgmii > [4.662367 0.000755] eth0: ethernet@ff0d0000 > [14.671655 10.009288] Using ethernet@ff0d0000 device > [14.672018 0.000364] host 192.168.1.5 is alive > [14.673032 0.001014] Hit any key to stop autoboot:  0 > > The delay is needed in both cases. In a) you see, that the PHY aneg > takes a bit of time to finish. The link is established at this time. > > My feeling is that configuration of "pcscntrl" (or some other register) > after phy_startup() in zynq_gem_init() introduces this necessity of this > additional delay. I think this will require further investigation what it is really happening. If this is related to SGMII only or also RGMII. Obviously adding some delay without proper explanation is not the right way to go. Pretty much if something is not stable there should be a way to pooling any bit. There is ongoing effort on moving clock from direct register access to using firmware interface. And maybe this issue will be resolve by that that simply clock is not stable at the time when driver tries to enable RX/TX. And current clock driver is not waiting for clock to be stable but firmware base driver does it. Thanks, Michal