[U-Boot] [PATCH 1/3] imx: Add GPIO_TO_PORT macro

Vikram Narayanan
2012-04-09T16:09:28Z

Hi,

On 4/6/2012 2:26 PM, Stefano Babic wrote:
> On 04/04/2012 18:05, Vikram Narayanan wrote:
>> imx: Add GPIO_TO_PORT macro
>>
>> Signed-off-by: Vikram Narayanan<vikram186@gmail.com>
>
> Hi,
>
>> ---
>> arch/arm/include/asm/arch-mx5/gpio.h | 2 ++
>> arch/arm/include/asm/arch-mx6/gpio.h | 2 ++
>> 2 files changed, 4 insertions(+), 0 deletions(-)
>> 50.0% arch/arm/include/asm/arch-mx5/
>> 50.0% arch/arm/include/asm/arch-mx6/
>>
>> diff --git a/arch/arm/include/asm/arch-mx5/gpio.h b/arch/arm/include/asm/arch-mx5/gpio.h
>> index 1dc34e9..bcb5edb 100644
>> --- a/arch/arm/include/asm/arch-mx5/gpio.h
>> +++ b/arch/arm/include/asm/arch-mx5/gpio.h
>> @@ -25,6 +25,8 @@
>> #ifndef __ASM_ARCH_MX5_GPIO_H
>> #define __ASM_ARCH_MX5_GPIO_H
>>
>> +#define GPIO_TO_PORT(number) (number/32)
>> +
>> /* GPIO registers */
>> struct gpio_regs {
>> u32 gpio_dr;
>> diff --git a/arch/arm/include/asm/arch-mx6/gpio.h b/arch/arm/include/asm/arch-mx6/gpio.h
>> index 20c4e57..385d12d 100644
>> --- a/arch/arm/include/asm/arch-mx6/gpio.h
>> +++ b/arch/arm/include/asm/arch-mx6/gpio.h
>> @@ -25,6 +25,8 @@
>> #ifndef __ASM_ARCH_MX6_GPIO_H
>> #define __ASM_ARCH_MX6_GPIO_H
>>
>> +#define GPIO_TO_PORT(number) (number/32)
>> +
>> /* GPIO registers */
>> struct gpio_regs {
>> u32 gpio_dr;
>
> NAK. We have already (and probably too many) GPIO_TO_PORT:

Yes. You are right.
So, instead of defining all the headers this way,

#if defined(CONFIG_MX53) || defined(CONFIG_MX51)
#include <asm/arch/mx5x_pins.h>
#elif defined(CONFIG_MX6)
#include <asm/arch/imx-regs.h>
#endif
..... etc

Why not define the GPIO_TO_PORT macro in the driver? Anyways for all its
the same 32 pins. Any suggestions/flames?

Thanks,
Vikram