Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp613540pxh; Tue, 9 Nov 2021 16:11:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJzCGyhYKxSF4aGPxSjpsLNEKY6Ay7S5Iq5qO3nbRIOMpHn6dE+K8UW+Ex1qnZmtu+OlNp/b X-Received: by 2002:a5d:8c83:: with SMTP id g3mr7783489ion.24.1636503093796; Tue, 09 Nov 2021 16:11:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636503093; cv=none; d=google.com; s=arc-20160816; b=Jk/CIpY21LBLWFgU+/Od89aigoxk1b8MxyoT7+g2/rbclTeF+Y0JdnZrizMh/p6xTt zETUbp5bfcfGQwhddE7OMVXcHqiGpnTEZY0auAWBjFSy7BASJsCDtwzzwAmRspBoU5gk 19VO0c7W3Z6qG2KT9xvpjjtLRY2HGC+1+R/w/uPwh5ZKUnVjZAESOngSE0LS8B+WgIQb /rNn6EjrM9ekVtZmwJEw2EqCPrnFa9tMlPNByCRpdtvxZEEdGanTGOX7VltPERC499BN Er+1r5gYLnSqMq/utNRk5M5Mwu1O7NvJ0uYy87Lo3du1WtoUNWMlI5Pqr+BK05oq8g8X v/xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=bCGwSmI8NTSILNGyHTY8bibfBV/DYZ+v1YjLw7ldJW8=; b=q+G7OPeTOqIolbQttrz8E4F9d1Zg5p3I8Dg8aGZNN4ovy0oV5znG9kaNnFKeWUMAwJ oyzF4xb54mz8NLwYPeoEVOV5udbtYu/ouJEwYrbpKMIBXzrmlUzr1xzPPgqb/3TrfJaC 66AfG7tkeWGEhao/M0cXhU73KW2Qe06skjh2LshRJfq6bYWwni6vJJeo4of134oIpyG+ 5Zo9hsXhhMpkbPTe/b9zkYovn557BMvJgMzM5ZIP7ZFDOLhRj4Q4lbNM9tdcISJvhr1c 9Ny1OzxuI0mgxFq5ZXQlFaKp/eH4pE9t0hzqf2PmPffDOnyIA50cC7aQaRDt1AbpgAED 2a4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mYPuj6bg; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n14si5829271ioz.69.2021.11.09.16.11.21; Tue, 09 Nov 2021 16:11:33 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mYPuj6bg; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241606AbhKISLe (ORCPT + 97 others); Tue, 9 Nov 2021 13:11:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230383AbhKISLd (ORCPT ); Tue, 9 Nov 2021 13:11:33 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76677C061764; Tue, 9 Nov 2021 10:08:47 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id r5so38593pls.1; Tue, 09 Nov 2021 10:08:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=bCGwSmI8NTSILNGyHTY8bibfBV/DYZ+v1YjLw7ldJW8=; b=mYPuj6bgHH/UBiNs/5YKLiid1ATKXLZCXLyQJVKleNkGzn1QmapwDIeTulZ9qpO8+2 tIir31gPIX+1agbgs7V+4wTlAm0GuT5fqsrcFfTaTCboHFrNAJGLuobDZn5GoS9Hj8y8 Pp8Uv0SSUsLbE3utyAiTgCcyLq/PZD6CadLiHW8TnukPZhYsmYtGX/Wtlti7jv659+Er lSoTlDWQJx4a25eAOdBUwXe0wPZHB2IkDKqEH94y5OXxTeRyXrrr8XNhpOFFxbvdYl62 ygRURSqKSLKPZ+AXPWAwJkYDQ6UexnpVEC+KMAe9ZMxvNhTp4M6uQSfWRUEXZCAn1Qy2 MktA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=bCGwSmI8NTSILNGyHTY8bibfBV/DYZ+v1YjLw7ldJW8=; b=IHE4gy9tT4CscwkpEjpn5/llV18sR7m2wAlPZI5+YxcFz32weIywsALJF50Z4xl9Im 90m0LbdMjGBi4Kdw4kuIioGvHpWXwRIyfB3LFFFemmjSLyYF5WVujJb2spyKKeRt8+uX EkzOiEVSgWv0SOuAsigTY4gsz0DOUPvvthkfqm+ck6cQDFlZdljZ8Hd0LSzbOxrMyAOC jzE82ySz52O1tyN8Hn5Or0RcDJg3h2JXrQplpCMjDuylFeC9U/IQjg+eUXgouISeH6Kx e2hBgkDZGXnjPXY+yHlZSVDqjpeLySgrzX6Ddw8lrH53/hXBvhWT643wZ0/jrZgsPHxS tXhw== X-Gm-Message-State: AOAM5338qr+WztyAeqIiJjV7bowTPX6ZlDb08fSdd0ea0V5whfYYUxdr N9UOr8mclvfiLq6UF6Lq0xye+TEGnnI= X-Received: by 2002:a17:90b:4c88:: with SMTP id my8mr9141713pjb.132.1636481326756; Tue, 09 Nov 2021 10:08:46 -0800 (PST) Received: from [10.67.48.245] ([192.19.223.252]) by smtp.googlemail.com with ESMTPSA id ep15sm3720434pjb.3.2021.11.09.10.08.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 09 Nov 2021 10:08:46 -0800 (PST) Subject: Re: [PATCH v2 4/7] net: dsa: b53: Add PHC clock support To: Martin Kaistra , Andrew Lunn , Vivien Didelot Cc: Richard Cochran , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , John Stultz , Thomas Gleixner , Stephen Boyd , Russell King , Marc Kleine-Budde , linux-kernel@vger.kernel.org, netdev@vger.kernel.org References: <20211109095013.27829-1-martin.kaistra@linutronix.de> <20211109095013.27829-5-martin.kaistra@linutronix.de> From: Florian Fainelli Message-ID: Date: Tue, 9 Nov 2021 10:08:44 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20211109095013.27829-5-martin.kaistra@linutronix.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/9/21 1:50 AM, Martin Kaistra wrote: > The BCM53128 switch has an internal clock, which can be used for > timestamping. Add support for it. > > The 32-bit free running clock counts nanoseconds. In order to account > for the wrap-around at 999999999 (0x3B9AC9FF) while using the cycle > counter infrastructure, we need to set a 30bit mask and use the > overflow_point property. > > Enable the Broadsync HD timestamping feature in b53_ptp_init() for PTPv2 > Ethertype (0x88f7). > > Signed-off-by: Martin Kaistra > --- [snip] > struct b53_mib_desc { > u8 size; > @@ -1131,12 +1132,24 @@ static int b53_setup(struct dsa_switch *ds) > b53_disable_port(ds, port); > } > > + if (dev->broadsync_hd) { > + ret = b53_ptp_init(dev); > + if (ret) { > + dev_err(ds->dev, "failed to initialize PTP\n"); > + return ret; > + } Can you fold the check for dev->broadsync_hd within b53_ptp_init() as requested before? And likewise for b53_ptp_exit. -- Florian