Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp3057071rwb; Mon, 16 Jan 2023 03:11:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXtwnqn80MykzTN32CwbAmQJqnHnrkZvMdmSQnt2eQWhr5KsRzw1DwpLaRzvoY8D1hII7/D1 X-Received: by 2002:a05:6a20:3b22:b0:b6:8317:219b with SMTP id c34-20020a056a203b2200b000b68317219bmr15085240pzh.8.1673867468535; Mon, 16 Jan 2023 03:11:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673867468; cv=none; d=google.com; s=arc-20160816; b=XLDwdZDLnlab3o3bb81mmWx4tBdQczts1OaYPHt98bMrY+x4wTbplW0+vuHdl61cBM hy/jBaLZTJiilbr1S/fZSCaA+hQ6BBo6VlQzPEOi2FwXUiuSftB1Ig7cg7kuc/1rY3zH Zh9g9dKyd9OOKsQI74XmhT9hjDEkdWZFXG2LF6hpVRa7NVWSNo5YMGatVXjbAFHpRF6G Awg+KUx91OObNDI+qU20QkV3ZuxSYWc73uo0UEJap4FGu4+NMVW0JtvZuRUJu7cbhoSq WMc+4mONYQ7hPQJvXYSPjv6lV6GHpzDraA6ULdjWoTILVzjUhpQ0SFGJd4TxlNOSwKnZ QeGw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=otK04t6Fq+0COownezUclLPHt9Yq8LgEt2fdJEWCBeY=; b=t5Cq655/e6jM/oB7QA9UawdPZYWKz8dtnCbkmYr3LcL8qUFenEZmQ5U6ja0tXNk+XC UsdQd2WOj1YOz+kupByq0JzCx9IVEj1BHO15YZRwXB8MykI4HWO4tMHwlMc53VBHXVO9 63XBrdNDqci5FFMjIoNA16sM+0Cd+QjNBo/spT8n6sDQUHljhSLy93GNH/uSH1sL+vUh gpdDJqeAlAOpi3FzfxynTZlTs35J56i3uCJRRGrg/gY1fgLUAdozkXT7RLMu5xoiN/eW 9rq6QlKp6EXNHhZ0KTvE4xTOaphdW7jzydnc/V9SzWRtOgXzIUIRvcukVRtrYpkbvJcw SvRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=SgVpIa9+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c6-20020a63da06000000b004a6549b92afsi29437867pgh.699.2023.01.16.03.11.02; Mon, 16 Jan 2023 03:11:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=SgVpIa9+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230446AbjAPKiK (ORCPT + 51 others); Mon, 16 Jan 2023 05:38:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230387AbjAPKhz (ORCPT ); Mon, 16 Jan 2023 05:37:55 -0500 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::228]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B3031BAFD; Mon, 16 Jan 2023 02:37:35 -0800 (PST) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 2BAD51BF20D; Mon, 16 Jan 2023 10:37:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1673865454; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=otK04t6Fq+0COownezUclLPHt9Yq8LgEt2fdJEWCBeY=; b=SgVpIa9+7N5kErKew4ZANdCP3OgDdChVG7HEXYslpXSzH7kvthC+fDHeFxhnov9U3/LWVX VjRKdfUkztdgeLWQV1qbhW2EjzVSlFpO8oSVajOsieEF5LJzu54hu5F81H9DiiyJF7NXv0 wusfQa+cj2Gy/i3aL23RJ+Zv0wh4sjwGsaBGQec3wlbJNGwMlq8kPckzFNJi2DRSbVixKU LzcPKzCgm5A74SLyL/SVLgE5+cDHuffnhAYISWss/MI41KnD23sfO3JYTXtgxzKCk+YoIG Z1EEoADo6NCN6Ok1TK6/zLEBuVeLaGIXzAJkzXKCE6IYT0o35UVIu/nQVDb6UQ== From: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= To: Sergey Shtylyov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Geert Uytterhoeven , Magnus Damm , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Russell King , Wong Vee Khee , =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , Kurt Kanzenbach , Revanth Kumar Uppala , Tan Tee Min Cc: Thomas Petazzoni , Herve Codina , =?UTF-8?q?Miqu=C3=A8l=20Raynal?= , Milan Stevanovic , Jimmy Lalande , Pascal Eberhard , Mohammad Athari Bin Ismail , Jon Hunter , netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH net-next 3/6] net: stmmac: start phylink before setting up hardware Date: Mon, 16 Jan 2023 11:39:23 +0100 Message-Id: <20230116103926.276869-4-clement.leger@bootlin.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230116103926.276869-1-clement.leger@bootlin.com> References: <20230116103926.276869-1-clement.leger@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The stmmac on the Renesas RZ/N1 platform is connected to the PCS which must be configured to provide a correct RGMII RX clock to the stmmac IP. Without the RX clock, the driver will fail to initialize the hardware (more specifically, the driver will report it fails to reset DMA). In order to fix that, start phylink mecanism before setting up hardware. Signed-off-by: Clément Léger --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index f2247b8cf0a3..88c941003855 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3818,6 +3818,12 @@ static int __stmmac_open(struct net_device *dev, } } + /* We need to setup the phy & PCS before accessing the stmmac registers + * because in some cases (RZ/N1), if the stmmac IP is not clocked by the + * PCS, hardware init will fail because it lacks a RGMII RX clock. + */ + phylink_start(priv->phylink); + ret = stmmac_hw_setup(dev, true); if (ret < 0) { netdev_err(priv->dev, "%s: Hw setup failed\n", __func__); @@ -3826,7 +3832,6 @@ static int __stmmac_open(struct net_device *dev, stmmac_init_coalesce(priv); - phylink_start(priv->phylink); /* We may have called phylink_speed_down before */ phylink_speed_up(priv->phylink); -- 2.39.0