diff options
Diffstat (limited to 'drivers/serial')
-rw-r--r-- | drivers/serial/8250_pci.c | 2 | ||||
-rw-r--r-- | drivers/serial/Kconfig | 4 | ||||
-rw-r--r-- | drivers/serial/bfin_5xx.c | 6 | ||||
-rw-r--r-- | drivers/serial/crisv10.c | 173 | ||||
-rw-r--r-- | drivers/serial/jsm/jsm.h | 2 | ||||
-rw-r--r-- | drivers/serial/jsm/jsm_driver.c | 1 | ||||
-rw-r--r-- | drivers/serial/max3100.c | 927 | ||||
-rw-r--r-- | drivers/serial/s3c6400.c | 1 | ||||
-rw-r--r-- | drivers/serial/samsung.c | 65 | ||||
-rw-r--r-- | drivers/serial/samsung.h | 4 | ||||
-rw-r--r-- | drivers/serial/sunsu.c | 2 |
11 files changed, 1076 insertions, 111 deletions
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c index 7ddff3f55087..938bc1b6c3fa 100644 --- a/drivers/serial/8250_pci.c +++ b/drivers/serial/8250_pci.c | |||
@@ -771,8 +771,6 @@ static int pci_netmos_init(struct pci_dev *dev) | |||
771 | } | 771 | } |
772 | 772 | ||
773 | /* | 773 | /* |
774 | * ITE support by Niels de Vos <niels.devos@wincor-nixdorf.com> | ||
775 | * | ||
776 | * These chips are available with optionally one parallel port and up to | 774 | * These chips are available with optionally one parallel port and up to |
777 | * two serial ports. Unfortunately they all have the same product id. | 775 | * two serial ports. Unfortunately they all have the same product id. |
778 | * | 776 | * |
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 0328fd4006e5..343e3a35b6a3 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig | |||
@@ -854,7 +854,7 @@ config SERIAL_IMX_CONSOLE | |||
854 | 854 | ||
855 | config SERIAL_UARTLITE | 855 | config SERIAL_UARTLITE |
856 | tristate "Xilinx uartlite serial port support" | 856 | tristate "Xilinx uartlite serial port support" |
857 | depends on PPC32 | 857 | depends on PPC32 || MICROBLAZE |
858 | select SERIAL_CORE | 858 | select SERIAL_CORE |
859 | help | 859 | help |
860 | Say Y here if you want to use the Xilinx uartlite serial controller. | 860 | Say Y here if you want to use the Xilinx uartlite serial controller. |
@@ -1340,7 +1340,7 @@ config SERIAL_NETX_CONSOLE | |||
1340 | 1340 | ||
1341 | config SERIAL_OF_PLATFORM | 1341 | config SERIAL_OF_PLATFORM |
1342 | tristate "Serial port on Open Firmware platform bus" | 1342 | tristate "Serial port on Open Firmware platform bus" |
1343 | depends on PPC_OF | 1343 | depends on PPC_OF || MICROBLAZE |
1344 | depends on SERIAL_8250 || SERIAL_OF_PLATFORM_NWPSERIAL | 1344 | depends on SERIAL_8250 || SERIAL_OF_PLATFORM_NWPSERIAL |
1345 | help | 1345 | help |
1346 | If you have a PowerPC based system that has serial ports | 1346 | If you have a PowerPC based system that has serial ports |
diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c index 18ba812a4f84..d86123e03391 100644 --- a/drivers/serial/bfin_5xx.c +++ b/drivers/serial/bfin_5xx.c | |||
@@ -166,7 +166,7 @@ static void bfin_serial_start_tx(struct uart_port *port) | |||
166 | struct tty_struct *tty = uart->port.info->port.tty; | 166 | struct tty_struct *tty = uart->port.info->port.tty; |
167 | 167 | ||
168 | #ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS | 168 | #ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS |
169 | if (uart->scts && (!bfin_serial_get_mctrl(&uart->port)&TIOCM_CTS)) { | 169 | if (uart->scts && !(bfin_serial_get_mctrl(&uart->port) & TIOCM_CTS)) { |
170 | uart->scts = 0; | 170 | uart->scts = 0; |
171 | uart_handle_cts_change(&uart->port, uart->scts); | 171 | uart_handle_cts_change(&uart->port, uart->scts); |
172 | } | 172 | } |
@@ -368,7 +368,7 @@ static irqreturn_t bfin_serial_tx_int(int irq, void *dev_id) | |||
368 | struct bfin_serial_port *uart = dev_id; | 368 | struct bfin_serial_port *uart = dev_id; |
369 | 369 | ||
370 | #ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS | 370 | #ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS |
371 | if (uart->scts && (!bfin_serial_get_mctrl(&uart->port)&TIOCM_CTS)) { | 371 | if (uart->scts && !(bfin_serial_get_mctrl(&uart->port) & TIOCM_CTS)) { |
372 | uart->scts = 0; | 372 | uart->scts = 0; |
373 | uart_handle_cts_change(&uart->port, uart->scts); | 373 | uart_handle_cts_change(&uart->port, uart->scts); |
374 | } | 374 | } |
@@ -504,7 +504,7 @@ static irqreturn_t bfin_serial_dma_tx_int(int irq, void *dev_id) | |||
504 | struct circ_buf *xmit = &uart->port.info->xmit; | 504 | struct circ_buf *xmit = &uart->port.info->xmit; |
505 | 505 | ||
506 | #ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS | 506 | #ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS |
507 | if (uart->scts && (!bfin_serial_get_mctrl(&uart->port)&TIOCM_CTS)) { | 507 | if (uart->scts && !(bfin_serial_get_mctrl(&uart->port)&TIOCM_CTS)) { |
508 | uart->scts = 0; | 508 | uart->scts = 0; |
509 | uart_handle_cts_change(&uart->port, uart->scts); | 509 | uart_handle_cts_change(&uart->port, uart->scts); |
510 | } | 510 | } |
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c index 7ba7d70f04d6..7be52fe288eb 100644 --- a/drivers/serial/crisv10.c +++ b/drivers/serial/crisv10.c | |||
@@ -23,16 +23,18 @@ static char *serial_version = "$Revision: 1.25 $"; | |||
23 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <asm/uaccess.h> | ||
27 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
28 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
29 | #include <linux/bitops.h> | 28 | #include <linux/bitops.h> |
29 | #include <linux/seq_file.h> | ||
30 | #include <linux/delay.h> | ||
31 | #include <linux/module.h> | ||
32 | #include <linux/uaccess.h> | ||
33 | #include <linux/io.h> | ||
30 | 34 | ||
31 | #include <asm/io.h> | ||
32 | #include <asm/irq.h> | 35 | #include <asm/irq.h> |
33 | #include <asm/dma.h> | 36 | #include <asm/dma.h> |
34 | #include <asm/system.h> | 37 | #include <asm/system.h> |
35 | #include <linux/delay.h> | ||
36 | 38 | ||
37 | #include <arch/svinto.h> | 39 | #include <arch/svinto.h> |
38 | 40 | ||
@@ -456,7 +458,6 @@ static struct e100_serial rs_table[] = { | |||
456 | 458 | ||
457 | #define NR_PORTS (sizeof(rs_table)/sizeof(struct e100_serial)) | 459 | #define NR_PORTS (sizeof(rs_table)/sizeof(struct e100_serial)) |
458 | 460 | ||
459 | static struct ktermios *serial_termios[NR_PORTS]; | ||
460 | #ifdef CONFIG_ETRAX_SERIAL_FAST_TIMER | 461 | #ifdef CONFIG_ETRAX_SERIAL_FAST_TIMER |
461 | static struct fast_timer fast_timers[NR_PORTS]; | 462 | static struct fast_timer fast_timers[NR_PORTS]; |
462 | #endif | 463 | #endif |
@@ -4257,151 +4258,132 @@ rs_open(struct tty_struct *tty, struct file * filp) | |||
4257 | return 0; | 4258 | return 0; |
4258 | } | 4259 | } |
4259 | 4260 | ||
4261 | #ifdef CONFIG_PROC_FS | ||
4260 | /* | 4262 | /* |
4261 | * /proc fs routines.... | 4263 | * /proc fs routines.... |
4262 | */ | 4264 | */ |
4263 | 4265 | ||
4264 | static int line_info(char *buf, struct e100_serial *info) | 4266 | static void seq_line_info(struct seq_file *m, struct e100_serial *info) |
4265 | { | 4267 | { |
4266 | char stat_buf[30]; | ||
4267 | int ret; | ||
4268 | unsigned long tmp; | 4268 | unsigned long tmp; |
4269 | 4269 | ||
4270 | ret = sprintf(buf, "%d: uart:E100 port:%lX irq:%d", | 4270 | seq_printf(m, "%d: uart:E100 port:%lX irq:%d", |
4271 | info->line, (unsigned long)info->ioport, info->irq); | 4271 | info->line, (unsigned long)info->ioport, info->irq); |
4272 | 4272 | ||
4273 | if (!info->ioport || (info->type == PORT_UNKNOWN)) { | 4273 | if (!info->ioport || (info->type == PORT_UNKNOWN)) { |
4274 | ret += sprintf(buf+ret, "\n"); | 4274 | seq_printf(m, "\n"); |
4275 | return ret; | 4275 | return; |
4276 | } | 4276 | } |
4277 | 4277 | ||
4278 | stat_buf[0] = 0; | 4278 | seq_printf(m, " baud:%d", info->baud); |
4279 | stat_buf[1] = 0; | 4279 | seq_printf(m, " tx:%lu rx:%lu", |
4280 | if (!E100_RTS_GET(info)) | ||
4281 | strcat(stat_buf, "|RTS"); | ||
4282 | if (!E100_CTS_GET(info)) | ||
4283 | strcat(stat_buf, "|CTS"); | ||
4284 | if (!E100_DTR_GET(info)) | ||
4285 | strcat(stat_buf, "|DTR"); | ||
4286 | if (!E100_DSR_GET(info)) | ||
4287 | strcat(stat_buf, "|DSR"); | ||
4288 | if (!E100_CD_GET(info)) | ||
4289 | strcat(stat_buf, "|CD"); | ||
4290 | if (!E100_RI_GET(info)) | ||
4291 | strcat(stat_buf, "|RI"); | ||
4292 | |||
4293 | ret += sprintf(buf+ret, " baud:%d", info->baud); | ||
4294 | |||
4295 | ret += sprintf(buf+ret, " tx:%lu rx:%lu", | ||
4296 | (unsigned long)info->icount.tx, | 4280 | (unsigned long)info->icount.tx, |
4297 | (unsigned long)info->icount.rx); | 4281 | (unsigned long)info->icount.rx); |
4298 | tmp = CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE); | 4282 | tmp = CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE); |
4299 | if (tmp) { | 4283 | if (tmp) |
4300 | ret += sprintf(buf+ret, " tx_pend:%lu/%lu", | 4284 | seq_printf(m, " tx_pend:%lu/%lu", |
4301 | (unsigned long)tmp, | 4285 | (unsigned long)tmp, |
4302 | (unsigned long)SERIAL_XMIT_SIZE); | 4286 | (unsigned long)SERIAL_XMIT_SIZE); |
4303 | } | ||
4304 | 4287 | ||
4305 | ret += sprintf(buf+ret, " rx_pend:%lu/%lu", | 4288 | seq_printf(m, " rx_pend:%lu/%lu", |
4306 | (unsigned long)info->recv_cnt, | 4289 | (unsigned long)info->recv_cnt, |
4307 | (unsigned long)info->max_recv_cnt); | 4290 | (unsigned long)info->max_recv_cnt); |
4308 | 4291 | ||
4309 | #if 1 | 4292 | #if 1 |
4310 | if (info->port.tty) { | 4293 | if (info->port.tty) { |
4311 | |||
4312 | if (info->port.tty->stopped) | 4294 | if (info->port.tty->stopped) |
4313 | ret += sprintf(buf+ret, " stopped:%i", | 4295 | seq_printf(m, " stopped:%i", |
4314 | (int)info->port.tty->stopped); | 4296 | (int)info->port.tty->stopped); |
4315 | if (info->port.tty->hw_stopped) | 4297 | if (info->port.tty->hw_stopped) |
4316 | ret += sprintf(buf+ret, " hw_stopped:%i", | 4298 | seq_printf(m, " hw_stopped:%i", |
4317 | (int)info->port.tty->hw_stopped); | 4299 | (int)info->port.tty->hw_stopped); |
4318 | } | 4300 | } |
4319 | 4301 | ||
4320 | { | 4302 | { |
4321 | unsigned char rstat = info->ioport[REG_STATUS]; | 4303 | unsigned char rstat = info->ioport[REG_STATUS]; |
4322 | if (rstat & IO_MASK(R_SERIAL0_STATUS, xoff_detect) ) | 4304 | if (rstat & IO_MASK(R_SERIAL0_STATUS, xoff_detect)) |
4323 | ret += sprintf(buf+ret, " xoff_detect:1"); | 4305 | seq_printf(m, " xoff_detect:1"); |
4324 | } | 4306 | } |
4325 | 4307 | ||
4326 | #endif | 4308 | #endif |
4327 | 4309 | ||
4328 | |||
4329 | |||
4330 | |||
4331 | if (info->icount.frame) | 4310 | if (info->icount.frame) |
4332 | ret += sprintf(buf+ret, " fe:%lu", | 4311 | seq_printf(m, " fe:%lu", (unsigned long)info->icount.frame); |
4333 | (unsigned long)info->icount.frame); | ||
4334 | 4312 | ||
4335 | if (info->icount.parity) | 4313 | if (info->icount.parity) |
4336 | ret += sprintf(buf+ret, " pe:%lu", | 4314 | seq_printf(m, " pe:%lu", (unsigned long)info->icount.parity); |
4337 | (unsigned long)info->icount.parity); | ||
4338 | 4315 | ||
4339 | if (info->icount.brk) | 4316 | if (info->icount.brk) |
4340 | ret += sprintf(buf+ret, " brk:%lu", | 4317 | seq_printf(m, " brk:%lu", (unsigned long)info->icount.brk); |
4341 | (unsigned long)info->icount.brk); | ||
4342 | 4318 | ||
4343 | if (info->icount.overrun) | 4319 | if (info->icount.overrun) |
4344 | ret += sprintf(buf+ret, " oe:%lu", | 4320 | seq_printf(m, " oe:%lu", (unsigned long)info->icount.overrun); |
4345 | (unsigned long)info->icount.overrun); | ||
4346 | 4321 | ||
4347 | /* | 4322 | /* |
4348 | * Last thing is the RS-232 status lines | 4323 | * Last thing is the RS-232 status lines |
4349 | */ | 4324 | */ |
4350 | ret += sprintf(buf+ret, " %s\n", stat_buf+1); | 4325 | if (!E100_RTS_GET(info)) |
4351 | return ret; | 4326 | seq_puts(m, "|RTS"); |
4327 | if (!E100_CTS_GET(info)) | ||
4328 | seq_puts(m, "|CTS"); | ||
4329 | if (!E100_DTR_GET(info)) | ||
4330 | seq_puts(m, "|DTR"); | ||
4331 | if (!E100_DSR_GET(info)) | ||
4332 | seq_puts(m, "|DSR"); | ||
4333 | if (!E100_CD_GET(info)) | ||
4334 | seq_puts(m, "|CD"); | ||
4335 | if (!E100_RI_GET(info)) | ||
4336 | seq_puts(m, "|RI"); | ||
4337 | seq_puts(m, "\n"); | ||
4352 | } | 4338 | } |
4353 | 4339 | ||
4354 | int rs_read_proc(char *page, char **start, off_t off, int count, | 4340 | |
4355 | int *eof, void *data) | 4341 | static int crisv10_proc_show(struct seq_file *m, void *v) |
4356 | { | 4342 | { |
4357 | int i, len = 0, l; | 4343 | int i; |
4358 | off_t begin = 0; | ||
4359 | 4344 | ||
4360 | len += sprintf(page, "serinfo:1.0 driver:%s\n", | 4345 | seq_printf(m, "serinfo:1.0 driver:%s\n", serial_version); |
4361 | serial_version); | 4346 | |
4362 | for (i = 0; i < NR_PORTS && len < 4000; i++) { | 4347 | for (i = 0; i < NR_PORTS; i++) { |
4363 | if (!rs_table[i].enabled) | 4348 | if (!rs_table[i].enabled) |
4364 | continue; | 4349 | continue; |
4365 | l = line_info(page + len, &rs_table[i]); | 4350 | seq_line_info(m, &rs_table[i]); |
4366 | len += l; | ||
4367 | if (len+begin > off+count) | ||
4368 | goto done; | ||
4369 | if (len+begin < off) { | ||
4370 | begin += len; | ||
4371 | len = 0; | ||
4372 | } | ||
4373 | } | 4351 | } |
4374 | #ifdef DEBUG_LOG_INCLUDED | 4352 | #ifdef DEBUG_LOG_INCLUDED |
4375 | for (i = 0; i < debug_log_pos; i++) { | 4353 | for (i = 0; i < debug_log_pos; i++) { |
4376 | len += sprintf(page + len, "%-4i %lu.%lu ", i, debug_log[i].time, timer_data_to_ns(debug_log[i].timer_data)); | 4354 | seq_printf(m, "%-4i %lu.%lu ", |
4377 | len += sprintf(page + len, debug_log[i].string, debug_log[i].value); | 4355 | i, debug_log[i].time, |
4378 | if (len+begin > off+count) | 4356 | timer_data_to_ns(debug_log[i].timer_data)); |
4379 | goto done; | 4357 | seq_printf(m, debug_log[i].string, debug_log[i].value); |
4380 | if (len+begin < off) { | ||
4381 | begin += len; | ||
4382 | len = 0; | ||
4383 | } | ||
4384 | } | 4358 | } |
4385 | len += sprintf(page + len, "debug_log %i/%i %li bytes\n", | 4359 | seq_printf(m, "debug_log %i/%i\n", i, DEBUG_LOG_SIZE); |
4386 | i, DEBUG_LOG_SIZE, begin+len); | ||
4387 | debug_log_pos = 0; | 4360 | debug_log_pos = 0; |
4388 | #endif | 4361 | #endif |
4362 | return 0; | ||
4363 | } | ||
4389 | 4364 | ||
4390 | *eof = 1; | 4365 | static int crisv10_proc_open(struct inode *inode, struct file *file) |
4391 | done: | 4366 | { |
4392 | if (off >= len+begin) | 4367 | return single_open(file, crisv10_proc_show, NULL); |
4393 | return 0; | ||
4394 | *start = page + (off-begin); | ||
4395 | return ((count < begin+len-off) ? count : begin+len-off); | ||
4396 | } | 4368 | } |
4397 | 4369 | ||
4370 | static const struct file_operations crisv10_proc_fops = { | ||
4371 | .owner = THIS_MODULE, | ||
4372 | .open = crisv10_proc_open, | ||
4373 | .read = seq_read, | ||
4374 | .llseek = seq_lseek, | ||
4375 | .release = single_release, | ||
4376 | }; | ||
4377 | #endif | ||
4378 | |||
4379 | |||
4398 | /* Finally, routines used to initialize the serial driver. */ | 4380 | /* Finally, routines used to initialize the serial driver. */ |
4399 | 4381 | ||
4400 | static void | 4382 | static void show_serial_version(void) |
4401 | show_serial_version(void) | ||
4402 | { | 4383 | { |
4403 | printk(KERN_INFO | 4384 | printk(KERN_INFO |
4404 | "ETRAX 100LX serial-driver %s, (c) 2000-2004 Axis Communications AB\r\n", | 4385 | "ETRAX 100LX serial-driver %s, " |
4386 | "(c) 2000-2004 Axis Communications AB\r\n", | ||
4405 | &serial_version[11]); /* "$Revision: x.yy" */ | 4387 | &serial_version[11]); /* "$Revision: x.yy" */ |
4406 | } | 4388 | } |
4407 | 4389 | ||
@@ -4425,13 +4407,14 @@ static const struct tty_operations rs_ops = { | |||
4425 | .break_ctl = rs_break, | 4407 | .break_ctl = rs_break, |
4426 | .send_xchar = rs_send_xchar, | 4408 | .send_xchar = rs_send_xchar, |
4427 | .wait_until_sent = rs_wait_until_sent, | 4409 | .wait_until_sent = rs_wait_until_sent, |
4428 | .read_proc = rs_read_proc, | ||
4429 | .tiocmget = rs_tiocmget, | 4410 | .tiocmget = rs_tiocmget, |
4430 | .tiocmset = rs_tiocmset | 4411 | .tiocmset = rs_tiocmset, |
4412 | #ifdef CONFIG_PROC_FS | ||
4413 | .proc_fops = &crisv10_proc_fops, | ||
4414 | #endif | ||
4431 | }; | 4415 | }; |
4432 | 4416 | ||
4433 | static int __init | 4417 | static int __init rs_init(void) |
4434 | rs_init(void) | ||
4435 | { | 4418 | { |
4436 | int i; | 4419 | int i; |
4437 | struct e100_serial *info; | 4420 | struct e100_serial *info; |
diff --git a/drivers/serial/jsm/jsm.h b/drivers/serial/jsm/jsm.h index 8871aaa3dba6..c0a3e2734e24 100644 --- a/drivers/serial/jsm/jsm.h +++ b/drivers/serial/jsm/jsm.h | |||
@@ -130,8 +130,6 @@ struct jsm_board | |||
130 | struct pci_dev *pci_dev; | 130 | struct pci_dev *pci_dev; |
131 | u32 maxports; /* MAX ports this board can handle */ | 131 | u32 maxports; /* MAX ports this board can handle */ |
132 | 132 | ||
133 | spinlock_t bd_lock; /* Used to protect board */ | ||
134 | |||
135 | spinlock_t bd_intr_lock; /* Used to protect the poller tasklet and | 133 | spinlock_t bd_intr_lock; /* Used to protect the poller tasklet and |
136 | * the interrupt routine from each other. | 134 | * the interrupt routine from each other. |
137 | */ | 135 | */ |
diff --git a/drivers/serial/jsm/jsm_driver.c b/drivers/serial/jsm/jsm_driver.c index d2d32a198629..b3604aa322a4 100644 --- a/drivers/serial/jsm/jsm_driver.c +++ b/drivers/serial/jsm/jsm_driver.c | |||
@@ -88,7 +88,6 @@ static int __devinit jsm_probe_one(struct pci_dev *pdev, const struct pci_device | |||
88 | else | 88 | else |
89 | brd->maxports = 2; | 89 | brd->maxports = 2; |
90 | 90 | ||
91 | spin_lock_init(&brd->bd_lock); | ||
92 | spin_lock_init(&brd->bd_intr_lock); | 91 | spin_lock_init(&brd->bd_intr_lock); |
93 | 92 | ||
94 | /* store which revision we have */ | 93 | /* store which revision we have */ |
diff --git a/drivers/serial/max3100.c b/drivers/serial/max3100.c new file mode 100644 index 000000000000..9fd33e5622bd --- /dev/null +++ b/drivers/serial/max3100.c | |||
@@ -0,0 +1,927 @@ | |||
1 | /* | ||
2 | * | ||
3 | * Copyright (C) 2008 Christian Pellegrin <chripell@evolware.org> | ||
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 | * | ||
11 | * Notes: the MAX3100 doesn't provide an interrupt on CTS so we have | ||
12 | * to use polling for flow control. TX empty IRQ is unusable, since | ||
13 | * writing conf clears FIFO buffer and we cannot have this interrupt | ||
14 | * always asking us for attention. | ||
15 | * | ||
16 | * Example platform data: | ||
17 | |||
18 | static struct plat_max3100 max3100_plat_data = { | ||
19 | .loopback = 0, | ||
20 | .crystal = 0, | ||
21 | .poll_time = 100, | ||
22 | }; | ||
23 | |||
24 | static struct spi_board_info spi_board_info[] = { | ||
25 | { | ||
26 | .modalias = "max3100", | ||
27 | .platform_data = &max3100_plat_data, | ||
28 | .irq = IRQ_EINT12, | ||
29 | .max_speed_hz = 5*1000*1000, | ||
30 | .chip_select = 0, | ||
31 | }, | ||
32 | }; | ||
33 | |||
34 | * The initial minor number is 209 in the low-density serial port: | ||
35 | * mknod /dev/ttyMAX0 c 204 209 | ||
36 | */ | ||
37 | |||
38 | #define MAX3100_MAJOR 204 | ||
39 | #define MAX3100_MINOR 209 | ||
40 | /* 4 MAX3100s should be enough for everyone */ | ||
41 | #define MAX_MAX3100 4 | ||
42 | |||
43 | #include <linux/delay.h> | ||
44 | #include <linux/device.h> | ||
45 | #include <linux/serial_core.h> | ||
46 | #include <linux/serial.h> | ||
47 | #include <linux/spi/spi.h> | ||
48 | #include <linux/freezer.h> | ||
49 | |||
50 | #include <linux/serial_max3100.h> | ||
51 | |||
52 | #define MAX3100_C (1<<14) | ||
53 | #define MAX3100_D (0<<14) | ||
54 | #define MAX3100_W (1<<15) | ||
55 | #define MAX3100_RX (0<<15) | ||
56 | |||
57 | #define MAX3100_WC (MAX3100_W | MAX3100_C) | ||
58 | #define MAX3100_RC (MAX3100_RX | MAX3100_C) | ||
59 | #define MAX3100_WD (MAX3100_W | MAX3100_D) | ||
60 | #define MAX3100_RD (MAX3100_RX | MAX3100_D) | ||
61 | #define MAX3100_CMD (3 << 14) | ||
62 | |||
63 | #define MAX3100_T (1<<14) | ||
64 | #define MAX3100_R (1<<15) | ||
65 | |||
66 | #define MAX3100_FEN (1<<13) | ||
67 | #define MAX3100_SHDN (1<<12) | ||
68 | #define MAX3100_TM (1<<11) | ||
69 | #define MAX3100_RM (1<<10) | ||
70 | #define MAX3100_PM (1<<9) | ||
71 | #define MAX3100_RAM (1<<8) | ||
72 | #define MAX3100_IR (1<<7) | ||
73 | #define MAX3100_ST (1<<6) | ||
74 | #define MAX3100_PE (1<<5) | ||
75 | #define MAX3100_L (1<<4) | ||
76 | #define MAX3100_BAUD (0xf) | ||
77 | |||
78 | #define MAX3100_TE (1<<10) | ||
79 | #define MAX3100_RAFE (1<<10) | ||
80 | #define MAX3100_RTS (1<<9) | ||
81 | #define MAX3100_CTS (1<<9) | ||
82 | #define MAX3100_PT (1<<8) | ||
83 | #define MAX3100_DATA (0xff) | ||
84 | |||
85 | #define MAX3100_RT (MAX3100_R | MAX3100_T) | ||
86 | #define MAX3100_RTC (MAX3100_RT | MAX3100_CTS | MAX3100_RAFE) | ||
87 | |||
88 | /* the following simulate a status reg for ignore_status_mask */ | ||
89 | #define MAX3100_STATUS_PE 1 | ||
90 | #define MAX3100_STATUS_FE 2 | ||
91 | #define MAX3100_STATUS_OE 4 | ||
92 | |||
93 | struct max3100_port { | ||
94 | struct uart_port port; | ||
95 | struct spi_device *spi; | ||
96 | |||
97 | int cts; /* last CTS received for flow ctrl */ | ||
98 | int tx_empty; /* last TX empty bit */ | ||
99 | |||
100 | spinlock_t conf_lock; /* shared data */ | ||
101 | int conf_commit; /* need to make changes */ | ||
102 | int conf; /* configuration for the MAX31000 | ||
103 | * (bits 0-7, bits 8-11 are irqs) */ | ||
104 | int rts_commit; /* need to change rts */ | ||
105 | int rts; /* rts status */ | ||
106 | int baud; /* current baud rate */ | ||
107 | |||
108 | int parity; /* keeps track if we should send parity */ | ||
109 | #define MAX3100_PARITY_ON 1 | ||
110 | #define MAX3100_PARITY_ODD 2 | ||
111 | #define MAX3100_7BIT 4 | ||
112 | int rx_enabled; /* if we should rx chars */ | ||
113 | |||
114 | int irq; /* irq assigned to the max3100 */ | ||
115 | |||
116 | int minor; /* minor number */ | ||
117 | int crystal; /* 1 if 3.6864Mhz crystal 0 for 1.8432 */ | ||
118 | int loopback; /* 1 if we are in loopback mode */ | ||
119 | |||
120 | /* for handling irqs: need workqueue since we do spi_sync */ | ||
121 | struct workqueue_struct *workqueue; | ||
122 | struct work_struct work; | ||
123 | /* set to 1 to make the workhandler exit as soon as possible */ | ||
124 | int force_end_work; | ||
125 | /* need to know we are suspending to avoid deadlock on workqueue */ | ||
126 | int suspending; | ||
127 | |||
128 | /* hook for suspending MAX3100 via dedicated pin */ | ||
129 | void (*max3100_hw_suspend) (int suspend); | ||
130 | |||
131 | /* poll time (in ms) for ctrl lines */ | ||
132 | int poll_time; | ||
133 | /* and its timer */ | ||
134 | struct timer_list timer; | ||
135 | }; | ||
136 | |||
137 | static struct max3100_port *max3100s[MAX_MAX3100]; /* the chips */ | ||
138 | static DEFINE_MUTEX(max3100s_lock); /* race on probe */ | ||
139 | |||
140 | static int max3100_do_parity(struct max3100_port *s, u16 c) | ||
141 | { | ||
142 | int parity; | ||
143 | |||
144 | if (s->parity & MAX3100_PARITY_ODD) | ||
145 | parity = 1; | ||
146 | else | ||
147 | parity = 0; | ||
148 | |||
149 | if (s->parity & MAX3100_7BIT) | ||
150 | c &= 0x7f; | ||
151 | else | ||
152 | c &= 0xff; | ||
153 | |||
154 | parity = parity ^ (hweight8(c) & 1); | ||
155 | return parity; | ||
156 | } | ||
157 | |||
158 | static int max3100_check_parity(struct max3100_port *s, u16 c) | ||
159 | { | ||
160 | return max3100_do_parity(s, c) == ((c >> 8) & 1); | ||
161 | } | ||
162 | |||
163 | static void max3100_calc_parity(struct max3100_port *s, u16 *c) | ||
164 | { | ||
165 | if (s->parity & MAX3100_7BIT) | ||
166 | *c &= 0x7f; | ||
167 | else | ||
168 | *c &= 0xff; | ||
169 | |||
170 | if (s->parity & MAX3100_PARITY_ON) | ||
171 | *c |= max3100_do_parity(s, *c) << 8; | ||
172 | } | ||
173 | |||
174 | static void max3100_work(struct work_struct *w); | ||
175 | |||
176 | static void max3100_dowork(struct max3100_port *s) | ||
177 | { | ||
178 | if (!s->force_end_work && !work_pending(&s->work) && | ||
179 | !freezing(current) && !s->suspending) | ||
180 | queue_work(s->workqueue, &s->work); | ||
181 | } | ||
182 | |||
183 | static void max3100_timeout(unsigned long data) | ||
184 | { | ||
185 | struct max3100_port *s = (struct max3100_port *)data; | ||
186 | |||
187 | if (s->port.info) { | ||
188 | max3100_dowork(s); | ||
189 | mod_timer(&s->timer, jiffies + s->poll_time); | ||
190 | } | ||
191 | } | ||
192 | |||
193 | static int max3100_sr(struct max3100_port *s, u16 tx, u16 *rx) | ||
194 | { | ||
195 | struct spi_message message; | ||
196 | u16 etx, erx; | ||
197 | int status; | ||
198 | struct spi_transfer tran = { | ||
199 | .tx_buf = &etx, | ||
200 | .rx_buf = &erx, | ||
201 | .len = 2, | ||
202 | }; | ||
203 | |||
204 | etx = cpu_to_be16(tx); | ||
205 | spi_message_init(&message); | ||
206 | spi_message_add_tail(&tran, &message); | ||
207 | status = spi_sync(s->spi, &message); | ||
208 | if (status) { | ||
209 | dev_warn(&s->spi->dev, "error while calling spi_sync\n"); | ||
210 | return -EIO; | ||
211 | } | ||
212 | *rx = be16_to_cpu(erx); | ||
213 | s->tx_empty = (*rx & MAX3100_T) > 0; | ||
214 | dev_dbg(&s->spi->dev, "%04x - %04x\n", tx, *rx); | ||
215 | return 0; | ||
216 | } | ||
217 | |||
218 | static int max3100_handlerx(struct max3100_port *s, u16 rx) | ||
219 | { | ||
220 | unsigned int ch, flg, status = 0; | ||
221 | int ret = 0, cts; | ||
222 | |||
223 | if (rx & MAX3100_R && s->rx_enabled) { | ||
224 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
225 | ch = rx & (s->parity & MAX3100_7BIT ? 0x7f : 0xff); | ||
226 | if (rx & MAX3100_RAFE) { | ||
227 | s->port.icount.frame++; | ||
228 | flg = TTY_FRAME; | ||
229 | status |= MAX3100_STATUS_FE; | ||
230 | } else { | ||
231 | if (s->parity & MAX3100_PARITY_ON) { | ||
232 | if (max3100_check_parity(s, rx)) { | ||
233 | s->port.icount.rx++; | ||
234 | flg = TTY_NORMAL; | ||
235 | } else { | ||
236 | s->port.icount.parity++; | ||
237 | flg = TTY_PARITY; | ||
238 | status |= MAX3100_STATUS_PE; | ||
239 | } | ||
240 | } else { | ||
241 | s->port.icount.rx++; | ||
242 | flg = TTY_NORMAL; | ||
243 | } | ||
244 | } | ||
245 | uart_insert_char(&s->port, status, MAX3100_STATUS_OE, ch, flg); | ||
246 | ret = 1; | ||
247 | } | ||
248 | |||
249 | cts = (rx & MAX3100_CTS) > 0; | ||
250 | if (s->cts != cts) { | ||
251 | s->cts = cts; | ||
252 | uart_handle_cts_change(&s->port, cts ? TIOCM_CTS : 0); | ||
253 | } | ||
254 | |||
255 | return ret; | ||
256 | } | ||
257 | |||
258 | static void max3100_work(struct work_struct *w) | ||
259 | { | ||
260 | struct max3100_port *s = container_of(w, struct max3100_port, work); | ||
261 | int rxchars; | ||
262 | u16 tx, rx; | ||
263 | int conf, cconf, rts, crts; | ||
264 | struct circ_buf *xmit = &s->port.info->xmit; | ||
265 | |||
266 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
267 | |||
268 | rxchars = 0; | ||
269 | do { | ||
270 | spin_lock(&s->conf_lock); | ||
271 | conf = s->conf; | ||
272 | cconf = s->conf_commit; | ||
273 | s->conf_commit = 0; | ||
274 | rts = s->rts; | ||
275 | crts = s->rts_commit; | ||
276 | s->rts_commit = 0; | ||
277 | spin_unlock(&s->conf_lock); | ||
278 | if (cconf) | ||
279 | max3100_sr(s, MAX3100_WC | conf, &rx); | ||
280 | if (crts) { | ||
281 | max3100_sr(s, MAX3100_WD | MAX3100_TE | | ||
282 | (s->rts ? MAX3100_RTS : 0), &rx); | ||
283 | rxchars += max3100_handlerx(s, rx); | ||
284 | } | ||
285 | |||
286 | max3100_sr(s, MAX3100_RD, &rx); | ||
287 | rxchars += max3100_handlerx(s, rx); | ||
288 | |||
289 | if (rx & MAX3100_T) { | ||
290 | tx = 0xffff; | ||
291 | if (s->port.x_char) { | ||
292 | tx = s->port.x_char; | ||
293 | s->port.icount.tx++; | ||
294 | s->port.x_char = 0; | ||
295 | } else if (!uart_circ_empty(xmit) && | ||
296 | !uart_tx_stopped(&s->port)) { | ||
297 | tx = xmit->buf[xmit->tail]; | ||
298 | xmit->tail = (xmit->tail + 1) & | ||
299 | (UART_XMIT_SIZE - 1); | ||
300 | s->port.icount.tx++; | ||
301 | } | ||
302 | if (tx != 0xffff) { | ||
303 | max3100_calc_parity(s, &tx); | ||
304 | tx |= MAX3100_WD | (s->rts ? MAX3100_RTS : 0); | ||
305 | max3100_sr(s, tx, &rx); | ||
306 | rxchars += max3100_handlerx(s, rx); | ||
307 | } | ||
308 | } | ||
309 | |||
310 | if (rxchars > 16 && s->port.info->port.tty != NULL) { | ||
311 | tty_flip_buffer_push(s->port.info->port.tty); | ||
312 | rxchars = 0; | ||
313 | } | ||
314 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) | ||
315 | uart_write_wakeup(&s->port); | ||
316 | |||
317 | } while (!s->force_end_work && | ||
318 | !freezing(current) && | ||
319 | ((rx & MAX3100_R) || | ||
320 | (!uart_circ_empty(xmit) && | ||
321 | !uart_tx_stopped(&s->port)))); | ||
322 | |||
323 | if (rxchars > 0 && s->port.info->port.tty != NULL) | ||
324 | tty_flip_buffer_push(s->port.info->port.tty); | ||
325 | } | ||
326 | |||
327 | static irqreturn_t max3100_irq(int irqno, void *dev_id) | ||
328 | { | ||
329 | struct max3100_port *s = dev_id; | ||
330 | |||
331 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
332 | |||
333 | max3100_dowork(s); | ||
334 | return IRQ_HANDLED; | ||
335 | } | ||
336 | |||
337 | static void max3100_enable_ms(struct uart_port *port) | ||
338 | { | ||
339 | struct max3100_port *s = container_of(port, | ||
340 | struct max3100_port, | ||
341 | port); | ||
342 | |||
343 | if (s->poll_time > 0) | ||
344 | mod_timer(&s->timer, jiffies); | ||
345 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
346 | } | ||
347 | |||
348 | static void max3100_start_tx(struct uart_port *port) | ||
349 | { | ||
350 | struct max3100_port *s = container_of(port, | ||
351 | struct max3100_port, | ||
352 | port); | ||
353 | |||
354 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
355 | |||
356 | max3100_dowork(s); | ||
357 | } | ||
358 | |||
359 | static void max3100_stop_rx(struct uart_port *port) | ||
360 | { | ||
361 | struct max3100_port *s = container_of(port, | ||
362 | struct max3100_port, | ||
363 | port); | ||
364 | |||
365 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
366 | |||
367 | s->rx_enabled = 0; | ||
368 | spin_lock(&s->conf_lock); | ||
369 | s->conf &= ~MAX3100_RM; | ||
370 | s->conf_commit = 1; | ||
371 | spin_unlock(&s->conf_lock); | ||
372 | max3100_dowork(s); | ||
373 | } | ||
374 | |||
375 | static unsigned int max3100_tx_empty(struct uart_port *port) | ||
376 | { | ||
377 | struct max3100_port *s = container_of(port, | ||
378 | struct max3100_port, | ||
379 | port); | ||
380 | |||
381 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
382 | |||
383 | /* may not be truly up-to-date */ | ||
384 | max3100_dowork(s); | ||
385 | return s->tx_empty; | ||
386 | } | ||
387 | |||
388 | static unsigned int max3100_get_mctrl(struct uart_port *port) | ||
389 | { | ||
390 | struct max3100_port *s = container_of(port, | ||
391 | struct max3100_port, | ||
392 | port); | ||
393 | |||
394 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
395 | |||
396 | /* may not be truly up-to-date */ | ||
397 | max3100_dowork(s); | ||
398 | /* always assert DCD and DSR since these lines are not wired */ | ||
399 | return (s->cts ? TIOCM_CTS : 0) | TIOCM_DSR | TIOCM_CAR; | ||
400 | } | ||
401 | |||
402 | static void max3100_set_mctrl(struct uart_port *port, unsigned int mctrl) | ||
403 | { | ||
404 | struct max3100_port *s = container_of(port, | ||
405 | struct max3100_port, | ||
406 | port); | ||
407 | int rts; | ||
408 | |||
409 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
410 | |||
411 | rts = (mctrl & TIOCM_RTS) > 0; | ||
412 | |||
413 | spin_lock(&s->conf_lock); | ||
414 | if (s->rts != rts) { | ||
415 | s->rts = rts; | ||
416 | s->rts_commit = 1; | ||
417 | max3100_dowork(s); | ||
418 | } | ||
419 | spin_unlock(&s->conf_lock); | ||
420 | } | ||
421 | |||
422 | static void | ||
423 | max3100_set_termios(struct uart_port *port, struct ktermios *termios, | ||
424 | struct ktermios *old) | ||
425 | { | ||
426 | struct max3100_port *s = container_of(port, | ||
427 | struct max3100_port, | ||
428 | port); | ||
429 | int baud = 0; | ||
430 | unsigned cflag; | ||
431 | u32 param_new, param_mask, parity = 0; | ||
432 | struct tty_struct *tty = s->port.info->port.tty; | ||
433 | |||
434 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
435 | if (!tty) | ||
436 | return; | ||
437 | |||
438 | cflag = termios->c_cflag; | ||
439 | param_new = 0; | ||
440 | param_mask = 0; | ||
441 | |||
442 | baud = tty_get_baud_rate(tty); | ||
443 | param_new = s->conf & MAX3100_BAUD; | ||
444 | switch (baud) { | ||
445 | case 300: | ||
446 | if (s->crystal) | ||
447 | baud = s->baud; | ||
448 | else | ||
449 | param_new = 15; | ||
450 | break; | ||
451 | case 600: | ||
452 | param_new = 14 + s->crystal; | ||
453 | break; | ||
454 | case 1200: | ||
455 | param_new = 13 + s->crystal; | ||
456 | break; | ||
457 | case 2400: | ||
458 | param_new = 12 + s->crystal; | ||
459 | break; | ||
460 | case 4800: | ||
461 | param_new = 11 + s->crystal; | ||
462 | break; | ||
463 | case 9600: | ||
464 | param_new = 10 + s->crystal; | ||
465 | break; | ||
466 | case 19200: | ||
467 | param_new = 9 + s->crystal; | ||
468 | break; | ||
469 | case 38400: | ||
470 | param_new = 8 + s->crystal; | ||
471 | break; | ||
472 | case 57600: | ||
473 | param_new = 1 + s->crystal; | ||
474 | break; | ||
475 | case 115200: | ||
476 | param_new = 0 + s->crystal; | ||
477 | break; | ||
478 | case 230400: | ||
479 | if (s->crystal) | ||
480 | param_new = 0; | ||
481 | else | ||
482 | baud = s->baud; | ||
483 | break; | ||
484 | default: | ||
485 | baud = s->baud; | ||
486 | } | ||
487 | tty_encode_baud_rate(tty, baud, baud); | ||
488 | s->baud = baud; | ||
489 | param_mask |= MAX3100_BAUD; | ||
490 | |||
491 | if ((cflag & CSIZE) == CS8) { | ||
492 | param_new &= ~MAX3100_L; | ||
493 | parity &= ~MAX3100_7BIT; | ||
494 | } else { | ||
495 | param_new |= MAX3100_L; | ||
496 | parity |= MAX3100_7BIT; | ||
497 | cflag = (cflag & ~CSIZE) | CS7; | ||
498 | } | ||
499 | param_mask |= MAX3100_L; | ||
500 | |||
501 | if (cflag & CSTOPB) | ||
502 | param_new |= MAX3100_ST; | ||
503 | else | ||
504 | param_new &= ~MAX3100_ST; | ||
505 | param_mask |= MAX3100_ST; | ||
506 | |||
507 | if (cflag & PARENB) { | ||
508 | param_new |= MAX3100_PE; | ||
509 | parity |= MAX3100_PARITY_ON; | ||
510 | } else { | ||
511 | param_new &= ~MAX3100_PE; | ||
512 | parity &= ~MAX3100_PARITY_ON; | ||
513 | } | ||
514 | param_mask |= MAX3100_PE; | ||
515 | |||
516 | if (cflag & PARODD) | ||
517 | parity |= MAX3100_PARITY_ODD; | ||
518 | else | ||
519 | parity &= ~MAX3100_PARITY_ODD; | ||
520 | |||
521 | /* mask termios capabilities we don't support */ | ||
522 | cflag &= ~CMSPAR; | ||
523 | termios->c_cflag = cflag; | ||
524 | |||
525 | s->port.ignore_status_mask = 0; | ||
526 | if (termios->c_iflag & IGNPAR) | ||
527 | s->port.ignore_status_mask |= | ||
528 | MAX3100_STATUS_PE | MAX3100_STATUS_FE | | ||
529 | MAX3100_STATUS_OE; | ||
530 | |||
531 | /* we are sending char from a workqueue so enable */ | ||
532 | s->port.info->port.tty->low_latency = 1; | ||
533 | |||
534 | if (s->poll_time > 0) | ||
535 | del_timer_sync(&s->timer); | ||
536 | |||
537 | uart_update_timeout(port, termios->c_cflag, baud); | ||
538 | |||
539 | spin_lock(&s->conf_lock); | ||
540 | s->conf = (s->conf & ~param_mask) | (param_new & param_mask); | ||
541 | s->conf_commit = 1; | ||
542 | s->parity = parity; | ||
543 | spin_unlock(&s->conf_lock); | ||
544 | max3100_dowork(s); | ||
545 | |||
546 | if (UART_ENABLE_MS(&s->port, termios->c_cflag)) | ||
547 | max3100_enable_ms(&s->port); | ||
548 | } | ||
549 | |||
550 | static void max3100_shutdown(struct uart_port *port) | ||
551 | { | ||
552 | struct max3100_port *s = container_of(port, | ||
553 | struct max3100_port, | ||
554 | port); | ||
555 | |||
556 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
557 | |||
558 | if (s->suspending) | ||
559 | return; | ||
560 | |||
561 | s->force_end_work = 1; | ||
562 | |||
563 | if (s->poll_time > 0) | ||
564 | del_timer_sync(&s->timer); | ||
565 | |||
566 | if (s->workqueue) { | ||
567 | flush_workqueue(s->workqueue); | ||
568 | destroy_workqueue(s->workqueue); | ||
569 | s->workqueue = NULL; | ||
570 | } | ||
571 | if (s->irq) | ||
572 | free_irq(s->irq, s); | ||
573 | |||
574 | /* set shutdown mode to save power */ | ||
575 | if (s->max3100_hw_suspend) | ||
576 | s->max3100_hw_suspend(1); | ||
577 | else { | ||
578 | u16 tx, rx; | ||
579 | |||
580 | tx = MAX3100_WC | MAX3100_SHDN; | ||
581 | max3100_sr(s, tx, &rx); | ||
582 | } | ||
583 | } | ||
584 | |||
585 | static int max3100_startup(struct uart_port *port) | ||
586 | { | ||
587 | struct max3100_port *s = container_of(port, | ||
588 | struct max3100_port, | ||
589 | port); | ||
590 | char b[12]; | ||
591 | |||
592 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
593 | |||
594 | s->conf = MAX3100_RM; | ||
595 | s->baud = s->crystal ? 230400 : 115200; | ||
596 | s->rx_enabled = 1; | ||
597 | |||
598 | if (s->suspending) | ||
599 | return 0; | ||
600 | |||
601 | s->force_end_work = 0; | ||
602 | s->parity = 0; | ||
603 | s->rts = 0; | ||
604 | |||
605 | sprintf(b, "max3100-%d", s->minor); | ||
606 | s->workqueue = create_freezeable_workqueue(b); | ||
607 | if (!s->workqueue) { | ||
608 | dev_warn(&s->spi->dev, "cannot create workqueue\n"); | ||
609 | return -EBUSY; | ||
610 | } | ||
611 | INIT_WORK(&s->work, max3100_work); | ||
612 | |||
613 | if (request_irq(s->irq, max3100_irq, | ||
614 | IRQF_TRIGGER_FALLING, "max3100", s) < 0) { | ||
615 | dev_warn(&s->spi->dev, "cannot allocate irq %d\n", s->irq); | ||
616 | s->irq = 0; | ||
617 | destroy_workqueue(s->workqueue); | ||
618 | s->workqueue = NULL; | ||
619 | return -EBUSY; | ||
620 | } | ||
621 | |||
622 | if (s->loopback) { | ||
623 | u16 tx, rx; | ||
624 | tx = 0x4001; | ||
625 | max3100_sr(s, tx, &rx); | ||
626 | } | ||
627 | |||
628 | if (s->max3100_hw_suspend) | ||
629 | s->max3100_hw_suspend(0); | ||
630 | s->conf_commit = 1; | ||
631 | max3100_dowork(s); | ||
632 | /* wait for clock to settle */ | ||
633 | msleep(50); | ||
634 | |||
635 | max3100_enable_ms(&s->port); | ||
636 | |||
637 | return 0; | ||
638 | } | ||
639 | |||
640 | static const char *max3100_type(struct uart_port *port) | ||
641 | { | ||
642 | struct max3100_port *s = container_of(port, | ||
643 | struct max3100_port, | ||
644 | port); | ||
645 | |||
646 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
647 | |||
648 | return s->port.type == PORT_MAX3100 ? "MAX3100" : NULL; | ||
649 | } | ||
650 | |||
651 | static void max3100_release_port(struct uart_port *port) | ||
652 | { | ||
653 | struct max3100_port *s = container_of(port, | ||
654 | struct max3100_port, | ||
655 | port); | ||
656 | |||
657 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
658 | } | ||
659 | |||
660 | static void max3100_config_port(struct uart_port *port, int flags) | ||
661 | { | ||
662 | struct max3100_port *s = container_of(port, | ||
663 | struct max3100_port, | ||
664 | port); | ||
665 | |||
666 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
667 | |||
668 | if (flags & UART_CONFIG_TYPE) | ||
669 | s->port.type = PORT_MAX3100; | ||
670 | } | ||
671 | |||
672 | static int max3100_verify_port(struct uart_port *port, | ||
673 | struct serial_struct *ser) | ||
674 | { | ||
675 | struct max3100_port *s = container_of(port, | ||
676 | struct max3100_port, | ||
677 | port); | ||
678 | int ret = -EINVAL; | ||
679 | |||
680 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
681 | |||
682 | if (ser->type == PORT_UNKNOWN || ser->type == PORT_MAX3100) | ||
683 | ret = 0; | ||
684 | return ret; | ||
685 | } | ||
686 | |||
687 | static void max3100_stop_tx(struct uart_port *port) | ||
688 | { | ||
689 | struct max3100_port *s = container_of(port, | ||
690 | struct max3100_port, | ||
691 | port); | ||
692 | |||
693 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
694 | } | ||
695 | |||
696 | static int max3100_request_port(struct uart_port *port) | ||
697 | { | ||
698 | struct max3100_port *s = container_of(port, | ||
699 | struct max3100_port, | ||
700 | port); | ||
701 | |||
702 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
703 | return 0; | ||
704 | } | ||
705 | |||
706 | static void max3100_break_ctl(struct uart_port *port, int break_state) | ||
707 | { | ||
708 | struct max3100_port *s = container_of(port, | ||
709 | struct max3100_port, | ||
710 | port); | ||
711 | |||
712 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
713 | } | ||
714 | |||
715 | static struct uart_ops max3100_ops = { | ||
716 | .tx_empty = max3100_tx_empty, | ||
717 | .set_mctrl = max3100_set_mctrl, | ||
718 | .get_mctrl = max3100_get_mctrl, | ||
719 | .stop_tx = max3100_stop_tx, | ||
720 | .start_tx = max3100_start_tx, | ||
721 | .stop_rx = max3100_stop_rx, | ||
722 | .enable_ms = max3100_enable_ms, | ||
723 | .break_ctl = max3100_break_ctl, | ||
724 | .startup = max3100_startup, | ||
725 | .shutdown = max3100_shutdown, | ||
726 | .set_termios = max3100_set_termios, | ||
727 | .type = max3100_type, | ||
728 | .release_port = max3100_release_port, | ||
729 | .request_port = max3100_request_port, | ||
730 | .config_port = max3100_config_port, | ||
731 | .verify_port = max3100_verify_port, | ||
732 | }; | ||
733 | |||
734 | static struct uart_driver max3100_uart_driver = { | ||
735 | .owner = THIS_MODULE, | ||
736 | .driver_name = "ttyMAX", | ||
737 | .dev_name = "ttyMAX", | ||
738 | .major = MAX3100_MAJOR, | ||
739 | .minor = MAX3100_MINOR, | ||
740 | .nr = MAX_MAX3100, | ||
741 | }; | ||
742 | static int uart_driver_registered; | ||
743 | |||
744 | static int __devinit max3100_probe(struct spi_device *spi) | ||
745 | { | ||
746 | int i, retval; | ||
747 | struct plat_max3100 *pdata; | ||
748 | u16 tx, rx; | ||
749 | |||
750 | mutex_lock(&max3100s_lock); | ||
751 | |||
752 | if (!uart_driver_registered) { | ||
753 | uart_driver_registered = 1; | ||
754 | retval = uart_register_driver(&max3100_uart_driver); | ||
755 | if (retval) { | ||
756 | printk(KERN_ERR "Couldn't register max3100 uart driver\n"); | ||
757 | mutex_unlock(&max3100s_lock); | ||
758 | return retval; | ||
759 | } | ||
760 | } | ||
761 | |||
762 | for (i = 0; i < MAX_MAX3100; i++) | ||
763 | if (!max3100s[i]) | ||
764 | break; | ||
765 | if (i == MAX_MAX3100) { | ||
766 | dev_warn(&spi->dev, "too many MAX3100 chips\n"); | ||
767 | mutex_unlock(&max3100s_lock); | ||
768 | return -ENOMEM; | ||
769 | } | ||
770 | |||
771 | max3100s[i] = kzalloc(sizeof(struct max3100_port), GFP_KERNEL); | ||
772 | if (!max3100s[i]) { | ||
773 | dev_warn(&spi->dev, | ||
774 | "kmalloc for max3100 structure %d failed!\n", i); | ||
775 | mutex_unlock(&max3100s_lock); | ||
776 | return -ENOMEM; | ||
777 | } | ||
778 | max3100s[i]->spi = spi; | ||
779 | max3100s[i]->irq = spi->irq; | ||
780 | spin_lock_init(&max3100s[i]->conf_lock); | ||
781 | dev_set_drvdata(&spi->dev, max3100s[i]); | ||
782 | pdata = spi->dev.platform_data; | ||
783 | max3100s[i]->crystal = pdata->crystal; | ||
784 | max3100s[i]->loopback = pdata->loopback; | ||
785 | max3100s[i]->poll_time = pdata->poll_time * HZ / 1000; | ||
786 | if (pdata->poll_time > 0 && max3100s[i]->poll_time == 0) | ||
787 | max3100s[i]->poll_time = 1; | ||
788 | max3100s[i]->max3100_hw_suspend = pdata->max3100_hw_suspend; | ||
789 | max3100s[i]->minor = i; | ||
790 | init_timer(&max3100s[i]->timer); | ||
791 | max3100s[i]->timer.function = max3100_timeout; | ||
792 | max3100s[i]->timer.data = (unsigned long) max3100s[i]; | ||
793 | |||
794 | dev_dbg(&spi->dev, "%s: adding port %d\n", __func__, i); | ||
795 | max3100s[i]->port.irq = max3100s[i]->irq; | ||
796 | max3100s[i]->port.uartclk = max3100s[i]->crystal ? 3686400 : 1843200; | ||
797 | max3100s[i]->port.fifosize = 16; | ||
798 | max3100s[i]->port.ops = &max3100_ops; | ||
799 | max3100s[i]->port.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF; | ||
800 | max3100s[i]->port.line = i; | ||
801 | max3100s[i]->port.type = PORT_MAX3100; | ||
802 | max3100s[i]->port.dev = &spi->dev; | ||
803 | retval = uart_add_one_port(&max3100_uart_driver, &max3100s[i]->port); | ||
804 | if (retval < 0) | ||
805 | dev_warn(&spi->dev, | ||
806 | "uart_add_one_port failed for line %d with error %d\n", | ||
807 | i, retval); | ||
808 | |||
809 | /* set shutdown mode to save power. Will be woken-up on open */ | ||
810 | if (max3100s[i]->max3100_hw_suspend) | ||
811 | max3100s[i]->max3100_hw_suspend(1); | ||
812 | else { | ||
813 | tx = MAX3100_WC | MAX3100_SHDN; | ||
814 | max3100_sr(max3100s[i], tx, &rx); | ||
815 | } | ||
816 | mutex_unlock(&max3100s_lock); | ||
817 | return 0; | ||
818 | } | ||
819 | |||
820 | static int __devexit max3100_remove(struct spi_device *spi) | ||
821 | { | ||
822 | struct max3100_port *s = dev_get_drvdata(&spi->dev); | ||
823 | int i; | ||
824 | |||
825 | mutex_lock(&max3100s_lock); | ||
826 | |||
827 | /* find out the index for the chip we are removing */ | ||
828 | for (i = 0; i < MAX_MAX3100; i++) | ||
829 | if (max3100s[i] == s) | ||
830 | break; | ||
831 | |||
832 | dev_dbg(&spi->dev, "%s: removing port %d\n", __func__, i); | ||
833 | uart_remove_one_port(&max3100_uart_driver, &max3100s[i]->port); | ||
834 | kfree(max3100s[i]); | ||
835 | max3100s[i] = NULL; | ||
836 | |||
837 | /* check if this is the last chip we have */ | ||
838 | for (i = 0; i < MAX_MAX3100; i++) | ||
839 | if (max3100s[i]) { | ||
840 | mutex_unlock(&max3100s_lock); | ||
841 | return 0; | ||
842 | } | ||
843 | pr_debug("removing max3100 driver\n"); | ||
844 | uart_unregister_driver(&max3100_uart_driver); | ||
845 | |||
846 | mutex_unlock(&max3100s_lock); | ||
847 | return 0; | ||
848 | } | ||
849 | |||
850 | #ifdef CONFIG_PM | ||
851 | |||
852 | static int max3100_suspend(struct spi_device *spi, pm_message_t state) | ||
853 | { | ||
854 | struct max3100_port *s = dev_get_drvdata(&spi->dev); | ||
855 | |||
856 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
857 | |||
858 | disable_irq(s->irq); | ||
859 | |||
860 | s->suspending = 1; | ||
861 | uart_suspend_port(&max3100_uart_driver, &s->port); | ||
862 | |||
863 | if (s->max3100_hw_suspend) | ||
864 | s->max3100_hw_suspend(1); | ||
865 | else { | ||
866 | /* no HW suspend, so do SW one */ | ||
867 | u16 tx, rx; | ||
868 | |||
869 | tx = MAX3100_WC | MAX3100_SHDN; | ||
870 | max3100_sr(s, tx, &rx); | ||
871 | } | ||
872 | return 0; | ||
873 | } | ||
874 | |||
875 | static int max3100_resume(struct spi_device *spi) | ||
876 | { | ||
877 | struct max3100_port *s = dev_get_drvdata(&spi->dev); | ||
878 | |||
879 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
880 | |||
881 | if (s->max3100_hw_suspend) | ||
882 | s->max3100_hw_suspend(0); | ||
883 | uart_resume_port(&max3100_uart_driver, &s->port); | ||
884 | s->suspending = 0; | ||
885 | |||
886 | enable_irq(s->irq); | ||
887 | |||
888 | s->conf_commit = 1; | ||
889 | if (s->workqueue) | ||
890 | max3100_dowork(s); | ||
891 | |||
892 | return 0; | ||
893 | } | ||
894 | |||
895 | #else | ||
896 | #define max3100_suspend NULL | ||
897 | #define max3100_resume NULL | ||
898 | #endif | ||
899 | |||
900 | static struct spi_driver max3100_driver = { | ||
901 | .driver = { | ||
902 | .name = "max3100", | ||
903 | .bus = &spi_bus_type, | ||
904 | .owner = THIS_MODULE, | ||
905 | }, | ||
906 | |||
907 | .probe = max3100_probe, | ||
908 | .remove = __devexit_p(max3100_remove), | ||
909 | .suspend = max3100_suspend, | ||
910 | .resume = max3100_resume, | ||
911 | }; | ||
912 | |||
913 | static int __init max3100_init(void) | ||
914 | { | ||
915 | return spi_register_driver(&max3100_driver); | ||
916 | } | ||
917 | module_init(max3100_init); | ||
918 | |||
919 | static void __exit max3100_exit(void) | ||
920 | { | ||
921 | spi_unregister_driver(&max3100_driver); | ||
922 | } | ||
923 | module_exit(max3100_exit); | ||
924 | |||
925 | MODULE_DESCRIPTION("MAX3100 driver"); | ||
926 | MODULE_AUTHOR("Christian Pellegrin <chripell@evolware.org>"); | ||
927 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/serial/s3c6400.c b/drivers/serial/s3c6400.c index 06936d13393f..3e3785233682 100644 --- a/drivers/serial/s3c6400.c +++ b/drivers/serial/s3c6400.c | |||
@@ -102,6 +102,7 @@ static struct s3c24xx_uart_info s3c6400_uart_inf = { | |||
102 | .name = "Samsung S3C6400 UART", | 102 | .name = "Samsung S3C6400 UART", |
103 | .type = PORT_S3C6400, | 103 | .type = PORT_S3C6400, |
104 | .fifosize = 64, | 104 | .fifosize = 64, |
105 | .has_divslot = 1, | ||
105 | .rx_fifomask = S3C2440_UFSTAT_RXMASK, | 106 | .rx_fifomask = S3C2440_UFSTAT_RXMASK, |
106 | .rx_fifoshift = S3C2440_UFSTAT_RXSHIFT, | 107 | .rx_fifoshift = S3C2440_UFSTAT_RXSHIFT, |
107 | .rx_fifofull = S3C2440_UFSTAT_RXFULL, | 108 | .rx_fifofull = S3C2440_UFSTAT_RXFULL, |
diff --git a/drivers/serial/samsung.c b/drivers/serial/samsung.c index 41ac94872b8d..93b5d75db126 100644 --- a/drivers/serial/samsung.c +++ b/drivers/serial/samsung.c | |||
@@ -127,7 +127,7 @@ static void s3c24xx_serial_stop_tx(struct uart_port *port) | |||
127 | struct s3c24xx_uart_port *ourport = to_ourport(port); | 127 | struct s3c24xx_uart_port *ourport = to_ourport(port); |
128 | 128 | ||
129 | if (tx_enabled(port)) { | 129 | if (tx_enabled(port)) { |
130 | disable_irq(ourport->tx_irq); | 130 | disable_irq_nosync(ourport->tx_irq); |
131 | tx_enabled(port) = 0; | 131 | tx_enabled(port) = 0; |
132 | if (port->flags & UPF_CONS_FLOW) | 132 | if (port->flags & UPF_CONS_FLOW) |
133 | s3c24xx_serial_rx_enable(port); | 133 | s3c24xx_serial_rx_enable(port); |
@@ -154,7 +154,7 @@ static void s3c24xx_serial_stop_rx(struct uart_port *port) | |||
154 | 154 | ||
155 | if (rx_enabled(port)) { | 155 | if (rx_enabled(port)) { |
156 | dbg("s3c24xx_serial_stop_rx: port=%p\n", port); | 156 | dbg("s3c24xx_serial_stop_rx: port=%p\n", port); |
157 | disable_irq(ourport->rx_irq); | 157 | disable_irq_nosync(ourport->rx_irq); |
158 | rx_enabled(port) = 0; | 158 | rx_enabled(port) = 0; |
159 | } | 159 | } |
160 | } | 160 | } |
@@ -508,6 +508,7 @@ s3c24xx_serial_setsource(struct uart_port *port, struct s3c24xx_uart_clksrc *c) | |||
508 | struct baud_calc { | 508 | struct baud_calc { |
509 | struct s3c24xx_uart_clksrc *clksrc; | 509 | struct s3c24xx_uart_clksrc *clksrc; |
510 | unsigned int calc; | 510 | unsigned int calc; |
511 | unsigned int divslot; | ||
511 | unsigned int quot; | 512 | unsigned int quot; |
512 | struct clk *src; | 513 | struct clk *src; |
513 | }; | 514 | }; |
@@ -517,6 +518,7 @@ static int s3c24xx_serial_calcbaud(struct baud_calc *calc, | |||
517 | struct s3c24xx_uart_clksrc *clksrc, | 518 | struct s3c24xx_uart_clksrc *clksrc, |
518 | unsigned int baud) | 519 | unsigned int baud) |
519 | { | 520 | { |
521 | struct s3c24xx_uart_port *ourport = to_ourport(port); | ||
520 | unsigned long rate; | 522 | unsigned long rate; |
521 | 523 | ||
522 | calc->src = clk_get(port->dev, clksrc->name); | 524 | calc->src = clk_get(port->dev, clksrc->name); |
@@ -527,8 +529,24 @@ static int s3c24xx_serial_calcbaud(struct baud_calc *calc, | |||
527 | rate /= clksrc->divisor; | 529 | rate /= clksrc->divisor; |
528 | 530 | ||
529 | calc->clksrc = clksrc; | 531 | calc->clksrc = clksrc; |
530 | calc->quot = (rate + (8 * baud)) / (16 * baud); | 532 | |
531 | calc->calc = (rate / (calc->quot * 16)); | 533 | if (ourport->info->has_divslot) { |
534 | unsigned long div = rate / baud; | ||
535 | |||
536 | /* The UDIVSLOT register on the newer UARTs allows us to | ||
537 | * get a divisor adjustment of 1/16th on the baud clock. | ||
538 | * | ||
539 | * We don't keep the UDIVSLOT value (the 16ths we calculated | ||
540 | * by not multiplying the baud by 16) as it is easy enough | ||
541 | * to recalculate. | ||
542 | */ | ||
543 | |||
544 | calc->quot = div / 16; | ||
545 | calc->calc = rate / div; | ||
546 | } else { | ||
547 | calc->quot = (rate + (8 * baud)) / (16 * baud); | ||
548 | calc->calc = (rate / (calc->quot * 16)); | ||
549 | } | ||
532 | 550 | ||
533 | calc->quot--; | 551 | calc->quot--; |
534 | return 1; | 552 | return 1; |
@@ -611,6 +629,30 @@ static unsigned int s3c24xx_serial_getclk(struct uart_port *port, | |||
611 | return best->quot; | 629 | return best->quot; |
612 | } | 630 | } |
613 | 631 | ||
632 | /* udivslot_table[] | ||
633 | * | ||
634 | * This table takes the fractional value of the baud divisor and gives | ||
635 | * the recommended setting for the UDIVSLOT register. | ||
636 | */ | ||
637 | static u16 udivslot_table[16] = { | ||
638 | [0] = 0x0000, | ||
639 | [1] = 0x0080, | ||
640 | [2] = 0x0808, | ||
641 | [3] = 0x0888, | ||
642 | [4] = 0x2222, | ||
643 | [5] = 0x4924, | ||
644 | [6] = 0x4A52, | ||
645 | [7] = 0x54AA, | ||
646 | [8] = 0x5555, | ||
647 | [9] = 0xD555, | ||
648 | [10] = 0xD5D5, | ||
649 | [11] = 0xDDD5, | ||
650 | [12] = 0xDDDD, | ||
651 | [13] = 0xDFDD, | ||
652 | [14] = 0xDFDF, | ||
653 | [15] = 0xFFDF, | ||
654 | }; | ||
655 | |||
614 | static void s3c24xx_serial_set_termios(struct uart_port *port, | 656 | static void s3c24xx_serial_set_termios(struct uart_port *port, |
615 | struct ktermios *termios, | 657 | struct ktermios *termios, |
616 | struct ktermios *old) | 658 | struct ktermios *old) |
@@ -623,6 +665,7 @@ static void s3c24xx_serial_set_termios(struct uart_port *port, | |||
623 | unsigned int baud, quot; | 665 | unsigned int baud, quot; |
624 | unsigned int ulcon; | 666 | unsigned int ulcon; |
625 | unsigned int umcon; | 667 | unsigned int umcon; |
668 | unsigned int udivslot = 0; | ||
626 | 669 | ||
627 | /* | 670 | /* |
628 | * We don't support modem control lines. | 671 | * We don't support modem control lines. |
@@ -644,6 +687,7 @@ static void s3c24xx_serial_set_termios(struct uart_port *port, | |||
644 | /* check to see if we need to change clock source */ | 687 | /* check to see if we need to change clock source */ |
645 | 688 | ||
646 | if (ourport->clksrc != clksrc || ourport->baudclk != clk) { | 689 | if (ourport->clksrc != clksrc || ourport->baudclk != clk) { |
690 | dbg("selecting clock %p\n", clk); | ||
647 | s3c24xx_serial_setsource(port, clksrc); | 691 | s3c24xx_serial_setsource(port, clksrc); |
648 | 692 | ||
649 | if (ourport->baudclk != NULL && !IS_ERR(ourport->baudclk)) { | 693 | if (ourport->baudclk != NULL && !IS_ERR(ourport->baudclk)) { |
@@ -658,6 +702,13 @@ static void s3c24xx_serial_set_termios(struct uart_port *port, | |||
658 | ourport->baudclk_rate = clk ? clk_get_rate(clk) : 0; | 702 | ourport->baudclk_rate = clk ? clk_get_rate(clk) : 0; |
659 | } | 703 | } |
660 | 704 | ||
705 | if (ourport->info->has_divslot) { | ||
706 | unsigned int div = ourport->baudclk_rate / baud; | ||
707 | |||
708 | udivslot = udivslot_table[div & 15]; | ||
709 | dbg("udivslot = %04x (div %d)\n", udivslot, div & 15); | ||
710 | } | ||
711 | |||
661 | switch (termios->c_cflag & CSIZE) { | 712 | switch (termios->c_cflag & CSIZE) { |
662 | case CS5: | 713 | case CS5: |
663 | dbg("config: 5bits/char\n"); | 714 | dbg("config: 5bits/char\n"); |
@@ -697,12 +748,16 @@ static void s3c24xx_serial_set_termios(struct uart_port *port, | |||
697 | 748 | ||
698 | spin_lock_irqsave(&port->lock, flags); | 749 | spin_lock_irqsave(&port->lock, flags); |
699 | 750 | ||
700 | dbg("setting ulcon to %08x, brddiv to %d\n", ulcon, quot); | 751 | dbg("setting ulcon to %08x, brddiv to %d, udivslot %08x\n", |
752 | ulcon, quot, udivslot); | ||
701 | 753 | ||
702 | wr_regl(port, S3C2410_ULCON, ulcon); | 754 | wr_regl(port, S3C2410_ULCON, ulcon); |
703 | wr_regl(port, S3C2410_UBRDIV, quot); | 755 | wr_regl(port, S3C2410_UBRDIV, quot); |
704 | wr_regl(port, S3C2410_UMCON, umcon); | 756 | wr_regl(port, S3C2410_UMCON, umcon); |
705 | 757 | ||
758 | if (ourport->info->has_divslot) | ||
759 | wr_regl(port, S3C2443_DIVSLOT, udivslot); | ||
760 | |||
706 | dbg("uart: ulcon = 0x%08x, ucon = 0x%08x, ufcon = 0x%08x\n", | 761 | dbg("uart: ulcon = 0x%08x, ucon = 0x%08x, ufcon = 0x%08x\n", |
707 | rd_regl(port, S3C2410_ULCON), | 762 | rd_regl(port, S3C2410_ULCON), |
708 | rd_regl(port, S3C2410_UCON), | 763 | rd_regl(port, S3C2410_UCON), |
diff --git a/drivers/serial/samsung.h b/drivers/serial/samsung.h index 571d6b90d206..7afb94843a08 100644 --- a/drivers/serial/samsung.h +++ b/drivers/serial/samsung.h | |||
@@ -21,6 +21,10 @@ struct s3c24xx_uart_info { | |||
21 | unsigned long tx_fifoshift; | 21 | unsigned long tx_fifoshift; |
22 | unsigned long tx_fifofull; | 22 | unsigned long tx_fifofull; |
23 | 23 | ||
24 | /* uart port features */ | ||
25 | |||
26 | unsigned int has_divslot:1; | ||
27 | |||
24 | /* clock source control */ | 28 | /* clock source control */ |
25 | 29 | ||
26 | int (*get_clksrc)(struct uart_port *, struct s3c24xx_uart_clksrc *clk); | 30 | int (*get_clksrc)(struct uart_port *, struct s3c24xx_uart_clksrc *clk); |
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c index a4dc79b1d7ab..47c6837850b1 100644 --- a/drivers/serial/sunsu.c +++ b/drivers/serial/sunsu.c | |||
@@ -1178,7 +1178,7 @@ static struct uart_driver sunsu_reg = { | |||
1178 | .major = TTY_MAJOR, | 1178 | .major = TTY_MAJOR, |
1179 | }; | 1179 | }; |
1180 | 1180 | ||
1181 | static int __init sunsu_kbd_ms_init(struct uart_sunsu_port *up) | 1181 | static int __devinit sunsu_kbd_ms_init(struct uart_sunsu_port *up) |
1182 | { | 1182 | { |
1183 | int quot, baud; | 1183 | int quot, baud; |
1184 | #ifdef CONFIG_SERIO | 1184 | #ifdef CONFIG_SERIO |