Blackfin arch: fix bug - gpio_bank() macros messed up bank number caculating with positioning a gpio
The whole story: Before BF51x merged, all the MAX_BLACKFIN_GPIOS are integral multiple of GPIO_BANKSIZE (= 16). But BF51x provides MAX_BLACKFIN_GPIOS = 40 which includes 3 banks and the 3rd bank has only 8 GPIO pins. Therefore, gpio_bank() macros is correct when you try to find a GPIO in which bank (GPIO_35 is in bank 2). But on BF51x gpio_bank(MAX_BLACKFIN_GPIOS) only gives out 2 banks instead of 3 banks for some static array initialization. This patch add a new macros gpio_bank_n() and GPIO_BANK_NUM to do bank number caculating and remain the gpio_bank() macros for positioning a gpio in which bank. Signed-off-by: Bryan Wu <cooloney@kernel.org>
This commit is contained in:
@ -85,10 +85,12 @@
|
||||
#define __ARCH_BLACKFIN_GPIO_H__
|
||||
|
||||
#define gpio_bank(x) ((x) >> 4)
|
||||
#define gpio_bank_n(x) ((x) & 0xF ? ((x) >> 4) + 1 : (x) >> 4)
|
||||
#define gpio_bit(x) (1<<((x) & 0xF))
|
||||
#define gpio_sub_n(x) ((x) & 0xF)
|
||||
|
||||
#define GPIO_BANKSIZE 16
|
||||
#define GPIO_BANK_NUM gpio_bank_n(MAX_BLACKFIN_GPIOS)
|
||||
|
||||
#define GPIO_0 0
|
||||
#define GPIO_1 1
|
||||
|
Reference in New Issue
Block a user