Re: [PATCH v4 3/7] pwm: sun4i: Add an optional probe for bus clock
From: Uwe Kleine-König
Date: Fri Nov 15 2019 - 02:25:39 EST
Hello Clément,
On Thu, Nov 14, 2019 at 11:36:16PM +0100, Clément Péron wrote:
> On Wed, 13 Nov 2019 at 09:35, Uwe Kleine-König
> <u.kleine-koenig@xxxxxxxxxxxxxx> wrote:
> > On Fri, Nov 08, 2019 at 09:45:13AM +0100, Clément Péron wrote:
> > > + /*
> > > + * Fallback for old dtbs with a single clock and no name.
> > > + * If a parent has a clock-name called "mod" whereas the
> > > + * current node is unnamed the clock reference will be
> > > + * incorrectly obtained and will not go into this fallback.
> >
> > For me "old dtbs" suggests that today a device tree should have a "mod"
> > clock. Is this true also for machines other than H6? And I'd put the
> > comment before the acquisition of the "mod" clock. Something like:
>
> Agree to remove the "old dtbs" but specifying the SoC instead
> of the reason is less clear for me.
>
> I would prefer to have something like this:
>
> A clock is explicitly called "mod" when several clocks are referenced.
> However, when only one clock is declared this one is unamed.
> So we request "mod" first (and ignore the corner case that a parent
> provides a "mod" clock)
> and if this is not found we fall back to the first clock of the PWM.
It gets better. What about also describing shortly the purpose of this
clock (assuming this is the source clock of the PWM that is then
divided):
All hardware variants need a source clock that is divided and
then feeds the counter that defines the output wave form. In the
device tree this clock is either unnamed or called "mod".
Some variants (e.g. H6) need another clock to access the
hardware registers; this is called "bus".
So we request "mod" first (and ignore the corner case that a
parent provides a "mod" clock while the right one would be the
unnamed one of the PWM device) and if this is not found we fall
back to the first clock of the PWM.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |