From patchwork Thu Oct 26 09:48:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Furong Xu <0x1207@gmail.com> X-Patchwork-Id: 13437412 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8EB97C25B6B for ; Thu, 26 Oct 2023 09:49:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=o88QKFKHYfylW2wxWzZJRF2IPpFIa1yCENh00PjN3qo=; b=3/mwdHVN+hskRO HToTn6C8smB+2U5Ub1MYUv2/Dj06YXx5ytldly0iT/FGn8J519eoz3rR/7mgIhXjtNkYydQ/VaMQl 7+FCDSYqpPtA2jGeHe0qVw/6tGF6sT+qZcrLs+6IQSRJhoZPhuW6AmTsCFelhrsLFXHKMX/uGO/5j Zx9m/VUgubRKyWDC3tEr9mK+FM1ikX94ZhguLF6bcse73pPSX9D8PhMEo6mpx3hBzlipgXDSbuIOQ 4uQ8edSmz9OoH9nXnrh1+qZ4+KG2hfZmG6nx526O1vLYfvFmZrQt4DZFLUyjczzx2CBCGo0YXEJNO MW5YDqsjaiMwrSELG8mA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qvwzM-00E6jT-3A; Thu, 26 Oct 2023 09:49:16 +0000 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qvwzK-00E6iD-1y for linux-arm-kernel@lists.infradead.org; Thu, 26 Oct 2023 09:49:15 +0000 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1c9c5a1b87bso4983105ad.3 for ; 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=lists.infradead.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=OEevi1kHUEPi7v4gPyfGguERB2cczWJew7B6xPyhvhO1Eoeaxzr8s9dniryCUgdJ78 xwZ+8XGYusjUPsyWggXjc7jCVwvD/SjgygWtogNaFDlT/mPQYtLu/ZzTCbSakigvRZsj WPcwgBPiZ/89hIBZ0X4Bx+FGkrooGuXddLUGuBy44/+tHgTktNabJ7hhOjOZGpft0DJ6 k2tJxkh3jepEs/9LCCqa+TkTZy+OKz6ArLQ104G89yLXegoG8jOtyqYM/xQNUK/5/ELP a79kc5aZpsiZEpXZU2Xs1h2ihlP8kVmXGlz66Wjki6oRDsR/ZSSXL6nu2wJCkVXCRys8 WQiw== 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=hDxeMqez3qrXr2MU6LPkuIkygLS+nFFvpJnv4NpSmEvgnkgUKIHCiwyOdfauSPCk+Y L7uPBOXUgxySzCx5zr10KVvv8zwXnHo2IEEeZZqvJK+QMHGMU8RkdnsmPMI8y3XA9EiF qr5ZombvVlVvkujnobZnORxbt1q5CWzD0bOb1bqSy02hixK5dRg2XaX9FXcvNxIn43ND sb/538upnFyDXSsF1bxXixJda+wViXdL+utEo5AWPBMSQzCrCjUaUSs/++F5KBtuhe4I eaquvEH6KexFz61EoXvBs/GDlo2lNk7nEtnPGwfdxinJzhUMldTzz6YEeUDnvE1Cv4Me tOhA== X-Gm-Message-State: AOJu0YwB7Ok+x/hAAh3LEZGswGXgkT5dCZtCfuLIDwo79rkRTmEQQ5dh hhCOyu+rFdVjgMViVcX6IB8= X-Google-Smtp-Source: AGHT+IEY6OtenDK7uCoSvT5qxvLDxbjXEYrpn2zBZno+Rv6P5yQzWR32ht2pgfIh/xPY2jg4eMpn8A== 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" , Alexandre Torgue , Jose Abreu , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Joao Pinto , Simon Horman 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231026_024914_676188_0AED5420 X-CRM114-Status: GOOD ( 13.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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> Reviewed-by: Jacob Keller Reviewed-by: Serge Semin --- 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); writel(cfg->start.tv_sec, ioaddr + XGMAC_PPSx_TARGET_TIME_SEC(index));