aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/kernel/bfin_gpio.c
diff options
context:
space:
mode:
authorMichael Hennerich <michael.hennerich@analog.com>2008-04-23 20:10:10 -0400
committerBryan Wu <cooloney@kernel.org>2008-04-23 20:10:10 -0400
commitaffee2b2613ada262eecea354b6c60696ca5d482 (patch)
treebc8b5b7a11416f565635b0b135a4438e17e64230 /arch/blackfin/kernel/bfin_gpio.c
parenta086ee2268abcfcbf80a114f4602e5b26aa80bf0 (diff)
[Blackfin] arch: Allow concurrent use of GPIO and GPIO IRQ
The irq setup code no longer calls gpio request and free. This patch also changes the default gpio_free behavior on Blackfin. A freed GPIO keeps it's last state, and is not defaulted back to an input. This is also what all other architectures do. Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
Diffstat (limited to 'arch/blackfin/kernel/bfin_gpio.c')
-rw-r--r--arch/blackfin/kernel/bfin_gpio.c45
1 files changed, 17 insertions, 28 deletions
diff --git a/arch/blackfin/kernel/bfin_gpio.c b/arch/blackfin/kernel/bfin_gpio.c
index fcb2f6cf430b..7e8eaf4a31bb 100644
--- a/arch/blackfin/kernel/bfin_gpio.c
+++ b/arch/blackfin/kernel/bfin_gpio.c
@@ -395,32 +395,6 @@ inline void portmux_setup(unsigned short portno, unsigned short function)
395# define portmux_setup(...) do { } while (0) 395# define portmux_setup(...) do { } while (0)
396#endif 396#endif
397 397
398#ifndef BF548_FAMILY
399static void default_gpio(unsigned gpio)
400{
401 unsigned short bank, bitmask;
402 unsigned long flags;
403
404 bank = gpio_bank(gpio);
405 bitmask = gpio_bit(gpio);
406
407 local_irq_save(flags);
408
409 gpio_bankb[bank]->maska_clear = bitmask;
410 gpio_bankb[bank]->maskb_clear = bitmask;
411 SSYNC();
412 gpio_bankb[bank]->inen &= ~bitmask;
413 gpio_bankb[bank]->dir &= ~bitmask;
414 gpio_bankb[bank]->polar &= ~bitmask;
415 gpio_bankb[bank]->both &= ~bitmask;
416 gpio_bankb[bank]->edge &= ~bitmask;
417 AWA_DUMMY_READ(edge);
418 local_irq_restore(flags);
419}
420#else
421# define default_gpio(...) do { } while (0)
422#endif
423
424static int __init bfin_gpio_init(void) 398static int __init bfin_gpio_init(void)
425{ 399{
426 printk(KERN_INFO "Blackfin GPIO Controller\n"); 400 printk(KERN_INFO "Blackfin GPIO Controller\n");
@@ -1080,8 +1054,6 @@ void gpio_free(unsigned gpio)
1080 return; 1054 return;
1081 } 1055 }
1082 1056
1083 default_gpio(gpio);
1084
1085 reserved_gpio_map[gpio_bank(gpio)] &= ~gpio_bit(gpio); 1057 reserved_gpio_map[gpio_bank(gpio)] &= ~gpio_bit(gpio);
1086 1058
1087 set_label(gpio, "free"); 1059 set_label(gpio, "free");
@@ -1144,6 +1116,18 @@ int gpio_get_value(unsigned gpio)
1144} 1116}
1145EXPORT_SYMBOL(gpio_get_value); 1117EXPORT_SYMBOL(gpio_get_value);
1146 1118
1119void bfin_gpio_irq_prepare(unsigned gpio)
1120{
1121 unsigned long flags;
1122
1123 port_setup(gpio, GPIO_USAGE);
1124
1125 local_irq_save(flags);
1126 gpio_array[gpio_bank(gpio)]->port_dir_clear = gpio_bit(gpio);
1127 gpio_array[gpio_bank(gpio)]->port_inen |= gpio_bit(gpio);
1128 local_irq_restore(flags);
1129}
1130
1147#else 1131#else
1148 1132
1149int gpio_direction_input(unsigned gpio) 1133int gpio_direction_input(unsigned gpio)
@@ -1210,6 +1194,11 @@ void bfin_gpio_reset_spi0_ssel1(void)
1210 udelay(1); 1194 udelay(1);
1211} 1195}
1212 1196
1197void bfin_gpio_irq_prepare(unsigned gpio)
1198{
1199 port_setup(gpio, GPIO_USAGE);
1200}
1201
1213#endif /*BF548_FAMILY */ 1202#endif /*BF548_FAMILY */
1214 1203
1215#if defined(CONFIG_PROC_FS) 1204#if defined(CONFIG_PROC_FS)