aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorCharulatha V <charu@ti.com>2011-04-22 07:08:16 -0400
committerKevin Hilman <khilman@ti.com>2011-06-16 14:13:37 -0400
commita8be8dafd00e3ccf4f85e2f30babf42be5076324 (patch)
treea7eeb824cf0791676bd2d40f998b0b6cb6666aaa /drivers/gpio
parent129fd2230733ff0457e76d6aabde136cf8666bc0 (diff)
gpio/omap: remove get_gpio_bank()
use chip info to get the pointer to the struct gpio_bank for a given GPIO bank and remove get_gpio_bank(). Signed-off-by: Charulatha V <charu@ti.com>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-omap.c29
1 files changed, 2 insertions, 27 deletions
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 72811a3b9158..25a7ee6bddb0 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -86,31 +86,6 @@ int gpio_bank_count;
86#define GPIO_INDEX(bank, gpio) (gpio % bank->width) 86#define GPIO_INDEX(bank, gpio) (gpio % bank->width)
87#define GPIO_BIT(bank, gpio) (1 << GPIO_INDEX(bank, gpio)) 87#define GPIO_BIT(bank, gpio) (1 << GPIO_INDEX(bank, gpio))
88 88
89static inline struct gpio_bank *get_gpio_bank(int gpio)
90{
91 if (cpu_is_omap15xx()) {
92 if (OMAP_GPIO_IS_MPUIO(gpio))
93 return &gpio_bank[0];
94 return &gpio_bank[1];
95 }
96 if (cpu_is_omap16xx()) {
97 if (OMAP_GPIO_IS_MPUIO(gpio))
98 return &gpio_bank[0];
99 return &gpio_bank[1 + (gpio >> 4)];
100 }
101 if (cpu_is_omap7xx()) {
102 if (OMAP_GPIO_IS_MPUIO(gpio))
103 return &gpio_bank[0];
104 return &gpio_bank[1 + (gpio >> 5)];
105 }
106 if (cpu_is_omap24xx())
107 return &gpio_bank[gpio >> 5];
108 if (cpu_is_omap34xx() || cpu_is_omap44xx())
109 return &gpio_bank[gpio >> 5];
110 BUG();
111 return NULL;
112}
113
114static inline int gpio_valid(int gpio) 89static inline int gpio_valid(int gpio)
115{ 90{
116 if (gpio < 0) 91 if (gpio < 0)
@@ -1266,7 +1241,7 @@ static struct platform_device omap_mpuio_device = {
1266 1241
1267static inline void mpuio_init(void) 1242static inline void mpuio_init(void)
1268{ 1243{
1269 struct gpio_bank *bank = get_gpio_bank(OMAP_MPUIO(0)); 1244 struct gpio_bank *bank = &gpio_bank[0];
1270 platform_set_drvdata(&omap_mpuio_device, bank); 1245 platform_set_drvdata(&omap_mpuio_device, bank);
1271 1246
1272 if (platform_driver_register(&omap_mpuio_driver) == 0) 1247 if (platform_driver_register(&omap_mpuio_driver) == 0)
@@ -1342,7 +1317,7 @@ static int gpio_get(struct gpio_chip *chip, unsigned offset)
1342 u32 mask; 1317 u32 mask;
1343 1318
1344 gpio = chip->base + offset; 1319 gpio = chip->base + offset;
1345 bank = get_gpio_bank(gpio); 1320 bank = container_of(chip, struct gpio_bank, chip);
1346 reg = bank->base; 1321 reg = bank->base;
1347 mask = GPIO_BIT(bank, gpio); 1322 mask = GPIO_BIT(bank, gpio);
1348 1323