diff options
-rw-r--r-- | arch/arc/boot/dts/angel4.dts | 2 | ||||
-rw-r--r-- | drivers/tty/serial/arc_uart.c | 87 |
2 files changed, 13 insertions, 76 deletions
diff --git a/arch/arc/boot/dts/angel4.dts b/arch/arc/boot/dts/angel4.dts index 5bb2fdaca02f..6b57475967a6 100644 --- a/arch/arc/boot/dts/angel4.dts +++ b/arch/arc/boot/dts/angel4.dts | |||
@@ -17,7 +17,7 @@ | |||
17 | interrupt-parent = <&intc>; | 17 | interrupt-parent = <&intc>; |
18 | 18 | ||
19 | chosen { | 19 | chosen { |
20 | bootargs = "console=ttyARC0,115200n8 earlyprintk=ttyARC0"; | 20 | bootargs = "earlycon=arc_uart,mmio32,0xc0fc1000,115200n8 console=ttyARC0,115200n8"; |
21 | }; | 21 | }; |
22 | 22 | ||
23 | aliases { | 23 | aliases { |
diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c index 41d2e351c06d..94d345bfd08d 100644 --- a/drivers/tty/serial/arc_uart.c +++ b/drivers/tty/serial/arc_uart.c | |||
@@ -492,33 +492,23 @@ static int | |||
492 | arc_uart_init_one(struct platform_device *pdev, int dev_id) | 492 | arc_uart_init_one(struct platform_device *pdev, int dev_id) |
493 | { | 493 | { |
494 | struct resource *res, *res2; | 494 | struct resource *res, *res2; |
495 | unsigned long *plat_data; | ||
496 | struct arc_uart_port *uart = &arc_uart_ports[dev_id]; | 495 | struct arc_uart_port *uart = &arc_uart_ports[dev_id]; |
497 | struct uart_port *port = &uart->port; | 496 | struct uart_port *port = &uart->port; |
498 | 497 | ||
499 | plat_data = dev_get_platdata(&pdev->dev); | 498 | struct device_node *np = pdev->dev.of_node; |
500 | if (!plat_data) | 499 | u32 val; |
501 | return -ENODEV; | ||
502 | 500 | ||
503 | if (is_early_platform_device(pdev)) { | 501 | if (of_property_read_u32(np, "clock-frequency", &val)) { |
504 | port->uartclk = plat_data[1]; | 502 | dev_err(&pdev->dev, "clock-frequency property NOTset\n"); |
505 | uart->baud = plat_data[2]; | 503 | return -EINVAL; |
506 | } else { | ||
507 | struct device_node *np = pdev->dev.of_node; | ||
508 | u32 val; | ||
509 | |||
510 | if (of_property_read_u32(np, "clock-frequency", &val)) { | ||
511 | dev_err(&pdev->dev, "clock-frequency property NOTset\n"); | ||
512 | return -EINVAL; | ||
513 | } | ||
514 | port->uartclk = val; | ||
515 | |||
516 | if (of_property_read_u32(np, "current-speed", &val)) { | ||
517 | dev_err(&pdev->dev, "current-speed property NOT set\n"); | ||
518 | return -EINVAL; | ||
519 | } | ||
520 | uart->baud = val; | ||
521 | } | 504 | } |
505 | port->uartclk = val; | ||
506 | |||
507 | if (of_property_read_u32(np, "current-speed", &val)) { | ||
508 | dev_err(&pdev->dev, "current-speed property NOT set\n"); | ||
509 | return -EINVAL; | ||
510 | } | ||
511 | uart->baud = val; | ||
522 | 512 | ||
523 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 513 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
524 | if (!res) | 514 | if (!res) |
@@ -607,38 +597,6 @@ static struct console arc_console = { | |||
607 | .data = &arc_uart_driver | 597 | .data = &arc_uart_driver |
608 | }; | 598 | }; |
609 | 599 | ||
610 | static __init void early_serial_write(struct console *con, const char *s, | ||
611 | unsigned int n) | ||
612 | { | ||
613 | struct uart_port *port = &arc_uart_ports[con->index].port; | ||
614 | |||
615 | uart_console_write(port, s, n, arc_serial_poll_putchar); | ||
616 | } | ||
617 | |||
618 | static struct console arc_early_serial_console __initdata = { | ||
619 | .name = "early_ARCuart", | ||
620 | .write = early_serial_write, | ||
621 | .flags = CON_PRINTBUFFER | CON_BOOT, | ||
622 | .index = -1 | ||
623 | }; | ||
624 | |||
625 | static int __init arc_serial_probe_earlyprintk(struct platform_device *pdev) | ||
626 | { | ||
627 | int dev_id = pdev->id < 0 ? 0 : pdev->id; | ||
628 | int rc; | ||
629 | |||
630 | arc_early_serial_console.index = dev_id; | ||
631 | |||
632 | rc = arc_uart_init_one(pdev, dev_id); | ||
633 | if (rc) | ||
634 | panic("early console init failed\n"); | ||
635 | |||
636 | arc_serial_console_setup(&arc_early_serial_console, NULL); | ||
637 | |||
638 | register_console(&arc_early_serial_console); | ||
639 | return 0; | ||
640 | } | ||
641 | |||
642 | static __init void arc_early_serial_write(struct console *con, const char *s, | 600 | static __init void arc_early_serial_write(struct console *con, const char *s, |
643 | unsigned int n) | 601 | unsigned int n) |
644 | { | 602 | { |
@@ -713,27 +671,6 @@ static struct platform_driver arc_platform_driver = { | |||
713 | }, | 671 | }, |
714 | }; | 672 | }; |
715 | 673 | ||
716 | #ifdef CONFIG_SERIAL_ARC_CONSOLE | ||
717 | |||
718 | static struct platform_driver early_arc_platform_driver __initdata = { | ||
719 | .probe = arc_serial_probe_earlyprintk, | ||
720 | .remove = arc_serial_remove, | ||
721 | .driver = { | ||
722 | .name = DRIVER_NAME, | ||
723 | .owner = THIS_MODULE, | ||
724 | }, | ||
725 | }; | ||
726 | /* | ||
727 | * Register an early platform driver of "earlyprintk" class. | ||
728 | * ARCH platform code installs the driver and probes the early devices | ||
729 | * The installation could rely on user specifying earlyprintk=xyx in cmd line | ||
730 | * or it could be done independently, for all "earlyprintk" class drivers. | ||
731 | * [see arch/arc/plat-arcfpga/platform.c] | ||
732 | */ | ||
733 | early_platform_init("earlyprintk", &early_arc_platform_driver); | ||
734 | |||
735 | #endif /* CONFIG_SERIAL_ARC_CONSOLE */ | ||
736 | |||
737 | static int __init arc_serial_init(void) | 674 | static int __init arc_serial_init(void) |
738 | { | 675 | { |
739 | int ret; | 676 | int ret; |