Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp239697rwn; Wed, 14 Sep 2022 19:57:24 -0700 (PDT) X-Google-Smtp-Source: AA6agR5CMw0YbbXe30lt/yEsABzzGMG2TwahRbs0pYJb83erPOB+hBx2dmfh1p34EHDR6oIN+t7M X-Received: by 2002:a17:906:fd86:b0:777:d739:1ede with SMTP id xa6-20020a170906fd8600b00777d7391edemr21769555ejb.576.1663210644325; Wed, 14 Sep 2022 19:57:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663210644; cv=none; d=google.com; s=arc-20160816; b=ct1WsRmUeCzOGniK4cWJHtN3QFbO4Nq2dfIlm2Qq4L3X1XAYRQBzRLLng1NMDwz1AZ R7AC1g1XPBlqXGSpTbqS01kY3Tg5XuV1UsUEQEXk9ilsclcYELp6csyUmQODZxEzkznY BeWeL4PCIOhoWv2N+/flK1bJ3SWOpeiuncJJtUMYDJMQSsmbH3KbVlinO0illRecnUTT 9Y04y3c1gIBHL9zk/SQb2xg5YqroniHoEIoDSLVtGt+YSK79vQH2vo+vXWoPm2MJYZdn WKvL+MqKomHEY+wOba+t/FdQhtF43HGjxK0F+LygS8ZBg9vjJvAetq2d2YZlImtKPPnT kEvA== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Ne9cM+YswsLwN2sAUxB058oBiWyLOnEeEdaac2OhME0=; b=W7j3kcporFsSqW66889ZwSZk+ZxrS30IOSa/Dd/B4iSCniEJvWd8pZTD8HVuhAJAUP uCSl0jRGHu7QQWMuJomeL1sHBCcbYcYVD4zhvnFGX4tATqJcQTqagn28Dw0L9ivpnVTF pURR0NPzckejArN2YDyRip4u1LaIkpMgzTkWmX4gRez2VcN604lF7dLz3qy5d9fN85Fz O5WBFv9ERlN99SMVW6okKklnFtd3kwNF8VQyryagM1nyJo5HxflNMLTyzLE5oBXLXgLB AhMtKPBMBtJL0DF3rJuwv69jDHURM1cg0xNtc5km6LJLWegwdWBWL5v8yle2/8GIbdC4 uHmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=LcoA3YdA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h6-20020a0564020e8600b00451627edb0asi1749306eda.268.2022.09.14.19.56.59; Wed, 14 Sep 2022 19:57:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=LcoA3YdA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229950AbiIOCi4 (ORCPT + 99 others); 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> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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