From patchwork Mon Jan 2 05:04:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arun Ramadoss X-Patchwork-Id: 3451 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4018096wrt; Sun, 1 Jan 2023 21:06:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXtKOO8W6qK4Povt2bTx55dOtXfVRbdCa5wqMk2Ke0V/CXfQ87UIvv3VBBZ6nqBGkOIIwbLJ X-Received: by 2002:a17:907:a407:b0:84c:7974:8a73 with SMTP id sg7-20020a170907a40700b0084c79748a73mr19478750ejc.57.1672635976892; Sun, 01 Jan 2023 21:06:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672635976; cv=none; d=google.com; s=arc-20160816; b=nOjdYpsD3RJ87/M0tOfBcrv/bJhl3V+S1CPtTtXo2WWa+BQlYsjPlDBdwGqqkZ512J fB0JTxZN21YVnK8OAZJweipx9luyRq0rcSEvXxW+FqLsnifoOG7dMJnQJwRaauf4f6Fe CSrgp346zBVZaKJlotxTLN8YV97oVc1tt7m9Z9m8S4mwwOwYlv+T74LHDB9PAwxzPCKB VgAe+I9fV//RAB095TQCnb9+H+X9bNJRDNmqeS5N9sZbZonZR0e4yeWXqVaL2m1dU6Zl GuWePSCbZkHnKMCrXAXcpmCUy3/hgQpbLFS3FFjgr7X9ht+3HIeXWppXMglMXYL5OTBV ufaQ== 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=DZKoCT7etaHIsurTRgMkNCuLhmINkGv5s1qXKGsGMWg=; b=mQMvAHht6WgEz0DDICY5zdXWXUdJcCQW4FK3cV2Xu8StSox/4mHRJg5o+DGQ9V3sSi FzaXofgnRkZGnceY/mkTuByH+YVGb446u4LVHwa5WwGgihUy5kfQgoCE/4ecIhFM0gY3 GFyB61ygB5vKVMfxKkw74uVxa3I1E9Cf9D5tWc50YZqRbepGfcQz5a/HYho7pD89c307 opWJDLf6B5a3UB01xlMkk3gMoztbSrcX8uoJQBaHHegLYYumaCdsTAKj08jQUWxjyDL7 9PpekzzdlZWI3GVa64aURP0NrcWlGPpP077KMm1OQhsv13ASUe4QZW5f4p018l4U4kAy yz/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=aEFiHdJS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n13-20020a05640205cd00b0047d1cac0428si26790122edx.502.2023.01.01.21.05.53; Sun, 01 Jan 2023 21:06:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=aEFiHdJS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229742AbjABFFT (ORCPT + 99 others); Mon, 2 Jan 2023 00:05:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbjABFFR (ORCPT ); Mon, 2 Jan 2023 00:05:17 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82D6610BE; Sun, 1 Jan 2023 21:05:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1672635916; x=1704171916; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=jjlAa5M79d0piFAU0LsxQkG64HUyuB/bfXBIDLtDCDo=; b=aEFiHdJSaRfFztW5oKy49Oo/GPW/e11QFZ1hoKqKKd3sP4uF+E0x3eZA MdB7Uh0w4Keg8unttdMkBx6GOx8I0z9Nw/wOtKk9n1lgnmuAxANlGP9+r PxMeGDMHTpfuGj4P5Yq76/NbgQ3e+UMXrLD6OeZERorE7C3ZkxSpQsqWN p+4t9EQl1CHBetYU/KjjIgio/w1IYRgDJRL4i1eQaJJAYjbtUEZSIkQyd 1Pk6D431HCgbTYQmoyCmDGkXcbUJ+TLBUk0jC0A/sQ4asXAmRU08pmbGM 9/Xy7mcIxHcxWitF26RPSupUHZ6de2I35SIXel0AYnb19eblk8HA0xWRn Q==; X-IronPort-AV: E=Sophos;i="5.96,293,1665471600"; d="scan'208";a="195057225" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 01 Jan 2023 22:05:15 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Sun, 1 Jan 2023 22:05:14 -0700 Received: from CHE-LT-I17769U.microchip.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Sun, 1 Jan 2023 22:05:08 -0700 From: Arun Ramadoss To: , CC: , , , , , , , , , , , , , , Subject: [Patch net-next v6 00/13] net: dsa: microchip: add PTP support for KSZ9563/KSZ8563 and LAN937x Date: Mon, 2 Jan 2023 10:34:46 +0530 Message-ID: <20230102050459.31023-1-arun.ramadoss@microchip.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753885942355560221?= X-GMAIL-MSGID: =?utf-8?q?1753885942355560221?= KSZ9563/KSZ8563 and LAN937x switch are capable for supporting IEEE 1588 PTP protocol. LAN937x has the same PTP register set similar to KSZ9563, hence the implementation has been made common for the KSZ switches. KSZ9563 does not support two step timestamping but LAN937x supports both. Tested the 1step & 2step p2p timestamping in LAN937x and p2p1step timestamping in KSZ9563. This patch series is based on the Christian Eggers PTP support for KSZ9563. Applied the Christian patch and updated as per the latest refactoring of KSZ series code. The features added on top are PTP packet Interrupt implementation based on nested handler, LAN937x two step timestamping and programmable per_out pins. Link: https://www.spinics.net/lists/netdev/msg705531.html Patch v5 -> v6 - Rebased to latest net-next and renamed from RFC to patch net-next. Patch v4 -> v5 - Replaced irq_domain_add_simple with irq_doamin_add_linear - Used the helper diff_by_scaled_ppm() for adjfine. Patch v3 -> v4 - removed IRQF_TRIGGER_FALLING from the request_threaded_irq of ptp msg - addressed review comments on patch 10 periodic output - added sign off in patch 6 & 9 - reverted to set PTP_1STEP bit for lan937x which is missed during v3 regression Patch v2-> v3 - used port_rxtstamp for reconstructing the absolute timestamp instead of tagger function pointer. - Reverted to setting of 802.1As bit. Patch v1 -> v2 - GPIO perout enable bit is different for LAN937x and KSZ9x. Added new patch for configuring LAN937x programmable pins. - PTP enabled in hardware based on both tx and rx timestamping of all the user ports. - Replaced setting of 802.1AS bit with P2P bit in PTP_MSG_CONF1 register. RFC v2 -> Patch v1 - Changed the patch author based on past patch submission - Changed the commit message prefix as net: dsa: microchip: ptp Individual patch changes are listed in correspondig commits. RFC v1 -> v2 - Added the p2p1step timestamping and conditional execution of 2 step for LAN937x only. - Added the periodic output support Arun Ramadoss (5): net: dsa: microchip: ptp: add 4 bytes in tail tag when ptp enabled net: dsa: microchip: ptp: enable interrupt for timestamping net: dsa: microchip: ptp: add support for perout programmable pins net: dsa: microchip: ptp: lan937x: add 2 step timestamping net: dsa: microchip: ptp: lan937x: Enable periodic output in LED pins Christian Eggers (8): net: dsa: microchip: ptp: add the posix clock support net: dsa: microchip: ptp: Initial hardware time stamping support net: dsa: microchip: ptp: manipulating absolute time using ptp hw clock net: ptp: add helper for one-step P2P clocks net: dsa: microchip: ptp: add packet reception timestamping net: dsa: microchip: ptp: add packet transmission timestamping net: dsa: microchip: ptp: move pdelay_rsp correction field to tail tag net: dsa: microchip: ptp: add periodic output signal MAINTAINERS | 1 + drivers/net/dsa/microchip/Kconfig | 11 + drivers/net/dsa/microchip/Makefile | 5 + drivers/net/dsa/microchip/ksz_common.c | 44 +- drivers/net/dsa/microchip/ksz_common.h | 48 + drivers/net/dsa/microchip/ksz_ptp.c | 1191 +++++++++++++++++++++++ drivers/net/dsa/microchip/ksz_ptp.h | 86 ++ drivers/net/dsa/microchip/ksz_ptp_reg.h | 142 +++ include/linux/dsa/ksz_common.h | 53 + include/linux/ptp_classify.h | 71 ++ net/dsa/tag_ksz.c | 213 +++- 11 files changed, 1847 insertions(+), 18 deletions(-) create mode 100644 drivers/net/dsa/microchip/ksz_ptp.c create mode 100644 drivers/net/dsa/microchip/ksz_ptp.h create mode 100644 drivers/net/dsa/microchip/ksz_ptp_reg.h create mode 100644 include/linux/dsa/ksz_common.h base-commit: c183e6c3ec342624c43269c099050d01eeb67e63