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 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 CFDE4C433EF for ; Tue, 12 Apr 2022 20:18:47 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8DABB83E52; Tue, 12 Apr 2022 22:18:45 +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="J6KGH0hr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 116AC83EA4; Tue, 12 Apr 2022 22:18:44 +0200 (CEST) Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) (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 0E3BA83DD7 for ; Tue, 12 Apr 2022 22:18:41 +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=mibodhi@gmail.com Received: by mail-qk1-x730.google.com with SMTP id c199so13001973qkg.4 for ; Tue, 12 Apr 2022 13:18:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GH1zcw+1Z6IVWQ6aK4O9N6R0rxholLo4E8IqkAqGUbI=; b=J6KGH0hr6QTUgRgZyK2ki9GFhAf650ttmd62pIrf/XbQag8W0QiTjffr24qMBh0Qo4 Y8CqY2jTrGLRnrXrf2Qb0VALpCINXojwaCy98S4vpkwRDUr4d7wkWC4RnklA7vRwYZ+T IOxSRvs3oWjRC2y8i8cRcGcx6sTSkdV+v1WO6OHbSZKd0mXzYDzoUQf4PGDmQNA94Ws/ xB2Ms+iK5f+I5rI4sSJPZoo6/N8tYNy78PdXo9g6gsQUEoN4rdMQuQZiJ73NlZ2i3cly Q1TvvhFQJi4+DsnfGW0N9A9AZj1jl/uLhyrNht1Z+wMhxsOPkKQ7V1rldVfhsfxMnjGl WUnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GH1zcw+1Z6IVWQ6aK4O9N6R0rxholLo4E8IqkAqGUbI=; b=jAgwWjqUOb2eUb42xkmFbd5bV804cTZvM3gvHP+yGtg2i8f93l90RxO4Llwg/TXDTM osFbjBDo6zreMkO2lBM5kWqRGmSm5dT8JtiZNo67I/1I0NkKr+LLc/207PGICConBbMh 1u6LSYspfJBWyg0aXAjmCeGnaleJMI4dkRDjdgrxg4t851rt6i40eVC50A7tXFlZm0Qs UaoF6joqNZv7qY3OKMOps5EVtAzWqoqZMO0T0c3f7NjNEjw1F6QExhUkHzNGbefN0wPS saZwUhvezlcaLHByF5a9hf5A33HBVIMDxVul8M0gp3b3zhBMrBJBLVvuNuXmAHoYyIvE tFSw== X-Gm-Message-State: AOAM533lJx+axnPqdXC36ADZjS0lIESim0dqSmqHOcS/iv0CMoBvvznS Igl6vZE4vhI5BYTX198YNoY= X-Google-Smtp-Source: ABdhPJxhU8Zmz+zeATcQNqqoRynzEy0Yu2+R98gvZP7PJzOiAU+BQGKTWPvfn/nfbz5wzy3cJrvc3w== X-Received: by 2002:a05:620a:1389:b0:69c:ea0:65f7 with SMTP id k9-20020a05620a138900b0069c0ea065f7mr4438520qki.621.1649794719919; Tue, 12 Apr 2022 13:18:39 -0700 (PDT) Received: from localhost.localdomain (76-229-100-169.lightspeed.irvnca.sbcglobal.net. [76.229.100.169]) by smtp.gmail.com with ESMTPSA id c13-20020a37e10d000000b0069c268c37f1sm3749040qkm.23.2022.04.12.13.18.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 13:18:39 -0700 (PDT) From: Tony Dinh To: Joe Hershberger , Ramon Fried Cc: Stefan Roese , Tom Rini , U-Boot Mailing List , =?UTF-8?q?Marek=20Beh=FAn?= , =?UTF-8?q?Pali=20Roh=E1r?= , Tony Dinh Subject: [PATCH] net: marvell: mvgbe: Set PHY page 0 before phy_connect Date: Tue, 12 Apr 2022 13:18:19 -0700 Message-Id: <20220412201820.10291-1-mibodhi@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.5 at phobos.denx.de X-Virus-Status: Clean For most Kirkwood boards, the PHY page is already set to page 0 (in register 22) before phy_connect is invoked. But some board like the Zyxel NSA310S (which uses the network chip MV88E1318S), the PHY page is not set to page 0. There seems to be some bad data remained in register 22 when the uclass MVGBE about to invoke phy_connect(). This patch enables the uclass MVGBE to always set the PHY page to 0 before phy_connect. For reference, please see this discussion: [RFC PATCH v2] arm: kirkwood: nsa310s: Use Marvell uclass mvgbe and PHY driver for DM Ethernet. https://lists.denx.de/pipermail/u-boot/2022-April/480946.html This patch has been tested with the following Kirkwood boards: NSA310S (88F6702, network chip MV88E1318S) Sheevaplug (88F6281, network chip MV88E1318) Pogo V4 (88F6192, network chip 88E1116R) GF Home(88F6281, network chip 88E1116R) Dreamplug (88F6281, network chip MV88E1318) Dell Kace M300 (88F6282, network chip MV88E1318) - out of tree u-boot Signed-off-by: Tony Dinh --- drivers/net/mvgbe.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/mvgbe.c b/drivers/net/mvgbe.c index 954bf86121..d2db1e584a 100644 --- a/drivers/net/mvgbe.c +++ b/drivers/net/mvgbe.c @@ -43,6 +43,7 @@ DECLARE_GLOBAL_DATA_PTR; #define MV_PHY_ADR_REQUEST 0xee #define MVGBE_SMI_REG (((struct mvgbe_registers *)MVGBE0_BASE)->smi) +#define MVGBE_PGADR_REG 22 #if defined(CONFIG_PHYLIB) || defined(CONFIG_MII) || defined(CONFIG_CMD_MII) static int smi_wait_ready(struct mvgbe_device *dmvgbe) @@ -745,6 +746,9 @@ static struct phy_device *__mvgbe_phy_init(struct eth_device *dev, miiphy_write(dev->name, MV_PHY_ADR_REQUEST, MV_PHY_ADR_REQUEST, phyid); + /* Make sure the selected PHY page is 0 before connecting */ + miiphy_write(dev->name, phyid, MVGBE_PGADR_REG, 0); + phydev = phy_connect(bus, phyid, dev, phy_interface); if (!phydev) { printf("phy_connect failed\n"); -- 2.30.2