wdenk | 281e00a | 2004-08-01 22:48:16 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2002 |
Detlev Zundel | 792a09e | 2009-05-13 10:54:10 +0200 | [diff] [blame] | 3 | * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de> |
wdenk | 281e00a | 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 | 6c768ca | 2011-04-29 18:03:29 +0000 | [diff] [blame^] | 22 | #include <linux/compiler.h> |
kevin.morfitt@fearnside-systems.co.uk | ac67804 | 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 | d87080b | 2006-03-31 18:32:53 +0200 | [diff] [blame] | 25 | DECLARE_GLOBAL_DATA_PTR; |
| 26 | |
wdenk | 48b4261 | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 27 | #ifdef CONFIG_SERIAL1 |
| 28 | #define UART_NR S3C24X0_UART0 |
| 29 | |
wdenk | 42dfe7a | 2004-03-14 22:25:36 +0000 | [diff] [blame] | 30 | #elif defined(CONFIG_SERIAL2) |
wdenk | 48b4261 | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 31 | #define UART_NR S3C24X0_UART1 |
| 32 | |
wdenk | 42dfe7a | 2004-03-14 22:25:36 +0000 | [diff] [blame] | 33 | #elif defined(CONFIG_SERIAL3) |
wdenk | 48b4261 | 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 | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 40 | #include <asm/io.h> |
| 41 | |
Harald Welte | a7c185e | 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 | eb0ae7f | 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 | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 71 | |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 72 | #define INIT_S3C_SERIAL_STRUCTURE(port, name, bus) { \ |
| 73 | name, \ |
| 74 | bus, \ |
| 75 | s3serial##port##_init, \ |
Anatolij Gustschin | fbb0030 | 2010-04-24 19:27:04 +0200 | [diff] [blame] | 76 | NULL,\ |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 77 | s3serial##port##_setbrg, \ |
| 78 | s3serial##port##_getc, \ |
| 79 | s3serial##port##_tstc, \ |
| 80 | s3serial##port##_putc, \ |
| 81 | s3serial##port##_puts, \ |
| 82 | } |
Harald Welte | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 83 | |
| 84 | #endif /* CONFIG_SERIAL_MULTI */ |
| 85 | |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 86 | #ifdef CONFIG_HWFLOW |
| 87 | static int hwflow; |
| 88 | #endif |
| 89 | |
Harald Welte | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 90 | void _serial_setbrg(const int dev_index) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 91 | { |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 92 | struct s3c24x0_uart *uart = s3c24x0_get_base_uart(dev_index); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 93 | unsigned int reg = 0; |
Harald Welte | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 94 | int i; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 95 | |
| 96 | /* value is calculated so : (int)(PCLK/16./baudrate) -1 */ |
| 97 | reg = get_PCLK() / (16 * gd->baudrate) - 1; |
| 98 | |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 99 | writel(reg, &uart->ubrdiv); |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 100 | for (i = 0; i < 100; i++) |
| 101 | /* Delay */ ; |
Harald Welte | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 102 | } |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 103 | |
Harald Welte | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 104 | #if defined(CONFIG_SERIAL_MULTI) |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 105 | static inline void serial_setbrg_dev(unsigned int dev_index) |
Harald Welte | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 106 | { |
| 107 | _serial_setbrg(dev_index); |
| 108 | } |
| 109 | #else |
| 110 | void serial_setbrg(void) |
| 111 | { |
| 112 | _serial_setbrg(UART_NR); |
| 113 | } |
| 114 | #endif |
| 115 | |
| 116 | |
| 117 | /* Initialise the serial port. The settings are always 8 data bits, no parity, |
| 118 | * 1 stop bit, no start bits. |
| 119 | */ |
| 120 | static int serial_init_dev(const int dev_index) |
| 121 | { |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 122 | struct s3c24x0_uart *uart = s3c24x0_get_base_uart(dev_index); |
| 123 | |
| 124 | #ifdef CONFIG_HWFLOW |
| 125 | hwflow = 0; /* turned off by default */ |
| 126 | #endif |
Harald Welte | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 127 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 128 | /* FIFO enable, Tx/Rx FIFO clear */ |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 129 | writel(0x07, &uart->ufcon); |
| 130 | writel(0x0, &uart->umcon); |
Harald Welte | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 131 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 132 | /* Normal,No parity,1 stop,8 bit */ |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 133 | writel(0x3, &uart->ulcon); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 134 | /* |
| 135 | * tx=level,rx=edge,disable timeout int.,enable rx error int., |
| 136 | * normal,interrupt or polling |
| 137 | */ |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 138 | writel(0x245, &uart->ucon); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 139 | |
| 140 | #ifdef CONFIG_HWFLOW |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 141 | writel(0x1, &uart->umcon); /* rts up */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 142 | #endif |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 143 | |
Harald Welte | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 144 | /* FIXME: This is sooooooooooooooooooo ugly */ |
| 145 | #if defined(CONFIG_ARCH_GTA02_v1) || defined(CONFIG_ARCH_GTA02_v2) |
| 146 | /* we need auto hw flow control on the gsm and gps port */ |
| 147 | if (dev_index == 0 || dev_index == 1) |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 148 | writel(0x10, &uart->umcon); |
Harald Welte | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 149 | #endif |
| 150 | _serial_setbrg(dev_index); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 151 | |
| 152 | return (0); |
| 153 | } |
| 154 | |
Harald Welte | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 155 | #if !defined(CONFIG_SERIAL_MULTI) |
| 156 | /* Initialise the serial port. The settings are always 8 data bits, no parity, |
| 157 | * 1 stop bit, no start bits. |
| 158 | */ |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 159 | int serial_init(void) |
Harald Welte | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 160 | { |
| 161 | return serial_init_dev(UART_NR); |
| 162 | } |
| 163 | #endif |
| 164 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 165 | /* |
| 166 | * Read a single byte from the serial port. Returns 1 on success, 0 |
| 167 | * otherwise. When the function is succesfull, the character read is |
| 168 | * written into its argument c. |
| 169 | */ |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 170 | int _serial_getc(const int dev_index) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 171 | { |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 172 | struct s3c24x0_uart *uart = s3c24x0_get_base_uart(dev_index); |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 173 | |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 174 | while (!(readl(&uart->utrstat) & 0x1)) |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 175 | /* wait for character to arrive */ ; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 176 | |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 177 | return readb(&uart->urxh) & 0xff; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 178 | } |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 179 | |
Harald Welte | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 180 | #if defined(CONFIG_SERIAL_MULTI) |
| 181 | static inline int serial_getc_dev(unsigned int dev_index) |
| 182 | { |
| 183 | return _serial_getc(dev_index); |
| 184 | } |
| 185 | #else |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 186 | int serial_getc(void) |
Harald Welte | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 187 | { |
| 188 | return _serial_getc(UART_NR); |
| 189 | } |
| 190 | #endif |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 191 | |
| 192 | #ifdef CONFIG_HWFLOW |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 193 | int hwflow_onoff(int on) |
| 194 | { |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 195 | switch (on) { |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 196 | case 0: |
| 197 | default: |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 198 | break; /* return current */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 199 | case 1: |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 200 | hwflow = 1; /* turn on */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 201 | break; |
| 202 | case -1: |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 203 | hwflow = 0; /* turn off */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 204 | break; |
| 205 | } |
| 206 | return hwflow; |
| 207 | } |
| 208 | #endif |
| 209 | |
| 210 | #ifdef CONFIG_MODEM_SUPPORT |
| 211 | static int be_quiet = 0; |
| 212 | void disable_putc(void) |
| 213 | { |
| 214 | be_quiet = 1; |
| 215 | } |
| 216 | |
| 217 | void enable_putc(void) |
| 218 | { |
| 219 | be_quiet = 0; |
| 220 | } |
| 221 | #endif |
| 222 | |
| 223 | |
| 224 | /* |
| 225 | * Output a single byte to the serial port. |
| 226 | */ |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 227 | void _serial_putc(const char c, const int dev_index) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 228 | { |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 229 | struct s3c24x0_uart *uart = s3c24x0_get_base_uart(dev_index); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 230 | #ifdef CONFIG_MODEM_SUPPORT |
| 231 | if (be_quiet) |
| 232 | return; |
| 233 | #endif |
| 234 | |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 235 | while (!(readl(&uart->utrstat) & 0x2)) |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 236 | /* wait for room in the tx FIFO */ ; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 237 | |
| 238 | #ifdef CONFIG_HWFLOW |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 239 | while (hwflow && !(readl(&uart->umstat) & 0x1)) |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 240 | /* Wait for CTS up */ ; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 241 | #endif |
| 242 | |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 243 | writeb(c, &uart->utxh); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 244 | |
| 245 | /* If \n, also do \r */ |
| 246 | if (c == '\n') |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 247 | serial_putc('\r'); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 248 | } |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 249 | |
Harald Welte | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 250 | #if defined(CONFIG_SERIAL_MULTI) |
| 251 | static inline void serial_putc_dev(unsigned int dev_index, const char c) |
| 252 | { |
| 253 | _serial_putc(c, dev_index); |
| 254 | } |
| 255 | #else |
| 256 | void serial_putc(const char c) |
| 257 | { |
| 258 | _serial_putc(c, UART_NR); |
| 259 | } |
| 260 | #endif |
| 261 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 262 | |
| 263 | /* |
| 264 | * Test whether a character is in the RX buffer |
| 265 | */ |
Harald Welte | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 266 | int _serial_tstc(const int dev_index) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 267 | { |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 268 | struct s3c24x0_uart *uart = s3c24x0_get_base_uart(dev_index); |
wdenk | 48b4261 | 2003-06-19 23:01:32 +0000 | [diff] [blame] | 269 | |
C Nauman | d9abba8 | 2010-10-26 23:04:31 +0900 | [diff] [blame] | 270 | return readl(&uart->utrstat) & 0x1; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 271 | } |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 272 | |
Harald Welte | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 273 | #if defined(CONFIG_SERIAL_MULTI) |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 274 | static inline int serial_tstc_dev(unsigned int dev_index) |
Harald Welte | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 275 | { |
| 276 | return _serial_tstc(dev_index); |
| 277 | } |
| 278 | #else |
| 279 | int serial_tstc(void) |
| 280 | { |
| 281 | return _serial_tstc(UART_NR); |
| 282 | } |
| 283 | #endif |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 284 | |
Harald Welte | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 285 | void _serial_puts(const char *s, const int dev_index) |
| 286 | { |
| 287 | while (*s) { |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 288 | _serial_putc(*s++, dev_index); |
Harald Welte | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 289 | } |
| 290 | } |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 291 | |
Harald Welte | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 292 | #if defined(CONFIG_SERIAL_MULTI) |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 293 | static inline void serial_puts_dev(int dev_index, const char *s) |
Harald Welte | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 294 | { |
| 295 | _serial_puts(s, dev_index); |
| 296 | } |
| 297 | #else |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 298 | void serial_puts(const char *s) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 299 | { |
Harald Welte | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 300 | _serial_puts(s, UART_NR); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 301 | } |
Harald Welte | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 302 | #endif |
| 303 | |
| 304 | #if defined(CONFIG_SERIAL_MULTI) |
| 305 | DECLARE_S3C_SERIAL_FUNCTIONS(0); |
| 306 | struct serial_device s3c24xx_serial0_device = |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 307 | INIT_S3C_SERIAL_STRUCTURE(0, "s3ser0", "S3UART1"); |
Harald Welte | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 308 | DECLARE_S3C_SERIAL_FUNCTIONS(1); |
| 309 | struct serial_device s3c24xx_serial1_device = |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 310 | INIT_S3C_SERIAL_STRUCTURE(1, "s3ser1", "S3UART2"); |
Harald Welte | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 311 | DECLARE_S3C_SERIAL_FUNCTIONS(2); |
| 312 | struct serial_device s3c24xx_serial2_device = |
kevin.morfitt@fearnside-systems.co.uk | eb0ae7f | 2009-10-10 13:33:11 +0900 | [diff] [blame] | 313 | INIT_S3C_SERIAL_STRUCTURE(2, "s3ser2", "S3UART3"); |
Mike Frysinger | 6c768ca | 2011-04-29 18:03:29 +0000 | [diff] [blame^] | 314 | |
| 315 | __weak struct serial_device *default_serial_console(void) |
| 316 | { |
| 317 | #if defined(CONFIG_SERIAL1) |
| 318 | return &s3c24xx_serial0_device; |
| 319 | #elif defined(CONFIG_SERIAL2) |
| 320 | return &s3c24xx_serial1_device; |
| 321 | #elif defined(CONFIG_SERIAL3) |
| 322 | return &s3c24xx_serial2_device; |
| 323 | #else |
| 324 | #error "CONFIG_SERIAL? missing." |
| 325 | #endif |
| 326 | } |
Harald Welte | a7c185e | 2007-12-19 14:24:40 +0100 | [diff] [blame] | 327 | #endif /* CONFIG_SERIAL_MULTI */ |