Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp1320596lqh; Mon, 6 May 2024 04:24:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUWChxTJv3IqBCK+Nt/4oBRVnK3DbJA1whGQSuVU55zw5TVhJsbSwv6KhSQeJhGr2g6yxmSATWxV3DqQprbj9RfjuaQLe3+GiEBIMBF5g== X-Google-Smtp-Source: AGHT+IG7hflKw7qhH7ZrjbMin36fuyGQrRfP7N7N0qINeVvFzfYXrYLQV1XO3l4ds0I1Cvp+tI6+ X-Received: by 2002:a50:cd5d:0:b0:572:71b3:3c4d with SMTP id d29-20020a50cd5d000000b0057271b33c4dmr6255970edj.34.1714994685443; Mon, 06 May 2024 04:24:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714994685; cv=pass; d=google.com; s=arc-20160816; b=p0JdoiDy66XiUSjGa29YL6d9Sh1VWzqhM5LBq2jAGF43LQl/cZuuqXtkwA+zDkPU/B pRtIPihomWZWQrZiyYZjsZyqV0JqjMOG+2WxUNnwuR6iX9oGE203FEHFu1DIPjuL5ry6 0itGdOwQQdIrRXvNBmOHi1gCrxpc/h9aB0UbecxH/3pKqIEbnf/jyF0U1XxSqAmSE8fm xRVoL8SGRH3/uHT+ScltRrlmlq6HM7I8AsqHa+5m+X6zwGgJQVdiA97QVpgNUL+EgctS SrVxUOXmNhpdumpFYtV6rvhzucVHh0RK913We15YcitSt+rxLO4e3mhSN2NFU+G3jQCT A20g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date; bh=6/5d9mrey0z6E77J+ABi9iiwn9elsW+Czw3OW2qo5J0=; fh=uYiYYTqoiQtwJMMFIGcFVOwPaCwRorFI2ifEJJ6G7Fc=; b=reHVKeMl8KgSVdPFvCheZRqaaD7dEF1yIw9IEBKIxI+uOZUmabqvrUGXbNZuTRM7ch MFSIQ4nKMWcEDePo/ciTzpIlKgn+KoYL5uZh9fC//7kye1R8Nim2yLQj2Kltp+q6NQsl SVnFQBnarE0Tot7oof/uvSPN4vEiuCcbSQIOOiq0s8b+SoIDiFZ2pzTWvSkfxyq0F/Dw w06wIzFsbkzOB9FSMNww7c0Q11BdY2kb0jN5Gu+CbyTj9iL2ZVw4I/imEEsAWGASZ4p5 7aXsg82Hu1ZiA3K8IMJ+OKfrIAF62ZJO9+8ZDhexo0Ek6v+Lx9CuHRtF2dgi09aJ50/Y edLA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=makrotopia.org); spf=pass (google.com: domain of linux-kernel+bounces-169732-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169732-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id l21-20020aa7d955000000b00572b128de80si4705340eds.690.2024.05.06.04.24.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 04:24:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-169732-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=makrotopia.org); spf=pass (google.com: domain of linux-kernel+bounces-169732-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169732-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 1E2E51F211C5 for ; Mon, 6 May 2024 11:24:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 07C67142E9F; Mon, 6 May 2024 11:24:36 +0000 (UTC) Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 913C314262C; Mon, 6 May 2024 11:24:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714994675; cv=none; b=YxBhyl2AtJiDyEuzRlUev1epEFBCGYRyK32Az8nQzNXObKZfCwegaxQeXd+r76VtTpkqGdIRY0vCGoXR+p+hgg3jYhhBNRyJdUDQma/kWV5VP/ElJ4fN6Hggr5iOdsEcv/HN5tPWpT+DcY121WWHzUgScVA8YB3tYFNxm/TjGKU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714994675; c=relaxed/simple; bh=eh/Jl7ow3G5csXcfFyd1/lkvB9y3DrTGKYKArXTKXBM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=n43T47lQX0WwAxRawPIzUazTwG0f6w/gPyBvO047oE2nKSQBTuQLI+m3p07Q9VTZgKHBYUKGh0BQr9wGOHrXObJ2JVWUoFXO291aAR3dBzLMu7VtcVqbaEnee6aaAkWG2G1VIRb79eRG3jt9jzykJS2sy4ABAmfo5UNgxXQ/aaM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.97.1) (envelope-from ) id 1s3wSD-000000005mU-15Wb; Mon, 06 May 2024 11:24:21 +0000 Date: Mon, 6 May 2024 12:24:17 +0100 From: Daniel Golle To: arinc.unal@arinc9.com Cc: DENG Qingfang , Sean Wang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Bartel Eerdekens , mithat.guner@xeront.com, 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: [PATCH net-next v2] net: dsa: mt7530: detect PHY muxing when PHY is defined on switch MDIO bus Message-ID: References: <20240430-b4-for-netnext-mt7530-use-switch-mdio-bus-for-phy-muxing-v2-1-9104d886d0db@arinc9.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240430-b4-for-netnext-mt7530-use-switch-mdio-bus-for-phy-muxing-v2-1-9104d886d0db@arinc9.com> On Tue, Apr 30, 2024 at 08:01:33AM +0300, Arınç ÜNAL via B4 Relay wrote: > From: Arınç ÜNAL > > Currently, the MT7530 DSA subdriver configures the MT7530 switch to provide > direct access to switch PHYs, meaning, the switch PHYs listen on the MDIO > bus the switch listens on. The PHY muxing feature makes use of this. > > This is problematic as the PHY may be attached before the switch is > initialised, in which case, the PHY will fail to be attached. > > Since commit 91374ba537bd ("net: dsa: mt7530: support OF-based registration > of switch MDIO bus"), we can describe the switch PHYs on the MDIO bus of > the switch on the device tree. Extend the check to detect PHY muxing when > the PHY is defined on the MDIO bus of the switch on the device tree. > > When the PHY is described this way, the switch will be initialised first, > then the switch MDIO bus will be registered. Only after these steps, the > PHY will be attached. > > Signed-off-by: Arınç ÜNAL Reviewed-by: Daniel Golle > --- > Changes in v2: > - Address the terminology on the patch log. > - Link to v1: https://lore.kernel.org/r/20240429-b4-for-netnext-mt7530-use-switch-mdio-bus-for-phy-muxing-v1-1-1f775983e155@arinc9.com > --- > drivers/net/dsa/mt7530.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c > index 2b9f904a98f0..6cf21c9d523b 100644 > --- a/drivers/net/dsa/mt7530.c > +++ b/drivers/net/dsa/mt7530.c > @@ -2483,7 +2483,8 @@ mt7530_setup(struct dsa_switch *ds) > if (!phy_node) > continue; > > - if (phy_node->parent == priv->dev->of_node->parent) { > + if (phy_node->parent == priv->dev->of_node->parent || > + phy_node->parent->parent == priv->dev->of_node) { I had some concerns about missing check for phy_node->parent != NULL, but it's impossible in practise. If phy_node exists, it will have a parent node as well. To be super extra safe, maybe doing phy_node->parent && phy_node->parent->parent == priv->dev->of_node would be better. > ret = of_get_phy_mode(mac_np, &interface); > if (ret && ret != -ENODEV) { > of_node_put(mac_np); > > --- > base-commit: 5c4c0edca68a5841a8d53ccd49596fe199c8334c > change-id: 20240429-b4-for-netnext-mt7530-use-switch-mdio-bus-for-phy-muxing-586269371c55 > > Best regards, > -- > Arınç ÜNAL > > >