From patchwork Fri May 6 22:42:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Lemon X-Patchwork-Id: 12841705 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF011C433F5 for ; Fri, 6 May 2022 22:42:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376562AbiEFWp6 (ORCPT ); Fri, 6 May 2022 18:45:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355448AbiEFWp5 (ORCPT ); Fri, 6 May 2022 18:45:57 -0400 Received: from smtp2.emailarray.com (smtp.emailarray.com [69.28.212.198]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBE2961600 for ; Fri, 6 May 2022 15:42:12 -0700 (PDT) Received: (qmail 38834 invoked by uid 89); 6 May 2022 22:42:11 -0000 Received: from unknown (HELO localhost) (amxlbW9uQGZsdWdzdmFtcC5jb21AMTc0LjIxLjE0NC4yOQ==) (POLARISLOCAL) by smtp2.emailarray.com with SMTP; 6 May 2022 22:42:11 -0000 From: Jonathan Lemon To: andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, f.fainelli@gmail.com, bcm-kernel-feedback-list@broadcom.com Cc: netdev@vger.kernel.org, kernel-team@fb.com, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, lasse@timebeat.app, clk@fb.com Subject: [PATCH net-next v4 0/2] Broadcom PTP PHY support Date: Fri, 6 May 2022 15:42:08 -0700 Message-Id: <20220506224210.1425817-1-jonathan.lemon@gmail.com> X-Mailer: git-send-email 2.34.3 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This adds PTP support for the Broadcom PHY BCM54210E (and the specific variant BCM54213PE that the rpi-5.15 branch uses). This has only been tested on the RPI CM4, which has one port. There are other Broadcom chips which may benefit from using the same framework here, although with different register sets. v3->v4: Squash bcm-phy-lib.h and broadcom.c changes into one patch Reorder so the main patch shows up first. v2->v3: Rearrange patches so they apply in order Use ERR_CAST v1->v2: Squash Kconfig into main patch Move config checks into bcm-phy-lib.h Fix delta_ns calculations in adjtime Uppercase mode selector macros Only use NSE_INIT when necessary Remove the inserted Broadcom RX timestamp from the PTP packet Add perout (chip generated) and fsync out (timer generated) Remove PHY_ID_BCM54213PE special casing (needed for rpi tree) Thanks to Lasse Johnsen for pointing out that the chip's periodic output generation isn't sync'd to any time base. Jonathan Lemon (2): net: phy: broadcom: Add PTP support for some Broadcom PHYs. net: phy: broadcom: Add Broadcom PTP hooks to bcm-phy-lib drivers/net/phy/Kconfig | 10 + drivers/net/phy/Makefile | 1 + drivers/net/phy/bcm-phy-lib.h | 14 + drivers/net/phy/bcm-phy-ptp.c | 869 ++++++++++++++++++++++++++++++++++ drivers/net/phy/broadcom.c | 23 +- 5 files changed, 913 insertions(+), 4 deletions(-) create mode 100644 drivers/net/phy/bcm-phy-ptp.c