Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3177365ybz; Sun, 19 Apr 2020 19:56:00 -0700 (PDT) X-Google-Smtp-Source: APiQypKDPyCZjI4lJca1ITYcJeMEXIZxKrUbD86akwUzsYBJQjSLr6OSi+Rwfw4B06brXv+dYlD/ X-Received: by 2002:a17:906:2458:: with SMTP id a24mr13615394ejb.239.1587351359875; Sun, 19 Apr 2020 19:55:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587351359; cv=none; d=google.com; s=arc-20160816; b=bZvq+sV0yiiFrNl09GIAgoxW339GDznS6xR0GVBeoKT9dW0Ctb4Gx+Zw/OFZvo/lS4 8BkcUzwVTtXvITVdptJnJaCV5SKPyEUoljhvnYUke2cCJhfXN8oLUpKWnMmMKbTEkIDY Q66Sh/DOXu9mXQvR42w6ojwWpFkG1vBeija7c5/4exNqLTXFroWXX6c9CxqdNn0R8Ti5 cRWVT6IRVGMKe3Hr8BJHT6ZEe1FQ7Y/R0sxVSK0rzYJwNOurBfZMBEUNgyT6GxMtE3pC YLRiUeMu/2I0hu+RK3WH+Yv052So2QHTjJIrvoyyymdGY0pCe8bPNmAn1PEJfUMHrOW3 K68w== 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=QMlaNarznj75XYeX9X9uCpw0tIxdzShiXvKLBJml5Ok=; b=isT6hJb9RIbq/5zqebiz5YVcpkb3gpcp09hr5+Sn8JDIy55xvVjgzIKsuQVgqVvPJ/ hS1v8LLir2YX+6tkvxTENeEUUppRC0JWdjXwU4HAM1ORsUlpDtsWkzvFe5o2VodBcm/B t2LnauKGVgqn4Eyfw4DSsvrtKsWotoOoRcjcCZ6zaNVxw/EatF6QmJxtpjXUqWBPKbWm 2Pn5G47g3LHXvJxwCnE/bcw/F2RSqeRpGR7IBPG4CFhZiYMNQ6dLcH7XsO7J1S1pa5PJ tMTT0FeWv7a1zNZWhBBFF7oxfWOSWlaDS+yDjVSsALFTgKMtzijOulW/3/MEs39UOhEt Hnog== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id u2si20815264edp.321.2020.04.19.19.55.37; Sun, 19 Apr 2020 19:55:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726486AbgDTCv4 (ORCPT + 99 others); Sun, 19 Apr 2020 22:51:56 -0400 Received: from inva020.nxp.com ([92.121.34.13]:55732 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725994AbgDTCvP (ORCPT ); Sun, 19 Apr 2020 22:51:15 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id BBF541A0638; Mon, 20 Apr 2020 04:51:13 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id CFBB31A061B; Mon, 20 Apr 2020 04:51:08 +0200 (CEST) Received: from localhost.localdomain (mega.ap.freescale.net [10.192.208.232]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 5D8D3402D8; Mon, 20 Apr 2020 10:51:02 +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: [v3, 2/7] net: mscc: ocelot: fix timestamp info if ptp clock does not work Date: Mon, 20 Apr 2020 10:46:46 +0800 Message-Id: <20200420024651.47353-3-yangbo.lu@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200420024651.47353-1-yangbo.lu@nxp.com> References: <20200420024651.47353-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. Changes for v3: - 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