aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/blackfin/kernel/bfin_gpio.c31
-rw-r--r--include/asm-blackfin/mach-bf527/portmux.h2
-rw-r--r--include/asm-blackfin/mach-bf533/portmux.h2
-rw-r--r--include/asm-blackfin/mach-bf537/portmux.h2
-rw-r--r--include/asm-blackfin/mach-bf548/portmux.h2
-rw-r--r--include/asm-blackfin/mach-bf561/portmux.h2
6 files changed, 28 insertions, 13 deletions
diff --git a/arch/blackfin/kernel/bfin_gpio.c b/arch/blackfin/kernel/bfin_gpio.c
index ea13d2a22d69..ffee36910288 100644
--- a/arch/blackfin/kernel/bfin_gpio.c
+++ b/arch/blackfin/kernel/bfin_gpio.c
@@ -179,15 +179,13 @@ static struct gpio_port_t *gpio_array[gpio_bank(MAX_BLACKFIN_GPIOS)] = {
179#endif 179#endif
180 180
181static unsigned short reserved_gpio_map[gpio_bank(MAX_BLACKFIN_GPIOS)]; 181static unsigned short reserved_gpio_map[gpio_bank(MAX_BLACKFIN_GPIOS)];
182static unsigned short reserved_peri_map[gpio_bank(MAX_BLACKFIN_GPIOS + 16)]; 182static unsigned short reserved_peri_map[gpio_bank(MAX_RESOURCES)];
183 183
184#define MAX_RESOURCES 256
185#define RESOURCE_LABEL_SIZE 16 184#define RESOURCE_LABEL_SIZE 16
186 185
187struct str_ident { 186static struct str_ident {
188 char name[RESOURCE_LABEL_SIZE]; 187 char name[RESOURCE_LABEL_SIZE];
189} *str_ident; 188} str_ident[MAX_RESOURCES];
190
191 189
192#ifdef CONFIG_PM 190#ifdef CONFIG_PM
193static unsigned short wakeup_map[gpio_bank(MAX_BLACKFIN_GPIOS)]; 191static unsigned short wakeup_map[gpio_bank(MAX_BLACKFIN_GPIOS)];
@@ -251,6 +249,11 @@ static char *get_label(unsigned short ident)
251 249
252static int cmp_label(unsigned short ident, const char *label) 250static int cmp_label(unsigned short ident, const char *label)
253{ 251{
252 if (label == NULL) {
253 dump_stack();
254 printk(KERN_ERR "Please provide none-null label\n");
255 }
256
254 if (label && str_ident) 257 if (label && str_ident)
255 return strncmp(str_ident[ident].name, 258 return strncmp(str_ident[ident].name,
256 label, strlen(label)); 259 label, strlen(label));
@@ -419,12 +422,6 @@ static void default_gpio(unsigned short gpio)
419 422
420static int __init bfin_gpio_init(void) 423static int __init bfin_gpio_init(void)
421{ 424{
422 str_ident = kcalloc(MAX_RESOURCES,
423 sizeof(struct str_ident), GFP_KERNEL);
424 if (str_ident == NULL)
425 return -ENOMEM;
426
427 memset(str_ident, 0, MAX_RESOURCES * sizeof(struct str_ident));
428 425
429 printk(KERN_INFO "Blackfin GPIO Controller\n"); 426 printk(KERN_INFO "Blackfin GPIO Controller\n");
430 427
@@ -785,6 +782,14 @@ void gpio_pm_restore(void)
785} 782}
786 783
787#endif 784#endif
785#else /* BF548_FAMILY */
786
787unsigned short get_gpio_dir(unsigned short gpio)
788{
789 return (0x01 & (gpio_array[gpio_bank(gpio)]->port_dir_clear >> gpio_sub_n(gpio)));
790}
791EXPORT_SYMBOL(get_gpio_dir);
792
788#endif /* BF548_FAMILY */ 793#endif /* BF548_FAMILY */
789 794
790/*********************************************************** 795/***********************************************************
@@ -1204,10 +1209,10 @@ static int gpio_proc_read(char *buf, char **start, off_t offset,
1204 1209
1205 for (c = 0; c < MAX_RESOURCES; c++) { 1210 for (c = 0; c < MAX_RESOURCES; c++) {
1206 if (!check_gpio(c) && (reserved_gpio_map[gpio_bank(c)] & gpio_bit(c))) 1211 if (!check_gpio(c) && (reserved_gpio_map[gpio_bank(c)] & gpio_bit(c)))
1207 len = sprintf(buf, "GPIO_%d: %s \tGPIO %s\n", c, 1212 len = sprintf(buf, "GPIO_%d: %s \t\tGPIO %s\n", c,
1208 get_label(c), get_gpio_dir(c) ? "OUTPUT" : "INPUT"); 1213 get_label(c), get_gpio_dir(c) ? "OUTPUT" : "INPUT");
1209 else if (reserved_peri_map[gpio_bank(c)] & gpio_bit(c)) 1214 else if (reserved_peri_map[gpio_bank(c)] & gpio_bit(c))
1210 len = sprintf(buf, "GPIO_%d: %s \tPeripheral\n", c, get_label(c)); 1215 len = sprintf(buf, "GPIO_%d: %s \t\tPeripheral\n", c, get_label(c));
1211 else 1216 else
1212 continue; 1217 continue;
1213 buf += len; 1218 buf += len;
diff --git a/include/asm-blackfin/mach-bf527/portmux.h b/include/asm-blackfin/mach-bf527/portmux.h
index dcf001adc63c..ae4d205bfcf5 100644
--- a/include/asm-blackfin/mach-bf527/portmux.h
+++ b/include/asm-blackfin/mach-bf527/portmux.h
@@ -1,6 +1,8 @@
1#ifndef _MACH_PORTMUX_H_ 1#ifndef _MACH_PORTMUX_H_
2#define _MACH_PORTMUX_H_ 2#define _MACH_PORTMUX_H_
3 3
4#define MAX_RESOURCES MAX_BLACKFIN_GPIOS
5
4#define P_PPI0_D0 (P_DEFINED | P_IDENT(GPIO_PF0) | P_FUNCT(0)) 6#define P_PPI0_D0 (P_DEFINED | P_IDENT(GPIO_PF0) | P_FUNCT(0))
5#define P_PPI0_D1 (P_DEFINED | P_IDENT(GPIO_PF1) | P_FUNCT(0)) 7#define P_PPI0_D1 (P_DEFINED | P_IDENT(GPIO_PF1) | P_FUNCT(0))
6#define P_PPI0_D2 (P_DEFINED | P_IDENT(GPIO_PF2) | P_FUNCT(0)) 8#define P_PPI0_D2 (P_DEFINED | P_IDENT(GPIO_PF2) | P_FUNCT(0))
diff --git a/include/asm-blackfin/mach-bf533/portmux.h b/include/asm-blackfin/mach-bf533/portmux.h
index 137f4884acfe..685a2651dcda 100644
--- a/include/asm-blackfin/mach-bf533/portmux.h
+++ b/include/asm-blackfin/mach-bf533/portmux.h
@@ -1,6 +1,8 @@
1#ifndef _MACH_PORTMUX_H_ 1#ifndef _MACH_PORTMUX_H_
2#define _MACH_PORTMUX_H_ 2#define _MACH_PORTMUX_H_
3 3
4#define MAX_RESOURCES MAX_BLACKFIN_GPIOS
5
4#define P_PPI0_CLK (P_DONTCARE) 6#define P_PPI0_CLK (P_DONTCARE)
5#define P_PPI0_FS1 (P_DONTCARE) 7#define P_PPI0_FS1 (P_DONTCARE)
6#define P_PPI0_FS2 (P_DONTCARE) 8#define P_PPI0_FS2 (P_DONTCARE)
diff --git a/include/asm-blackfin/mach-bf537/portmux.h b/include/asm-blackfin/mach-bf537/portmux.h
index 5a3f7d3bf73d..78fee6e0f237 100644
--- a/include/asm-blackfin/mach-bf537/portmux.h
+++ b/include/asm-blackfin/mach-bf537/portmux.h
@@ -1,6 +1,8 @@
1#ifndef _MACH_PORTMUX_H_ 1#ifndef _MACH_PORTMUX_H_
2#define _MACH_PORTMUX_H_ 2#define _MACH_PORTMUX_H_
3 3
4#define MAX_RESOURCES (MAX_BLACKFIN_GPIOS + GPIO_BANKSIZE) /* We additionally handle PORTJ */
5
4#define P_UART0_TX (P_DEFINED | P_IDENT(GPIO_PF0) | P_FUNCT(0)) 6#define P_UART0_TX (P_DEFINED | P_IDENT(GPIO_PF0) | P_FUNCT(0))
5#define P_UART0_RX (P_DEFINED | P_IDENT(GPIO_PF1) | P_FUNCT(0)) 7#define P_UART0_RX (P_DEFINED | P_IDENT(GPIO_PF1) | P_FUNCT(0))
6#define P_UART1_TX (P_DEFINED | P_IDENT(GPIO_PF2) | P_FUNCT(0)) 8#define P_UART1_TX (P_DEFINED | P_IDENT(GPIO_PF2) | P_FUNCT(0))
diff --git a/include/asm-blackfin/mach-bf548/portmux.h b/include/asm-blackfin/mach-bf548/portmux.h
index 6b485120015f..8177a567dcdb 100644
--- a/include/asm-blackfin/mach-bf548/portmux.h
+++ b/include/asm-blackfin/mach-bf548/portmux.h
@@ -1,6 +1,8 @@
1#ifndef _MACH_PORTMUX_H_ 1#ifndef _MACH_PORTMUX_H_
2#define _MACH_PORTMUX_H_ 2#define _MACH_PORTMUX_H_
3 3
4#define MAX_RESOURCES MAX_BLACKFIN_GPIOS
5
4#define P_SPORT2_TFS (P_DEFINED | P_IDENT(GPIO_PA0) | P_FUNCT(0)) 6#define P_SPORT2_TFS (P_DEFINED | P_IDENT(GPIO_PA0) | P_FUNCT(0))
5#define P_SPORT2_DTSEC (P_DEFINED | P_IDENT(GPIO_PA1) | P_FUNCT(0)) 7#define P_SPORT2_DTSEC (P_DEFINED | P_IDENT(GPIO_PA1) | P_FUNCT(0))
6#define P_SPORT2_DTPRI (P_DEFINED | P_IDENT(GPIO_PA2) | P_FUNCT(0)) 8#define P_SPORT2_DTPRI (P_DEFINED | P_IDENT(GPIO_PA2) | P_FUNCT(0))
diff --git a/include/asm-blackfin/mach-bf561/portmux.h b/include/asm-blackfin/mach-bf561/portmux.h
index 132ad31665e3..a6ee8206efb6 100644
--- a/include/asm-blackfin/mach-bf561/portmux.h
+++ b/include/asm-blackfin/mach-bf561/portmux.h
@@ -1,6 +1,8 @@
1#ifndef _MACH_PORTMUX_H_ 1#ifndef _MACH_PORTMUX_H_
2#define _MACH_PORTMUX_H_ 2#define _MACH_PORTMUX_H_
3 3
4#define MAX_RESOURCES MAX_BLACKFIN_GPIOS
5
4#define P_PPI0_CLK (P_DONTCARE) 6#define P_PPI0_CLK (P_DONTCARE)
5#define P_PPI0_FS1 (P_DONTCARE) 7#define P_PPI0_FS1 (P_DONTCARE)
6#define P_PPI0_FS2 (P_DONTCARE) 8#define P_PPI0_FS2 (P_DONTCARE)