/* Handle notification of a termios change. */ static void duart_set_termios(struct tty_struct *tty, struct termios *old) { uart_state_t *us = (uart_state_t *) tty->driver_data; #ifdef DUART_SPEW printk("duart_set_termios called by %i (%s)\n", current->pid, current->comm); #endif if (old && tty->termios->c_cflag == old->c_cflag) return; duart_set_cflag(us->line, tty->termios->c_cflag); }
/* Set up the driver and register it, register the 2 1250 UART interrupts. This is called from tty_init, or as a part of the module init */ static int __init sb1250_duart_init(void) { int i; sb1250_duart_driver = alloc_tty_driver(DUART_MAX_LINE); if (!sb1250_duart_driver) return -ENOMEM; sb1250_duart_driver->owner = THIS_MODULE; sb1250_duart_driver->name = "duart"; sb1250_duart_driver->devfs_name = "duart/"; sb1250_duart_driver->major = TTY_MAJOR; sb1250_duart_driver->minor_start = SB1250_DUART_MINOR_BASE; sb1250_duart_driver->type = TTY_DRIVER_TYPE_SERIAL; sb1250_duart_driver->subtype = SERIAL_TYPE_NORMAL; sb1250_duart_driver->init_termios = tty_std_termios; sb1250_duart_driver->flags = TTY_DRIVER_REAL_RAW; tty_set_operations(sb1250_duart_driver, &duart_ops); for (i=0; i<DUART_MAX_LINE; i++) { uart_state_t *port = uart_states + i; if (!sb1250_duart_present[i]) continue; init_duart_port(port, i); spin_lock_init(&port->outp_lock); duart_mask_ints(i, M_DUART_IMR_ALL); if (request_irq(K_INT_UART_0+i, duart_int, 0, "uart", port)) { panic("Couldn't get uart0 interrupt line"); } __raw_writeq(M_DUART_RX_EN|M_DUART_TX_EN, (u8 *) IOADDR(A_DUART_CHANREG(i, R_DUART_CMD))); duart_set_cflag(i, DEFAULT_CFLAGS); } /* Interrupts are now active, our ISR can be called. */ if (tty_register_driver(sb1250_duart_driver)) { printk(KERN_ERR "Couldn't register sb1250 duart serial driver\n"); put_tty_driver(sb1250_duart_driver); return 1; } return 0; }
/* Set up the driver and register it, register the 2 1250 UART interrupts. This is called from tty_init, or as a part of the module init */ static int __init sb1250_duart_init(void) { int i; sb1250_duart_driver.magic = TTY_DRIVER_MAGIC; sb1250_duart_driver.driver_name = "serial"; #ifdef CONFIG_DEVFS_FS sb1250_duart_driver.name = "tts/%d"; #else sb1250_duart_driver.name = "ttyS"; #endif sb1250_duart_driver.major = TTY_MAJOR; sb1250_duart_driver.minor_start = SB1250_DUART_MINOR_BASE; sb1250_duart_driver.num = DUART_MAX_LINE; sb1250_duart_driver.type = TTY_DRIVER_TYPE_SERIAL; sb1250_duart_driver.subtype = SERIAL_TYPE_NORMAL; sb1250_duart_driver.init_termios = tty_std_termios; sb1250_duart_driver.flags = TTY_DRIVER_REAL_RAW; sb1250_duart_driver.refcount = &duart_refcount; sb1250_duart_driver.table = duart_table; sb1250_duart_driver.termios = duart_termios; sb1250_duart_driver.termios_locked = duart_termios_locked; sb1250_duart_driver.open = duart_open; sb1250_duart_driver.close = duart_close; sb1250_duart_driver.write = duart_write; sb1250_duart_driver.put_char = duart_put_char; sb1250_duart_driver.write_room = duart_write_room; sb1250_duart_driver.flush_chars = duart_flush_chars; sb1250_duart_driver.chars_in_buffer = duart_chars_in_buffer; sb1250_duart_driver.flush_buffer = duart_flush_buffer; sb1250_duart_driver.ioctl = duart_ioctl; sb1250_duart_driver.set_termios = duart_set_termios; sb1250_duart_driver.stop = duart_stop; sb1250_duart_driver.start = duart_start; sb1250_duart_driver.hangup = duart_hangup; sb1250_duart_driver.wait_until_sent = duart_wait_until_sent; sb1250_duart_callout_driver = sb1250_duart_driver; #ifdef CONFIG_DEVFS_FS sb1250_duart_callout_driver.name = "cua/%d"; #else sb1250_duart_callout_driver.name = "cua"; #endif sb1250_duart_callout_driver.major = TTYAUX_MAJOR; sb1250_duart_callout_driver.subtype = SERIAL_TYPE_CALLOUT; for (i=0; i<DUART_MAX_LINE; i++) { uart_state_t *port = uart_states + i; if (!sb1250_duart_present[i]) continue; init_duart_port(port, i); spin_lock_init(&port->outp_lock); duart_mask_ints(i, M_DUART_IMR_ALL); if (request_irq(K_INT_UART_0+i, duart_int, 0, "uart", port)) { panic("Couldn't get uart0 interrupt line"); } out64(M_DUART_RX_EN|M_DUART_TX_EN, IO_SPACE_BASE | A_DUART_CHANREG(i, R_DUART_CMD)); duart_set_cflag(i, DEFAULT_CFLAGS); } /* Interrupts are now active, our ISR can be called. */ if (tty_register_driver(&sb1250_duart_driver)) { printk(KERN_ERR "Couldn't register sb1250 duart serial driver\n"); } if (tty_register_driver(&sb1250_duart_callout_driver)) { printk(KERN_ERR "Couldn't register sb1250 duart callout driver\n"); } return 0; }