aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/sa1100.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial/sa1100.c')
-rw-r--r--drivers/serial/sa1100.c37
1 files changed, 17 insertions, 20 deletions
diff --git a/drivers/serial/sa1100.c b/drivers/serial/sa1100.c
index ed618cc7ae96..25a086458ab9 100644
--- a/drivers/serial/sa1100.c
+++ b/drivers/serial/sa1100.c
@@ -156,19 +156,16 @@ static void sa1100_stop_tx(struct uart_port *port)
156} 156}
157 157
158/* 158/*
159 * interrupts may not be disabled on entry 159 * port locked and interrupts disabled
160 */ 160 */
161static void sa1100_start_tx(struct uart_port *port) 161static void sa1100_start_tx(struct uart_port *port)
162{ 162{
163 struct sa1100_port *sport = (struct sa1100_port *)port; 163 struct sa1100_port *sport = (struct sa1100_port *)port;
164 unsigned long flags;
165 u32 utcr3; 164 u32 utcr3;
166 165
167 spin_lock_irqsave(&sport->port.lock, flags);
168 utcr3 = UART_GET_UTCR3(sport); 166 utcr3 = UART_GET_UTCR3(sport);
169 sport->port.read_status_mask |= UTSR0_TO_SM(UTSR0_TFS); 167 sport->port.read_status_mask |= UTSR0_TO_SM(UTSR0_TFS);
170 UART_PUT_UTCR3(sport, utcr3 | UTCR3_TIE); 168 UART_PUT_UTCR3(sport, utcr3 | UTCR3_TIE);
171 spin_unlock_irqrestore(&sport->port.lock, flags);
172} 169}
173 170
174/* 171/*
@@ -834,9 +831,9 @@ static struct uart_driver sa1100_reg = {
834 .cons = SA1100_CONSOLE, 831 .cons = SA1100_CONSOLE,
835}; 832};
836 833
837static int sa1100_serial_suspend(struct device *_dev, pm_message_t state) 834static int sa1100_serial_suspend(struct platform_device *dev, pm_message_t state)
838{ 835{
839 struct sa1100_port *sport = dev_get_drvdata(_dev); 836 struct sa1100_port *sport = platform_get_drvdata(dev);
840 837
841 if (sport) 838 if (sport)
842 uart_suspend_port(&sa1100_reg, &sport->port); 839 uart_suspend_port(&sa1100_reg, &sport->port);
@@ -844,9 +841,9 @@ static int sa1100_serial_suspend(struct device *_dev, pm_message_t state)
844 return 0; 841 return 0;
845} 842}
846 843
847static int sa1100_serial_resume(struct device *_dev) 844static int sa1100_serial_resume(struct platform_device *dev)
848{ 845{
849 struct sa1100_port *sport = dev_get_drvdata(_dev); 846 struct sa1100_port *sport = platform_get_drvdata(dev);
850 847
851 if (sport) 848 if (sport)
852 uart_resume_port(&sa1100_reg, &sport->port); 849 uart_resume_port(&sa1100_reg, &sport->port);
@@ -854,9 +851,8 @@ static int sa1100_serial_resume(struct device *_dev)
854 return 0; 851 return 0;
855} 852}
856 853
857static int sa1100_serial_probe(struct device *_dev) 854static int sa1100_serial_probe(struct platform_device *dev)
858{ 855{
859 struct platform_device *dev = to_platform_device(_dev);
860 struct resource *res = dev->resource; 856 struct resource *res = dev->resource;
861 int i; 857 int i;
862 858
@@ -869,9 +865,9 @@ static int sa1100_serial_probe(struct device *_dev)
869 if (sa1100_ports[i].port.mapbase != res->start) 865 if (sa1100_ports[i].port.mapbase != res->start)
870 continue; 866 continue;
871 867
872 sa1100_ports[i].port.dev = _dev; 868 sa1100_ports[i].port.dev = &dev->dev;
873 uart_add_one_port(&sa1100_reg, &sa1100_ports[i].port); 869 uart_add_one_port(&sa1100_reg, &sa1100_ports[i].port);
874 dev_set_drvdata(_dev, &sa1100_ports[i]); 870 platform_set_drvdata(dev, &sa1100_ports[i]);
875 break; 871 break;
876 } 872 }
877 } 873 }
@@ -879,11 +875,11 @@ static int sa1100_serial_probe(struct device *_dev)
879 return 0; 875 return 0;
880} 876}
881 877
882static int sa1100_serial_remove(struct device *_dev) 878static int sa1100_serial_remove(struct platform_device *pdev)
883{ 879{
884 struct sa1100_port *sport = dev_get_drvdata(_dev); 880 struct sa1100_port *sport = platform_get_drvdata(pdev);
885 881
886 dev_set_drvdata(_dev, NULL); 882 platform_set_drvdata(pdev, NULL);
887 883
888 if (sport) 884 if (sport)
889 uart_remove_one_port(&sa1100_reg, &sport->port); 885 uart_remove_one_port(&sa1100_reg, &sport->port);
@@ -891,13 +887,14 @@ static int sa1100_serial_remove(struct device *_dev)
891 return 0; 887 return 0;
892} 888}
893 889
894static struct device_driver sa11x0_serial_driver = { 890static struct platform_driver sa11x0_serial_driver = {
895 .name = "sa11x0-uart",
896 .bus = &platform_bus_type,
897 .probe = sa1100_serial_probe, 891 .probe = sa1100_serial_probe,
898 .remove = sa1100_serial_remove, 892 .remove = sa1100_serial_remove,
899 .suspend = sa1100_serial_suspend, 893 .suspend = sa1100_serial_suspend,
900 .resume = sa1100_serial_resume, 894 .resume = sa1100_serial_resume,
895 .driver = {
896 .name = "sa11x0-uart",
897 },
901}; 898};
902 899
903static int __init sa1100_serial_init(void) 900static int __init sa1100_serial_init(void)
@@ -910,7 +907,7 @@ static int __init sa1100_serial_init(void)
910 907
911 ret = uart_register_driver(&sa1100_reg); 908 ret = uart_register_driver(&sa1100_reg);
912 if (ret == 0) { 909 if (ret == 0) {
913 ret = driver_register(&sa11x0_serial_driver); 910 ret = platform_driver_register(&sa11x0_serial_driver);
914 if (ret) 911 if (ret)
915 uart_unregister_driver(&sa1100_reg); 912 uart_unregister_driver(&sa1100_reg);
916 } 913 }
@@ -919,7 +916,7 @@ static int __init sa1100_serial_init(void)
919 916
920static void __exit sa1100_serial_exit(void) 917static void __exit sa1100_serial_exit(void)
921{ 918{
922 driver_unregister(&sa11x0_serial_driver); 919 platform_driver_unregister(&sa11x0_serial_driver);
923 uart_unregister_driver(&sa1100_reg); 920 uart_unregister_driver(&sa1100_reg);
924} 921}
925 922