linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maxime Coquelin <mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Daniel Thompson
	<daniel.thompson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Linus Walleij
	<linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: "Mark Rutland" <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	"Rob Herring" <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	"linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"Arnd Bergmann" <arnd-r2nGTMty4D4@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"Andreas Färber" <afaerber-l3A5Bk7waGM@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"Bruno Herrera"
	<bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH v2 3/9] includes: dt-bindings: Add STM32F429 pinctrl DT bindings
Date: Tue, 20 Oct 2015 18:32:36 +0200	[thread overview]
Message-ID: <CALszF6DQ2G_Fzhk_SP+A0i_Z4mg9etdf1NcfQS3cPpB0zNot-w@mail.gmail.com> (raw)
In-Reply-To: <56261239.5030007-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

2015-10-20 12:06 GMT+02:00 Daniel Thompson <daniel.thompson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>:
> On 17/10/15 18:23, Maxime Coquelin wrote:
>>
>> Signed-off-by: Maxime Coquelin <mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> ---
>>   include/dt-bindings/pinctrl/pinctrl-stm32.h     |   12 +
>>   include/dt-bindings/pinctrl/stm32f429-pinfunc.h | 1241
>> +++++++++++++++++++++++
>>   2 files changed, 1253 insertions(+)
>>   create mode 100644 include/dt-bindings/pinctrl/pinctrl-stm32.h
>>   create mode 100644 include/dt-bindings/pinctrl/stm32f429-pinfunc.h
>>
>> diff --git a/include/dt-bindings/pinctrl/pinctrl-stm32.h
>> b/include/dt-bindings/pinctrl/pinctrl-stm32.h
>> new file mode 100644
>> index 0000000..a2e7222
>> --- /dev/null
>> +++ b/include/dt-bindings/pinctrl/pinctrl-stm32.h
>> @@ -0,0 +1,12 @@
>> +#ifndef _DT_BINDINGS_PINCTRL_STM32_H
>> +#define _DT_BINDINGS_PINCTRL_STM32_H
>> +
>> +#define STM32_PIN_NO(x) ((x) << 8)
>> +#define STM32_GET_PIN_NO(x) ((x) >> 8)
>> +#define STM32_GET_PIN_FUNC(x) ((x) & 0xff)
>> +
>> +#define STM32_PIN_GPIO         0
>> +#define STM32_PIN_AF(x)                ((x) + 1)
>> +#define STM32_PIN_ANALOG       (STM32_PIN_AF(15) + 1)
>> +
>> +#endif /* _DT_BINDINGS_PINCTRL_STM32_H */
>> diff --git a/include/dt-bindings/pinctrl/stm32f429-pinfunc.h
>> b/include/dt-bindings/pinctrl/stm32f429-pinfunc.h
>> new file mode 100644
>> index 0000000..9dd5fd0
>> --- /dev/null
>> +++ b/include/dt-bindings/pinctrl/stm32f429-pinfunc.h
>> @@ -0,0 +1,1241 @@
>> +#ifndef _DT_BINDINGS_STM32F429_PINFUNC_H
>> +#define _DT_BINDINGS_STM32F429_PINFUNC_H
>> +
>> +#include <dt-bindings/pinctrl/pinctrl-stm32.h>
>> +
>> +#define STM32F429_PA0_FUNC_GPIO 0x0
>> +#define STM32F429_PA0_FUNC_TIM2_CH1_TIM2_ETR 0x2
>
>
> Did you expand these out after my feedback (instead of things like:
> STM32_PIN_NO(0) | STM32_PIN_AF(1) )?
Yes.

>
> If so I must have been somewhat unclear.
Most likely I didn't understood what you meant!

>
> 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?

Thanks,
Maxime
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-10-20 16:32 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-17 17:23 [PATCH v2 0/9] Add STM32 pinctrl/GPIO driver Maxime Coquelin
2015-10-17 17:23 ` [PATCH v2 1/9] ARM: Kconfig: Introduce MACH_STM32F429 flag Maxime Coquelin
2015-10-17 17:23 ` [PATCH v2 2/9] Documentation: dt-bindings: Document STM32 pinctrl driver DT bindings Maxime Coquelin
2015-10-17 17:23 ` [PATCH v2 3/9] includes: dt-bindings: Add STM32F429 pinctrl " Maxime Coquelin
     [not found]   ` <1445102604-11502-4-git-send-email-mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-10-20 10:06     ` Daniel Thompson
     [not found]       ` <56261239.5030007-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-10-20 16:32         ` Maxime Coquelin [this message]
2015-10-22 12:35           ` Linus Walleij
2015-11-06 12:57             ` Maxime Coquelin
2015-11-17 11:00               ` Linus Walleij
2015-11-30 15:55                 ` Maxime Coquelin
2015-10-17 17:23 ` [PATCH v2 4/9] pinctrl: Add support STM32 MCUs Maxime Coquelin
     [not found]   ` <1445102604-11502-5-git-send-email-mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-12-01  9:53     ` Maxime Coquelin
2015-12-10 17:08       ` Linus Walleij
2015-12-11  8:20         ` Patrice Chotard
2015-12-11  8:26           ` Maxime Coquelin
2015-10-17 17:23 ` [PATCH v2 5/9] ARM: mach-stm32: Select pinctrl Maxime Coquelin
     [not found]   ` <1445102604-11502-6-git-send-email-mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-10-26 13:37     ` Linus Walleij
2015-10-17 17:23 ` [PATCH v2 6/9] ARM: dts: Add pinctrl node to STM32F429 Maxime Coquelin
2015-10-17 17:23 ` [PATCH v2 7/9] ARM: dts: Add USART1 pin config to STM32F429 boards Maxime Coquelin
2015-10-26 13:38   ` Linus Walleij
2015-10-17 17:23 ` [PATCH v2 8/9] ARM: dts: Add leds support to STM32F429 Discovery board Maxime Coquelin
2015-10-26 13:41   ` Linus Walleij
2015-10-27 20:31     ` Maxime Coquelin
2015-10-27 21:37       ` Andreas Färber
2015-10-27 21:46         ` Linus Walleij
2015-10-27 21:52           ` Andreas Färber
     [not found]             ` <562FF234.9010403-l3A5Bk7waGM@public.gmane.org>
2015-10-28  8:09               ` Daniel Thompson
2015-10-28 14:24                 ` Maxime Coquelin
2015-10-17 17:23 ` [PATCH v2 9/9] ARM: config: Enable GPIO Led driver in stm32_defconfig Maxime Coquelin
2015-10-26 13:42   ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALszF6DQ2G_Fzhk_SP+A0i_Z4mg9etdf1NcfQS3cPpB0zNot-w@mail.gmail.com \
    --to=mcoquelin.stm32-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=afaerber-l3A5Bk7waGM@public.gmane.org \
    --cc=arnd-r2nGTMty4D4@public.gmane.org \
    --cc=bruherrera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=daniel.thompson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).