[net-next,v1,1/1] net: stmmac: xgmac: Enable support for multiple Flexible PPS outputs
Message ID | 20231026094856.986796-1-0x1207@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp548016vqb; Thu, 26 Oct 2023 02:49:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE0q0C4pVdbjB6KxZZM+nI7d8qkUjvgP3gM7mC6vXzmALCxDAxtMSRLe44m/AuuoC5vSATr X-Received: by 2002:a81:4ac2:0:b0:59b:e449:2d51 with SMTP id x185-20020a814ac2000000b0059be4492d51mr19305422ywa.49.1698313768329; Thu, 26 Oct 2023 02:49:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698313768; cv=none; d=google.com; s=arc-20160816; b=qk2jnvkA9JWmm2mQdFZlnkcClhUbizy0VbCp5BqGg1t2Gu35sVh7YlKuJCkobbEt2Z EztsrLjDWHbAKg5I44YHR53a9X0PzJnEbNQ3hLit0Cy9TPZ/6Zd7hyaoSGnodq7iM751 wS2QgIuDkfLmTJy3kdVdGGls63SzfjJcPXP6h+0zmNODvihG85xNg+8902qWzwiEdiWD HPjgH624raqQ8S/C0J1Kqf7wspJmbaRKFR2OH3Fn7Osc5c/n42hQ/Qu52WAV5xELkTga iKGssJ3zR9LIlfXOyYPvBroh90HuJfrrTK64+1xi+K/dQEUnz3aS9P57TFVTK73WAdkD TH6A== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=trQmZAbaoRQLYbgSGHo4E3o4LgBwFck38x5wYn9EorM=; fh=lNbqm66A/wpozhFc+nLwOwrPosFlY20hAnN9jlxMS5I=; b=npU0sNOb9aA1PLQoRtPteoccAXjl+P0SGSOWuS08XsQYme4VhWWzwUjsmEcG9e7HQs jPI8AH0sWx8AfqPpejcFC9dbIW+inOftkjMuj0vVyfWDF96tIcX7VL0xcrUkuWQLe/jQ v+H+CYgSjfebPVst6uhNDtpI/ZqX3Bc4Tj1KQe/4uu46uAKozbWZ0SbbDmJuomkm3yp0 LjurElfGheV1QGxn4111iRXdYoN6WFvWyFdiE5tV26waUaDy7F3RgVjKQS8m9982qr/G 1Q6lBq61xQyXvI3noZ4HYIomXXtWFUWlqlBgc8xJ+CET+Lx9wFCBtMIaHwS8nIIdwfFN mjaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FNjiGQOf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id n1-20020a0dfd01000000b0059e8a6bd2f1si13439911ywf.533.2023.10.26.02.49.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 02:49:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FNjiGQOf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 0513C8135BE6; Thu, 26 Oct 2023 02:49:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230008AbjJZJtP (ORCPT <rfc822;aposhian.dev@gmail.com> + 26 others); Thu, 26 Oct 2023 05:49:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229611AbjJZJtO (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 26 Oct 2023 05:49:14 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F1E99D; Thu, 26 Oct 2023 02:49:12 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1cacde97002so4977745ad.2; Thu, 26 Oct 2023 02:49:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698313752; x=1698918552; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=trQmZAbaoRQLYbgSGHo4E3o4LgBwFck38x5wYn9EorM=; b=FNjiGQOfChB8nJFNbg3MbEMKsXgc1oONjFLFRsVfwYVBzwmuxkSe8Negrdo7IR7nRB R1NlgucrmrLzPnNaLNjXVr4lm30Q1ZJWU7RkJ6cqUPNuyhZHS3ZlstrJV/mUdioY8FXO 5aQs3n2PZBeB2KPtTHKBDiI1lmdSYr/tkIpCm7ZoTkZFobKgCbMhOseTVumwzqnkhFcj dGLO2J/qKgwIGWcVK2G11/+qeRqLQzjw907Bh+VWOu05Gpuk9jV4i13ha8I/BwBN2DFo sEo5Eo/7XxpiJE8nfF9b4uVleqLe8sUrQNm/A8MUpeoIXiTqw0FHFkQE81OM1rwzqdZA jAsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698313752; x=1698918552; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=trQmZAbaoRQLYbgSGHo4E3o4LgBwFck38x5wYn9EorM=; b=Z6OcUt5R0i7WA4fti9j/GbFGgg+z8cxQKCjliIyELnJA12VzN2flgDgo/aE7rUYl6F Y/DqXPHndZObiAPbcF7kLFTMJ5MgaRLCYX+6xzCivGJNp3UGudUpMqdqrEN+zT/z2RgK vG99T07GPhkA47+ADWrfMqEy3W4eSFj5CQwYvhQ5wUQgmB1hdEH03CFAFyeOFgSy7PuT VLjrBouA7Wiovbm4AWNNOo22pncF0p133eDY3YE+iXQFmSDBcTFKTvM3U1S0TeKN+ly7 KVYPIw7swgEAFqjemaKDjtVcVu8S9UWdZiz3galNEQARu77LxArp/qISw/pB0SCd3yFg +33g== X-Gm-Message-State: AOJu0YxABW5YZTSGfgKQw98/XGM5a9yAFvA/UGge5f7vdk7nlmPjc8zx Sqr8Lq1zmsjbWJC1fn8mG0I= X-Received: by 2002:a17:903:41c7:b0:1ca:b26a:9724 with SMTP id u7-20020a17090341c700b001cab26a9724mr17622651ple.12.1698313751680; Thu, 26 Oct 2023 02:49:11 -0700 (PDT) Received: from localhost.localdomain ([74.48.130.204]) by smtp.googlemail.com with ESMTPSA id ji5-20020a170903324500b001b06c106844sm10674264plb.151.2023.10.26.02.49.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 02:49:11 -0700 (PDT) From: Furong Xu <0x1207@gmail.com> To: "David S. Miller" <davem@davemloft.net>, Alexandre Torgue <alexandre.torgue@foss.st.com>, Jose Abreu <joabreu@synopsys.com>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Maxime Coquelin <mcoquelin.stm32@gmail.com>, Joao Pinto <jpinto@synopsys.com>, Simon Horman <horms@kernel.org> Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, xfr@outlook.com, rock.xu@nio.com, Furong Xu <0x1207@gmail.com> Subject: [PATCH net-next v1 1/1] net: stmmac: xgmac: Enable support for multiple Flexible PPS outputs Date: Thu, 26 Oct 2023 17:48:56 +0800 Message-Id: <20231026094856.986796-1-0x1207@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 26 Oct 2023 02:49:26 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780811057530231811 X-GMAIL-MSGID: 1780811057530231811 |
Series |
[net-next,v1,1/1] net: stmmac: xgmac: Enable support for multiple Flexible PPS outputs
|
|
Commit Message
Furong Xu
Oct. 26, 2023, 9:48 a.m. UTC
From XGMAC Core 3.20 and later, each Flexible PPS has individual PPSEN bit
to select Fixed mode or Flexible mode. The PPSEN must be set, or it stays
in Fixed PPS mode by default.
XGMAC Core prior 3.20, corresponding PPSEN bits are read-only reserved,
always set PPSEN do not make things worse ;)
Signed-off-by: Furong Xu <0x1207@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 2 +-
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Comments
On 10/26/2023 2:48 AM, Furong Xu wrote: > From XGMAC Core 3.20 and later, each Flexible PPS has individual PPSEN bit > to select Fixed mode or Flexible mode. The PPSEN must be set, or it stays > in Fixed PPS mode by default. > XGMAC Core prior 3.20, corresponding PPSEN bits are read-only reserved, > always set PPSEN do not make things worse ;) > Previous revisions the corresponding bits are always set, and don't get modified by writes, so setting these bits for all hardware has no ill effect. In the previous code we always set BIT(4), but nwo we set BIT(4+x). This won't affect XGMAC prior to 3.20, but corrects a mistake when programming the newer XGMAC. Ok. Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> The original code was added in 95eaf3cd0a90 ("net: stmmac: dwxgmac: Add Flexible PPS support"), which landed in v5.4 It looks like XGMAC Core 3.20 support was not added until possibly commit 669a55560e4b ("net: stmmac: Check more MAC HW features for XGMAC Core 3.20") which appears to be new enough that its not in any official Linux release, though it looks like it was already in net. Perhaps this should be tagged Fixes: and sent through net, hopefully to try and hit 6.6 or at least a stable release shortly after? Thanks, Jake
On Thu, Oct 26, 2023 at 05:48:56PM +0800, Furong Xu wrote: > From XGMAC Core 3.20 and later, each Flexible PPS has individual PPSEN bit > to select Fixed mode or Flexible mode. The PPSEN must be set, or it stays > in Fixed PPS mode by default. Are you sure 3.10a don't have the PPSEN flag available for all outputs too? > XGMAC Core prior 3.20, corresponding PPSEN bits are read-only reserved, > always set PPSEN do not make things worse ;) > > Signed-off-by: Furong Xu <0x1207@gmail.com> > --- > drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 2 +- > drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h > index 7a8f47e7b728..a4e8b498dea9 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h > +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h > @@ -259,7 +259,7 @@ > ((val) << XGMAC_PPS_MINIDX(x)) > #define XGMAC_PPSCMD_START 0x2 > #define XGMAC_PPSCMD_STOP 0x5 > -#define XGMAC_PPSEN0 BIT(4) > +#define XGMAC_PPSENx(x) BIT(4 + (x) * 8) > #define XGMAC_PPSx_TARGET_TIME_SEC(x) (0x00000d80 + (x) * 0x10) > #define XGMAC_PPSx_TARGET_TIME_NSEC(x) (0x00000d84 + (x) * 0x10) > #define XGMAC_TRGTBUSY0 BIT(31) > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c > index f352be269deb..53bb8f16c481 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c > +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c > @@ -1178,7 +1178,7 @@ static int dwxgmac2_flex_pps_config(void __iomem *ioaddr, int index, > > val |= XGMAC_PPSCMDx(index, XGMAC_PPSCMD_START); > val |= XGMAC_TRGTMODSELx(index, XGMAC_PPSCMD_START); > - val |= XGMAC_PPSEN0; > + val |= XGMAC_PPSENx(index); At the very least it would be nice to have a comment here that the mode selection was available for the output #0 only in the IP-cores prior v3.20a with the outputs 1-3 always working as flexible PPS outputs. Other than that no more comments: Reviewed-by: Serge Semin <fancer.lancer@gmail.com> -Serge(y) > > writel(cfg->start.tv_sec, ioaddr + XGMAC_PPSx_TARGET_TIME_SEC(index)); > > -- > 2.34.1 > >
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h index 7a8f47e7b728..a4e8b498dea9 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h @@ -259,7 +259,7 @@ ((val) << XGMAC_PPS_MINIDX(x)) #define XGMAC_PPSCMD_START 0x2 #define XGMAC_PPSCMD_STOP 0x5 -#define XGMAC_PPSEN0 BIT(4) +#define XGMAC_PPSENx(x) BIT(4 + (x) * 8) #define XGMAC_PPSx_TARGET_TIME_SEC(x) (0x00000d80 + (x) * 0x10) #define XGMAC_PPSx_TARGET_TIME_NSEC(x) (0x00000d84 + (x) * 0x10) #define XGMAC_TRGTBUSY0 BIT(31) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c index f352be269deb..53bb8f16c481 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c @@ -1178,7 +1178,7 @@ static int dwxgmac2_flex_pps_config(void __iomem *ioaddr, int index, val |= XGMAC_PPSCMDx(index, XGMAC_PPSCMD_START); val |= XGMAC_TRGTMODSELx(index, XGMAC_PPSCMD_START); - val |= XGMAC_PPSEN0; + val |= XGMAC_PPSENx(index); writel(cfg->start.tv_sec, ioaddr + XGMAC_PPSx_TARGET_TIME_SEC(index));