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


Groups > linux.kernel > #1561401 > unrolled thread

Re: [linux-sunxi] [PATCH 1/2] drivers: pinctrl: add driver for Allwinner H5 SoC

Started byAndre Przywara <andre.przywara@arm.com>
First post2017-01-18 10:50 +0100
Last post2017-01-26 11:10 +0100
Articles 5 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [linux-sunxi] [PATCH 1/2] drivers: pinctrl: add driver for  Allwinner H5 SoC Andre Przywara <andre.przywara@arm.com> - 2017-01-18 10:50 +0100
    Re: [linux-sunxi] [PATCH 1/2] drivers: pinctrl: add driver for  Allwinner H5 SoC Linus Walleij <linus.walleij@linaro.org> - 2017-01-19 10:40 +0100
      Re: [linux-sunxi] [PATCH 1/2] drivers: pinctrl: add driver for  Allwinner H5 SoC Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-01-19 18:40 +0100
    Re: [linux-sunxi] [PATCH 1/2] drivers: pinctrl: add driver for  Allwinner H5 SoC Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-01-19 19:00 +0100
      Re: [linux-sunxi] [PATCH 1/2] drivers: pinctrl: add driver for  Allwinner H5 SoC Linus Walleij <linus.walleij@linaro.org> - 2017-01-26 11:10 +0100

#1561401 — Re: [linux-sunxi] [PATCH 1/2] drivers: pinctrl: add driver for Allwinner H5 SoC

FromAndre Przywara <andre.przywara@arm.com>
Date2017-01-18 10:50 +0100
SubjectRe: [linux-sunxi] [PATCH 1/2] drivers: pinctrl: add driver for Allwinner H5 SoC
Message-ID<t0V2p-2ja-5@gated-at.bofh.it>
Hi,

On 16/01/17 16:31, Maxime Ripard wrote:
> On Mon, Jan 09, 2017 at 12:16:00AM +0000, André Przywara wrote:
>> On 05/01/17 22:42, Maxime Ripard wrote:
>>> On Fri, Dec 30, 2016 at 01:55:44PM +0100, Linus Walleij wrote:
>>>> On Mon, Dec 26, 2016 at 3:33 PM, André Przywara <andre.przywara@arm.com> wrote:
>>>>
>>>>> So while this patch technically looks correct, I was wondering if we
>>>>> should really explore the possibility of making the whole of sunxi
>>>>> pinctrl DT controlled.
>>>>> I brought this up a while ago, but people weren't overly enthusiastic
>>>>> about it, though their argument weren't really convincing to me[1].
>>>>>
>>>>> So:
>>>>> As this "driver" here is basically a table linking GPIO bit settings
>>>>> (the actual mux value) to names and every pin we care about needs to be
>>>>> enumerated in the DT anyway, why not just add something like:
>>>>> allwinner,pinmux = <4>;
>>>>> to each pin(group) in the DT and get rid of this "driver" file here
>>>>> entirely?
>>>>
>>>> I'm open to that if you can use pinctrl-single which is in the kernel
>>>> for this purpose only, and is used with both OMAPs and HiSilicon.
>>>
>>> I'm not open to that, and I'm getting tired of discussing it over and
>>> over again. Andre, if you want to be convinced again, please read the
>>> last discussion we had on this topic.
>>
>> As I said: It didn't convince me back then. And frankly we didn't really
>> discuss it back then, I just refrained from entering a discussion
>> against _two_ maintainers at this time, since my capacity on this kind
>> of email threads is really very limited - especially for something that
>> is a hobby to me.
> 
> This is also (mostly) a hobby to me, which is exactly why I prefer to
> work on something actually useful, rather than just discussing this
> over and over again. Just like I don't want (myself, or anyone,
> really, since we're all in the same boat) to have to maintain two
> separate pinctrl drivers.
> 
> We're having a documented, simple, pinctrl binding, using the generic
> bindings now (that almost everyone else is using now, or is very close
> to), and we can leverage as much documentation and code from that. Why
> would we want to create and maintain a new driver with a new binding,
> that will need to be documented again, learned by everyone, and will
> lead only to confusion across the people who just want to have their
> board supported?

I agree, and thus was proposing a _slightly changed_ pinctrl driver
which actually *reduces* the maintenance burden in the kernel.
In the moment we need to add _both_ a pinctrl .dtsi node _and_ a kernel
"driver" file, which is really boilerplate code plus a table.
Also we need to make sure that both these files match.
If a new SoC is really 99% similar to an existing one, atm we still need
explicit kernel support if only one pin is changed (see the H5).

So my idea was to basically add the mux value as a DT property, thus
making the kernel pinctrl-sun[x]i-a[yz].c files obsolete and greatly
_reduce_ the maintenance burden. Ideally there wouldn't be any pinctrl
code changes in the kernel for future SoCs anymore - at least if
Allwinner sticks with their current pace of releasing copy&pasted SoC
designs. Changes beyond that would require a driver change anyway, even
with the current model.

I gave Linus' proposal to use the pinctrl-single binding a quick look
and don't think it's a match for Allwinner SoC. So my idea was to
basically just add a new compatible and the muxsel property to the
existing driver and binding. It would basically look the same, apart
from one or two additions (to cover interrupts, for instance).
Any future SoCs could then just use that compatible and would describe
the SoC details in the DT, like it's meant to be and like we do already,
but extended by putting the mux value in there as well.
So the only kernel contribution would then be the DT, really, which
technically could be delivered on some device storage as well, but
that's a different discussion ...

> And imagine the kind of mess we would be in if everyone getting a bit
> involved in the support of one platform at one point wanted to trash
> one big part of its infrastructure and start all over again because he
> likes it better this way.

Like I said above, I didn't mean to trash the current pinctrl binding,
just make it a bit more generic and simplify future kernel support.

> I'm sorry, but this is also our jobs as maintainers to prevent all
> these kind of issues, and to maintain consistency. Switching to one
> binding to another breaks that consistency on many level,

Yet we did it for the clocks. The very same argumentation that you gave
above applies there as well (two different bindings, two sets of drivers
in the kernel, new learnings for people, etc.)
One difference would be that the new pinctrl binding wouldn't be
fundamentally different to the old one, up to the point where the old
driver could possibly use the very same DT nodes (but that would need to
be worked out).

Cheers,
Andre.

> both in
> pinctrl and in the platform support itself. So sorry, but that's not
> going to happen.
> 
> Maxime
> 

[toc] | [next] | [standalone]


#1562523

FromLinus Walleij <linus.walleij@linaro.org>
Date2017-01-19 10:40 +0100
Message-ID<t1hmi-8aB-15@gated-at.bofh.it>
In reply to#1561401
On Wed, Jan 18, 2017 at 10:44 AM, Andre Przywara <andre.przywara@arm.com> wrote:

> Any future SoCs could then just use that compatible and would describe
> the SoC details in the DT, like it's meant to be and like we do already,
> but extended by putting the mux value in there as well.
> So the only kernel contribution would then be the DT, really, (...)

Your different positions have existed since the inception of the
pinctrl subsystem:

- One camp (myself included) wanted to describe the hardware mostly
  in the driver: functions, groups etc are tables in the driver file.

- Another camp (OMAP included) think that the device tree should take
  store most things: groups functions, etc.

What we know for sure should be described in DT is how different
IP blocks are connected in an SoC (e.g. interrupts, clocks, DMA
channels, regulators) and on the of course outside of the SoC, on
the board.

The question here is whether the way a hardware has instantiated
a certain IP block when doing physical compilation in their
Verilog, VHDL or SystemC files, is something that should be
described in DT.

Many companies have developed tools to
extract this data from their hardware design files and provide
it to developers as a blob och incomprehensible data, such was
the situation for OMAP for example. So to them it made most
sense to implement pinctrl-single, just parsing that data into
DTS(I) files.

Other companies (such as STMicroelectronics) instead put a
team of people to write a datasheet with a special chapter
on how pins etc are connected, and programmers are given
this datasheet and need to again type in the data and define
groups etc.

Whether parametrization of a HW block should be done in the
driver file from the compatible string or with custom attributes
in the node is not a simple answer to the question. OF is vague
on this kind of things: both solutions exist.

Allwinner and Qualcomm authors faced a situation such as that
they were given a code dump and no datasheet and no data
tables either. That creates an especially complicated situation
where none of the above scenarios apply.

What we/you need to ask: what is most helpful for the Allwinner
community? What makes the barrier low for new contributions,
and makes it easiest to cooperate?

I try to live by this motto from IETF:

   "rough consensus and running code"

Please do the same.

Yours,
Linus Walleij

[toc] | [prev] | [next] | [standalone]


#1562968

FromMaxime Ripard <maxime.ripard@free-electrons.com>
Date2017-01-19 18:40 +0100
Message-ID<t1oQO-4uu-31@gated-at.bofh.it>
In reply to#1562523

[Multipart message — attachments visible in raw view] — view raw

On Thu, Jan 19, 2017 at 09:11:49PM +0800, Icenowy Zheng wrote:
> 19.01.2017, 17:23, "Linus Walleij" <linus.walleij@linaro.org>:
> > On Wed, Jan 18, 2017 at 10:44 AM, Andre Przywara <andre.przywara@arm.com> wrote:
> >
> >>  Any future SoCs could then just use that compatible and would describe
> >>  the SoC details in the DT, like it's meant to be and like we do already,
> >>  but extended by putting the mux value in there as well.
> >>  So the only kernel contribution would then be the DT, really, (...)
> >
> > Your different positions have existed since the inception of the
> > pinctrl subsystem:
> >
> > - One camp (myself included) wanted to describe the hardware mostly
> >   in the driver: functions, groups etc are tables in the driver file.
> >
> > - Another camp (OMAP included) think that the device tree should take
> >   store most things: groups functions, etc.
> >
> > What we know for sure should be described in DT is how different
> > IP blocks are connected in an SoC (e.g. interrupts, clocks, DMA
> > channels, regulators) and on the of course outside of the SoC, on
> > the board.
> >
> > The question here is whether the way a hardware has instantiated
> > a certain IP block when doing physical compilation in their
> > Verilog, VHDL or SystemC files, is something that should be
> > described in DT.
> >
> > Many companies have developed tools to
> > extract this data from their hardware design files and provide
> > it to developers as a blob och incomprehensible data, such was
> > the situation for OMAP for example. So to them it made most
> > sense to implement pinctrl-single, just parsing that data into
> > DTS(I) files.
> >
> > Other companies (such as STMicroelectronics) instead put a
> > team of people to write a datasheet with a special chapter
> > on how pins etc are connected, and programmers are given
> > this datasheet and need to again type in the data and define
> > groups etc.
> >
> > Whether parametrization of a HW block should be done in the
> > driver file from the compatible string or with custom attributes
> > in the node is not a simple answer to the question. OF is vague
> > on this kind of things: both solutions exist.
> >
> > Allwinner and Qualcomm authors faced a situation such as that
> > they were given a code dump and no datasheet and no data
> > tables either. That creates an especially complicated situation
> > where none of the above scenarios apply.
> 
> Allwinner do give user manual about the pin controller, and they're
> used when we write the pinctrl-sunxi driver.

That has not always been true for all the SoCs, and it's still not the
case, even for newer SoCs.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[toc] | [prev] | [next] | [standalone]


#1562976

FromMaxime Ripard <maxime.ripard@free-electrons.com>
Date2017-01-19 19:00 +0100
Message-ID<t1pa9-4BO-3@gated-at.bofh.it>
In reply to#1561401

[Multipart message — attachments visible in raw view] — view raw

On Wed, Jan 18, 2017 at 09:44:37AM +0000, Andre Przywara wrote:
> Hi,
> 
> On 16/01/17 16:31, Maxime Ripard wrote:
> > On Mon, Jan 09, 2017 at 12:16:00AM +0000, André Przywara wrote:
> >> On 05/01/17 22:42, Maxime Ripard wrote:
> >>> On Fri, Dec 30, 2016 at 01:55:44PM +0100, Linus Walleij wrote:
> >>>> On Mon, Dec 26, 2016 at 3:33 PM, André Przywara <andre.przywara@arm.com> wrote:
> >>>>
> >>>>> So while this patch technically looks correct, I was wondering if we
> >>>>> should really explore the possibility of making the whole of sunxi
> >>>>> pinctrl DT controlled.
> >>>>> I brought this up a while ago, but people weren't overly enthusiastic
> >>>>> about it, though their argument weren't really convincing to me[1].
> >>>>>
> >>>>> So:
> >>>>> As this "driver" here is basically a table linking GPIO bit settings
> >>>>> (the actual mux value) to names and every pin we care about needs to be
> >>>>> enumerated in the DT anyway, why not just add something like:
> >>>>> allwinner,pinmux = <4>;
> >>>>> to each pin(group) in the DT and get rid of this "driver" file here
> >>>>> entirely?
> >>>>
> >>>> I'm open to that if you can use pinctrl-single which is in the kernel
> >>>> for this purpose only, and is used with both OMAPs and HiSilicon.
> >>>
> >>> I'm not open to that, and I'm getting tired of discussing it over and
> >>> over again. Andre, if you want to be convinced again, please read the
> >>> last discussion we had on this topic.
> >>
> >> As I said: It didn't convince me back then. And frankly we didn't really
> >> discuss it back then, I just refrained from entering a discussion
> >> against _two_ maintainers at this time, since my capacity on this kind
> >> of email threads is really very limited - especially for something that
> >> is a hobby to me.
> > 
> > This is also (mostly) a hobby to me, which is exactly why I prefer to
> > work on something actually useful, rather than just discussing this
> > over and over again. Just like I don't want (myself, or anyone,
> > really, since we're all in the same boat) to have to maintain two
> > separate pinctrl drivers.
> > 
> > We're having a documented, simple, pinctrl binding, using the generic
> > bindings now (that almost everyone else is using now, or is very close
> > to), and we can leverage as much documentation and code from that. Why
> > would we want to create and maintain a new driver with a new binding,
> > that will need to be documented again, learned by everyone, and will
> > lead only to confusion across the people who just want to have their
> > board supported?
> 
> I agree, and thus was proposing a _slightly changed_ pinctrl driver
> which actually *reduces* the maintenance burden in the kernel.
> In the moment we need to add _both_ a pinctrl .dtsi node _and_ a kernel
> "driver" file, which is really boilerplate code plus a table.
> Also we need to make sure that both these files match.
> If a new SoC is really 99% similar to an existing one, atm we still need
> explicit kernel support if only one pin is changed (see the H5).

That's not true anymore. And while it's true that it reduces the
amount of maintainance on the kernel side and more on the DT side. And
from what you're constantly saying, the thing we can't plan on fixing
/ upgrading is the DT, while the kernel is easy to change.

Which means that if we ever want to fix a non-upgradable DT, the only
way to do that would be to add quirks fixing it in the kernel
itself. Adding more maintainance burden to the kernel.

But really, this is not up for debate. You're 4 years too late for
that for the original binding, and almost 2 years for the generic
binding.

> > I'm sorry, but this is also our jobs as maintainers to prevent all
> > these kind of issues, and to maintain consistency. Switching to one
> > binding to another breaks that consistency on many level,
> 
> Yet we did it for the clocks. The very same argumentation that you gave
> above applies there as well (two different bindings, two sets of drivers
> in the kernel, new learnings for people, etc.)

No, this is very different. An end user just wanting to plug a dumb
device on his i2c bus will never even see how clocks are
described. This is not true for pinctrl.

And all the other arguments for the clocks have been the same than the
pinctrl driver: every driver is converging to the new binding we've
been using, the table in the kernel is easier to fix, etc.

> One difference would be that the new pinctrl binding wouldn't be
> fundamentally different to the old one, up to the point where the old
> driver could possibly use the very same DT nodes (but that would need to
> be worked out).

The story is different if you manage to keep the binding. Every
platform (but TI's) is converging to the generic bindings. Not using
them is not an option. Having a different implementation is.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[toc] | [prev] | [next] | [standalone]


#1567260

FromLinus Walleij <linus.walleij@linaro.org>
Date2017-01-26 11:10 +0100
Message-ID<t3Pa9-61W-5@gated-at.bofh.it>
In reply to#1562976
On Thu, Jan 19, 2017 at 6:41 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:

> That's not true anymore. And while it's true that it reduces the
> amount of maintainance on the kernel side and more on the DT side. And
> from what you're constantly saying, the thing we can't plan on fixing
> / upgrading is the DT, while the kernel is easy to change.
>
> Which means that if we ever want to fix a non-upgradable DT, the only
> way to do that would be to add quirks fixing it in the kernel
> itself. Adding more maintainance burden to the kernel.

This is a good argument to not put groups and functions into the
DT at all. If the following propositions hold:

- Functions and group definitions will contain bugs

- Those bugs will need to be fixed by changing the buggy
  definitions

- It is hard to change the DTB, it is easy to change the zImage

Then by logical deduction the definitions should be in the kernel
to minimize maintenance burden.

There is a pattern amongst firmware people that they think that
they always get the group and function definitions right on first
try. As long as there are humans involved in the process, this
stance is provedly wrong, just use git log and you will see how
much of such bugs we fix, even in drivers and DTSes produced
by the vendors themselves.

Yours,
Linus Walleij

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web