Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3846666imm; Mon, 25 Jun 2018 05:42:03 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI+vqpDcj2tLk3QbVYrU30FFAy/CDoNbG6RAw3Mx8srmauzXUiOOIpLXbvI1Opp1K+rAOm2 X-Received: by 2002:a63:a319:: with SMTP id s25-v6mr10644060pge.62.1529930523283; Mon, 25 Jun 2018 05:42:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529930523; cv=none; d=google.com; s=arc-20160816; b=jcm1dYd8jaxrgYUm7JQNURUeZeZwBAS7/oZq5Esz039yYAD/gWVJpW6sP4obu38aZE 9hXHM5Sqsm9gh0sqBpQtzkfKyl0odp+FMHr8Ix1bUwj5RcpYPfRE04/HvQn+ing1Cagt qT3fwR/Vk74JuuIM2UEveMnXwXFFxGpqnclUUCsiWFd0Z4mI68saGb9QrACp5m50HQZX q6S4gMyLnWTycaGZE4D2q4Hvm7/6NkVWkgmxSZykX00NN9gu+R6zoTOyCU4ZUMRwQIUu yhyHxOYW0XJ9wvS++9OwtbMxYnpoR9WNQM/Bwo8DO7TZlmLSLfggMbvXEvqKykBxhrjd cp4g== 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=kyVYera5TcwZlabS03EkDI5m2vxfly8M5wqZG4hLsRI=; b=m1gN1GY5cAvGfGvpRVSBMqZHy8sH32+0b+iOIe63HmePogjoRfyOFPdQ5JYtigM7MI K6TzUez0J2Z3mItYaF6ZWjgCSi6B7NHzHkagkO56UyknAJz0k4WXPEw77zZOdeSGosQv AgxI7GjGvLnlpY2FmQQFbsatCD9mpiwsa/jqJ8/56tQpMbtum0l5MtElmG5rslzi+aFz xaYGi0NF4EzLAux6hF8t+2Q3n1peRh1njkgnwZ1CuNx/c1gZL5QLuP6p24XuADN4sPmi JKcpaaRLcgMdA+aEap3IdWsqiIpG1s4azMCbIhjMASly0cduGSQJIwkJFlnV72P3cD0P VYpA== 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 m11-v6si13926456plt.284.2018.06.25.05.41.49; Mon, 25 Jun 2018 05:42:03 -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 S933998AbeFYMjd (ORCPT + 99 others); Mon, 25 Jun 2018 08:39:33 -0400 Received: from inva021.nxp.com ([92.121.34.21]:42218 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933976AbeFYMjb (ORCPT ); Mon, 25 Jun 2018 08:39:31 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 15B76200078; Mon, 25 Jun 2018 14:39:30 +0200 (CEST) Received: from smtp.na-rdc02.nxp.com (inv1260.us-phx01.nxp.com [134.27.49.11]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id CB86820000A; Mon, 25 Jun 2018 14:39:29 +0200 (CEST) Received: from az84smr01.freescale.net (az84smr01.freescale.net [10.64.34.197]) by inv1260.na-rdc02.nxp.com (Postfix) with ESMTP id 431E340A70; Mon, 25 Jun 2018 05:39:29 -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 w5PCd34S025070; Mon, 25 Jun 2018 05:39:26 -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: [v4, 07/10] fsl/fman_port: support getting timestamp Date: Mon, 25 Jun 2018 20:37:13 +0800 Message-Id: <20180625123716.28993-8-yangbo.lu@nxp.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180625123716.28993-1-yangbo.lu@nxp.com> References: <20180625123716.28993-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 Acked-by: Richard Cochran Acked-by: Madalin Bucur --- Changes for v2: - None. Changes for v3: - Moved endianness conversion from dpaa to fman API. Changes for v4: - Fixed kbuild issue. --- 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..4a2d960 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(*(__be64 *)(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