Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 16555C433EF for ; Mon, 23 May 2022 12:09:52 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0A83183EE4; Mon, 23 May 2022 14:09:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1653307790; bh=r+ZQorAVE1S3uQHpNQK94ZjawP1FgOYR2AofaNom0Hc=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=xjKMXnK0RsPEACikoE8ZUVjSARgk5CAOUZziP795lTlIfPdfhhCFyaxtzCLTlfcWV 8cTLMS0Wf4Vn7LcMNBWH4hRCma0/9id/Cnwp8BB6+Vh5rxnWg7pzp9dvsUHz8em7R7 ZsXtSqqFolBTrtYebq8uBQmsROmVCCtN2uWi5XnuzX0zB9F7QM+SySxMiL/7lQz5SS KCkqZjK4ihnBzMDvDHbeBSWyvXw1x0o0NE7MbxXdxb7d0/NUoXwWt2vjwUf7oaLHSZ CAEkHtpu4iwQMuChJvIUH/1ff744ysMx/11J0CAY20ubYXxLPZGeINn5u+PprKAr2p 1oW24rU/z4y+A== Received: from [127.0.0.1] (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 76CA680084; Mon, 23 May 2022 14:09:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1653307787; bh=r+ZQorAVE1S3uQHpNQK94ZjawP1FgOYR2AofaNom0Hc=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=xaMzuy6MZ9t7XDhjxKATsFYhlIpX9KVwhFc7boOUmhYkZ1DwHiR6cdvbETiUGFjp6 6+LZyhswlu2oFAiTLtkXYC9mI1QgTLyGZYJ9edb4Hyp+GJffekNcEjVEaGuFhblOKq NUtPsG9wuiIc50cQelPVuubzqF2xiK2ZIbuNm5U39Dbjzfjr0LomKgGobyM95NdwA8 mZkRnPoGRswBmdBYcoixCCxJ4QutsevwXudAKDovisAgvszI9WqDHhul1505mk3hKW Ta0jIDTpMEA4efS2UOqKJpusmGQZcDyqII4dyMXPh59zew/Kl1a4gz6v/8rkaLYmPs /aeT2a0OrJ7tw== Message-ID: <025c8f3a-c3ed-5cc0-a8a2-c22d95459956@denx.de> Date: Mon, 23 May 2022 14:09:47 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: dwc_eth_qos driver for tegra Content-Language: en-US To: Rasmus Villemoes , Christophe Roullier , Stephen Warren Cc: u-boot , Patrick Delaunay , Ramon Fried References: <4e1cbbc0-1008-b68c-e7ff-a7cb8929f74d@prevas.dk> <87181e47-18d9-768b-f5b0-fa48f10fe7ec@prevas.dk> From: Marek Vasut In-Reply-To: <87181e47-18d9-768b-f5b0-fa48f10fe7ec@prevas.dk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean On 5/23/22 13:46, Rasmus Villemoes wrote: > On 23/05/2022 12.57, Marek Vasut wrote: >> On 5/23/22 11:17, Rasmus Villemoes wrote: >>> Hi >> >> Hi, >> >>> I'm looking at switching the dwc_eth_qos driver over to use >>> dm_eth_phy_connect(). However, I'm a little puzzled by the code for the >>> tegra variant. The comment at the top of the file, as well as >>> tegra186.dtsi, says >>> >>>    phy-mode = "rgmii"; >>> >>> But eqos_get_interface_tegra186() returns a hard-coded >>> PHY_INTERFACE_MODE_MII. Now the commit which introduced the ->interface >>> abstraction, ac2d4efb16e (net: dwc_eth_qos: add Ethernet stm32mp1 >>> support), and that eqos_get_interface_tegra186() function, changed >>> >>> -       eqos->phy = phy_connect(eqos->mii, 0, dev, 0); >>> >>> to >>> >>> +               eqos->phy = phy_connect(eqos->mii, 0, dev, >>> +                                       eqos->config->interface(dev)); >>> >>> and that last hard-coded 0 in the former phy_connect() is indeed >>> equivalent to PHY_INTERFACE_MODE_MII. >>> >>> So which is it? It would be nice if one could just rely on >>> dm_eth_phy_connect() picking up the correct value from device tree, and >>> drop all the code which duplicates parsing of phy-mode from the ethernet >>> driver. >> >> linux-2.6$ git grep mii arch/arm64/boot/dts/nvidia/tegra186* >> arch/arm64/boot/dts/nvidia/tegra186-p3310.dtsi:         phy-mode = "rgmii"; >> arch/arm64/boot/dts/nvidia/tegra186-p3509-0000+p3636-0001.dts: phy-mode >> = "rgmii-id"; >> >> So probably RGMII ? > > Well, yes, I also did check the linux device tree files which also says > rgmii, but that doesn't explain why the U-Boot driver code seems to > ignore that entirely and use mii hardcoded, both before and after > ac2d4efb16e. > > So another way of asking: does this driver actually work today, and/or > has it worked at some point? I assume the answer is yes - after all, the > very first commit "supports the specific configuration used in NVIDIA's > Tegra186 chip", but that commit also did that phy_connect() with a last > argument of 0 aka PHY_INTERFACE_MODE_MII. > > And would it break if one started taking the phy-mode from device tree? > If so, should device tree be updated to say "mii"? I think we wait for nvidia to answer all this, I don't have that SoC available.