From mboxrd@z Thu Jan 1 00:00:00 1970 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 DF318C433EF for ; Sat, 18 Dec 2021 23:42:46 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CC5C383076; Sun, 19 Dec 2021 00:42:43 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=nic.cz Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 3C259830A2; Sun, 19 Dec 2021 00:42:42 +0100 (CET) Received: from mail.nic.cz (mail.nic.cz [IPv6:2001:1488:800:400::400]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D7E7383071 for ; Sun, 19 Dec 2021 00:42:38 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=nic.cz Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.behun@nic.cz Received: from thinkpad (unknown [IPv6:2a0e:b107:ae1:0:3e97:eff:fe61:c680]) by mail.nic.cz (Postfix) with ESMTPSA id 3CD0814096B; Sun, 19 Dec 2021 00:42:38 +0100 (CET) Date: Sun, 19 Dec 2021 00:42:37 +0100 From: Marek =?UTF-8?B?QmVow7pu?= To: Tony Dinh Cc: U-Boot Mailing List , Stefan Roese , David Purdy , Tom Rini , Pali Roh_r Subject: Re: [PATCH 7/8] arm: kirkwood: Pogoplug-V4 : Add board implementation Message-ID: <20211219004237.15cb69ee@thinkpad> In-Reply-To: References: <20211218042335.5865-1-mibodhi@gmail.com> <20211218042335.5865-8-mibodhi@gmail.com> <20211218235913.7c5e30ee@thinkpad> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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.2 at phobos.denx.de X-Virus-Status: Clean On Sat, 18 Dec 2021 15:28:49 -0800 Tony Dinh wrote: > Hi Marek, >=20 > On Sat, Dec 18, 2021 at 2:59 PM Marek Beh=C3=BAn wro= te: > > =20 > > > +#if defined(CONFIG_RESET_PHY_R) > > > +/* Configure and initialize PHY */ > > > +void reset_phy(void) > > > +{ > > > + u16 reg; > > > + int phyaddr; > > > + char *name =3D "ethernet-controller@72000"; > > > + char *eth0_path =3D "/ocp@f1000000/ethernet-controller@72000"; > > > + > > > + if (miiphy_set_current_dev(name)) > > > + return; > > > + > > > + phyaddr =3D fdt_get_phy_addr(eth0_path); > > > + if (phyaddr < 0) > > > + return; > > > + > > > + /* > > > + * Enable RGMII delay on Tx and Rx for CPU port > > > + * Ref: sec 4.7.2 of chip datasheet > > > + */ > > > + miiphy_write(name, phyaddr, MV88E1116_PGADR_REG, 2); > > > + miiphy_read(name, phyaddr, MV88E1116_MAC_CTRL_REG, ®); > > > + reg |=3D (MV88E1116_RGMII_RXTM_CTRL | MV88E1116_RGMII_TXTM_CTRL= ); > > > + miiphy_write(name, phyaddr, MV88E1116_MAC_CTRL_REG, reg); > > > + miiphy_write(name, phyaddr, MV88E1116_PGADR_REG, 0); > > > + > > > + /* reset the phy */ > > > + miiphy_reset(name, phyaddr); > > > + > > > + printf("88E1116 Initialized on %s\n", name); > > > +} =20 > > > > This PHY has a driver in U-Boot, drivers/net/phy/marvell.c, > > structure M88E1118_driver. > > > > There the m88e1118_config() method already does one thing of what you > > are doing here: enabling rgmii delays. It also sets LED config, but > > does not reset the PHY. You can add call to phy_reset() there... =20 >=20 > Thanks for the advice! That would be best. >=20 > Will look into this for another separate patch, to see if it is > possible to factor out similar code in other Kirkwood boards too. Also implement the .readext and .writeext methods as M88E151x_driver and you won't need to alwyas change page by hand. Marek