Re: [PATCH 3/5] drivers: clk-qoriq: Add clockgen support for lx2160a

From: Scott Wood
Date: Mon Sep 03 2018 - 16:38:24 EST


On Mon, 2018-09-03 at 01:17 +0000, Andy Tang wrote:
> Hi Scott,
>
> Please see my replay in line.
>
> > -----Original Message-----
> > From: Linuxppc-dev
> > <linuxppc-dev-bounces+b29983=freescale.com@xxxxxxxxxxxxxxxx> On
> > Behalf Of Scott Wood
> > Sent: 2018å9æ1æ 4:29
> > To: Andy Tang <andy.tang@xxxxxxx>; Vabhav Sharma
> > <vabhav.sharma@xxxxxxx>; linux-kernel@xxxxxxxxxxxxxxx;
> > devicetree@xxxxxxxxxxxxxxx; robh+dt@xxxxxxxxxx;
> > mark.rutland@xxxxxxx; linuxppc-dev@xxxxxxxxxxxxxxxx;
> > linux-arm-kernel@xxxxxxxxxxxxxxxxxxx; mturquette@xxxxxxxxxxxx;
> > sboyd@xxxxxxxxxx; rjw@xxxxxxxxxxxxx; viresh.kumar@xxxxxxxxxx;
> > linux-clk@xxxxxxxxxxxxxxx; linux-pm@xxxxxxxxxxxxxxx;
> > linux-kernel-owner@xxxxxxxxxxxxxxx; catalin.marinas@xxxxxxx;
> > will.deacon@xxxxxxx; gregkh@xxxxxxxxxxxxxxxxxxx; arnd@xxxxxxxx;
> > kstewart@xxxxxxxxxxxxxxxxxxx; yamada.masahiro@xxxxxxxxxxxxx
> > Cc: Yogesh Narayan Gaur <yogeshnarayan.gaur@xxxxxxx>;
> > linux@xxxxxxxxxxxxxxx; Udit Kumar <udit.kumar@xxxxxxx>; Varun Sethi
> > <V.Sethi@xxxxxxx>
> > Subject: Re: [PATCH 3/5] drivers: clk-qoriq: Add clockgen support for
> > lx2160a
> >
> > On Fri, 2018-08-31 at 06:12 +0000, Andy Tang wrote:
> > > We don't want to increase NUM_CMUX each time new soc with more
> >
> > cmuxes added.
> >
> > You don't want to have to make a trivial change each time you exceed a
> > limit that has yet to be exceeded once since NUM_CMUX was added?
> > This isn't ABI or in any other way hard to change. It's right in the same
> > file
> > as the chip description you'd be adding.
> >
> > And even if a chip did come along with 16 cmuxes, you'd then need to
> > increase the array to 17 to hold the -1 if you don't want to leave a
> > situation
> > like the
> > p4080 is in now, where a chip's cmux array could be broken by increasing
> > NUM_CMUX further.
> >
>
> [Andy] Adding buffer to a limitation number is always a good habit when
> coding. We often forget to increase this value when
> a new chip with more cmuxes added.

"often"? There has never been a new chip added with more cmuxes than p4080's
8, and if one does come along and you forget, the compiler should complain
about exceeding the array length with a static initializer. This isn't like
an array that is filled with a runtime-determined length.

> Like this patch, we didn't increase this value at first. We spent a lot of
> time finding out that NUM_CMUX needs to be increased too.

Are you talking about some other chip that you haven't sent a patch for yet?
Or is the cmux array for this chip wrong? What specifically did you see
happen "at first"?

> It is a personal preference how to set this value. I think it is better to
> increase it to 16, not NUM_CMUX+1 as long as we fix the P4080 issue
> even though it is a trivial change. And I agree the description needs to be
> updated.

I'm not the clock maintainer, so it's not up to me, but I don't see the point
in setting it to an arbitrary number, and I do not agree that increasing
NUM_CMUX is a suitable replacement for NUM_CMUX+1 in cmux_to_group[], as that
array should be one larger than cmux[] in order to allow every chip to have a
-1 terminator. In any case, any change to NUM_CMUX should be a separate patch
because it's not required for lx2160a support (assuming lx2160a was correctly
described by this patch).

-Scott