Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp1466825imn; Sun, 31 Jul 2022 08:05:23 -0700 (PDT) X-Google-Smtp-Source: AA6agR5rYimZb/OFkgjTEDt3BZqHcjZ4tF+onGUIdb63UOBPRa7eK4cb9AP+YM9bffeji5sR5wEi X-Received: by 2002:a17:90b:3892:b0:1f2:e0a5:8a56 with SMTP id mu18-20020a17090b389200b001f2e0a58a56mr15112288pjb.9.1659279923053; Sun, 31 Jul 2022 08:05:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659279923; cv=none; d=google.com; s=arc-20160816; b=J94nokuOGo4wndo1FisAlGfw3I0t8wu7jzm+vA8FeLOjDWs+AjIVuceiw/rGKjXrHf 5IgQBcoCosGLjqu/uQx9hXBIIQDedDcTDSg4JdwL0MXKPM/gUujPXeIthNoDwJOuKDRP v3GvpCpp5GDe0tqVPakZlOdkECiAHxpP4TLH6HlXHWTc8uKHeU6MkaQzZF39ILM1WVd/ kOeFJJoWhYPJTW4k2MmhSyJxKJR2dAToKuk3hQe0RA8Mt9UnizzNSZC8qmkUEp1UZnzr QSSR4gCGpz5K0eFz4MJY9g6hDpBxIDDDYaBRZu7mv8gdnaMjNQCf29I/dRa+aCExwB7M zGzw== 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=tC9r4oVZgcMaGiiUSFNsXQd1XmrYl3tfqTOi1U1v8R8=; b=nAqzhYvnnIJ3+2NCYSQKUv5jcTmffmdBXc4Hd+oBQiIE6avVeCfbOz7QO+wJCbYW40 VZyORpt/U2Y28eUm3KzYqz++kOl7oRBy91YfNYmYxdaW9JfRIn6fjjmmVrbDBIGHwyUP TACZHEOnL7qJd9cWDng2drkKH9ZuHK9w7FanuLFH34F8XhsFWk5Yf4WqoRDIBjCCdqiw ijWEeO/ryvpj3cLbvj9cqTU17EL4DaknTNs3NERHJ82SfwqOS0wF1Ek6u7TGqlk26FFk mJow0ear/6m9E0fyEr6A9CWdwifbAHAqj4NorXzvgd9sYfQ3FpOSaP9VNEiboRZLo02D hW8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=Sfk7rQDk; 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 i10-20020a63e44a000000b00419cdf7b71bsi9916008pgk.312.2022.07.31.08.05.05; Sun, 31 Jul 2022 08:05:23 -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=Sfk7rQDk; 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 S236819AbiGaObR (ORCPT + 99 others); Sun, 31 Jul 2022 10:31:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229639AbiGaObQ (ORCPT ); Sun, 31 Jul 2022 10:31:16 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AF4765FB; Sun, 31 Jul 2022 07:31:12 -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=tC9r4oVZgcMaGiiUSFNsXQd1XmrYl3tfqTOi1U1v8R8=; b=Sfk7rQDkt5zbohJXnWs0UeLejw 0DnLZYTf+/12xv6rYD9jl9RlV5VLLLP7oO3jn7ZFCXms6d3U8kIrPXkdYpIsRxSn3iPDug5zKptS0 QQVzx5BBEz5YCBBYIsmz7XaEF0fuMb4+1P+u4jSBodfmlGI2IFXihgpDiBmhEEk/VCgw=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1oI9xq-00C5Ym-Mx; Sun, 31 Jul 2022 16:30:42 +0200 Date: Sun, 31 Jul 2022 16:30:42 +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 v4] net: phy: Add driver for Motorcomm yt8521 gigabit ethernet Message-ID: References: <20220727070827.1162-1-Frank.Sae@motor-comm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220727070827.1162-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 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 Wed, Jul 27, 2022 at 03:08:27PM +0800, Frank wrote: > patch v4: > Hi Andrew,Jakub > Thanks very much and based on your comments we modified the patch v4 as below. > > We evaluated the Marvell 10G driver and at803x you suggested. The 2 drivers > implement SFP module attach/detach functions and we think these functions do > not help yt8521 to do UTP/Fiber register space arbitration which you may > concern in previous patch. > > Yt8521 can detect utp/fiber media link status automatically. For the case of > both media are connected, driver arbitrates the priority of the media (by > default, driver takes fiber as higher priority) and report the media status > to up layer(MAC). > > 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. > > > patch v2: > Hi Andrew, Russell King, Peter, > Thanks and based on your comments we modified the patch as below. > > > So there's only two possible pages that can be used in the extended > >register space? > > Yes,there is only two register space (utp and fiber). > > > > +/* Extended Register's Data Register */ > > > +#define YTPHY_PAGE_DATA 0x1F > > > > These are defined exactly the same way as below. Please reuse code > > where possible. > > Yes, code will be reuse, but "YT8511_PAGE" need to be rename like > "YTPHY_PAGE_DATA",as it is common register for yt phys. > > > patch v1: > Add a driver for the motorcomm yt8521 gigabit ethernet phy. We have verified > the driver on StarFive VisionFive development board, which is developed by > Shanghai StarFive Technology Co., Ltd.. On the board, yt8521 gigabit ethernet > phy works in utp mode, RGMII interface, supports 1000M/100M/10M speeds, and > wol(magic package). > > Signed-off-by: Frank > --- > MAINTAINERS | 1 + > drivers/net/phy/Kconfig | 2 +- > drivers/net/phy/motorcomm.c | 1170 ++++++++++++++++++++++++++++++++++- > 3 files changed, 1170 insertions(+), 3 deletions(-) This is not the correct way to format the commit message. All the text you have above will end up in the commit. Please put all discussion after the --- . > + /* If it is reset, need to wait for the reset to complete */ > + if (set == BMCR_RESET) { > + while (max_cnt--) { > + /* unlock mdio bus during sleep */ > + phy_unlock_mdio_bus(phydev); > + usleep_range(1000, 1100); > + phy_lock_mdio_bus(phydev); > + > + ret = __phy_read(phydev, MII_BMCR); > + if (ret < 0) > + goto err_restore_page; > + > + if (!(ret & BMCR_RESET)) > + return phy_restore_page(phydev, old_page, 0); > + } > + if (max_cnt <= 0) > + ret = -ETIME; ETIMEDOUT. Andrew