devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: Horatiu Vultur <horatiu.vultur@microchip.com>
Cc: davem@davemloft.net, kuba@kernel.org, robh+dt@kernel.org,
	linux@armlinux.org.uk, netdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 2/5] net: lan966x: add the basic lan966x driver
Date: Thu, 18 Nov 2021 11:19:22 +0100	[thread overview]
Message-ID: <cdb9c0c334823505a2ce499e36be9507112f4298.camel@pengutronix.de> (raw)
In-Reply-To: <20211117214231.yiv2s6nxl6yx4klq@soft-dev3-1.localhost>

Hi Horatiu,

On Wed, 2021-11-17 at 22:42 +0100, Horatiu Vultur wrote:
> > On Wed, 2021-11-17 at 10:18 +0100, Horatiu Vultur wrote:
> > > +static int lan966x_reset_switch(struct lan966x *lan966x)
> > > +{
> > > +     struct reset_control *reset;
> > > +     int val = 0;
> > > +     int ret;
> > > +
> > > +     reset = devm_reset_control_get_shared(lan966x->dev, "switch");
> > > +     if (IS_ERR(reset))
> > > +             dev_warn(lan966x->dev, "Could not obtain switch reset: %ld\n",
> > > +                      PTR_ERR(reset));
> > > +     else
> > > +             reset_control_reset(reset);
> > 
> > According to the device tree bindings, both resets are required.
> > I'd expect this to return on error.
> > Is there any chance of the device working with out the switch reset
> > being triggered?
> 
> The only case that I see is if the bootloader triggers this switch
> reset and then when bootloader starts the kernel and doesn't set back
> the switch in reset. Is this a valid scenario or is a bug in the
> bootloader?

I'm not sure. In general, the kernel shouldn't rely on the bootloader to
have put the devices into a certain working state. If the driver will
not work or worse, if register access could hang the system if the
bootloader has passed control to the kernel with the switch held in
reset and no reset control is available to the driver, it should not
continue after failure to get the reset handle.

I'd suggest to just use:

	reset = devm_reset_control_get_shared(lan966x->dev, "switch");
	if (IS_ERR(reset))
		return dev_err_probe(lan966x->dev, PTR_ERR(reset),
				     "Could not obtain switch reset");
	reset_control_reset(reset);

unless you have a good reason to do otherwise.

regards
Philipp

  reply	other threads:[~2021-11-18 10:20 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-17  9:18 [PATCH net-next 0/5] net: lan966x: Add lan966x switch driver Horatiu Vultur
2021-11-17  9:18 ` [PATCH net-next 1/5] dt-bindings: net: lan966x: Add lan966x-switch bindings Horatiu Vultur
2021-11-17  9:18 ` [PATCH net-next 2/5] net: lan966x: add the basic lan966x driver Horatiu Vultur
2021-11-17  9:52   ` Philipp Zabel
2021-11-17 21:42     ` Horatiu Vultur
2021-11-18 10:19       ` Philipp Zabel [this message]
2021-11-18 12:49         ` Horatiu Vultur
2021-11-17  9:18 ` [PATCH net-next 3/5] net: lan966x: add port module support Horatiu Vultur
2021-11-17  9:54   ` Russell King (Oracle)
2021-11-18  9:57     ` Horatiu Vultur
2021-11-18  9:59       ` Russell King (Oracle)
2021-11-18 12:59         ` Horatiu Vultur
2021-11-18 13:31           ` Russell King (Oracle)
2021-11-18 15:36             ` Sean Anderson
2021-11-18 16:11               ` Russell King (Oracle)
2021-11-18 16:18                 ` Sean Anderson
2021-11-19  8:49                   ` Horatiu Vultur
2021-11-17 11:41   ` Russell King (Oracle)
2021-11-17  9:18 ` [PATCH net-next 4/5] net: lan966x: add mactable support Horatiu Vultur
2021-11-17  9:18 ` [PATCH net-next 5/5] net: lan966x: add ethtool configuration and statistics Horatiu Vultur

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=cdb9c0c334823505a2ce499e36be9507112f4298.camel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=horatiu.vultur@microchip.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    /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).