Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp833126pxu; Mon, 23 Nov 2020 05:27:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJwiZxFFkwtp9dFRYm0UlHl278ILyNICu6i2ve1sP10M0VGI/w+kbG1XjZ8nMx6xXBHvhsyU X-Received: by 2002:a50:99c3:: with SMTP id n3mr47738030edb.213.1606138038615; Mon, 23 Nov 2020 05:27:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606138038; cv=none; d=google.com; s=arc-20160816; b=kcKFGCKgcK+C6j8gObQfhpiUVXP9V+i9YS6Ti4s7A8nNU8domCmQVITQvRWp4BPg3U lszrFChKikbdEJ61n2BiMcpL5qMFMEZNmKEgqTsmiCT1b1E1b1v4jAIqz1KTWloW5KqK ehC2ED/mafciYMizQdWi0Z+SNflvRsHpnskbBn/5ELEAogV8zCYRWcexZI0CUMkd1zr7 NK613yQ+MedC4G9G0TZEPnumw/VffgzAVnUM1WzEptvSf9EakRggQuoduinCmmTLn36O 5Trbd/d88Hzeqlgr8YjXz9HZM8ngW3Rsn4FH6rHZrODgls70V3XWKnl1oxnNbj8T4tUC XAWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pauFmG7QFb4hWvSw26cBl/3GXt/VT1DJysj3+Rq0uns=; b=cKELXxsU5Oe9605VUY4G1oEj9UZivI9ROnOWcdI1S3zQvxVBDEPwO4hNFKUGnMk7DL 3b5/N6QmyqhjSY+Pdy7lb9977wNQxrVA/cMntwYoKJYvbje6PqIQ1VcS8242e8mAGSh2 USf26ioAHl7W4sTNZpLz5GlN1kaY17sX6AlI7HF44xhSQbeWSNxMONe46vmLAF2KWWbj ajonkZNH5d3yciQxi+9k88GhmnwGJMpQFifso18Eti6O2KhQyvrhPBA5PnlXA2CmHk9C is/oyaVDVs6J1N+xoSNMjiygcg4bUn04ovZqUmQX0pAyx0Cs/MJAUVvM/IO1EaoBCtNi bxrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Lc8vBb4S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o1si6332600ejn.643.2020.11.23.05.26.55; Mon, 23 Nov 2020 05:27:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Lc8vBb4S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731377AbgKWMec (ORCPT + 99 others); Mon, 23 Nov 2020 07:34:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:45972 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731352AbgKWMeX (ORCPT ); Mon, 23 Nov 2020 07:34:23 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BFCBD2076E; Mon, 23 Nov 2020 12:34:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606134863; bh=I3kkkj9+FZ0SUHAyrZ9elToQ9fT6LuXdNRXthBVpCWk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lc8vBb4SGkK8FcDshhImgAew0tcGiPxQqdVu0jwsML/sQZAa3tkru4b5eOUa+dpTI OH2X//YiVuZ9i+Sg7g/j/OkWKxekov06w6WgUNrYNKobW3qJEBLjasVw+1QmE7f/7d GL4aYNUGuzZjaY0ep0pugvtr5JJST+rkVktdX4KQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrew Lunn , Martin Blumenstingl , Hauke Mehrtens , Florian Fainelli , Jakub Kicinski Subject: [PATCH 5.4 018/158] net: lantiq: Wait for the GPHY firmware to be ready Date: Mon, 23 Nov 2020 13:20:46 +0100 Message-Id: <20201123121820.815161016@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121819.943135899@linuxfoundation.org> References: <20201123121819.943135899@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Martin Blumenstingl [ Upstream commit 2a1828e378c1b5ba1ff283ed8f8c5cc37bb391dc ] A user reports (slightly shortened from the original message): libphy: lantiq,xrx200-mdio: probed mdio_bus 1e108000.switch-mii: MDIO device at address 17 is missing. gswip 1e108000.switch lan: no phy at 2 gswip 1e108000.switch lan: failed to connect to port 2: -19 lantiq,xrx200-net 1e10b308.eth eth0: error -19 setting up slave phy This is a single-port board using the internal Fast Ethernet PHY. The user reports that switching to PHY scanning instead of configuring the PHY within device-tree works around this issue. The documentation for the standalone variant of the PHY11G (which is probably very similar to what is used inside the xRX200 SoCs but having the firmware burnt onto that standalone chip in the factory) states that the PHY needs 300ms to be ready for MDIO communication after releasing the reset. Add a 300ms delay after initializing all GPHYs to ensure that the GPHY firmware had enough time to initialize and to appear on the MDIO bus. Unfortunately there is no (known) documentation on what the minimum time to wait after releasing the reset on an internal PHY so play safe and take the one for the external variant. Only wait after the last GPHY firmware is loaded to not slow down the initialization too much ( xRX200 has two GPHYs but newer SoCs have at least three GPHYs). Fixes: 14fceff4771e51 ("net: dsa: Add Lantiq / Intel DSA driver for vrx200") Reviewed-by: Andrew Lunn Signed-off-by: Martin Blumenstingl Acked-by: Hauke Mehrtens Reviewed-by: Florian Fainelli Link: https://lore.kernel.org/r/20201115165757.552641-1-martin.blumenstingl@googlemail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/dsa/lantiq_gswip.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/drivers/net/dsa/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq_gswip.c @@ -26,6 +26,7 @@ */ #include +#include #include #include #include @@ -1818,6 +1819,16 @@ static int gswip_gphy_fw_list(struct gsw i++; } + /* The standalone PHY11G requires 300ms to be fully + * initialized and ready for any MDIO communication after being + * taken out of reset. For the SoC-internal GPHY variant there + * is no (known) documentation for the minimum time after a + * reset. Use the same value as for the standalone variant as + * some users have reported internal PHYs not being detected + * without any delay. + */ + msleep(300); + return 0; remove_gphy: