Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1159462rdb; Fri, 1 Dec 2023 08:25:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IHMehvXPEPD/dB1NJQMTyrT9JIPXUO2bVl083u70zRf4kb+SlQLOIzgy1mhmyUiXn52jVmJ X-Received: by 2002:a05:6a00:4096:b0:6cd:d4b1:cd09 with SMTP id bw22-20020a056a00409600b006cdd4b1cd09mr10241753pfb.5.1701447952274; Fri, 01 Dec 2023 08:25:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701447952; cv=none; d=google.com; s=arc-20160816; b=CGmwjzvOvIiAZHo/ij4L5M9P0yW/XVrQqNhf/92FTJ5hdqmUB0g6xsJVZzp8/nuZR2 rxTLWAleeOk+dSYr26oodDBiaDGNYm3rqgFX/vUQv98k/8iL1qj26iYgTr1zUHLjE6Fm WSO9bWmj4VHPLQ72wlHUZpc1XgVBCjO/B1ehojeWqhRkM3vI9cdQN1NJdoGH0s26vw5y AieUnALqZ2qbFFbE5bAUJrYbk56f/x01ingQdoqqUyH3iqEuDaMyCQ2sOgjfAf4vYZqx KJMnh+lJcv6JO4RkML9IN1ydg02ZpnqWKtwPENDPfoxF08//BlWb6KPR6C7KFtjA/L11 +WoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1Fe9LinVeEIS31sVu9a8Ip9icgC4gCnScZC9xWW4pX4=; fh=qcwoMAcFlfY0GVYuASvQ+3YZq1y5HP+zQhxC8KC3zF0=; b=zf9BhkYnSfkIejFJge2EfDO151k0k/KJ1ufzM0rYJpM40kLJFF6ZFnGUTuxpLigsma FAP+sJV7sGN6KhZP1IBYduY1Gdzv4ItNDEJbRUtZgpNaAGEcXGtdIhrW69D6IY3wz96Q xi26vIgppsftDmpiFx1NYwTbOuRHvet9CvCVhadvtJTg+Hr4i1+9Yzn5KK68X7FzQC6u f3Clbj5gfraDUmTPd2DjGAVSn+ld3VqgtP/OeL7WP2HhssEQ2RTU5nxNnoY48VngoHYL aCTcF/6tr7MQPffmVKtUDqe+qDWu+oM3X+2si7v9HmHn6PX3t0f56/dqepVo+8/ueHfF fAcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kO8eVe2O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id s1-20020a056a0008c100b006be04b8c3basi3642451pfu.178.2023.12.01.08.25.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 08:25:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kO8eVe2O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 884568066B80; Fri, 1 Dec 2023 08:25:38 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378105AbjLAQZU (ORCPT + 99 others); Fri, 1 Dec 2023 11:25:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229663AbjLAQZS (ORCPT ); Fri, 1 Dec 2023 11:25:18 -0500 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF852A6; Fri, 1 Dec 2023 08:25:24 -0800 (PST) Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-50bdebb1786so496299e87.1; Fri, 01 Dec 2023 08:25:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701447923; x=1702052723; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=1Fe9LinVeEIS31sVu9a8Ip9icgC4gCnScZC9xWW4pX4=; b=kO8eVe2Om6W7oe8P2GtUiPRM6d//ZVGK8ZKlWqc3qpCabfCj5QhOliNY8AzBWpVh9S 6erIbTR60xmsZvMEcGYDLxCZy3HBz8eCcApG5tt90EOvgFrfQ34n5Tdk7YD+vOKydo0s eBbQTDjJtORLSaz/5hwVjATqT8Oygfb6kOQkIPxmib/hGNc8Fg1zKT4iv3imRJj6ZXD1 p10v262tO1cRmhiMjxhqOrLUq6qs0C8bxpR8Z6JXeLWh2X1LgK50BKVH2w0m8hiL7bbm Y3GJ1yDE5T4WGA0tQ82og9/B7oS3pZ8PYogts2+MNO2SkVw8ssnOuxIxptPGoivQr/Bo IAZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701447923; x=1702052723; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=1Fe9LinVeEIS31sVu9a8Ip9icgC4gCnScZC9xWW4pX4=; b=pQayqNNZBc0Kdmf1KPXI+JyWVQrEyX4e2OBlH1EHIY/Q0GmZHbmE7pbcng0KYdaY9U z0o4iXBIm60nuntTa/5NXFeU5ZEbU/w/ddZVJJU9yAhzTlyiBNlK/TIbwGNh3Ob1cDia 2Qp5ZWnDxUNkkBD6k9sKZe1yX6t5grnhyKYmJHO9OA/pbUkA2/+XNf6OYFgBr6RSSaY0 wr+slLbf0XzNIwDDR2cMX80iiwTvCVCDtgrS7ZrD7Y4ewSeYtcaLPgx4OI9JKJLJaaxG S98tQsWdm0Z56SKBeUFWuXz+01gnj7cSaFYJukm0k+mznwiP957NK9iJugoGlk3N0eKD kXGA== X-Gm-Message-State: AOJu0Yzp1WuUQUsQyZcGufMCHbEWalnuT20eX1MReqjREGdpK5xKsagN FoX4I6Dj3666PTGhJh8ggSE= X-Received: by 2002:a05:6512:280b:b0:50b:d764:64c0 with SMTP id cf11-20020a056512280b00b0050bd76464c0mr1188134lfb.117.1701447922712; Fri, 01 Dec 2023 08:25:22 -0800 (PST) Received: from mobilestation ([178.176.56.174]) by smtp.gmail.com with ESMTPSA id i15-20020a056512340f00b0050bc303f3cbsm232121lfr.173.2023.12.01.08.25.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 08:25:22 -0800 (PST) Date: Fri, 1 Dec 2023 19:25:19 +0300 From: Serge Semin To: Maxime Chevallier Cc: Andrew Lunn , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Tomer Maimon , davem@davemloft.net, avifishman70@gmail.com, venture@google.com, openbmc@lists.ozlabs.org, robh+dt@kernel.org, tali.perry1@gmail.com, mcoquelin.stm32@gmail.com, edumazet@google.com, joabreu@synopsys.com, joel@jms.id.au, krzysztof.kozlowski+dt@linaro.org, peppe.cavallaro@st.com, j.neuschaefer@gmx.net, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, benjaminfair@google.com Subject: Re: [Linux-stm32] [PATCH v1 2/2] net: stmmac: Add NPCM support Message-ID: References: <6aeb28f5-04c2-4723-9da2-d168025c307c@lunn.ch> <9ad42fef-b210-496a-aafc-eb2a7416c4df@lunn.ch> <25d0c091-3dce-4d62-a112-c82106809c65@lunn.ch> <20231130213441.032a661c@device.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231130213441.032a661c@device.home> X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 howler.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 (howler.vger.email [0.0.0.0]); Fri, 01 Dec 2023 08:25:38 -0800 (PST) Hi Maxime On Thu, Nov 30, 2023 at 09:34:41PM +0100, Maxime Chevallier wrote: > Hello, > > On Thu, 30 Nov 2023 22:59:32 +0300 > Serge Semin wrote: > > > On Thu, Nov 30, 2023 at 06:26:13PM +0100, Andrew Lunn wrote: > > > > I will check with the xpcs maintainer how can we add indirect access > > > > to the xpcs module. > > > > > > https://elixir.bootlin.com/linux/latest/source/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c#L449 > > > > > > It creates a regmap for the memory range. On top of that it creates an > > > MDIO bus. You can then access the PCS in the normal way. > > > > Actually Synopsys DW XPCS can be synthesized with two types of the CSR > > interfaces: > > 1. MDIO: device looks as a normal MDIO device. This option is currently > > supported by the STMMAC MDIO driver. > > 2. MCI/APB3: device MMD CSRs are directly (all CSRs are visible) or > > indirectly (paged-base access) accessible over the system memory bus. > > > > In addition to the above XPCS device can be equipped with separate > > clock sources (at least to feed the MCI or APB3 interface) and may > > have dedicated IRQ line to signal various events like link > > establishing, failures, etc. From that perspective XPCS in both cases > > looks as a normal platform device for which would be better to have a > > special DT-node defined with all those resources supplied. Then the > > XPCS DT-node could be passed to the DW MAC DT-node via the already > > standardized "pcs-handle" DT-property. > > To my understanding, this should work, there's another PCS that works > this way : > https://elixir.bootlin.com/linux/v6.7-rc3/source/drivers/net/pcs/pcs-rzn1-miic.c It is similar to that, but since DW XPCS can reside on the normal MDIO bus and in the system memory I took a liberty to implement the DW XPCS MCI/APB3 interface support in the framework of the MDIO subsystem, especially seeing Synopsys call them just "Management Interfaces", the MMD CSRs can be indirectly accessible and since potentially there can be more than one XPCS device on the same MCI/APB3 bus. > > Are you still able to use the mdio-regmap glue that Andrew mentioned, > to avoid the duplication between the mdio and mmio register accesses ? Andrew cited the glue code using the Lynx PCS driver. In my case it's DW XPCS driver. In anycase my patchset is designed in a way so not to break (hopefully) the current DW XPCS driver users (STMMAC Eth for sure, WangSun XGBE, SJA1105 DSA). So it will be still possible to create a dedicated MDIO bus (using mdio-regmap API too) with the XPCS device being detectable on it. -Serge(y) > > Maxime