diff options
Diffstat (limited to 'drivers/serial')
-rw-r--r-- | drivers/serial/21285.c | 2 | ||||
-rw-r--r-- | drivers/serial/Kconfig | 4 | ||||
-rw-r--r-- | drivers/serial/clps711x.c | 2 | ||||
-rw-r--r-- | drivers/serial/cpm_uart/cpm_uart_core.c | 14 | ||||
-rw-r--r-- | drivers/serial/imx.c | 2 | ||||
-rw-r--r-- | drivers/serial/mcf.c | 2 | ||||
-rw-r--r-- | drivers/serial/mpc52xx_uart.c | 40 | ||||
-rw-r--r-- | drivers/serial/pxa.c | 30 | ||||
-rw-r--r-- | drivers/serial/sa1100.c | 2 | ||||
-rw-r--r-- | drivers/serial/serial_core.c | 76 |
10 files changed, 76 insertions, 98 deletions
diff --git a/drivers/serial/21285.c b/drivers/serial/21285.c index f31c669..cb6d85d 100644 --- a/drivers/serial/21285.c +++ b/drivers/serial/21285.c @@ -14,8 +14,8 @@ #include <linux/tty_flip.h> #include <linux/serial_core.h> #include <linux/serial.h> +#include <linux/io.h> -#include <asm/io.h> #include <asm/irq.h> #include <asm/mach-types.h> #include <asm/hardware/dec21285.h> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 7d7f576..aa9d3a4 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -628,7 +628,7 @@ config SERIAL_MPSC_CONSOLE config SERIAL_PXA bool "PXA serial port support" - depends on ARM && ARCH_PXA + depends on ARCH_PXA || ARCH_MMP select SERIAL_CORE help If you have a machine based on an Intel XScale PXA2xx CPU you @@ -1374,7 +1374,7 @@ config SERIAL_BFIN_SPORT depends on BLACKFIN && EXPERIMENTAL select SERIAL_CORE help - Enble support SPORT emulate UART on Blackfin series. + Enable SPORT emulate UART on Blackfin series. To compile this driver as a module, choose M here: the module will be called bfin_sport_uart. diff --git a/drivers/serial/clps711x.c b/drivers/serial/clps711x.c index 459f342..80e7642 100644 --- a/drivers/serial/clps711x.c +++ b/drivers/serial/clps711x.c @@ -38,9 +38,9 @@ #include <linux/tty_flip.h> #include <linux/serial_core.h> #include <linux/serial.h> +#include <linux/io.h> #include <mach/hardware.h> -#include <asm/io.h> #include <asm/irq.h> #include <asm/hardware/clps7111.h> diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c index bde4b4b0..5c6ef51 100644 --- a/drivers/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/serial/cpm_uart/cpm_uart_core.c @@ -406,6 +406,18 @@ static int cpm_uart_startup(struct uart_port *port) pr_debug("CPM uart[%d]:startup\n", port->line); + /* If the port is not the console, make sure rx is disabled. */ + if (!(pinfo->flags & FLAG_CONSOLE)) { + /* Disable UART rx */ + if (IS_SMC(pinfo)) { + clrbits16(&pinfo->smcp->smc_smcmr, SMCMR_REN); + clrbits8(&pinfo->smcp->smc_smcm, SMCM_RX); + } else { + clrbits32(&pinfo->sccp->scc_gsmrl, SCC_GSMRL_ENR); + clrbits16(&pinfo->sccp->scc_sccm, UART_SCCM_RX); + } + cpm_line_cr_cmd(pinfo, CPM_CR_INIT_TRX); + } /* Install interrupt handler. */ retval = request_irq(port->irq, cpm_uart_int, 0, "cpm_uart", port); if (retval) @@ -420,8 +432,6 @@ static int cpm_uart_startup(struct uart_port *port) setbits32(&pinfo->sccp->scc_gsmrl, (SCC_GSMRL_ENR | SCC_GSMRL_ENT)); } - if (!(pinfo->flags & FLAG_CONSOLE)) - cpm_line_cr_cmd(pinfo, CPM_CR_INIT_TRX); return 0; } diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c index a509546..9f460b1 100644 --- a/drivers/serial/imx.c +++ b/drivers/serial/imx.c @@ -1129,7 +1129,7 @@ static int serial_imx_probe(struct platform_device *pdev) sport->timer.function = imx_timeout; sport->timer.data = (unsigned long)sport; - sport->clk = clk_get(&pdev->dev, "uart_clk"); + sport->clk = clk_get(&pdev->dev, "uart"); if (IS_ERR(sport->clk)) { ret = PTR_ERR(sport->clk); goto unmap; diff --git a/drivers/serial/mcf.c b/drivers/serial/mcf.c index 56841fe..0eefb07 100644 --- a/drivers/serial/mcf.c +++ b/drivers/serial/mcf.c @@ -513,7 +513,7 @@ static int __init mcf_console_setup(struct console *co, char *options) int parity = 'n'; int flow = 'n'; - if ((co->index >= 0) && (co->index <= MCF_MAXPORTS)) + if ((co->index < 0) || (co->index >= MCF_MAXPORTS)) co->index = 0; port = &mcf_ports[co->index].port; if (port->membase == 0) diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c index 0c3a2ab..7f72f8c 100644 --- a/drivers/serial/mpc52xx_uart.c +++ b/drivers/serial/mpc52xx_uart.c @@ -50,8 +50,8 @@ /* OF Platform device Usage : * * This driver is only used for PSCs configured in uart mode. The device - * tree will have a node for each PSC in uart mode w/ device_type = "serial" - * and "mpc52xx-psc-uart" in the compatible string + * tree will have a node for each PSC with "mpc52xx-psc-uart" in the compatible + * list. * * By default, PSC devices are enumerated in the order they are found. However * a particular PSC number can be forces by adding 'device_no = <port#>' @@ -522,7 +522,7 @@ mpc52xx_uart_startup(struct uart_port *port) /* Request IRQ */ ret = request_irq(port->irq, mpc52xx_uart_int, - IRQF_DISABLED | IRQF_SAMPLE_RANDOM | IRQF_SHARED, + IRQF_DISABLED | IRQF_SAMPLE_RANDOM, "mpc52xx_psc_uart", port); if (ret) return ret; @@ -1212,30 +1212,18 @@ mpc52xx_uart_of_resume(struct of_device *op) #endif static void -mpc52xx_uart_of_assign(struct device_node *np, int idx) +mpc52xx_uart_of_assign(struct device_node *np) { - int free_idx = -1; int i; - /* Find the first free node */ + /* Find the first free PSC number */ for (i = 0; i < MPC52xx_PSC_MAXNUM; i++) { if (mpc52xx_uart_nodes[i] == NULL) { - free_idx = i; - break; + of_node_get(np); + mpc52xx_uart_nodes[i] = np; + return; } } - - if ((idx < 0) || (idx >= MPC52xx_PSC_MAXNUM)) - idx = free_idx; - - if (idx < 0) - return; /* No free slot; abort */ - - of_node_get(np); - /* If the slot is already occupied, then swap slots */ - if (mpc52xx_uart_nodes[idx] && (free_idx != -1)) - mpc52xx_uart_nodes[free_idx] = mpc52xx_uart_nodes[idx]; - mpc52xx_uart_nodes[idx] = np; } static void @@ -1243,23 +1231,17 @@ mpc52xx_uart_of_enumerate(void) { static int enum_done; struct device_node *np; - const unsigned int *devno; const struct of_device_id *match; int i; if (enum_done) return; - for_each_node_by_type(np, "serial") { + /* Assign index to each PSC in device tree */ + for_each_matching_node(np, mpc52xx_uart_of_match) { match = of_match_node(mpc52xx_uart_of_match, np); - if (!match) - continue; - psc_ops = match->data; - - /* Is a particular device number requested? */ - devno = of_get_property(np, "port-number", NULL); - mpc52xx_uart_of_assign(np, devno ? *devno : -1); + mpc52xx_uart_of_assign(np); } enum_done = 1; diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c index f6e3b86..a48a8a1 100644 --- a/drivers/serial/pxa.c +++ b/drivers/serial/pxa.c @@ -43,13 +43,7 @@ #include <linux/tty_flip.h> #include <linux/serial_core.h> #include <linux/clk.h> - -#include <asm/io.h> -#include <mach/hardware.h> -#include <asm/irq.h> -#include <mach/pxa-regs.h> -#include <mach/regs-uart.h> - +#include <linux/io.h> struct uart_pxa_port { struct uart_port port; @@ -491,7 +485,7 @@ serial_pxa_set_termios(struct uart_port *port, struct ktermios *termios, * Ensure the port will be enabled. * This is required especially for serial console. */ - up->ier |= IER_UUE; + up->ier |= UART_IER_UUE; /* * Update the per-port timeout. @@ -784,19 +778,15 @@ static int serial_pxa_probe(struct platform_device *dev) sport->port.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF; sport->port.uartclk = clk_get_rate(sport->clk); - /* - * Is it worth keeping this? - */ - if (mmres->start == __PREG(FFUART)) - sport->name = "FFUART"; - else if (mmres->start == __PREG(BTUART)) - sport->name = "BTUART"; - else if (mmres->start == __PREG(STUART)) - sport->name = "STUART"; - else if (mmres->start == __PREG(HWUART)) - sport->name = "HWUART"; - else + switch (dev->id) { + case 0: sport->name = "FFUART"; break; + case 1: sport->name = "BTUART"; break; + case 2: sport->name = "STUART"; break; + case 3: sport->name = "HWUART"; break; + default: sport->name = "???"; + break; + } sport->port.membase = ioremap(mmres->start, mmres->end - mmres->start + 1); if (!sport->port.membase) { diff --git a/drivers/serial/sa1100.c b/drivers/serial/sa1100.c index b24a25e..94530f0 100644 --- a/drivers/serial/sa1100.c +++ b/drivers/serial/sa1100.c @@ -36,8 +36,8 @@ #include <linux/tty_flip.h> #include <linux/serial_core.h> #include <linux/serial.h> +#include <linux/io.h> -#include <asm/io.h> #include <asm/irq.h> #include <mach/hardware.h> #include <asm/mach/serial_sa1100.h> diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 42f4e66..b0bb29d 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c @@ -27,6 +27,8 @@ #include <linux/slab.h> #include <linux/init.h> #include <linux/console.h> +#include <linux/proc_fs.h> +#include <linux/seq_file.h> #include <linux/serial_core.h> #include <linux/smp_lock.h> #include <linux/device.h> @@ -1682,20 +1684,20 @@ static const char *uart_type(struct uart_port *port) #ifdef CONFIG_PROC_FS -static int uart_line_info(char *buf, struct uart_driver *drv, int i) +static void uart_line_info(struct seq_file *m, struct uart_driver *drv, int i) { struct uart_state *state = drv->state + i; int pm_state; struct uart_port *port = state->port; char stat_buf[32]; unsigned int status; - int mmio, ret; + int mmio; if (!port) - return 0; + return; mmio = port->iotype >= UPIO_MEM; - ret = sprintf(buf, "%d: uart:%s %s%08llX irq:%d", + seq_printf(m, "%d: uart:%s %s%08llX irq:%d", port->line, uart_type(port), mmio ? "mmio:0x" : "port:", mmio ? (unsigned long long)port->mapbase @@ -1703,8 +1705,8 @@ static int uart_line_info(char *buf, struct uart_driver *drv, int i) port->irq); if (port->type == PORT_UNKNOWN) { - strcat(buf, "\n"); - return ret + 1; + seq_putc(m, '\n'); + return; } if (capable(CAP_SYS_ADMIN)) { @@ -1719,19 +1721,19 @@ static int uart_line_info(char *buf, struct uart_driver *drv, int i) uart_change_pm(state, pm_state); mutex_unlock(&state->mutex); - ret += sprintf(buf + ret, " tx:%d rx:%d", + seq_printf(m, " tx:%d rx:%d", port->icount.tx, port->icount.rx); if (port->icount.frame) - ret += sprintf(buf + ret, " fe:%d", + seq_printf(m, " fe:%d", port->icount.frame); if (port->icount.parity) - ret += sprintf(buf + ret, " pe:%d", + seq_printf(m, " pe:%d", port->icount.parity); if (port->icount.brk) - ret += sprintf(buf + ret, " brk:%d", + seq_printf(m, " brk:%d", port->icount.brk); if (port->icount.overrun) - ret += sprintf(buf + ret, " oe:%d", + seq_printf(m, " oe:%d", port->icount.overrun); #define INFOBIT(bit, str) \ @@ -1753,45 +1755,39 @@ static int uart_line_info(char *buf, struct uart_driver *drv, int i) STATBIT(TIOCM_RNG, "|RI"); if (stat_buf[0]) stat_buf[0] = ' '; - strcat(stat_buf, "\n"); - ret += sprintf(buf + ret, stat_buf); - } else { - strcat(buf, "\n"); - ret++; + seq_puts(m, stat_buf); } + seq_putc(m, '\n'); #undef STATBIT #undef INFOBIT - return ret; } -static int uart_read_proc(char *page, char **start, off_t off, - int count, int *eof, void *data) +static int uart_proc_show(struct seq_file *m, void *v) { - struct tty_driver *ttydrv = data; + struct tty_driver *ttydrv = m->private; struct uart_driver *drv = ttydrv->driver_state; - int i, len = 0, l; - off_t begin = 0; + int i; - len += sprintf(page, "serinfo:1.0 driver%s%s revision:%s\n", + seq_printf(m, "serinfo:1.0 driver%s%s revision:%s\n", "", "", ""); - for (i = 0; i < drv->nr && len < PAGE_SIZE - 96; i++) { - l = uart_line_info(page + len, drv, i); - len += l; - if (len + begin > off + count) - goto done; - if (len + begin < off) { - begin += len; - len = 0; - } - } - *eof = 1; - done: - if (off >= len + begin) - return 0; - *start = page + (off - begin); - return (count < begin + len - off) ? count : (begin + len - off); + for (i = 0; i < drv->nr; i++) + uart_line_info(m, drv, i); + return 0; } + +static int uart_proc_open(struct inode *inode, struct file *file) +{ + return single_open(file, uart_proc_show, PDE(inode)->data); +} + +static const struct file_operations uart_proc_fops = { + .owner = THIS_MODULE, + .open = uart_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; #endif #if defined(CONFIG_SERIAL_CORE_CONSOLE) || defined(CONFIG_CONSOLE_POLL) @@ -2299,7 +2295,7 @@ static const struct tty_operations uart_ops = { .break_ctl = uart_break_ctl, .wait_until_sent= uart_wait_until_sent, #ifdef CONFIG_PROC_FS - .read_proc = uart_read_proc, + .proc_fops = &uart_proc_fops, #endif .tiocmget = uart_tiocmget, .tiocmset = uart_tiocmset, |