Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3142092rdh; Mon, 27 Nov 2023 07:19:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IGLw3SFpYMdupKuh9q4zNM1+joqqsxwlmgChvi6WiBYrsHaGPyVULTZ8Hd9SdOm/DHjxX6L X-Received: by 2002:a05:6871:2309:b0:1e9:bb3a:9a89 with SMTP id sf9-20020a056871230900b001e9bb3a9a89mr15232354oab.47.1701098375343; Mon, 27 Nov 2023 07:19:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701098375; cv=none; d=google.com; s=arc-20160816; b=AoNiVTs2OgedVMlHnuvyL05Y4nmJLsv+PF2DYsbwalFhc2hXx5YMPCwEBw5ubcLkcM Oa+0bNlTs99xVwWTJ+xoo2qZPQv8BPG2LBiu8FYtfavXi/ZGtdjUjbxqecgVeBXu/bIg E5Hd4KMHRPBgfTXMyT6c5v11SvmkF/JJodJBFBPEQ97MybShfC4XXiuaWBEuCN03EWBz J/2BxgopU2N7if1jrCUQHlLHP47fgYzhfQgeLaqgFkcwCB21fpwnuLVFHe1s3bI9YbB+ JdTpA50UDhcjUtchTq1fxtD/HgjvVraRC9zdB4sOkuP6gnXmsx26Wt3Br1KzDeqZNcx7 ILXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=VIKMvlIRYtS1WvbUoM+vWJ1z9I2GYsx2bfxFTfmC+TQ=; fh=Ro4G+9lvn+KGg51C9N8KXvAXm3ZGou9+X/eOgDc9YmQ=; b=gFVWgczlzCWpmktEJbozilFmYI7s/EONEhDVo+6Bx4/L+CFhlD9ElsrNGHRDnZFv9Z qSxbdoPGRYEAgZrTAqWF8Wcx7e0lH79LrOE9e/9B6pDiVYLOa3aEuG3DYnymPNCueEiM /1HqxOiwjFealfWrnp+i5PTIMNuPewPhbOAo3gt+QkI7cy3LoYNtFG9agmoY63R3kbJw aZ6JVF05h9uG1rsCi3pUkJgoLdt3VmWYsUoP+f6/NvI3ATU9v7ZfTZWJWJH8aWs7A/hX 5JJ7z4msjj9omyxXF9P0DyQDxCNNNT8Tw+3BjmWjvNww0NWQ5tZWEnmQL/VoXrciP/kc kn6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=B6PrzDkN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id x15-20020a056830114f00b006d833db9e41si313932otq.144.2023.11.27.07.19.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 07:19:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=B6PrzDkN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 5EBFF80779BE; Mon, 27 Nov 2023 07:19:34 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233897AbjK0PTX (ORCPT + 99 others); Mon, 27 Nov 2023 10:19:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233730AbjK0PTV (ORCPT ); Mon, 27 Nov 2023 10:19:21 -0500 Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1DCCAA; Mon, 27 Nov 2023 07:19:27 -0800 (PST) Received: by mail-yb1-xb36.google.com with SMTP id 3f1490d57ef6-db4050e68f3so4007067276.0; Mon, 27 Nov 2023 07:19:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701098367; x=1701703167; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=VIKMvlIRYtS1WvbUoM+vWJ1z9I2GYsx2bfxFTfmC+TQ=; b=B6PrzDkNSGflIGyKxT6lJSOQZtl1VH+4eiypVM5zl6cxjK23Wu2q3XJoL02SsBwr8T tG5rUCL+N435lbKfNLuwQzM9kkp22+OqmqSoS/RQLuESSO9QDwyHCsdyYja060omGwzY IV0DGMss6fZt2LCYzx+7kzq6Pnmw5UGgUgUoyWDl5YCO30EVZOEp69vFTHGKzLBAqFpd a2cWE9Az84mPzYdX0BZAGPpVFenUGhI4pyE6TFE5AHHb9RktbvLxCWPrslOos9qox1oq EY5v4iCAuV8blJQC2bx+/rYlLI3G9MKDhP48+TtHa/UyX/n2e54ArFdB2RQQDiTh2eJa c2zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701098367; x=1701703167; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VIKMvlIRYtS1WvbUoM+vWJ1z9I2GYsx2bfxFTfmC+TQ=; b=PKNIZUTCGlVrHyGL9wh0SpeZx9laWJA/LwnOcNNTbiOKAW+BRLnihbKVgcx+892VIx yvOSQE0FUZ6l3c56lWhOdnOQwL0xxHyfn1JLQlbWHq1hF7TBi9doiMXogMTruhxyD8GQ AklyggB8qKLHe7aGGXcgDr0apdTkO5ZfAkYZwlrtBwqzrKeGUdgJIkdmWsYn/PhdrFsC fEdliWz/GivdlqrQyKU4v+8Ctwv4F0qLPP9I+VflecCd0i3/q5SE3p6gefp1rMMfhHI1 p77jODzFwYV/h+tYieRSqS6RnOfDBW9bG09X5Zsp2wgDNXKt0knZK4B4E3M9qWUJpRKC y2BQ== X-Gm-Message-State: AOJu0YyjwNgrsfuhjhNul3djBBh96C/XCqQ6ohod5LEm26UZ6XyCkE1n BUJpvoRF+5jjxxjVBNfuOIF5cBmRmaVeA8TszEI= X-Received: by 2002:a25:4b02:0:b0:db0:23d8:780 with SMTP id y2-20020a254b02000000b00db023d80780mr9466434yba.60.1701098366826; Mon, 27 Nov 2023 07:19:26 -0800 (PST) MIME-Version: 1.0 References: <20231121151733.2015384-1-tmaimon77@gmail.com> <20231121151733.2015384-3-tmaimon77@gmail.com> <6aeb28f5-04c2-4723-9da2-d168025c307c@lunn.ch> <9ad42fef-b210-496a-aafc-eb2a7416c4df@lunn.ch> In-Reply-To: From: Tomer Maimon Date: Mon, 27 Nov 2023 17:19:15 +0200 Message-ID: Subject: Re: [PATCH v1 2/2] net: stmmac: Add NPCM support To: Andrew Lunn Cc: alexandre.torgue@foss.st.com, tali.perry1@gmail.com, edumazet@google.com, krzysztof.kozlowski+dt@linaro.org, linux-stm32@st-md-mailman.stormreply.com, benjaminfair@google.com, openbmc@lists.ozlabs.org, joabreu@synopsys.com, joel@jms.id.au, devicetree@vger.kernel.org, j.neuschaefer@gmx.net, robh+dt@kernel.org, peppe.cavallaro@st.com, linux-arm-kernel@lists.infradead.org, avifishman70@gmail.com, venture@google.com, linux-kernel@vger.kernel.org, mcoquelin.stm32@gmail.com, netdev@vger.kernel.org, davem@davemloft.net Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Mon, 27 Nov 2023 07:19:34 -0800 (PST) Hi Andrew, I took a look at the xpcs driver and the stmmac driver and it doesn't cover NPCM use. in the NPCM case the stmmac ID=0x37 therefore the driver is linked to DWMAC1000 https://elixir.bootlin.com/linux/v6.7-rc2/source/drivers/net/ethernet/stmicro/stmmac/hwif.c#L139 to enable the xpcs, the stmmac should support xgmac or gmac4 and in the NPCM is support only gmac. https://elixir.bootlin.com/linux/v6.7-rc2/source/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c#L555 https://elixir.bootlin.com/linux/v6.7-rc2/source/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c#L573 and the most important thing is that the XPCS is handled through an indirect register access and not through MDIO. the MDIO is connected to the external PHY and not to the XPCS. In that case, I think the best way to handle the XPCS is through the NPCM glue layer, what do you think? Thanks, Tomer On Thu, 23 Nov 2023 at 15:50, Tomer Maimon wrote: > > Hi Andrew, > > On Wed, 22 Nov 2023 at 20:45, Andrew Lunn wrote: > > > > On Wed, Nov 22, 2023 at 07:50:57PM +0200, Tomer Maimon wrote: > > > Hi Andrew, > > > > > > Thanks for your comments > > > > > > On Tue, 21 Nov 2023 at 18:42, Andrew Lunn wrote: > > > > > > > > > +void npcm_dwmac_pcs_init(struct npcm_dwmac *dwmac, struct device *dev, > > > > > + struct plat_stmmacenet_data *plat_dat) > > > > > +{ > > > > > + u16 val; > > > > > + > > > > > + iowrite16((u16)(SR_MII_CTRL >> 9), dwmac->reg + IND_AC_BA_REG); > > > > > + val = ioread16(dwmac->reg + PCS_SR_MII_CTRL_REG); > > > > > + val |= PCS_RST; > > > > > + iowrite16(val, dwmac->reg + PCS_SR_MII_CTRL_REG); > > > > > + > > > > > + while (val & PCS_RST) > > > > > + val = ioread16(dwmac->reg + PCS_SR_MII_CTRL_REG); > > > > > + > > > > > + val &= ~(PCS_AN_ENABLE); > > > > > + iowrite16(val, dwmac->reg + PCS_SR_MII_CTRL_REG); > > > > > +} > > > > > > > > Is this a licensed PCS implementation? Or home grown? If its been > > > > licensed from somebody, it maybe should live in driver/net/pcs, so > > > > others can reuse it when they license the same core. > > > > > we are using DWC PCS, I don't see support for DWC PCS and I am not > > > sure it is supposed to be supported at /drivers/net/pcs > > > > I've not followed the naming used by Synopsys. Is DWC PCS the same as > > XPCS? Does Synopsys have multiple PCS implementations? > > > > > I do see a patch set to support DWC PCS but I don't think it answers my needs > > > https://patchwork.ozlabs.org/project/netdev/patch/1559674736-2190-3-git-send-email-weifeng.voon@intel.com/ > > > > I _think_ this patch eventually got turned into > > driver/net/pcs/pcs-xpcs.c > > > > What exactly does it not do for you? > Thanks for pointing me to Synopsys (DWC) PCS in pcs-xpcs.c I need to > check if the driver follows all our SGMII needs > > > > Andrew > > Best regards, > > Tomer