Commit 3cbbbd88 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://bk.arm.linux.org.uk/linux-2.6-serial

into home.osdl.org:/home/torvalds/v2.5/linux
parents 7a9df5e2 3cd30bf0
......@@ -122,6 +122,7 @@ struct uart_8250_port {
struct uart_port port;
struct timer_list timer; /* "no irq" timer */
struct list_head list; /* ports on this IRQ */
unsigned int capabilities; /* port capabilities */
unsigned short rev;
unsigned char acr;
unsigned char ier;
......@@ -683,6 +684,7 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags)
serial_outp(up, UART_LCR, save_lcr);
up->port.fifosize = uart_config[up->port.type].dfl_xmit_fifo_size;
up->capabilities = uart_config[up->port.type].flags;
if (up->port.type == PORT_UNKNOWN)
goto out;
......@@ -1190,6 +1192,8 @@ static int serial8250_startup(struct uart_port *port)
unsigned long flags;
int retval;
up->capabilities = uart_config[up->port.type].flags;
if (up->port.type == PORT_16C950) {
/* Wake up and initialize UART */
up->acr = 0;
......@@ -1215,7 +1219,7 @@ static int serial8250_startup(struct uart_port *port)
* Clear the FIFO buffers and disable them.
* (they will be reeanbled in set_termios())
*/
if (uart_config[up->port.type].flags & UART_CLEAR_FIFO) {
if (up->capabilities & UART_CLEAR_FIFO) {
serial_outp(up, UART_FCR, UART_FCR_ENABLE_FIFO);
serial_outp(up, UART_FCR, UART_FCR_ENABLE_FIFO |
UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT);
......@@ -1428,7 +1432,7 @@ serial8250_set_termios(struct uart_port *port, struct termios *termios,
up->rev == 0x5201)
quot ++;
if (uart_config[up->port.type].flags & UART_USE_FIFO) {
if (up->capabilities & UART_USE_FIFO) {
if (baud < 2400)
fcr = UART_FCR_ENABLE_FIFO | UART_FCR_TRIGGER_1;
#ifdef CONFIG_SERIAL_8250_RSA
......@@ -1489,13 +1493,13 @@ serial8250_set_termios(struct uart_port *port, struct termios *termios,
serial_out(up, UART_IER, up->ier);
if (uart_config[up->port.type].flags & UART_STARTECH) {
if (up->capabilities & UART_STARTECH) {
serial_outp(up, UART_LCR, 0xBF);
serial_outp(up, UART_EFR,
termios->c_cflag & CRTSCTS ? UART_EFR_CTS :0);
}
if (uart_config[up->port.type].flags & UART_NATSEMI) {
if (up->capabilities & UART_NATSEMI) {
/* Switch to bank 2 not bank 1, to avoid resetting EXCR2 */
serial_outp(up, UART_LCR, 0xe0);
} else {
......@@ -1524,7 +1528,7 @@ serial8250_pm(struct uart_port *port, unsigned int state,
struct uart_8250_port *up = (struct uart_8250_port *)port;
if (state) {
/* sleep */
if (uart_config[up->port.type].flags & UART_STARTECH) {
if (up->capabilities & UART_STARTECH) {
/* Arrange to enter sleep mode */
serial_outp(up, UART_LCR, 0xBF);
serial_outp(up, UART_EFR, UART_EFR_ECB);
......@@ -1543,7 +1547,7 @@ serial8250_pm(struct uart_port *port, unsigned int state,
up->pm(port, state, oldstate);
} else {
/* wake */
if (uart_config[up->port.type].flags & UART_STARTECH) {
if (up->capabilities & UART_STARTECH) {
/* Wake up UART */
serial_outp(up, UART_LCR, 0xBF);
serial_outp(up, UART_EFR, UART_EFR_ECB);
......@@ -2101,9 +2105,9 @@ void serial8250_get_irq_map(unsigned int *map)
*
* Suspend one serial port.
*/
void serial8250_suspend_port(int line, u32 level)
void serial8250_suspend_port(int line)
{
uart_suspend_port(&serial8250_reg, &serial8250_ports[line].port, level);
uart_suspend_port(&serial8250_reg, &serial8250_ports[line].port);
}
/**
......@@ -2112,9 +2116,9 @@ void serial8250_suspend_port(int line, u32 level)
*
* Resume one serial port.
*/
void serial8250_resume_port(int line, u32 level)
void serial8250_resume_port(int line)
{
uart_resume_port(&serial8250_reg, &serial8250_ports[line].port, level);
uart_resume_port(&serial8250_reg, &serial8250_ports[line].port);
}
static int __init serial8250_init(void)
......
......@@ -27,8 +27,8 @@ struct serial8250_probe {
int serial8250_register_probe(struct serial8250_probe *probe);
void serial8250_unregister_probe(struct serial8250_probe *probe);
void serial8250_get_irq_map(unsigned int *map);
void serial8250_suspend_port(int line, u32 level);
void serial8250_resume_port(int line, u32 level);
void serial8250_suspend_port(int line);
void serial8250_resume_port(int line);
struct old_serial_port {
unsigned int uart;
......
......@@ -1600,19 +1600,6 @@ static void __devexit pciserial_remove_one(struct pci_dev *dev)
}
}
static int pciserial_save_state_one(struct pci_dev *dev, u32 state)
{
struct serial_private *priv = pci_get_drvdata(dev);
if (priv) {
int i;
for (i = 0; i < priv->nr; i++)
serial8250_suspend_port(priv->line[i], SUSPEND_SAVE_STATE);
}
return 0;
}
static int pciserial_suspend_one(struct pci_dev *dev, u32 state)
{
struct serial_private *priv = pci_get_drvdata(dev);
......@@ -1621,7 +1608,7 @@ static int pciserial_suspend_one(struct pci_dev *dev, u32 state)
int i;
for (i = 0; i < priv->nr; i++)
serial8250_suspend_port(priv->line[i], SUSPEND_POWER_DOWN);
serial8250_suspend_port(priv->line[i]);
}
return 0;
}
......@@ -1639,10 +1626,8 @@ static int pciserial_resume_one(struct pci_dev *dev)
if (priv->quirk->init)
priv->quirk->init(dev);
for (i = 0; i < priv->nr; i++) {
serial8250_resume_port(priv->line[i], RESUME_POWER_ON);
serial8250_resume_port(priv->line[i], RESUME_RESTORE_STATE);
}
for (i = 0; i < priv->nr; i++)
serial8250_resume_port(priv->line[i]);
}
return 0;
}
......@@ -2040,7 +2025,6 @@ static struct pci_driver serial_pci_driver = {
.name = "serial",
.probe = pciserial_init_one,
.remove = __devexit_p(pciserial_remove_one),
.save_state = pciserial_save_state_one,
.suspend = pciserial_suspend_one,
.resume = pciserial_resume_one,
.id_table = serial_pci_tbl,
......
......@@ -10,6 +10,7 @@ menu "Serial drivers"
# The new 8250/16550 serial drivers
config SERIAL_8250
tristate "8250/16550 and compatible serial support"
select SERIAL_CORE
---help---
This selects whether you want to include the driver for the standard
serial ports. The standard answer is Y. People who might say N
......@@ -41,6 +42,7 @@ config SERIAL_8250
config SERIAL_8250_CONSOLE
bool "Console on 8250/16550 and compatible serial port"
depends on SERIAL_8250=y
select SERIAL_CORE_CONSOLE
---help---
If you say Y here, it will be possible to use a serial port as the
system console (the system console is the device which receives all
......@@ -167,12 +169,14 @@ config SERIAL_8250_ACORN
config SERIAL_ANAKIN
bool "Anakin serial port support"
depends on ARM && ARCH_ANAKIN
select SERIAL_CORE
help
::: To be written :::
config SERIAL_ANAKIN_CONSOLE
bool "Console on Anakin serial port"
depends on SERIAL_ANAKIN
select SERIAL_CORE_CONSOLE
help
Even if you say Y here, the currently visible virtual console
(/dev/tty0) will still be used as the system console by default, but
......@@ -190,7 +194,8 @@ config ANAKIN_DEFAULT_BAUDRATE
config SERIAL_AMBA
tristate "ARM AMBA serial port support"
depends on ARM && ARCH_INTEGRATOR
depends on ARM_AMBA
select SERIAL_CORE
help
This selects the ARM(R) AMBA(R) PrimeCell UART. If you have an
Integrator platform, say Y or M here.
......@@ -200,6 +205,7 @@ config SERIAL_AMBA
config SERIAL_AMBA_CONSOLE
bool "Support for console on AMBA serial port"
depends on SERIAL_AMBA=y
select SERIAL_CORE_CONSOLE
---help---
Say Y here if you wish to use an AMBA PrimeCell UART as the system
console (the system console is the device which receives all kernel
......@@ -214,18 +220,20 @@ config SERIAL_AMBA_CONSOLE
config SERIAL_INTEGRATOR
bool
depends on SERIAL_AMBA=y
depends on SERIAL_AMBA && ARCH_INTEGRATOR
default y
config SERIAL_CLPS711X
tristate "CLPS711X serial port support"
depends on ARM && ARCH_CLPS711X
select SERIAL_CORE
help
::: To be written :::
config SERIAL_CLPS711X_CONSOLE
bool "Support for console on CLPS711X serial port"
depends on SERIAL_CLPS711X=y
select SERIAL_CORE_CONSOLE
help
Even if you say Y here, the currently visible virtual console
(/dev/tty0) will still be used as the system console by default, but
......@@ -243,6 +251,7 @@ config SERIAL_CLPS711X_OLD_NAME
config SERIAL_21285
tristate "DC21285 serial port support"
depends on ARM && FOOTBRIDGE
select SERIAL_CORE
help
If you have a machine based on a 21285 (Footbridge) StrongARM(R)/
PCI bridge you can enable its onboard serial port by enabling this
......@@ -258,6 +267,7 @@ config SERIAL_21285_OLD
config SERIAL_21285_CONSOLE
bool "Console on DC21285 serial port"
depends on SERIAL_21285=y
select SERIAL_CORE_CONSOLE
help
If you have enabled the serial port on the 21285 footbridge you can
make it the console by answering Y to this option.
......@@ -272,6 +282,7 @@ config SERIAL_21285_CONSOLE
config SERIAL_UART00
bool "Excalibur serial port (uart00) support"
depends on ARM && ARCH_CAMELOT
select SERIAL_CORE
help
Say Y here if you want to use the hard logic uart on Excalibur. This
driver also supports soft logic implentations of this uart core.
......@@ -279,6 +290,7 @@ config SERIAL_UART00
config SERIAL_UART00_CONSOLE
bool "Support for console on Excalibur serial port"
depends on SERIAL_UART00
select SERIAL_CORE_CONSOLE
help
Say Y here if you want to support a serial console on an Excalibur
hard logic uart or uart00 IP core.
......@@ -293,6 +305,7 @@ config SERIAL_UART00_CONSOLE
config SERIAL_SA1100
bool "SA1100 serial port support"
depends on ARM && ARCH_SA1100
select SERIAL_CORE
help
If you have a machine based on a SA1100/SA1110 StrongARM(R) CPU you
can enable its onboard serial port by enabling this option.
......@@ -302,6 +315,7 @@ config SERIAL_SA1100
config SERIAL_SA1100_CONSOLE
bool "Console on SA1100 serial port"
depends on SERIAL_SA1100
select SERIAL_CORE_CONSOLE
help
If you have enabled the serial port on the SA1100/SA1110 StrongARM
CPU you can make it the console by answering Y to this option.
......@@ -316,6 +330,8 @@ config SERIAL_SA1100_CONSOLE
config SERIAL_SUNCORE
bool
depends on SPARC32 || SPARC64
select SERIAL_CORE
select SERIAL_CORE_CONSOLE
default y
config SERIAL_SUNZILOG
......@@ -352,6 +368,7 @@ config SERIAL_SUNSU_CONSOLE
config SERIAL_MUX
tristate "Serial MUX support"
depends on PARISC
select SERIAL_CORE
default y
---help---
Saying Y here will enable the hardware MUX serial driver for
......@@ -369,6 +386,7 @@ config SERIAL_MUX
config SERIAL_MUX_CONSOLE
bool "Support for console on serial MUX"
depends on SERIAL_MUX
select SERIAL_CORE_CONSOLE
default y
config PDC_CONSOLE
......@@ -406,6 +424,7 @@ config SERIAL_SUNSAB_CONSOLE
config V850E_UART
bool "NEC V850E on-chip UART support"
depends on V850E_MA1 || V850E_ME2 || V850E_TEG || V850E2_ANNA || V850E_AS85EP1
select SERIAL_CORE
default y
config V850E_UARTB
......@@ -416,10 +435,12 @@ config V850E_UARTB
config V850E_UART_CONSOLE
bool "Use NEC V850E on-chip UART for console"
depends on V850E_UART
select SERIAL_CORE_CONSOLE
config SERIAL98
tristate "PC-9800 8251-based primary serial port support"
depends on X86_PC9800
select SERIAL_CORE
help
If you want to use standard primary serial ports on PC-9800,
say Y. Otherwise, say N.
......@@ -427,16 +448,13 @@ config SERIAL98
config SERIAL98_CONSOLE
bool "Support for console on PC-9800 standard serial port"
depends on SERIAL98=y
select SERIAL_CORE_CONSOLE
config SERIAL_CORE
tristate
default m if SERIAL_AMBA!=y && SERIAL_CLPS711X!=y && SERIAL_21285!=y && !SERIAL_SA1100 && !SERIAL_ANAKIN && !SERIAL_UART00 && SERIAL_8250!=y && SERIAL_MUX!=y && !SERIAL_ROCKETPORT && !SERIAL_SUNCORE && !V850E_UART && SERIAL_PMACZILOG!=y && (SERIAL_AMBA=m || SERIAL_CLPS711X=m || SERIAL_21285=m || SERIAL_8250=m || SERIAL_MUX=m || SERIAL98=m || SERIAL_PMACZILOG=m)
default y if SERIAL_AMBA=y || SERIAL_CLPS711X=y || SERIAL_21285=y || SERIAL_SA1100 || SERIAL_ANAKIN || SERIAL_UART00 || SERIAL_8250=y || SERIAL_MUX=y || SERIAL_ROCKETPORT || SERIAL_SUNCORE || V850E_UART || SERIAL98=y || SERIAL_PMACZILOG=y
config SERIAL_CORE_CONSOLE
bool
depends on SERIAL_AMBA_CONSOLE || SERIAL_CLPS711X_CONSOLE || SERIAL_21285_CONSOLE || SERIAL_SA1100_CONSOLE || SERIAL_ANAKIN_CONSOLE || SERIAL_UART00_CONSOLE || SERIAL_8250_CONSOLE || SERIAL_MUX_CONSOLE || SERIAL_SUNZILOG_CONSOLE || SERIAL_SUNSU_CONSOLE || SERIAL_SUNSAB_CONSOLE || V850E_UART_CONSOLE || SERIAL98_CONSOLE || SERIAL_PMACZILOG_CONSOLE
default y
config SERIAL_68328
bool "68328 serial support"
......@@ -476,6 +494,7 @@ config SERIAL_68360
config SERIAL_PMACZILOG
tristate "PowerMac z85c30 ESCC support"
depends on PPC_OF
select SERIAL_CORE
help
This driver supports the Zilog z85C30 serial ports found on
PowerMac machines.
......@@ -484,6 +503,7 @@ config SERIAL_PMACZILOG
config SERIAL_PMACZILOG_CONSOLE
bool "Console on PowerMac z85c30 serial port"
depends on SERIAL_PMACZILOG=y
select SERIAL_CORE_CONSOLE
help
If you would like to be able to use the z85c30 serial port
on your PowerMac as the console, you can do so by answering
......
......@@ -11,10 +11,10 @@ serial-8250-$(CONFIG_PNP) += 8250_pnp.o
serial-8250-$(CONFIG_SERIAL_8250_HCDP) += 8250_hcdp.o
serial-8250-$(CONFIG_SERIAL_8250_ACPI) += 8250_acpi.o
obj-$(CONFIG_SERIAL_CORE) += core.o
obj-$(CONFIG_SERIAL_CORE) += serial_core.o
obj-$(CONFIG_SERIAL_21285) += 21285.o
obj-$(CONFIG_SERIAL_8250) += 8250.o $(serial-8250-y)
obj-$(CONFIG_SERIAL_8250_CS) += 8250_cs.o
obj-$(CONFIG_SERIAL_8250_CS) += serial_cs.o
obj-$(CONFIG_SERIAL_8250_ACORN) += 8250_acorn.o
obj-$(CONFIG_SERIAL_ANAKIN) += anakin.o
obj-$(CONFIG_SERIAL_AMBA) += amba.o
......
......@@ -104,7 +104,7 @@ static void clps711xuart_enable_ms(struct uart_port *port)
{
}
static void clps711xuart_int_rx(int irq, void *dev_id, struct pt_regs *regs)
static irqreturn_t clps711xuart_int_rx(int irq, void *dev_id, struct pt_regs *regs)
{
struct uart_port *port = dev_id;
struct tty_struct *tty = port->info->tty;
......@@ -139,7 +139,7 @@ static void clps711xuart_int_rx(int irq, void *dev_id, struct pt_regs *regs)
}
out:
tty_flip_buffer_push(tty);
return;
return IRQ_HANDLED;
handle_error:
if (ch & UARTDR_PARERR)
......@@ -180,7 +180,7 @@ static void clps711xuart_int_rx(int irq, void *dev_id, struct pt_regs *regs)
goto error_return;
}
static void clps711xuart_int_tx(int irq, void *dev_id, struct pt_regs *regs)
static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id, struct pt_regs *regs)
{
struct uart_port *port = dev_id;
struct circ_buf *xmit = &port->info->xmit;
......@@ -190,11 +190,11 @@ static void clps711xuart_int_tx(int irq, void *dev_id, struct pt_regs *regs)
clps_writel(port->x_char, UARTDR(port));
port->icount.tx++;
port->x_char = 0;
return;
return IRQ_HANDLED;
}
if (uart_circ_empty(xmit) || uart_tx_stopped(port)) {
clps711xuart_stop_tx(port, 0);
return;
return IRQ_HANDLED;
}
count = port->fifosize >> 1;
......@@ -211,6 +211,8 @@ static void clps711xuart_int_tx(int irq, void *dev_id, struct pt_regs *regs)
if (uart_circ_empty(xmit))
clps711xuart_stop_tx(port, 0);
return IRQ_HANDLED;
}
static unsigned int clps711xuart_tx_empty(struct uart_port *port)
......
......@@ -862,8 +862,8 @@ static int sa1100_serial_suspend(struct device *_dev, u32 state, u32 level)
{
struct sa1100_port *sport = dev_get_drvdata(_dev);
if (sport)
uart_suspend_port(&sa1100_reg, &sport->port, level);
if (sport && level == SUSPEND_DISABLE)
uart_suspend_port(&sa1100_reg, &sport->port);
return 0;
}
......@@ -872,8 +872,8 @@ static int sa1100_serial_resume(struct device *_dev, u32 level)
{
struct sa1100_port *sport = dev_get_drvdata(_dev);
if (sport)
uart_resume_port(&sa1100_reg, &sport->port, level);
if (sport && level == RESUME_ENABLE)
uart_resume_port(&sa1100_reg, &sport->port);
return 0;
}
......
......@@ -1875,84 +1875,72 @@ static void uart_change_pm(struct uart_state *state, int pm_state)
state->pm_state = pm_state;
}
int uart_suspend_port(struct uart_driver *drv, struct uart_port *port, u32 level)
int uart_suspend_port(struct uart_driver *drv, struct uart_port *port)
{
struct uart_state *state = drv->state + port->line;
down(&state->sem);
switch (level) {
case SUSPEND_SAVE_STATE:
if (state->info && state->info->flags & UIF_INITIALIZED) {
struct uart_ops *ops = port->ops;
if (state->info && state->info->flags & UIF_INITIALIZED) {
struct uart_ops *ops = port->ops;
spin_lock_irq(&port->lock);
ops->stop_tx(port, 0);
ops->set_mctrl(port, 0);
ops->stop_rx(port);
spin_unlock_irq(&port->lock);
/*
* Wait for the transmitter to empty.
*/
while (!ops->tx_empty(port)) {
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(10*HZ/1000);
}
set_current_state(TASK_RUNNING);
ops->shutdown(port);
}
break;
spin_lock_irq(&port->lock);
ops->stop_tx(port, 0);
ops->set_mctrl(port, 0);
ops->stop_rx(port);
spin_unlock_irq(&port->lock);
case SUSPEND_POWER_DOWN:
/*
* Disable the console device before suspending.
* Wait for the transmitter to empty.
*/
if (uart_console(port))
port->cons->flags &= ~CON_ENABLED;
while (!ops->tx_empty(port)) {
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(10*HZ/1000);
}
set_current_state(TASK_RUNNING);
uart_change_pm(state, 3);
break;
ops->shutdown(port);
}
/*
* Disable the console device before suspending.
*/
if (uart_console(port))
port->cons->flags &= ~CON_ENABLED;
uart_change_pm(state, 3);
up(&state->sem);
return 0;
}
int uart_resume_port(struct uart_driver *drv, struct uart_port *port, u32 level)
int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
{
struct uart_state *state = drv->state + port->line;
down(&state->sem);
switch (level) {
case RESUME_POWER_ON:
uart_change_pm(state, 0);
uart_change_pm(state, 0);
/*
* Re-enable the console device after suspending.
*/
if (uart_console(port)) {
uart_change_speed(state, NULL);
port->cons->flags |= CON_ENABLED;
}
break;
/*
* Re-enable the console device after suspending.
*/
if (uart_console(port)) {
uart_change_speed(state, NULL);
port->cons->flags |= CON_ENABLED;
}
case RESUME_RESTORE_STATE:
if (state->info && state->info->flags & UIF_INITIALIZED) {
struct uart_ops *ops = port->ops;
if (state->info && state->info->flags & UIF_INITIALIZED) {
struct uart_ops *ops = port->ops;
ops->set_mctrl(port, 0);
ops->startup(port);
uart_change_speed(state, NULL);
spin_lock_irq(&port->lock);
ops->set_mctrl(port, port->mctrl);
ops->start_tx(port, 0);
spin_unlock_irq(&port->lock);
}
break;
ops->set_mctrl(port, 0);
ops->startup(port);
uart_change_speed(state, NULL);
spin_lock_irq(&port->lock);
ops->set_mctrl(port, port->mctrl);
ops->start_tx(port, 0);
spin_unlock_irq(&port->lock);
}
up(&state->sem);
......
......@@ -67,6 +67,12 @@
#define PORT_PC9861 45
#define PORT_PC9801_101 46
/* DZ */
#define PORT_DZ 47
/* Parisc type numbers. */
#define PORT_MUX 48
/* Macintosh Zilog type numbers */
#define PORT_MAC_ZILOG 50 /* m68k : not yet implemented */
#define PORT_PMAC_ZILOG 51
......@@ -319,8 +325,8 @@ int uart_remove_one_port(struct uart_driver *reg, struct uart_port *port);
/*
* Power Management
*/
int uart_suspend_port(struct uart_driver *reg, struct uart_port *port, u32 level);
int uart_resume_port(struct uart_driver *reg, struct uart_port *port, u32 level);
int uart_suspend_port(struct uart_driver *reg, struct uart_port *port);
int uart_resume_port(struct uart_driver *reg, struct uart_port *port);
#define uart_circ_empty(circ) ((circ)->head == (circ)->tail)
#define uart_circ_clear(circ) ((circ)->head = (circ)->tail = 0)
......
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