devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: Robert Marko <robert.marko@sartura.hr>
Cc: Lee Jones <lee.jones@linaro.org>,
	linux-kernel@vger.kernel.org,
	Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	robh+dt@kernel.org, devicetree@vger.kernel.org,
	Luka Perkov <luka.perkov@sartura.hr>,
	jmp@epiphyte.org, Paul Menzel <pmenzel@molgen.mpg.de>,
	Donald Buczek <buczek@molgen.mpg.de>
Subject: Re: [PATCH v3 4/6] reset: Add Delta TN48M CPLD reset controller
Date: Wed, 02 Jun 2021 10:47:03 +0200	[thread overview]
Message-ID: <0601d2800a285b44271d2b5a5e28669aa913522b.camel@pengutronix.de> (raw)
In-Reply-To: <CA+HBbNG3O_QORj1NEKvoC4C5FfyfXyO_PMOZS0pHJimGn+HTUA@mail.gmail.com>

On Tue, 2021-06-01 at 19:09 +0200, Robert Marko wrote:
[...]
> Yes, it's self-clearing, per spec they will be cleared after 100ms.

Can you make sure the function only returns after the reset is
deasserted again, for example by using regmap_read_poll_timeout() on the
reset bit?

> Will drop assert then, I saw that reset was for self-clearing, but other
> drivers I looked for example implemented both which was confusing.

If you have full control over the reset line, you can implement .reset
by manually asserting and deasserting (possibly after a delay). But if
the reset is self-clearing, you can't properly implement .(de)assert,
which have an expectation about the state of the reset line after the
function returns.

> > > +}
> > > +
> > > +static int tn48m_control_status(struct reset_controller_dev *rcdev,
> > > +                             unsigned long id)
> > > +{
> > > +     struct tn48_reset_data *data = to_tn48_reset_data(rcdev);
> > > +     unsigned int regval;
> > > +     int ret;
> > > +
> > > +     ret = regmap_read(data->regmap, TN48M_RESET_REG, &regval);
> > > +     if (ret < 0)
> > > +             return ret;
> > > +
> > > +     if (BIT(tn48m_resets[id].bit) & regval)
> > > +             return 0;
> > > +     else
> > > +             return 1;
> > > +}
> > > +
> > > +static const struct reset_control_ops tn48_reset_ops = {
> > > +     .reset          = tn48m_control_reset,
> > > +     .assert         = tn48m_control_assert,
> > > +     .status         = tn48m_control_status,
> > > +};
> > > +
> > > +static int tn48m_reset_probe(struct platform_device *pdev)
> > > +{
> > > +     struct tn48_reset_data *data;
> > > +     struct regmap *regmap;
> > > +
> > > +     if (!pdev->dev.parent)
> > > +             return -ENODEV;
> > 
> > That shouldn't be necessary.
> 
> This driver depends on having a parent as it needs to get the
> regmap from it.
> The parent is a CPLD using simple-i2c-mfd.
> So it's nice to check.

pdev->dev.parent is always set to &platform_bus if there is no parent.

regards
Philipp

  reply	other threads:[~2021-06-02  8:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-31 12:51 [PATCH v3 1/6] mfd: simple-mfd-i2c: Add Delta TN48M CPLD support Robert Marko
2021-05-31 12:51 ` [PATCH v3 2/6] gpio: Add Delta TN48M CPLD GPIO driver Robert Marko
2021-05-31 12:51 ` [PATCH v3 3/6] dt-bindings: reset: Add Delta TN48M Robert Marko
2021-05-31 12:51 ` [PATCH v3 4/6] reset: Add Delta TN48M CPLD reset controller Robert Marko
2021-06-01 15:38   ` Philipp Zabel
2021-06-01 17:09     ` Robert Marko
2021-06-02  8:47       ` Philipp Zabel [this message]
2021-06-02 11:48         ` Robert Marko
2021-05-31 12:51 ` [PATCH v3 5/6] dt-bindings: mfd: Add Delta TN48M CPLD drivers bindings Robert Marko
2021-06-02 10:47   ` Lee Jones
2021-06-02 10:54     ` Robert Marko
2021-05-31 12:51 ` [PATCH v3 6/6] MAINTAINERS: Add Delta Networks TN48M CPLD drivers Robert Marko
2021-06-01  8:39 ` [PATCH v3 1/6] mfd: simple-mfd-i2c: Add Delta TN48M CPLD support Lee Jones
2021-06-01  9:12   ` Robert Marko
2021-06-02 10:49 ` Lee Jones
2021-06-02 11:53   ` Robert Marko

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=0601d2800a285b44271d2b5a5e28669aa913522b.camel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=bgolaszewski@baylibre.com \
    --cc=buczek@molgen.mpg.de \
    --cc=devicetree@vger.kernel.org \
    --cc=jmp@epiphyte.org \
    --cc=lee.jones@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luka.perkov@sartura.hr \
    --cc=pmenzel@molgen.mpg.de \
    --cc=robert.marko@sartura.hr \
    --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).