Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 77379
b: refs/heads/master
c: fac3cf4
h: refs/heads/master
i:
  77377: a3b7e9c
  77375: d050b95
v: v3
  • Loading branch information
Michael Hennerich authored and Bryan Wu committed Dec 24, 2007
1 parent 520508c commit d4c031a
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1545a1111a02b5aafe6f141e133a6269c5741285
refs/heads/master: fac3cf432ef9b6bfd64b35b95afe0b7e0079da74
31 changes: 18 additions & 13 deletions trunk/arch/blackfin/kernel/bfin_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,13 @@ static struct gpio_port_t *gpio_array[gpio_bank(MAX_BLACKFIN_GPIOS)] = {
#endif

static unsigned short reserved_gpio_map[gpio_bank(MAX_BLACKFIN_GPIOS)];
static unsigned short reserved_peri_map[gpio_bank(MAX_BLACKFIN_GPIOS + 16)];
static unsigned short reserved_peri_map[gpio_bank(MAX_RESOURCES)];

#define MAX_RESOURCES 256
#define RESOURCE_LABEL_SIZE 16

struct str_ident {
static struct str_ident {
char name[RESOURCE_LABEL_SIZE];
} *str_ident;

} str_ident[MAX_RESOURCES];

#ifdef CONFIG_PM
static unsigned short wakeup_map[gpio_bank(MAX_BLACKFIN_GPIOS)];
Expand Down Expand Up @@ -251,6 +249,11 @@ static char *get_label(unsigned short ident)

static int cmp_label(unsigned short ident, const char *label)
{
if (label == NULL) {
dump_stack();
printk(KERN_ERR "Please provide none-null label\n");
}

if (label && str_ident)
return strncmp(str_ident[ident].name,
label, strlen(label));
Expand Down Expand Up @@ -419,12 +422,6 @@ static void default_gpio(unsigned short gpio)

static int __init bfin_gpio_init(void)
{
str_ident = kcalloc(MAX_RESOURCES,
sizeof(struct str_ident), GFP_KERNEL);
if (str_ident == NULL)
return -ENOMEM;

memset(str_ident, 0, MAX_RESOURCES * sizeof(struct str_ident));

printk(KERN_INFO "Blackfin GPIO Controller\n");

Expand Down Expand Up @@ -785,6 +782,14 @@ void gpio_pm_restore(void)
}

#endif
#else /* BF548_FAMILY */

unsigned short get_gpio_dir(unsigned short gpio)
{
return (0x01 & (gpio_array[gpio_bank(gpio)]->port_dir_clear >> gpio_sub_n(gpio)));
}
EXPORT_SYMBOL(get_gpio_dir);

#endif /* BF548_FAMILY */

/***********************************************************
Expand Down Expand Up @@ -1204,10 +1209,10 @@ static int gpio_proc_read(char *buf, char **start, off_t offset,

for (c = 0; c < MAX_RESOURCES; c++) {
if (!check_gpio(c) && (reserved_gpio_map[gpio_bank(c)] & gpio_bit(c)))
len = sprintf(buf, "GPIO_%d: %s \tGPIO %s\n", c,
len = sprintf(buf, "GPIO_%d: %s \t\tGPIO %s\n", c,
get_label(c), get_gpio_dir(c) ? "OUTPUT" : "INPUT");
else if (reserved_peri_map[gpio_bank(c)] & gpio_bit(c))
len = sprintf(buf, "GPIO_%d: %s \tPeripheral\n", c, get_label(c));
len = sprintf(buf, "GPIO_%d: %s \t\tPeripheral\n", c, get_label(c));
else
continue;
buf += len;
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/asm-blackfin/mach-bf527/portmux.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef _MACH_PORTMUX_H_
#define _MACH_PORTMUX_H_

#define MAX_RESOURCES MAX_BLACKFIN_GPIOS

#define P_PPI0_D0 (P_DEFINED | P_IDENT(GPIO_PF0) | P_FUNCT(0))
#define P_PPI0_D1 (P_DEFINED | P_IDENT(GPIO_PF1) | P_FUNCT(0))
#define P_PPI0_D2 (P_DEFINED | P_IDENT(GPIO_PF2) | P_FUNCT(0))
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/asm-blackfin/mach-bf533/portmux.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef _MACH_PORTMUX_H_
#define _MACH_PORTMUX_H_

#define MAX_RESOURCES MAX_BLACKFIN_GPIOS

#define P_PPI0_CLK (P_DONTCARE)
#define P_PPI0_FS1 (P_DONTCARE)
#define P_PPI0_FS2 (P_DONTCARE)
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/asm-blackfin/mach-bf537/portmux.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef _MACH_PORTMUX_H_
#define _MACH_PORTMUX_H_

#define MAX_RESOURCES (MAX_BLACKFIN_GPIOS + GPIO_BANKSIZE) /* We additionally handle PORTJ */

#define P_UART0_TX (P_DEFINED | P_IDENT(GPIO_PF0) | P_FUNCT(0))
#define P_UART0_RX (P_DEFINED | P_IDENT(GPIO_PF1) | P_FUNCT(0))
#define P_UART1_TX (P_DEFINED | P_IDENT(GPIO_PF2) | P_FUNCT(0))
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/asm-blackfin/mach-bf548/portmux.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef _MACH_PORTMUX_H_
#define _MACH_PORTMUX_H_

#define MAX_RESOURCES MAX_BLACKFIN_GPIOS

#define P_SPORT2_TFS (P_DEFINED | P_IDENT(GPIO_PA0) | P_FUNCT(0))
#define P_SPORT2_DTSEC (P_DEFINED | P_IDENT(GPIO_PA1) | P_FUNCT(0))
#define P_SPORT2_DTPRI (P_DEFINED | P_IDENT(GPIO_PA2) | P_FUNCT(0))
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/asm-blackfin/mach-bf561/portmux.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef _MACH_PORTMUX_H_
#define _MACH_PORTMUX_H_

#define MAX_RESOURCES MAX_BLACKFIN_GPIOS

#define P_PPI0_CLK (P_DONTCARE)
#define P_PPI0_FS1 (P_DONTCARE)
#define P_PPI0_FS2 (P_DONTCARE)
Expand Down

0 comments on commit d4c031a

Please sign in to comment.