From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnd Bergmann Subject: Re: [PATCH v2 11/18] pinctrl: Add pinctrl driver for STM32 MCUs Date: Tue, 10 Mar 2015 16:08:26 +0100 Message-ID: <2464742.YZIRrHto62@wuerfel> References: <1424455277-29983-1-git-send-email-mcoquelin.stm32@gmail.com> <1424455277-29983-12-git-send-email-mcoquelin.stm32@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1424455277-29983-12-git-send-email-mcoquelin.stm32@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: linux-arm-kernel@lists.infradead.org Cc: Mark Rutland , linux-doc@vger.kernel.org, Linus Walleij , Will Deacon , Nikolay Borisov , linux-api@vger.kernel.org, Jiri Slaby , Mauro Carvalho Chehab , Kees Cook , linux-arch@vger.kernel.org, Russell King , Jonathan Corbet , Daniel Lezcano , Antti Palosaari , geert@linux-m68k.org, linux-serial@vger.kernel.org, u.kleine-koenig@pengutronix.de, devicetree@vger.kernel.org, Philipp Zabel , Pawel Moll , Ian Campbell , Rusty Russell , Tejun Heo , Rob Herring , Thomas Gleixner , Michal List-Id: linux-arch.vger.kernel.org On Friday 20 February 2015 19:01:10 Maxime Coquelin wrote: > --- /dev/null > +++ b/include/dt-bindings/pinctrl/pinctrl-stm32.h > @@ -0,0 +1,43 @@ > +#ifndef _DT_BINDINGS_PINCTRL_STM32_H > +#define _DT_BINDINGS_PINCTRL_STM32_H > + > +/* Modes */ > +#define IN 0 > +#define OUT 1 > +#define ALT 2 > +#define ANALOG 3 I think it's better to prefix all the names with a string to identify what they are for, otherwise these are way too generic. > +/* Alternate functions */ > +#define ALT0 ((0 << 2) | ALT) > +#define ALT1 ((1 << 2) | ALT) > +#define ALT2 ((2 << 2) | ALT) > +#define ALT3 ((3 << 2) | ALT) > +#define ALT4 ((4 << 2) | ALT) > +#define ALT5 ((5 << 2) | ALT) > +#define ALT6 ((6 << 2) | ALT) > +#define ALT7 ((7 << 2) | ALT) > +#define ALT8 ((8 << 2) | ALT) > +#define ALT9 ((9 << 2) | ALT) > +#define ALT10 ((10 << 2) | ALT) > +#define ALT11 ((11 << 2) | ALT) > +#define ALT12 ((12 << 2) | ALT) > +#define ALT13 ((13 << 2) | ALT) > +#define ALT14 ((14 << 2) | ALT) > +#define ALT15 ((15 << 2) | ALT) You can have a single macro for these like #define STM32_PIN_ALT(x) ((x << 2) | ALT) > +/* Pull-Up/Down */ > +#define NO_PULL 0 > +#define PULL_UP 1 > +#define PULL_DOWN 2 > + > +/* Type */ > +#define PUSH_PULL (0 << 2) > +#define OPEN_DRAIN (1 << 2) > + These should probably not be stm32 specific at all, they sound rather generic, so maybe put the definitions into a common file. Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.kundenserver.de ([212.227.126.131]:56489 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753486AbbCJPKV (ORCPT ); Tue, 10 Mar 2015 11:10:21 -0400 From: Arnd Bergmann Subject: Re: [PATCH v2 11/18] pinctrl: Add pinctrl driver for STM32 MCUs Date: Tue, 10 Mar 2015 16:08:26 +0100 Message-ID: <2464742.YZIRrHto62@wuerfel> In-Reply-To: <1424455277-29983-12-git-send-email-mcoquelin.stm32@gmail.com> References: <1424455277-29983-1-git-send-email-mcoquelin.stm32@gmail.com> <1424455277-29983-12-git-send-email-mcoquelin.stm32@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-arch-owner@vger.kernel.org List-ID: To: linux-arm-kernel@lists.infradead.org Cc: Maxime Coquelin , u.kleine-koenig@pengutronix.de, afaerber@suse.de, geert@linux-m68k.org, Rob Herring , Philipp Zabel , Jonathan Corbet , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Russell King , Daniel Lezcano , Thomas Gleixner , Linus Walleij , Greg Kroah-Hartman , Jiri Slaby , Andrew Morton , "David S. Miller" , Mauro Carvalho Chehab , Joe Perches , Antti Palosaari , Tejun Heo , Will Deacon , Nikolay Borisov , Rusty Russell , Kees Cook , Michal Marek , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, linux-serial@vger.kernel.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org Message-ID: <20150310150826.IMEDZqmacDSiVqp-NKIF3laqp0LmleoARtDHE5q5p0I@z> On Friday 20 February 2015 19:01:10 Maxime Coquelin wrote: > --- /dev/null > +++ b/include/dt-bindings/pinctrl/pinctrl-stm32.h > @@ -0,0 +1,43 @@ > +#ifndef _DT_BINDINGS_PINCTRL_STM32_H > +#define _DT_BINDINGS_PINCTRL_STM32_H > + > +/* Modes */ > +#define IN 0 > +#define OUT 1 > +#define ALT 2 > +#define ANALOG 3 I think it's better to prefix all the names with a string to identify what they are for, otherwise these are way too generic. > +/* Alternate functions */ > +#define ALT0 ((0 << 2) | ALT) > +#define ALT1 ((1 << 2) | ALT) > +#define ALT2 ((2 << 2) | ALT) > +#define ALT3 ((3 << 2) | ALT) > +#define ALT4 ((4 << 2) | ALT) > +#define ALT5 ((5 << 2) | ALT) > +#define ALT6 ((6 << 2) | ALT) > +#define ALT7 ((7 << 2) | ALT) > +#define ALT8 ((8 << 2) | ALT) > +#define ALT9 ((9 << 2) | ALT) > +#define ALT10 ((10 << 2) | ALT) > +#define ALT11 ((11 << 2) | ALT) > +#define ALT12 ((12 << 2) | ALT) > +#define ALT13 ((13 << 2) | ALT) > +#define ALT14 ((14 << 2) | ALT) > +#define ALT15 ((15 << 2) | ALT) You can have a single macro for these like #define STM32_PIN_ALT(x) ((x << 2) | ALT) > +/* Pull-Up/Down */ > +#define NO_PULL 0 > +#define PULL_UP 1 > +#define PULL_DOWN 2 > + > +/* Type */ > +#define PUSH_PULL (0 << 2) > +#define OPEN_DRAIN (1 << 2) > + These should probably not be stm32 specific at all, they sound rather generic, so maybe put the definitions into a common file. Arnd