netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 17:05:01 +0100	[thread overview]
Message-ID: <Y9vfLYtio1fbZvfW@lunn.ch> (raw)
In-Reply-To: <cf6fb63cdce40105c5247cdbcb64c1729e19d04a.camel@siemens.com>

On Thu, Feb 02, 2023 at 03:18:37PM +0000, Valek, Andrej wrote:
> 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?

The current code is designed to take a switch held in reset out of
reset. It does not perform an actual reset.

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

You might be able to use this to perform the power on reset of the
switch. That advantage of that is it won't slow down the probe of
everybody elses switches which have correct pin strapping.

	Andrew

  reply	other threads:[~2023-02-02 16:05 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 [this message]
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

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=Y9vfLYtio1fbZvfW@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).