Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5177440pxb; Wed, 19 Jan 2022 12:44:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJwdgBothEZCVqKxDsUWqXAFwb9A0wr0Pn/TRuQVyLBdwkZT/4ra65ivdOcS2r0Xxm6h80BR X-Received: by 2002:a63:9251:: with SMTP id s17mr28774171pgn.501.1642625097851; Wed, 19 Jan 2022 12:44:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642625097; cv=none; d=google.com; s=arc-20160816; b=SzptVe1+n2Xi5bgznM1x/C1BrCW+qaCk8tBWl9kB+6jrsdgaQzOOq8lilPBx+Z7GGw BFVIwqfld+FSHL3pjE/zyhqs3t0K/jZmZ1ss8rm5m5C68ka28xFWJjocevK4IIdEQRUG m2n8q/KEdAXptrBrpgnL0ImENIFJ8odc5nu9RoCC4IOVlH8nYpQuQtkh3PPOo1fkEO87 7uL44QafXqh1rRHDva3Nffs0pl4nseLA0P9TUzXRlIrv/LPFCwqMtJJpM6VZ3Ked0fgU 4VzT69nA7Ob1zUv14GyP6fMVJH7xr3ATsK9SdgzwjB8RrEkltWlOdTp+iGlS5mfMSNFW qmBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=l47OxJNz+T9yVVKLS3cwIy5EZUNQ7sqTlqM3ewJLQ20=; b=PilMtCpZ0tXHDMlmOqP4nwsOMD+O+76A1eX6EmxoJSWZ/Oy7UeNKtO89EYTLw4+DoV yZHqpYi/MthfiAQaR4WmWEyvX5xBKAovIgYQF9DCKxabxEPLUL9RTMO1oc59oIyFHS66 R5IVzdL+NkQwj9Zmf9FlTiPdthD0Dua0XUYM0ThILX/i4tZN20CI0dy+NC+6mbLeL33K n2XW0A7BuRNHudEyAi71/gaUhNi5slioklJPh6+S+sg9+nnlIGOfudE1szD4PsvOD4mE pWyjj6TBdgc2sByptDovpfX6FLr5pa1qq2n18R5Jvma3vhPAv6xVY9Rzd0Xhz7UbDaep Q9qQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=toshiba.co.jp Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e5si1016329pgu.816.2022.01.19.12.44.46; Wed, 19 Jan 2022 12:44:57 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=toshiba.co.jp Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231913AbiARHa4 (ORCPT + 99 others); Tue, 18 Jan 2022 02:30:56 -0500 Received: from mo-csw-fb1114.securemx.jp ([210.130.202.173]:46878 "EHLO mo-csw-fb.securemx.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229474AbiARHaz (ORCPT ); Tue, 18 Jan 2022 02:30:55 -0500 Received: by mo-csw-fb.securemx.jp (mx-mo-csw-fb1114) id 20I5k8FR002771; Tue, 18 Jan 2022 14:46:09 +0900 Received: by mo-csw.securemx.jp (mx-mo-csw1114) id 20I5jmUW030006; Tue, 18 Jan 2022 14:45:48 +0900 X-Iguazu-Qid: 2wHHOe8oPqfgLHbULq X-Iguazu-QSIG: v=2; s=0; t=1642484748; q=2wHHOe8oPqfgLHbULq; m=VAOczg2DnS8QSbYDBwK1TRj1xM0/+Rg5QHs9/nZdNRM= Received: from imx2-a.toshiba.co.jp (imx2-a.toshiba.co.jp [106.186.93.35]) by relay.securemx.jp (mx-mr1113) id 20I5jkJl031006 (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 18 Jan 2022 14:45:46 +0900 X-SA-MID: 30475378 From: Yuji Ishikawa To: "David S . Miller" , Jakub Kicinski Cc: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, nobuhiro1.iwamatsu@toshiba.co.jp, yuji2.ishikawa@toshiba.co.jp Subject: [PATCH 2/2] net: stmmac: dwmac-visconti: Fix clock configuration for RMII mode Date: Tue, 18 Jan 2022 14:39:50 +0900 X-TSB-HOP: ON X-TSB-HOP2: ON Message-Id: <20220118053950.2605-3-yuji2.ishikawa@toshiba.co.jp> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220118053950.2605-1-yuji2.ishikawa@toshiba.co.jp> References: <20220118053950.2605-1-yuji2.ishikawa@toshiba.co.jp> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Bit pattern of the ETHER_CLOCK_SEL register for RMII/MII mode should be fixed. Also, some control bits should be modified with a specific sequence. Signed-off-by: Yuji Ishikawa Reviewed-by: Nobuhiro Iwamatsu --- .../ethernet/stmicro/stmmac/dwmac-visconti.c | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c index 43a446cea..dde5b772a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c @@ -96,31 +96,41 @@ static void visconti_eth_fix_mac_speed(void *priv, unsigned int speed) val |= ETHER_CLK_SEL_TX_O_E_N_IN; writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); + /* Set Clock-Mux, Start clock, Set TX_O direction */ switch (dwmac->phy_intf_sel) { case ETHER_CONFIG_INTF_RGMII: val = clk_sel_val | ETHER_CLK_SEL_RX_CLK_EXT_SEL_RXC; + writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); + + val |= ETHER_CLK_SEL_RX_TX_CLK_EN; + writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); + + val &= ~ETHER_CLK_SEL_TX_O_E_N_IN; + writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); break; case ETHER_CONFIG_INTF_RMII: val = clk_sel_val | ETHER_CLK_SEL_RX_CLK_EXT_SEL_DIV | - ETHER_CLK_SEL_TX_CLK_EXT_SEL_TXC | ETHER_CLK_SEL_TX_O_E_N_IN | + ETHER_CLK_SEL_TX_CLK_EXT_SEL_DIV | ETHER_CLK_SEL_TX_O_E_N_IN | ETHER_CLK_SEL_RMII_CLK_SEL_RX_C; + writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); + + val |= ETHER_CLK_SEL_RMII_CLK_RST; + writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); + + val |= ETHER_CLK_SEL_RMII_CLK_EN | ETHER_CLK_SEL_RX_TX_CLK_EN; + writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); break; case ETHER_CONFIG_INTF_MII: default: val = clk_sel_val | ETHER_CLK_SEL_RX_CLK_EXT_SEL_RXC | - ETHER_CLK_SEL_TX_CLK_EXT_SEL_DIV | ETHER_CLK_SEL_TX_O_E_N_IN | - ETHER_CLK_SEL_RMII_CLK_EN; + ETHER_CLK_SEL_TX_CLK_EXT_SEL_TXC | ETHER_CLK_SEL_TX_O_E_N_IN; + writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); + + val |= ETHER_CLK_SEL_RX_TX_CLK_EN; + writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); break; } - /* Start clock */ - writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); - val |= ETHER_CLK_SEL_RX_TX_CLK_EN; - writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); - - val &= ~ETHER_CLK_SEL_TX_O_E_N_IN; - writel(val, dwmac->reg + REG_ETHER_CLOCK_SEL); - spin_unlock_irqrestore(&dwmac->lock, flags); } -- 2.17.1