Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3110726ybb; Mon, 30 Mar 2020 21:16:46 -0700 (PDT) X-Google-Smtp-Source: ADFU+vufjwrSfdZGRtzqfQ9T9YYD/wTdtiLvwFshnx2C1vQQJohgaXwtlqZnqpfo4gqznbMZqeLp X-Received: by 2002:a9d:19ca:: with SMTP id k68mr11914759otk.232.1585628206534; Mon, 30 Mar 2020 21:16:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585628206; cv=none; d=google.com; s=arc-20160816; b=nGIpZwOX4H1O0LVH5HMKuDERUb+yZCVzbpYTASxcfwIJrd1uqVu1kozLfsa+0HmHf4 THoh0cTWlZ2IC+fkKABvka0pjWfbhQ8XxiinI0K1Z+AI9YTZNp1INaXgfBvbGdcuyT8m yAEiqNhGMX8piYrtFOJ399cb7TOmjsLi+zUjd61RDaHPdCummVYumd5molN8Fogv9MC1 9+eU6Z99AOaNuzaMmzE2xDvKLUwrgKeIHpou4MCvPZu/xPpKkRbJqlLU9mM2Vw686gTc HORr4+kl+5M20S7csWXOu6/i24FQF0tEeBnr72C0/Li9QiRQ++kCdAhYu1yrD/g9VJzu W5Kw== 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; bh=jAIYEWYwxF2M9nHv/jwSqzWpSHJBEoxWwgL8dRWfNtw=; b=uAcQ55Gpo7biXeU3GE6VmUjN+FX7xhR/qeWc3BZEhHlFiUhQEXgZjfCUEj9D4UBoSg Xln0uwebMi+aJpQqlVDWJKFRyQ+9KDE0jOstigvmACzZaG5LHJi9APvYOx6AibaAIuqM 0PSlIgJgC2VxgSc18nvsjALB9Pq5g4wPFevQUzCiKSraGI7liNz7PeKIRvlxkhwwJ2H3 ZS/rdQ5fMphDwyxx7X0fAH6vA8JYEsKkfeJURI+sikUNF2RpXlWINCl1CI5JQJ/DT7gv ICiE/Yf23YZxZsFENmQgz/UGCt/K5K78NvxKxlOf3uF3vF29MpDmuSt1Ch1ejie/GjqY ssjg== 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 m1si3901352ote.308.2020.03.30.21.16.33; Mon, 30 Mar 2020 21:16:46 -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 S1726475AbgCaEPH (ORCPT + 99 others); Tue, 31 Mar 2020 00:15:07 -0400 Received: from inva021.nxp.com ([92.121.34.21]:46664 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725792AbgCaEPG (ORCPT ); Tue, 31 Mar 2020 00:15:06 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 1583A2007AF; Tue, 31 Mar 2020 06:15:05 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id D4BCF2007A6; Tue, 31 Mar 2020 06:14:58 +0200 (CEST) Received: from localhost.localdomain (mega.ap.freescale.net [10.192.208.232]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 04A0F402AA; Tue, 31 Mar 2020 12:14:50 +0800 (SGT) From: Yangbo Lu To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Yangbo Lu , "David S . Miller" , Richard Cochran , Vladimir Oltean , Claudiu Manoil , Andrew Lunn , Vivien Didelot , Florian Fainelli , Alexandre Belloni , Microchip Linux Driver Support Subject: [v2, 2/7] net: mscc: ocelot: fix timestamp info if ptp clock does not work Date: Tue, 31 Mar 2020 12:11:08 +0800 Message-Id: <20200331041113.15873-3-yangbo.lu@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200331041113.15873-1-yangbo.lu@nxp.com> References: <20200331041113.15873-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 The timestamp info should be only software timestamp capabilities if ptp clock does not work. Signed-off-by: Yangbo Lu --- Changes for v2: - None. --- drivers/net/ethernet/mscc/ocelot.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index 6cfd6dc..bd6692a 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -1346,6 +1346,12 @@ int ocelot_get_ts_info(struct ocelot *ocelot, int port, { info->phc_index = ocelot->ptp_clock ? ptp_clock_index(ocelot->ptp_clock) : -1; + if (info->phc_index == -1) { + info->so_timestamping |= SOF_TIMESTAMPING_TX_SOFTWARE | + SOF_TIMESTAMPING_RX_SOFTWARE | + SOF_TIMESTAMPING_SOFTWARE; + return 0; + } info->so_timestamping |= SOF_TIMESTAMPING_TX_SOFTWARE | SOF_TIMESTAMPING_RX_SOFTWARE | SOF_TIMESTAMPING_SOFTWARE | -- 2.7.4