Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753468AbdIHOAa (ORCPT ); Fri, 8 Sep 2017 10:00:30 -0400 Received: from vps0.lunn.ch ([178.209.37.122]:33011 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750985AbdIHOA2 (ORCPT ); Fri, 8 Sep 2017 10:00:28 -0400 Date: Fri, 8 Sep 2017 16:00:20 +0200 From: Andrew Lunn To: Corentin Labbe Cc: robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@free-electrons.com, wens@csie.org, linux@armlinux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, peppe.cavallaro@st.com, alexandre.torgue@st.com, f.fainelli@gmail.com, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 10/10] net: stmmac: dwmac-sun8i: Handle integrated/external MDIOs Message-ID: <20170908140020.GC25219@lunn.ch> References: <20170908071156.5115-1-clabbe.montjoie@gmail.com> <20170908071156.5115-11-clabbe.montjoie@gmail.com> <20170908130520.GA11248@lunn.ch> <20170908132632.GA3037@Red> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170908132632.GA3037@Red> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1182 Lines: 30 > > > +static int mdio_mux_syscon_switch_fn(int current_child, int desired_child, > > > + void *data) > > > +{ > > > + struct stmmac_priv *priv = data; > > > + struct sunxi_priv_data *gmac = priv->plat->bsp_priv; > > > + u32 reg, val; > > > + int ret = 0; > > > + bool need_reset = false; > > > + > > > + if (current_child ^ desired_child) { > > > + regmap_read(gmac->regmap, SYSCON_EMAC_REG, ®); > > > + switch (desired_child) { > > > + case DWMAC_sUN8I_MDIO_MUX_INTERNAL_ID: > > > + dev_info(priv->device, "Switch mux to internal PHY"); > > > + val = (reg & ~H3_EPHY_MUX_MASK) | H3_EPHY_SELECT; > > > + if (gmac->use_internal_phy) > > > + need_reset = true; > > > + break; > > > > This i don't get. Why do you need use_internal_phy? Isn't that > > implicit from DWMAC_sUN8I_MDIO_MUX_INTERNAL_ID? Is it even possible to > > use an external PHY on the internal MDIO bus? > > > > On my H3 box with external PHY, the MDIO mux library first select (for scan ?) the internal MDIO. > Without use_internal_phy usage, this board will launch a reset to use the internal MDIO... and this reset timeout/fail. Do you know why the reset times out/fails? Andrew