diff options
author | Sandeep Patil <sandeep.patil@azingo.com> | 2008-10-21 09:06:30 -0400 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2008-12-15 16:46:36 -0500 |
commit | 1d4bab082474d539f900e896880aa2135e0f5393 (patch) | |
tree | 277e991e7994a5b28a894f66c7582e59b6d9c1aa | |
parent | f0c9eb4ec2d3c9f4ddd74b75da6dfc137e0f6b0d (diff) |
[ARM] S3C24A0: Serial port definitions and driver support.
Add serial support for S3C24A0, based on current S3C2410
UART driver. It adds necessary new defines in regs-serial.h
for S3C24A0 and the code to support this device in
drivers/serial/s3c24a0.c
Signed-off-by: Sandeep Patil <sandeep.patil@azingo.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
-rw-r--r-- | arch/arm/plat-s3c/include/plat/regs-serial.h | 8 | ||||
-rw-r--r-- | drivers/serial/Kconfig | 7 | ||||
-rw-r--r-- | drivers/serial/Makefile | 1 | ||||
-rw-r--r-- | drivers/serial/s3c24a0.c | 118 | ||||
-rw-r--r-- | drivers/serial/samsung.c | 2 |
5 files changed, 134 insertions, 2 deletions
diff --git a/arch/arm/plat-s3c/include/plat/regs-serial.h b/arch/arm/plat-s3c/include/plat/regs-serial.h index a0daa647b92c..18ba31c7174c 100644 --- a/arch/arm/plat-s3c/include/plat/regs-serial.h +++ b/arch/arm/plat-s3c/include/plat/regs-serial.h | |||
@@ -149,6 +149,14 @@ | |||
149 | #define S3C2410_UFSTAT_RXMASK (15<<0) | 149 | #define S3C2410_UFSTAT_RXMASK (15<<0) |
150 | #define S3C2410_UFSTAT_RXSHIFT (0) | 150 | #define S3C2410_UFSTAT_RXSHIFT (0) |
151 | 151 | ||
152 | /* UFSTAT S3C24A0 */ | ||
153 | #define S3C24A0_UFSTAT_TXFULL (1 << 14) | ||
154 | #define S3C24A0_UFSTAT_RXFULL (1 << 6) | ||
155 | #define S3C24A0_UFSTAT_TXMASK (63 << 8) | ||
156 | #define S3C24A0_UFSTAT_TXSHIFT (8) | ||
157 | #define S3C24A0_UFSTAT_RXMASK (63) | ||
158 | #define S3C24A0_UFSTAT_RXSHIFT (0) | ||
159 | |||
152 | /* UFSTAT S3C2443 same as S3C2440 */ | 160 | /* UFSTAT S3C2443 same as S3C2440 */ |
153 | #define S3C2440_UFSTAT_TXFULL (1<<14) | 161 | #define S3C2440_UFSTAT_TXFULL (1<<14) |
154 | #define S3C2440_UFSTAT_RXFULL (1<<6) | 162 | #define S3C2440_UFSTAT_RXFULL (1<<6) |
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 579d63a81aa2..f71a2e8a5f60 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig | |||
@@ -508,7 +508,12 @@ config SERIAL_S3C2440 | |||
508 | help | 508 | help |
509 | Serial port support for the Samsung S3C2440 and S3C2442 SoC | 509 | Serial port support for the Samsung S3C2440 and S3C2442 SoC |
510 | 510 | ||
511 | 511 | config SERIAL_S3C24A0 | |
512 | tristate "Samsung S3C24A0 Serial port support" | ||
513 | depends on SERIAL_SAMSUNG && CPU_S3C24A0 | ||
514 | default y if CPU_S3C24A0 | ||
515 | help | ||
516 | Serial port support for the Samsung S3C24A0 SoC | ||
512 | 517 | ||
513 | config SERIAL_DZ | 518 | config SERIAL_DZ |
514 | bool "DECstation DZ serial driver" | 519 | bool "DECstation DZ serial driver" |
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile index 0c17c8ddb19d..7769aece54ca 100644 --- a/drivers/serial/Makefile +++ b/drivers/serial/Makefile | |||
@@ -41,6 +41,7 @@ obj-$(CONFIG_SERIAL_S3C2400) += s3c2400.o | |||
41 | obj-$(CONFIG_SERIAL_S3C2410) += s3c2410.o | 41 | obj-$(CONFIG_SERIAL_S3C2410) += s3c2410.o |
42 | obj-$(CONFIG_SERIAL_S3C2412) += s3c2412.o | 42 | obj-$(CONFIG_SERIAL_S3C2412) += s3c2412.o |
43 | obj-$(CONFIG_SERIAL_S3C2440) += s3c2440.o | 43 | obj-$(CONFIG_SERIAL_S3C2440) += s3c2440.o |
44 | obj-$(CONFIG_SERIAL_S3C24A0) += s3c24a0.o | ||
44 | obj-$(CONFIG_SERIAL_IP22_ZILOG) += ip22zilog.o | 45 | obj-$(CONFIG_SERIAL_IP22_ZILOG) += ip22zilog.o |
45 | obj-$(CONFIG_SERIAL_MUX) += mux.o | 46 | obj-$(CONFIG_SERIAL_MUX) += mux.o |
46 | obj-$(CONFIG_SERIAL_68328) += 68328serial.o | 47 | obj-$(CONFIG_SERIAL_68328) += 68328serial.o |
diff --git a/drivers/serial/s3c24a0.c b/drivers/serial/s3c24a0.c new file mode 100644 index 000000000000..ebf2fd3c8f7d --- /dev/null +++ b/drivers/serial/s3c24a0.c | |||
@@ -0,0 +1,118 @@ | |||
1 | /* linux/drivers/serial/s3c24a0.c | ||
2 | * | ||
3 | * Driver for Samsung S3C24A0 SoC onboard UARTs. | ||
4 | * | ||
5 | * Based on drivers/serial/s3c2410.c | ||
6 | * | ||
7 | * Author: Sandeep Patil <sandeep.patil@azingo.com> | ||
8 | * | ||
9 | * Ben Dooks, Copyright (c) 2003-2005,2008 Simtec Electronics | ||
10 | * http://armlinux.simtec.co.uk/ | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License version 2 as | ||
14 | * published by the Free Software Foundation. | ||
15 | */ | ||
16 | |||
17 | #include <linux/module.h> | ||
18 | #include <linux/ioport.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/serial_core.h> | ||
22 | #include <linux/serial.h> | ||
23 | #include <linux/io.h> | ||
24 | #include <linux/irq.h> | ||
25 | |||
26 | #include <mach/hardware.h> | ||
27 | |||
28 | #include <plat/regs-serial.h> | ||
29 | #include <mach/regs-gpio.h> | ||
30 | |||
31 | #include "samsung.h" | ||
32 | |||
33 | static int s3c24a0_serial_setsource(struct uart_port *port, | ||
34 | struct s3c24xx_uart_clksrc *clk) | ||
35 | { | ||
36 | unsigned long ucon = rd_regl(port, S3C2410_UCON); | ||
37 | |||
38 | if (strcmp(clk->name, "uclk") == 0) | ||
39 | ucon |= S3C2410_UCON_UCLK; | ||
40 | else | ||
41 | ucon &= ~S3C2410_UCON_UCLK; | ||
42 | |||
43 | wr_regl(port, S3C2410_UCON, ucon); | ||
44 | return 0; | ||
45 | } | ||
46 | |||
47 | static int s3c24a0_serial_getsource(struct uart_port *port, | ||
48 | struct s3c24xx_uart_clksrc *clk) | ||
49 | { | ||
50 | unsigned long ucon = rd_regl(port, S3C2410_UCON); | ||
51 | |||
52 | clk->divisor = 1; | ||
53 | clk->name = (ucon & S3C2410_UCON_UCLK) ? "uclk" : "pclk"; | ||
54 | |||
55 | return 0; | ||
56 | } | ||
57 | |||
58 | static int s3c24a0_serial_resetport(struct uart_port *port, | ||
59 | struct s3c2410_uartcfg *cfg) | ||
60 | { | ||
61 | dbg("s3c24a0_serial_resetport: port=%p (%08lx), cfg=%p\n", | ||
62 | port, port->mapbase, cfg); | ||
63 | |||
64 | wr_regl(port, S3C2410_UCON, cfg->ucon); | ||
65 | wr_regl(port, S3C2410_ULCON, cfg->ulcon); | ||
66 | |||
67 | /* reset both fifos */ | ||
68 | |||
69 | wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH); | ||
70 | wr_regl(port, S3C2410_UFCON, cfg->ufcon); | ||
71 | |||
72 | return 0; | ||
73 | } | ||
74 | |||
75 | static struct s3c24xx_uart_info s3c24a0_uart_inf = { | ||
76 | .name = "Samsung S3C24A0 UART", | ||
77 | .type = PORT_S3C2410, | ||
78 | .fifosize = 16, | ||
79 | .rx_fifomask = S3C24A0_UFSTAT_RXMASK, | ||
80 | .rx_fifoshift = S3C24A0_UFSTAT_RXSHIFT, | ||
81 | .rx_fifofull = S3C24A0_UFSTAT_RXFULL, | ||
82 | .tx_fifofull = S3C24A0_UFSTAT_TXFULL, | ||
83 | .tx_fifomask = S3C24A0_UFSTAT_TXMASK, | ||
84 | .tx_fifoshift = S3C24A0_UFSTAT_TXSHIFT, | ||
85 | .get_clksrc = s3c24a0_serial_getsource, | ||
86 | .set_clksrc = s3c24a0_serial_setsource, | ||
87 | .reset_port = s3c24a0_serial_resetport, | ||
88 | }; | ||
89 | |||
90 | static int s3c24a0_serial_probe(struct platform_device *dev) | ||
91 | { | ||
92 | return s3c24xx_serial_probe(dev, &s3c24a0_uart_inf); | ||
93 | } | ||
94 | |||
95 | static struct platform_driver s3c24a0_serial_drv = { | ||
96 | .probe = s3c24a0_serial_probe, | ||
97 | .remove = s3c24xx_serial_remove, | ||
98 | .driver = { | ||
99 | .name = "s3c24a0-uart", | ||
100 | .owner = THIS_MODULE, | ||
101 | }, | ||
102 | }; | ||
103 | |||
104 | s3c24xx_console_init(&s3c24a0_serial_drv, &s3c24a0_uart_inf); | ||
105 | |||
106 | static int __init s3c24a0_serial_init(void) | ||
107 | { | ||
108 | return s3c24xx_serial_init(&s3c24a0_serial_drv, &s3c24a0_uart_inf); | ||
109 | } | ||
110 | |||
111 | static void __exit s3c24a0_serial_exit(void) | ||
112 | { | ||
113 | platform_driver_unregister(&s3c24a0_serial_drv); | ||
114 | } | ||
115 | |||
116 | module_init(s3c24a0_serial_init); | ||
117 | module_exit(s3c24a0_serial_exit); | ||
118 | |||
diff --git a/drivers/serial/samsung.c b/drivers/serial/samsung.c index ebeda832c8a3..bb8b57aae3af 100644 --- a/drivers/serial/samsung.c +++ b/drivers/serial/samsung.c | |||
@@ -61,7 +61,7 @@ | |||
61 | 61 | ||
62 | /* we can support 3 uarts, but not always use them */ | 62 | /* we can support 3 uarts, but not always use them */ |
63 | 63 | ||
64 | #ifdef CONFIG_CPU_S3C2400 | 64 | #if defined(CONFIG_CPU_S3C2400) || defined(CONFIG_CPU_S3C24A0) |
65 | #define NR_PORTS (2) | 65 | #define NR_PORTS (2) |
66 | #else | 66 | #else |
67 | #define NR_PORTS (3) | 67 | #define NR_PORTS (3) |