From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89C35C04FF3 for ; Fri, 21 May 2021 20:14:21 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A5B2961353 for ; Fri, 21 May 2021 20:14:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A5B2961353 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6ECA482E40; Fri, 21 May 2021 22:14:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="WiXvjfg3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AD16682E41; Fri, 21 May 2021 22:14:16 +0200 (CEST) Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 911E682BB2 for ; Fri, 21 May 2021 22:14:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rehn.andreas86@gmail.com Received: by mail-ot1-x32f.google.com with SMTP id g7-20020a9d12870000b0290328b1342b73so11290401otg.9 for ; Fri, 21 May 2021 13:14:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kWt2SrZVYX714UcRiLPfvDKXq4KwGhrhGgUgkghKqyE=; b=WiXvjfg3HyOSV15W8xvABknMtO7Fl0ZnQ3Dj+UwZqheewgby+xWv7jvI5GRFrbdBZb w82NAC+/3efOKEer7XOTCNqy4YVSXp3s6GOSo7x4PE8aiUw3AXMmrQeVZ1KqMdA8vfzW +BjyicGGT4lGBDC5q7ynIzHSZbCiTICsvmfvRwG9Zioq6hR/YpiadgvGr4zZAXylbUfm qKh3xMjq+8BD1i2VfsYzI/gvGz638SpCLI5baEsjSX2Ho4miY/xT0/sA30i0PM+I+Ezs IdksUr0aZvSJdNfT6EIyGULM6LCmyTM6Jjud2FB0tBdjh1PkwKWBgHT0WaAcfJKC/a/d /gYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kWt2SrZVYX714UcRiLPfvDKXq4KwGhrhGgUgkghKqyE=; b=Q8rKpeiK9dlW8tKFGtH0RDLFFnIWfgXO07o4oQdm1QEuCiAoYdA19l8mJ6xiAtBd82 QMutl4TBxhqPeP1xZ+gTT6wQE8k4Sds3Ez96nOQOdckg+kPug3PMRYr3qcSvXm5OnqId kSSyymftNpBSY+5E+G3eqoLoPT6h0s/hn2zUfrgk2jCbUSQzMSjx4l+CyQr0bM1cNNH0 /WJdiQZbHmgVKCeg0ubgzuvbyx2Fv57g/xG5jg8/ElD3itmJQoaAdDR75wlFm40BUagC fz74cYLboX6QYNgsy51B3pailQEin08VHV3HPC8GMJ8HoMUV4XwCBLHnGZMRNiOoSdA5 o3eg== X-Gm-Message-State: AOAM531/RdNY+iE4S1PX3defv8RXZGOMJ25mQNxEpdStmLkncCr1lVCx WHlQOvKLGloyXsb7MDKkAzRrKP4g2qVxV7tuIPc= X-Google-Smtp-Source: ABdhPJw49PNn2I43Pn3W/1rUHHoy8t/xLVL2q1QAH/c5dDeTNvjPdN0OcU1/vfgHaBnV9crW9d/i5tiod4SxmQLF43w= X-Received: by 2002:a05:6830:a:: with SMTP id c10mr10475386otp.114.1621628051178; Fri, 21 May 2021 13:14:11 -0700 (PDT) MIME-Version: 1.0 References: <20210519194208.515548-1-rehn.andreas86@gmail.com> <20210519194208.515548-7-rehn.andreas86@gmail.com> <20210519224451.18d6ccfd@slackpad.fritz.box> <20210520011804.208c9b5c@slackpad.fritz.box> In-Reply-To: <20210520011804.208c9b5c@slackpad.fritz.box> From: Andreas Rehn Date: Fri, 21 May 2021 22:14:00 +0200 Message-ID: Subject: Re: [PATCH 6/6] net: sun8i-emac: v3s: fix soft reset timeout To: Andre Przywara Cc: hdegoede@redhat.com, Jagan Teki , icenowy@aosc.io, u-boot@lists.denx.de Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.4 at phobos.denx.de X-Virus-Status: Clean sorry for the late response. I run some test runs and maybe there is something with the phy itself or something is missing on sun8i_emac_eth_stop/start? if you have any patches/ideas to test - let me know! maybe someone has an idea how I can try to force the Linux mainline driver in the same situation? just want to know if there is the same behavior. test-scenario: download 10 times zImage and dtb over tftp, static ip, no reset, timeout =3D 1000 10 duplex half: soft reset time 0us with 3 tftp timeouts and recover lowest speed: 369.1 KiB/s max speed: 779.3 KiB/s 10 duplex full: soft reset time 0us with 0 tftp timeouts and recover lowest speed: 656.3 KiB/s max speed: 752.9 KiB/s 100 duplex half: soft reset time 0us with 1 tftp timeout and recover lowest speed: 1.6 MiB/s max speed: 2.7 MiB/s 100 duplex full: try1: 0us, 630000 us with 0 tftp timeout and recover try2: 1001000 us sun8i_emac_eth_start: Timeout -> 5 times -> reconnect cable try3: 382000us, 502000us with 0 tftp timeout and recover try4: 330000 us, 1001000 us sun8i_emac_eth_start: Timeout -> 2 times -> 192000 us try5: power up with cable pluged in: 58000 us, 373000 us with 0 tftp timeout and recover try6: 354000 us, 494000 us with 0 tftp timeout and recover try7: 1001000 us sun8i_emac_eth_start: Timeout -> 3 times -> 1001000 us sun8i_emac_eth_start: Timeout, 626000 us next tries with fresh startup try8: 845000 us, 594000 us try9: 903000 us, 479000 us try10: 638000 us, 500000 us try11: 1001000 us sun8i_emac_eth_start: Timeout, 333000 us try12: 63000 us, 489000 us lowest speed: 1.6 MiB/s max speed: 2.7 MiB/s when switching from 100 duplex half to full and try to run tftp download for zImage and dtb try1: reset MAC done after: 0 us ethernet@1c30000 Waiting for PHY auto negotiation to complete......... TIMEOUT ! reset MAC done after: 0 us ethernet@1c30000 Waiting for PHY auto negotiation to complete......... TIMEOUT ! try2: reset MAC done after: 0 us Using ethernet@1c30000 device TFTP from server 192.168.5.80; our IP address is 192.168.5.78 Filename 'zImage'. Load address: 0x42000000 Loading: ################################################################# ################################################################# ################################################################# ################################################################ 2.4 MiB/s done Bytes transferred =3D 3790520 (39d6b8 hex) reset MAC done after: 1001000 us sun8i_emac_eth_start: Timeout Am Do., 20. Mai 2021 um 02:18 Uhr schrieb Andre Przywara < andre.przywara@arm.com>: > On Thu, 20 May 2021 00:10:47 +0200 > Andreas Rehn wrote: > > > hey, > > > > sure. I give it a try tomorrow. > > with 250 ms, for example, I ran into timeouts after the first tftp > download. > > after a manual retry, it works fine but retry is not a valid production > > behavior. > > Just read the arch timer after the SOFT_RST write and after the first > read of 0 again, and I got 17-18 ticks on my OrangePi Zero (H2+). So at > 24MHz this is less than a *micro*second for the MAC to reset. So the 10 > ms are already plenty. > Are you sure that it's this timeout value that is improving things for > you? > > Cheers, > Andre > > > greetings > > Andreas > > > > Am Mi., 19. Mai 2021 um 23:45 Uhr schrieb Andre Przywara < > > andre.przywara@arm.com>: > > > > > On Wed, 19 May 2021 21:42:08 +0200 > > > Andreas Rehn wrote: > > > > > > Hi, > > > > > > > v3s emac soft reset tooks quit longer if autonegation is active > > > > on 100 Mbit full duplex pairs what can result in > > > > `sun8i_emac_eth_start: Timeout` error > > > > > > Mmmh, why the 500ms? Can you figure out how long it typically > > > takes for you? By open-coding wait_for_bit_le32() and printing the ti= me > > > it took to flip the bit back? > > > > > > Happy to change this then when we have some data. > > > > > > Cheers, > > > Andre > > > > > > > wait_for_bit_le32 polls register value each ms. > > > > Increasing the timeout for setup do not effect current behavior > > > > but reduces unexpected behaviors (e.g. timeouts on tftp download). > > > > > > > > Signed-off-by: Andreas Rehn > > > > --- > > > > drivers/net/sun8i_emac.c | 2 +- > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > diff --git a/drivers/net/sun8i_emac.c b/drivers/net/sun8i_emac.c > > > > index 0e7ad3b0d4..23fd35f9e1 100644 > > > > --- a/drivers/net/sun8i_emac.c > > > > +++ b/drivers/net/sun8i_emac.c > > > > @@ -475,7 +475,7 @@ static int sun8i_emac_eth_start(struct udevice > *dev) > > > > /* Soft reset MAC */ > > > > writel(EMAC_CTL1_SOFT_RST, priv->mac_reg + EMAC_CTL1); > > > > ret =3D wait_for_bit_le32(priv->mac_reg + EMAC_CTL1, > > > > - EMAC_CTL1_SOFT_RST, false, 10, true); > > > > + EMAC_CTL1_SOFT_RST, false, 500, true)= ; > > > > if (ret) { > > > > printf("%s: Timeout\n", __func__); > > > > return ret; > > > > > > > > > > --=20 Mit freundlichen Gr=C3=BC=C3=9Fen / kind regards Andreas Rehn | Master of Engineering (M.Eng)