public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Francesco Dolcini <francesco.dolcini@toradex.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Francesco Dolcini <francesco.dolcini@toradex.com>,
	netdev@vger.kernel.org, Andy Duan <fugang.duan@nxp.com>,
	Joakim Zhang <qiangqing.zhang@nxp.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	"David S. Miller" <davem@davemloft.net>,
	Fabio Estevam <festevam@gmail.com>,
	Tim Harvey <tharvey@gateworks.com>,
	Chris Healy <cphealy@gmail.com>
Subject: Re: FEC MDIO read timeout on linkup
Date: Mon, 2 May 2022 20:25:12 +0200	[thread overview]
Message-ID: <20220502182512.GA400423@francesco-nb.int.toradex.com> (raw)
In-Reply-To: <YnAhFse2h0vN1FCM@lunn.ch>

On Mon, May 02, 2022 at 08:21:10PM +0200, Andrew Lunn wrote:
> > 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.

Of course, I did it.

> 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?

Correct, plus the required locking since both fec_enet_mdio_read() and
_write() do write into the same registers.

Francesco


  reply	other threads:[~2022-05-02 18:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-22 15:26 FEC MDIO read timeout on linkup Francesco Dolcini
2022-04-22 15:55 ` Fabio Estevam
2022-04-22 16:04   ` Francesco Dolcini
2022-04-29 15:15     ` Francesco Dolcini
2022-05-02 17:05 ` Francesco Dolcini
2022-05-02 18:21   ` Andrew Lunn
2022-05-02 18:25     ` Francesco Dolcini [this message]
2022-05-02 18:24   ` Andrew Lunn
2022-05-02 18:34     ` Francesco Dolcini
2022-05-03 16:13       ` Francesco Dolcini
2022-05-03 22:17         ` Andrew Lunn
2022-05-05  8:29           ` Francesco Dolcini
2022-05-05 17:41             ` Andrew Lunn
2022-05-05 17:54               ` Francesco Dolcini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220502182512.GA400423@francesco-nb.int.toradex.com \
    --to=francesco.dolcini@toradex.com \
    --cc=andrew@lunn.ch \
    --cc=cphealy@gmail.com \
    --cc=davem@davemloft.net \
    --cc=festevam@gmail.com \
    --cc=fugang.duan@nxp.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=qiangqing.zhang@nxp.com \
    --cc=tharvey@gateworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox