From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752591AbbJOLPF (ORCPT ); Thu, 15 Oct 2015 07:15:05 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:36852 "EHLO mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752483AbbJOLPD (ORCPT ); Thu, 15 Oct 2015 07:15:03 -0400 Subject: Re: [PATCH 2/7] includes: dt-bindings: Add STM32F429 pinctrl DT bindings To: Maxime Coquelin , Linus Walleij , Mark Rutland , Rob Herring , linux-gpio@vger.kernel.org References: <1444853247-31114-1-git-send-email-mcoquelin.stm32@gmail.com> <1444853247-31114-3-git-send-email-mcoquelin.stm32@gmail.com> Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, afaerber@suse.de, devicetree@vger.kernel.org, bruherrera@gmail.com From: Daniel Thompson Message-ID: <561F8AB3.9010103@linaro.org> Date: Thu, 15 Oct 2015 12:14:59 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <1444853247-31114-3-git-send-email-mcoquelin.stm32@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14/10/15 21:07, Maxime Coquelin wrote: > Signed-off-by: Maxime Coquelin > --- > 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 > + > +#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?