Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1974003imm; Thu, 7 Jun 2018 03:26:48 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIPFJTFxB9e74aGhb0083MK1HDHuaETbzD70hccKtFd9WHPaFYWSTGVZ0mAF7sjnOVA2MXm X-Received: by 2002:a17:902:650c:: with SMTP id b12-v6mr1462915plk.31.1528367208620; Thu, 07 Jun 2018 03:26:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528367208; cv=none; d=google.com; s=arc-20160816; b=OX1aBN+qstmSNvK9AACO5hQSvF5E0qH1qdO+xxQZJ7buOzzcs3KRSsBc+W0/zXQaHB YPrcrgnwYLLnpHPLuukFJO/J7tASu4c18VI0YgFnqcxOUoa7xBYk+HCRm+Y72232hoU2 cGgFiqdbanJb5uC7PkfrtoCIOtdQrajvRW/cAKehpJ38WRfey+rYogv1y2PgTh5/UC1t 9OgDu+Q/JN/EzEm+/TQrUniwpvxaVS9Vk9qxpcRqegC+JtG19JNPKuxth3LZVFjo4NCA ChlKwl+X8wwfpq1ial+x8FFemuxjZe5zfoWH8I8BSK7O08ppii6AlbC6plvzI6CXgYXg pB2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=uXnXIVA88SD8xDDqOY1zJPKc6tIJ8Ypw/gGNyc2zZkw=; b=ijDaJG+/aW2VcodYoLKcUisXOKVoVW0aJeOa+EP7+nAL2dULVImq4OwO3n3dzZgl9f hzp5ISgqDO3u4pyrTEAp/pUolz4yX7BPAPBx3As++e5oN/88j3W49MlRnc8SgJqNAwF7 aH3ChhwaniBASA+FZ4WN3uqsZlYJczhYag0zGdr9QsmUen3j/7tjYQnfg0OnZn83h8JU 52s47z9manS6VkC6MRArS2gaZRDUbyRrcX/sYMMvWS+vROPa0SrbLxZNx5fqFks0Ew6D zEz9r6ZKd9MSjSNjrp5eqoRNA7HZ2InpHXYi3uT3Vy/8wK9SpWNr2as7CMiBac4OgwKu Ln3w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b7-v6si20976975pgq.564.2018.06.07.03.26.33; Thu, 07 Jun 2018 03:26:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932980AbeFGJYS (ORCPT + 99 others); Thu, 7 Jun 2018 05:24:18 -0400 Received: from inva020.nxp.com ([92.121.34.13]:46320 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932878AbeFGJWr (ORCPT ); Thu, 7 Jun 2018 05:22:47 -0400 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" Cc: devicetree@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Yangbo Lu 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 */ -- 1.7.1