Commit cdef47ce authored by David S. Miller's avatar David S. Miller

SPARC: More Sun serial driver updates.

- Fully convert SUNSAB driver.
- Make Sun serial console selection more sensible.
- Misc bug fixes to all drivers.
parent 45fe4502
This diff is collapsed.
/* $Id: sab82532.h,v 1.7 2001/05/23 23:09:10 ecd Exp $ /* sunsab.h: Register Definitions for the Siemens SAB82532 DUSCC
* sab82532.h: Register Definitions for the Siemens SAB82532 DUSCC
* *
* Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
*/ */
#ifndef _SPARC64_SAB82532_H #ifndef _SUNSAB_H
#define _SPARC64_SAB82532_H #define _SUNSAB_H
#include <linux/types.h>
#include <linux/serial.h>
#include <linux/circ_buf.h>
struct sab82532_async_rd_regs { struct sab82532_async_rd_regs {
u8 rfifo[0x20]; /* Receive FIFO */ u8 rfifo[0x20]; /* Receive FIFO */
...@@ -120,8 +115,6 @@ union sab82532_async_regs { ...@@ -120,8 +115,6 @@ union sab82532_async_regs {
__volatile__ struct sab82532_async_rw_regs rw; __volatile__ struct sab82532_async_rw_regs rw;
}; };
#define NR_PORTS 2
union sab82532_irq_status { union sab82532_irq_status {
unsigned short stat; unsigned short stat;
struct { struct {
...@@ -130,62 +123,10 @@ union sab82532_irq_status { ...@@ -130,62 +123,10 @@ union sab82532_irq_status {
} sreg; } sreg;
}; };
struct sab82532 {
int magic;
int baud_base;
union sab82532_async_regs *regs;
int irq;
int flags; /* defined in tty.h */
int type; /* SAB82532 version */
struct tty_struct *tty;
int read_status_mask;
int ignore_status_mask;
int timeout;
int xmit_fifo_size;
int recv_fifo_size;
int custom_divisor;
int baud;
unsigned int cec_timeout;
unsigned int tec_timeout;
int x_char;
int close_delay;
unsigned short closing_wait;
unsigned short closing_wait2;
unsigned long irqflags;
int is_console;
unsigned char interrupt_mask0;
unsigned char interrupt_mask1;
unsigned char pvr_dtr_bit;
unsigned char pvr_dsr_bit;
unsigned char dcd;
unsigned char cts;
unsigned char dsr;
unsigned long event;
unsigned long last_active;
int line;
int count;
int blocked_open;
long session;
long pgrp;
struct circ_buf xmit;
struct tq_struct tqueue;
struct tq_struct tqueue_hangup;
struct async_icount icount;
struct termios normal_termios;
struct termios callout_termios;
wait_queue_head_t open_wait;
wait_queue_head_t close_wait;
wait_queue_head_t delta_msr_wait;
struct sab82532 *next;
struct sab82532 *prev;
};
/* irqflags bits */ /* irqflags bits */
#define SAB82532_ALLS 0x00000001 #define SAB82532_ALLS 0x00000001
#define SAB82532_XPR 0x00000002 #define SAB82532_XPR 0x00000002
/* RFIFO Status Byte */ /* RFIFO Status Byte */
#define SAB82532_RSTAT_PE 0x80 #define SAB82532_RSTAT_PE 0x80
#define SAB82532_RSTAT_FE 0x40 #define SAB82532_RSTAT_FE 0x40
...@@ -377,4 +318,4 @@ struct sab82532 { ...@@ -377,4 +318,4 @@ struct sab82532 {
#define SAB82532_CCR4_ICD 0x10 #define SAB82532_CCR4_ICD 0x10
#endif /* !(_SPARC64_SAB82532_H) */ #endif /* !(_SUNSAB_H) */
...@@ -1362,7 +1362,7 @@ static void sunsu_console_write(struct console *co, const char *s, ...@@ -1362,7 +1362,7 @@ static void sunsu_console_write(struct console *co, const char *s,
static kdev_t sunsu_console_device(struct console *co) static kdev_t sunsu_console_device(struct console *co)
{ {
return mk_kdev(TTY_MAJOR, 64 + co->index); return mk_kdev(sunsu_reg.major, sunsu_reg.minor + co->index);
} }
/* /*
...@@ -1379,6 +1379,9 @@ static int __init sunsu_console_setup(struct console *co, char *options) ...@@ -1379,6 +1379,9 @@ static int __init sunsu_console_setup(struct console *co, char *options)
int parity = 'n'; int parity = 'n';
int flow = 'n'; int flow = 'n';
printk("Console: ttyS%d (SU)\n",
(sunsu_reg.minor - 64) + co->index);
/* /*
* Check whether an invalid uart number has been specified, and * Check whether an invalid uart number has been specified, and
* if so, search for the first available port that does have * if so, search for the first available port that does have
...@@ -1414,15 +1417,23 @@ static struct console sunsu_cons = { ...@@ -1414,15 +1417,23 @@ static struct console sunsu_cons = {
static int __init sunsu_serial_console_init(void) static int __init sunsu_serial_console_init(void)
{ {
int index; int i;
if (con_is_present()) if (con_is_present())
return 0; return 0;
index = serial_console - 1; for (i = 0; i < UART_NR; i++) {
if (sunsu_ports[index].port_node == 0) int this_minor = sunsu_reg.minor + i;
if ((this_minor - 64) == (serial_console - 1))
break;
}
if (i == UART_NR)
return 0; return 0;
sunsu_cons.index = index; if (sunsu_ports[i].port_node == 0)
return 0;
sunsu_cons.index = i;
register_console(&sunsu_cons); register_console(&sunsu_cons);
return 0; return 0;
} }
......
...@@ -1013,7 +1013,6 @@ static struct uart_driver sunzilog_reg = { ...@@ -1013,7 +1013,6 @@ static struct uart_driver sunzilog_reg = {
.dev_name = "ttyS", .dev_name = "ttyS",
#endif #endif
.major = TTY_MAJOR, .major = TTY_MAJOR,
.minor = 64,
}; };
static void * __init alloc_one_table(unsigned long size) static void * __init alloc_one_table(unsigned long size)
...@@ -1386,7 +1385,7 @@ sunzilog_console_write(struct console *con, const char *s, unsigned int count) ...@@ -1386,7 +1385,7 @@ sunzilog_console_write(struct console *con, const char *s, unsigned int count)
static kdev_t sunzilog_console_device(struct console *con) static kdev_t sunzilog_console_device(struct console *con)
{ {
return mk_kdev(TTY_MAJOR, 64 + con->index); return mk_kdev(sunzilog_reg.major, sunzilog_reg.minor + con->index);
} }
static int __init sunzilog_console_setup(struct console *con, char *options) static int __init sunzilog_console_setup(struct console *con, char *options)
...@@ -1395,7 +1394,8 @@ static int __init sunzilog_console_setup(struct console *con, char *options) ...@@ -1395,7 +1394,8 @@ static int __init sunzilog_console_setup(struct console *con, char *options)
unsigned long flags; unsigned long flags;
int baud, brg; int baud, brg;
printk("Console: ttyS%d (Zilog8530)\n", con->index / 2); printk("Console: ttyS%d (Zilog8530)\n",
(sunzilog_reg.minor - 64) + con->index);
/* Get firmware console settings. */ /* Get firmware console settings. */
sunserial_console_termios(con); sunserial_console_termios(con);
...@@ -1447,10 +1447,21 @@ static struct console sunzilog_console = { ...@@ -1447,10 +1447,21 @@ static struct console sunzilog_console = {
static int __init sunzilog_console_init(void) static int __init sunzilog_console_init(void)
{ {
int i;
if (con_is_present()) if (con_is_present())
return 0; return 0;
sunzilog_console.index = serial_console - 1; for (i = 0; i < NUM_CHANNELS; i++) {
int this_minor = sunzilog_reg.minor + i;
if ((this_minor - 64) == (serial_console - 1))
break;
}
if (i == NUM_CHANNELS)
return 0;
sunzilog_console.index = i;
register_console(&sunzilog_console); register_console(&sunzilog_console);
return 0; return 0;
} }
...@@ -1480,6 +1491,7 @@ static void __init sunzilog_prepare(void) ...@@ -1480,6 +1491,7 @@ static void __init sunzilog_prepare(void)
up[(chip * 2) + 0].port.uartclk = ZS_CLOCK; up[(chip * 2) + 0].port.uartclk = ZS_CLOCK;
up[(chip * 2) + 0].port.fifosize = 1; up[(chip * 2) + 0].port.fifosize = 1;
up[(chip * 2) + 0].port.ops = &sunzilog_pops; up[(chip * 2) + 0].port.ops = &sunzilog_pops;
up[(chip * 2) + 0].port.type = PORT_SUNZILOG;
up[(chip * 2) + 0].port.flags = 0; up[(chip * 2) + 0].port.flags = 0;
up[(chip * 2) + 0].port.line = (chip * 2) + 0; up[(chip * 2) + 0].port.line = (chip * 2) + 0;
up[(chip * 2) + 0].flags |= SUNZILOG_FLAG_IS_CHANNEL_A; up[(chip * 2) + 0].flags |= SUNZILOG_FLAG_IS_CHANNEL_A;
...@@ -1490,6 +1502,7 @@ static void __init sunzilog_prepare(void) ...@@ -1490,6 +1502,7 @@ static void __init sunzilog_prepare(void)
up[(chip * 2) + 1].port.uartclk = ZS_CLOCK; up[(chip * 2) + 1].port.uartclk = ZS_CLOCK;
up[(chip * 2) + 1].port.fifosize = 1; up[(chip * 2) + 1].port.fifosize = 1;
up[(chip * 2) + 1].port.ops = &sunzilog_pops; up[(chip * 2) + 1].port.ops = &sunzilog_pops;
up[(chip * 2) + 1].port.type = PORT_SUNZILOG;
up[(chip * 2) + 1].port.flags = 0; up[(chip * 2) + 1].port.flags = 0;
up[(chip * 2) + 1].port.line = (chip * 2) + 1; up[(chip * 2) + 1].port.line = (chip * 2) + 1;
up[(chip * 2) + 1].flags |= 0; up[(chip * 2) + 1].flags |= 0;
...@@ -1607,12 +1620,10 @@ static int __init sunzilog_ports_init(void) ...@@ -1607,12 +1620,10 @@ static int __init sunzilog_ports_init(void)
* in the system. * in the system.
*/ */
sunzilog_reg.nr = NUM_CHANNELS; sunzilog_reg.nr = NUM_CHANNELS;
#ifdef CONFIG_SERIAL_CONSOLE
sunzilog_reg.cons = &sunzilog_console; sunzilog_reg.cons = &sunzilog_console;
#else
sunzilog_reg.cons = NULL; sunzilog_reg.minor = sunserial_current_minor;
#endif sunserial_current_minor += NUM_CHANNELS;
ret = uart_register_driver(&sunzilog_reg); ret = uart_register_driver(&sunzilog_reg);
if (ret == 0) { if (ret == 0) {
......
...@@ -51,6 +51,10 @@ ...@@ -51,6 +51,10 @@
#define PORT_UART00 35 #define PORT_UART00 35
#define PORT_21285 37 #define PORT_21285 37
/* Sparc type numbers. */
#define PORT_SUNZILOG 38
#define PORT_SUNSAB 39
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/config.h> #include <linux/config.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment