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 37521C05027 for ; Mon, 23 Jan 2023 17:23:20 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5C5578563B; Mon, 23 Jan 2023 18:23:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=arm.com 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 9FCFC8563B; Mon, 23 Jan 2023 18:23:15 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 7D38D8573E for ; Mon, 23 Jan 2023 18:23:11 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=andre.przywara@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 88F7EC14; Mon, 23 Jan 2023 09:23:52 -0800 (PST) Received: from [10.1.26.40] (e110479.cambridge.arm.com [10.1.26.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9E1763F71E; Mon, 23 Jan 2023 09:23:02 -0800 (PST) Message-ID: <6e29ac2c-90bc-3c52-9ced-d86c74295812@arm.com> Date: Mon, 23 Jan 2023 17:22:50 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH v2 2/5] net: sun8i-emac: Add a flag for RMII support Content-Language: en-GB To: Samuel Holland , Jagan Teki Cc: Joe Hershberger , Ramon Fried , u-boot@lists.denx.de References: <20230122225107.62464-1-samuel@sholland.org> <20230122225107.62464-3-samuel@sholland.org> From: Andre Przywara In-Reply-To: <20230122225107.62464-3-samuel@sholland.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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.6 at phobos.denx.de X-Virus-Status: Clean On 22/01/2023 22:51, Samuel Holland wrote: > Describe this feature instead of using the SoC ID. Looks alright, also compared against the kernel driver. > Signed-off-by: Samuel Holland Reviewed-by: Andre Przywara Cheers, Andre > --- > > Changes in v2: > - New patch for v2 > > drivers/net/sun8i_emac.c | 15 +++++++-------- > 1 file changed, 7 insertions(+), 8 deletions(-) > > diff --git a/drivers/net/sun8i_emac.c b/drivers/net/sun8i_emac.c > index 986e565cd8..f232b8f087 100644 > --- a/drivers/net/sun8i_emac.c > +++ b/drivers/net/sun8i_emac.c > @@ -137,6 +137,7 @@ enum emac_variant_id { > > struct emac_variant { > enum emac_variant_id variant; > + bool support_rmii; > }; > > struct emac_dma_desc { > @@ -337,9 +338,7 @@ static int sun8i_emac_set_syscon(struct sun8i_eth_pdata *pdata, > reg = sun8i_emac_set_syscon_ephy(priv, reg); > > reg &= ~(SC_ETCS_MASK | SC_EPIT); > - if (priv->variant->variant == H3_EMAC || > - priv->variant->variant == A64_EMAC || > - priv->variant->variant == H6_EMAC) > + if (priv->variant->support_rmii) > reg &= ~SC_RMII_EN; > > switch (priv->interface) { > @@ -353,13 +352,10 @@ static int sun8i_emac_set_syscon(struct sun8i_eth_pdata *pdata, > reg |= SC_EPIT | SC_ETCS_INT_GMII; > break; > case PHY_INTERFACE_MODE_RMII: > - if (priv->variant->variant == H3_EMAC || > - priv->variant->variant == A64_EMAC || > - priv->variant->variant == H6_EMAC) { > + if (priv->variant->support_rmii) { > reg |= SC_RMII_EN | SC_ETCS_EXT_GMII; > - break; > + break; > } > - /* RMII not supported on A83T */ > default: > debug("%s: Invalid PHY interface\n", __func__); > return -EINVAL; > @@ -910,6 +906,7 @@ static const struct emac_variant emac_variant_a83t = { > > static const struct emac_variant emac_variant_h3 = { > .variant = H3_EMAC, > + .support_rmii = true, > }; > > static const struct emac_variant emac_variant_r40 = { > @@ -918,10 +915,12 @@ static const struct emac_variant emac_variant_r40 = { > > static const struct emac_variant emac_variant_a64 = { > .variant = A64_EMAC, > + .support_rmii = true, > }; > > static const struct emac_variant emac_variant_h6 = { > .variant = H6_EMAC, > + .support_rmii = true, > }; > > static const struct udevice_id sun8i_emac_eth_ids[] = {