Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Peter 'p2' De Schrijver <p2@mind.be>
To: linux-mips@linux-mips.org
Subject: TIOCGSERIAL for SB1250 UARTs
Date: Wed, 14 Apr 2004 21:55:17 +0200	[thread overview]
Message-ID: <20040414195517.GA1615@mind.be> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 110 bytes --]

Hi,

The attached patch implements the TIOCGSERIAL ioctl for the SB1250
DUART. 

Thanks,

Peter (p2).

[-- Attachment #1.2: sb1250-serial-patch-1 --]
[-- Type: text/plain, Size: 1686 bytes --]

--- linux-2.4.24/drivers/char/sb1250_duart.c	2003-08-25 13:44:41.000000000 +0200
+++ linux-qube/linux-2.4.24/linux/drivers/char/sb1250_duart.c	2004-04-03 20:40:05.000000000 +0200
@@ -498,9 +498,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) {
@@ -517,7 +539,7 @@
 		printk("Ignoring TIOCMSET\n");
 		break;
 	case TIOCGSERIAL:
-		printk("Ignoring TIOCGSERIAL\n");
+		return get_serial_info(us,(struct serial_struct *) arg);
 		break;
 	case TIOCSSERIAL:
 		printk("Ignoring TIOCSSERIAL\n");
--- linux-2.4.24/include/linux/serial.h	2002-08-03 02:39:45.000000000 +0200
+++ linux-qube/linux-2.4.24/linux/include/linux/serial.h	2004-04-03 20:14:37.000000000 +0200
@@ -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

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

                 reply	other threads:[~2004-04-14 19:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040414195517.GA1615@mind.be \
    --to=p2@mind.be \
    --cc=linux-mips@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox