From patchwork Thu Dec 24 16:24:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 351929 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp7137064jai; Thu, 24 Dec 2020 08:27:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJxhqfi2JDTfrtCNS2zFgn+1xiFoy8yAVaby59EQWSmt4CiSQyHRE6dxe75sw9pM7JhwbBQp X-Received: by 2002:a05:6402:366:: with SMTP id s6mr29031731edw.44.1608827235361; Thu, 24 Dec 2020 08:27:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608827235; cv=none; d=google.com; s=arc-20160816; b=Qa2BjKrjvbwiOtm8dR4tzwDVbjl0DQx0Q5WhHu+UlQvEUYtXVLzNAHEmjs9l6+4oiG HvwUzyaLiitdWOShfKylsDI0WxsgieR6+0E+pzkJdZZQAyZw/5DtdcjKq36UpCGz4zOv 9qzzEtDlqCnbwWo8KBz99s8WU4Fw8IrACbmTDjTa7QoPNAkrCHkATaARmJW6hXAem5EV aX5qeabpeN/pp0m5xHOnyxpZfjM52oJUqmbo5nNHuuIYuKwrKx++YXLxcnp7r5NMeV3g 2R8dbDMT777MZWD55uZPi2norGHGSKeKh5GxUbIbxOsuCsS+T1Ms9upzdWgd4V0M69mt 0W8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=WMEUYGFV0NV6CnOTlVaGE190P40OrfNJJimbiz0eDZ0=; b=nbOAIfy01aMaaSGOiwst14s+KE6iKe6CM89NPvtaCjnQdFDZZS5XMTqLyFiq+EhO4X zCUyY4xh/wbRraMOtHKdx6ByGg/UPrxNBfEBzGKX5wZnvQzneW7TtlmYWYk6uo0o+L+a CsEvfgGe71UGXGLxNymFx70gyN2u+mUoKaqE/OC2TK0j2bNcZTRNO8d1epsFIs79D/yJ L5uvaTLkC2CNz9sAS8wqUkThefaqnl1MknH0gXscE0Sjwcexg00ZmI3Pua70T3E+DQi+ GdSu4smPMnnRkVxzbovVrFM1iWzGxftR0u0H+p34e4vBKKUjxK2ryoVRfkFbM9o/LxdP Nzxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=wJxrAGXZ; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cz22si15569692edb.241.2020.12.24.08.27.15; Thu, 24 Dec 2020 08:27:15 -0800 (PST) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=wJxrAGXZ; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728524AbgLXQZ4 (ORCPT + 8 others); Thu, 24 Dec 2020 11:25:56 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:38056 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727081AbgLXQZ4 (ORCPT ); Thu, 24 Dec 2020 11:25:56 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 0BOGOFew041071; Thu, 24 Dec 2020 10:24:15 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1608827055; bh=WMEUYGFV0NV6CnOTlVaGE190P40OrfNJJimbiz0eDZ0=; h=From:To:CC:Subject:Date; b=wJxrAGXZnl6XX+i4NYFZeYOHAu7jXcMC7fe2Fhglp7EcFDqPBbs9f6HDkFONXk0jH Qr30JSFw+Jl0KDrzJ9Cf/Op/h90SANNrSn6q5HGedA+g7ssW8+uCXN54rSd4GTB/m+ XT0VlVG1F31ySoN/EhR9/cmxl9y9EGUzA66m27rA= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 0BOGOFZc106349 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 24 Dec 2020 10:24:15 -0600 Received: from DFLE106.ent.ti.com (10.64.6.27) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Thu, 24 Dec 2020 10:24:14 -0600 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Thu, 24 Dec 2020 10:24:14 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 0BOGOE1m107382; Thu, 24 Dec 2020 10:24:14 -0600 From: Grygorii Strashko To: "David S. Miller" , , Jakub Kicinski , Richard Cochran CC: , Vignesh Raghavendra , Lokesh Vutla , Grygorii Strashko Subject: [PATCH net] net: ethernet: ti: cpts: fix ethtool output when no ptp_clock registered Date: Thu, 24 Dec 2020 18:24:05 +0200 Message-ID: <20201224162405.28032-1-grygorii.strashko@ti.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The CPTS driver registers PTP PHC clock when first netif is going up and unregister it when all netif are down. Now ethtool will show: - PTP PHC clock index 0 after boot until first netif is up; - the last assigned PTP PHC clock index even if PTP PHC clock is not registered any more after all netifs are down. This patch ensures that -1 is returned by ethtool when PTP PHC clock is not registered any more. Fixes: 8a2c9a5ab4b9 ("net: ethernet: ti: cpts: rework initialization/deinitialization") Signed-off-by: Grygorii Strashko --- drivers/net/ethernet/ti/cpts.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.17.1 Acked-by: Richard Cochran diff --git a/drivers/net/ethernet/ti/cpts.c b/drivers/net/ethernet/ti/cpts.c index d1fc7955d422..43222a34cba0 100644 --- a/drivers/net/ethernet/ti/cpts.c +++ b/drivers/net/ethernet/ti/cpts.c @@ -599,6 +599,7 @@ void cpts_unregister(struct cpts *cpts) ptp_clock_unregister(cpts->clock); cpts->clock = NULL; + cpts->phc_index = -1; cpts_write32(cpts, 0, int_enable); cpts_write32(cpts, 0, control); @@ -784,6 +785,7 @@ struct cpts *cpts_create(struct device *dev, void __iomem *regs, cpts->cc.read = cpts_systim_read; cpts->cc.mask = CLOCKSOURCE_MASK(32); cpts->info = cpts_info; + cpts->phc_index = -1; if (n_ext_ts) cpts->info.n_ext_ts = n_ext_ts;