diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /arch/blackfin/kernel/bfin_gpio.c | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'arch/blackfin/kernel/bfin_gpio.c')
-rw-r--r-- | arch/blackfin/kernel/bfin_gpio.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/arch/blackfin/kernel/bfin_gpio.c b/arch/blackfin/kernel/bfin_gpio.c index ed978f1c5cb..02796b88443 100644 --- a/arch/blackfin/kernel/bfin_gpio.c +++ b/arch/blackfin/kernel/bfin_gpio.c | |||
@@ -58,7 +58,7 @@ static struct gpio_port_t * const gpio_array[] = { | |||
58 | (struct gpio_port_t *) FIO0_FLAG_D, | 58 | (struct gpio_port_t *) FIO0_FLAG_D, |
59 | (struct gpio_port_t *) FIO1_FLAG_D, | 59 | (struct gpio_port_t *) FIO1_FLAG_D, |
60 | (struct gpio_port_t *) FIO2_FLAG_D, | 60 | (struct gpio_port_t *) FIO2_FLAG_D, |
61 | #elif defined(CONFIG_BF54x) || defined(CONFIG_BF60x) | 61 | #elif defined(CONFIG_BF54x) |
62 | (struct gpio_port_t *)PORTA_FER, | 62 | (struct gpio_port_t *)PORTA_FER, |
63 | (struct gpio_port_t *)PORTB_FER, | 63 | (struct gpio_port_t *)PORTB_FER, |
64 | (struct gpio_port_t *)PORTC_FER, | 64 | (struct gpio_port_t *)PORTC_FER, |
@@ -66,11 +66,9 @@ static struct gpio_port_t * const gpio_array[] = { | |||
66 | (struct gpio_port_t *)PORTE_FER, | 66 | (struct gpio_port_t *)PORTE_FER, |
67 | (struct gpio_port_t *)PORTF_FER, | 67 | (struct gpio_port_t *)PORTF_FER, |
68 | (struct gpio_port_t *)PORTG_FER, | 68 | (struct gpio_port_t *)PORTG_FER, |
69 | # if defined(CONFIG_BF54x) | ||
70 | (struct gpio_port_t *)PORTH_FER, | 69 | (struct gpio_port_t *)PORTH_FER, |
71 | (struct gpio_port_t *)PORTI_FER, | 70 | (struct gpio_port_t *)PORTI_FER, |
72 | (struct gpio_port_t *)PORTJ_FER, | 71 | (struct gpio_port_t *)PORTJ_FER, |
73 | # endif | ||
74 | #else | 72 | #else |
75 | # error no gpio arrays defined | 73 | # error no gpio arrays defined |
76 | #endif | 74 | #endif |
@@ -212,7 +210,7 @@ static void port_setup(unsigned gpio, unsigned short usage) | |||
212 | else | 210 | else |
213 | *port_fer[gpio_bank(gpio)] |= gpio_bit(gpio); | 211 | *port_fer[gpio_bank(gpio)] |= gpio_bit(gpio); |
214 | SSYNC(); | 212 | SSYNC(); |
215 | #elif defined(CONFIG_BF54x) || defined(CONFIG_BF60x) | 213 | #elif defined(CONFIG_BF54x) |
216 | if (usage == GPIO_USAGE) | 214 | if (usage == GPIO_USAGE) |
217 | gpio_array[gpio_bank(gpio)]->port_fer &= ~gpio_bit(gpio); | 215 | gpio_array[gpio_bank(gpio)]->port_fer &= ~gpio_bit(gpio); |
218 | else | 216 | else |
@@ -301,7 +299,7 @@ static void portmux_setup(unsigned short per) | |||
301 | pmux |= (function << offset); | 299 | pmux |= (function << offset); |
302 | bfin_write_PORT_MUX(pmux); | 300 | bfin_write_PORT_MUX(pmux); |
303 | } | 301 | } |
304 | #elif defined(CONFIG_BF54x) || defined(CONFIG_BF60x) | 302 | #elif defined(CONFIG_BF54x) |
305 | inline void portmux_setup(unsigned short per) | 303 | inline void portmux_setup(unsigned short per) |
306 | { | 304 | { |
307 | u16 ident = P_IDENT(per); | 305 | u16 ident = P_IDENT(per); |
@@ -379,7 +377,7 @@ static int portmux_group_check(unsigned short per) | |||
379 | } | 377 | } |
380 | #endif | 378 | #endif |
381 | 379 | ||
382 | #if !(defined(CONFIG_BF54x) || defined(CONFIG_BF60x)) | 380 | #ifndef CONFIG_BF54x |
383 | /*********************************************************** | 381 | /*********************************************************** |
384 | * | 382 | * |
385 | * FUNCTIONS: Blackfin General Purpose Ports Access Functions | 383 | * FUNCTIONS: Blackfin General Purpose Ports Access Functions |
@@ -682,7 +680,7 @@ void bfin_gpio_pm_hibernate_restore(void) | |||
682 | 680 | ||
683 | 681 | ||
684 | #endif | 682 | #endif |
685 | #else /* CONFIG_BF54x || CONFIG_BF60x */ | 683 | #else /* CONFIG_BF54x */ |
686 | #ifdef CONFIG_PM | 684 | #ifdef CONFIG_PM |
687 | 685 | ||
688 | int bfin_pm_standby_ctrl(unsigned ctrl) | 686 | int bfin_pm_standby_ctrl(unsigned ctrl) |
@@ -728,7 +726,7 @@ unsigned short get_gpio_dir(unsigned gpio) | |||
728 | } | 726 | } |
729 | EXPORT_SYMBOL(get_gpio_dir); | 727 | EXPORT_SYMBOL(get_gpio_dir); |
730 | 728 | ||
731 | #endif /* CONFIG_BF54x || CONFIG_BF60x */ | 729 | #endif /* CONFIG_BF54x */ |
732 | 730 | ||
733 | /*********************************************************** | 731 | /*********************************************************** |
734 | * | 732 | * |
@@ -785,7 +783,7 @@ int peripheral_request(unsigned short per, const char *label) | |||
785 | * be requested and used by several drivers | 783 | * be requested and used by several drivers |
786 | */ | 784 | */ |
787 | 785 | ||
788 | #if defined(CONFIG_BF54x) || defined(CONFIG_BF60x) | 786 | #ifdef CONFIG_BF54x |
789 | if (!((per & P_MAYSHARE) && get_portmux(per) == P_FUNCT2MUX(per))) { | 787 | if (!((per & P_MAYSHARE) && get_portmux(per) == P_FUNCT2MUX(per))) { |
790 | #else | 788 | #else |
791 | if (!(per & P_MAYSHARE)) { | 789 | if (!(per & P_MAYSHARE)) { |
@@ -939,7 +937,7 @@ int bfin_gpio_request(unsigned gpio, const char *label) | |||
939 | printk(KERN_NOTICE "bfin-gpio: GPIO %d is already reserved as gpio-irq!" | 937 | printk(KERN_NOTICE "bfin-gpio: GPIO %d is already reserved as gpio-irq!" |
940 | " (Documentation/blackfin/bfin-gpio-notes.txt)\n", gpio); | 938 | " (Documentation/blackfin/bfin-gpio-notes.txt)\n", gpio); |
941 | } | 939 | } |
942 | #if !(defined(CONFIG_BF54x) || defined(CONFIG_BF60x)) | 940 | #ifndef CONFIG_BF54x |
943 | else { /* Reset POLAR setting when acquiring a gpio for the first time */ | 941 | else { /* Reset POLAR setting when acquiring a gpio for the first time */ |
944 | set_gpio_polar(gpio, 0); | 942 | set_gpio_polar(gpio, 0); |
945 | } | 943 | } |
@@ -1112,7 +1110,7 @@ void bfin_gpio_irq_free(unsigned gpio) | |||
1112 | 1110 | ||
1113 | static inline void __bfin_gpio_direction_input(unsigned gpio) | 1111 | static inline void __bfin_gpio_direction_input(unsigned gpio) |
1114 | { | 1112 | { |
1115 | #if defined(CONFIG_BF54x) || defined(CONFIG_BF60x) | 1113 | #ifdef CONFIG_BF54x |
1116 | gpio_array[gpio_bank(gpio)]->dir_clear = gpio_bit(gpio); | 1114 | gpio_array[gpio_bank(gpio)]->dir_clear = gpio_bit(gpio); |
1117 | #else | 1115 | #else |
1118 | gpio_array[gpio_bank(gpio)]->dir &= ~gpio_bit(gpio); | 1116 | gpio_array[gpio_bank(gpio)]->dir &= ~gpio_bit(gpio); |
@@ -1140,13 +1138,13 @@ EXPORT_SYMBOL(bfin_gpio_direction_input); | |||
1140 | 1138 | ||
1141 | void bfin_gpio_irq_prepare(unsigned gpio) | 1139 | void bfin_gpio_irq_prepare(unsigned gpio) |
1142 | { | 1140 | { |
1143 | #if defined(CONFIG_BF54x) || defined(CONFIG_BF60x) | 1141 | #ifdef CONFIG_BF54x |
1144 | unsigned long flags; | 1142 | unsigned long flags; |
1145 | #endif | 1143 | #endif |
1146 | 1144 | ||
1147 | port_setup(gpio, GPIO_USAGE); | 1145 | port_setup(gpio, GPIO_USAGE); |
1148 | 1146 | ||
1149 | #if defined(CONFIG_BF54x) || defined(CONFIG_BF60x) | 1147 | #ifdef CONFIG_BF54x |
1150 | flags = hard_local_irq_save(); | 1148 | flags = hard_local_irq_save(); |
1151 | __bfin_gpio_direction_input(gpio); | 1149 | __bfin_gpio_direction_input(gpio); |
1152 | hard_local_irq_restore(flags); | 1150 | hard_local_irq_restore(flags); |
@@ -1175,7 +1173,7 @@ int bfin_gpio_direction_output(unsigned gpio, int value) | |||
1175 | 1173 | ||
1176 | gpio_array[gpio_bank(gpio)]->inen &= ~gpio_bit(gpio); | 1174 | gpio_array[gpio_bank(gpio)]->inen &= ~gpio_bit(gpio); |
1177 | gpio_set_value(gpio, value); | 1175 | gpio_set_value(gpio, value); |
1178 | #if defined(CONFIG_BF54x) || defined(CONFIG_BF60x) | 1176 | #ifdef CONFIG_BF54x |
1179 | gpio_array[gpio_bank(gpio)]->dir_set = gpio_bit(gpio); | 1177 | gpio_array[gpio_bank(gpio)]->dir_set = gpio_bit(gpio); |
1180 | #else | 1178 | #else |
1181 | gpio_array[gpio_bank(gpio)]->dir |= gpio_bit(gpio); | 1179 | gpio_array[gpio_bank(gpio)]->dir |= gpio_bit(gpio); |
@@ -1190,7 +1188,7 @@ EXPORT_SYMBOL(bfin_gpio_direction_output); | |||
1190 | 1188 | ||
1191 | int bfin_gpio_get_value(unsigned gpio) | 1189 | int bfin_gpio_get_value(unsigned gpio) |
1192 | { | 1190 | { |
1193 | #if defined(CONFIG_BF54x) || defined(CONFIG_BF60x) | 1191 | #ifdef CONFIG_BF54x |
1194 | return (1 & (gpio_array[gpio_bank(gpio)]->data >> gpio_sub_n(gpio))); | 1192 | return (1 & (gpio_array[gpio_bank(gpio)]->data >> gpio_sub_n(gpio))); |
1195 | #else | 1193 | #else |
1196 | unsigned long flags; | 1194 | unsigned long flags; |
@@ -1265,8 +1263,8 @@ static __init int gpio_register_proc(void) | |||
1265 | { | 1263 | { |
1266 | struct proc_dir_entry *proc_gpio; | 1264 | struct proc_dir_entry *proc_gpio; |
1267 | 1265 | ||
1268 | proc_gpio = proc_create("gpio", 0, NULL, &gpio_proc_ops); | 1266 | proc_gpio = proc_create("gpio", S_IRUGO, NULL, &gpio_proc_ops); |
1269 | return proc_gpio == NULL; | 1267 | return proc_gpio != NULL; |
1270 | } | 1268 | } |
1271 | __initcall(gpio_register_proc); | 1269 | __initcall(gpio_register_proc); |
1272 | #endif | 1270 | #endif |