[U-Boot] [PATCH 1/4] gpio: Adds GPIO driver support for Armada100

Lei Wen adrian.wenl at gmail.com
Tue Jul 19 06:14:40 CEST 2011


Hi Ajay,

On Tue, Jul 19, 2011 at 12:01 PM, Ajay Bhargav
<ajay.bhargav at einfochips.com> wrote:
>
>> How about merge this into current mvmfp.c? Just add some function
>> into
>> it, then no need another c file.
>>
>> Best regards,
>> Lei
>>
>
> Hi Lei,
>
> According to current ongoing development there is generic GPIO framework being introduced. Its good if we keep gpio separate though they are connected to MFP too, It makes more sense if they are kept in different file. lets see what Prafulla has to say about this.
>
Ok.
BTW, I also have some comments towards your patch.
You define a huge structure in
arch/arm/include/asm/arch-armada100/gpio.h, which don't looks so good
to me.

In our code base, that file only keeps as short as:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#define BANK_OFF(n)     (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
#define GPIO_REG(x)     (*((volatile u32 *)(CONFIG_GPIO_REGBASE + (x))))

#define NR_BUILTIN_GPIO (128)

#define GPIO_bit(gpio)  (1 << ((gpio) & 0x1f))

#define GPLR(x)         GPIO_REG(BANK_OFF((x) >> 5) + 0x00)
#define GPDR(x)         GPIO_REG(BANK_OFF((x) >> 5) + 0x0c)
#define GPSR(x)         GPIO_REG(BANK_OFF((x) >> 5) + 0x18)
#define GPCR(x)         GPIO_REG(BANK_OFF((x) >> 5) + 0x24)

int gpio_get_value(unsigned gpio);
void gpio_set_value(unsigned gpio, int value);
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Macro here save a lot space, and keep the code clean.

Best regards,
Lei


More information about the U-Boot mailing list