Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1349296lqa; Mon, 29 Apr 2024 06:18:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWuidnVhVEW9AT0Ti86CxvyVfMshoj/IbpPpvqqNDgrVvMV56fOwxKRkdaizuq0zUofET/VaF3axUlBiow67198wcLkn5c5rgW2W3FrnQ== X-Google-Smtp-Source: AGHT+IEn4bSNbhqvsd/zzkfplP2Dw+j/qhGe/nDa4+SH6+Lx6IxJzGIeE3j9w6VHhneWt7jjO5Oz X-Received: by 2002:a67:cd17:0:b0:47b:dc6f:6406 with SMTP id u23-20020a67cd17000000b0047bdc6f6406mr9474687vsl.13.1714396712435; Mon, 29 Apr 2024 06:18:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714396712; cv=pass; d=google.com; s=arc-20160816; b=WWkR3T/dP+UtZo7yKTq98BgQi2K/QJ5CAiUo0nN4UHTnxgEviD1iqCmTxs4WChGkBa lDtfkdf+c6zH/knL21lWpcipSlhMubholcWbgq0TKXTZUVmStVDhLHx9n/FWxbHyOhR0 1IZwO+IK4JKnRM9SUQC4nMVsHHm8ugyt9WDAQJRsoUnkMzlhfDv5m7L3ZGaP/oevjwS8 Pic9PF8qrdwQCn2vvEcUWIdXYuIpj27dZuU5KsazUn3nF8RqwbBr0KyBAMvHrq6ylXC1 Lazqnaq/Xu/fV6fTXuKQk0VVsxrP6IhxT5CXl5bxiAi6cfJdV7Ft4zTjIoJJVy3kSLhF JOuw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=6WIxTn0pRjbZXHgFG8AwaR4joGVxkdi8wOuc1SO7gIs=; fh=5KV02Y39vnDrzsKPYuL0otqQA9qBsVwXe6sAC+akO20=; b=RPZ5If82arcAeHdFskNv3x286Y9uaCJIoSipD4r+f2RdFPAzMnTQyNWUVloXm2kW+r D/5iTn4mqbRKPi1+oUgO1T5ocNKzd0qK3aW4YxWvPSTqv6K1xEfPjCUi/ZgtX0WH+8sm L2NBGaEHGflcfhC9eKzWr7MmVPCkHlhaV47sVrTc3NvqSfk9oNar8J4yaXLNpwHP7OE/ Gmfh2b16ezM0gxzWvtkNpNli43Vni269TS2FLHTWCEZSDTF9lMQDTwpIdytHl4nWcjzF Wdh5fYJebNpJyY7WRdotsB2mWddwOa1yriViQy7j/Q8BAfNEWW1IRO8vD0iFmeOwnN0q A00g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@arinc9.com header.s=gm1 header.b=FGEd0IUV; arc=pass (i=1 spf=pass spfdomain=arinc9.com dkim=pass dkdomain=arinc9.com dmarc=pass fromdomain=arinc9.com); spf=pass (google.com: domain of linux-kernel+bounces-162353-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162353-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arinc9.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id bu11-20020a056102524b00b0047bea717f0esi2870527vsb.347.2024.04.29.06.18.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 06:18:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162353-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@arinc9.com header.s=gm1 header.b=FGEd0IUV; arc=pass (i=1 spf=pass spfdomain=arinc9.com dkim=pass dkdomain=arinc9.com dmarc=pass fromdomain=arinc9.com); spf=pass (google.com: domain of linux-kernel+bounces-162353-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162353-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arinc9.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D7B931C221AD for ; Mon, 29 Apr 2024 13:18:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 196B96BB28; Mon, 29 Apr 2024 13:18:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=arinc9.com header.i=@arinc9.com header.b="FGEd0IUV" Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (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 B071674404; Mon, 29 Apr 2024 13:18:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714396701; cv=none; b=Q/skNZEUV07BRMCzKnqML/vlQ3yPToFl2Fff8oR5rtmTGf0xuHbzuiYhkCLT1vBN65gMqDbIt6IL331DXxkhCvmu8uAV5l9bozmt80JZl3TZExX4+fXp9tJdpKS8uIm1ZBW3ygOf3S28NkVIodgE+7vBnza1cTicectnhzaIprs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714396701; c=relaxed/simple; bh=EUNYM67ljV/1+l6ugAx8BfuV7yZemSgbjdsgHuN1rzU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Ta39qU74o4aQRWbPSlinkK+n0d/sOVbKQsiNKNX6qENo9nu5/bqhLVbAVwJC0MU/SQIw6Tn+MJPyUupwEz9FmrJWrTuoP2ocmVq9RhWYQ+WDVpfrA7PPiTWhC0xL9I554ekr/XiZWorH0zIeFW4CsJJKcKC+cgThCEBa7WyKkZI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arinc9.com; spf=pass smtp.mailfrom=arinc9.com; dkim=pass (2048-bit key) header.d=arinc9.com header.i=@arinc9.com header.b=FGEd0IUV; arc=none smtp.client-ip=217.70.183.198 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arinc9.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arinc9.com Received: by mail.gandi.net (Postfix) with ESMTPSA id D4C1DC0005; Mon, 29 Apr 2024 13:18:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arinc9.com; s=gm1; t=1714396691; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6WIxTn0pRjbZXHgFG8AwaR4joGVxkdi8wOuc1SO7gIs=; b=FGEd0IUVUimnHqEMC3oAwvto00HNVnMflL0L7Ph/Ryrk7N/JOd8t1z4bbBPy5b58KRO9k5 I3szYcCy8KVwRYHA1I6NfbF0HWGffDxy9+baoG19copWjA/jxRvbpIWFAaMDBDjyaWLWXk IKPn/HbPA4OqlW2+y/DGE85RCCMAklQrxnr+rWemcMa7T4IlOjaPDGsuV3y00M+UGoipOp Lsv/aCYhblt5FsBnUNpFA/1mLETUrUj0KaEnJ+E/2UYRMLXP3yc6HN0o0gYxq4oRf5EWh1 txO81TyFcNZxEJVl4hf3JCF+BaPQlmyEXsv00J6rxXu9sd40YeFXkPafTdvXzg== Message-ID: Date: Mon, 29 Apr 2024 16:17:40 +0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next] net: dsa: mt7530: detect PHY muxing when PHY is defined on switch MDIO bus To: "Russell King (Oracle)" Cc: Daniel Golle , 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 References: <20240429-b4-for-netnext-mt7530-use-switch-mdio-bus-for-phy-muxing-v1-1-1f775983e155@arinc9.com> Content-Language: en-US From: =?UTF-8?B?QXLEsW7DpyDDnE5BTA==?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-GND-Sasl: arinc.unal@arinc9.com On 29.04.2024 12:58, Russell King (Oracle) wrote: > On Mon, Apr 29, 2024 at 12:46:43PM +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 probed before the switch is >> initialised, in which case attaching the PHY will fail. >> >> 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 probed. > > Looking at the commit description and the patch, I'm not sure whether > you really mean "probed" or whether you mean "attached". > > PHY drivers will bind to PHY devices when they are detected on the MDIO > bus (either by scanning or instantiating firmware description) and the > devices are registered. As each device is registered, the drivers for > the bus type are scanned and any matches will have their probe function > called. This happens outside of any control of the DSA driver if the > DSA device is on the same MDIO bus. > > This is separate from the process of looking up a PHY and attaching the > PHY. > > So, I think there is probably a terminology issue with the patch > description. I suspect you don't mean "probing" as in phy_probe() being > called. Looking at the code, it looks like the driver is making > decisions based on how PHYs are connected to the ethernet MACs in the > device tree, and you're making decisions based on that. I wouldn't call > that "probing" a PHY. Yes, I meant to say "looking up a PHY and attaching the PHY" by probing a PHY. I'll adjust the patch log to below, thanks. 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. Arınç