Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp922270pxu; Fri, 23 Oct 2020 17:29:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz60bVhxxBiObFX8GVvk77dlsuPm7m8CMAy8c/6QcFeSAxx8Zz0MpvJyEl36c+3YpS9wVme X-Received: by 2002:a17:906:68c4:: with SMTP id y4mr4682376ejr.197.1603499363730; Fri, 23 Oct 2020 17:29:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603499363; cv=none; d=google.com; s=arc-20160816; b=kxJ1Orra9BlWOZlNOFrE3XtlUgrfHkDQBFnSvd8iNyePwqupfOoKUvbhKXJqXzZj9Z KN6XUkMpMBR0u/UlOA1ojT06+v8BlKPXbB0MsyhuFoxwjGzj6M7krP/Ht7km1kMP17/7 QchU5AvgYCHr2zVi1GFjPzvtD4sAtPBVs2LmCPI6u4dJmBxSO5iPE7kDD5JO9nCDdVN3 areewEd1QgrdQTGitQPLKyOc3tPQFxom0xaLCtzzOU6CyRzwSQ7zxGhMhkaEGEB2veTF WGd4f4Ry/WsFIMZdMYDbJIHCpzn9LRp7l+quWYlFAcGKFMkaJIkq/TX0oE2JTvJNROLq FR/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=a+ovCR1yy/EToEvr0Qlr+Wqhb5g8AAw4FBll4FjPygY=; b=qdedbpR4ZLjgaNRE+UmGyFzbZiBWKWMXXzwslbMaNrSnmAz4RG29IhohbliTgimKhY 0ngKGB2kDlBiF+RlhJoxK1uwOeChv36Z6A+UyyEtg4g3gvua9r/+qKWy0uWU2T3wCYrd JvBXE0yYa0h1El0GtTqa+CO2jy5f+tF3ud+TFDtHrdEfkbWUkW61a8rShZyWDV3L6KgM l4aEEECcE9ssQSeNVrz4ovbsau/i8hwMKZFE492ks0YEYQuXDLUTuczWVubdxB29B+QH C3q4Vnge7CcMAk3KBeJr//PQ3WpI12Mo4MKS+8GRqX4olwQWsFPxykAAvM02dgvinwEz ZKzQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o6si2743864edi.562.2020.10.23.17.29.01; Fri, 23 Oct 2020 17:29:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756442AbgJWUxr (ORCPT + 99 others); Fri, 23 Oct 2020 16:53:47 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:42390 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756428AbgJWUxr (ORCPT ); Fri, 23 Oct 2020 16:53:47 -0400 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1kW448-003Awl-Nh; Fri, 23 Oct 2020 22:53:36 +0200 Date: Fri, 23 Oct 2020 22:53:36 +0200 From: Andrew Lunn To: Oleksij Rempel Cc: "David S. Miller" , Florian Fainelli , Heiner Kallweit , Jakub Kicinski , Oliver Hartkopp , David Jander , kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Russell King , mkl@pengutronix.de, Marek Vasut , linux-can@vger.kernel.org Subject: Re: [RFC PATCH v1 1/6] net: phy: add CAN PHY Virtual Bus Message-ID: <20201023205336.GF752111@lunn.ch> References: <20201023105626.6534-1-o.rempel@pengutronix.de> <20201023105626.6534-2-o.rempel@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201023105626.6534-2-o.rempel@pengutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 23, 2020 at 12:56:21PM +0200, Oleksij Rempel wrote: > Most of CAN PHYs (transceivers) are not attached to any data bus, so we > are not able to communicate with them. For this case, we introduce a CAN > specific virtual bus to make use of existing PHY framework. I don't think you are making the best use of the phylib framework. MDIO busses can be standalone devices, with their own DT nodes. And that device node can list the PHY devices on the bus. can_mdio { compatible = "virtual,mdio-virtual"; #address-cells = <1>; #size-cells = <0>; canphy0: can-phy@0 { compatible = "can,generic-transceiver", reg = <0>; } canphy1: can-phy@1 compatible = "nxp,tja1051", reg = <1> } } When you call of_mdiobus_register(fmb->mii_bus, np) it will parse this tree and should create PHY devices for them, and since your PHY driver has a match function, it should then bind the correct PHY driver. Your 'MAC' driver then uses phy-handle as normal to point to the PHY. There is also some interesting overlap here with what Intel posted recently: https://www.spinics.net/lists/kernel/msg3706164.html I'm not sure anything can be shared here, but it is worth looking at and thinking about. Andrew