Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3240443rwd; Fri, 16 Jun 2023 14:31:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4zdfyVdL8hF4tj7l8BDhVJEtCDI5J4qYEK9PmfaZhseOCzi6n8xdhyv3Gn+FupBaG83JHg X-Received: by 2002:a05:6808:148f:b0:39e:7af4:7eea with SMTP id e15-20020a056808148f00b0039e7af47eeamr4121619oiw.55.1686951068777; Fri, 16 Jun 2023 14:31:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686951068; cv=none; d=google.com; s=arc-20160816; b=ntkXTdTNzFfsjcC5iAZbtcU8EB4rnE2uIP14OaZLhUNF9gwuexSy3oMqx4fPENgQ9V KmUKjycpxoh+vAw18FY8qirOm0o+8xp9c4g3ekJIoY9W1paIH9yctYG/bPmP2BPUzGAv jQdPK3FBoEi434NPfal8AzJw/SfiRmSJli/BVu1kPssRuM4BMvZM1sUza5jHOVM1K0YX +8hW8TCuf88CwMB/ZfGVPAmC58M8xw2jWna6WO5dt4FqyGAE41GZaRQfyGdqEcBx/LMH r82kcHVjeWZ275ZxpPNdDwcC/5ZrmIjDBXOJe43JBc2PfUJoAGeBP+yceE8W33tZzv7N c9bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/0KYNG1uu6OLOczaiMiZPIPx6IT+zlOzx5X/EdsZ93Y=; b=GWSIlG/vk9UKZ1CgusgEDMX7JRU76Z1oNQGWL8uNO1bdVhZuLceeLA06EkHzq9ClSm U5fGZLDEQBjZ00Sx/B+OlMoJ9qJHdZubt2bebhNZERujB5XbVR7vvtrSS5tQlPQonApX TSnvhurSHKFheeYFqV+WNNfM14nAPkynK1asKI2vHbnTNtjY8GsY+R+eB8GoDo5/nl/7 2LsoQgO9OviClGd32JZffEHYdHFmpJsjvbRIpYJxGxL3ryQ7RGBaqRU0ab8UcL1rr1Gi i7ckEXNh7h9aCqTX3xsPLvRzJ3UYhtgxxgm0voHOVSLAGUUiFzVtYIU1Q/H5YtGDKo7z F7yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=koc+oIVJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p9-20020a639509000000b00544538e2041si17363196pgd.305.2023.06.16.14.30.54; Fri, 16 Jun 2023 14:31:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=koc+oIVJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233378AbjFPVAe (ORCPT + 99 others); Fri, 16 Jun 2023 17:00:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbjFPVAd (ORCPT ); Fri, 16 Jun 2023 17:00:33 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E5E530F1; Fri, 16 Jun 2023 14:00:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=/0KYNG1uu6OLOczaiMiZPIPx6IT+zlOzx5X/EdsZ93Y=; b=koc+oIVJT0JjkvRjMmML9CaNhS yx7gLISInirxmjUOfey7U7uxJuvGY1KMVKq7fLgiTreGudJ6HCgOpsSod7zcUeZXqKw++4Oo5C2PI RcO5Fusttvj/6HURCtLlf35Ah1d6rc8HXqS43P0wKtJRdo+rqp3E8BJq5pifQX58SdyA=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1qAGYT-00Gl8R-J8; Fri, 16 Jun 2023 23:00:25 +0200 Date: Fri, 16 Jun 2023 23:00:25 +0200 From: Andrew Lunn To: "Radu Pirea (NXP OSS)" Cc: hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, sebastian.tobuschat@nxp.com Subject: Re: [PATCH net-next v1 13/14] net: phy: nxp-c45-tja11xx: reset PCS if the link goes down Message-ID: References: <20230616135323.98215-1-radu-nicolae.pirea@oss.nxp.com> <20230616135323.98215-14-radu-nicolae.pirea@oss.nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230616135323.98215-14-radu-nicolae.pirea@oss.nxp.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 16, 2023 at 04:53:22PM +0300, Radu Pirea (NXP OSS) wrote: > During PTP testing on early TJA1120 engineering samples I observed that > if the link is lost and recovered, the tx timestamps will be randomly > lost. To avoid this HW issue, the PCS should be reseted. > > Resetting the PCS will break the link and we should reset the PCS on > LINK UP -> LINK DOWN transition, otherwise we will trigger and infinite > loop of LINK UP -> LINK DOWN events. > +static int tja1120_read_status(struct phy_device *phydev) > +{ > + unsigned int link = phydev->link; > + int ret; Maybe consider using link_change_notify: /** * @link_change_notify: Called to inform a PHY device driver * when the core is about to change the link state. This * callback is supposed to be used as fixup hook for drivers * that need to take action when the link state * changes. Drivers are by no means allowed to mess with the * PHY device structure in their implementations. */ void (*link_change_notify)(struct phy_device *dev); Seems like a fixup to me. Andrew