aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/jz4740/gpio.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/arch/mips/jz4740/gpio.c b/arch/mips/jz4740/gpio.c
index 9bb0770fa76e..bd2fc29b95e0 100644
--- a/arch/mips/jz4740/gpio.c
+++ b/arch/mips/jz4740/gpio.c
@@ -347,22 +347,14 @@ static void jz_gpio_irq_unmask(struct irq_data *data)
347/* TODO: Check if function is gpio */ 347/* TODO: Check if function is gpio */
348static unsigned int jz_gpio_irq_startup(struct irq_data *data) 348static unsigned int jz_gpio_irq_startup(struct irq_data *data)
349{ 349{
350 struct irq_desc *desc = irq_to_desc(data->irq);
351
352 jz_gpio_set_irq_bit(data, JZ_REG_GPIO_SELECT_SET); 350 jz_gpio_set_irq_bit(data, JZ_REG_GPIO_SELECT_SET);
353
354 desc->status &= ~IRQ_MASKED;
355 jz_gpio_irq_unmask(data); 351 jz_gpio_irq_unmask(data);
356
357 return 0; 352 return 0;
358} 353}
359 354
360static void jz_gpio_irq_shutdown(struct irq_data *data) 355static void jz_gpio_irq_shutdown(struct irq_data *data)
361{ 356{
362 struct irq_desc *desc = irq_to_desc(data->irq);
363
364 jz_gpio_irq_mask(data); 357 jz_gpio_irq_mask(data);
365 desc->status |= IRQ_MASKED;
366 358
367 /* Set direction to input */ 359 /* Set direction to input */
368 jz_gpio_set_irq_bit(data, JZ_REG_GPIO_DIRECTION_CLEAR); 360 jz_gpio_set_irq_bit(data, JZ_REG_GPIO_DIRECTION_CLEAR);
@@ -377,11 +369,8 @@ static void jz_gpio_irq_ack(struct irq_data *data)
377static int jz_gpio_irq_set_type(struct irq_data *data, unsigned int flow_type) 369static int jz_gpio_irq_set_type(struct irq_data *data, unsigned int flow_type)
378{ 370{
379 struct jz_gpio_chip *chip = irq_to_jz_gpio_chip(data); 371 struct jz_gpio_chip *chip = irq_to_jz_gpio_chip(data);
380 struct irq_desc *desc = irq_to_desc(data->irq);
381 unsigned int irq = data->irq; 372 unsigned int irq = data->irq;
382 373
383 jz_gpio_irq_mask(data);
384
385 if (flow_type == IRQ_TYPE_EDGE_BOTH) { 374 if (flow_type == IRQ_TYPE_EDGE_BOTH) {
386 uint32_t value = readl(chip->base + JZ_REG_GPIO_PIN); 375 uint32_t value = readl(chip->base + JZ_REG_GPIO_PIN);
387 if (value & IRQ_TO_BIT(irq)) 376 if (value & IRQ_TO_BIT(irq))
@@ -414,9 +403,6 @@ static int jz_gpio_irq_set_type(struct irq_data *data, unsigned int flow_type)
414 return -EINVAL; 403 return -EINVAL;
415 } 404 }
416 405
417 if (!(desc->status & IRQ_MASKED))
418 jz_gpio_irq_unmask(data);
419
420 return 0; 406 return 0;
421} 407}
422 408
@@ -443,6 +429,7 @@ static struct irq_chip jz_gpio_irq_chip = {
443 .irq_shutdown = jz_gpio_irq_shutdown, 429 .irq_shutdown = jz_gpio_irq_shutdown,
444 .irq_set_type = jz_gpio_irq_set_type, 430 .irq_set_type = jz_gpio_irq_set_type,
445 .irq_set_wake = jz_gpio_irq_set_wake, 431 .irq_set_wake = jz_gpio_irq_set_wake,
432 .flags = IRQCHIP_SET_TYPE_MASKED,
446}; 433};
447 434
448/* 435/*
@@ -527,7 +514,7 @@ static int jz4740_gpio_chip_init(struct jz_gpio_chip *chip, unsigned int id)
527 set_irq_chained_handler(chip->irq, jz_gpio_irq_demux_handler); 514 set_irq_chained_handler(chip->irq, jz_gpio_irq_demux_handler);
528 515
529 for (irq = chip->irq_base; irq < chip->irq_base + chip->gpio_chip.ngpio; ++irq) { 516 for (irq = chip->irq_base; irq < chip->irq_base + chip->gpio_chip.ngpio; ++irq) {
530 lockdep_set_class(&irq_desc[irq].lock, &gpio_lock_class); 517 irq_set_lockdep_class(irq, &gpio_lock_class);
531 set_irq_chip_data(irq, chip); 518 set_irq_chip_data(irq, chip);
532 set_irq_chip_and_handler(irq, &jz_gpio_irq_chip, 519 set_irq_chip_and_handler(irq, &jz_gpio_irq_chip,
533 handle_level_irq); 520 handle_level_irq);