[U-Boot] arm, da850: Question about gpio control
Gabriele Filosofi
GabrieleF at cosmed.it
Fri Dec 16 18:16:59 CET 2011
Hi all,
In board/davinci/da8xxevm/da850.c
#ifdef CONFIG_USE_NOR
/* Set the GPIO direction as output */
clrbits_be32((u32 *)GPIO_BANK0_REG_DIR_ADDR, (0x01 << 11));
/* Set the output as low */
val = readl(GPIO_BANK0_REG_SET_ADDR);
val |= (0x01 << 11);
writel(val, GPIO_BANK0_REG_CLR_ADDR);
#endif
It works, however is it the right way to put a gpio low ?
Why do we need to read the SET register, change its content, and write the CLR register ?
A second question is also related to GPIO control from within board_init.
I can toggle GP2[6] high or low using the code above, but I cannot do the same for GP2[12]. Why ?
After having done the following, the pin 25 of J30 still remain to logic level 1 !
int mycode(void)
{
const struct pinmux_config gpio_pins[] = {
{ pinmux(5), 8, 3 },
};
u32 val;
/* PinMux for GPIO */
if (davinci_configure_pin_mux(gpio_pins, ARRAY_SIZE(gpio_pins)) != 0)
return 1;
/* Set the GPIO direction as output */
clrbits_be32((u32 *)GPIO_BANK2_REG_DIR_ADDR, (0x01 << 12));
/* Set the output as low */
val = readl(GPIO_BANK2_REG_CLR_ADDR);
val |= (0x01 << 12);
writel(val, GPIO_BANK2_REG_CLR_ADDR);
return 0;
}
Thanks,
Gabriele
More information about the U-Boot
mailing list