[U-Boot] [PATCH] M28: Added guarding for reserved bits in GPIO driver
Robert Deliën
Robert at delien.nl
Wed Nov 23 13:36:31 CET 2011
And are you sure the amound of pins in bank 0, 1, 2 is the same on mx233 and
mx28 ?
Yes, I'm sure they're not ;-). I went through the manual and changed it into this:
static const int mxs_bank_pins[] = {
#if defined(CONFIG_MX23)
MX23_BANK0_PINS,
MX23_BANK1_PINS,
MX23_BANK2_PINS
#elif defined(CONFIG_MX28)
MX28_BANK0_PINS,
MX28_BANK1_PINS,
MX28_BANK2_PINS,
MX28_BANK3_PINS,
MX28_BANK4_PINS
#endif
};
I also implemented a non-static function gpio_name_to_pin. I didn't implement validity checking in it, but is does check for set bits outside the pin and bank masks. To check if a pin is actually valid, I have added a non-static function gpio_invalid, as you suggested. I just named it differently because a function called gpio_is_valid returning 0 in case the pin is valid might be a bit confusing when evaluating the return parameter.
As a result, there's no longer a validity check in gpio_request anymore. Or would you suggest to do this check at the beginning of each non-static function taking a gp input parameter?
I'm not really sure yet how to implement Mike's suggestion to deal with diversity, but I'll work on that now.
More information about the U-Boot
mailing list