Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2056582pxb; Mon, 12 Apr 2021 13:10:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3BA2dr9QEXbkIYcnzp0pQ6Nee/WGRVWqcww5Jgkg8rBeXMlM1OwqfjsvnOaPMTQpBnaxT X-Received: by 2002:a63:d748:: with SMTP id w8mr27834476pgi.266.1618258218009; Mon, 12 Apr 2021 13:10:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618258218; cv=none; d=google.com; s=arc-20160816; b=Uh5h57tye+TPlWKdP4tUxFNNa012adfg5d3de3K9iZcwkpDxuqcFURJPgVcHj6HQnm JVpHRUugythWrgDX0aPU8LFsBGLMwWPyLyaY0XQs7TPwAJcp03eETAIi2CAuIx3/8PDq 92j93oa+WHFL+jZ5jmgL+VjV+srBywcnMNQQAU79wgHi52JQ8toS5+lEx62SoYvAzpNn onHmg9GAgTZ6pafetRu35ZW/+vsXfynI4q5CpG7IXxLZZqtafULnjVQQBHK5nUkLV3cS LLGZiTLZrRDfjRhfvYoHPTHSlo1ivPqn/gWPGZC5wnWLD4ot8lZ5wynl6dDeAwwfmZaD TL7A== 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=w9fHYSiR+2qTV9gQzh9VY//RUFuVOXrjkCEsmXDN0KQ=; b=HHRgLft/qaAFTWC5b4HWJaPn+rjrWoIy/E/55dZfs8HLDFwc2O2iSFkGvNFvoO1tS0 I6lTCvlwQI8M3VQMolqpv6dAWqMF6o9MUB1WNh656bcsFs4DW2yjh9thQu2iYgE8Bk7C jXGxK/eEfiOEuuD4V9pLWoDIQIrjWdyi+pi7bjSbAOUBAZe5IPG13DtpL5eFCreFQE/D PKznNOcA1fuBVynkNQTQr5IOgWEJHUwIPZTXU8H6Ru+1p+hRC4TdrNz7SPR2G8kHOcx/ ts0h3/XYHgKdU4uGrJ44RFMtY2ZSnD8fXuxfn/ayl/mv495bevQ//74cd3Vw/Dt+IEd3 4epw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UsI7D3YQ; 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 lt14si479462pjb.146.2021.04.12.13.10.05; Mon, 12 Apr 2021 13:10:17 -0700 (PDT) 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=UsI7D3YQ; 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 S237831AbhDLIu6 (ORCPT + 99 others); Mon, 12 Apr 2021 04:50:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:40154 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238022AbhDLIrM (ORCPT ); Mon, 12 Apr 2021 04:47:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id ECB1A60241; Mon, 12 Apr 2021 08:46:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618217214; bh=Z5yp3c1JKRaDWcp/FAKciNoNk4fIeyswpLIHlDudOWQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UsI7D3YQXpM9Rf1PJPTZ3WoLoCKhbnPS6CA7M7+bZRxip0aTlJ4HDWWBwU9vkp+8l hG9xR4VojJ6kPMXcWoPpYfHRAT05JjQX22KKCatTertlaKApjYRLNxAz4kV/hbAbDb kFfW/mZ+tYrX2zL4aqX8ZkXd3JtIo+YKDWePdO/U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hauke Mehrtens , Martin Blumenstingl , Florian Fainelli , "David S. Miller" , Sasha Levin Subject: [PATCH 5.4 044/111] net: dsa: lantiq_gswip: Configure all remaining GSWIP_MII_CFG bits Date: Mon, 12 Apr 2021 10:40:22 +0200 Message-Id: <20210412084005.718187166@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412084004.200986670@linuxfoundation.org> References: <20210412084004.200986670@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 commit 4b5923249b8fa427943b50b8f35265176472be38 upstream. There are a few more bits in the GSWIP_MII_CFG register for which we did rely on the boot-loader (or the hardware defaults) to set them up properly. For some external RMII PHYs we need to select the GSWIP_MII_CFG_RMII_CLK bit and also we should un-set it for non-RMII PHYs. The GSWIP_MII_CFG_RMII_CLK bit is ignored for other PHY connection modes. The GSWIP IP also supports in-band auto-negotiation for RGMII PHYs when the GSWIP_MII_CFG_RGMII_IBS bit is set. Clear this bit always as there's no known hardware which uses this (so it is not tested yet). Clear the xMII isolation bit when set at initialization time if it was previously set by the bootloader. Not doing so could lead to no traffic (neither RX nor TX) on a port with this bit set. While here, also add the GSWIP_MII_CFG_RESET bit. We don't need to manage it because this bit is self-clearning when set. We still add it here to get a better overview of the GSWIP_MII_CFG register. Fixes: 14fceff4771e51 ("net: dsa: Add Lantiq / Intel DSA driver for vrx200") Cc: stable@vger.kernel.org Suggested-by: Hauke Mehrtens Acked-by: Hauke Mehrtens Signed-off-by: Martin Blumenstingl Reviewed-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman [ Updated after the upstream commit 3e9005be87777 required some changes for Linux 5.4 ] Signed-off-by: Martin Blumenstingl Signed-off-by: Sasha Levin --- drivers/net/dsa/lantiq_gswip.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c index e0f5d406e6c0..dc75e798dbff 100644 --- a/drivers/net/dsa/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq_gswip.c @@ -93,8 +93,12 @@ /* GSWIP MII Registers */ #define GSWIP_MII_CFGp(p) (0x2 * (p)) +#define GSWIP_MII_CFG_RESET BIT(15) #define GSWIP_MII_CFG_EN BIT(14) +#define GSWIP_MII_CFG_ISOLATE BIT(13) #define GSWIP_MII_CFG_LDCLKDIS BIT(12) +#define GSWIP_MII_CFG_RGMII_IBS BIT(8) +#define GSWIP_MII_CFG_RMII_CLK BIT(7) #define GSWIP_MII_CFG_MODE_MIIP 0x0 #define GSWIP_MII_CFG_MODE_MIIM 0x1 #define GSWIP_MII_CFG_MODE_RMIIP 0x2 @@ -817,9 +821,11 @@ static int gswip_setup(struct dsa_switch *ds) /* Configure the MDIO Clock 2.5 MHz */ gswip_mdio_mask(priv, 0xff, 0x09, GSWIP_MDIO_MDC_CFG1); - /* Disable the xMII link */ + /* Disable the xMII interface and clear it's isolation bit */ for (i = 0; i < priv->hw_info->max_ports; i++) - gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_EN, 0, i); + gswip_mii_mask_cfg(priv, + GSWIP_MII_CFG_EN | GSWIP_MII_CFG_ISOLATE, + 0, i); /* enable special tag insertion on cpu port */ gswip_switch_mask(priv, 0, GSWIP_FDMA_PCTRL_STEN, @@ -1594,6 +1600,9 @@ static void gswip_phylink_mac_config(struct dsa_switch *ds, int port, break; case PHY_INTERFACE_MODE_RMII: miicfg |= GSWIP_MII_CFG_MODE_RMIIM; + + /* Configure the RMII clock as output: */ + miicfg |= GSWIP_MII_CFG_RMII_CLK; break; case PHY_INTERFACE_MODE_RGMII: case PHY_INTERFACE_MODE_RGMII_ID: @@ -1606,7 +1615,11 @@ static void gswip_phylink_mac_config(struct dsa_switch *ds, int port, "Unsupported interface: %d\n", state->interface); return; } - gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_MODE_MASK, miicfg, port); + + gswip_mii_mask_cfg(priv, + GSWIP_MII_CFG_MODE_MASK | GSWIP_MII_CFG_RMII_CLK | + GSWIP_MII_CFG_RGMII_IBS | GSWIP_MII_CFG_LDCLKDIS, + miicfg, port); gswip_port_set_speed(priv, port, state->speed, state->interface); gswip_port_set_duplex(priv, port, state->duplex); -- 2.30.2