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: 158736 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp319917vqb; Thu, 26 Oct 2023 19:57:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHHWUD1kbwmkh07w/pkcqt9lDAFvY1kExAtKraX1ix3TQHK6KavWfJ5zSxd50PcSmYCEjX3 X-Received: by 2002:a81:b389:0:b0:5a7:c8f3:de4b with SMTP id r131-20020a81b389000000b005a7c8f3de4bmr1465112ywh.8.1698375435004; Thu, 26 Oct 2023 19:57:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698375434; cv=none; d=google.com; s=arc-20160816; b=SJcgKihnf5LOo4auR2Wkf67gCJzTaK9oa5C2lB4y2T9DBZSy8tF4LAuq8AISD1Nx7p kVKAfWnNerfOnks7HL0G3ZpqHpX895JU2DtoBMmf4o2gGzqIFBhCww0ecX3gBv8D+gKr HhsoiVHN5JHV/ORJq3xF/OnXcVnVrWHvawgBAXN7RdcBMAGNmZC8HXMz77s5QWFesIdc 8TTUdhP5zWEPqTFOYMvcrEGTGimNAGXK74qV2DIEzd0CWSpFohhF7PMnLTfbjLhu/+Rc n0+iuZT4tcQrCCQzscdxamO22hptmKKgDYdjuVtfP1dIRCB4zpgYgg+PknjWe11Ffl3Y Tzqg== 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=LDZeSNoT/F6uceX8xPaWwPCrqzVzl/F9opDYqP7fPJg=; fh=fQUSHtvtXnlA2TWsE6ApI99mIWtCUlG6e9KAZsNxWx4=; b=CFGnEJZZSv5IQINeyCOsEyqyEDw3dksm53ObVBaNlmAtxrK14Q5rJEMDgelocbedjj uggGL+uG2fvSrgIbbdpqePuloGlPuYUdIWZi8xUT9VJS8kV6YMwZ7wTdiDZ77qkewxAI Ccq/8wwoCo9h6Lu5yoz4G7gQuIvvcoaVtmwYr/35NnNiATzpwS5l9zIaadAir3th5Jpt 9BKGGXzlQaKbwlzykfTXd+B4k0JegZKLtae1rCZwo+HVSsAJB13SzykOs9nr+T4xr92Y Sm1ZPimrW5ex06moDNRxlfzpY6gZlomY7Wy2GtL9omNdEr39u8wETmeMJP+yljtlEoNx RaMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=lv46pZwI; 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id g67-20020a0df646000000b0059c2412e526si1027316ywf.468.2023.10.26.19.57.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 19:57:14 -0700 (PDT) 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=lv46pZwI; 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 9D70F82D1A97; Thu, 26 Oct 2023 19:57:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345189AbjJ0C5A (ORCPT + 26 others); Thu, 26 Oct 2023 22:57:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbjJ0C46 (ORCPT ); Thu, 26 Oct 2023 22:56:58 -0400 Received: from mail-oa1-x33.google.com (mail-oa1-x33.google.com [IPv6:2001:4860:4864:20::33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A130129; Thu, 26 Oct 2023 19:56:56 -0700 (PDT) Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-1e9d3cc6e7aso997529fac.2; Thu, 26 Oct 2023 19:56:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698375415; x=1698980215; 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=LDZeSNoT/F6uceX8xPaWwPCrqzVzl/F9opDYqP7fPJg=; b=lv46pZwIs5MU/Tq1hR90liS7lPOwKAK2cOWtOdt82RlyRayp7exQ/o/lc/+5WfPbdb CJ0LOQkWYn6MuFUFL+NkchQ11aNU+M7fatURhkqV/cKArQqI08I7FcKvceJplnu6Ow6H bK7RaGk/iJG34AadzYHSkNeCKUxLaVV/0uoZvFHCKGaH+ch8f+J+WmWCaKW7jo1O6z9y hlGzIxb8560vsmnakGF/G/0L14/1Eu4E+UY1HEFuyDW3z/pOsO3gt0+v7La7aN9iOnL4 5FxI5GjRLYJM9DsgSb7LWzQOr0cSMNPjJakeKdgfNAh7W2MtI8oOgsc0KKXClTRPDhKo zQNg== 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=Bk+x7hGLMkyVNg6yv7lG3CCBF4ddIGpGEiRF5ehprOBXtRToCIoTuV02WVw0N8iQPt Tpx28dWcjr20DelOmi92Ub3G70UkkMywgi7IGv7ZRL6ZQodF2cqzSXdtQmIg1hIrUWLf Oq/DhtY7yNuj990yPyfVrFBH5IYtAq23Jrgap+2foVwGPuh10xXbkkkQlXohwACfR3Hw ZUtttWEAQ26lNLLvvlg9gUcZ6TZF0q88j2eFgng92fmdip9DvVSzhl3eeP4azdHbVzh+ MISuZGbvlqBrygZivPpm4G/TomJGuvMFIyfTg285M1r+cwKRJXlBHqyZP+30XflR35KI E3Aw== X-Gm-Message-State: AOJu0YyhjPS0Ji5NdZeUl+B0osVDyu24VvyRcyX3Ptqr3jqdSXO3N7n9 UefFOYM3rM2kS4M91fK+UKSLkQR8cw0= 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-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 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]); Thu, 26 Oct 2023 19:57:12 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780875720086701556 X-GMAIL-MSGID: 1780875720086701556 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));