Commit 8eb3e3bf authored by Graf Yang's avatar Graf Yang Committed by Bryan Wu

Blackfin arch: Request the gpio resource when making it as an irq pin, avoiding override it.

Signed-off-by: default avatarGraf Yang <graf.yang@analog.com>
Signed-off-by: default avatarBryan Wu <cooloney@kernel.org>
parent 30af6d49
...@@ -1257,10 +1257,10 @@ static int gpio_proc_read(char *buf, char **start, off_t offset, ...@@ -1257,10 +1257,10 @@ static int gpio_proc_read(char *buf, char **start, off_t offset,
for (c = 0; c < MAX_RESOURCES; c++) { for (c = 0; c < MAX_RESOURCES; c++) {
if (!check_gpio(c) && (reserved_gpio_map[gpio_bank(c)] & gpio_bit(c))) if (!check_gpio(c) && (reserved_gpio_map[gpio_bank(c)] & gpio_bit(c)))
len = sprintf(buf, "GPIO_%d: %s \t\tGPIO %s\n", c, len = sprintf(buf, "GPIO_%d: \t%s \t\tGPIO %s\n", c,
get_label(c), get_gpio_dir(c) ? "OUTPUT" : "INPUT"); get_label(c), get_gpio_dir(c) ? "OUTPUT" : "INPUT");
else if (reserved_peri_map[gpio_bank(c)] & gpio_bit(c)) else if (reserved_peri_map[gpio_bank(c)] & gpio_bit(c))
len = sprintf(buf, "GPIO_%d: %s \t\tPeripheral\n", c, get_label(c)); len = sprintf(buf, "GPIO_%d: \t%s \t\tPeripheral\n", c, get_label(c));
else else
continue; continue;
buf += len; buf += len;
......
...@@ -437,8 +437,15 @@ static void bfin_gpio_irq_shutdown(unsigned int irq) ...@@ -437,8 +437,15 @@ static void bfin_gpio_irq_shutdown(unsigned int irq)
static int bfin_gpio_irq_type(unsigned int irq, unsigned int type) static int bfin_gpio_irq_type(unsigned int irq, unsigned int type)
{ {
int ret;
char buf[16];
u32 gpionr = irq_to_gpio(irq); u32 gpionr = irq_to_gpio(irq);
snprintf(buf, 16, "gpio-irq%d", irq);
ret = bfin_gpio_request(gpionr, buf);
if (ret)
return ret;
if (type == IRQ_TYPE_PROBE) { if (type == IRQ_TYPE_PROBE) {
/* only probe unenabled GPIO interrupt lines */ /* only probe unenabled GPIO interrupt lines */
if (__test_bit(gpionr, gpio_enabled)) if (__test_bit(gpionr, gpio_enabled))
...@@ -738,7 +745,8 @@ static void bfin_gpio_irq_shutdown(unsigned int irq) ...@@ -738,7 +745,8 @@ static void bfin_gpio_irq_shutdown(unsigned int irq)
static int bfin_gpio_irq_type(unsigned int irq, unsigned int type) static int bfin_gpio_irq_type(unsigned int irq, unsigned int type)
{ {
int ret;
char buf[16];
u32 gpionr = irq_to_gpio(irq); u32 gpionr = irq_to_gpio(irq);
u32 pint_val = irq2pint_lut[irq - SYS_IRQS]; u32 pint_val = irq2pint_lut[irq - SYS_IRQS];
u32 pintbit = PINT_BIT(pint_val); u32 pintbit = PINT_BIT(pint_val);
...@@ -747,6 +755,11 @@ static int bfin_gpio_irq_type(unsigned int irq, unsigned int type) ...@@ -747,6 +755,11 @@ static int bfin_gpio_irq_type(unsigned int irq, unsigned int type)
if (pint_val == IRQ_NOT_AVAIL) if (pint_val == IRQ_NOT_AVAIL)
return -ENODEV; return -ENODEV;
snprintf(buf, 16, "gpio-irq%d", irq);
ret = bfin_gpio_request(gpionr, buf);
if (ret)
return ret;
if (type == IRQ_TYPE_PROBE) { if (type == IRQ_TYPE_PROBE) {
/* only probe unenabled GPIO interrupt lines */ /* only probe unenabled GPIO interrupt lines */
if (__test_bit(gpionr, gpio_enabled)) if (__test_bit(gpionr, gpio_enabled))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment