diff mbox series

[v2,1/3] dt-bindings: add binding for i.MX8MQ IOMUXC

Message ID 20180201174923.7385-1-l.stach@pengutronix.de
State New
Headers show
Series [v2,1/3] dt-bindings: add binding for i.MX8MQ IOMUXC | expand

Commit Message

Lucas Stach Feb. 1, 2018, 5:49 p.m. UTC
This adds the binding for the i.MX8MQ pin controller, in the same
fashion as earlier i.MX SoCs.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
v2: switch to generic pinconf properties
---
 .../bindings/pinctrl/fsl,imx8mq-pinctrl.txt        | 39 ++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/fsl,imx8mq-pinctrl.txt

Comments

Rob Herring Feb. 5, 2018, 6:09 a.m. UTC | #1
On Thu, Feb 01, 2018 at 06:49:21PM +0100, Lucas Stach wrote:
> This adds the binding for the i.MX8MQ pin controller, in the same
> fashion as earlier i.MX SoCs.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
> v2: switch to generic pinconf properties
> ---
>  .../bindings/pinctrl/fsl,imx8mq-pinctrl.txt        | 39 ++++++++++++++++++++++
>  1 file changed, 39 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/pinctrl/fsl,imx8mq-pinctrl.txt
> 
> diff --git a/Documentation/devicetree/bindings/pinctrl/fsl,imx8mq-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/fsl,imx8mq-pinctrl.txt
> new file mode 100644
> index 000000000000..5c5d2d835d05
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/pinctrl/fsl,imx8mq-pinctrl.txt
> @@ -0,0 +1,39 @@
> +* Freescale IMX8MQ IOMUX Controller
> +
> +Please refer to fsl,imx-pinctrl.txt and pinctrl-bindings.txt in this directory
> +for common binding part and usage.
> +
> +=== Pin Controller Node ===
> +
> +Required properties:
> +- compatible: "fsl,imx8mq-iomuxc"
> +- reg: Must contain the base physical address and size of the iomuxc registers.
> +
> +=== Pin Configuration Node ===
> +Required properties:
> +- pinmux: Array of integersy, representing a group of pins mux setting.
> +	The format is pinmux = <PIN_FUNC_ID>, PIN_FUNC_ID is a pin working on
> +	a specific function.
> +
> +	Refer to imx8mq-pinfunc.h in device tree source folder for all available
> +	imx8mq PIN_FUNC_ID.
> +
> +Optional Properties:
> +- drive-strength		Integer: controls Drive Strength

I thought drive-strength is supposed to be be in mA. We should not have 
differing units in common properties. 

There was an Atmel binding the other day that this came up. 

> +					0: driver disabled
> +					1: 255 Ohm
> +					2: 105 Ohm
> +					3:  75 Ohm
> +					4:  85 Ohm
> +					5:  65 Ohm
> +					6:  45 Ohm
> +					7:  40 Ohm
> +- slew-rate:			Integer: controls Slew Rate
> +					0: Slow
> +					1: Medium
> +					2: Fast
> +					3: Maximum
> +- drive-open-drain		Bool: enable Open-drian
> +- bias-pull-up			Bool: enable Pull-up
> +- input-schmitt-enable		Bool: enable schmitt-trigger
> +- input-enable			Bool: enable input, overriding module settings
> -- 
> 2.15.1
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Lucas Stach Feb. 5, 2018, 10:09 a.m. UTC | #2
Am Montag, den 05.02.2018, 00:09 -0600 schrieb Rob Herring:
> On Thu, Feb 01, 2018 at 06:49:21PM +0100, Lucas Stach wrote:
> > This adds the binding for the i.MX8MQ pin controller, in the same
> > fashion as earlier i.MX SoCs.
> > 
> > > > Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> > ---
> > v2: switch to generic pinconf properties
> > ---
> >  .../bindings/pinctrl/fsl,imx8mq-pinctrl.txt        | 39 ++++++++++++++++++++++
> >  1 file changed, 39 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/pinctrl/fsl,imx8mq-pinctrl.txt
> > 
> > diff --git a/Documentation/devicetree/bindings/pinctrl/fsl,imx8mq-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/fsl,imx8mq-pinctrl.txt
> > new file mode 100644
> > index 000000000000..5c5d2d835d05
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/pinctrl/fsl,imx8mq-pinctrl.txt
> > @@ -0,0 +1,39 @@
> > +* Freescale IMX8MQ IOMUX Controller
> > +
> > +Please refer to fsl,imx-pinctrl.txt and pinctrl-bindings.txt in this directory
> > +for common binding part and usage.
> > +
> > +=== Pin Controller Node ===
> > +
> > +Required properties:
> > +- compatible: "fsl,imx8mq-iomuxc"
> > +- reg: Must contain the base physical address and size of the iomuxc registers.
> > +
> > +=== Pin Configuration Node ===
> > +Required properties:
> > +- pinmux: Array of integersy, representing a group of pins mux setting.
> > > > +	The format is pinmux = <PIN_FUNC_ID>, PIN_FUNC_ID is a pin working on
> > > > +	a specific function.
> > +
> > > > +	Refer to imx8mq-pinfunc.h in device tree source folder for all available
> > > > +	imx8mq PIN_FUNC_ID.
> > +
> > +Optional Properties:
> > +- drive-strength		Integer: controls Drive Strength
> 
> I thought drive-strength is supposed to be be in mA. We should not have 
> differing units in common properties. 
> 
> There was an Atmel binding the other day that this came up.

I know it's in the common binding, but it's going to be very hard to
support. The drive-strength in mA really depends on external loading of
the pin and the pin voltage, at least for the most widespread
controllers that only switch between resistors, instead of driving the
pin by a current regulator.
So we would need much more information, which doesn't really seem
practical.

I would much prefer if we just remove unit from the common binding and
let the drivers define it in a way that fits their hardware
description.

It's the same thing with the slew-rate really, but the common binding
didn't make the mistake to define a single unit there, with many
pincontrollers being really vague about how fast the slew really is,
but some may actually define it in uS or whatever else makes sense.

Regards,
Lucas
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Linus Walleij Feb. 5, 2018, 11:13 p.m. UTC | #3
On Mon, Feb 5, 2018 at 11:09 AM, Lucas Stach <l.stach@pengutronix.de> wrote:

>> > +Optional Properties:
>> > +- drive-strength           Integer: controls Drive Strength
>>
>> I thought drive-strength is supposed to be be in mA. We should not have
>> differing units in common properties.
>>
>> There was an Atmel binding the other day that this came up.
>
> I know it's in the common binding, but it's going to be very hard to
> support. The drive-strength in mA really depends on external loading of
> the pin and the pin voltage, at least for the most widespread
> controllers that only switch between resistors, instead of driving the
> pin by a current regulator.

How does this circuit really look? Can you sketch something so
we understand what is going on electronically here?

The way I imagine most drive strength out there works is by simply
connection more MOS-totempoles after each other and each of them
has a production-technology-related max output current like 4mA, so
by putting two in a series yoy double that to 8 mA.

Is that what you mean with "current regulator"?

If you mean rather "output impedance", that is something else and
something we need a new (generic) property for. I never saw that
before, really.

> I would much prefer if we just remove unit from the common binding and
> let the drivers define it in a way that fits their hardware
> description.

Yeah but is this really the same thing even ...

> It's the same thing with the slew-rate really, but the common binding
> didn't make the mistake to define a single unit there, with many
> pincontrollers being really vague about how fast the slew really is,
> but some may actually define it in uS or whatever else makes sense.

I agree with that. Also for skewrate and output time delays
(skew delay).

It's very unclear how cell libraries really implement this.
But with drive strength I thought we knew it ...

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Lucas Stach Feb. 6, 2018, 10:53 a.m. UTC | #4
Hi Linus,

Am Dienstag, den 06.02.2018, 00:13 +0100 schrieb Linus Walleij:
> > On Mon, Feb 5, 2018 at 11:09 AM, Lucas Stach <l.stach@pengutronix.de> wrote:
> 
> > > > +Optional Properties:
> > > > +- drive-strength           Integer: controls Drive Strength
> > > 
> > > I thought drive-strength is supposed to be be in mA. We should not have
> > > differing units in common properties.
> > > 
> > > There was an Atmel binding the other day that this came up.
> > 
> > I know it's in the common binding, but it's going to be very hard to
> > support. The drive-strength in mA really depends on external loading of
> > the pin and the pin voltage, at least for the most widespread
> > controllers that only switch between resistors, instead of driving the
> > pin by a current regulator.
> 
> How does this circuit really look? Can you sketch something so
> we understand what is going on electronically here?

There is no description of how the circuit really looks like and I
would very much prefer this not being a prerequisite to get some
software support in place.

The best description we have is from NXP AN5078:
"The drive strength enable (DSE) can be explained as series resistance
between an ideal driver's output and its load. To achieve maximal
transferred power, the impedance of the driver has to match the load
impedance."

Which means the control bits don't really vary the output impedance,
but the description models it like that. If we _assume_ the simple MOS
totempole setup then adding more totempoles will bring down the output
impedance.

> The way I imagine most drive strength out there works is by simply
> connection more MOS-totempoles after each other and each of them
> has a production-technology-related max output current like 4mA, so
> by putting two in a series yoy double that to 8 mA.

So with this description in mind the drive-strength property doesn't
describe an actual real world drive-strength, but some maximum current
output under ideal load matching?

That's pretty confusing actually, as in a real-world setup increasing
the drive-strength property value might negatively affect the load
matching, leading to _decreasing_ the actual drive-strength.

> Is that what you mean with "current regulator"?
> 
> If you mean rather "output impedance", that is something else and
> something we need a new (generic) property for. I never saw that
> before, really.

So, just because the description of the drive-strength value uses some
(idealized) output impedance, we are now going to introduce yet another
property for the same thing? This is confusing to people reading the
reference manual, which never speaks about output-impedance, but always
about drive-strength.

Hardware people (the ones responsible to come up with the padctrl
settings) are much more likely to read the reference manual than any
idealized dt-binding. I want to make it as easy as possible for them to
match up the hardware and reference manual with the DT description.
So, can we please just keep the drive-strength property and deal with
it being described in different units in different hardware manuals?

Regards,
Lucas
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Linus Walleij Feb. 6, 2018, 2:32 p.m. UTC | #5
On Tue, Feb 6, 2018 at 11:53 AM, Lucas Stach <l.stach@pengutronix.de> wrote:

Hi Lucas,

your reply seems a bit annoyed.

Are you annoyed with me?

In that case please take it down a bit, I understand it can
be stressful as developer, but I need to maintain the stuff
we're pushing in for years to come and it's my job to
ask the tricksy questions.

> Am Dienstag, den 06.02.2018, 00:13 +0100 schrieb Linus Walleij:
>> > On Mon, Feb 5, 2018 at 11:09 AM, Lucas Stach <l.stach@pengutronix.de> wrote:
>>
>> > > > +Optional Properties:
>> > > > +- drive-strength           Integer: controls Drive Strength
>> > >
>> > > I thought drive-strength is supposed to be be in mA. We should not have
>> > > differing units in common properties.
>> > >
>> > > There was an Atmel binding the other day that this came up.
>> >
>> > I know it's in the common binding, but it's going to be very hard to
>> > support. The drive-strength in mA really depends on external loading of
>> > the pin and the pin voltage, at least for the most widespread
>> > controllers that only switch between resistors, instead of driving the
>> > pin by a current regulator.
>>
>> How does this circuit really look? Can you sketch something so
>> we understand what is going on electronically here?
>
> There is no description of how the circuit really looks like and I
> would very much prefer this not being a prerequisite to get some
> software support in place.

That depends. If you're a hobbyist with limited access to
documentation I agree. In that case let's go for something
that floats your project, I'm fine with that. I have a weak spot
for people with a good project and limited resources, so I
am here to help. I'd say then let's go for some "nxp,foo" property.

If you are working for NXP directly or under contract, what you say
is that the left hand does not know what the right hand is doing and that
is never a good sign. Such as the hardware and software departments
do not talk to each other, do not have each other mail addresses
and practice what is called "throw over the wall-engineering".
Or throw it all the way over to Pengutronix, maybe, a separate
legal entity they don't even prioritize to inform. What do I know.

In this latter case it is more or less my responsibility as subsystem
maintainer to push back at NXP as a legal body, it has nothing to
do with the people involved. Especially not you personally. In this
case I am adressing your organization, not you.

So which one is it?

> The best description we have is from NXP AN5078:
> "The drive strength enable (DSE) can be explained as series resistance
> between an ideal driver's output and its load. To achieve maximal
> transferred power, the impedance of the driver has to match the load
> impedance."
>
> Which means the control bits don't really vary the output impedance,
> but the description models it like that. If we _assume_ the simple MOS
> totempole setup then adding more totempoles will bring down the output
> impedance.

+- drive-strength               Integer: controls Drive Strength
+                                       0: driver disabled
+                                       1: 255 Ohm
+                                       2: 105 Ohm
+                                       3:  75 Ohm
+                                       4:  85 Ohm
+                                       5:  65 Ohm
+                                       6:  45 Ohm
+                                       7:  40 Ohm

As for equal resistances R = Rx/N assuming it is
really 255 Ohms internal resistance per totempole:

1: 255
2: 127,5
3: 85
4: 63,75
5: 51
6: 42,5
7: 36,4

I don't know. Something is not right. Maybe this is how
CMOS work under load?

>> The way I imagine most drive strength out there works is by simply
>> connection more MOS-totempoles after each other and each of them
>> has a production-technology-related max output current like 4mA, so
>> by putting two in a series yoy double that to 8 mA.
>
> So with this description in mind the drive-strength property doesn't
> describe an actual real world drive-strength, but some maximum current
> output under ideal load matching?

I guess that is what other datasheets have been listing.
I have personally seen a few of those.

I don't know if it is as simple as a totem-pole, I guess
IIRC under ideal circumstances the internal resistance of an
operational amplifier is zero. E.g. on a popular TTL part uA 741
it is 5.5 milliohms. What is Rout for a normal CMOS totem-pole?
Some googling suggests ~400 Ohm so 255 Ohm may not be
so far off.

Does anyone else know?

This is pretty interesting stuff :D

> That's pretty confusing actually, as in a real-world setup increasing
> the drive-strength property value might negatively affect the load
> matching, leading to _decreasing_ the actual drive-strength.

This sounds like a perfect argument to create a new
property "output-impedance" and use that in my ears.
It makes more sense to a designer, because what they
really want to do, electrically, is to match impedances.

I am thinking some designer writing this device tree.
What they want to control is the output impedance, not
drive strength. So that name makes more sense.

>> Is that what you mean with "current regulator"?
>>
>> If you mean rather "output impedance", that is something else and
>> something we need a new (generic) property for. I never saw that
>> before, really.
>
> So, just because the description of the drive-strength value uses some
> (idealized) output impedance, we are now going to introduce yet another
> property for the same thing?

Yes it seems like a good idea, if (by your own line of reasoning)
it is the physical principle underlying these resistance settings.
Then we are likely to see it again.

> This is confusing to people reading the
> reference manual, which never speaks about output-impedance, but always
> about drive-strength.

Since we are already (obviously) confused, we have to choose
the lesser evil here.

Apparently what (board- system-) designers want to do is match
output resistance to load, I would argue that it is more confusing
to call that "drive strength", i.e. what is misleading is not what I am
discussing here, but the manual you are referring to. Just a bad
piece of technical writing.

> Hardware people (the ones responsible to come up with the padctrl
> settings) are much more likely to read the reference manual than any
> idealized dt-binding.

Can we talk to them about this?

I don't like to think about them as some foreign people in a far
away dimension we can never understand or communicate
with, how do they really do what they do?

> I want to make it as easy as possible for them to
> match up the hardware and reference manual with the DT description.

I was hoping we could dig in a bit and figure out what we
are going to do and why and how these people think.

I want to avoid poking magic values we don't really understand
into registers and using the manual as alchemic magic or
spellbook, essentially. (As so often happens...)

> So, can we please just keep the drive-strength property and deal with
> it being described in different units in different hardware manuals?

If you want something to match the specific hardware
manual from NXP and you don't want it to be translated
into the units of the DT binding, then I think it is better
to use something prefixed "nxp,*".

That clearly indicates that this is some NXP oddity that
we don't really understand.

I was just hoping not to introduce too many of these.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Lucas Stach Feb. 6, 2018, 3:47 p.m. UTC | #6
Hi Linus,

Am Dienstag, den 06.02.2018, 15:32 +0100 schrieb Linus Walleij:
> On Tue, Feb 6, 2018 at 11:53 AM, Lucas Stach <l.stach@pengutronix.de>
> wrote:
> 
> Hi Lucas,
> 
> your reply seems a bit annoyed.
> 
> Are you annoyed with me?
> 
> In that case please take it down a bit, I understand it can
> be stressful as developer, but I need to maintain the stuff
> we're pushing in for years to come and it's my job to
> ask the tricksy questions.

To be fully honest I'm a bit annoyed with the pinctrl framework making
things (IMHO) unnecessarily complex, for what is basically a pretty
easy task. But I'll try to keep things focused on the technical issue
at hand, so we can all make some progress.

> > Am Dienstag, den 06.02.2018, 00:13 +0100 schrieb Linus Walleij:
> > > > On Mon, Feb 5, 2018 at 11:09 AM, Lucas Stach <l.stach@pengutron
> > > > ix.de> wrote:
> > > > > > +Optional Properties:
> > > > > > +- drive-strength           Integer: controls Drive
> > > > > > Strength
> > > > > 
> > > > > I thought drive-strength is supposed to be be in mA. We
> > > > > should not have
> > > > > differing units in common properties.
> > > > > 
> > > > > There was an Atmel binding the other day that this came up.
> > > > 
> > > > I know it's in the common binding, but it's going to be very
> > > > hard to
> > > > support. The drive-strength in mA really depends on external
> > > > loading of
> > > > the pin and the pin voltage, at least for the most widespread
> > > > controllers that only switch between resistors, instead of
> > > > driving the
> > > > pin by a current regulator.
> > > 
> > > How does this circuit really look? Can you sketch something so
> > > we understand what is going on electronically here?
> > 
> > There is no description of how the circuit really looks like and I
> > would very much prefer this not being a prerequisite to get some
> > software support in place.
> 
> That depends. If you're a hobbyist with limited access to
> documentation I agree. In that case let's go for something
> that floats your project, I'm fine with that. I have a weak spot
> for people with a good project and limited resources, so I
> am here to help. I'd say then let's go for some "nxp,foo" property.
> 
> If you are working for NXP directly or under contract, what you say
> is that the left hand does not know what the right hand is doing and
> that
> is never a good sign. Such as the hardware and software departments
> do not talk to each other, do not have each other mail addresses
> and practice what is called "throw over the wall-engineering".
> Or throw it all the way over to Pengutronix, maybe, a separate
> legal entity they don't even prioritize to inform. What do I know.
> 
> In this latter case it is more or less my responsibility as subsystem
> maintainer to push back at NXP as a legal body, it has nothing to
> do with the people involved. Especially not you personally. In this
> case I am adressing your organization, not you.
> 
> So which one is it?

Neither. Pengutronix is mostly contracted by customers of NXP to enable
stuff in mainline. So I'm not working on this in my spare time, but I
still have to deal with the fact that I can only get the information
from the reference manual, NXP downstream BSPs and the occasional
helpful NXP employee.

Also even if we were inside of NXP, pad cells are usually something
that chip makers buy or get from the Fab design library. So probably
even they don't know what's inside exactly.

> > The best description we have is from NXP AN5078:
> > "The drive strength enable (DSE) can be explained as series
> > resistance
> > between an ideal driver's output and its load. To achieve maximal
> > transferred power, the impedance of the driver has to match the
> > load
> > impedance."
> > 
> > Which means the control bits don't really vary the output
> > impedance,
> > but the description models it like that. If we _assume_ the simple
> > MOS
> > totempole setup then adding more totempoles will bring down the
> > output
> > impedance.
> 
> +- drive-strength               Integer: controls Drive Strength
> +                                       0: driver disabled
> +                                       1: 255 Ohm
> +                                       2: 105 Ohm
> +                                       3:  75 Ohm
> +                                       4:  85 Ohm
> +                                       5:  65 Ohm
> +                                       6:  45 Ohm
> +                                       7:  40 Ohm
> 
> As for equal resistances R = Rx/N assuming it is
> really 255 Ohms internal resistance per totempole:
> 
> 1: 255
> 2: 127,5
> 3: 85
> 4: 63,75
> 5: 51
> 6: 42,5
> 7: 36,4
> 
> I don't know. Something is not right. Maybe this is how
> CMOS work under load?

Semiconductor physics tends to be slightly more complex than this. :)

> > > The way I imagine most drive strength out there works is by
> > > simply
> > > connection more MOS-totempoles after each other and each of them
> > > has a production-technology-related max output current like 4mA,
> > > so
> > > by putting two in a series yoy double that to 8 mA.
> > 
> > So with this description in mind the drive-strength property
> > doesn't
> > describe an actual real world drive-strength, but some maximum
> > current
> > output under ideal load matching?
> 
> I guess that is what other datasheets have been listing.
> I have personally seen a few of those.
> 
> I don't know if it is as simple as a totem-pole, I guess
> IIRC under ideal circumstances the internal resistance of an
> operational amplifier is zero. E.g. on a popular TTL part uA 741
> it is 5.5 milliohms. What is Rout for a normal CMOS totem-pole?
> Some googling suggests ~400 Ohm so 255 Ohm may not be
> so far off.
> 
> Does anyone else know?
> 
> This is pretty interesting stuff :D

Interesting indeed, but pretty far away from the dt-binding we set out
to discuss. And even if we might come up with a simplistic model of
what's going on inside the pad cell, how do we know if it matches
reality? Does this really help us define a useful binding?

> > That's pretty confusing actually, as in a real-world setup
> > increasing
> > the drive-strength property value might negatively affect the load
> > matching, leading to _decreasing_ the actual drive-strength.
> 
> This sounds like a perfect argument to create a new
> property "output-impedance" and use that in my ears.
> It makes more sense to a designer, because what they
> really want to do, electrically, is to match impedances.
> 
> I am thinking some designer writing this device tree.
> What they want to control is the output impedance, not
> drive strength. So that name makes more sense.
> 
> > > Is that what you mean with "current regulator"?
> > > 
> > > If you mean rather "output impedance", that is something else and
> > > something we need a new (generic) property for. I never saw that
> > > before, really.
> > 
> > So, just because the description of the drive-strength value uses
> > some
> > (idealized) output impedance, we are now going to introduce yet
> > another
> > property for the same thing?
> 
> Yes it seems like a good idea, if (by your own line of reasoning)
> it is the physical principle underlying these resistance settings.
> Then we are likely to see it again.
> 
> > This is confusing to people reading the
> > reference manual, which never speaks about output-impedance, but
> > always
> > about drive-strength.
> 
> Since we are already (obviously) confused, we have to choose
> the lesser evil here.
> 
> Apparently what (board- system-) designers want to do is match
> output resistance to load, I would argue that it is more confusing
> to call that "drive strength", i.e. what is misleading is not what I
> am
> discussing here, but the manual you are referring to. Just a bad
> piece of technical writing.

What usually happens is that hardware (I'm talking about board/system
here) designers start by reading the reference manual and hardware
design guide and work with that. They come up with all the necessary
configuration in the terms of the manual.

After that they or someone else has to translate this into DT. Things
get confusing when the reference manual and the DT binding disagree
about the used terms.

> > Hardware people (the ones responsible to come up with the padctrl
> > settings) are much more likely to read the reference manual than
> > any
> > idealized dt-binding.
> 
> Can we talk to them about this?
> 
> I don't like to think about them as some foreign people in a far
> away dimension we can never understand or communicate
> with, how do they really do what they do?

I wasn't referring to the chip design people, but board designers. I
talk to them quite often, but it's a lot easier if the Linux people and
board designers agree on the terms used. :)

> > I want to make it as easy as possible for them to
> > match up the hardware and reference manual with the DT description.
> 
> I was hoping we could dig in a bit and figure out what we
> are going to do and why and how these people think.
> 
> I want to avoid poking magic values we don't really understand
> into registers and using the manual as alchemic magic or
> spellbook, essentially. (As so often happens...)
> 
> > So, can we please just keep the drive-strength property and deal
> > with
> > it being described in different units in different hardware
> > manuals?
> 
> If you want something to match the specific hardware
> manual from NXP and you don't want it to be translated
> into the units of the DT binding, then I think it is better
> to use something prefixed "nxp,*".

> That clearly indicates that this is some NXP oddity that
> we don't really understand.

I'm not keen on using the common padctrl stuff, which already bloats
the DT description compared to i.MX6, and then again need to introduce
custom properties. That's just worst of both worlds, verbose DT to use
the common stuff, mixed with special properties, only valid on this
single controller.

If you insist I guess I'm fine with compromising on an "output-
impedance" common property, but then this just makes things harder for
everyone involved, as the impedance even seems to vary slightly with
the used pad voltage. So to not get into a combinatorial explosion, we
would need to describe this property as somethings like "output
impedance at 3.3v)", at least on this specific hardware.

Or we could agree that drive-strength property could be described in
some unit that makes sense on each controller. mA for hardware
described with some fabled ideal load matching, Ohms for hardware that
models it this way with maximum drive strength at the point of best
load matching.

In the end this is about mapping 3 hardware bits to a DT description...

Regards,
Lucas

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Linus Walleij Feb. 7, 2018, 9:09 a.m. UTC | #7
On Tue, Feb 6, 2018 at 4:47 PM, Lucas Stach <l.stach@pengutronix.de> wrote:

> To be fully honest I'm a bit annoyed with the pinctrl framework making
> things (IMHO) unnecessarily complex, for what is basically a pretty
> easy task.

My ambition is to make things readable, understandable and
maintainable. In generic terms, incorporating a bunch of knowledge
of the electronics that really happen into the stuff we encode in
the kernel.

I guess it varies a bit on what goal one has.

If the goal is "ship product with upstream kernel really fast now"
then things like pinctrl-single.c where we just hammer magic values
into registers, make sense. OMAP developers had no idea whatsoever
what their ASIC people or cell library authors were doing so they
just threw in the towel. HiSilicon also use this. Intels ambition was
to use ACPI BIOS to handle all pin control and route around the kernel
altogether, but that is not working out so well for them I think.

All of them are approaches to avoid putting the hairy details into the
kernel, just poke some magic values into some magic registers
and be happy.

So i.MX could have been like that, but then I guess you need to take
legacy into account and discuss with the other i.MX driver authors
about how they really wanted and want to do things.

Their current silence wrt this mailchain is actually becoming a
problem, and the problem is that discussing with you falls upwards
to me as subsystem maintainer. Which sucks. I prefer that people
who know this hardware discuss amongst themselves how they
want things to work.

Surely Sascha must have an opinion? It means much to me
what he wants to do. I take it you guys are colleagues?

> Pengutronix is mostly contracted by customers of NXP to enable
> stuff in mainline. So I'm not working on this in my spare time, but I
> still have to deal with the fact that I can only get the information
> from the reference manual, NXP downstream BSPs and the occasional
> helpful NXP employee.

Hm I see, this seems like a bit of crappy position to be in when
you just want to ask someone in hardware how things really work.

But we have Freescale i.MX maintainers on the inside of the company
now NXP (soon Qualcomm? soon Broadcom?).

Hell this mail is even going to linux-imx@nxp.com, what do they do
with it? Put it in a mailbox and never read it?

Surely someone on the inside must be able to provide some details.

> Also even if we were inside of NXP, pad cells are usually something
> that chip makers buy or get from the Fab design library. So probably
> even they don't know what's inside exactly.

Yeah that is what I call "throw over the wall engineering".
It's not good, if NXP works with information brick walls like that it is
not any good for them, because it is not any good for their customers.

Not something you or I can fix though...

> What usually happens is that hardware (I'm talking about board/system
> here) designers start by reading the reference manual and hardware
> design guide and work with that. They come up with all the necessary
> configuration in the terms of the manual.

Sometimes half-guessing and a bit of trial-and-error right?

> After that they or someone else has to translate this into DT. Things
> get confusing when the reference manual and the DT binding disagree
> about the used terms.

I see.

>> If you want something to match the specific hardware
>> manual from NXP and you don't want it to be translated
>> into the units of the DT binding, then I think it is better
>> to use something prefixed "nxp,*".
>
>> That clearly indicates that this is some NXP oddity that
>> we don't really understand.
>
> I'm not keen on using the common padctrl stuff, which already bloats
> the DT description compared to i.MX6,

This you need to discuss with the generic i.MX driver maintainers.
They are the maintainers of drivers/pinctrl/freescale/* after all.

They never put an entry in MAINTAINERS though, but I
always regarded these as the pinctrl maintainers for i.MX:

ARM/FREESCALE IMX / MXC ARM ARCHITECTURE
M:      Shawn Guo <shawnguo@kernel.org>
M:      Sascha Hauer <kernel@pengutronix.de>
R:      Fabio Estevam <fabio.estevam@nxp.com>

On top of this, Dong Aisheng, Gary Bisson and
Vladimir Zapolskiy has made major contributions.

It's a little ecosystem on its own, not really to be discussed
by just you and me. I wonder where the rest of the voices are,
I hope not silenced by organizational stress after the NXP
merger...

> and then again need to introduce
> custom properties. That's just worst of both worlds, verbose DT to use
> the common stuff, mixed with special properties, only valid on this
> single controller.

No matter how much you dislike it, it is what e.g. Qualcomm is
doing. (Who might soon be one and the same as NXP I hear.)

> If you insist I guess I'm fine with compromising on an "output-
> impedance" common property, but then this just makes things harder for
> everyone involved, as the impedance even seems to vary slightly with
> the used pad voltage. So to not get into a combinatorial explosion, we
> would need to describe this property as somethings like "output
> impedance at 3.3v)", at least on this specific hardware.

Hm, should it me "nxp,drive-strength" then, as it is just some
magic value? I guess "nxp,magic-drive-strength" is not going to
cut it :D

Also maybe we should use the old "freescale,*" notation for legacy
reasons... I don't know. This Vendor prefix seems less stable
than the chipsets.

> Or we could agree that drive-strength property could be described in
> some unit that makes sense on each controller. mA for hardware
> described with some fabled ideal load matching, Ohms for hardware that
> models it this way with maximum drive strength at the point of best
> load matching.

I am not like stubbornly against. I just want some discussion here,
it would be nice to know the opinion of the i.MX maintainers.

> In the end this is about mapping 3 hardware bits to a DT description...

Pleas don't think about it like "can't we just do this real simple
thing now, just merge this and stop being an ass".

Things just poking three bits can look very simple, like in so
many BSPs:

volatile unsigned long *foo;

foo = (unsigned long *) 0xfec0be00;
*foo &= ~0x700;
*foo |= 0x200; /* do the magic */

But this is not helpful for developers or maintainers. That is IMHO
why we have the frameworks and all the DT standardization in
the first place, exactly so we understand what we are doing.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dong Aisheng Feb. 7, 2018, 11:02 a.m. UTC | #8
SGkgTGludXMsDQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogTGludXMg
V2FsbGVpaiBbbWFpbHRvOmxpbnVzLndhbGxlaWpAbGluYXJvLm9yZ10NCj4gU2VudDogMjAxOOW5
tDLmnIg35pelIDE3OjA5DQo+IFRvOiBMdWNhcyBTdGFjaCA8bC5zdGFjaEBwZW5ndXRyb25peC5k
ZT47IEEucy4gRG9uZw0KPiA8YWlzaGVuZy5kb25nQG54cC5jb20+OyBkbC1saW51eC1pbXggPGxp
bnV4LWlteEBueHAuY29tPjsgR2FyeSBCaXNzb24NCj4gPGdhcnkuYmlzc29uQGJvdW5kYXJ5ZGV2
aWNlcy5jb20+OyBWbGFkaW1pciBaYXBvbHNraXkNCj4gPHZsYWRpbWlyX3phcG9sc2tpeUBtZW50
b3IuY29tPjsgU2FzY2hhIEhhdWVyIDxrZXJuZWxAcGVuZ3V0cm9uaXguZGU+DQo+IENjOiBSb2Ig
SGVycmluZyA8cm9iaEBrZXJuZWwub3JnPjsgTWFyayBSdXRsYW5kIDxtYXJrLnJ1dGxhbmRAYXJt
LmNvbT47DQo+IGxpbnV4LWdwaW9Admdlci5rZXJuZWwub3JnOyBvcGVuIGxpc3Q6T1BFTiBGSVJN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yc3RhbmQgd2hhdCB3ZSBhcmUgZG9p
bmcuDQo+IA0KPiBZb3VycywNCj4gTGludXMgV2FsbGVpag0K
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sascha Hauer Feb. 7, 2018, 11:11 a.m. UTC | #9
On Wed, Feb 07, 2018 at 10:09:20AM +0100, Linus Walleij wrote:
> On Tue, Feb 6, 2018 at 4:47 PM, Lucas Stach <l.stach@pengutronix.de> wrote:
> 
> > To be fully honest I'm a bit annoyed with the pinctrl framework making
> > things (IMHO) unnecessarily complex, for what is basically a pretty
> > easy task.
> 
> My ambition is to make things readable, understandable and
> maintainable. In generic terms, incorporating a bunch of knowledge
> of the electronics that really happen into the stuff we encode in
> the kernel.
> 
> I guess it varies a bit on what goal one has.
> 
> If the goal is "ship product with upstream kernel really fast now"
> then things like pinctrl-single.c where we just hammer magic values
> into registers, make sense. OMAP developers had no idea whatsoever
> what their ASIC people or cell library authors were doing so they
> just threw in the towel. HiSilicon also use this. Intels ambition was
> to use ACPI BIOS to handle all pin control and route around the kernel
> altogether, but that is not working out so well for them I think.
> 
> All of them are approaches to avoid putting the hairy details into the
> kernel, just poke some magic values into some magic registers
> and be happy.
> 
> So i.MX could have been like that, but then I guess you need to take
> legacy into account and discuss with the other i.MX driver authors
> about how they really wanted and want to do things.
> 
> Their current silence wrt this mailchain is actually becoming a
> problem, and the problem is that discussing with you falls upwards
> to me as subsystem maintainer. Which sucks. I prefer that people
> who know this hardware discuss amongst themselves how they
> want things to work.
> 
> Surely Sascha must have an opinion? It means much to me
> what he wants to do. I take it you guys are colleagues?

My opinion is that all that is generic about padctrl is a device driver
saying "Put my pins into a suitable mode". That is what padctrl is good
for and we are there for years now. I have always been happy with the
plain register values in the device tree. Before device tree we had
exactly these values in the board files and I never heard anyone
complaining about it. There were defines for the bits in the register
which you could use when you were unhappy with plain register values.

It's really trivial to look in the reference manual to make up the
needed register values. It's also trivial to take a register value
and look into the reference manual what this value does. Every
translation layer, call it generic properties, just makes things more
complicated. Often enough our input is register value tables
from either our customers our from spreadsheets from FSL/NXP. Every
translation layer in the way just means we have to translate the already
existing register values into something hoping that this correctly
translates back into the register values.

It's not that some board designer comes up with "I need a drive strength
of 150mA" and wants to put that value into the device tree. Instead they
start with the reference manual, see which values they can (must) adjust
and then adjust the values until they are happy. No one wants to ask
questions like "How do I have to manipulate that device tree to change
that particular bit?"

As said, I am happy with plain register values in the device tree and
I consider everything else overengineered.
FSL/NXP Reference Manuals are freely available and of high quality so
everybody can understand the register values. There's nothing magic to
them. That might change slightly when the Manuals are not available, but
even then I think that not the device tree ABI is the right place to
add that missing documentation.

Sascha
Fabio Estevam Feb. 7, 2018, 11:41 a.m. UTC | #10
[Adding Shawn on Cc]

On Wed, Feb 7, 2018 at 9:11 AM, Sascha Hauer <s.hauer@pengutronix.de> wrote:

> My opinion is that all that is generic about padctrl is a device driver
> saying "Put my pins into a suitable mode". That is what padctrl is good
> for and we are there for years now. I have always been happy with the
> plain register values in the device tree. Before device tree we had
> exactly these values in the board files and I never heard anyone
> complaining about it. There were defines for the bits in the register
> which you could use when you were unhappy with plain register values.
>
> It's really trivial to look in the reference manual to make up the
> needed register values. It's also trivial to take a register value
> and look into the reference manual what this value does. Every
> translation layer, call it generic properties, just makes things more
> complicated. Often enough our input is register value tables
> from either our customers our from spreadsheets from FSL/NXP. Every
> translation layer in the way just means we have to translate the already
> existing register values into something hoping that this correctly
> translates back into the register values.
>
> It's not that some board designer comes up with "I need a drive strength
> of 150mA" and wants to put that value into the device tree. Instead they
> start with the reference manual, see which values they can (must) adjust
> and then adjust the values until they are happy. No one wants to ask
> questions like "How do I have to manipulate that device tree to change
> that particular bit?"
>
> As said, I am happy with plain register values in the device tree and
> I consider everything else overengineered.
> FSL/NXP Reference Manuals are freely available and of high quality so
> everybody can understand the register values. There's nothing magic to
> them. That might change slightly when the Manuals are not available, but
> even then I think that not the device tree ABI is the right place to
> add that missing documentation.

I agree 100% with Sascha.

I am also happy with the current plain register values in device tree.

Having two methods (plain register values on most of i.MX SoCs and the
new generic one for imx7ulp, imx8mq) is confusing for the end users.

I would prefer to use the plain register values in device tree for all
i.MX SoCs instead.

Thanks
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dong Aisheng Feb. 7, 2018, 1:21 p.m. UTC | #11
Hi Sascha,

> -----Original Message-----

> From: Sascha Hauer [mailto:s.hauer@pengutronix.de]

> Sent: 2018年2月7日 19:12

> To: Linus Walleij <linus.walleij@linaro.org>

> Cc: Lucas Stach <l.stach@pengutronix.de>; A.s. Dong

> <aisheng.dong@nxp.com>; dl-linux-imx <linux-imx@nxp.com>; Gary Bisson

> <gary.bisson@boundarydevices.com>; Vladimir Zapolskiy

> <vladimir_zapolskiy@mentor.com>; Sascha Hauer <kernel@pengutronix.de>;

> Mark Rutland <mark.rutland@arm.com>; Rob Herring <robh@kernel.org>;

> open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

> <devicetree@vger.kernel.org>; patchwork-lst@pengutronix.de;

> linux-gpio@vger.kernel.org

> Subject: Re: [PATCH v2 1/3] dt-bindings: add binding for i.MX8MQ IOMUXC

> 

> On Wed, Feb 07, 2018 at 10:09:20AM +0100, Linus Walleij wrote:

> > On Tue, Feb 6, 2018 at 4:47 PM, Lucas Stach <l.stach@pengutronix.de> wrote:

> >

> > > To be fully honest I'm a bit annoyed with the pinctrl framework

> > > making things (IMHO) unnecessarily complex, for what is basically a

> > > pretty easy task.

> >

> > My ambition is to make things readable, understandable and

> > maintainable. In generic terms, incorporating a bunch of knowledge of

> > the electronics that really happen into the stuff we encode in the

> > kernel.

> >

> > I guess it varies a bit on what goal one has.

> >

> > If the goal is "ship product with upstream kernel really fast now"

> > then things like pinctrl-single.c where we just hammer magic values

> > into registers, make sense. OMAP developers had no idea whatsoever

> > what their ASIC people or cell library authors were doing so they just

> > threw in the towel. HiSilicon also use this. Intels ambition was to

> > use ACPI BIOS to handle all pin control and route around the kernel

> > altogether, but that is not working out so well for them I think.

> >

> > All of them are approaches to avoid putting the hairy details into the

> > kernel, just poke some magic values into some magic registers and be

> > happy.

> >

> > So i.MX could have been like that, but then I guess you need to take

> > legacy into account and discuss with the other i.MX driver authors

> > about how they really wanted and want to do things.

> >

> > Their current silence wrt this mailchain is actually becoming a

> > problem, and the problem is that discussing with you falls upwards to

> > me as subsystem maintainer. Which sucks. I prefer that people who know

> > this hardware discuss amongst themselves how they want things to work.

> >

> > Surely Sascha must have an opinion? It means much to me what he wants

> > to do. I take it you guys are colleagues?

> 

> My opinion is that all that is generic about padctrl is a device driver saying "Put

> my pins into a suitable mode". That is what padctrl is good for and we are there

> for years now. I have always been happy with the plain register values in the

> device tree. Before device tree we had exactly these values in the board files

> and I never heard anyone complaining about it. There were defines for the bits

> in the register which you could use when you were unhappy with plain register

> values.

> 

> It's really trivial to look in the reference manual to make up the needed register

> values. It's also trivial to take a register value and look into the reference

> manual what this value does. Every translation layer, call it generic properties,

> just makes things more complicated. Often enough our input is register value

> tables from either our customers our from spreadsheets from FSL/NXP. Every

> translation layer in the way just means we have to translate the already existing

> register values into something hoping that this correctly translates back into the

> register values.

> 

> It's not that some board designer comes up with "I need a drive strength of

> 150mA" and wants to put that value into the device tree. Instead they start

> with the reference manual, see which values they can (must) adjust and then

> adjust the values until they are happy. No one wants to ask questions like "How

> do I have to manipulate that device tree to change that particular bit?"

> 

> As said, I am happy with plain register values in the device tree and I consider

> everything else overengineered.

> FSL/NXP Reference Manuals are freely available and of high quality so everybody

> can understand the register values. There's nothing magic to them. That might

> change slightly when the Manuals are not available, but even then I think that

> not the device tree ABI is the right place to add that missing documentation.

> 


Probably as I first implemented generic pinconfig support for i.MX, personally
I'm tend to it a bit, mainly because below reasons we find in real situations:

First and most important, plain register value is a bit error prone.
(Actually we meet many times of issues during internal development).
User has to compose it manually by refer to reference manual
which might be more easy to mistake than using standard binding property.

And not everyone would like to compose the register value manually
when writing their device tree, they may simply do copy & paste of an exist one
and quickly test, if it works, everything is done. They don't know which setting is actually
used as they can see nothing from the plain register value. Untill the device becomes
unwork in some special circumstances, then they have to waste a lot time to find out
the pad setting issue. This happens especially more often when switch to
a new SoC while the pad config register layout changed a bit.
We certainly would like to avoid it!

Secondly, plain register value is also unreadable and unmaintainable,
also not quite friendly in reviewing other one's patches.

Last, it might be trivial, people don't want to refer to reference manual
again and again once being asked which driver strength or something else
Is used.

Regards
Dong Aisheng

> Sascha

> 

> --

> Pengutronix e.K.                           |

> |

> Industrial Linux Solutions                 |

> https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.p

> engutronix.de%2F&data=02%7C01%7Caisheng.dong%40nxp.com%7C2644d871

> 2e234a6c2e7a08d56e1b9b29%7Cbd8a2a2207224ec7b35f1c4f0497e341%7C0%

> 7C0%7C636535987211269744&sdata=vImuWxtT7Ya0uxEHrnROUYZ%2BiCWLs8

> LmxWB5oNPcgjk%3D&reserved=0  |

> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |

> Amtsgericht Hildesheim, HRA 2686           | Fax:

> +49-5121-206917-5555 |
Sascha Hauer Feb. 7, 2018, 1:49 p.m. UTC | #12
On Wed, Feb 07, 2018 at 01:21:44PM +0000, A.s. Dong wrote:
> Hi Sascha,
> 
> > -----Original Message-----
> > From: Sascha Hauer [mailto:s.hauer@pengutronix.de]
> > Sent: 2018年2月7日 19:12
> > To: Linus Walleij <linus.walleij@linaro.org>
> > Cc: Lucas Stach <l.stach@pengutronix.de>; A.s. Dong
> > <aisheng.dong@nxp.com>; dl-linux-imx <linux-imx@nxp.com>; Gary Bisson
> > <gary.bisson@boundarydevices.com>; Vladimir Zapolskiy
> > <vladimir_zapolskiy@mentor.com>; Sascha Hauer <kernel@pengutronix.de>;
> > Mark Rutland <mark.rutland@arm.com>; Rob Herring <robh@kernel.org>;
> > open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS
> > <devicetree@vger.kernel.org>; patchwork-lst@pengutronix.de;
> > linux-gpio@vger.kernel.org
> > Subject: Re: [PATCH v2 1/3] dt-bindings: add binding for i.MX8MQ IOMUXC
> > 
> > On Wed, Feb 07, 2018 at 10:09:20AM +0100, Linus Walleij wrote:
> > > On Tue, Feb 6, 2018 at 4:47 PM, Lucas Stach <l.stach@pengutronix.de> wrote:
> > >
> > > > To be fully honest I'm a bit annoyed with the pinctrl framework
> > > > making things (IMHO) unnecessarily complex, for what is basically a
> > > > pretty easy task.
> > >
> > > My ambition is to make things readable, understandable and
> > > maintainable. In generic terms, incorporating a bunch of knowledge of
> > > the electronics that really happen into the stuff we encode in the
> > > kernel.
> > >
> > > I guess it varies a bit on what goal one has.
> > >
> > > If the goal is "ship product with upstream kernel really fast now"
> > > then things like pinctrl-single.c where we just hammer magic values
> > > into registers, make sense. OMAP developers had no idea whatsoever
> > > what their ASIC people or cell library authors were doing so they just
> > > threw in the towel. HiSilicon also use this. Intels ambition was to
> > > use ACPI BIOS to handle all pin control and route around the kernel
> > > altogether, but that is not working out so well for them I think.
> > >
> > > All of them are approaches to avoid putting the hairy details into the
> > > kernel, just poke some magic values into some magic registers and be
> > > happy.
> > >
> > > So i.MX could have been like that, but then I guess you need to take
> > > legacy into account and discuss with the other i.MX driver authors
> > > about how they really wanted and want to do things.
> > >
> > > Their current silence wrt this mailchain is actually becoming a
> > > problem, and the problem is that discussing with you falls upwards to
> > > me as subsystem maintainer. Which sucks. I prefer that people who know
> > > this hardware discuss amongst themselves how they want things to work.
> > >
> > > Surely Sascha must have an opinion? It means much to me what he wants
> > > to do. I take it you guys are colleagues?
> > 
> > My opinion is that all that is generic about padctrl is a device driver saying "Put
> > my pins into a suitable mode". That is what padctrl is good for and we are there
> > for years now. I have always been happy with the plain register values in the
> > device tree. Before device tree we had exactly these values in the board files
> > and I never heard anyone complaining about it. There were defines for the bits
> > in the register which you could use when you were unhappy with plain register
> > values.
> > 
> > It's really trivial to look in the reference manual to make up the needed register
> > values. It's also trivial to take a register value and look into the reference
> > manual what this value does. Every translation layer, call it generic properties,
> > just makes things more complicated. Often enough our input is register value
> > tables from either our customers our from spreadsheets from FSL/NXP. Every
> > translation layer in the way just means we have to translate the already existing
> > register values into something hoping that this correctly translates back into the
> > register values.
> > 
> > It's not that some board designer comes up with "I need a drive strength of
> > 150mA" and wants to put that value into the device tree. Instead they start
> > with the reference manual, see which values they can (must) adjust and then
> > adjust the values until they are happy. No one wants to ask questions like "How
> > do I have to manipulate that device tree to change that particular bit?"
> > 
> > As said, I am happy with plain register values in the device tree and I consider
> > everything else overengineered.
> > FSL/NXP Reference Manuals are freely available and of high quality so everybody
> > can understand the register values. There's nothing magic to them. That might
> > change slightly when the Manuals are not available, but even then I think that
> > not the device tree ABI is the right place to add that missing documentation.
> > 
> 
> Probably as I first implemented generic pinconfig support for i.MX, personally
> I'm tend to it a bit, mainly because below reasons we find in real situations:
> 
> First and most important, plain register value is a bit error prone.
> (Actually we meet many times of issues during internal development).
> User has to compose it manually by refer to reference manual
> which might be more easy to mistake than using standard binding property.
> 
> And not everyone would like to compose the register value manually
> when writing their device tree, they may simply do copy & paste of an exist one
> and quickly test, if it works, everything is done. They don't know which setting is actually
> used as they can see nothing from the plain register value. Untill the device becomes
> unwork in some special circumstances, then they have to waste a lot time to find out
> the pad setting issue. This happens especially more often when switch to
> a new SoC while the pad config register layout changed a bit.
> We certainly would like to avoid it!
> 
> Secondly, plain register value is also unreadable and unmaintainable,
> also not quite friendly in reviewing other one's patches.
> 
> Last, it might be trivial, people don't want to refer to reference manual
> again and again once being asked which driver strength or something else
> Is used.

These issues could be solved by bitmask defines aswell, no need to bloat
the dtbs with strings.

Sascha
Shawn Guo Feb. 8, 2018, 8:56 a.m. UTC | #13
On Wed, Feb 07, 2018 at 09:41:22AM -0200, Fabio Estevam wrote:
> [Adding Shawn on Cc]

Thanks Fabio.

> On Wed, Feb 7, 2018 at 9:11 AM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> 
> > My opinion is that all that is generic about padctrl is a device driver
> > saying "Put my pins into a suitable mode". That is what padctrl is good
> > for and we are there for years now. I have always been happy with the
> > plain register values in the device tree. Before device tree we had
> > exactly these values in the board files and I never heard anyone
> > complaining about it. There were defines for the bits in the register
> > which you could use when you were unhappy with plain register values.
> >
> > It's really trivial to look in the reference manual to make up the
> > needed register values. It's also trivial to take a register value
> > and look into the reference manual what this value does. Every
> > translation layer, call it generic properties, just makes things more
> > complicated. Often enough our input is register value tables
> > from either our customers our from spreadsheets from FSL/NXP. Every
> > translation layer in the way just means we have to translate the already
> > existing register values into something hoping that this correctly
> > translates back into the register values.
> >
> > It's not that some board designer comes up with "I need a drive strength
> > of 150mA" and wants to put that value into the device tree. Instead they
> > start with the reference manual, see which values they can (must) adjust
> > and then adjust the values until they are happy. No one wants to ask
> > questions like "How do I have to manipulate that device tree to change
> > that particular bit?"
> >
> > As said, I am happy with plain register values in the device tree and
> > I consider everything else overengineered.
> > FSL/NXP Reference Manuals are freely available and of high quality so
> > everybody can understand the register values. There's nothing magic to
> > them. That might change slightly when the Manuals are not available, but
> > even then I think that not the device tree ABI is the right place to
> > add that missing documentation.
> 
> I agree 100% with Sascha.

I would vote for not going generic pinconf either, as the controversy
here starts from something, that indicates the generic stuff doesn't
work for i.MX.

Shawn
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dong Aisheng Feb. 8, 2018, 11:54 a.m. UTC | #14
PiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9tOiBBLnMuIERvbmcNCj4gU2VudDog
MjAxOOW5tDLmnIg35pelIDE5OjAzDQo+IFRvOiAnTGludXMgV2FsbGVpaicgPGxpbnVzLndhbGxl
aWpAbGluYXJvLm9yZz47IEx1Y2FzIFN0YWNoDQo+IDxsLnN0YWNoQHBlbmd1dHJvbml4Lm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b28gfD0gMHgyMDA7IC8qIGRvIHRoZSBtYWdpYyAqLw0K
PiA+DQo+ID4gQnV0IHRoaXMgaXMgbm90IGhlbHBmdWwgZm9yIGRldmVsb3BlcnMgb3IgbWFpbnRh
aW5lcnMuIFRoYXQgaXMgSU1ITw0KPiA+IHdoeSB3ZSBoYXZlIHRoZSBmcmFtZXdvcmtzIGFuZCBh
bGwgdGhlIERUIHN0YW5kYXJkaXphdGlvbiBpbiB0aGUgZmlyc3QNCj4gPiBwbGFjZSwgZXhhY3Rs
eSBzbyB3ZSB1bmRlcnN0YW5kIHdoYXQgd2UgYXJlIGRvaW5nLg0KPiA+DQo+ID4gWW91cnMsDQo+
ID4gTGludXMgV2FsbGVpag0K
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Lucas Stach Feb. 8, 2018, 3:28 p.m. UTC | #15
Am Donnerstag, den 08.02.2018, 16:56 +0800 schrieb Shawn Guo:
> On Wed, Feb 07, 2018 at 09:41:22AM -0200, Fabio Estevam wrote:
> > [Adding Shawn on Cc]
> 
> Thanks Fabio.
> 
> > On Wed, Feb 7, 2018 at 9:11 AM, Sascha Hauer <s.hauer@pengutronix.d
> > e> wrote:
> > 
> > > My opinion is that all that is generic about padctrl is a device
> > > driver
> > > saying "Put my pins into a suitable mode". That is what padctrl
> > > is good
> > > for and we are there for years now. I have always been happy with
> > > the
> > > plain register values in the device tree. Before device tree we
> > > had
> > > exactly these values in the board files and I never heard anyone
> > > complaining about it. There were defines for the bits in the
> > > register
> > > which you could use when you were unhappy with plain register
> > > values.
> > > 
> > > It's really trivial to look in the reference manual to make up
> > > the
> > > needed register values. It's also trivial to take a register
> > > value
> > > and look into the reference manual what this value does. Every
> > > translation layer, call it generic properties, just makes things
> > > more
> > > complicated. Often enough our input is register value tables
> > > from either our customers our from spreadsheets from FSL/NXP.
> > > Every
> > > translation layer in the way just means we have to translate the
> > > already
> > > existing register values into something hoping that this
> > > correctly
> > > translates back into the register values.
> > > 
> > > It's not that some board designer comes up with "I need a drive
> > > strength
> > > of 150mA" and wants to put that value into the device tree.
> > > Instead they
> > > start with the reference manual, see which values they can (must)
> > > adjust
> > > and then adjust the values until they are happy. No one wants to
> > > ask
> > > questions like "How do I have to manipulate that device tree to
> > > change
> > > that particular bit?"
> > > 
> > > As said, I am happy with plain register values in the device tree
> > > and
> > > I consider everything else overengineered.
> > > FSL/NXP Reference Manuals are freely available and of high
> > > quality so
> > > everybody can understand the register values. There's nothing
> > > magic to
> > > them. That might change slightly when the Manuals are not
> > > available, but
> > > even then I think that not the device tree ABI is the right place
> > > to
> > > add that missing documentation.
> > 
> > I agree 100% with Sascha.
> 
> I would vote for not going generic pinconf either, as the controversy
> here starts from something, that indicates the generic stuff doesn't
> work for i.MX.

So it seems with that we are at a point where the majority vote of
users/maintainers are in favor of keeping the binding that has served
us well on MX5/6. Which is right where we started with v1 of the MX8
patches.

How do we proceed? I would like to send out a respin of those series
next week. Can we all agree to roll back the pinctrl binding to the
MX5/6 one? Or are there still major reservations against it? I would
like to avoid introducing any unnecessary churn.

Regards,
Lucas
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Fabio Estevam Feb. 8, 2018, 7:19 p.m. UTC | #16
Hi Lucas,

On Thu, Feb 8, 2018 at 1:28 PM, Lucas Stach <l.stach@pengutronix.de> wrote:

> So it seems with that we are at a point where the majority vote of
> users/maintainers are in favor of keeping the binding that has served
> us well on MX5/6. Which is right where we started with v1 of the MX8
> patches.
>
> How do we proceed? I would like to send out a respin of those series
> next week. Can we all agree to roll back the pinctrl binding to the
> MX5/6 one? Or are there still major reservations against it? I would

Yes, looks like a good plan IMHO.

Thanks
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Linus Walleij Feb. 23, 2018, 10:08 a.m. UTC | #17
On Thu, Feb 8, 2018 at 4:28 PM, Lucas Stach <l.stach@pengutronix.de> wrote:

> So it seems with that we are at a point where the majority vote of
> users/maintainers are in favor of keeping the binding that has served
> us well on MX5/6. Which is right where we started with v1 of the MX8
> patches.
>
> How do we proceed? I would like to send out a respin of those series
> next week. Can we all agree to roll back the pinctrl binding to the
> MX5/6 one? Or are there still major reservations against it? I would
> like to avoid introducing any unnecessary churn.

What we need to see is for i.MX maintainers to agree, e.g.
figure out how to do all stuff in drivers/pinctrl/freescale/*
should be engineered going forward.

(Maybe that filepath and symbols needs to be renamed drivers/pinctrl/imx
by the way, this platform seems to change company more often
than I change my car tyres.)

I'll try to follow up on the resulting patch series.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/pinctrl/fsl,imx8mq-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/fsl,imx8mq-pinctrl.txt
new file mode 100644
index 000000000000..5c5d2d835d05
--- /dev/null
+++ b/Documentation/devicetree/bindings/pinctrl/fsl,imx8mq-pinctrl.txt
@@ -0,0 +1,39 @@ 
+* Freescale IMX8MQ IOMUX Controller
+
+Please refer to fsl,imx-pinctrl.txt and pinctrl-bindings.txt in this directory
+for common binding part and usage.
+
+=== Pin Controller Node ===
+
+Required properties:
+- compatible: "fsl,imx8mq-iomuxc"
+- reg: Must contain the base physical address and size of the iomuxc registers.
+
+=== Pin Configuration Node ===
+Required properties:
+- pinmux: Array of integersy, representing a group of pins mux setting.
+	The format is pinmux = <PIN_FUNC_ID>, PIN_FUNC_ID is a pin working on
+	a specific function.
+
+	Refer to imx8mq-pinfunc.h in device tree source folder for all available
+	imx8mq PIN_FUNC_ID.
+
+Optional Properties:
+- drive-strength		Integer: controls Drive Strength
+					0: driver disabled
+					1: 255 Ohm
+					2: 105 Ohm
+					3:  75 Ohm
+					4:  85 Ohm
+					5:  65 Ohm
+					6:  45 Ohm
+					7:  40 Ohm
+- slew-rate:			Integer: controls Slew Rate
+					0: Slow
+					1: Medium
+					2: Fast
+					3: Maximum
+- drive-open-drain		Bool: enable Open-drian
+- bias-pull-up			Bool: enable Pull-up
+- input-schmitt-enable		Bool: enable schmitt-trigger
+- input-enable			Bool: enable input, overriding module settings