From patchwork Thu Jun 7 09:20:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangbo Lu X-Patchwork-Id: 10451511 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C593D60375 for ; Thu, 7 Jun 2018 09:25:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B4CBD29C00 for ; Thu, 7 Jun 2018 09:25:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A985429CAE; Thu, 7 Jun 2018 09:25:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4D83E29C00 for ; Thu, 7 Jun 2018 09:25:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=WiqRbd5MLqqjCE33xIcyrGC/0dfVhfiMLUKpH4OLztY=; b=JcrvS7ZdEhK6IQHSKpzt4Pr/B8 QeUMAM3Qm4RUwNcymnUyOR2XxgQPCrR5I10JrETk/tT5SDnp9rTp3KcUhDewp/X3E/ZILIKy1Dmej 7Lh1TNBCMJZNO3Ek5oQgBmb+1xTsTRAL+5p00An64oicpED4cEASe7M9GabjLGD6TGGw14oxNb6x5 c7UijTDjKRjv8aH3+dj573QJYFsM1uT17QZql8jC38/CeCB6ir5vjiQHsVkVxVml1DNPVaS4fChQG z+6a1T56ByE/M1/ic041/dGvqPvSCDRy3VdJTzcaH1XCobbWxYRIp3CMQ5AqwzRxbBCGsSQVy8+X0 hE2tSNqQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fQrA5-00023h-VS; Thu, 07 Jun 2018 09:24:53 +0000 Received: from inva020.nxp.com ([92.121.34.13]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fQr89-00011t-OG for linux-arm-kernel@lists.infradead.org; Thu, 07 Jun 2018 09:23:09 +0000 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 6D4961A02FF; Thu, 7 Jun 2018 11:22:45 +0200 (CEST) Received: from smtp.na-rdc02.nxp.com (inv1260.us-phx01.nxp.com [134.27.49.11]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 2BA351A008B; Thu, 7 Jun 2018 11:22:45 +0200 (CEST) Received: from az84smr01.freescale.net (az84smr01.freescale.net [10.64.34.197]) by inv1260.na-rdc02.nxp.com (Postfix) with ESMTP id 9488E40A70; Thu, 7 Jun 2018 02:22:44 -0700 (MST) Received: from titan.ap.freescale.net ([10.192.208.233]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id w579MJ4n020959; Thu, 7 Jun 2018 02:22:41 -0700 From: Yangbo Lu To: netdev@vger.kernel.org, madalin.bucur@nxp.com, Richard Cochran , Rob Herring , Shawn Guo , "David S . Miller" Subject: [v3, 07/10] fsl/fman_port: support getting timestamp Date: Thu, 7 Jun 2018 17:20:47 +0800 Message-Id: <20180607092050.46128-8-yangbo.lu@nxp.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180607092050.46128-1-yangbo.lu@nxp.com> References: <20180607092050.46128-1-yangbo.lu@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180607_022253_950990_333ED031 X-CRM114-Status: GOOD ( 10.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Yangbo Lu MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch is to add fman_port_get_tstamp() interface to get timestamp. Signed-off-by: Yangbo Lu --- Changes for v2: - None. Changes for v3: - Moved endianness conversion from dpaa to fman API. --- drivers/net/ethernet/freescale/fman/fman_port.c | 12 ++++++++++++ drivers/net/ethernet/freescale/fman/fman_port.h | 2 ++ 2 files changed, 14 insertions(+), 0 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman_port.c b/drivers/net/ethernet/freescale/fman/fman_port.c index ce6e24c..dce860d 100644 --- a/drivers/net/ethernet/freescale/fman/fman_port.c +++ b/drivers/net/ethernet/freescale/fman/fman_port.c @@ -1731,6 +1731,18 @@ int fman_port_get_hash_result_offset(struct fman_port *port, u32 *offset) } EXPORT_SYMBOL(fman_port_get_hash_result_offset); +int fman_port_get_tstamp(struct fman_port *port, const void *data, u64 *tstamp) +{ + if (port->buffer_offsets.time_stamp_offset == ILLEGAL_BASE) + return -EINVAL; + + *tstamp = be64_to_cpu(*(u64 *)(data + + port->buffer_offsets.time_stamp_offset)); + + return 0; +} +EXPORT_SYMBOL(fman_port_get_tstamp); + static int fman_port_probe(struct platform_device *of_dev) { struct fman_port *port; diff --git a/drivers/net/ethernet/freescale/fman/fman_port.h b/drivers/net/ethernet/freescale/fman/fman_port.h index e86ca6a..9dbb69f 100644 --- a/drivers/net/ethernet/freescale/fman/fman_port.h +++ b/drivers/net/ethernet/freescale/fman/fman_port.h @@ -153,6 +153,8 @@ int fman_port_cfg_buf_prefix_content(struct fman_port *port, int fman_port_get_hash_result_offset(struct fman_port *port, u32 *offset); +int fman_port_get_tstamp(struct fman_port *port, const void *data, u64 *tstamp); + struct fman_port *fman_port_bind(struct device *dev); #endif /* __FMAN_PORT_H */