CVSROOT: /home/cvs
Module name: linux
Changes by: ths@ftp.linux-mips.org 05/01/07 14:50:19
Modified files:
drivers/char : sb1250_duart.c
include/linux : serial.h
Log message:
Support TIOCGSERIAL for sb1250 duarts. Forward port of Peter de
Schrijver's
patch for 2.4.
diff -urN linux/drivers/char/sb1250_duart.c linux/drivers/char/sb1250_duart.c
--- linux/drivers/char/sb1250_duart.c 2004/12/21 04:31:17 1.28
+++ linux/drivers/char/sb1250_duart.c 2005/01/07 14:50:19 1.29
@@ -489,9 +489,31 @@
duart_set_cflag(us->line, tty->termios->c_cflag);
}
+static int get_serial_info(uart_state_t *us, struct serial_struct * retinfo) {
+
+ struct serial_struct tmp;
+
+ memset(&tmp, 0, sizeof(tmp));
+
+ tmp.type=PORT_SB1250;
+ tmp.line=us->line;
+ tmp.port=A_DUART_CHANREG(tmp.line,0);
+ tmp.irq=K_INT_UART_0 + tmp.line;
+ tmp.xmit_fifo_size=16; /* fixed by hw */
+ tmp.baud_base=5000000;
+ tmp.io_type=SERIAL_IO_MEM;
+
+ if (copy_to_user(retinfo,&tmp,sizeof(*retinfo)))
+ return -EFAULT;
+
+ return 0;
+}
+
static int duart_ioctl(struct tty_struct *tty, struct file * file,
unsigned int cmd, unsigned long arg)
{
+ uart_state_t *us = (uart_state_t *) tty->driver_data;
+
/* if (serial_paranoia_check(info, tty->device, "rs_ioctl"))
return -ENODEV;*/
switch (cmd) {
@@ -508,8 +530,7 @@
printk("Ignoring TIOCMSET\n");
break;
case TIOCGSERIAL:
- printk("Ignoring TIOCGSERIAL\n");
- break;
+ return get_serial_info(us,(struct serial_struct *) arg);
case TIOCSSERIAL:
printk("Ignoring TIOCSSERIAL\n");
break;
@@ -539,36 +560,6 @@
}
// printk("Ignoring IOCTL %x from pid %i (%s)\n", cmd, current->pid,
current->comm);
return -ENOIOCTLCMD;
-#if 0
- if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
- (cmd != TIOCSERCONFIG) && (cmd != TIOCSERGSTRUCT) &&
- (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) {
- if (tty->flags & (1 << TTY_IO_ERROR))
- return -EIO;
- }
-
- switch (cmd) {
- case TIOCMGET:
- case TIOCMBIS:
- case TIOCMBIC:
- case TIOCMSET:
- case TIOCGSERIAL:
- case TIOCSSERIAL:
- case TIOCSERCONFIG:
- case TIOCSERGETLSR: /* Get line status register */
- case TIOCSERGSTRUCT:
- case TIOCMIWAIT:
- case TIOCGICOUNT:
- case TIOCSERGWILD:
- case TIOCSERSWILD:
- /* XXX Implement me! */
- printk("IOCTL needs implementing: %x\n", cmd);
-
- default:
- printk("Unknown ioctl: %x\n", cmd);
- }
-#endif
- return 0;
}
/* XXXKW locking? */
diff -urN linux/include/linux/serial.h linux/include/linux/serial.h
--- linux/include/linux/serial.h 2004/12/04 18:16:10 1.26
+++ linux/include/linux/serial.h 2005/01/07 14:50:19 1.27
@@ -75,7 +75,8 @@
#define PORT_16654 11
#define PORT_16850 12
#define PORT_RSA 13 /* RSA-DV II/S card */
-#define PORT_MAX 13
+#define PORT_SB1250 14
+#define PORT_MAX 14
#define SERIAL_IO_PORT 0
#define SERIAL_IO_HUB6 1
|