2 * Driver for Samsung S3C2412 and S3C2413 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>
15 #include <linux/platform_device.h>
16 #include <linux/init.h>
17 #include <linux/serial_core.h>
18 #include <linux/serial.h>
21 #include <mach/hardware.h>
23 #include <plat/regs-serial.h>
24 #include <mach/regs-gpio.h>
28 static int s3c2412_serial_resetport(struct uart_port *port,
29 struct s3c2410_uartcfg *cfg)
31 unsigned long ucon = rd_regl(port, S3C2410_UCON);
33 dbg("%s: port=%p (%08lx), cfg=%p\n",
34 __func__, port, port->mapbase, cfg);
36 /* ensure we don't change the clock settings... */
38 ucon &= S3C2412_UCON_CLKMASK;
40 wr_regl(port, S3C2410_UCON, ucon | cfg->ucon);
41 wr_regl(port, S3C2410_ULCON, cfg->ulcon);
43 /* reset both fifos */
45 wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH);
46 wr_regl(port, S3C2410_UFCON, cfg->ufcon);
51 static struct s3c24xx_uart_info s3c2412_uart_inf = {
52 .name = "Samsung S3C2412 UART",
56 .rx_fifomask = S3C2440_UFSTAT_RXMASK,
57 .rx_fifoshift = S3C2440_UFSTAT_RXSHIFT,
58 .rx_fifofull = S3C2440_UFSTAT_RXFULL,
59 .tx_fifofull = S3C2440_UFSTAT_TXFULL,
60 .tx_fifomask = S3C2440_UFSTAT_TXMASK,
61 .tx_fifoshift = S3C2440_UFSTAT_TXSHIFT,
62 .def_clk_sel = S3C2410_UCON_CLKSEL2,
64 .clksel_mask = S3C2412_UCON_CLKMASK,
65 .clksel_shift = S3C2412_UCON_CLKSHIFT,
66 .reset_port = s3c2412_serial_resetport,
69 /* device management */
71 static int s3c2412_serial_probe(struct platform_device *dev)
73 dbg("s3c2440_serial_probe: dev=%p\n", dev);
74 return s3c24xx_serial_probe(dev, &s3c2412_uart_inf);
77 static struct platform_driver s3c2412_serial_driver = {
78 .probe = s3c2412_serial_probe,
79 .remove = __devexit_p(s3c24xx_serial_remove),
81 .name = "s3c2412-uart",
86 static inline int s3c2412_serial_init(void)
88 return s3c24xx_serial_init(&s3c2412_serial_driver, &s3c2412_uart_inf);
91 static inline void s3c2412_serial_exit(void)
93 platform_driver_unregister(&s3c2412_serial_driver);
96 module_init(s3c2412_serial_init);
97 module_exit(s3c2412_serial_exit);
99 MODULE_DESCRIPTION("Samsung S3C2412,S3C2413 SoC Serial port driver");
100 MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
101 MODULE_LICENSE("GPL v2");
102 MODULE_ALIAS("platform:s3c2412-uart");