2015-11-06 12:57:35

by Maxime Coquelin

[permalink] [raw]
Subject: Re: [PATCH v2 3/9] includes: dt-bindings: Add STM32F429 pinctrl DT bindings

2015-10-22 14:35 GMT+02:00 Linus Walleij <[email protected]>:
> On Tue, Oct 20, 2015 at 6:32 PM, Maxime Coquelin
> <[email protected]> wrote:
>> 2015-10-20 12:06 GMT+02:00 Daniel Thompson <[email protected]>:
>>> On 17/10/15 18:23, Maxime Coquelin wrote:
>
>>> I suggesting that, like with the clock driver, there is no need to the
>>> STM32F429_PAXX_FUNC_YYY macros at all.
>>>
>>> Given the way you can enumerate pin config options in stm32f429.dtsi then I
>>> think stm32f429.dtsi is the only file that will ever include this header? If
>>> so then why not just plug the values directly into the pinmux fields. Its
>>> not duplicative and is easier to map back to data sheets.
>>>
>>> ~~~
>>> #define PIN_NO(x) ...
>>> #define PIN_AF(x) ...
>>>
>>> usart1_pins_a: usart1@0 {
>>> pins1 {
>>> pinmux = PIN_NO(9) | PIN_AF(7);
>>> bias-disable;
>>> drive-push-pull;
>>> slew-rate = <0>;
>>> };
>>> ...
>>> };
>>> ~~~
>>
>> The advantage with the defines is that you can see easily which pin we
>> are talking about.
>> Moreover, the defines are generated from the datasheet, so it is
>> painless to generate them.
>> And it will be consistent with Mediatek implementation, on which I
>> heavily inspired.
>>
>> Linus, what is your view?
>
> I have no strong view of this at all.
>
> I would ask the opinion of other people doing numbered muxes
> to see what is generally best for everyone to use,
> Sascha Hauer specifically, or the Mediatek people.

Thinking again at it, I persist to believe have the defines makes it
easier to use.
With auto-completion, it makes it faster and less error prone to
select the right
alternate function without parsing the datasheet.

But as these defines are not actually used on driver side, maybe I
could just move
them to the dts directory?

Regards,
Maxime


2015-11-17 11:00:10

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH v2 3/9] includes: dt-bindings: Add STM32F429 pinctrl DT bindings

On Fri, Nov 6, 2015 at 1:57 PM, Maxime Coquelin
<[email protected]> wrote:

> Thinking again at it, I persist to believe have the defines makes it
> easier to use.
> With auto-completion, it makes it faster and less error prone to
> select the right
> alternate function without parsing the datasheet.

Auto-completion ... should we design our source code to
fit certain editors?

> But as these defines are not actually used on driver side, maybe I
> could just move
> them to the dts directory?

No strong opinion there. include/dt-bindings is part of the bindings
documentation actually so I guess it goes there.

Yours,
Linus Walleij

2015-11-30 15:55:38

by Maxime Coquelin

[permalink] [raw]
Subject: Re: [PATCH v2 3/9] includes: dt-bindings: Add STM32F429 pinctrl DT bindings

2015-11-17 12:00 GMT+01:00 Linus Walleij <[email protected]>:
> On Fri, Nov 6, 2015 at 1:57 PM, Maxime Coquelin
> <[email protected]> wrote:
>
>> Thinking again at it, I persist to believe have the defines makes it
>> easier to use.
>> With auto-completion, it makes it faster and less error prone to
>> select the right
>> alternate function without parsing the datasheet.
>
> Auto-completion ... should we design our source code to
> fit certain editors?
No, you are right.
But even without auto-completion, it is easier to have the values pre-computed.
And Mediatek has the defines, so it is better to do the same for STM32
for consistency.

>> But as these defines are not actually used on driver side, maybe I
>> could just move
>> them to the dts directory?
>
> No strong opinion there. include/dt-bindings is part of the bindings
> documentation actually so I guess it goes there.
Ok.

Thanks,
Maxime