From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 798AFC433F5 for ; Mon, 2 May 2022 18:21:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386822AbiEBSYr (ORCPT ); Mon, 2 May 2022 14:24:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238642AbiEBSYq (ORCPT ); Mon, 2 May 2022 14:24:46 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A340A65A1 for ; Mon, 2 May 2022 11:21:16 -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=erYGb63ZCu5CmvEC/xF+eVwLkOUEqtkM+RbcC2Zv7C0=; b=vxanIRSNkrfklf0jgUeLwwXbqg mRsS3xkreGRhiEd+c7S/hWODg9+2uqxlq5diN2C6UkiATFq+9F6aYox+JmxszLq8oBnl+dveFMMaD gmsS8IyS+3i549Mv0/nHO0oj6CYGyGNAptrLL6uTTJbi1hLLfMQRgINYNj8MczbttCMo=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1nlafW-000wBL-M4; Mon, 02 May 2022 20:21:10 +0200 Date: Mon, 2 May 2022 20:21:10 +0200 From: Andrew Lunn To: Francesco Dolcini Cc: netdev@vger.kernel.org, Andy Duan , Joakim Zhang , Heiner Kallweit , Russell King , Jakub Kicinski , Paolo Abeni , "David S. Miller" , Fabio Estevam , Tim Harvey , Chris Healy Subject: Re: FEC MDIO read timeout on linkup Message-ID: References: <20220422152612.GA510015@francesco-nb.int.toradex.com> <20220502170527.GA137942@francesco-nb.int.toradex.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220502170527.GA137942@francesco-nb.int.toradex.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org > Could it be that the issue is writing the MSCR in fec_restart(), > `writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED)`? > > I do see the issue on link up/down event, when this function is actually > called. > > >From what I can understand from the previous history: > > 1e6114f51f9d (net: fec: fix MDIO probing for some FEC hardware blocks, 2020-10-28) > f166f890c8f0 (net: ethernet: fec: Replace interrupt driven MDIO with polled IO, 2020-05-02) > > writing to this register could trigger a FEC_ENET_MII interrupt actually > creating a race condition with fec_enet_mdio_read() that is called on > link change also. You should read the discussion from when this code was added. Are you planning on adding: if (fep->quirks & FEC_QUIRK_CLEAR_SETUP_MII) { /* Clear MMFR to avoid to generate MII event by writing MSCR. * MII event generation condition: * - writing MSCR: * - mmfr[31:0]_not_zero & mscr[7:0]_is_zero & * mscr_reg_data_in[7:0] != 0 * - writing MMFR: * - mscr[7:0]_not_zero */ writel(0, fep->hwp + FEC_MII_DATA); } To other locations which change FEC_MII_SPEED? Andrew