From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69FAFC6FA82 for ; Thu, 15 Sep 2022 02:38:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230229AbiIOCi4 (ORCPT ); Wed, 14 Sep 2022 22:38:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229685AbiIOCix (ORCPT ); Wed, 14 Sep 2022 22:38:53 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2471286B7C; Wed, 14 Sep 2022 19:38:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Transfer-Encoding:Content-Disposition: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:From: Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Content-Disposition: In-Reply-To:References; bh=Ne9cM+YswsLwN2sAUxB058oBiWyLOnEeEdaac2OhME0=; b=Lc oA3YdAA+Nf2G+MvvFRbZfD9HVBUvaIuUPRfzo1Nhy/7lv5nb7OcEC1StLRYaBAt3+phKAv+q4KB90 xwXirbuxfyfEOfL/8JBkT+ZlUxjCfcQBatVtR4EiY8jmcg09CfL7w8s3/Zt4yD4lwSn7C/d5Qp2ZK 4gJU7QZNKkqc2q4=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1oYelt-00Glyc-QH; Thu, 15 Sep 2022 04:38:33 +0200 Date: Thu, 15 Sep 2022 04:38:33 +0200 From: Andrew Lunn To: =?utf-8?B?QXLEsW7DpyDDnE5BTA==?= Cc: netdev , Linux ARM , "moderated list:ARM/Mediatek SoC support" , linux-kernel , Thibaut , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Sean Wang , Landen Chao , DENG Qingfang , Vivien Didelot , Florian Fainelli , Vladimir Oltean , Matthias Brugger , Philipp Zabel , Sergio Paracuellos Subject: Re: Move MT7530 phy muxing from DSA to PHY driver Message-ID: References: <0e3ca573-2190-57b0-0e98-7f5b890d328e@arinc9.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <0e3ca573-2190-57b0-0e98-7f5b890d328e@arinc9.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 15, 2022 at 01:07:13AM +0300, Arınç ÜNAL wrote: > Hello folks. > > MediaTek MT7530 switch has got 5 phys and 7 gmacs. gmac5 and gmac6 are > treated as CPU ports. > > This switch has got a feature which phy0 or phy4 can be muxed to gmac5 of > the switch. This allows an ethernet mac connected to gmac5 to directly > connect to the phy. > > PHY muxing works by looking for the compatible string "mediatek,eth-mac" > then the mac address to find the gmac1 node. Then, it checks the mdio > address on the node which "phy-handle" on the gmac1 node points to. If the > mdio address is 0, phy0 is muxed to gmac5 of the switch. If it's 4, phy4 is > muxed. > > https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/drivers/net/dsa/mt7530.c?id=1f9a6abecf538cc73635f6082677a2f4dc9c89a4#n2238 > > Because that DSA probes the switch before muxing the phy, this won't work on > devices which only use a single switch phy because probing will fail. > > I'd like this operation to be done from the MediaTek Gigabit PHY driver > instead. The motives for this change are that we solve the behaviour above, > liberate the need to use DSA for this operation and get rid of the DSA > overhead. > > Would a change like this make sense and be accepted into netdev? Where in the address range is the mux register? Officially, PHY drivers only have access to PHY registers, via MDIO. If the mux register is in the switch address space, it would be better if the switch did the mux configuration. An alternative might be to represent the mux in DT somewhere, and have a mux driver. Andrew From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AD0C0ECAAD8 for ; Thu, 15 Sep 2022 02:40:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To: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-Owner; bh=lgxuNqGFwQDTzRZyaV9g9/tabreu8mz/oyRuceJd9I4=; b=pLqfcbAL0jfMra 18GgFTxtafAGRsfh6y9a9woML0rB07+gBtrg61xBtrWcuR96CYW97cha1IOgLkhZpfutCoKxDZlRT /zF7UWcidXQiSXihi3lOedSzIhmkbQPCQq13EcOBp8bBW9lqBekRBqiiuir7CVqCFpdRAWWTgd9fR akCrWivJC/IemWzLZxvBe8SZiKbmGb341w09IGMTtFN1NKx5SYEJEnBLebH6Wlggx4w2A1HURhVpY R5WB80W+2Mc7VQJ9TRSiw4G5osKD+OCTxn/AC6DYIv2YGALKTMdUzVOJBXnc/oAWq+qhdvcVJy7bc aewHTMwz2HkHCVNrzSgg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oYem8-00FnA2-Ob; Thu, 15 Sep 2022 02:38:48 +0000 Received: from vps0.lunn.ch ([185.16.172.187]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oYem4-00Fn6p-SU; Thu, 15 Sep 2022 02:38:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Transfer-Encoding:Content-Disposition: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:From: Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Content-Disposition: In-Reply-To:References; bh=Ne9cM+YswsLwN2sAUxB058oBiWyLOnEeEdaac2OhME0=; b=Lc oA3YdAA+Nf2G+MvvFRbZfD9HVBUvaIuUPRfzo1Nhy/7lv5nb7OcEC1StLRYaBAt3+phKAv+q4KB90 xwXirbuxfyfEOfL/8JBkT+ZlUxjCfcQBatVtR4EiY8jmcg09CfL7w8s3/Zt4yD4lwSn7C/d5Qp2ZK 4gJU7QZNKkqc2q4=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1oYelt-00Glyc-QH; Thu, 15 Sep 2022 04:38:33 +0200 Date: Thu, 15 Sep 2022 04:38:33 +0200 From: Andrew Lunn To: =?utf-8?B?QXLEsW7DpyDDnE5BTA==?= Cc: netdev , Linux ARM , "moderated list:ARM/Mediatek SoC support" , linux-kernel , Thibaut , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Sean Wang , Landen Chao , DENG Qingfang , Vivien Didelot , Florian Fainelli , Vladimir Oltean , Matthias Brugger , Philipp Zabel , Sergio Paracuellos Subject: Re: Move MT7530 phy muxing from DSA to PHY driver Message-ID: References: <0e3ca573-2190-57b0-0e98-7f5b890d328e@arinc9.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <0e3ca573-2190-57b0-0e98-7f5b890d328e@arinc9.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220914_193844_959962_7963BE44 X-CRM114-Status: GOOD ( 19.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org T24gVGh1LCBTZXAgMTUsIDIwMjIgYXQgMDE6MDc6MTNBTSArMDMwMCwgQXLEsW7DpyDDnE5BTCB3 cm90ZToKPiBIZWxsbyBmb2xrcy4KPiAKPiBNZWRpYVRlayBNVDc1MzAgc3dpdGNoIGhhcyBnb3Qg NSBwaHlzIGFuZCA3IGdtYWNzLiBnbWFjNSBhbmQgZ21hYzYgYXJlCj4gdHJlYXRlZCBhcyBDUFUg cG9ydHMuCj4gCj4gVGhpcyBzd2l0Y2ggaGFzIGdvdCBhIGZlYXR1cmUgd2hpY2ggcGh5MCBvciBw aHk0IGNhbiBiZSBtdXhlZCB0byBnbWFjNSBvZgo+IHRoZSBzd2l0Y2guIFRoaXMgYWxsb3dzIGFu IGV0aGVybmV0IG1hYyBjb25uZWN0ZWQgdG8gZ21hYzUgdG8gZGlyZWN0bHkKPiBjb25uZWN0IHRv IHRoZSBwaHkuCj4gCj4gUEhZIG11eGluZyB3b3JrcyBieSBsb29raW5nIGZvciB0aGUgY29tcGF0 aWJsZSBzdHJpbmcgIm1lZGlhdGVrLGV0aC1tYWMiCj4gdGhlbiB0aGUgbWFjIGFkZHJlc3MgdG8g ZmluZCB0aGUgZ21hYzEgbm9kZS4gVGhlbiwgaXQgY2hlY2tzIHRoZSBtZGlvCj4gYWRkcmVzcyBv biB0aGUgbm9kZSB3aGljaCAicGh5LWhhbmRsZSIgb24gdGhlIGdtYWMxIG5vZGUgcG9pbnRzIHRv LiBJ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