rt2x00: Remove incorrect led blink
[linux-2.6.git] / drivers / tty / serial / s3c2410.c
blobb1d7e7c1849d22192c21c03e9bdc5073df5be8f2
1 /*
2 * Driver for Samsung S3C2410 SoC onboard UARTs.
4 * Ben Dooks, Copyright (c) 2003-2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk/
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
12 #include <linux/module.h>
13 #include <linux/ioport.h>
14 #include <linux/io.h>
15 #include <linux/platform_device.h>
16 #include <linux/init.h>
17 #include <linux/serial_core.h>
18 #include <linux/serial.h>
20 #include <asm/irq.h>
21 #include <mach/hardware.h>
23 #include <plat/regs-serial.h>
24 #include <mach/regs-gpio.h>
26 #include "samsung.h"
28 static int s3c2410_serial_setsource(struct uart_port *port,
29 struct s3c24xx_uart_clksrc *clk)
31 unsigned long ucon = rd_regl(port, S3C2410_UCON);
33 if (strcmp(clk->name, "uclk") == 0)
34 ucon |= S3C2410_UCON_UCLK;
35 else
36 ucon &= ~S3C2410_UCON_UCLK;
38 wr_regl(port, S3C2410_UCON, ucon);
39 return 0;
42 static int s3c2410_serial_getsource(struct uart_port *port,
43 struct s3c24xx_uart_clksrc *clk)
45 unsigned long ucon = rd_regl(port, S3C2410_UCON);
47 clk->divisor = 1;
48 clk->name = (ucon & S3C2410_UCON_UCLK) ? "uclk" : "pclk";
50 return 0;
53 static int s3c2410_serial_resetport(struct uart_port *port,
54 struct s3c2410_uartcfg *cfg)
56 dbg("s3c2410_serial_resetport: port=%p (%08lx), cfg=%p\n",
57 port, port->mapbase, cfg);
59 wr_regl(port, S3C2410_UCON, cfg->ucon);
60 wr_regl(port, S3C2410_ULCON, cfg->ulcon);
62 /* reset both fifos */
64 wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH);
65 wr_regl(port, S3C2410_UFCON, cfg->ufcon);
67 return 0;
70 static struct s3c24xx_uart_info s3c2410_uart_inf = {
71 .name = "Samsung S3C2410 UART",
72 .type = PORT_S3C2410,
73 .fifosize = 16,
74 .rx_fifomask = S3C2410_UFSTAT_RXMASK,
75 .rx_fifoshift = S3C2410_UFSTAT_RXSHIFT,
76 .rx_fifofull = S3C2410_UFSTAT_RXFULL,
77 .tx_fifofull = S3C2410_UFSTAT_TXFULL,
78 .tx_fifomask = S3C2410_UFSTAT_TXMASK,
79 .tx_fifoshift = S3C2410_UFSTAT_TXSHIFT,
80 .get_clksrc = s3c2410_serial_getsource,
81 .set_clksrc = s3c2410_serial_setsource,
82 .reset_port = s3c2410_serial_resetport,
85 static int s3c2410_serial_probe(struct platform_device *dev)
87 return s3c24xx_serial_probe(dev, &s3c2410_uart_inf);
90 static struct platform_driver s3c2410_serial_driver = {
91 .probe = s3c2410_serial_probe,
92 .remove = __devexit_p(s3c24xx_serial_remove),
93 .driver = {
94 .name = "s3c2410-uart",
95 .owner = THIS_MODULE,
99 static int __init s3c2410_serial_init(void)
101 return s3c24xx_serial_init(&s3c2410_serial_driver, &s3c2410_uart_inf);
104 static void __exit s3c2410_serial_exit(void)
106 platform_driver_unregister(&s3c2410_serial_driver);
109 module_init(s3c2410_serial_init);
110 module_exit(s3c2410_serial_exit);
112 MODULE_LICENSE("GPL v2");
113 MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
114 MODULE_DESCRIPTION("Samsung S3C2410 SoC Serial port driver");
115 MODULE_ALIAS("platform:s3c2410-uart");