From patchwork Mon Mar 21 17:07:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karsten Merker X-Patchwork-Id: 600201 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3qTMhW1nHWz9s3s for ; Tue, 22 Mar 2016 04:07:39 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C58C4A748F; Mon, 21 Mar 2016 18:07:35 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id crAQe_NzYfka; Mon, 21 Mar 2016 18:07:35 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3FE1AA7498; Mon, 21 Mar 2016 18:07:35 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 64236A7498 for ; Mon, 21 Mar 2016 18:07:32 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HgaloEdL6lZM for ; Mon, 21 Mar 2016 18:07:32 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.135]) by theia.denx.de (Postfix) with ESMTPS id 1913AA748F for ; Mon, 21 Mar 2016 18:07:28 +0100 (CET) Received: from excalibur.cnev.de ([84.44.187.95]) by mrelayeu.kundenserver.de (mreue003) with ESMTPSA (Nemesis) id 0LyQ4I-1Zftjm0xni-015tFR; Mon, 21 Mar 2016 18:07:24 +0100 Received: from karsten by excalibur.cnev.de with local (Exim 4.84_2) (envelope-from ) id 1ai3IX-0005ZC-NY; Mon, 21 Mar 2016 18:07:21 +0100 Date: Mon, 21 Mar 2016 18:07:21 +0100 From: Karsten Merker To: Michael Haas , Hans de Goede Message-ID: <20160321170721.GC4751@excalibur.cnev.de> References: <56EE56A5.7040301@computerlinguist.org> <20160321161140.GB4751@excalibur.cnev.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160321161140.GB4751@excalibur.cnev.de> X-No-Archive: yes User-Agent: Mutt/1.5.23 (2014-03-12) X-Provags-ID: V03:K0:OKBhxV3DRINzQ6RLGQXTG4oQiQjS3CEwcNP8a2wMc71c8UH4vQg X/RCBHCfNZbmKWOSBjm+4st+AzAoO5ccUMbCwE+f3BqmTnUZ5iX+Aq1lMk8XfSKi3tqT+lS wOzicbG/Lq0o6WXgZ4NfmKZfKQGYA5g6rZCBxVHvO2tFM7rXFr28f1MHAQiITH+B8EbTkJa Ulao9zkKs7u3rQ65oIP8g== X-UI-Out-Filterresults: notjunk:1; V01:K0:cxshXYm5vXA=:vVaboUaGESVvYTfqILLdmO cDsecTg/n1++uXmlo3vMgUlOUKonqgKhwpj7p+4DtpXEA99JoDVrpDSHTRRhk7mgWVEebQ17x KrT6fiLla79x2oysPSfciWcLRhHD/ceNNqle/MUj3kpr3kLMgtcrnAOuaskJOgQlbt+8X7WTc KBJjckOUsokBM4oKY6cJrwLrW0bmbVT+aCS53XO54l+ikIBfssPGxZsChcz0YyOE4t2WWgRgf +x/lPP2tR+3eRCh8E/4NnQb6k4wPoeud/CS2/V9oRtrPP85SEPAcxCT1vulSiYNJjgn76TrTr +GSU+VdWth75GE+ojUzR9UaKEEyvLuLu49bcLDY8NyREgFGMVeNlPatuEeIUJ6C1dwdLinf1i qB1ecGNmKiy3GfVFrgdL+57Z0lbcpKrAGN/YN96RClEjlP4wGihSPua343uDB9A0I8PXKAvrp yFDZ48IM7h20x8UU9ttNCquBYtUTAyu+h7QsTw4ICfrHvxJrxMkG8rVsV3X5xMM1i+K2VF9F3 Ymjb/dcnV44t3kTLoEKP/OpsrSftkjCmI7YGfCAvy7j9+xkI9TILBm2m1nuVfUP3sGZVWTQFm xx4sbC6sVejZLArpmNBAju8o0zU1hpot8YzZQ4TuOQDvkR9sy2Z31ybJ1ouF/0h0sKR1cfHr8 K1hU1/Kvx/WCJTHqjoh8zwATfTteTwZDdWJcwzA/TYKE83Iq+knIzIogydAieXf/CsEQ= Cc: "u-boot@lists.denx.de" Subject: Re: [U-Boot] Which entry in drivers/net/phy/realtek.c matches my device? X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 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" On Mon, Mar 21, 2016 at 05:11:41PM +0100, Karsten Merker wrote: > On Sun, Mar 20, 2016 at 08:52:05AM +0100, Michael Haas wrote: > > Hello all, > > > > I'd like to add some device-specific hacks to realtek.c. I'm using the > > Olimex A20-OlinuXino-Lime2 which uses the RTL8211CL PHY. > > > > Which of the various phy_driver structs is responsible for that device? > > I presume it's keyed off the .uid, but I'm not sure how to find the ID > > of the specific PHY used on my device. > > I have just looked at u-boot's drivers/net/phy/realtek.c and am a > bit confused regarding the PHY IDs when comparing the code to the > Linux kernel's drivers/net/phy/realtek.c. > > On my Lime2 and my A20-SOM-EVB, the RTL8211CL provides a PHY ID of > 0x001cc912: > > Lime2: eth0: PHY ID 001cc912 at 1 IRQ POLL (stmmac-0:01) active > A20-SOM-EVB: eth0: PHY ID 001cc912 at 1 IRQ POLL (stmmac-0:01) active > > According to the Linux sources, 0x001cc912 is the PHY ID of the > RTL8211B, so that would mean that the RTL8211B and RTL8211C share > the same PHY ID. I have googled around a bit and that seems to > be indeed the case. This is insofar interesting as the PHY IDs > of the various RTL8211 variants count up otherwhise while there > is a hole in the numbering scheme where the RTL8211C would fit > in: > > RTL8211B: 0x001cc912 > > RTL8211D: 0x001cc914 > RTL8211E: 0x001cc915 > RTL8211F: 0x001cc916 > > The u-boot drivers/net/phy/realtek.c doesn't have 0x001cc912 as > the PHY ID for the RTL8211B, but instead has 0x1cc910. The mask > bits cover the whole ID, so it looks like the 0x001cc912 from our > RTL8211CL wouldn't match in u-boot at all? I have run some tests which have confirmed that this is indeed the case. The PHY ID of the RTL8211CL in the A20-OlinuXino-Lime2 doesn't cause a match in the Realtek PHY driver in u-boot. With the following patch, the PHY gets at least recognized by the realtek phy driver. Regards, Karsten diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index 259a87f..b5354a8 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -231,6 +231,17 @@ static struct phy_driver RTL8211B_driver = { .shutdown = &genphy_shutdown, }; +/* Support for RTL8211C PHY */ +static struct phy_driver RTL8211C_driver = { + .name = "RealTek RTL8211C", + .uid = 0x1cc912, + .mask = 0xffffff, + .features = PHY_GBIT_FEATURES, + .config = &rtl8211x_config, + .startup = &rtl8211x_startup, + .shutdown = &genphy_shutdown, +}; + /* Support for RTL8211E-VB-CG, RTL8211E-VL-CG and RTL8211EG-VB-CG PHYs */ static struct phy_driver RTL8211E_driver = { .name = "RealTek RTL8211E", @@ -267,6 +278,7 @@ static struct phy_driver RTL8211F_driver = { int phy_realtek_init(void) { phy_register(&RTL8211B_driver); + phy_register(&RTL8211C_driver); phy_register(&RTL8211E_driver); phy_register(&RTL8211F_driver); phy_register(&RTL8211DN_driver);