From: Andrew Lunn <andrew@lunn.ch>
To: "Valek, Andrej" <andrej.valek@siemens.com>
Cc: "vivien.didelot@gmail.com" <vivien.didelot@gmail.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: DSA mv88e6xxx_probe
Date: Thu, 2 Feb 2023 19:10:04 +0100 [thread overview]
Message-ID: <Y9v8fBxpO19jr9+9@lunn.ch> (raw)
In-Reply-To: <af64afe5fee14cc373511acfa5a9b927516c4d66.camel@siemens.com>
> > > > chip->reset = devm_gpiod_get_optional(dev, "reset",
> > > > GPIOD_OUT_LOW);
> > > > if (IS_ERR(chip->reset))
> > > > goto out;
> > > >
> > > > if (chip->reset)
> > > > usleep_range(1000, 2000);
> > >
> > > So it should wait, but for what?
> >
> > The current code is designed to take a switch held in reset out of
> > reset. It does not perform an actual reset.
> >
> How does it then work? I see just a "devm_gpiod_get_optional" which
> just assign an pointer to "chip->reset" and then
> " if (chip->reset) usleep_range(1000, 2000);" which just waits for
> "something" ? Where is the "reset" took out? I don't see any gpio set
> to 0.
https://elixir.bootlin.com/linux/latest/source/include/linux/gpio/consumer.h#L49
GPIOD_OUT_LOW = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT,
https://elixir.bootlin.com/linux/latest/source/drivers/gpio/gpiolib.c#L4051
/* Process flags */
if (dflags & GPIOD_FLAGS_BIT_DIR_OUT)
ret = gpiod_direction_output(desc,
!!(dflags & GPIOD_FLAGS_BIT_DIR_VAL));
else
ret = gpiod_direction_input(desc);
> > If you need a real reset, you probably need to call
> > mv88e6xxx_hardware_reset(chip), not usleep().
> >
> > However, a reset can be a slow operation, specially if the EEPROM is
> > full of stuff. So we want to avoid two resets if possible.
> >
> > The MDIO bus itself has DT descriptions for a GPIO reset. See
> > Documentation/devicetree/bindings/net/mdio.yaml
> This looks promising. So I have to just move the "reset-gpios" DTB
> entry from switch to mdio section. But which driver handles it,
> drivers/net/phy/mdio_bus.c,
Yes.
> > mdio {
> > #address-cells = <1>;
> > #size-cells = 0>;
> while here is no compatible part... .
It does not need a compatible, because it is part of the FEC, and the
FEC has a compatible. Remember this is device tree, sometimes you need
to go up the tree towards the root to find the actual device with a
compatible.
Andrew
next prev parent reply other threads:[~2023-02-02 18:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-02 15:18 DSA mv88e6xxx_probe Valek, Andrej
2023-02-02 16:05 ` Andrew Lunn
2023-02-02 17:57 ` Valek, Andrej
2023-02-02 18:10 ` Andrew Lunn [this message]
2023-02-03 8:07 ` Valek, Andrej
2023-02-03 13:54 ` Andrew Lunn
2023-02-03 14:47 ` Valek, Andrej
2023-02-06 14:50 ` Valek, Andrej
2023-02-08 8:20 ` Valek, Andrej
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=Y9v8fBxpO19jr9+9@lunn.ch \
--to=andrew@lunn.ch \
--cc=andrej.valek@siemens.com \
--cc=netdev@vger.kernel.org \
--cc=vivien.didelot@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;
as well as URLs for NNTP newsgroup(s).