Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5403545rwd; Mon, 12 Jun 2023 04:49:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6GKTrTilT3geI3gIZgeiTGHvNlw2+wSUC3/qheitgoA/wwihiTMrjZG+Ewpu+h7+QeSSTj X-Received: by 2002:a05:6a20:7f87:b0:118:5d5a:f26f with SMTP id d7-20020a056a207f8700b001185d5af26fmr9630260pzj.12.1686570567050; Mon, 12 Jun 2023 04:49:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686570567; cv=none; d=google.com; s=arc-20160816; b=dLVSvez2Oqk1OIDKN+Vekb8OkL3J/jkIgeYnyvKf+bLRTaJlV1pliygPSuFXh0mcG0 mW41FP5mpb55u7V0xU3GxG+zeLUjKXq6oeo5/nC3g6ddzDQhngYen2ZihmqmhnKUVwN9 uHAFp+ss2i95qV2ltvLe06qiNXmoEry4VJOG5f/DPxmqeOyMV8/YXdXNfbjBp1Gb0B45 EIZcpE9mpK4H6DPacLDV+UzVUkN6hJyw2CEiOJMJE6vAtO+N7SUW/wwXYE8kmwzJkT0a uV1ww77wRuhvWRBjKwKaDllvqsMrR2MJ7it02y8DTEKOCPRJbz0eG3WQhwnvuH7ROCKL M3+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=36XT+W2jk5CIFa+WG0Q2ZcCHn/yHT0eHq3gE6BLySHQ=; b=WOIooTz5eMDDtNPw/rNdwir0vTmNJWc23N1XGs6SV3y6da9zGboONvnroQVpmBMiuk AnGLBFEWO/5PE3U+X/cWK6UmhxAHgRtYIspQdzTuovFD2q0ZVCSLBIW2TuFahw7q+WL0 Xe+o4dplHHliuhD/MoMNnueeFW1hSeMQC0E7KxoZnL5/62BNZyZXE5W1igJrECfy3FLV p0nhOPVuUM4wng5JJ7NpVJDDEwhNbzcHHKPRyejgLOCVfEfgwHX0WDRheEZRiq6B+6gP 8YOHEPIi+0DXZiSs06ebQByWNwluwtoYu3z85IrcxYFZ0Z+P4n5F/9Frfja59zddiUZ8 Oadg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=U1lQrQVH; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 197-20020a6301ce000000b0053b86623b3asi3736914pgb.577.2023.06.12.04.49.14; Mon, 12 Jun 2023 04:49:27 -0700 (PDT) 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=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=U1lQrQVH; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236891AbjFLLk7 (ORCPT + 99 others); Mon, 12 Jun 2023 07:40:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237306AbjFLLja (ORCPT ); Mon, 12 Jun 2023 07:39:30 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC62BBD; Mon, 12 Jun 2023 04:33:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=36XT+W2jk5CIFa+WG0Q2ZcCHn/yHT0eHq3gE6BLySHQ=; b=U1lQrQVH5nBqDOyuohzmMYHg5j X8OJVBhjV1g+IZlMta6smtL5UyG5THn0GEpnDDC1GX5OLBe/7FyN6hw9VL1f4SNyzn7aKSq7PSp7G rxuRWlALT6mNIbCyeOh9uXuQMMwfduQiRgCR1tJXpcXsAfCsLDatmemMgCbEN3csev3SCSEOZbbZ4 vfEIfita03v846CVuFGdpr4rnEADICC1l2nIC21h0sWEwRLuS/TxAB/5LDw/T/NVxbonuHCY/CP3h sLLXiFczoHwtDxrsIqydkENI/eQwKPRd9ZZa2MywV75dqpMCVzQQhJEYqkda1Xa/uYoKPl/Tyjaq3 tmiMSjGQ==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:38822) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q8fnd-0005fn-Pp; Mon, 12 Jun 2023 12:33:29 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1q8fna-0004va-3b; Mon, 12 Jun 2023 12:33:26 +0100 Date: Mon, 12 Jun 2023 12:33:25 +0100 From: "Russell King (Oracle)" To: Daniel Golle Cc: netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, AngeloGioacchino Del Regno , Matthias Brugger , Lorenzo Bianconi , Mark Lee , Sean Wang , John Crispin , Felix Fietkau , Conor Dooley , Krzysztof Kozlowski , Rob Herring , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Sam Shih Subject: Re: [PATCH net-next 8/8] net: ethernet: mtk_eth_soc: add basic support for MT7988 SoC Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Russell King (Oracle) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE 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 On Sun, Jun 11, 2023 at 01:43:37AM +0100, Daniel Golle wrote: > if (updated) { > - val = mtk_r32(eth, MTK_MAC_MISC); > + val = mtk_r32(eth, reg); > val = (val & mask) | set; > - mtk_w32(eth, val, MTK_MAC_MISC); > + mtk_w32(eth, val, reg); mtk_m32() ? > + /* Force Port1 XGMAC Link Up */ > + val = mtk_r32(eth, MTK_XGMAC_STS(MTK_GMAC1_ID)); > + mtk_w32(eth, val | MTK_XGMAC_FORCE_LINK(MTK_GMAC1_ID), > + MTK_XGMAC_STS(MTK_GMAC1_ID)); > + > + /* Adjust GSW bridge IPG to 11 */ > + val = mtk_r32(eth, MTK_GSW_CFG); > + val &= ~(GSWTX_IPG_MASK | GSWRX_IPG_MASK); > + val |= (GSW_IPG_11 << GSWTX_IPG_SHIFT) | > + (GSW_IPG_11 << GSWRX_IPG_SHIFT); > + mtk_w32(eth, val, MTK_GSW_CFG); mtk_m32() for both these? > + /* Setup gmac */ > + if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3) && > + mac->interface == PHY_INTERFACE_MODE_INTERNAL) { > + mtk_w32(mac->hw, MTK_GDMA_XGDM_SEL, MTK_GDMA_EG_CTRL(mac->id)); > + mtk_w32(mac->hw, MAC_MCR_FORCE_LINK_DOWN, MTK_MAC_MCR(mac->id)); > + > + mtk_setup_bridge_switch(eth); I think this should be documented somewhere - that PHY_INTERFACE_MODE_INTERNAL means the MAC is connected to a switch. However, I'm not sure that's the best condition to use - don't we have a way for a MAC to test if it's connected to a DSA switch? > + /* Configure MDC Turbo Mode */ > + if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3)) { > + val = mtk_r32(eth, MTK_MAC_MISC_V3); > + val |= MISC_MDC_TURBO; > + mtk_w32(eth, val, MTK_MAC_MISC_V3); > + } > val = mtk_r32(eth, MTK_PPSC); > + if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V1) || > + MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) > + val |= PPSC_MDC_TURBO; > + > + /* Configure MDC Divider */ > val &= ~PPSC_MDC_CFG; > - val |= FIELD_PREP(PPSC_MDC_CFG, divider) | PPSC_MDC_TURBO; > + val |= FIELD_PREP(PPSC_MDC_CFG, divider); > mtk_w32(eth, val, MTK_PPSC); More opportunities for mtk_m32(). > + if (MTK_HAS_CAPS(mac->hw->soc->caps, MTK_NETSYS_V3_BIT) && > + MTK_HAS_CAPS(mac->hw->soc->caps, MTK_ESW_BIT) && > + id == MTK_GMAC1_ID) { > + mac->phylink_config.mac_capabilities = MAC_ASYM_PAUSE | > + MAC_SYM_PAUSE | > + MAC_10000FD; > + phy_interface_zero(mac->phylink_config.supported_interfaces); Were there bits set that you don't want? Thanks! -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!