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


Groups > linux.kernel > #1247125 > unrolled thread

[PATCH 0/7] Add STM32 pinctrl/GPIO driver

Started byMaxime Coquelin <mcoquelin.stm32@gmail.com>
First post2015-10-14 22:10 +0200
Last post2015-10-15 14:00 +0200
Articles 5 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/7] Add STM32 pinctrl/GPIO driver Maxime Coquelin <mcoquelin.stm32@gmail.com> - 2015-10-14 22:10 +0200
    [PATCH 1/7] ARM: Kconfig: Introduce MACH_STM32F429 flag Maxime Coquelin <mcoquelin.stm32@gmail.com> - 2015-10-14 22:20 +0200
    Re: [PATCH 2/7] includes: dt-bindings: Add STM32F429 pinctrl DT  bindings Daniel Thompson <daniel.thompson@linaro.org> - 2015-10-15 13:20 +0200
      Re: [PATCH 2/7] includes: dt-bindings: Add STM32F429 pinctrl DT bindings Maxime Coquelin <mcoquelin.stm32@gmail.com> - 2015-10-15 13:30 +0200
        Re: [PATCH 2/7] includes: dt-bindings: Add STM32F429 pinctrl DT  bindings Daniel Thompson <daniel.thompson@linaro.org> - 2015-10-15 14:00 +0200

#1247125 — [PATCH 0/7] Add STM32 pinctrl/GPIO driver

FromMaxime Coquelin <mcoquelin.stm32@gmail.com>
Date2015-10-14 22:10 +0200
Subject[PATCH 0/7] Add STM32 pinctrl/GPIO driver
Message-ID<qjAx4-CQ-7@gated-at.bofh.it>
Hi Linus, all,

As you suggested during the submission of the STM32 machine support,
I reworked the STM32 pinctrl driver to use the standardized pin config
bindings.

The STM32 family has 16 pins per GPIO bank, and the number of bank varies
depending on the model.

Pins can be multiplexed either in GPIO mode, alternate function (up to 15
functions per pin) or analog (for ADC/DAC).

Kind regards,
Maxime

Maxime Coquelin (7):
  ARM: Kconfig: Introduce MACH_STM32F429 flag
  includes: dt-bindings: Add STM32F429 pinctrl DT bindings
  Documentation: dt-bindings: Document STM32 pinctrl driver DT bindings
  pinctrl: Add support STM32 MCUs
  ARM: mach-stm32: Select pinctrl
  ARM: dts: Add pinctrl node to STM32F429
  ARM: dts: Add USART1 pin config to STM32F429 boards

 .../bindings/pinctrl/st,stm32-pinctrl.txt          |  113 ++
 arch/arm/Kconfig                                   |    6 +
 arch/arm/boot/dts/stm32429i-eval.dts               |    2 +
 arch/arm/boot/dts/stm32f429-disco.dts              |    2 +
 arch/arm/boot/dts/stm32f429.dtsi                   |  110 ++
 drivers/pinctrl/Kconfig                            |    1 +
 drivers/pinctrl/Makefile                           |    4 +-
 drivers/pinctrl/stm32/Kconfig                      |   16 +
 drivers/pinctrl/stm32/Makefile                     |    5 +
 drivers/pinctrl/stm32/pinctrl-stm32.c              |  856 +++++++++++
 drivers/pinctrl/stm32/pinctrl-stm32.h              |   43 +
 drivers/pinctrl/stm32/pinctrl-stm32f429.c          | 1598 ++++++++++++++++++++
 include/dt-bindings/pinctrl/pinctrl-stm32.h        |   12 +
 include/dt-bindings/pinctrl/stm32f429-pinfunc.h    | 1241 +++++++++++++++
 14 files changed, 4008 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/st,stm32-pinctrl.txt
 create mode 100644 drivers/pinctrl/stm32/Kconfig
 create mode 100644 drivers/pinctrl/stm32/Makefile
 create mode 100644 drivers/pinctrl/stm32/pinctrl-stm32.c
 create mode 100644 drivers/pinctrl/stm32/pinctrl-stm32.h
 create mode 100644 drivers/pinctrl/stm32/pinctrl-stm32f429.c
 create mode 100644 include/dt-bindings/pinctrl/pinctrl-stm32.h
 create mode 100644 include/dt-bindings/pinctrl/stm32f429-pinfunc.h

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1247130 — [PATCH 1/7] ARM: Kconfig: Introduce MACH_STM32F429 flag

FromMaxime Coquelin <mcoquelin.stm32@gmail.com>
Date2015-10-14 22:20 +0200
Subject[PATCH 1/7] ARM: Kconfig: Introduce MACH_STM32F429 flag
Message-ID<qjAGK-O8-13@gated-at.bofh.it>
In reply to#1247125
This patch introduces the MACH_STM32F429 to make possible to only select
STM32F429 pinctrl driver.

By default, all the MACH_STM32Fxxx flags will be set with STM32 defconfig.

Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
---
 arch/arm/Kconfig | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 72ad724..bf94e54 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -988,6 +988,11 @@ config ARCH_STM32
 	help
 	  Support for STMicroelectronics STM32 processors.
 
+config MACH_STM32F429
+	bool "STMicrolectronics STM32F429"
+	depends on ARCH_STM32
+	default y
+
 # Definitions to make life easier
 config ARCH_ACORN
 	bool
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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


#1247690 — Re: [PATCH 2/7] includes: dt-bindings: Add STM32F429 pinctrl DT bindings

FromDaniel Thompson <daniel.thompson@linaro.org>
Date2015-10-15 13:20 +0200
SubjectRe: [PATCH 2/7] includes: dt-bindings: Add STM32F429 pinctrl DT bindings
Message-ID<qjOJH-4LQ-9@gated-at.bofh.it>
In reply to#1247125
On 14/10/15 21:07, Maxime Coquelin wrote:
> Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
> ---
>   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..979e4eb
> --- /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 (STM32_PIN_NO(0) | STM32_PIN_GPIO)
> +#define STM32F429_PA0_FUNC_TIM2_CH1 TIM2_ETR (STM32_PIN_NO(0) | STM32_PIN_AF(1))

For the clock driver I was advised to get rid of this sort of "heroics" 
and expose raw numbers from the datasheet directly to DT bindings users.

Should the same logic apply to this *huge* collection of macros?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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


#1247699 — Re: [PATCH 2/7] includes: dt-bindings: Add STM32F429 pinctrl DT bindings

FromMaxime Coquelin <mcoquelin.stm32@gmail.com>
Date2015-10-15 13:30 +0200
SubjectRe: [PATCH 2/7] includes: dt-bindings: Add STM32F429 pinctrl DT bindings
Message-ID<qjOTo-4XL-27@gated-at.bofh.it>
In reply to#1247690
2015-10-15 13:14 GMT+02:00 Daniel Thompson <daniel.thompson@linaro.org>:
> On 14/10/15 21:07, Maxime Coquelin wrote:
>>
>> Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
>> ---
>>   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..979e4eb
>> --- /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 (STM32_PIN_NO(0) | STM32_PIN_GPIO)
>> +#define STM32F429_PA0_FUNC_TIM2_CH1 TIM2_ETR (STM32_PIN_NO(0) |
>> STM32_PIN_AF(1))
>
>
> For the clock driver I was advised to get rid of this sort of "heroics" and
> expose raw numbers from the datasheet directly to DT bindings users.
>
> Should the same logic apply to this *huge* collection of macros?

I'm open to change, I just took example on the Mediatek implementation.
Advantage is that checkpatch will be more silent, drawback is that it
will be a little harder to understand how these values are generated.
If we decide to change to raw values, then the DT Bindings
documentation will need to be more verbose on the way these values are
generated.

Note that it will not be painful, as I can generate them from a script.

Regards,
Maxime
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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


#1247728 — Re: [PATCH 2/7] includes: dt-bindings: Add STM32F429 pinctrl DT bindings

FromDaniel Thompson <daniel.thompson@linaro.org>
Date2015-10-15 14:00 +0200
SubjectRe: [PATCH 2/7] includes: dt-bindings: Add STM32F429 pinctrl DT bindings
Message-ID<qjPmr-5vG-15@gated-at.bofh.it>
In reply to#1247699
On 15/10/15 12:29, Maxime Coquelin wrote:
> 2015-10-15 13:14 GMT+02:00 Daniel Thompson <daniel.thompson@linaro.org>:
>> On 14/10/15 21:07, Maxime Coquelin wrote:
>>>
>>> Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
>>> ---
>>>    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..979e4eb
>>> --- /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 (STM32_PIN_NO(0) | STM32_PIN_GPIO)
>>> +#define STM32F429_PA0_FUNC_TIM2_CH1 TIM2_ETR (STM32_PIN_NO(0) |
>>> STM32_PIN_AF(1))
>>
>>
>> For the clock driver I was advised to get rid of this sort of "heroics" and
>> expose raw numbers from the datasheet directly to DT bindings users.
>>
>> Should the same logic apply to this *huge* collection of macros?
>
> I'm open to change, I just took example on the Mediatek implementation.
> Advantage is that checkpatch will be more silent, drawback is that it
> will be a little harder to understand how these values are generated.
> If we decide to change to raw values, then the DT Bindings
> documentation will need to be more verbose on the way these values are
> generated.

To be honest I was thinking about moaning about that anyway. Its pretty 
tough from the docs you have currently to figure out the encoding.

Does having header files really excuse us from documenting the bindings 
properly? ;-)


Daniel.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web