From patchwork Fri Oct 27 02:56:03 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: 13438075 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 BF9EBC25B48 for ; Fri, 27 Oct 2023 02:57:32 +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=MtS73AVnAQb2JnrV9zrZ1R1mP4+Zcbg0x6ExvhPX9cc=; b=wnbNYcRnFBxL62 2NX9WsmHcCxoCm5VPZTFofyielwSF6zJWLJYYy+iuh0/7d+VWuV0nxzHeK/bK8ccxuXTb14uv8z4a s/c609A0BtXwB03ITRk6WGeD+RB89L9jytp3V1UGdZhrfWG9JikTfG/APdKc/KsrA8J/02XBEqvV6 3kW6JNLyOSkCi+8q6i6AYoNZJvAG9Ahs2zRa42ukMbglmoj8FNJBDWQ+pNNhTblpbYFwyEClO6H9J T6X6Xiq7epU/VfawZuD8UJfNxuvhay6gLnRBSG9PxioJySmE8g8+EI5VHVKk+OcQCjZqdzYdTtB1f TirMoO2EpYK8h+8BJv/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qwD20-00FTeJ-0M; Fri, 27 Oct 2023 02:57:04 +0000 Received: from mail-oa1-x30.google.com ([2001:4860:4864:20::30]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qwD1w-00FTdc-2I for linux-arm-kernel@lists.infradead.org; Fri, 27 Oct 2023 02:57:02 +0000 Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-1e9c9d181d6so1009444fac.0 for ; Thu, 26 Oct 2023 19:56:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698375415; x=1698980215; 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=LDZeSNoT/F6uceX8xPaWwPCrqzVzl/F9opDYqP7fPJg=; b=gwxrLJEzbO0N+ctTaGq/1+SD/0B/JBQtvEiCGx+XFrDRC6eseC4G9Hqn0uYh5YTjy4 +yHYZMXDH8cDXGN3yQem/FfI6/w5lNnS0yAGGxh5h65zZN6kpZIi0ibVeFjXb+/K8Co8 lv0VBLJCYZMD4DTFkJvshjq6t+vj1tHUsk/Jw1so/m83sm3XDDzAdjA69vDj+wSh+J6n rUFbA5HaPXw9j1UbEiWln1RpVJjnLNga/Jt3nEBCECbQJB8RJmsRvDVbCXRkhO9fLnxJ /wBmiXP2V3RGPo6G2ueQ3WBK/wHNmHbsWSy/26cEa9hjmdZaw3nkZ8PuCQ3dZisAUWka KWag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698375415; x=1698980215; 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=LDZeSNoT/F6uceX8xPaWwPCrqzVzl/F9opDYqP7fPJg=; b=CdpxF6MEqri1vTuvVliZwyPHIlVK360OIEUkyA9RnYi2Q0XjX8+dMf2UJ3oyYa2Nnk vJvY099pKpj2aRUPNW8sbqJPxP3AQUewFABa/24LRbcHmNRU1eV5hW4f6P6E2vWuCCO/ kYnGrgyIc+/vBZCK7IwNuH/csH4kBIF/xu62ZbEUQZRnrYFBJLlYbigN3IIXKCY6sxaS V8fvLiiCEEqBeyGI/QKBgii9VS75E4N8TN9MipBLVbPpcDHAp+IBB/wOypOz91KERzhJ e8EWnksJGoKiCfRFz1db13fXaiYFzY29RdK7tzjox6N1LFNEgBWdQxeoQcWuQP3cCtao yZMg== X-Gm-Message-State: AOJu0YzoK6L+9yyHkMWKdWWcBIsIVKVBA/0hsmPLtp4QaDICzKN9iE95 u3Rv6S+UeRgt9WPQGjStbOg= X-Google-Smtp-Source: AGHT+IGAnGmIB1mQEhtj+QsEa41nDsx78wO2RvvhhYj+HlCbTyldwYFUDGN/YyeLNRYe598RQaKFmw== X-Received: by 2002:a05:6871:4188:b0:1e9:e063:ca6b with SMTP id lc8-20020a056871418800b001e9e063ca6bmr2108233oab.32.1698375414687; Thu, 26 Oct 2023 19:56:54 -0700 (PDT) Received: from localhost.localdomain ([74.48.130.204]) by smtp.googlemail.com with ESMTPSA id z127-20020a633385000000b005b82611378bsm275339pgz.52.2023.10.26.19.56.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 19:56:54 -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 , Jacob Keller 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] net: stmmac: xgmac: Fix support for multiple Flexible PPS outputs Date: Fri, 27 Oct 2023 10:56:03 +0800 Message-Id: <20231027025603.1035668-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_195700_766036_8531C03B X-CRM114-Status: GOOD ( 13.28 ) 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 ;) Fixes: 95eaf3cd0a90 ("net: stmmac: dwxgmac: Add Flexible PPS support") Signed-off-by: Furong Xu <0x1207@gmail.com> 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));