From: Daniel Golle <daniel@makrotopia.org>
To: "Arınç ÜNAL" <arinc.unal@arinc9.com>
Cc: Vladimir Oltean <olteanv@gmail.com>,
Frank Wunderlich <frank-w@public-files.de>,
netdev <netdev@vger.kernel.org>,
erkin.bozoglu@xeront.com
Subject: Re: mt7530: dsa_switch_parse_of() fails, causes probe code to run twice
Date: Sat, 15 Apr 2023 00:53:49 +0100 [thread overview]
Message-ID: <ZDnnjcG5uR9gQrUb@makrotopia.org> (raw)
In-Reply-To: <e10aa146-c307-8a14-3842-ae50ceabf8cc@arinc9.com>
On Sat, Apr 15, 2023 at 02:23:16AM +0300, Arınç ÜNAL wrote:
> On 15.04.2023 01:48, Daniel Golle wrote:
> > On Sat, Apr 15, 2023 at 01:41:07AM +0300, Arınç ÜNAL wrote:
> > > Hey there,
> > >
> > > I've been working on the MT7530 DSA subdriver. While doing some tests, I
> > > realised mt7530_probe() runs twice. I moved enabling the regulators from
> > > mt7530_setup() to mt7530_probe(). Enabling the regulators there ends up
> > > with exception warnings on the first time. It works fine when
> > > mt7530_probe() is run again.
> > >
> > > This should not be an expected behaviour, right? Any ideas how we can make
> > > it work the first time?
> >
> > Can you share the patch or work-in-progress tree which will allow me
> > to reproduce this problem?
>
> I tested this on vanilla 6.3-rc6. There's just the diff below that is
> applied. I encountered it on the standalone MT7530 on my Bananapi BPI-R2. I
> haven't tried it on MCM MT7530 on MT7621 SoC yet.
>
> >
> > It can of course be that regulator driver has not yet been loaded on
> > the first run and -EPROBE_DEFER is returned in that case. Knowing the
> > value of 'err' variable below would hence be valuable information.
>
> Regardless of enabling the regulator on either mt7530_probe() or
> mt7530_setup(), dsa_switch_parse_of() always fails.
So dsa_switch_parse_of() can return -EPROBE_DEFER if the ethernet
driver responsible for the CPU port has not yet been loaded.
See net/dsa/dsa.c (inside function dsa_port_parse_of):
[...]
1232) master = of_find_net_device_by_node(ethernet);
1233) of_node_put(ethernet);
1234) if (!master)
1235) return -EPROBE_DEFER;
[...]
Hence it would be important to include the value of 'err' in your
debugging printf output, as -EPROBE_DEFER can be an expected and
implicitely intended reality and nothing is wrong then.
next prev parent reply other threads:[~2023-04-14 23:55 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-14 22:41 mt7530: dsa_switch_parse_of() fails, causes probe code to run twice Arınç ÜNAL
2023-04-14 22:48 ` Daniel Golle
2023-04-14 23:23 ` Arınç ÜNAL
2023-04-14 23:53 ` Daniel Golle [this message]
2023-04-15 0:28 ` Arınç ÜNAL
2023-04-15 0:52 ` Daniel Golle
2023-04-15 7:53 ` Arınç ÜNAL
2023-04-15 9:43 ` Arınç ÜNAL
2023-04-15 12:43 ` Daniel Golle
2023-04-15 13:19 ` Arınç ÜNAL
2023-04-15 13:38 ` Vladimir Oltean
2023-04-15 13:40 ` Arınç ÜNAL
2023-04-15 13:46 ` Vladimir Oltean
2023-04-15 14:02 ` Daniel Golle
2023-04-15 14:20 ` Vladimir Oltean
2023-04-15 14:28 ` Vladimir Oltean
2023-04-15 14:57 ` Arınç ÜNAL
2023-04-16 9:38 ` Arınç ÜNAL
2023-04-16 11:57 ` Daniel Golle
2023-04-15 10:12 ` Vladimir Oltean
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=ZDnnjcG5uR9gQrUb@makrotopia.org \
--to=daniel@makrotopia.org \
--cc=arinc.unal@arinc9.com \
--cc=erkin.bozoglu@xeront.com \
--cc=frank-w@public-files.de \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.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