netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* DSA mv88e6xxx_probe
@ 2023-02-02 15:18 Valek, Andrej
  2023-02-02 16:05 ` Andrew Lunn
  0 siblings, 1 reply; 9+ messages in thread
From: Valek, Andrej @ 2023-02-02 15:18 UTC (permalink / raw)
  To: vivien.didelot@gmail.com, andrew@lunn.ch; +Cc: netdev@vger.kernel.org

Hello everyone!

I have a switch mv88e6085 which is connected via MDIO bus to iMX.8 SoC.

Switch is not being detected during booting because the address is
different (due to uninitialized PINs from DTB). The problem is, that
switch has to be reset during boot phase, but it isn't.

So I would like to ask you maybe a generic question about
devm_gpiod_get_optional function inside mv88e6xxx_probe.

Is this "chip->reset = devm_gpiod_get_optional(dev, "reset",
GPIOD_OUT_LOW);" line really do the reset? Because from the lines below
looks like, but the reset pulse hasn't been made. Measured with scope.

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

I see an other lines down bellow
> mv88e6xxx_reg_lock(chip);
> err = mv88e6xxx_switch_reset(chip);
> mv88e6xxx_reg_unlock(chip);

but they are deeper after the "mv88e6xxx_detect" which failed, because
it can't find the switch.
> [3.229659] mv88e6085: probe of 5b040000.ethernet-1:10 failed with
error -110

So I "hard-coded" the real reset there:
> chip->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
> if (IS_ERR(chip->reset))
>	goto out;
>
> if (chip->reset) {
> 	gpiod_set_value_cansleep(chip->reset, 1);
> 	usleep_range(10000, 20000);
> 	gpiod_set_value_cansleep(chip->reset, 0);
> 	usleep_range(10000, 20000);

and switch was correctly founded:
> [    4.022175] mv88e6085 5b040000.ethernet-1:10: switch 0x3100
detected: Marvell 88E6321, revision 2
> [    4.210834] mv88e6085 5b040000.ethernet-1:10: configuring for
fixed/ link mode
> [    4.218587] mv88e6085 5b040000.ethernet-1:10: Link is Up -
1Gbps/Full - flow control off
...

So my question is, how the reset really works, or there is some kind of
potential bug?

Many thanks for your explanation.
Andrej

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-02-08  8:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).