Commit 85b34e48 authored by Linus Torvalds's avatar Linus Torvalds

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

into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents 0f31b37c 2a2b8976
......@@ -31,7 +31,7 @@
#include <linux/cpu.h>
#include <linux/unistd.h>
#include <linux/serial.h>
#include <linux/8250.h>
#include <linux/serial_8250.h>
#include <asm/io.h>
#include <asm/prom.h>
#include <asm/processor.h>
......@@ -901,7 +901,7 @@ static int __init set_preferred_console(void)
DBG("Found serial console at ttyS%d\n", offset);
if (spd) {
char opt[16];
static char __initdata opt[16];
sprintf(opt, "%d", *spd);
return add_preferred_console("ttyS", offset, opt);
} else
......@@ -1123,8 +1123,8 @@ __setup("decr_overclock=", set_decr_overclock );
*/
#define MAX_LEGACY_SERIAL_PORTS 8
static struct old_serial_port old_serial_ports[MAX_LEGACY_SERIAL_PORTS];
static unsigned int old_serial_count;
static struct plat_serial8250_port serial_ports[MAX_LEGACY_SERIAL_PORTS+1];
static unsigned int old_serial_count;
void __init generic_find_legacy_serial_ports(unsigned int *default_speed)
{
......@@ -1202,13 +1202,13 @@ void __init generic_find_legacy_serial_ports(unsigned int *default_speed)
if (index >= old_serial_count)
old_serial_count = index + 1;
/* Check if there is a port who already claimed our slot */
if (old_serial_ports[index].port != 0) {
if (serial_ports[index].iobase != 0) {
/* if we still have some room, move it, else override */
if (old_serial_count < MAX_LEGACY_SERIAL_PORTS) {
DBG("Moved legacy port %d -> %d\n", index,
old_serial_count);
old_serial_ports[old_serial_count++] =
old_serial_ports[index];
serial_ports[old_serial_count++] =
serial_ports[index];
} else {
DBG("Replacing legacy port %d\n", index);
}
......@@ -1220,18 +1220,17 @@ void __init generic_find_legacy_serial_ports(unsigned int *default_speed)
old_serial_count = index + 1;
/* Now fill the entry */
memset(&old_serial_ports[index], 0, sizeof(struct old_serial_port));
old_serial_ports[index].uart = 0;
old_serial_ports[index].baud_base = clk ? (*clk / 16) : BASE_BAUD;
old_serial_ports[index].port = reg->address;
old_serial_ports[index].irq = interrupts ? interrupts[0] : 0;
old_serial_ports[index].flags = ASYNC_BOOT_AUTOCONF;
memset(&serial_ports[index], 0, sizeof(struct plat_serial8250_port));
serial_ports[index].uartclk = clk ? *clk : BASE_BAUD * 16;
serial_ports[index].iobase = reg->address;
serial_ports[index].irq = interrupts ? interrupts[0] : 0;
serial_ports[index].flags = ASYNC_BOOT_AUTOCONF;
DBG("Added legacy port, index: %d, port: %x, irq: %d, clk: %d\n",
index,
old_serial_ports[index].port,
old_serial_ports[index].irq,
old_serial_ports[index].baud_base * 16);
serial_ports[index].iobase,
serial_ports[index].irq,
serial_ports[index].uartclk);
/* Get phys address of IO reg for port 1 */
if (index != 0)
......@@ -1279,19 +1278,21 @@ void __init generic_find_legacy_serial_ports(unsigned int *default_speed)
DBG(" <- generic_find_legacy_serial_port()\n");
}
struct old_serial_port *get_legacy_serial_ports(unsigned int *count)
{
*count = old_serial_count;
return old_serial_ports;
}
#else
struct old_serial_port *get_legacy_serial_ports(unsigned int *count)
static struct platform_device serial_device = {
.name = "serial8250",
.id = 0,
.dev = {
.platform_data = serial_ports,
},
};
static int __init serial_dev_init(void)
{
*count = 0;
return 0;
return platform_device_register(&serial_device);
}
arch_initcall(serial_dev_init);
#endif /* CONFIG_PPC_ISERIES */
EXPORT_SYMBOL(get_legacy_serial_ports);
int check_legacy_ioport(unsigned long base_port)
{
......
......@@ -35,6 +35,7 @@
#include <linux/init.h>
#include <linux/pm.h>
#include <linux/bitops.h>
#include <linux/delay.h>
#include <asm/io.h>
#include <asm/irq.h>
......@@ -997,7 +998,7 @@ static void send_break( struct m68k_serial * info, int duration)
unsigned long flags;
if (!info->port)
return;
current->state = TASK_INTERRUPTIBLE;
set_current_state(TASK_INTERRUPTIBLE);
save_flags(flags);
cli();
#ifdef USE_INTS
......@@ -1189,8 +1190,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
#endif
if (info->blocked_open) {
if (info->close_delay) {
current->state = TASK_INTERRUPTIBLE;
schedule_timeout(info->close_delay);
msleep_interruptible(jiffies_to_msecs(info->close_delay));
}
wake_up_interruptible(&info->open_wait);
}
......
......@@ -1396,7 +1396,7 @@ static void end_break(ser_info_t *info)
*/
static void send_break(ser_info_t *info, int duration)
{
current->state = TASK_INTERRUPTIBLE;
set_current_state(TASK_INTERRUPTIBLE);
#ifdef SERIAL_DEBUG_SEND_BREAK
printk("rs_send_break(%d) jiff=%lu...", duration, jiffies);
#endif
......@@ -1707,8 +1707,7 @@ static void rs_360_close(struct tty_struct *tty, struct file * filp)
info->tty = 0;
if (info->blocked_open) {
if (info->close_delay) {
current->state = TASK_INTERRUPTIBLE;
schedule_timeout(info->close_delay);
msleep_interruptible(jiffies_to_msecs(info->close_delay));
}
wake_up_interruptible(&info->open_wait);
}
......@@ -1761,9 +1760,8 @@ static void rs_360_wait_until_sent(struct tty_struct *tty, int timeout)
#ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT
printk("lsr = %d (jiff=%lu)...", lsr, jiffies);
#endif
current->state = TASK_INTERRUPTIBLE;
/* current->counter = 0; make us low-priority */
schedule_timeout(char_time);
msleep_interruptible(jiffies_to_msecs(char_time));
if (signal_pending(current))
break;
if (timeout && ((orig_jiffies + timeout) < jiffies))
......
This diff is collapsed.
......@@ -19,7 +19,6 @@
int serial8250_register_port(struct uart_port *);
void serial8250_unregister_port(int line);
void serial8250_get_irq_map(unsigned int *map);
void serial8250_suspend_port(int line);
void serial8250_resume_port(int line);
......@@ -73,3 +72,14 @@ struct serial8250_config {
#else
#define SERIAL8250_SHARE_IRQS 0
#endif
#if defined(__alpha__) && !defined(CONFIG_PCI)
/*
* Digital did something really horribly wrong with the OUT1 and OUT2
* lines on at least some ALPHA's. The failure mode is that if either
* is cleared, the machine locks up with endless interrupts.
*/
#define ALPHA_KLUDGE_MCR (UART_MCR_OUT2 | UART_MCR_OUT1)
#else
#define ALPHA_KLUDGE_MCR 0
#endif
......@@ -11,7 +11,6 @@
#include <linux/types.h>
#include <linux/tty.h>
#include <linux/serial_core.h>
#include <linux/serial.h>
#include <linux/errno.h>
#include <linux/ioport.h>
#include <linux/slab.h>
......@@ -22,11 +21,13 @@
#include <asm/ecard.h>
#include <asm/string.h>
#include "8250.h"
#define MAX_PORTS 3
struct serial_card_type {
unsigned int num_ports;
unsigned int baud_base;
unsigned int uartclk;
unsigned int type;
unsigned int offset[MAX_PORTS];
};
......@@ -36,31 +37,15 @@ struct serial_card_info {
int ports[MAX_PORTS];
};
static inline int
serial_register_onedev(unsigned long baddr, void *vaddr, int irq, unsigned int baud_base)
{
struct serial_struct req;
memset(&req, 0, sizeof(req));
req.irq = irq;
req.flags = UPF_AUTOPROBE | UPF_SHARE_IRQ;
req.baud_base = baud_base;
req.io_type = UPIO_MEM;
req.iomem_base = vaddr;
req.iomem_reg_shift = 2;
req.iomap_base = baddr;
return register_serial(&req);
}
static int __devinit
serial_card_probe(struct expansion_card *ec, const struct ecard_id *id)
{
struct serial_card_info *info;
struct serial_card_type *type = id->data;
struct uart_port port;
unsigned long bus_addr;
unsigned char *virt_addr;
unsigned int port;
unsigned char __iomem *virt_addr;
unsigned int i;
info = kmalloc(sizeof(struct serial_card_info), GFP_KERNEL);
if (!info)
......@@ -69,21 +54,28 @@ serial_card_probe(struct expansion_card *ec, const struct ecard_id *id)
memset(info, 0, sizeof(struct serial_card_info));
info->num_ports = type->num_ports;
ecard_set_drvdata(ec, info);
bus_addr = ec->resource[type->type].start;
virt_addr = ioremap(bus_addr, ec->resource[type->type].end - bus_addr + 1);
bus_addr = ecard_resource_start(ec, type->type);
virt_addr = ioremap(bus_addr, ecard_resource_len(ec, type->type));
if (!virt_addr) {
kfree(info);
return -ENOMEM;
}
for (port = 0; port < info->num_ports; port ++) {
unsigned long baddr = bus_addr + type->offset[port];
unsigned char *vaddr = virt_addr + type->offset[port];
ecard_set_drvdata(ec, info);
memset(&port, 0, sizeof(struct uart_port));
port.irq = ec->irq;
port.flags = UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ;
port.uartclk = type->uartclk;
port.iotype = UPIO_MEM;
port.regshift = 2;
port.dev = &ec->dev;
for (i = 0; i < info->num_ports; i ++) {
port.membase = virt_addr + type->offset[i];
port.mapbase = bus_addr + type->offset[i];
info->ports[port] = serial_register_onedev(baddr, vaddr,
ec->irq, type->baud_base);
info->ports[i] = serial8250_register_port(&port);
}
return 0;
......@@ -98,21 +90,21 @@ static void __devexit serial_card_remove(struct expansion_card *ec)
for (i = 0; i < info->num_ports; i++)
if (info->ports[i] > 0)
unregister_serial(info->ports[i]);
serial8250_unregister_port(info->ports[i]);
kfree(info);
}
static struct serial_card_type atomwide_type = {
.num_ports = 3,
.baud_base = 7372800 / 16,
.uartclk = 7372800,
.type = ECARD_RES_IOCSLOW,
.offset = { 0x2800, 0x2400, 0x2000 },
};
static struct serial_card_type serport_type = {
.num_ports = 2,
.baud_base = 3686400 / 16,
.uartclk = 3686400,
.type = ECARD_RES_IOCSLOW,
.offset = { 0x2000, 0x2020 },
};
......@@ -128,7 +120,7 @@ static struct ecard_driver serial_card_driver = {
.remove = __devexit_p(serial_card_remove),
.id_table = serial_cids,
.drv = {
.name = "8250_acorn",
.name = "8250_acorn",
},
};
......
......@@ -12,81 +12,71 @@
#include <linux/acpi.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/tty.h>
#include <linux/serial.h>
#include <linux/serial_core.h>
#include <acpi/acpi_bus.h>
#include <asm/io.h>
#include <asm/serial.h>
#include "8250.h"
struct serial_private {
int line;
void *iomem_base;
};
static acpi_status acpi_serial_mmio(struct serial_struct *req,
static acpi_status acpi_serial_mmio(struct uart_port *port,
struct acpi_resource_address64 *addr)
{
unsigned long size;
size = addr->max_address_range - addr->min_address_range + 1;
req->iomap_base = addr->min_address_range;
req->iomem_base = ioremap(req->iomap_base, size);
if (!req->iomem_base) {
printk(KERN_ERR "%s: couldn't ioremap 0x%lx-0x%lx\n",
__FUNCTION__, req->iomap_base, req->iomap_base + size);
return AE_ERROR;
}
req->io_type = SERIAL_IO_MEM;
port->mapbase = addr->min_address_range;
port->iotype = UPIO_MEM;
port->flags |= UPF_IOREMAP;
return AE_OK;
}
static acpi_status acpi_serial_port(struct serial_struct *req,
static acpi_status acpi_serial_port(struct uart_port *port,
struct acpi_resource_io *io)
{
if (io->range_length) {
req->port = io->min_base_address;
req->io_type = SERIAL_IO_PORT;
port->iobase = io->min_base_address;
port->iotype = UPIO_PORT;
} else
printk(KERN_ERR "%s: zero-length IO port range?\n", __FUNCTION__);
return AE_OK;
}
static acpi_status acpi_serial_ext_irq(struct serial_struct *req,
static acpi_status acpi_serial_ext_irq(struct uart_port *port,
struct acpi_resource_ext_irq *ext_irq)
{
if (ext_irq->number_of_interrupts > 0)
req->irq = acpi_register_gsi(ext_irq->interrupts[0],
ext_irq->edge_level, ext_irq->active_high_low);
port->irq = acpi_register_gsi(ext_irq->interrupts[0],
ext_irq->edge_level, ext_irq->active_high_low);
return AE_OK;
}
static acpi_status acpi_serial_irq(struct serial_struct *req,
static acpi_status acpi_serial_irq(struct uart_port *port,
struct acpi_resource_irq *irq)
{
if (irq->number_of_interrupts > 0)
req->irq = acpi_register_gsi(irq->interrupts[0],
irq->edge_level, irq->active_high_low);
port->irq = acpi_register_gsi(irq->interrupts[0],
irq->edge_level, irq->active_high_low);
return AE_OK;
}
static acpi_status acpi_serial_resource(struct acpi_resource *res, void *data)
{
struct serial_struct *serial_req = (struct serial_struct *) data;
struct uart_port *port = (struct uart_port *) data;
struct acpi_resource_address64 addr;
acpi_status status;
status = acpi_resource_to_address64(res, &addr);
if (ACPI_SUCCESS(status))
return acpi_serial_mmio(serial_req, &addr);
return acpi_serial_mmio(port, &addr);
else if (res->id == ACPI_RSTYPE_IO)
return acpi_serial_port(serial_req, &res->data.io);
return acpi_serial_port(port, &res->data.io);
else if (res->id == ACPI_RSTYPE_EXT_IRQ)
return acpi_serial_ext_irq(serial_req, &res->data.extended_irq);
return acpi_serial_ext_irq(port, &res->data.extended_irq);
else if (res->id == ACPI_RSTYPE_IRQ)
return acpi_serial_irq(serial_req, &res->data.irq);
return acpi_serial_irq(port, &res->data.irq);
return AE_OK;
}
......@@ -94,10 +84,13 @@ static int acpi_serial_add(struct acpi_device *device)
{
struct serial_private *priv;
acpi_status status;
struct serial_struct serial_req;
struct uart_port port;
int result;
memset(&serial_req, 0, sizeof(serial_req));
memset(&port, 0, sizeof(struct uart_port));
port.uartclk = 1843200;
port.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF;
priv = kmalloc(sizeof(struct serial_private), GFP_KERNEL);
if (!priv) {
......@@ -107,25 +100,20 @@ static int acpi_serial_add(struct acpi_device *device)
memset(priv, 0, sizeof(*priv));
status = acpi_walk_resources(device->handle, METHOD_NAME__CRS,
acpi_serial_resource, &serial_req);
acpi_serial_resource, &port);
if (ACPI_FAILURE(status)) {
result = -ENODEV;
goto fail;
}
if (serial_req.iomem_base)
priv->iomem_base = serial_req.iomem_base;
else if (!serial_req.port) {
if (!port.mapbase && !port.iobase) {
printk(KERN_ERR "%s: no iomem or port address in %s _CRS\n",
__FUNCTION__, device->pnp.bus_id);
result = -ENODEV;
goto fail;
}
serial_req.baud_base = BASE_BAUD;
serial_req.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF;
priv->line = register_serial(&serial_req);
priv->line = serial8250_register_port(&port);
if (priv->line < 0) {
printk(KERN_WARNING "Couldn't register serial port %s: %d\n",
device->pnp.bus_id, priv->line);
......@@ -137,8 +125,6 @@ static int acpi_serial_add(struct acpi_device *device)
return 0;
fail:
if (serial_req.iomem_base)
iounmap(serial_req.iomem_base);
kfree(priv);
return result;
......@@ -152,9 +138,7 @@ static int acpi_serial_remove(struct acpi_device *device, int type)
return -EINVAL;
priv = acpi_driver_data(device);
unregister_serial(priv->line);
if (priv->iomem_base)
iounmap(priv->iomem_base);
serial8250_unregister_port(priv->line);
kfree(priv);
return 0;
......
......@@ -14,7 +14,7 @@
#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/module.h>
#include <linux/serial.h>
#include <linux/serial_core.h>
#include <linux/signal.h>
#include <linux/slab.h>
#include <linux/types.h>
......@@ -22,37 +22,18 @@
#include <asm/hardware.h>
#include <asm/parisc-device.h>
#include <asm/io.h>
#include <asm/serial.h>
#include <asm/serial.h> /* for LASI_BASE_BAUD */
static void setup_parisc_serial(struct serial_struct *serial,
unsigned long address, int irq, int line)
{
memset(serial, 0, sizeof(struct serial_struct));
/* autoconfig() sets state->type. This sets info->type */
serial->type = PORT_16550A;
serial->line = line;
serial->iomap_base = address;
serial->iomem_base = ioremap(address, 0x8);
serial->irq = irq;
serial->io_type = SERIAL_IO_MEM; /* define access method */
serial->flags = 0;
serial->xmit_fifo_size = 16;
serial->custom_divisor = 0;
serial->baud_base = LASI_BASE_BAUD;
}
#include "8250.h"
static int __init
serial_init_chip(struct parisc_device *dev)
{
static int serial_line_nr;
struct uart_port port;
unsigned long address;
int err;
struct serial_struct *serial;
if (!dev->irq) {
/* We find some unattached serial ports by walking native
* busses. These should be silently ignored. Otherwise,
......@@ -66,21 +47,23 @@ serial_init_chip(struct parisc_device *dev)
return -ENODEV;
}
serial = kmalloc(sizeof(*serial), GFP_KERNEL);
if (!serial)
return -ENOMEM;
address = dev->hpa;
if (dev->id.sversion != 0x8d) {
address += 0x800;
}
setup_parisc_serial(serial, address, dev->irq, serial_line_nr++);
err = register_serial(serial);
memset(&port, 0, sizeof(struct uart_port));
port.mapbase = address;
port.irq = dev->irq;
port.iotype = UPIO_MEM;
port.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF;
port.uartclk = LASI_BASE_BAUD * 16;
port.dev = &dev->dev;
err = serial8250_register_port(&port);
if (err < 0) {
printk(KERN_WARNING "register_serial returned error %d\n", err);
kfree(serial);
return -ENODEV;
printk(KERN_WARNING "serial8250_register_port returned error %d\n", err);
return err;
}
return 0;
......
......@@ -23,13 +23,13 @@
#include <linux/delay.h>
#include <linux/tty.h>
#include <linux/serial_core.h>
#include <linux/bitops.h>
#include <linux/8250.h>
#include <linux/8250_pci.h>
#include <linux/bitops.h>
#include <asm/byteorder.h>
#include <asm/io.h>
#include "8250.h"
/*
* Definitions for PCI support.
......@@ -1026,6 +1026,7 @@ enum pci_board_num_t {
pbn_b1_bt_2_921600,
pbn_b1_1_1382400,
pbn_b1_2_1382400,
pbn_b1_4_1382400,
pbn_b1_8_1382400,
......@@ -1253,6 +1254,12 @@ static struct pci_board pci_boards[] __devinitdata = {
.uart_offset = 8,
},
[pbn_b1_1_1382400] = {
.flags = FL_BASE1,
.num_ports = 1,
.base_baud = 1382400,
.uart_offset = 8,
},
[pbn_b1_2_1382400] = {
.flags = FL_BASE1,
.num_ports = 2,
......@@ -1689,7 +1696,7 @@ pciserial_init_one(struct pci_dev *dev, const struct pci_device_id *ent)
struct uart_port serial_port;
memset(&serial_port, 0, sizeof(struct uart_port));
serial_port.flags = UPF_SKIP_TEST | UPF_AUTOPROBE |
serial_port.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF |
UPF_SHARE_IRQ;
serial_port.uartclk = board->base_baud * 16;
serial_port.irq = get_pci_irq(dev, board, i);
......@@ -2108,6 +2115,13 @@ static struct pci_device_id serial_pci_tbl[] = {
PCI_ANY_ID, PCI_ANY_ID, 0, 0,
pbn_b0_bt_1_460800 },
/*
* Dell Remote Access Card III - Tim_T_Murphy@Dell.com
*/
{ PCI_VENDOR_ID_DELL, PCI_DEVICE_ID_DELL_RACIII,
PCI_ANY_ID, PCI_ANY_ID, 0, 0,
pbn_b1_1_1382400 },
/*
* RAStel 2 port modem, gerg@moreton.com.au
*/
......
......@@ -21,15 +21,12 @@
#include <linux/pnp.h>
#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/tty.h>
#include <linux/serial.h>
#include <linux/serialP.h>
#include <linux/serial_core.h>
#include <linux/bitops.h>
#include <linux/8250.h>
#include <asm/byteorder.h>
#include <asm/serial.h>
#include "8250.h"
#define UNKNOWN_DEV 0x3000
......@@ -48,7 +45,7 @@ static const struct pnp_device_id pnp_dev_table[] = {
/* Actiontec ISA PNP 56K X2 Fax Modem */
{ "AEI1240", 0 },
/* Rockwell 56K ACF II Fax+Data+Voice Modem */
{ "AKY1021", SPCI_FL_NO_SHIRQ },
{ "AKY1021", 0 /*SPCI_FL_NO_SHIRQ*/ },
/* AZT3005 PnP SOUND DEVICE */
{ "AZT4001", 0 },
/* Best Data Products Inc. Smart One 336F PnP Modem */
......@@ -397,26 +394,29 @@ static int __devinit serial_pnp_guess_board(struct pnp_dev *dev, int *flags)
static int __devinit
serial_pnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id)
{
struct serial_struct serial_req;
struct uart_port port;
int ret, line, flags = dev_id->driver_data;
if (flags & UNKNOWN_DEV) {
ret = serial_pnp_guess_board(dev, &flags);
if (ret < 0)
return ret;
}
memset(&serial_req, 0, sizeof(serial_req));
serial_req.irq = pnp_irq(dev,0);
serial_req.port = pnp_port_start(dev, 0);
if (HIGH_BITS_OFFSET)
serial_req.port = pnp_port_start(dev, 0) >> HIGH_BITS_OFFSET;
memset(&port, 0, sizeof(struct uart_port));
port.irq = pnp_irq(dev,0);
port.iobase = pnp_port_start(dev, 0);
#ifdef SERIAL_DEBUG_PNP
printk("Setup PNP port: port %x, irq %d, type %d\n",
serial_req.port, serial_req.irq, serial_req.io_type);
port.iobase, port.irq, port.iotype);
#endif
serial_req.flags = UPF_SKIP_TEST | UPF_AUTOPROBE;
serial_req.baud_base = 115200;
line = register_serial(&serial_req);
port.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF;
port.uartclk = 1843200;
port.dev = &dev->dev;
line = serial8250_register_port(&port);
if (line >= 0)
pnp_set_drvdata(dev, (void *)(line + 1));
......@@ -428,7 +428,7 @@ static void __devexit serial_pnp_remove(struct pnp_dev * dev)
{
int line = (int)pnp_get_drvdata(dev);
if (line)
unregister_serial(line - 1);
serial8250_unregister_port(line - 1);
}
static struct pnp_driver serial_pnp_driver = {
......
......@@ -29,7 +29,6 @@
#include <linux/serial.h>
#include <linux/serialP.h>
#include <linux/delay.h>
#include <linux/8250.h>
#include <asm/serial.h>
#include <asm/io.h>
......@@ -41,6 +40,7 @@
#endif
#include <linux/serial_core.h>
#include "8250.h"
/*
* Debugging.
......@@ -1313,20 +1313,6 @@ void unregister_serial(int line)
uart_unregister_port(&serial8250_reg, line);
}
/*
* This is for ISAPNP only.
*/
void serial8250_get_irq_map(unsigned int *map)
{
int i;
for (i = 0; i < UART_NR; i++) {
if (serial8250_ports[i].port.type != PORT_UNKNOWN &&
serial8250_ports[i].port.irq < 16)
*map |= 1 << serial8250_ports[i].port.irq;
}
}
/**
* serial8250_suspend_port - suspend one serial port
* @line: serial line number
......@@ -1382,7 +1368,6 @@ module_exit(serial8250_exit);
EXPORT_SYMBOL(register_serial);
EXPORT_SYMBOL(unregister_serial);
EXPORT_SYMBOL(serial8250_get_irq_map);
EXPORT_SYMBOL(serial8250_suspend_port);
EXPORT_SYMBOL(serial8250_resume_port);
......
......@@ -140,12 +140,6 @@ static inline void trace(struct icom_port *, char *, unsigned long) {};
static inline void trace(struct icom_port *icom_port, char *trace_pt, unsigned long trace_data) {};
#endif
static void msleep(unsigned long msecs)
{
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(MSECS_TO_JIFFIES(msecs));
}
static void free_port_memory(struct icom_port *icom_port)
{
struct pci_dev *dev = icom_port->adapter->pci_dev;
......
......@@ -35,6 +35,7 @@
#include <linux/console.h>
#include <linux/init.h>
#include <linux/bitops.h>
#include <linux/delay.h>
#include <asm/io.h>
#include <asm/irq.h>
......@@ -978,7 +979,7 @@ static void send_break( struct mcf_serial * info, int duration)
if (!info->addr)
return;
current->state = TASK_INTERRUPTIBLE;
set_current_state(TASK_INTERRUPTIBLE);
uartp = info->addr;
local_irq_save(flags);
......@@ -1230,8 +1231,7 @@ static void mcfrs_close(struct tty_struct *tty, struct file * filp)
#endif
if (info->blocked_open) {
if (info->close_delay) {
current->state = TASK_INTERRUPTIBLE;
schedule_timeout(info->close_delay);
msleep_interruptible(jiffies_to_msecs(info->close_delay));
}
wake_up_interruptible(&info->open_wait);
}
......@@ -1296,8 +1296,7 @@ mcfrs_wait_until_sent(struct tty_struct *tty, int timeout)
fifo_cnt++;
if (fifo_cnt == 0)
break;
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(char_time);
msleep_interruptible(jiffies_to_msecs(char_time));
if (signal_pending(current))
break;
if (timeout && time_after(jiffies, orig_jiffies + timeout))
......
......@@ -949,8 +949,7 @@ static int pmz_startup(struct uart_port *port)
*/
if (pwr_delay != 0) {
pmz_debug("pmz: delaying %d ms\n", pwr_delay);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((pwr_delay * HZ)/1000);
msleep(pwr_delay);
}
/* IrDA reset is done now */
......@@ -1684,8 +1683,7 @@ static int pmz_resume(struct macio_dev *mdev)
*/
if (pwr_delay != 0) {
pmz_debug("pmz: delaying %d ms\n", pwr_delay);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((pwr_delay * HZ)/1000);
msleep(pwr_delay);
}
pmz_debug("resume, switching complete\n");
......
......@@ -32,6 +32,7 @@
#include <linux/smp_lock.h>
#include <linux/device.h>
#include <linux/serial.h> /* for serial_state and serial_icounter_struct */
#include <linux/delay.h>
#include <asm/irq.h>
#include <asm/uaccess.h>
......@@ -162,8 +163,6 @@ static int uart_startup(struct uart_state *state, int init_hw)
return -ENOMEM;
info->xmit.buf = (unsigned char *) page;
info->tmpbuf = info->xmit.buf + UART_XMIT_SIZE;
init_MUTEX(&info->tmpbuf_sem);
uart_circ_clear(&info->xmit);
}
......@@ -238,7 +237,6 @@ static void uart_shutdown(struct uart_state *state)
if (info->xmit.buf) {
free_page((unsigned long)info->xmit.buf);
info->xmit.buf = NULL;
info->tmpbuf = NULL;
}
/*
......@@ -450,53 +448,30 @@ __uart_put_char(struct uart_port *port, struct circ_buf *circ, unsigned char c)
spin_unlock_irqrestore(&port->lock, flags);
}
static inline int
__uart_user_write(struct uart_port *port, struct circ_buf *circ,
const unsigned char __user *buf, int count)
static void uart_put_char(struct tty_struct *tty, unsigned char ch)
{
unsigned long flags;
int c, ret = 0;
if (down_interruptible(&port->info->tmpbuf_sem))
return -EINTR;
while (1) {
int c1;
c = CIRC_SPACE_TO_END(circ->head, circ->tail, UART_XMIT_SIZE);
if (count < c)
c = count;
if (c <= 0)
break;
struct uart_state *state = tty->driver_data;
c -= copy_from_user(port->info->tmpbuf, buf, c);
if (!c) {
if (!ret)
ret = -EFAULT;
break;
}
spin_lock_irqsave(&port->lock, flags);
c1 = CIRC_SPACE_TO_END(circ->head, circ->tail, UART_XMIT_SIZE);
if (c1 < c)
c = c1;
memcpy(circ->buf + circ->head, port->info->tmpbuf, c);
circ->head = (circ->head + c) & (UART_XMIT_SIZE - 1);
spin_unlock_irqrestore(&port->lock, flags);
buf += c;
count -= c;
ret += c;
}
up(&port->info->tmpbuf_sem);
__uart_put_char(state->port, &state->info->xmit, ch);
}
return ret;
static void uart_flush_chars(struct tty_struct *tty)
{
uart_start(tty);
}
static inline int
__uart_kern_write(struct uart_port *port, struct circ_buf *circ,
const unsigned char *buf, int count)
static int
uart_write(struct tty_struct *tty, const unsigned char * buf, int count)
{
struct uart_state *state = tty->driver_data;
struct uart_port *port = state->port;
struct circ_buf *circ = &state->info->xmit;
unsigned long flags;
int c, ret = 0;
if (!circ->buf)
return 0;
spin_lock_irqsave(&port->lock, flags);
while (1) {
c = CIRC_SPACE_TO_END(circ->head, circ->tail, UART_XMIT_SIZE);
......@@ -512,33 +487,6 @@ __uart_kern_write(struct uart_port *port, struct circ_buf *circ,
}
spin_unlock_irqrestore(&port->lock, flags);
return ret;
}
static void uart_put_char(struct tty_struct *tty, unsigned char ch)
{
struct uart_state *state = tty->driver_data;
__uart_put_char(state->port, &state->info->xmit, ch);
}
static void uart_flush_chars(struct tty_struct *tty)
{
uart_start(tty);
}
static int
uart_write(struct tty_struct *tty, const unsigned char * buf, int count)
{
struct uart_state *state = tty->driver_data;
int ret;
if (!state->info->xmit.buf)
return 0;
ret = __uart_kern_write(state->port, &state->info->xmit,
buf, count);
uart_start(tty);
return ret;
}
......@@ -1272,8 +1220,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
if (state->info->blocked_open) {
if (state->close_delay) {
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(state->close_delay);
msleep_interruptible(jiffies_to_msecs(state->close_delay));
}
} else if (!uart_console(port)) {
uart_change_pm(state, 3);
......@@ -1338,8 +1285,7 @@ static void uart_wait_until_sent(struct tty_struct *tty, int timeout)
* we wait.
*/
while (!port->ops->tx_empty(port)) {
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(char_time);
msleep_interruptible(jiffies_to_msecs(char_time));
if (signal_pending(current))
break;
if (time_after(jiffies, expire))
......@@ -1896,10 +1842,8 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port)
* Wait for the transmitter to empty.
*/
while (!ops->tx_empty(port)) {
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(10*HZ/1000);
msleep(10);
}
set_current_state(TASK_RUNNING);
ops->shutdown(port);
}
......
......@@ -40,11 +40,8 @@
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/timer.h>
#include <linux/tty.h>
#include <linux/serial.h>
#include <linux/serial_core.h>
#include <linux/major.h>
#include <linux/8250.h>
#include <asm/io.h>
#include <asm/system.h>
......@@ -56,6 +53,8 @@
#include <pcmcia/ds.h>
#include <pcmcia/cisreg.h>
#include "8250.h"
#ifdef PCMCIA_DEBUG
static int pc_debug = PCMCIA_DEBUG;
MODULE_PARM(pc_debug, "i");
......@@ -147,7 +146,7 @@ static void serial_remove(dev_link_t *link)
*/
if (info->link.state & DEV_CONFIG) {
for (i = 0; i < info->ndev; i++)
unregister_serial(info->line[i]);
serial8250_unregister_port(info->line[i]);
info->link.dev = NULL;
......@@ -303,21 +302,22 @@ static void serial_detach(dev_link_t * link)
/*====================================================================*/
static int setup_serial(struct serial_info * info, ioaddr_t port, int irq)
static int setup_serial(struct serial_info * info, ioaddr_t iobase, int irq)
{
struct serial_struct serial;
struct uart_port port;
int line;
memset(&serial, 0, sizeof (serial));
serial.port = port;
serial.irq = irq;
serial.flags = UPF_SKIP_TEST | UPF_SHARE_IRQ;
memset(&port, 0, sizeof (struct uart_port));
port.iobase = iobase;
port.irq = irq;
port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ;
port.uartclk = 1843200;
if (buggy_uart)
serial.flags |= UPF_BUGGY_UART;
line = register_serial(&serial);
port.flags |= UPF_BUGGY_UART;
line = serial8250_register_port(&port);
if (line < 0) {
printk(KERN_NOTICE "serial_cs: register_serial() at 0x%04lx,"
" irq %d failed\n", (u_long) serial.port, serial.irq);
printk(KERN_NOTICE "serial_cs: serial8250_register_port() at "
"0x%04lx, irq %d failed\n", (u_long)iobase, irq);
return -EINVAL;
}
......
......@@ -4,8 +4,6 @@
#ifndef _PPC64_SERIAL_H
#define _PPC64_SERIAL_H
#include <linux/config.h>
/*
* This assumes you have a 1.8432 MHz clock for your UART.
*
......@@ -22,9 +20,4 @@
/* Default baud base if not found in device-tree */
#define BASE_BAUD ( 1843200 / 16 )
#define ARCH_HAS_GET_LEGACY_SERIAL_PORTS
struct old_serial_port;
extern struct old_serial_port *get_legacy_serial_ports(unsigned int *count);
#define UART_NR (8 + CONFIG_SERIAL_8250_NR_UARTS)
#endif /* _PPC64_SERIAL_H */
......@@ -521,7 +521,8 @@
#define PCI_VENDOR_ID_AI 0x1025
#define PCI_DEVICE_ID_AI_M1435 0x1435
#define PCI_VENDOR_ID_DELL 0x1028
#define PCI_VENDOR_ID_DELL 0x1028
#define PCI_DEVICE_ID_DELL_RACIII 0x0008
#define PCI_VENDOR_ID_MATROX 0x102B
#define PCI_DEVICE_ID_MATROX_MGA_2 0x0518
......
/*
* linux/include/linux/serial_8250.h
*
* Copyright (C) 2004 Russell King
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef _LINUX_SERIAL_8250_H
#define _LINUX_SERIAL_8250_H
#include <linux/serial_core.h>
#include <linux/device.h>
struct plat_serial8250_port {
unsigned long iobase; /* io base address */
void __iomem *membase; /* ioremap cookie or NULL */
unsigned long mapbase; /* resource base */
unsigned int irq; /* interrupt number */
unsigned int uartclk; /* UART clock rate */
unsigned char regshift; /* register shift */
unsigned char iotype; /* UPIO_* */
unsigned int flags; /* UPF_* flags */
};
#endif
......@@ -17,6 +17,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef LINUX_SERIAL_CORE_H
#define LINUX_SERIAL_CORE_H
/*
* The type definitions. These are from Ted Ts'o's serial.h
......@@ -96,6 +98,7 @@
#include <linux/circ_buf.h>
#include <linux/spinlock.h>
#include <linux/sched.h>
#include <linux/tty.h>
struct uart_port;
struct uart_info;
......@@ -246,7 +249,7 @@ struct uart_state {
struct semaphore sem;
};
#define UART_XMIT_SIZE 1024
#define UART_XMIT_SIZE PAGE_SIZE
/*
* This is the state information which is only valid when the port
* is open; it may be freed by the core driver once the device has
......@@ -268,9 +271,6 @@ struct uart_info {
#define UIF_NORMAL_ACTIVE (1 << 29)
#define UIF_INITIALIZED (1 << 31)
unsigned char *tmpbuf;
struct semaphore tmpbuf_sem;
int blocked_open;
struct tasklet_struct tlet;
......@@ -458,3 +458,5 @@ uart_handle_cts_change(struct uart_port *port, unsigned int status)
!((cflag) & CLOCAL))
#endif
#endif /* LINUX_SERIAL_CORE_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