Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4463203imw; Tue, 12 Jul 2022 08:20:53 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u8hhRc8F1s5rwp21obaAvzhdWxO+DSHsR6lPzIEL5gpRcocNaDYKk5cZv+dRJ1ksOQsQS3 X-Received: by 2002:a17:907:971a:b0:72b:6bab:abc2 with SMTP id jg26-20020a170907971a00b0072b6bababc2mr7398860ejc.551.1657639252888; Tue, 12 Jul 2022 08:20:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657639252; cv=none; d=google.com; s=arc-20160816; b=yTIPRSNFoiwna0kr7RiOG7Qicnrk1BG58/8MKRxgwX145uCVmR1IZV/ty4Mol+YMr/ NEsQkrUrae86HiIvaUd2JdSAwyyvX+l5T6fXa9TICDAcJchDWQC0S/gusGiPXGRmlSbS //HuXztejBen7p3DyrJccNKcuG6J3wBSqm9GNb8SV1IsHfqOQQlMrMQX3Hg730rajlPk y3Tbgw+3ybEZALQ5Av5W0mZmLtVduSXDN+rdG0Zyc2Q3oLb05wsLBU8sbjPS55rz3xvp un9rgfX+7H1gS9xqu6fNxqYLIclu3usRL2wfIFH8KZb5fcHND7HFsJNF4mA/uPnsj1mj rk9A== 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:dkim-signature; bh=TIMJuXXvaSY0EDiwuEYp7w+lzyifMk6auUfw6Pmy8H8=; b=LWY4ah0uCAQQsVpooT7i9NWr4x5IIWYt/AEMGmk/PG/y7ufGGHMLxL2YSu0M+r/YVy reygghl9OWhwXQM1maja7OZKt5llA99D7I5cHBUqNSdGhd5by186mRCvLlxDxZnvkLAA CyC7bOdtqTFsImIq2QNeXPM7zVj4CMkUTkL3JEYKiRjvmOLYnTlmzIC4oQqgRcIBwgke vcvOf+3/jHCvF+1cJotjji8RsOZ7hCIaSa5EltwZeSHyoPyW6FtjJh6MkceGNPBSItVd d9b6G5va6mmO2hj/pMoUc95PG05dU9vijFONR37YS69rBwKUjX5kyBIxF1dnnDfb+TFo vKag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=f5VgE4wD; 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 c6-20020a05640227c600b0043adeeba898si6761370ede.283.2022.07.12.08.20.28; Tue, 12 Jul 2022 08:20:52 -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=f5VgE4wD; 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 S232833AbiGLOo4 (ORCPT + 99 others); Tue, 12 Jul 2022 10:44:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233665AbiGLOom (ORCPT ); Tue, 12 Jul 2022 10:44:42 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B0E821E35; Tue, 12 Jul 2022 07:44:39 -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-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=TIMJuXXvaSY0EDiwuEYp7w+lzyifMk6auUfw6Pmy8H8=; b=f5VgE4wDv0lSQC5lTzqabKnVFB 2MGHWFSwP7P/40XxyUz26NovWdTh/lT2cUCI2TDwxXIOFpKmrZjyEk8viz7KfDHVlA8JUC0ZTuscZ dumqPhR//ME/UnijW00DpOQvNb6P0vH/GMuMygkcYT5BPY+TK8t5suvl4SjK8Q7k26y0=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1oBH7h-00A3p2-Tq; Tue, 12 Jul 2022 16:44:25 +0200 Date: Tue, 12 Jul 2022 16:44:25 +0200 From: Andrew Lunn To: Frank Cc: Peter Geis , Heiner Kallweit , Russell King , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , yinghong.zhang@motor-comm.com, fei.zhang@motor-comm.com, hua.sun@motor-comm.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] net: phy: Add driver for Motorcomm yt8521 gigabit ethernet Message-ID: References: <20220711103706.709-1-Frank.Sae@motor-comm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220711103706.709-1-Frank.Sae@motor-comm.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 Mon, Jul 11, 2022 at 06:37:06PM +0800, Frank wrote: > patch v3: > Hi Andrew > Thanks and based on your comments we modified the patch as below. > > > It is generally not that simple. Fibre, you probably want 1000BaseX, > > unless the fibre module is actually copper, and then you want > > SGMII. So you need something to talk to the fibre module and ask it > > what it is. That something is phylink. Phylink does not support both > > copper and fibre at the same time for one MAC. > > yes, you said it and for MAC, it does not support copper and Fiber at same time. > but from Physical Layer, you know, sometimes both Copper and Fiber cables are > connected. in this case, Phy driver should do arbitration and report to MAC > which media should be used and Link-up. > This is the reason that the driver has a "polling mode", and by default, also > this driver takes fiber as first priority which matches phy chip default behavior. The Marvell 10G driver is another PHY which can be used for both Copper and Fibre. In order to do this, it has a few extra functions: static int mv3310_sfp_insert(void *upstream, const struct sfp_eeprom_id *id) { struct phy_device *phydev = upstream; __ETHTOOL_DECLARE_LINK_MODE_MASK(support) = { 0, }; phy_interface_t iface; sfp_parse_support(phydev->sfp_bus, id, support); iface = sfp_select_interface(phydev->sfp_bus, support); if (iface != PHY_INTERFACE_MODE_10GBASER) { dev_err(&phydev->mdio.dev, "incompatible SFP module inserted\n"); return -EINVAL; } return 0; } static const struct sfp_upstream_ops mv3310_sfp_ops = { .attach = phy_sfp_attach, .detach = phy_sfp_detach, .module_insert = mv3310_sfp_insert, }; Also see the at803x driver. This allows the PHY to report to phylink what it is doing, and to determine the host side interface mode. I would expect this driver to implement sfp_upstream_ops as well. Andrew