2008-03-14 06:48:14 bfin_gpio.c non-GPIO port protection
Diego Serafin (ITALY)
Message: 52535 Hi everybody,
The function that sets up a blackfin PF port to GPIO or specific function (port_setup) allows reconfiguration of the port itself to GPIO mode even if the port's FER register was set to enable a peripheral function instead.
void port_setup(unsigned short gpio, unsigned short usage)
{
if (usage == GPIO_USAGE) {
if (*port_fer[gpio_bank(gpio)] & gpio_bit(gpio))
printk(KERN_WARNING "bfin-gpio: Possible Conflict with Peripheral "
"usage and GPIO %d detected!\n", gpio);
*port_fer[gpio_bank(gpio)] &= ~gpio_bit(gpio);
} else
*port_fer[gpio_bank(gpio)] |= gpio_bit(gpio);
SSYNC();
}
Wouldn't be safer to _not_ allow peripheral-function-to-GPIO port reconfiguration instead of printing only a kern warning? IMHO using module bfin_pflags from user's space could be very dangerous without this policy.
Regards,
Diego.
QuoteReplyEditDelete
2008-03-14 07:02:01 Re: bfin_gpio.c non-GPIO port protection
Mike Frysinger (UNITED STATES)
Message: 52537 i'm guessing you're looking at an older kernel ... this is already fixed in 2008R1+
you use the peripheral request function to request a pin for peripheral usage and gpio request will fail if it's already been allocated as a peripheral
QuoteReplyEditDelete
2008-03-14 09:05:23 Re: bfin_gpio.c non-GPIO port protection
Diego Serafin (ITALY)
Message: 52542 Do'h!
I'm still on 2007R1 .... sorry
Thank you Mike,
Diego