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=-5.0 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,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 86889C64E7B for ; Thu, 19 Nov 2020 15:20:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 103F324698 for ; Thu, 19 Nov 2020 15:20:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="y4zHdu31" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728490AbgKSPTo (ORCPT ); Thu, 19 Nov 2020 10:19:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727841AbgKSPTn (ORCPT ); Thu, 19 Nov 2020 10:19:43 -0500 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A33BC0613CF for ; Thu, 19 Nov 2020 07:19:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: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=evUCZtbWLKka56eqLZxXmX6pOWLwrLuqPpZqQalVeJc=; b=y4zHdu31PYQjoAC+fxdVnuBNV 8ZmTPQw/qYFwOcZhdGTSXK6c6sLMo8U5J7ZQRHcoJejE9x9nVUbf5zHCjnt2wmajHSi7+qikmzkAP W87H2cwOAAoouKB/emedgPO61o43vkeB2l+Em+v6YDzdPfkrstELJX+eq8fWAs/t9+ixFuDyJcF37 l9BZLPnHclgKaOYGMf+uvxY37zgBC4BgUtAMSmBRdq6AP5R1baTBz5QVn3/LZnWhIp9Bm/MLLifSC 0ujR1P/Z2vHcqRgULjhGI9NP9J5SlCf69BFn3CAIHGZuLQadbSLku11CQ36RnHmSTS6p5BvP5GaRA o35RPPe0w==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:33440) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kflim-0002LU-DN; Thu, 19 Nov 2020 15:19:40 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1kflil-0002Dg-I3; Thu, 19 Nov 2020 15:19:39 +0000 Date: Thu, 19 Nov 2020 15:19:39 +0000 From: Russell King - ARM Linux admin To: Maxime Chevallier Cc: Andrew Lunn , Florian Fainelli , netdev@vger.kernel.org, Antoine Tenart , Vivien Didelot , Thomas Petazzoni , "David S. Miller" , linux-arm-kernel@lists.infradead.org, Heiner Kallweit Subject: Re: net: phy: Dealing with 88e1543 dual-port mode Message-ID: <20201119151939.GM1551@shell.armlinux.org.uk> References: <20201119152246.085514e1@bootlin.com> <20201119145500.GL1551@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201119145500.GL1551@shell.armlinux.org.uk> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: Russell King - ARM Linux admin Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Thu, Nov 19, 2020 at 02:55:00PM +0000, Russell King - ARM Linux admin wrote: > On Thu, Nov 19, 2020 at 03:22:46PM +0100, Maxime Chevallier wrote: > > Hello everyone, > > > > I'm reaching out to discuss an issue I'm currently having, while working > > on a Marvell 88E1543 PHY. > > > > This PHY is very similar to the 88E1545 we already support upstream, but > > with an added "dual-port mode" feature that I'm currently using in a > > project, and that might be interesting to have upstream. > > > > As a quick remainder, the 88E154x family are 4-ports PHYs that support > > Fiber (SFP) or RJ45 Copper interfaces on the media side, and QSGMII/SGMII > > on the host side. > > > > A datasheet for this PHY family can be found here [1] but unfortunately, > > this public datasheet doesn't explain the mode I'm going to discuss... > > > > The specificity of the 88E1543 is that is can be configured as a 2-port > > PHY, each port having the ability to have both a Copper RJ45 interface and > > a Fiber interface with automatic media detection, very much like the > > 88x3310 that we support, and that is used on the MacchiatoBin. > > > > This auto-media detection is the specific mode i'm interested in. > > > > The way this works is that the PHY is internally configured by chaining > > 2 internal PHYs back to back. One PHY deals with the Host interface and > > is configured as an SGMII to QSGMII converter (the QSGMII is only used > > from within the PHY), and the other PHY acts as the Media-side PHY, > > configured in QSGMII to auto-media (RJ45 or Fiber (SFP)) : > > > > +- 88e1543 -----------------------+ > > +-----+ | +--------+ +--------+ | /-- Copper (RJ45) > > | |--SGMII----| Port 0 |--QSGMII--| Port 1 |----< > > | | | +--------+ +--------+ | \--- Fiber > > | MAC | | | > > | | | +--------+ +--------+ | /-- Copper (RJ45) > > | |--SGMII----| Port 2 |--QSGMII--| Port 3 |----< > > +-----+ | +--------+ +--------+ | \-- Fiber > > +---------------------------------+ > > Yes, this is somewhat like the 88x3310 - the 88x3310 PHY is actually a > collection of different PHY blocks integrated together, with a chunk of > firmware controlling the whole thing, enabling the appropriate PHY > blocks and routing the data paths amongst them as required. > > With the 88x3310, we don't care very much about the MAC-facing blocks > (PHYXS in Clause 45 terminology). We certainly do not check the PHYXS > for link before reporting that the PHY as a whole has link - this is > actually very important, since with the 88x3310, we have to report to > the MAC that the link is up so the MAC can configure its PHY facing > interface correctly before that part of the link will come up. > > Also, if we look at 88e1512 when used in SGMII to copper mode, this > PHY re-uses its fiber side for the MAC facing SGMII interface, so can > be regarded similar to your above diagram. > > So, a question for you: does the above setup for ports 0 and 2 require > any software configuration of the PHY, or is that all achieved by > hardware strapping the PHY for the appropriate mode? > > If it's all done by hardware strapping with no software configuration > requirement for ports 0 and 2, I would suggest that we ignore the > complexities here, and just represent ports 1 and 3 as normal, as a > SGMII-to-{copper,fibre}. > > If we were to let phylib to drive ports 0 and 2 as well, we're going > to introduce a whole raft of entirely new problems. phylib is only > really designed for the last-step media facing PHY. > > > I have two main concerns about how to deal with that (if we are interested > > in having such a support upstream at all). > > > > The first one, is how to represent that in the DT. > > > > One approach could be to really represents what's going on, by representing > > the 2 PHYs chained together. In this case, only the MAC-facing PHY > > will report the link state, so we are basically representing the internal > > wiring of the PHY, can we consider that as a description of the hardware ? > > > > Besides that, I don't think that today, we are able to represent link > > composed of multiple PHYs daisy-chained together, but this is something > > that we might want to support one day, since it could benefit other types > > of use-cases. > > > > Another approach could be to pretend the 88E1543 is a 2-port SGMII to > > Auto-media PHY. This is also a bit tricky, since we need a way to detect > > that we want the whole 4-ports PHY to act as a 2-port PHY. (or 3-port, if > > we only want to use one pair of ports in that mode, and the other ports > > as SGMII - Copper or SGMII - Fiber PHYs). > > Aren't each of the four ports at a different MDIO address, which means > each has to be described separately? > > > The second concern I have is that all of this is made even harder by the > > fact that this 88E1543 PHY seems indistinguishable from the 88E1545 by > > reading the PHY ID, they both report 0x01410eaX :/ I guess we would also > > need some DT indication that we are in fact dealing with a 88E1543. Note that it'll need slightly different initialisation paths, separate from the 88E151x. If we're in PHY_INTERFACE_MODE_SGMII, we don't look at the fiber page (for the reason I mentioned above - it's re-used for the MAC facing side of the PHY.) Also, yes, I realise that this doesn't conform to "DT describes the hardware". It's a question of how detailed a description we actually need. DT is not a schematic tool - it hasn't ever been used to describe everything at the hardware. It is a software representation of the hardware components in the system needed to be driven by software. If a component does not need to be driven by software, arguably it doesn't need to be mentioned in the DT description of the hardware. Consider a PCI(e) card. It's treated as a black hardware box as far as firmware descriptions go, even if we know the hardware consists of an Ethernet device and a separate PHY. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!