From patchwork Fri May 7 08:57:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Y.b. Lu" X-Patchwork-Id: 432470 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03CFEC433B4 for ; Fri, 7 May 2021 08:48:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C55B3613CE for ; Fri, 7 May 2021 08:48:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236448AbhEGIs6 (ORCPT ); Fri, 7 May 2021 04:48:58 -0400 Received: from inva020.nxp.com ([92.121.34.13]:59752 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236426AbhEGIsu (ORCPT ); Fri, 7 May 2021 04:48:50 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id F3AB41A19C3; Fri, 7 May 2021 10:47:48 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 4F2FF1A19CD; Fri, 7 May 2021 10:47:46 +0200 (CEST) Received: from localhost.localdomain (mega.ap.freescale.net [10.192.208.232]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id A395740326; Fri, 7 May 2021 10:47:42 +0200 (CEST) From: Yangbo Lu To: netdev@vger.kernel.org Cc: Yangbo Lu , "David S . Miller" , Richard Cochran , Claudiu Manoil , Jakub Kicinski Subject: [net-next 4/6] enetc_ptp: support ptp virtual clock Date: Fri, 7 May 2021 16:57:54 +0800 Message-Id: <20210507085756.20427-5-yangbo.lu@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210507085756.20427-1-yangbo.lu@nxp.com> References: <20210507085756.20427-1-yangbo.lu@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Add support for ptp virtual clock. Signed-off-by: Yangbo Lu --- drivers/net/ethernet/freescale/enetc/enetc_ptp.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ptp.c b/drivers/net/ethernet/freescale/enetc/enetc_ptp.c index bc594892507a..52de736df800 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_ptp.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_ptp.c @@ -10,6 +10,16 @@ int enetc_phc_index = -1; EXPORT_SYMBOL(enetc_phc_index); +struct ptp_vclock_cc ptp_qoriq_vclock_cc = { + .cc.read = ptp_qoriq_clock_read, + .cc.mask = CYCLECOUNTER_MASK(64), + .cc.shift = 28, + .cc.mult = (1 << 28), + .refresh_interval = (HZ * 60), + .mult_num = (1 << 6), + .mult_dem = 15625, +}; + static struct ptp_clock_info enetc_ptp_caps = { .owner = THIS_MODULE, .name = "ENETC PTP clock", @@ -24,6 +34,7 @@ static struct ptp_clock_info enetc_ptp_caps = { .gettime64 = ptp_qoriq_gettime, .settime64 = ptp_qoriq_settime, .enable = ptp_qoriq_enable, + .vclock_cc = &ptp_qoriq_vclock_cc, }; static int enetc_ptp_probe(struct pci_dev *pdev,