From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3E6A2DCBE3; Fri, 30 May 2025 23:56:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748649389; cv=none; b=t7ya3W3YrPg1Q9xrWknUOmEhkDeu7Q3RFmw5gBKcT3iOf7aVIkeKnVTkxBq4gMGFnnap2aYDboNPAVvZuHOHG5FH2qI6e71XxGIrjjyd2TjeErj7xo3S4cWTK2L7u/t4tT35gzfhnp0CVvek12HIYs6/iyz45DUBKcxKhhRlFlI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748649389; c=relaxed/simple; bh=KGsR6nTFKeHBuWscM0ej+HFNJljhuHIx/bH0e5Ph4zc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=EzLaFj08bKefGXCTEEWeueeSC+o+vk9em8OGOhJ7Wk4ZopmYWCOQLiyxGIWqpj3S3s5pIPN0x+IxuuM194/BT1tnwY3LtPe6XEieMJmufGT5uOA0vZXOOUqEQWvKWdTOhwQZBLwT4hfsyjuOkcKlstD7ecYpiFTkUCw3+Mc0tRs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Xj5YOuXK; arc=none smtp.client-ip=209.85.210.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Xj5YOuXK" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-742af848148so1701569b3a.1; Fri, 30 May 2025 16:56:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1748649387; x=1749254187; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=UbCZyIkZ0m1blK4VZNRnnH4emBisfG3c94TVO1BUVgg=; b=Xj5YOuXKVzAZmQG00s00vKesxdhpuYqd1PerOvQQw0XuMKPau5I5T94qukB4ynMjXY jPIcEuXyqUzVGQeOGYS3zzvoLsbUCqV8CSAdEllEwCVi56/BacwBFN4S1+yO2uhkz3aw XNdvOoPASGZKXcBCkq1i3copbZ/ThJYKogBHpPP4BSRnvl3ZzXbSJtvHdBLC4O/ODJr4 o7J4oJaOl1wyVy4GlgRdddElnNmpWSn2YULPMMbSPhh4OZEfZbetsL7aDJ+bx+ksoM71 ejJXPOd+LTlPqhj54mlxZRLYeg20x3VBeKJYc8+4mHrhE4XJl5QXuXy8xitCMPe7333g gTpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748649387; x=1749254187; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=UbCZyIkZ0m1blK4VZNRnnH4emBisfG3c94TVO1BUVgg=; b=obupIyCwqqkl1qNp9KlOOgPzfozP3fSN69gYmEmbZLZ84hMGPy9UAEUCGAgVKW7mN1 JNsMlKXyrb62LQOCoI5mWQPOrzukrw+FA/+nZ/QDm/WhjLuJIMytU97CdrGHMm+3sIVd cudygWxmnCL357WZVHePwgrtI2HfOPjj+j7Juukx4tWf42Ro816TpXhCuHlyCJIzJRM7 CLCw2FS/2ac4dKW8QFDG4ktUJm6+e5jv5ddYMaX+ikWXAOu80AjLj7Yec78PJI0Z9CAo dUBjcvZGUeGsI7wu1IB0KZJJrTiNJfMr5k168UhvH5taMUPeqrEAfouHRNuoZ5A8zGLD Wjdw== X-Forwarded-Encrypted: i=1; AJvYcCW4IR4oWIQt8mRkQZhaUBQ09WWmQOFjrp7W3imSygrcaOMga6KMPI6+30X2YrNs4KDny2Vrt2HVDlVv2K8=@vger.kernel.org X-Gm-Message-State: AOJu0YzQ5NA5QyLFLb+qE7ChRKEQg12eYtcAlcJ1GykbyzGmNhAWkmxs YW8mOzIFgTF6Iuo7NQt8s6gcFtDrlV0pwvXHinU6OmHpxpxIhAovhWYC X-Gm-Gg: ASbGnctnGJNCMrBvO+PhdsQyBAPeFOiWGVw+aFkYNmAmJcfaPcjHINOxN83PS9HSiEo VuJad9zPCgd8QE9lm0Z667nXR/EZneTvwYHTHkbImgw6t7zkMvQVcG9O/KQYIRfnB+MQTf68HKo 19yNFKXTmav7N/kOza26oM4TuJd4jW0+t9STKPeixVrdP0ENTh6W/MdVotdMjxqWfCqoOAhBUhQ wEuqYvImrVIFYQldYViEi9/xqNcSb6qrMH7YBESckMep2D94/hq3tQV9uI+V/moDP+6n7P/clD6 vy9jyu45SxRMBebbVsFLtWfpDMAKOJKMXjdqz57aqXKI1GN9raaU0a++w1cg73xfyF1r7ZoZHf3 yCaM= X-Google-Smtp-Source: AGHT+IFu4j52ek9ISddZry4BH1QLbrMR9o7ktMi7lXXMpOaUy7V4nO7Soh+iiNBWYpP530mVx7wSRA== X-Received: by 2002:a05:6a00:189c:b0:742:a77b:8c4 with SMTP id d2e1a72fcca58-747d181cb44mr632022b3a.3.1748649387295; Fri, 30 May 2025 16:56:27 -0700 (PDT) Received: from [10.67.48.245] ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-747afff723csm3581125b3a.164.2025.05.30.16.56.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 30 May 2025 16:56:26 -0700 (PDT) Message-ID: Date: Fri, 30 May 2025 16:56:22 -0700 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/3] net: stmmac: allow drivers to explicitly select PHY device To: James Hilliard , Andrew Lunn Cc: netdev@vger.kernel.org, linux-sunxi@lists.linux.dev, Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Alexandre Torgue , Russell King , "Russell King (Oracle)" , Furong Xu <0x1207@gmail.com>, Kunihiko Hayashi , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20250527175558.2738342-1-james.hilliard1@gmail.com> <631ed4fe-f28a-443b-922b-7f41c20f31f3@lunn.ch> Content-Language: en-US From: Florian Fainelli Autocrypt: addr=f.fainelli@gmail.com; keydata= xsDiBEjPuBIRBACW9MxSJU9fvEOCTnRNqG/13rAGsj+vJqontvoDSNxRgmafP8d3nesnqPyR xGlkaOSDuu09rxuW+69Y2f1TzjFuGpBk4ysWOR85O2Nx8AJ6fYGCoeTbovrNlGT1M9obSFGQ X3IzRnWoqlfudjTO5TKoqkbOgpYqIo5n1QbEjCCwCwCg3DOH/4ug2AUUlcIT9/l3pGvoRJ0E AICDzi3l7pmC5IWn2n1mvP5247urtHFs/uusE827DDj3K8Upn2vYiOFMBhGsxAk6YKV6IP0d ZdWX6fqkJJlu9cSDvWtO1hXeHIfQIE/xcqvlRH783KrihLcsmnBqOiS6rJDO2x1eAgC8meAX SAgsrBhcgGl2Rl5gh/jkeA5ykwbxA/9u1eEuL70Qzt5APJmqVXR+kWvrqdBVPoUNy/tQ8mYc nzJJ63ng3tHhnwHXZOu8hL4nqwlYHRa9eeglXYhBqja4ZvIvCEqSmEukfivk+DlI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cOkbZ9BPJPNCbqU6dowLOiy8AuTYQ48m vIyQ4Ijnb6GTrtxIUDQeOBNuQC/gyyx3nbL/lVlHbxr4tb6YkhkO6shjXhQh7nQb33FjGO4P WU11Nr9i/qoV8QCo12MQEo244RRA6VMud06y/E449rWZFSTwGqb0FS0seTcYNvxt8PB2izX+ HZA8SL54j479ubxhfuoTu5nXdtFYFj5Lj5x34LKPx7MpgAmj0H7SDhpFWF2FzcC1bjiW9mjW HaKaX23Awt97AqQZXegbfkJwX2Y53ufq8Np3e1542lh3/mpiGSilCsaTahEGrHK+lIusl6mz Joil+u3k01ofvJMK0ZdzGUZ/aPMZ16LofjFA+MNxWrZFrkYmiGdv+LG45zSlZyIvzSiG2lKy kuVag+IijCIom78P9jRtB1q1Q5lwZp2TLAJlz92DmFwBg1hyFzwDADjZ2nrDxKUiybXIgZp9 aU2d++ptEGCVJOfEW4qpWCCLPbOT7XBr+g/4H3qWbs3j/cDDq7LuVYIe+wchy/iXEJaQVeTC y5arMQorqTFWlEOgRA8OP47L9knl9i4xuR0euV6DChDrguup2aJVU8JPBBgRAgAPAhsMBQJn uAtCBQkxtc7uAAoJEGFXmRW1Y3YOJHUAoLuIJDcJtl7ZksBQa+n2T7T5zXoZAJ9EnFa2JZh7 WlfRzlpjIPmdjgoicA== In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 5/30/25 16:46, James Hilliard wrote: > On Tue, May 27, 2025 at 2:02 PM Andrew Lunn wrote: >> >> On Tue, May 27, 2025 at 01:21:21PM -0600, James Hilliard wrote: >>> On Tue, May 27, 2025 at 1:14 PM Andrew Lunn wrote: >>>> >>>> On Tue, May 27, 2025 at 11:55:54AM -0600, James Hilliard wrote: >>>>> Some devices like the Allwinner H616 need the ability to select a phy >>>>> in cases where multiple PHY's may be present in a device tree due to >>>>> needing the ability to support multiple SoC variants with runtime >>>>> PHY selection. >>>> >>>> I'm not convinced about this yet. As far as i see, it is different >>>> variants of the H616. They should have different compatibles, since >>>> they are not actually compatible, and you should have different DT >>>> descriptions. So you don't need runtime PHY selection. >>> >>> Different compatibles for what specifically? I mean the PHY compatibles >>> are just the generic "ethernet-phy-ieee802.3-c22" compatibles. >> >> You at least have a different MTD devices, exporting different >> clocks/PWM/Reset controllers. That should have different compatibles, >> since they are not compatible. You then need phandles to these >> different clocks/PWM/Reset controllers, and for one of the PHYs you >> need a phandle to the I2C bus, so the PHY driver can do the >> initialisation. So i think in the end you know what PHY you have on >> the board, so there is no need to do runtime detection. > > Hmm, thinking about this again, maybe it makes sense to just > do the runtime detection in the MFD driver entirely, as it turns > out the AC300 initialization sequence is largely a subset of the > AC200 initialization sequence(AC300 would just not need any > i2c part of the initialization sequence). So if we use the same > MFD driver which internally does autodetection then we can > avoid the need for selecting separate PHY's entirely. This at > least is largely how the vendor BSP driver works at the moment. > > Would this approach make sense? This has likely been discussed, but cannot you move the guts of patch #2 into u-boot or the boot loader being used and have it patch the PHY Device Tree node's "reg" property accordingly before handing out the DTB to the kernel? Another way to address what you want to do is to remove the "reg" property from the Ethernet PHY node and just let of_mdiobus_register() automatically scan, you have the advantage of having the addresses consecutive so this won't dramatically increase the boot time... I do that on the boards I suppose that have a removable mezzanine card that includes a PHY address whose address is dictated by straps so we don't want to guess, we let the kernel auto detect instead. -- Florian