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 X-Spam-Level: X-Spam-Status: No, score=-2.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0383EC2D0C5 for ; Tue, 17 Dec 2019 08:44:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CE567207FF for ; Tue, 17 Dec 2019 08:44:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="FniXI4tR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726690AbfLQIo1 (ORCPT ); Tue, 17 Dec 2019 03:44:27 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:56712 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725893AbfLQIo1 (ORCPT ); Tue, 17 Dec 2019 03:44:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=lM97wh2yMUbIcDn5kzF0SHEiJXh+HNYHQbKcDQfi62M=; b=FniXI4tRdy0k0FLN9WIY2BpkQn y278yFM8/+GXlThcYKNcg5GtJIdTpg1IFj5IxtBIT9BZxTDahYF6xZTmZ2QoBZRyfXvEQA7HBW9wK HooSz8mnch7NIpu0xWd5zDWefDWJmYklI0S+i1pOgGsEbIS+sFd2bQ63hJp1k9Phm708=; Received: from andrew by vps0.lunn.ch with local (Exim 4.92.2) (envelope-from ) id 1ih8Si-00023F-RF; Tue, 17 Dec 2019 09:44:12 +0100 Date: Tue, 17 Dec 2019 09:44:12 +0100 From: Andrew Lunn To: Oleksij Rempel Cc: Mark Rutland , devicetree@vger.kernel.org, Jay Cliburn , Florian Fainelli , Chris Snook , linux-kernel@vger.kernel.org, Ralf Baechle , "David S. Miller" , Paul Burton , Rob Herring , Pengutronix Kernel Team , James Hogan , Russell King , netdev@vger.kernel.org, linux-mips@vger.kernel.org, Vivien Didelot Subject: Re: [PATCH v4 2/5] dt-bindings: net: dsa: qca,ar9331 switch documentation Message-ID: <20191217084412.GB6994@lunn.ch> References: <20191022055743.6832-1-o.rempel@pengutronix.de> <20191022055743.6832-3-o.rempel@pengutronix.de> <20191023003543.GE5707@lunn.ch> <20191029073419.gjr4y7qsxx2javuf@pengutronix.de> <20191215145714.i22b5ndusnxo2rxy@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191215145714.i22b5ndusnxo2rxy@pengutronix.de> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org > I spend some tine on investigating and testing it. So, the result is > pretty simple. It looks like *MII lines of ethernet controller GMAC0 and > MAC of switch port5 are just connected together and wired to the PHY4. > Something like this: > > GMAC1-->switch--mac5-+--->phy4 > ^ > GMAC0---------------/ > > > So, both of MACs can be enabled at same time and introduce resource > conflict. If one is enabled, other one should be set in to reset mode. > > The questions are: > - how this can be reflected in devicetree? > - how this can be properly implemented in kernel? That is, er, interesting. So in device tree, i would use a phy-handle in GMAC1 or GMAC0 to point to phy4. I don't think there is anything you can do in DT to prevent both GMAC0 and GMAC1 having a phandle to phy4, other than adding a comment in the binding. You could ask Rob if DT schema provides any sorts of checks like this? But i doubt it. In the driver, it would be good to check if two MACs try to connect to one PHY. This in general should not happen, so maybe you can add a check to the core, in phylib and/or phylink. Just watch out for cpsw. It connects two PHYs to one MAC. Just don't make the assumption one MAC and one PHY is correct, everything else is wrong. Andrew