From patchwork Tue Jun 18 21:36:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Voon, Weifeng" X-Patchwork-Id: 1117923 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45SpyV20qsz9sPS for ; Tue, 18 Jun 2019 23:36:34 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729569AbfFRNga (ORCPT ); Tue, 18 Jun 2019 09:36:30 -0400 Received: from mga07.intel.com ([134.134.136.100]:21689 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729253AbfFRNgY (ORCPT ); Tue, 18 Jun 2019 09:36:24 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Jun 2019 06:36:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,389,1557212400"; d="scan'208";a="164705654" Received: from wvoon-ilbpg2.png.intel.com ([10.88.227.88]) by orsmga006.jf.intel.com with ESMTP; 18 Jun 2019 06:36:21 -0700 From: Voon Weifeng To: "David S. Miller" , Maxime Coquelin Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jose Abreu , Giuseppe Cavallaro , Andrew Lunn , Florian Fainelli , Alexandre Torgue , Vinicius Costa Gomes , Ong Boon Leong , Voon Weifeng Subject: [RFC net-next 5/5] net: stmmac: Set TSN HW tunable after tsn setup Date: Wed, 19 Jun 2019 05:36:18 +0800 Message-Id: <1560893778-6838-6-git-send-email-weifeng.voon@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1560893778-6838-1-git-send-email-weifeng.voon@intel.com> References: <1560893778-6838-1-git-send-email-weifeng.voon@intel.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org TSN HW tunable data for PTP Time Offset Value(PTOV), Current Time Offset Value(CTOV) and Time Interval Shift Amount(TILS) are added as platform data. These platform data are set after tsn setup. Signed-off-by: Voon Weifeng --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 16 ++++++++++++++++ include/linux/stmmac.h | 3 +++ 2 files changed, 19 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index a443c42fa58b..d3ce86abdc69 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -2533,6 +2533,22 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp) /* Setup for TSN capability */ dwmac_tsn_setup(priv->ioaddr); + /* Set TSN HW tunable */ + if (priv->plat->ptov) + stmmac_set_tsn_hwtunable(priv, priv->ioaddr, + TSN_HWTUNA_TX_EST_PTOV, + &priv->plat->ptov); + + if (priv->plat->ctov) + stmmac_set_tsn_hwtunable(priv, priv->ioaddr, + TSN_HWTUNA_TX_EST_CTOV, + &priv->plat->ctov); + + if (priv->plat->tils) + stmmac_set_tsn_hwtunable(priv, priv->ioaddr, + TSN_HWTUNA_TX_EST_TILS, + &priv->plat->tils); + return 0; } diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index d4a90f48e49b..792aa8b3e138 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -176,5 +176,8 @@ struct plat_stmmacenet_data { int mac_port_sel_speed; bool en_tx_lpi_clockgating; int has_xgmac; + unsigned int ptov; + unsigned int ctov; + unsigned int tils; }; #endif