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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 8AA50C2B9F2 for ; Sat, 22 May 2021 23:23:53 +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 79DD061163 for ; Sat, 22 May 2021 23:23:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 79DD061163 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 8808282E4E; Sun, 23 May 2021 01:23:50 +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=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="i5SQfe5x"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8DF2882E4E; Sun, 23 May 2021 01:23:49 +0200 (CEST) Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) (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 EC28F82E2B for ; Sun, 23 May 2021 01:23:46 +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-wr1-x430.google.com with SMTP id i17so24583795wrq.11 for ; Sat, 22 May 2021 16:23:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nLcoYCA4VYLHuGRmPIS0vd+0xjFtn/NaYHcnIgH36Wo=; b=i5SQfe5xaURSdr2o7xTL2ja5p4bhn2i74lL/CZ6n6qbMfr3cAfeNfIhBa/OFmpbNXR RVYHSUBV8nZtNWcqZs5Nx0RBH3qV7DIkIVRFhiQDcPFIkPBVBIDkWsC0Uj8R4CXltcjS bXvXxRSAQO45EnIYEQxLKcmiWOmYiafFnfNuZvrfsYsxjUk/EA6Q9Kp92sYt9prSovGf z7sVDJ+JdIZiIWVeUSa040UoLBfCJiDYgLZpnccO/4UWCHss1l0Lb2t5I9khTa42j86C XcOYK+XS6qrdfXyUZwEyRiLiNN6Ln/1NmLV3ZAe2NPWi6FeKDSaY2aknabypfl7y5cBd Xctw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nLcoYCA4VYLHuGRmPIS0vd+0xjFtn/NaYHcnIgH36Wo=; b=mc7KpaVD10vbyGXsqMYHpGisGCvccjO/WFKzMSaScRGfsjv6M+jeYQHF6TCkUO5kz+ IUH6kHrjPCwAtwpSRYfsvHeiCFR5ORlx+PoIMnkNi4zxFJXFdFlaPwUm4vUI6y+Wqr0l gGFutZA9TIlxtjMH4Cylc/QAQsZzgFUxeeiizV8E0vGLiBrCkZXitl1QTGKysgGzvNtM jY5GW0vNiiz3I/aIorSeM/8+fDJ59aXuuOKhuFeHoi3sZKjWYxyl4Usbg7J5yu+jS5cw 5+SVQhfG596510XG53Obmao90xlj8ReluX16HZdyG1R9kZhCjtxdC9L3qIi1TmOcHv8Y jTIg== X-Gm-Message-State: AOAM531GBf5yChvduw/xQPpVAZUCaSegn+5yf7KrBjqzcQ5CbqEL92/2 4yfeTpa5w03+6YC2BhIVNds= X-Google-Smtp-Source: ABdhPJyNk/zQKxuzoC+8r6scGiE+DF0MjsPIJecxLn4np1QPfSA8CrKC+NijXUdt8bdgqsGqmTR+kQ== X-Received: by 2002:adf:f5c7:: with SMTP id k7mr15550727wrp.293.1621725826540; Sat, 22 May 2021 16:23:46 -0700 (PDT) Received: from flex-5.fritz.box (dynamic-077-012-139-231.77.12.pool.telefonica.de. [77.12.139.231]) by smtp.gmail.com with ESMTPSA id c64sm3668677wma.15.2021.05.22.16.23.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 May 2021 16:23:46 -0700 (PDT) From: Andreas Rehn To: hdegoede@redhat.com, jagan@amarulasolutions.com, andre.przywara@arm.com Cc: icenowy@aosc.io, u-boot@lists.denx.de, linux-sunxi@googlegroups.com, Andreas Rehn Subject: [PATCH v2 6/6] net: sun8i-emac: v3s: fix soft reset timeout Date: Sun, 23 May 2021 01:23:40 +0200 Message-Id: <20210522232340.201471-1-rehn.andreas86@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210519194208.515548-7-rehn.andreas86@gmail.com> References: <20210519194208.515548-7-rehn.andreas86@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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 wait_for_bit_le32 polls register value each ms. Increasing the timeout for setup to 1000 ms and above results still in start timeouts. Linux kernel driver dwmac-sun8i work very nice and don't provide a soft reset. Skip soft reset on u-boot for V3s provide the expected behavior on all connection permutations. If cable is not plugged in, the timeout comes form the phy driver itself. Signed-off-by: Andreas Rehn --- Changes in v2: - skip soft reset if MACH_SUN8I_V3S is enabled - depends on PATCH v2 4/6 drivers/net/sun8i_emac.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/sun8i_emac.c b/drivers/net/sun8i_emac.c index ab9f61994c..403e9b9d31 100644 --- a/drivers/net/sun8i_emac.c +++ b/drivers/net/sun8i_emac.c @@ -474,12 +474,14 @@ static int sun8i_emac_eth_start(struct udevice *dev) int ret; /* Soft reset MAC */ - writel(EMAC_CTL1_SOFT_RST, priv->mac_reg + EMAC_CTL1); - ret = wait_for_bit_le32(priv->mac_reg + EMAC_CTL1, - EMAC_CTL1_SOFT_RST, false, 10, true); - if (ret) { - printf("%s: Timeout\n", __func__); - return ret; + if (!IS_ENABLED(CONFIG_MACH_SUN8I_V3S)) { + writel(EMAC_CTL1_SOFT_RST, priv->mac_reg + EMAC_CTL1); + ret = wait_for_bit_le32(priv->mac_reg + EMAC_CTL1, + EMAC_CTL1_SOFT_RST, false, 10, true); + if (ret) { + printf("%s: Timeout\n", __func__); + return ret; + } } /* Rewrite mac address after reset */ -- 2.25.1