Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1451819

Re: [PATCH v2] reset: uniphier: add reset controller drivers for UniPhier SoCs

From Philipp Zabel <p.zabel@pengutronix.de>
Newsgroups linux.kernel
Subject Re: [PATCH v2] reset: uniphier: add reset controller drivers for UniPhier SoCs
Date 2016-07-28 11:30 +0200
Message-ID <rZPND-4ie-15@gated-at.bofh.it> (permalink)
References <rZfh9-5uR-47@gated-at.bofh.it> <rZtap-5SB-3@gated-at.bofh.it> <rZJyx-8k3-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Masahiro,

Am Donnerstag, den 28.07.2016, 11:40 +0900 schrieb Masahiro Yamada:
> >> +static int uniphier_reset_update(struct reset_controller_dev *rcdev,
> >> +                              unsigned long id, bool assert)
> >> +{
> >> +     struct uniphier_reset_priv *priv = to_uniphier_reset_priv(rcdev);
> >> +     const struct uniphier_reset_data *p;
> >> +     bool handled = false;
> >> +
> >> +     for (p = priv->data; p->id != UNIPHIER_RESET_ID_END; p++) {
> >> +             unsigned int val;
> >> +             int ret;
> >> +
> >> +             if (p->id != id)
> >> +                     continue;
> >> +
> >> +             val = p->assert_val;
> >> +             if (!assert)
> >> +                     val = ~val;
> >> +
> >> +             ret = regmap_write_bits(priv->regmap, p->reg, p->mask, val);
> >> +             if (ret)
> >> +                     return ret;
> >> +
> >> +             handled = true;
> >
> > Why does this continue to walk through the list after the correct id was
> > found?
> 
> Looks like you already found the answer for this.

Yes.

[...]
> >> +#define UNIPHIER_MIO_RESET_USB2(index, ch)                           \
> >> +     UNIPHIER_RESETX_SIMPLE((index), 0x110 + 0x200 * (ch), BIT(24)), \
> >> +     UNIPHIER_RESETX_SIMPLE((index), 0x114 + 0x200 * (ch), BIT(0))
> >
> > Ah, so for USB2 reset you have two reset bits in separate registers. Are
> > you sure these are controlling the same reset line?
> 
> I am not a hardware guy, so I am not sure about the hardware design.
> 
> From my best guess, I think each bit controls a different block.
> But both of them must be de-asserted before starting up USB.
>
> There is no use-case where they are asserted/de-asserted independently.
> 
> So, I thought it made sense to couple them into a single ID.

If it turns out to be useful for drivers to bundle resets, I'd prefer to
do this in the framework rather than in the individual drivers, maybe
have a reset_assert/deassert_array, similarly to gpiod.

> > If the USB core does in fact have two separate reset inputs that just
> > happen to need asserting at the same time, this should still get two
> > separate ids. Same issue for the SD reset above, if the reset lines are
> > physically separate, please don't combine them in the driver.
> 
> Right.
> From the view of point of Device Tree interface,
> it should reflect the hardware design.
> I believe they are separate reset signals, so should be given with separate IDs.
> 
> But, as a software engineer, it is sometimes difficult to fully understand
> the hardware structure.
> 
> The hardware document often just says "how to use USB",
> but "how clock/reset signals are connected in each block" is not mentioned,
> or at least very unclear.

I understand the problem. If you have any way of finding out whether
these are in fact separate resets, please do. Otherwise we'll have to
guess.

> Probably, I will come back with real per-reset-line ID,
> but I need some time to take a look.

Ok, thanks.

regards
Philipp

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2] reset: uniphier: add reset controller drivers for UniPhier SoCs Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-07-26 20:30 +0200
  Re: [PATCH v2] reset: uniphier: add reset controller drivers for  UniPhier SoCs Philipp Zabel <p.zabel@pengutronix.de> - 2016-07-27 11:20 +0200
    Re: [PATCH v2] reset: uniphier: add reset controller drivers for  UniPhier SoCs Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-07-28 04:50 +0200
      Re: [PATCH v2] reset: uniphier: add reset controller drivers for  UniPhier SoCs Philipp Zabel <p.zabel@pengutronix.de> - 2016-07-28 11:30 +0200
  Re: [PATCH v2] reset: uniphier: add reset controller drivers for  UniPhier SoCs Rob Herring <robh@kernel.org> - 2016-07-29 22:20 +0200

csiph-web