Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1975988rwl; Thu, 6 Apr 2023 04:14:56 -0700 (PDT) X-Google-Smtp-Source: AKy350ZY7fPx9IMa+GBVrizELzxw8vuMJXsOt0ZfAHBMfnrzhnMuZ1btO8u0OqQWAtkgR5lRhHpv X-Received: by 2002:aa7:c302:0:b0:4fb:aa0a:5b72 with SMTP id l2-20020aa7c302000000b004fbaa0a5b72mr4511006edq.5.1680779695831; Thu, 06 Apr 2023 04:14:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680779695; cv=none; d=google.com; s=arc-20160816; b=yqE4GBr4I1hXP+2vxVF1o5R/fPKzD5hdh77Z7P0R79og46sxa1axnYOQj7OgR9Rg1W gimek5an7T6sY/LBaSc0xSKhwEfLX6DZSPxGqy+Bb6145iZ4MIx/zSC5PBId+Eo8nX5D MHCrovNfY18zStv4xu77UJiWq4r2r45Wh71//87qIO6lbErEDgI18VbdIJbOfDRf3bgP TIRMjnZiUB46LeVUFCw7sXaeeNGjPlPGO+6b6rTI+LcgwQ26RrXC3s+L6FxiH3nnnHFt YMFLz2dezT+iRE08MYcQA4Q0W6B8VAYm+E06N7v6GkV6BYKvEncY/x9ksOQi2UwtwXac fm2g== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=29DiQcJ+NesR4bzlrgSGDb6JnN91qFQawEIe6tNxYUo=; b=ONRltD7QnuECKGx8wchZdxeuDVVvhfRsKOEohTnBlOTTJ9lXgHtXJkyLLzKHUVNTHV acxRlJEJ5zTO1R6gNbfN9l7yzcdsgiYxH2RZ6rAUyhFp06+ELQHsyPT4MOkcy1aI0hA4 n3sTEZAt6x7eN7sgc/geX904Qn2EnTun9bZwnAMv6RzQcflXUcHPeZ99rthYGqlFFQdW mlCc1CKGnmWI8Rwdka9NbPpf65s6jhtttlAn1VIS+mpqxdb7QAtZH9VkjG166GAWrbVL JnL4CrJ6Oo5OU74R+G+6cfp3j5S9BZkoBMomMvSkkthSlIYlPoI9Cq9/OhxhIqHJ0uik xx7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=BaTEkyAh; 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 f17-20020aa7d851000000b004fbdcbde811si844198eds.655.2023.04.06.04.14.31; Thu, 06 Apr 2023 04:14:55 -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=BaTEkyAh; 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 S237148AbjDFLHg (ORCPT + 99 others); Thu, 6 Apr 2023 07:07:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236987AbjDFLHe (ORCPT ); Thu, 6 Apr 2023 07:07:34 -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 40A607A9D; Thu, 6 Apr 2023 04:07:31 -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-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To: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=29DiQcJ+NesR4bzlrgSGDb6JnN91qFQawEIe6tNxYUo=; b=BaTEkyAhdN5dw6cCUs02xo/plw WLCS1AwOw7Zev1BLZKXfHyhlnjjP4ozYoeSUWRONWbmN0kba+V79CUy1Jbd7mClSdQvOmm+DeKbF9 QOgTs7KK1c0Y1EvvPS9742xOwiQ+ehUMnp9kMAfP6KIc6NCR7kwM+lsRFHvBII9EYFbKGZqnuVvpk WsRwArejLCyVoakKWoeGXIFdfT2za2hfvRhiJfZaz0u5hp+5h6b6SWAdw9AOGikDrBObt7z+PXTfe jazufLNrIJMXtIDEZSWaGiw3XZ2UHf2CnxFB1+BRLVDOySv5sNwEVGNnVEVoHmEt5FTgJ3o4LFSnS /rlKe9rQ==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:46406) 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 1pkNSN-0006ry-9H; Thu, 06 Apr 2023 12:07:07 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1pkNSH-0007R0-4o; Thu, 06 Apr 2023 12:07:01 +0100 Date: Thu, 6 Apr 2023 12:07:01 +0100 From: "Russell King (Oracle)" To: arinc9.unal@gmail.com Cc: 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 , =?utf-8?B?QXLEsW7DpyDDnE5BTA==?= , 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: Re: [RFC PATCH net-next] net: dsa: mt7530: fix port specifications for MT7988 Message-ID: References: <20230406100445.52915-1-arinc.unal@arinc9.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230406100445.52915-1-arinc.unal@arinc9.com> Sender: Russell King (Oracle) X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE 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 On Thu, Apr 06, 2023 at 01:04:45PM +0300, arinc9.unal@gmail.com wrote: > From: Arınç ÜNAL > > On the switch on the MT7988 SoC, there are only 4 PHYs. There's only port 6 > as the CPU port, there's no port 5. Split the switch statement with a check > to enforce these for the switch on the MT7988 SoC. The internal phy-mode is > specific to MT7988 so put it for MT7988 only. > > Signed-off-by: Arınç ÜNAL > --- > > Daniel, this is based on the information you provided me about the switch. > I will add this to my current patch series if it looks good to you. > > Arınç > > --- > drivers/net/dsa/mt7530.c | 67 ++++++++++++++++++++++++++-------------- > 1 file changed, 43 insertions(+), 24 deletions(-) > > diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c > index 6fbbdcb5987f..f167fa135ef1 100644 > --- a/drivers/net/dsa/mt7530.c > +++ b/drivers/net/dsa/mt7530.c > @@ -2548,7 +2548,7 @@ static void mt7988_mac_port_get_caps(struct dsa_switch *ds, int port, > phy_interface_zero(config->supported_interfaces); > > switch (port) { > - case 0 ... 4: /* Internal phy */ > + case 0 ... 3: /* Internal phy */ > __set_bit(PHY_INTERFACE_MODE_INTERNAL, > config->supported_interfaces); > break; > @@ -2710,37 +2710,56 @@ mt753x_phylink_mac_config(struct dsa_switch *ds, int port, unsigned int mode, > struct mt7530_priv *priv = ds->priv; > u32 mcr_cur, mcr_new; > > - switch (port) { > - case 0 ... 4: /* Internal phy */ > - if (state->interface != PHY_INTERFACE_MODE_GMII && > - state->interface != PHY_INTERFACE_MODE_INTERNAL) > - goto unsupported; > - break; > - case 5: /* Port 5, a CPU port. */ > - if (priv->p5_interface == state->interface) > + if (priv->id == ID_MT7988) { > + switch (port) { > + case 0 ... 3: /* Internal phy */ > + if (state->interface != PHY_INTERFACE_MODE_INTERNAL) How do these end up with PHY_INTERFACE_MODE_INTERNAL ? phylib defaults to GMII mode without something else being specified in DT. Also note that you should *not* be validating state->interface in the mac_config() method because it's way too late to reject it - if you get an unsupported interface here, then that is down to the get_caps() method being buggy. Only report interfaces in get_caps() that you are prepared to handle in the rest of the system. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!