diff options
author | Alan Cox <alan@linux.intel.com> | 2010-09-13 03:39:56 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-10-22 13:20:03 -0400 |
commit | 91efa75ce14db63d1eb47a2935bc7332de243f8d (patch) | |
tree | b51944dec371ea57d4aef64a361c7dc41a305738 /drivers | |
parent | ee9b4500eb6433015f35762d390666fede48e574 (diff) |
serial: mrst_max3110: Make the IRQ option runtime
And while we are at it allow it to fail to find one. Without this the IRQ
option will cause the 3110 driver to fail on 0.7 SFI firmware.
Acked-by: Feng Tang <feng.tang@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/serial/Kconfig | 7 | ||||
-rw-r--r-- | drivers/serial/mrst_max3110.c | 55 |
2 files changed, 28 insertions, 34 deletions
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 12900f7083b0..ba4b390299d5 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig | |||
@@ -717,13 +717,6 @@ config SERIAL_MRST_MAX3110 | |||
717 | the Intel Moorestown platform. On other systems use the max3100 | 717 | the Intel Moorestown platform. On other systems use the max3100 |
718 | driver. | 718 | driver. |
719 | 719 | ||
720 | config MRST_MAX3110_IRQ | ||
721 | boolean "Enable GPIO IRQ for Max3110 over Moorestown" | ||
722 | default n | ||
723 | depends on SERIAL_MRST_MAX3110 && GPIO_LANGWELL | ||
724 | help | ||
725 | This has to be enabled after Moorestown GPIO driver is loaded | ||
726 | |||
727 | config SERIAL_MFD_HSU | 720 | config SERIAL_MFD_HSU |
728 | tristate "Medfield High Speed UART support" | 721 | tristate "Medfield High Speed UART support" |
729 | depends on PCI | 722 | depends on PCI |
diff --git a/drivers/serial/mrst_max3110.c b/drivers/serial/mrst_max3110.c index af8db27f9e87..b62857bf2fdb 100644 --- a/drivers/serial/mrst_max3110.c +++ b/drivers/serial/mrst_max3110.c | |||
@@ -447,7 +447,6 @@ static int max3110_main_thread(void *_max) | |||
447 | return ret; | 447 | return ret; |
448 | } | 448 | } |
449 | 449 | ||
450 | #ifdef CONFIG_MRST_MAX3110_IRQ | ||
451 | static irqreturn_t serial_m3110_irq(int irq, void *dev_id) | 450 | static irqreturn_t serial_m3110_irq(int irq, void *dev_id) |
452 | { | 451 | { |
453 | struct uart_max3110 *max = dev_id; | 452 | struct uart_max3110 *max = dev_id; |
@@ -459,7 +458,7 @@ static irqreturn_t serial_m3110_irq(int irq, void *dev_id) | |||
459 | 458 | ||
460 | return IRQ_HANDLED; | 459 | return IRQ_HANDLED; |
461 | } | 460 | } |
462 | #else | 461 | |
463 | /* if don't use RX IRQ, then need a thread to polling read */ | 462 | /* if don't use RX IRQ, then need a thread to polling read */ |
464 | static int max3110_read_thread(void *_max) | 463 | static int max3110_read_thread(void *_max) |
465 | { | 464 | { |
@@ -482,7 +481,6 @@ static int max3110_read_thread(void *_max) | |||
482 | 481 | ||
483 | return 0; | 482 | return 0; |
484 | } | 483 | } |
485 | #endif | ||
486 | 484 | ||
487 | static int serial_m3110_startup(struct uart_port *port) | 485 | static int serial_m3110_startup(struct uart_port *port) |
488 | { | 486 | { |
@@ -505,34 +503,38 @@ static int serial_m3110_startup(struct uart_port *port) | |||
505 | /* as we use thread to handle tx/rx, need set low latency */ | 503 | /* as we use thread to handle tx/rx, need set low latency */ |
506 | port->state->port.tty->low_latency = 1; | 504 | port->state->port.tty->low_latency = 1; |
507 | 505 | ||
508 | #ifdef CONFIG_MRST_MAX3110_IRQ | 506 | if (max->irq) { |
509 | ret = request_irq(max->irq, serial_m3110_irq, | 507 | max->read_thread = NULL; |
508 | ret = request_irq(max->irq, serial_m3110_irq, | ||
510 | IRQ_TYPE_EDGE_FALLING, "max3110", max); | 509 | IRQ_TYPE_EDGE_FALLING, "max3110", max); |
511 | if (ret) | 510 | if (ret) { |
512 | return ret; | 511 | max->irq = 0; |
512 | pr_err(PR_FMT "unable to allocate IRQ, polling\n"); | ||
513 | } else { | ||
514 | /* Enable RX IRQ only */ | ||
515 | config |= WC_RXA_IRQ_ENABLE; | ||
516 | } | ||
517 | } | ||
513 | 518 | ||
514 | /* Enable RX IRQ only */ | 519 | if (max->irq == 0) { |
515 | config |= WC_RXA_IRQ_ENABLE; | 520 | /* If IRQ is disabled, start a read thread for input data */ |
516 | #else | 521 | max->read_thread = |
517 | /* If IRQ is disabled, start a read thread for input data */ | 522 | kthread_run(max3110_read_thread, max, "max3110_read"); |
518 | max->read_thread = | 523 | if (IS_ERR(max->read_thread)) { |
519 | kthread_run(max3110_read_thread, max, "max3110_read"); | 524 | ret = PTR_ERR(max->read_thread); |
520 | if (IS_ERR(max->read_thread)) { | 525 | max->read_thread = NULL; |
521 | ret = PTR_ERR(max->read_thread); | 526 | pr_err(PR_FMT "Can't create read thread!\n"); |
522 | max->read_thread = NULL; | 527 | return ret; |
523 | pr_err(PR_FMT "Can't create read thread!"); | 528 | } |
524 | return ret; | ||
525 | } | 529 | } |
526 | #endif | ||
527 | 530 | ||
528 | ret = max3110_out(max, config); | 531 | ret = max3110_out(max, config); |
529 | if (ret) { | 532 | if (ret) { |
530 | #ifdef CONFIG_MRST_MAX3110_IRQ | 533 | if (max->irq) |
531 | free_irq(max->irq, max); | 534 | free_irq(max->irq, max); |
532 | #else | 535 | if (max->read_thread) |
533 | kthread_stop(max->read_thread); | 536 | kthread_stop(max->read_thread); |
534 | max->read_thread = NULL; | 537 | max->read_thread = NULL; |
535 | #endif | ||
536 | return ret; | 538 | return ret; |
537 | } | 539 | } |
538 | 540 | ||
@@ -551,9 +553,8 @@ static void serial_m3110_shutdown(struct uart_port *port) | |||
551 | max->read_thread = NULL; | 553 | max->read_thread = NULL; |
552 | } | 554 | } |
553 | 555 | ||
554 | #ifdef CONFIG_MRST_MAX3110_IRQ | 556 | if (max->irq) |
555 | free_irq(max->irq, max); | 557 | free_irq(max->irq, max); |
556 | #endif | ||
557 | 558 | ||
558 | /* Disable interrupts from this port */ | 559 | /* Disable interrupts from this port */ |
559 | config = WC_TAG | WC_SW_SHDI; | 560 | config = WC_TAG | WC_SW_SHDI; |