Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp880659rwl; Fri, 7 Apr 2023 06:55:39 -0700 (PDT) X-Google-Smtp-Source: AKy350a3E8rSZVbAwOCbojsD544Wqn9KtDKQiSALYP5MnjwRiyb6qCjfsirvDkBLjGyS01B0uqvz X-Received: by 2002:a17:902:ecc3:b0:1a2:9334:f79a with SMTP id a3-20020a170902ecc300b001a29334f79amr3262236plh.38.1680875738810; Fri, 07 Apr 2023 06:55:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680875738; cv=none; d=google.com; s=arc-20160816; b=LDBdwDC82HGYYvFdYfcZcXRbtyxn/2BhzM/abJkjfXG6JHG0+uE6cgY8js3bpsK5Ov ehkjsPMtfb0uja0VKTFDRXGwuHp9c378zrezqFlqh9Agb5+1DkR5QQrNpw3jFaioYR2b hhq073dBDFuxGHMhMC1RhdfJCuZeeDNAnZQboXpDy+nGfbm8lHEM+lG4uygP0fKOYPke LvGS+RZuMuls5kvtyYXRo5r2fD9hTPJaXPS0hDN8zZBCvuUzQx4DH/Oxkhl6ocOrp7q/ zzL2edf/uctAf8ZYe662u2BXcZGyBeTwyp8eMKy43eHkxfnk1iTh6tDdsV28idqwTGG3 LtdA== 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=Jsn0NQ9CmWAx6uQ/GpiFpZY13AUB836GqLn0lOzSnMY=; b=uMod5jsAQivhYA/F3L0fVuKuJf8NitJrIa7wsOQsImuAnpN9qEJYQsXL+FRjiLQtGQ 6xje7liNCEBcj0uHXrLU7US21sxi4JmBBGSpfWhHwxHPuTlaCZnZamH+9/rLdE1WcsFM AOF+LuPcuAgE0+QxyobW1GZgydhToBwMBZeY3fZcB9wY5I2a30nRCgRcvJ0iACuxproG IA4yljw3dfPFG3Q1b6jDcgJbOG9SFlasOB0rbh6RwFbLTEKfmERnB19R/SfTS/n+vaOg rGUpRafSrVlWDokK5w6IxpdMFPlqBBgMxWIVELTtGpuaERKch9qOdymteW6RdAiZ5bIO r8DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=dbhdUjb5; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e6-20020a17090301c600b0019c14335fc0si4249773plh.70.2023.04.07.06.55.27; Fri, 07 Apr 2023 06:55:38 -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=pass header.i=@gmail.com header.s=20210112 header.b=dbhdUjb5; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238991AbjDGNuw (ORCPT + 99 others); Fri, 7 Apr 2023 09:50:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237444AbjDGNtG (ORCPT ); Fri, 7 Apr 2023 09:49:06 -0400 Received: from mail-yw1-x112e.google.com (mail-yw1-x112e.google.com [IPv6:2607:f8b0:4864:20::112e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CDCEC16E; Fri, 7 Apr 2023 06:47:18 -0700 (PDT) Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-54bfce685c1so128068567b3.1; Fri, 07 Apr 2023 06:47:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680875236; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Jsn0NQ9CmWAx6uQ/GpiFpZY13AUB836GqLn0lOzSnMY=; b=dbhdUjb5Kx495YHbuaMUJ+xjTzf9UozTmMvu4Fpv2sLSGROC6B3CmnhQ2dGKQV0jCc 8lvm1MEqANTyT3HXeuYMQdyMZYAxfnxgpc7n1e5VjMGNX8DFTJxfshel9hE45/A0mhGO 1k4Oa/2WSb39LGib8igtf7MnAGRFXYzEWhQfHz4niOl6j1SZ3ZKTo/Q5XjcNJqc4LSYk SDRdgBcw7OJfMnwctk3/Z5y3ckC+lqqOnQ5ztpBm+68gWQo3Zb/MCdFHxg6fLXb0NigI cFGz/fzC8XyoDR+m2qJHQsQd5QwLW93/neCy2XUuNF2KPPFpuVqayNvihMZw9AgDswgL 1GwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680875236; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Jsn0NQ9CmWAx6uQ/GpiFpZY13AUB836GqLn0lOzSnMY=; b=gaJKEZ+NaahLJqntE7Y8ayeN3oKA+3Rke7Ch3F7PSHMFn1CD9HnrdBt+avSN2ngwHL qMr+ZlqHy4YHh9mi3pDoznPDGN5GA3s30pLtRuDUxTODZy/hdklcA8o+iygHMWfjq6J5 dtuKVlFHAqRzzVsCw35faHfYZE35fBjQ1ZriUQiDXAyG6Oz7Yy15kpqX4bvqiZ7M0VgL NRuidCl2aoi7hwStdRvrMj6umm7uNZ8l4lWV0TrlDvKr0T5oic9Rn2qv2QNMyaM/2IFG R2WL3VkhMw8xnokOTt82nFrIWsubtL6eb4otVbMZNCLdqSaHS6WVie7SZdfFxb9XXDAJ fOHw== X-Gm-Message-State: AAQBX9e/WvOV1DkSua3LKAeDuuaCPM/KU09Jc6PTzYhIwWCxcpDjXcgk jRR/OkVFMGgqM8qTiod9X4M= X-Received: by 2002:a81:484d:0:b0:541:9671:3169 with SMTP id v74-20020a81484d000000b0054196713169mr1867341ywa.39.1680875236297; Fri, 07 Apr 2023 06:47:16 -0700 (PDT) Received: from arinc9-PC.lan ([149.91.1.15]) by smtp.gmail.com with ESMTPSA id 139-20020a810e91000000b00545a0818473sm1034317ywo.3.2023.04.07.06.47.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Apr 2023 06:47:15 -0700 (PDT) From: arinc9.unal@gmail.com X-Google-Original-From: arinc.unal@arinc9.com To: Sean Wang , Landen Chao , DENG Qingfang , Daniel Golle , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Russell King Cc: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= , Richard van Schagen , Richard van Schagen , Frank Wunderlich , erkin.bozoglu@xeront.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [RFC PATCH v2 net-next 09/14] net: dsa: mt7530: move enabling port 6 to mt7530_setup_port6() Date: Fri, 7 Apr 2023 16:46:21 +0300 Message-Id: <20230407134626.47928-10-arinc.unal@arinc9.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230407134626.47928-1-arinc.unal@arinc9.com> References: <20230407134626.47928-1-arinc.unal@arinc9.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 From: Arınç ÜNAL Enable port 6 only when port 6 is being used. Read the HWTRAP_XTAL_MASK value from val now that val is equal to the value of MT7530_MHWTRAP. Update the comment on mt7530_setup() with a better explanation. Tested-by: Arınç ÜNAL Signed-off-by: Arınç ÜNAL --- drivers/net/dsa/mt7530.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 0a6d1c0872be..70a673347cf9 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -404,9 +404,13 @@ static int mt7530_setup_port6(struct dsa_switch *ds, phy_interface_t interface) { struct mt7530_priv *priv = ds->priv; - u32 ncpo1, ssc_delta, trgint, xtal; + u32 ncpo1, ssc_delta, trgint, xtal, val; - xtal = mt7530_read(priv, MT7530_MHWTRAP) & HWTRAP_XTAL_MASK; + val = mt7530_read(priv, MT7530_MHWTRAP); + val &= ~MHWTRAP_P6_DIS; + mt7530_write(priv, MT7530_MHWTRAP, val); + + xtal = val & HWTRAP_XTAL_MASK; if (xtal == HWTRAP_XTAL_20MHZ) { dev_err(priv->dev, @@ -2235,9 +2239,9 @@ mt7530_setup(struct dsa_switch *ds) mt7530_rmw(priv, MT7530_TRGMII_RD(i), RD_TAP_MASK, RD_TAP(16)); - /* Enable port 6 */ + /* Enable PHY access and operate in manual mode */ val = mt7530_read(priv, MT7530_MHWTRAP); - val &= ~MHWTRAP_P6_DIS & ~MHWTRAP_PHY_ACCESS; + val &= ~MHWTRAP_PHY_ACCESS; val |= MHWTRAP_MANUAL; mt7530_write(priv, MT7530_MHWTRAP, val); -- 2.37.2