Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1135292rdb; Wed, 6 Dec 2023 09:27:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IEtqXe6G/I5L0cJ3kSdOxUnDq4dv+lR5mHu9T5X+EpBjEdS+5e68Qyf08lQoyw5kO9imUep X-Received: by 2002:a05:6e02:13ef:b0:35d:87d4:938c with SMTP id w15-20020a056e0213ef00b0035d87d4938cmr1382291ilj.15.1701883643061; Wed, 06 Dec 2023 09:27:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701883643; cv=none; d=google.com; s=arc-20160816; b=vAJGLdiCrFiEribjonjy4k7iNhftehf2XGE0NTc9xSzUNTS39edJqWhAWQbENCyEqG Yrqr2NtMPUnyVvE/NqoWrFOCeiTR2p3AA+0+fl8FlFQtxx3snPGN9CTpFnae2NO9k1oy iD5/d3y4bExCDoFQux2uFkMpimyerAdOnBZ6wNInNega64hWjmo7u4izkGN2o7R5XuCM moRXNzEmX1pb93jN7vZyDnnABGMNm607x87Z+pia8sEcjL6cKOrQMTccl8qacA3IHI44 Khj0i3srnTQWOn4XC//BpbxtKM3pZh/78UozBaG9APmQVO5kv6vkhQOfeSZjGN1jwof/ 9mtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=o8pZVmJLBTU+1tWg81N7K3SrAOmJRHhU7sJoEUi0B8Q=; fh=Bd07Nsc/H6raZm/RAWh3fvYmiHlgBrjmxdIX4xchpRI=; b=RnclaDWHeQAORDL2i1Swq6MhtrivVTtTcoEpN85e6zOGBC34wRwA640fZFH4G6w4V0 ZOioXghnx6T1vTGS98ZK/TZqtVCjvoQVF62Dfn/HTfBkDJWgSZsqbG3i1RU9P/6hVn9E CrMIPGDEfamV6OSmzDIWg/fYMsM6YoWlYqf+iR8DX/+7PkQ+ckpRUmz9b9aZDyV2RMcv rULIDofPpwru8CZWq1hgiKfhwtJJgjTmWR5oTGTmAosvUWZUldnsIENnz17kOtlEY3E6 PHKrZZIhPlP0pDzcLX4EVUWvC2+UXBPuD/95i5QfrZrm48xIraxfjhn2hG7KNE0SjWsp py7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=RspeMsNl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id 19-20020a631553000000b005c6183ccab1si196954pgv.529.2023.12.06.09.27.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 09:27:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=RspeMsNl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 018E98029322; Wed, 6 Dec 2023 09:27:20 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378425AbjLFR1F (ORCPT + 99 others); Wed, 6 Dec 2023 12:27:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229771AbjLFR1E (ORCPT ); Wed, 6 Dec 2023 12:27:04 -0500 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CD4FD4B; Wed, 6 Dec 2023 09:27:08 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 4D837FF805; Wed, 6 Dec 2023 17:27:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1701883627; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=o8pZVmJLBTU+1tWg81N7K3SrAOmJRHhU7sJoEUi0B8Q=; b=RspeMsNlXs4d9FVko5LXZ3Kk3UqyCUGNCdsvtlEh+T6qMnNVaAAJKhPfp1sYFoj6hjBTCj ylgCMP9ngNWeyY9LxI6KabuMqEtQLjDrdMBz0I8KZeukyXFLCrH/+DOIN9hm1hQNXh6Fev M2j9oMbc4cXuShB9qSFyhqctHwnyEyjn4pFjxv38xjVYiuEKCg1gVA0pQNxb0n/0n90Dhw mOEph1mESP0822WMO36jzvlFA6rPG8yWiPJgciDCB3+moMrWPzUx81vh7Yeeagnc8Lwjbn wXBVek6wM7IgU+NDmVLVqwaZypP0vkx7oVV44HsAtlAqZdMK3qzKnnkV8oZ5Vg== Date: Wed, 6 Dec 2023 18:27:05 +0100 From: Maxime Chevallier To: Stefan Eichenberger Cc: mw@semihalf.com, linux@armlinux.org.uk, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next] net: mvpp2: add support for mii Message-ID: <20231206182705.3ff798ad@device.home> In-Reply-To: <20231206160125.2383281-1-eichest@gmail.com> References: <20231206160125.2383281-1-eichest@gmail.com> Organization: Bootlin X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-GND-Sasl: maxime.chevallier@bootlin.com X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 06 Dec 2023 09:27:20 -0800 (PST) Hello Stefan, On Wed, 6 Dec 2023 17:01:25 +0100 Stefan Eichenberger wrote: > Currently, mvpp2 only supports RGMII. This commit adds support for MII. > The description in Marvell's functional specification seems to be wrong. > To enable MII, we need to set GENCONF_CTRL0_PORT3_RGMII, while for RGMII > we need to clear it. This is also how U-Boot handles it. > > Signed-off-by: Stefan Eichenberger > --- > .../net/ethernet/marvell/mvpp2/mvpp2_main.c | 24 ++++++++++++++++--- > 1 file changed, 21 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c > index 93137606869e..6f136f42e2bf 100644 > --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c > +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c > @@ -1513,10 +1513,21 @@ static void mvpp22_gop_init_rgmii(struct mvpp2_port *port) > regmap_write(priv->sysctrl_base, GENCONF_PORT_CTRL0, val); > > regmap_read(priv->sysctrl_base, GENCONF_CTRL0, &val); > - if (port->gop_id == 2) > + if (port->gop_id == 2) { > val |= GENCONF_CTRL0_PORT2_RGMII; > - else if (port->gop_id == 3) > + } else if (port->gop_id == 3) { > val |= GENCONF_CTRL0_PORT3_RGMII_MII; > + > + /* According to the specification, GENCONF_CTRL0_PORT3_RGMII > + * should be set to 1 for RGMII and 0 for MII. However, tests > + * show that it is the other way around. This is also what > + * U-Boot does for mvpp2, so it is assumed to be correct. > + */ > + if (port->phy_interface == PHY_INTERFACE_MODE_MII) > + val |= GENCONF_CTRL0_PORT3_RGMII; > + else > + val &= ~GENCONF_CTRL0_PORT3_RGMII; > + } > regmap_write(priv->sysctrl_base, GENCONF_CTRL0, val); > } > > @@ -1615,6 +1626,7 @@ static int mvpp22_gop_init(struct mvpp2_port *port, phy_interface_t interface) > return 0; > > switch (interface) { > + case PHY_INTERFACE_MODE_MII: > case PHY_INTERFACE_MODE_RGMII: > case PHY_INTERFACE_MODE_RGMII_ID: > case PHY_INTERFACE_MODE_RGMII_RXID: > @@ -6948,8 +6960,11 @@ static int mvpp2_port_probe(struct platform_device *pdev, > MAC_10000FD; > } > > - if (mvpp2_port_supports_rgmii(port)) > + if (mvpp2_port_supports_rgmii(port)) { > phy_interface_set_rgmii(port->phylink_config.supported_interfaces); > + __set_bit(PHY_INTERFACE_MODE_MII, > + port->phylink_config.supported_interfaces); > + } > > if (comphy) { > /* If a COMPHY is present, we can support any of the > @@ -6973,6 +6988,9 @@ static int mvpp2_port_probe(struct platform_device *pdev, > port->phylink_config.supported_interfaces); > __set_bit(PHY_INTERFACE_MODE_SGMII, > port->phylink_config.supported_interfaces); > + } else if (phy_mode == PHY_INTERFACE_MODE_MII) { > + __set_bit(PHY_INTERFACE_MODE_100BASEX, > + port->phylink_config.supported_interfaces); Can you explain that part ? I don't understand why 100BaseX is being reported as a supported mode here. This whole section of the function is about detecting what can be reported based on the presence or not of a comphy driver / hardcoded comphy config. I don't think the comphy here has anything to do with MII / 100BaseX If 100BaseX can be carried on MII (which I don't know), shouldn't it be reported no matter what ? Thanks, Maxime