Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3745829rwb; Sat, 3 Dec 2022 09:58:50 -0800 (PST) X-Google-Smtp-Source: AA0mqf7flWx0jTYSSv91ePnxxUctFdekQph5mSkf9+LRF/RxmvhTDa4+zROxQdeb/Qovu26xS7E2 X-Received: by 2002:a05:6a02:118:b0:477:cce0:49d with SMTP id bg24-20020a056a02011800b00477cce0049dmr41339299pgb.74.1670090330682; Sat, 03 Dec 2022 09:58:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670090330; cv=none; d=google.com; s=arc-20160816; b=VLh6/oJqAdzh2fnmNkDa7unq6xyk8bOtMg2oZNiMqKjCRiqPUa+Bol5WL9DyNWwyNj hfuLDyYcZ07h6sdNOUN6wF1yC7C1q8sOB7FrtTYOClNfehr3kEdrqH+PsvLW/KH5zmbv jh5W0OLufPuqTPNk7z5l+eQz+iQPRBKyoMTIeeYIeRriqtpwecarwwAW21zAvFAzL1b2 KgE82dAKi0MYRkQf/whhJ+lrGynJ8yF4k5dEoGQ+EFNh1trpwRmY8BDzVh+2CsUkMCgg L4ZdUvWNyfzKkacOIo1i/jkV7mTF5qnQXJkIY0qNwsftOPUnWHYRNZhjD9zlbBzGmjL3 EgeQ== 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=kf0+FnqxropjT26w5i+R6Mn69hvc/cFGBm10OXyOzQk=; b=BfhMoFsXf+YkIRyUPrOss6Jxa5pKY6EB7JEnE7r3huFtv6HTC830CXiLEeeQtzHOR1 wc+vh6ratxXcwv72GbKEB35USfdzO8xxT5uiQOLcfXotl+i4FAkNlDH/LA/Buvq4Bu4m 0kuwac6z2vRUQMNyD3opLj4v8F7UJzP48iKmV7pL4jlDxOPJ7xyC+8uocGgkV6ZYc3u2 Hl3yqig6YEUcpS0f1cg4waoVrchaXLHkeQcCQ7E0cwSTqFnMlqJTlBzNcOUgNAqv2VsY jQ/N/I1QcGBcfgNpHBz1ar2gDX2KSpf1e1EH1I9DvQ4So6su5HLrw3SZMNlyDlnrgwmZ n6zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b="Ohj/2JvC"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w4-20020a656944000000b0047850dc6cdasi9966529pgq.116.2022.12.03.09.58.40; Sat, 03 Dec 2022 09:58:50 -0800 (PST) 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="Ohj/2JvC"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229633AbiLCR3A (ORCPT + 82 others); Sat, 3 Dec 2022 12:29:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229553AbiLCR26 (ORCPT ); Sat, 3 Dec 2022 12:28:58 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F2B47655; Sat, 3 Dec 2022 09:28:53 -0800 (PST) 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=kf0+FnqxropjT26w5i+R6Mn69hvc/cFGBm10OXyOzQk=; b=Ohj/2JvCsat4UCmFfnUSqfDfsd mmrqd00lvsHwnVdPQztHXTrVIjoYI1p0YlnfOG7NeeN1lwgfgfY8OdcSSmsVIWs5fKLdZNWctxvMJ L3Ot4Hl0s3AytEVxAPcNgn4p+EFoIrngaKH9NgcC9T5pywnBajeIfgDUwhWWinNhWcfI=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1p1WIw-004HN1-V1; Sat, 03 Dec 2022 18:27:58 +0100 Date: Sat, 3 Dec 2022 18:27:58 +0100 From: Andrew Lunn To: Chukun Pan Cc: heiko@sntech.de, alexandre.torgue@foss.st.com, davem@davemloft.net, david.wu@rock-chips.com, devicetree@vger.kernel.org, edumazet@google.com, joabreu@synopsys.com, krzysztof.kozlowski+dt@linaro.org, krzysztof.kozlowski@linaro.org, kuba@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, pabeni@redhat.com, peppe.cavallaro@st.com, robh+dt@kernel.org Subject: Re: Re: [PATCH 1/2] dt-bindings: net: rockchip-dwmac: add rk3568 xpcs compatible Message-ID: References: <3689593.Mh6RI2rZIc@diego> <20221203090015.16132-1-amadeus@jmu.edu.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221203090015.16132-1-amadeus@jmu.edu.cn> 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 Sat, Dec 03, 2022 at 05:00:15PM +0800, Chukun Pan wrote: > > Actually looking deeper in the TRM, having these registers "just" written > > to from the dwmac-glue-layer feels quite a bit like a hack. > > > The "pcs" thingy referenced in patch2 actually looks more like a real device > > with its own section in the TRM and own iomem area. This pcs device then > > itself has some more settings stored in said pipe-grf. > > > So this looks more like it wants to be an actual phy-driver. > > > @Chukun Pan: plase take a look at something like > > https://elixir.bootlin.com/linux/latest/source/drivers/phy/mscc/phy-ocelot-serdes.c#L398 > > on how phy-drivers for ethernets could look like. > > > Aquiring such a phy from the dwmac-glue and calling phy_set_mode after > > moving the xpcs_setup to a phy-driver shouldn't be too hard I think. > > Thanks for pointing that out. > The patch2 is come from the sdk kernel of rockchip. > The sgmii-phy of RK3568 is designed on nanning combo phy. > In the sdk kernel, if we want to use sgmii mode, we need > to modify the device tree in the gmac section like this: > > ``` > &gmac0 { > power-domains = <&power RK3568_PD_PIPE>; > phys = <&combphy1_usq PHY_TYPE_SGMII>; > phy-handle = <&sgmii_phy>; > phy-mode = "sgmii"; phy-mode tells you you are using SGMII. You can tell the generic PHY driver this which will call the PHY drivers .set_mode(). As said above, there are plenty of examples of this, mvneta and its comphy, various mscc drivers etc. Andrew