aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/pxa.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial/pxa.c')
-rw-r--r--drivers/serial/pxa.c62
1 files changed, 40 insertions, 22 deletions
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c
index 672b359b07ce..ff5e6309d682 100644
--- a/drivers/serial/pxa.c
+++ b/drivers/serial/pxa.c
@@ -39,7 +39,7 @@
39#include <linux/circ_buf.h> 39#include <linux/circ_buf.h>
40#include <linux/delay.h> 40#include <linux/delay.h>
41#include <linux/interrupt.h> 41#include <linux/interrupt.h>
42#include <linux/device.h> 42#include <linux/platform_device.h>
43#include <linux/tty.h> 43#include <linux/tty.h>
44#include <linux/tty_flip.h> 44#include <linux/tty_flip.h>
45#include <linux/serial_core.h> 45#include <linux/serial_core.h>
@@ -358,6 +358,9 @@ static int serial_pxa_startup(struct uart_port *port)
358 unsigned long flags; 358 unsigned long flags;
359 int retval; 359 int retval;
360 360
361 if (port->line == 3) /* HWUART */
362 up->mcr |= UART_MCR_AFE;
363 else
361 up->mcr = 0; 364 up->mcr = 0;
362 365
363 /* 366 /*
@@ -481,8 +484,10 @@ serial_pxa_set_termios(struct uart_port *port, struct termios *termios,
481 484
482 if ((up->port.uartclk / quot) < (2400 * 16)) 485 if ((up->port.uartclk / quot) < (2400 * 16))
483 fcr = UART_FCR_ENABLE_FIFO | UART_FCR_PXAR1; 486 fcr = UART_FCR_ENABLE_FIFO | UART_FCR_PXAR1;
484 else 487 else if ((up->port.uartclk / quot) < (230400 * 16))
485 fcr = UART_FCR_ENABLE_FIFO | UART_FCR_PXAR8; 488 fcr = UART_FCR_ENABLE_FIFO | UART_FCR_PXAR8;
489 else
490 fcr = UART_FCR_ENABLE_FIFO | UART_FCR_PXAR32;
486 491
487 /* 492 /*
488 * Ok, we're now changing the port state. Do it with 493 * Ok, we're now changing the port state. Do it with
@@ -499,7 +504,7 @@ serial_pxa_set_termios(struct uart_port *port, struct termios *termios,
499 /* 504 /*
500 * Update the per-port timeout. 505 * Update the per-port timeout.
501 */ 506 */
502 uart_update_timeout(port, termios->c_cflag, quot); 507 uart_update_timeout(port, termios->c_cflag, baud);
503 508
504 up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; 509 up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR;
505 if (termios->c_iflag & INPCK) 510 if (termios->c_iflag & INPCK)
@@ -772,6 +777,20 @@ static struct uart_pxa_port serial_pxa_ports[] = {
772 .ops = &serial_pxa_pops, 777 .ops = &serial_pxa_pops,
773 .line = 2, 778 .line = 2,
774 }, 779 },
780 }, { /* HWUART */
781 .name = "HWUART",
782 .cken = CKEN4_HWUART,
783 .port = {
784 .type = PORT_PXA,
785 .iotype = UPIO_MEM,
786 .membase = (void *)&HWUART,
787 .mapbase = __PREG(HWUART),
788 .irq = IRQ_HWUART,
789 .uartclk = 921600 * 16,
790 .fifosize = 64,
791 .ops = &serial_pxa_pops,
792 .line = 3,
793 },
775 } 794 }
776}; 795};
777 796
@@ -786,41 +805,39 @@ static struct uart_driver serial_pxa_reg = {
786 .cons = PXA_CONSOLE, 805 .cons = PXA_CONSOLE,
787}; 806};
788 807
789static int serial_pxa_suspend(struct device *_dev, pm_message_t state, u32 level) 808static int serial_pxa_suspend(struct platform_device *dev, pm_message_t state)
790{ 809{
791 struct uart_pxa_port *sport = dev_get_drvdata(_dev); 810 struct uart_pxa_port *sport = platform_get_drvdata(dev);
792 811
793 if (sport && level == SUSPEND_DISABLE) 812 if (sport)
794 uart_suspend_port(&serial_pxa_reg, &sport->port); 813 uart_suspend_port(&serial_pxa_reg, &sport->port);
795 814
796 return 0; 815 return 0;
797} 816}
798 817
799static int serial_pxa_resume(struct device *_dev, u32 level) 818static int serial_pxa_resume(struct platform_device *dev)
800{ 819{
801 struct uart_pxa_port *sport = dev_get_drvdata(_dev); 820 struct uart_pxa_port *sport = platform_get_drvdata(dev);
802 821
803 if (sport && level == RESUME_ENABLE) 822 if (sport)
804 uart_resume_port(&serial_pxa_reg, &sport->port); 823 uart_resume_port(&serial_pxa_reg, &sport->port);
805 824
806 return 0; 825 return 0;
807} 826}
808 827
809static int serial_pxa_probe(struct device *_dev) 828static int serial_pxa_probe(struct platform_device *dev)
810{ 829{
811 struct platform_device *dev = to_platform_device(_dev); 830 serial_pxa_ports[dev->id].port.dev = &dev->dev;
812
813 serial_pxa_ports[dev->id].port.dev = _dev;
814 uart_add_one_port(&serial_pxa_reg, &serial_pxa_ports[dev->id].port); 831 uart_add_one_port(&serial_pxa_reg, &serial_pxa_ports[dev->id].port);
815 dev_set_drvdata(_dev, &serial_pxa_ports[dev->id]); 832 platform_set_drvdata(dev, &serial_pxa_ports[dev->id]);
816 return 0; 833 return 0;
817} 834}
818 835
819static int serial_pxa_remove(struct device *_dev) 836static int serial_pxa_remove(struct platform_device *dev)
820{ 837{
821 struct uart_pxa_port *sport = dev_get_drvdata(_dev); 838 struct uart_pxa_port *sport = platform_get_drvdata(dev);
822 839
823 dev_set_drvdata(_dev, NULL); 840 platform_set_drvdata(dev, NULL);
824 841
825 if (sport) 842 if (sport)
826 uart_remove_one_port(&serial_pxa_reg, &sport->port); 843 uart_remove_one_port(&serial_pxa_reg, &sport->port);
@@ -828,14 +845,15 @@ static int serial_pxa_remove(struct device *_dev)
828 return 0; 845 return 0;
829} 846}
830 847
831static struct device_driver serial_pxa_driver = { 848static struct platform_driver serial_pxa_driver = {
832 .name = "pxa2xx-uart",
833 .bus = &platform_bus_type,
834 .probe = serial_pxa_probe, 849 .probe = serial_pxa_probe,
835 .remove = serial_pxa_remove, 850 .remove = serial_pxa_remove,
836 851
837 .suspend = serial_pxa_suspend, 852 .suspend = serial_pxa_suspend,
838 .resume = serial_pxa_resume, 853 .resume = serial_pxa_resume,
854 .driver = {
855 .name = "pxa2xx-uart",
856 },
839}; 857};
840 858
841int __init serial_pxa_init(void) 859int __init serial_pxa_init(void)
@@ -846,7 +864,7 @@ int __init serial_pxa_init(void)
846 if (ret != 0) 864 if (ret != 0)
847 return ret; 865 return ret;
848 866
849 ret = driver_register(&serial_pxa_driver); 867 ret = platform_driver_register(&serial_pxa_driver);
850 if (ret != 0) 868 if (ret != 0)
851 uart_unregister_driver(&serial_pxa_reg); 869 uart_unregister_driver(&serial_pxa_reg);
852 870
@@ -855,7 +873,7 @@ int __init serial_pxa_init(void)
855 873
856void __exit serial_pxa_exit(void) 874void __exit serial_pxa_exit(void)
857{ 875{
858 driver_unregister(&serial_pxa_driver); 876 platform_driver_unregister(&serial_pxa_driver);
859 uart_unregister_driver(&serial_pxa_reg); 877 uart_unregister_driver(&serial_pxa_reg);
860} 878}
861 879