diff options
Diffstat (limited to 'arch/blackfin/kernel/bfin_gpio.c')
-rw-r--r-- | arch/blackfin/kernel/bfin_gpio.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/arch/blackfin/kernel/bfin_gpio.c b/arch/blackfin/kernel/bfin_gpio.c index 170cf90735ba..bcf8cf6fe412 100644 --- a/arch/blackfin/kernel/bfin_gpio.c +++ b/arch/blackfin/kernel/bfin_gpio.c | |||
@@ -10,10 +10,12 @@ | |||
10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
11 | #include <linux/err.h> | 11 | #include <linux/err.h> |
12 | #include <linux/proc_fs.h> | 12 | #include <linux/proc_fs.h> |
13 | #include <linux/seq_file.h> | ||
13 | #include <asm/blackfin.h> | 14 | #include <asm/blackfin.h> |
14 | #include <asm/gpio.h> | 15 | #include <asm/gpio.h> |
15 | #include <asm/portmux.h> | 16 | #include <asm/portmux.h> |
16 | #include <linux/irq.h> | 17 | #include <linux/irq.h> |
18 | #include <asm/irq_handler.h> | ||
17 | 19 | ||
18 | #if ANOMALY_05000311 || ANOMALY_05000323 | 20 | #if ANOMALY_05000311 || ANOMALY_05000323 |
19 | enum { | 21 | enum { |
@@ -534,7 +536,7 @@ static const unsigned int sic_iwr_irqs[] = { | |||
534 | #if defined(BF533_FAMILY) | 536 | #if defined(BF533_FAMILY) |
535 | IRQ_PROG_INTB | 537 | IRQ_PROG_INTB |
536 | #elif defined(BF537_FAMILY) | 538 | #elif defined(BF537_FAMILY) |
537 | IRQ_PROG_INTB, IRQ_PORTG_INTB, IRQ_MAC_TX | 539 | IRQ_PF_INTB_WATCH, IRQ_PORTG_INTB, IRQ_PH_INTB_MAC_TX |
538 | #elif defined(BF538_FAMILY) | 540 | #elif defined(BF538_FAMILY) |
539 | IRQ_PORTF_INTB | 541 | IRQ_PORTF_INTB |
540 | #elif defined(CONFIG_BF52x) || defined(CONFIG_BF51x) | 542 | #elif defined(CONFIG_BF52x) || defined(CONFIG_BF51x) |
@@ -1203,35 +1205,43 @@ void bfin_reset_boot_spi_cs(unsigned short pin) | |||
1203 | } | 1205 | } |
1204 | 1206 | ||
1205 | #if defined(CONFIG_PROC_FS) | 1207 | #if defined(CONFIG_PROC_FS) |
1206 | static int gpio_proc_read(char *buf, char **start, off_t offset, | 1208 | static int gpio_proc_show(struct seq_file *m, void *v) |
1207 | int len, int *unused_i, void *unused_v) | ||
1208 | { | 1209 | { |
1209 | int c, irq, gpio, outlen = 0; | 1210 | int c, irq, gpio; |
1210 | 1211 | ||
1211 | for (c = 0; c < MAX_RESOURCES; c++) { | 1212 | for (c = 0; c < MAX_RESOURCES; c++) { |
1212 | irq = is_reserved(gpio_irq, c, 1); | 1213 | irq = is_reserved(gpio_irq, c, 1); |
1213 | gpio = is_reserved(gpio, c, 1); | 1214 | gpio = is_reserved(gpio, c, 1); |
1214 | if (!check_gpio(c) && (gpio || irq)) | 1215 | if (!check_gpio(c) && (gpio || irq)) |
1215 | len = sprintf(buf, "GPIO_%d: \t%s%s \t\tGPIO %s\n", c, | 1216 | seq_printf(m, "GPIO_%d: \t%s%s \t\tGPIO %s\n", c, |
1216 | get_label(c), (gpio && irq) ? " *" : "", | 1217 | get_label(c), (gpio && irq) ? " *" : "", |
1217 | get_gpio_dir(c) ? "OUTPUT" : "INPUT"); | 1218 | get_gpio_dir(c) ? "OUTPUT" : "INPUT"); |
1218 | else if (is_reserved(peri, c, 1)) | 1219 | else if (is_reserved(peri, c, 1)) |
1219 | len = sprintf(buf, "GPIO_%d: \t%s \t\tPeripheral\n", c, get_label(c)); | 1220 | seq_printf(m, "GPIO_%d: \t%s \t\tPeripheral\n", c, get_label(c)); |
1220 | else | 1221 | else |
1221 | continue; | 1222 | continue; |
1222 | buf += len; | ||
1223 | outlen += len; | ||
1224 | } | 1223 | } |
1225 | return outlen; | 1224 | |
1225 | return 0; | ||
1226 | } | 1226 | } |
1227 | 1227 | ||
1228 | static int gpio_proc_open(struct inode *inode, struct file *file) | ||
1229 | { | ||
1230 | return single_open(file, gpio_proc_show, NULL); | ||
1231 | } | ||
1232 | |||
1233 | static const struct file_operations gpio_proc_ops = { | ||
1234 | .open = gpio_proc_open, | ||
1235 | .read = seq_read, | ||
1236 | .llseek = seq_lseek, | ||
1237 | .release = single_release, | ||
1238 | }; | ||
1239 | |||
1228 | static __init int gpio_register_proc(void) | 1240 | static __init int gpio_register_proc(void) |
1229 | { | 1241 | { |
1230 | struct proc_dir_entry *proc_gpio; | 1242 | struct proc_dir_entry *proc_gpio; |
1231 | 1243 | ||
1232 | proc_gpio = create_proc_entry("gpio", S_IRUGO, NULL); | 1244 | proc_gpio = proc_create("gpio", S_IRUGO, NULL, &gpio_proc_ops); |
1233 | if (proc_gpio) | ||
1234 | proc_gpio->read_proc = gpio_proc_read; | ||
1235 | return proc_gpio != NULL; | 1245 | return proc_gpio != NULL; |
1236 | } | 1246 | } |
1237 | __initcall(gpio_register_proc); | 1247 | __initcall(gpio_register_proc); |