From: Robert Marko <robert.marko@sartura.hr>
To: Philipp Zabel <p.zabel@pengutronix.de>
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, 2 Jun 2021 13:48:23 +0200 [thread overview]
Message-ID: <CA+HBbNFU=vORe-+py5c3QQP6Fr4EnrVG05Z1Gi-LJdiDLuMSBQ@mail.gmail.com> (raw)
In-Reply-To: <0601d2800a285b44271d2b5a5e28669aa913522b.camel@pengutronix.de>
On Wed, Jun 2, 2021 at 10:47 AM Philipp Zabel <p.zabel@pengutronix.de> wrote:
>
> 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?
Yes, that is simple to implement.
>
> > 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.
Makes sense, I will drop the assert op.
>
> > > > +}
> > > > +
> > > > +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, ®val);
> > > > + 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.
Ok, so it's useless to check.
Will send a new version today.
Regards,
Robert
>
> regards
> Philipp
--
Robert Marko
Staff Embedded Linux Engineer
Sartura Ltd.
Lendavska ulica 16a
10000 Zagreb, Croatia
Email: robert.marko@sartura.hr
Web: www.sartura.hr
next prev parent reply other threads:[~2021-06-02 11:48 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
2021-06-02 11:48 ` Robert Marko [this message]
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='CA+HBbNFU=vORe-+py5c3QQP6Fr4EnrVG05Z1Gi-LJdiDLuMSBQ@mail.gmail.com' \
--to=robert.marko@sartura.hr \
--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=p.zabel@pengutronix.de \
--cc=pmenzel@molgen.mpg.de \
--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).