wdenk | 7ac1610 | 2004-08-01 22:48:16 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2002 |
Detlev Zundel | f1b3f2b | 2009-05-13 10:54:10 +0200 | [diff] [blame] | 3 | * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de> |
wdenk | 7ac1610 | 2004-08-01 22:48:16 +0000 | [diff] [blame] | 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 18 | * |
| 19 | */ |
| 20 | |
| 21 | #include <common.h> |
Mike Frysinger | f96c042 | 2011-04-29 18:03:29 +0000 | [diff] [blame] | 22 | #include <linux/compiler.h> |
kevin.morfitt@fearnside-systems.co.uk | e0d8131 | 2009-11-17 18:30:34 +0900 | [diff] [blame] | 23 | #include <asm/arch/s3c24x0_cpu.h> |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 24 | |
Wolfgang Denk | 6405a15 | 2006-03-31 18:32:53 +0200 | [diff] [blame] | 25 | DECLARE_GLOBAL_DATA_PTR; |
| 26 | |
wdenk | 7539dea | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 27 | #ifdef CONFIG_SERIAL1 |
| 28 | #define UART_NR S3C24X0_UART0 |
| 29 | |
wdenk | c35ba4e | 2004-03-14 22:25:36 +0000 | [diff] [blame] | 30 | #elif defined(CONFIG_SERIAL2) |
wdenk | 7539dea | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 31 | #define UART_NR S3C24X0_UART1 |
| 32 | |
wdenk | c35ba4e | 2004-03-14 22:25:36 +0000 | [diff] [blame] | 33 | #elif defined(CONFIG_SERIAL3) |
wdenk | 7539dea | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 34 | #define UART_NR S3C24X0_UART2 |
| 35 | |
| 36 | #else |
| 37 | #error "Bad: you didn't configure serial ..." |
| 38 | #endif |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 39 | |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 40 | #include <asm/io.h> |
| 41 | |
Harald Welte | da41262 | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 42 | #if defined(CONFIG_SERIAL_MULTI) |
| 43 | #include <serial.h> |
| 44 | |
| 45 | /* Multi serial device functions */ |
| 46 | #define DECLARE_S3C_SERIAL_FUNCTIONS(port) \ |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 47 | int s3serial##port##_init(void) \ |
| 48 | { \ |
| 49 | return serial_init_dev(port); \ |
| 50 | } \ |
| 51 | void s3serial##port##_setbrg(void) \ |
| 52 | { \ |
| 53 | serial_setbrg_dev(port); \ |
| 54 | } \ |
| 55 | int s3serial##port##_getc(void) \ |
| 56 | { \ |
| 57 | return serial_getc_dev(port); \ |
| 58 | } \ |
| 59 | int s3serial##port##_tstc(void) \ |
| 60 | { \ |
| 61 | return serial_tstc_dev(port); \ |
| 62 | } \ |
| 63 | void s3serial##port##_putc(const char c) \ |
| 64 | { \ |
| 65 | serial_putc_dev(port, c); \ |
| 66 | } \ |
| 67 | void s3serial##port##_puts(const char *s) \ |
| 68 | { \ |
| 69 | serial_puts_dev(port, s); \ |
| 70 | } |
Harald Welte | da41262 | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 71 | |
Marek Vasut | 5bcdf24 | 2012-09-09 18:48:28 +0200 | [diff] [blame^] | 72 | #define INIT_S3C_SERIAL_STRUCTURE(port, __name) { \ |
| 73 | .name = __name, \ |
| 74 | .start = s3serial##port##_init, \ |
| 75 | .stop = NULL, \ |
| 76 | .setbrg = s3serial##port##_setbrg, \ |
| 77 | .getc = s3serial##port##_getc, \ |
| 78 | .tstc = s3serial##port##_tstc, \ |
| 79 | .putc = s3serial##port##_putc, \ |
| 80 | .puts = s3serial##port##_puts, \ |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 81 | } |
Harald Welte | da41262 | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 82 | |
| 83 | #endif /* CONFIG_SERIAL_MULTI */ |
| 84 | |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 85 | #ifdef CONFIG_HWFLOW |
| 86 | static int hwflow; |
| 87 | #endif |
| 88 | |
Harald Welte | da41262 | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 89 | void _serial_setbrg(const int dev_index) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 90 | { |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 91 | struct s3c24x0_uart *uart = s3c24x0_get_base_uart(dev_index); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 92 | unsigned int reg = 0; |
Harald Welte | da41262 | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 93 | int i; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 94 | |
| 95 | /* value is calculated so : (int)(PCLK/16./baudrate) -1 */ |
| 96 | reg = get_PCLK() / (16 * gd->baudrate) - 1; |
| 97 | |
C Nauman | 383c43e | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 98 | writel(reg, &uart->ubrdiv); |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 99 | for (i = 0; i < 100; i++) |
| 100 | /* Delay */ ; |
Harald Welte | da41262 | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 101 | } |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 102 | |
Harald Welte | da41262 | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 103 | #if defined(CONFIG_SERIAL_MULTI) |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 104 | static inline void serial_setbrg_dev(unsigned int dev_index) |
Harald Welte | da41262 | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 105 | { |
| 106 | _serial_setbrg(dev_index); |
| 107 | } |
| 108 | #else |
| 109 | void serial_setbrg(void) |
| 110 | { |
| 111 | _serial_setbrg(UART_NR); |
| 112 | } |
| 113 | #endif |
| 114 | |
| 115 | |
| 116 | /* Initialise the serial port. The settings are always 8 data bits, no parity, |
| 117 | * 1 stop bit, no start bits. |
| 118 | */ |
| 119 | static int serial_init_dev(const int dev_index) |
| 120 | { |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 121 | struct s3c24x0_uart *uart = s3c24x0_get_base_uart(dev_index); |
| 122 | |
| 123 | #ifdef CONFIG_HWFLOW |
| 124 | hwflow = 0; /* turned off by default */ |
| 125 | #endif |
Harald Welte | da41262 | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 126 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 127 | /* FIFO enable, Tx/Rx FIFO clear */ |
C Nauman | 383c43e | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 128 | writel(0x07, &uart->ufcon); |
| 129 | writel(0x0, &uart->umcon); |
Harald Welte | da41262 | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 130 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 131 | /* Normal,No parity,1 stop,8 bit */ |
C Nauman | 383c43e | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 132 | writel(0x3, &uart->ulcon); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 133 | /* |
| 134 | * tx=level,rx=edge,disable timeout int.,enable rx error int., |
| 135 | * normal,interrupt or polling |
| 136 | */ |
C Nauman | 383c43e | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 137 | writel(0x245, &uart->ucon); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 138 | |
| 139 | #ifdef CONFIG_HWFLOW |
C Nauman | 383c43e | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 140 | writel(0x1, &uart->umcon); /* rts up */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 141 | #endif |
Harald Welte | da41262 | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 142 | |
| 143 | /* FIXME: This is sooooooooooooooooooo ugly */ |
| 144 | #if defined(CONFIG_ARCH_GTA02_v1) || defined(CONFIG_ARCH_GTA02_v2) |
| 145 | /* we need auto hw flow control on the gsm and gps port */ |
| 146 | if (dev_index == 0 || dev_index == 1) |
C Nauman | 383c43e | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 147 | writel(0x10, &uart->umcon); |
Harald Welte | da41262 | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 148 | #endif |
| 149 | _serial_setbrg(dev_index); |
| 150 | |
| 151 | return (0); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 152 | } |
| 153 | |
Harald Welte | da41262 | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 154 | #if !defined(CONFIG_SERIAL_MULTI) |
| 155 | /* Initialise the serial port. The settings are always 8 data bits, no parity, |
| 156 | * 1 stop bit, no start bits. |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 157 | */ |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 158 | int serial_init(void) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 159 | { |
Harald Welte | da41262 | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 160 | return serial_init_dev(UART_NR); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 161 | } |
Harald Welte | da41262 | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 162 | #endif |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 163 | |
| 164 | /* |
| 165 | * Read a single byte from the serial port. Returns 1 on success, 0 |
| 166 | * otherwise. When the function is succesfull, the character read is |
| 167 | * written into its argument c. |
| 168 | */ |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 169 | int _serial_getc(const int dev_index) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 170 | { |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 171 | struct s3c24x0_uart *uart = s3c24x0_get_base_uart(dev_index); |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 172 | |
C Nauman | 383c43e | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 173 | while (!(readl(&uart->utrstat) & 0x1)) |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 174 | /* wait for character to arrive */ ; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 175 | |
C Nauman | 383c43e | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 176 | return readb(&uart->urxh) & 0xff; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 177 | } |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 178 | |
Harald Welte | da41262 | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 179 | #if defined(CONFIG_SERIAL_MULTI) |
| 180 | static inline int serial_getc_dev(unsigned int dev_index) |
| 181 | { |
| 182 | return _serial_getc(dev_index); |
| 183 | } |
| 184 | #else |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 185 | int serial_getc(void) |
Harald Welte | da41262 | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 186 | { |
| 187 | return _serial_getc(UART_NR); |
| 188 | } |
| 189 | #endif |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 190 | |
| 191 | #ifdef CONFIG_HWFLOW |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 192 | int hwflow_onoff(int on) |
| 193 | { |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 194 | switch (on) { |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 195 | case 0: |
| 196 | default: |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 197 | break; /* return current */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 198 | case 1: |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 199 | hwflow = 1; /* turn on */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 200 | break; |
| 201 | case -1: |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 202 | hwflow = 0; /* turn off */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 203 | break; |
| 204 | } |
| 205 | return hwflow; |
| 206 | } |
| 207 | #endif |
| 208 | |
| 209 | #ifdef CONFIG_MODEM_SUPPORT |
| 210 | static int be_quiet = 0; |
| 211 | void disable_putc(void) |
| 212 | { |
| 213 | be_quiet = 1; |
| 214 | } |
| 215 | |
| 216 | void enable_putc(void) |
| 217 | { |
| 218 | be_quiet = 0; |
| 219 | } |
| 220 | #endif |
| 221 | |
| 222 | |
| 223 | /* |
| 224 | * Output a single byte to the serial port. |
| 225 | */ |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 226 | void _serial_putc(const char c, const int dev_index) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 227 | { |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 228 | struct s3c24x0_uart *uart = s3c24x0_get_base_uart(dev_index); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 229 | #ifdef CONFIG_MODEM_SUPPORT |
| 230 | if (be_quiet) |
| 231 | return; |
| 232 | #endif |
| 233 | |
C Nauman | 383c43e | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 234 | while (!(readl(&uart->utrstat) & 0x2)) |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 235 | /* wait for room in the tx FIFO */ ; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 236 | |
| 237 | #ifdef CONFIG_HWFLOW |
C Nauman | 383c43e | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 238 | while (hwflow && !(readl(&uart->umstat) & 0x1)) |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 239 | /* Wait for CTS up */ ; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 240 | #endif |
| 241 | |
C Nauman | 383c43e | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 242 | writeb(c, &uart->utxh); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 243 | |
| 244 | /* If \n, also do \r */ |
| 245 | if (c == '\n') |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 246 | serial_putc('\r'); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 247 | } |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 248 | |
Harald Welte | da41262 | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 249 | #if defined(CONFIG_SERIAL_MULTI) |
| 250 | static inline void serial_putc_dev(unsigned int dev_index, const char c) |
| 251 | { |
| 252 | _serial_putc(c, dev_index); |
| 253 | } |
| 254 | #else |
| 255 | void serial_putc(const char c) |
| 256 | { |
| 257 | _serial_putc(c, UART_NR); |
| 258 | } |
| 259 | #endif |
| 260 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 261 | |
| 262 | /* |
| 263 | * Test whether a character is in the RX buffer |
| 264 | */ |
Harald Welte | da41262 | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 265 | int _serial_tstc(const int dev_index) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 266 | { |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 267 | struct s3c24x0_uart *uart = s3c24x0_get_base_uart(dev_index); |
wdenk | 7539dea | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 268 | |
C Nauman | 383c43e | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 269 | return readl(&uart->utrstat) & 0x1; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 270 | } |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 271 | |
Harald Welte | da41262 | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 272 | #if defined(CONFIG_SERIAL_MULTI) |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 273 | static inline int serial_tstc_dev(unsigned int dev_index) |
Harald Welte | da41262 | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 274 | { |
| 275 | return _serial_tstc(dev_index); |
| 276 | } |
| 277 | #else |
| 278 | int serial_tstc(void) |
| 279 | { |
| 280 | return _serial_tstc(UART_NR); |
| 281 | } |
| 282 | #endif |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 283 | |
Harald Welte | da41262 | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 284 | void _serial_puts(const char *s, const int dev_index) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 285 | { |
| 286 | while (*s) { |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 287 | _serial_putc(*s++, dev_index); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 288 | } |
| 289 | } |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 290 | |
Harald Welte | da41262 | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 291 | #if defined(CONFIG_SERIAL_MULTI) |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 292 | static inline void serial_puts_dev(int dev_index, const char *s) |
Harald Welte | da41262 | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 293 | { |
| 294 | _serial_puts(s, dev_index); |
| 295 | } |
| 296 | #else |
kevin.morfitt@fearnside-systems.co.uk | 1464f4d | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 297 | void serial_puts(const char *s) |
Harald Welte | da41262 | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 298 | { |
| 299 | _serial_puts(s, UART_NR); |
| 300 | } |
| 301 | #endif |
| 302 | |
| 303 | #if defined(CONFIG_SERIAL_MULTI) |
| 304 | DECLARE_S3C_SERIAL_FUNCTIONS(0); |
| 305 | struct serial_device s3c24xx_serial0_device = |
Mike Frysinger | 1ef72f6 | 2011-04-29 18:03:31 +0000 | [diff] [blame] | 306 | INIT_S3C_SERIAL_STRUCTURE(0, "s3ser0"); |
Harald Welte | da41262 | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 307 | DECLARE_S3C_SERIAL_FUNCTIONS(1); |
| 308 | struct serial_device s3c24xx_serial1_device = |
Mike Frysinger | 1ef72f6 | 2011-04-29 18:03:31 +0000 | [diff] [blame] | 309 | INIT_S3C_SERIAL_STRUCTURE(1, "s3ser1"); |
Harald Welte | da41262 | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 310 | DECLARE_S3C_SERIAL_FUNCTIONS(2); |
| 311 | struct serial_device s3c24xx_serial2_device = |
Mike Frysinger | 1ef72f6 | 2011-04-29 18:03:31 +0000 | [diff] [blame] | 312 | INIT_S3C_SERIAL_STRUCTURE(2, "s3ser2"); |
Mike Frysinger | f96c042 | 2011-04-29 18:03:29 +0000 | [diff] [blame] | 313 | |
| 314 | __weak struct serial_device *default_serial_console(void) |
| 315 | { |
| 316 | #if defined(CONFIG_SERIAL1) |
| 317 | return &s3c24xx_serial0_device; |
| 318 | #elif defined(CONFIG_SERIAL2) |
| 319 | return &s3c24xx_serial1_device; |
| 320 | #elif defined(CONFIG_SERIAL3) |
| 321 | return &s3c24xx_serial2_device; |
| 322 | #else |
| 323 | #error "CONFIG_SERIAL? missing." |
| 324 | #endif |
| 325 | } |
Harald Welte | da41262 | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 326 | #endif /* CONFIG_SERIAL_MULTI */ |