aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/include/asm/gpio.h
diff options
context:
space:
mode:
authorBryan Wu <cooloney@kernel.org>2008-11-18 04:48:22 -0500
committerBryan Wu <cooloney@kernel.org>2008-11-18 04:48:22 -0500
commit397861cd8046549957a04d34a0b97b267cbb9589 (patch)
treefeb9a74acdf782205e2eef186a86f3141bc84ef3 /arch/blackfin/include/asm/gpio.h
parent10a88a2be569002ddbb669278c598d8ee11e2f50 (diff)
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>
Diffstat (limited to 'arch/blackfin/include/asm/gpio.h')
-rw-r--r--arch/blackfin/include/asm/gpio.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/blackfin/include/asm/gpio.h b/arch/blackfin/include/asm/gpio.h
index d8485624006a..2a5e846a5382 100644
--- a/arch/blackfin/include/asm/gpio.h
+++ b/arch/blackfin/include/asm/gpio.h
@@ -85,10 +85,12 @@
85#define __ARCH_BLACKFIN_GPIO_H__ 85#define __ARCH_BLACKFIN_GPIO_H__
86 86
87#define gpio_bank(x) ((x) >> 4) 87#define gpio_bank(x) ((x) >> 4)
88#define gpio_bank_n(x) ((x) & 0xF ? ((x) >> 4) + 1 : (x) >> 4)
88#define gpio_bit(x) (1<<((x) & 0xF)) 89#define gpio_bit(x) (1<<((x) & 0xF))
89#define gpio_sub_n(x) ((x) & 0xF) 90#define gpio_sub_n(x) ((x) & 0xF)
90 91
91#define GPIO_BANKSIZE 16 92#define GPIO_BANKSIZE 16
93#define GPIO_BANK_NUM gpio_bank_n(MAX_BLACKFIN_GPIOS)
92 94
93#define GPIO_0 0 95#define GPIO_0 0
94#define GPIO_1 1 96#define GPIO_1 1