static int __init netx_console_setup(struct console *co, char *options) { struct netx_port *sport; int baud = 9600; int bits = 8; int parity = 'n'; int flow = 'n'; /* * Check whether an invalid uart number has been specified, and * if so, search for the first available port that does have * console support. */ if (co->index == -1 || co->index >= ARRAY_SIZE(netx_ports)) co->index = 0; sport = &netx_ports[co->index]; if (options) { uart_parse_options(options, &baud, &parity, &bits, &flow); } else { /* if the UART is enabled, assume it has been correctly setup * by the bootloader and get the options */ if (readl(sport->port.membase + UART_CR) & CR_UART_EN) { netx_console_get_options(&sport->port, &baud, &parity, &bits, &flow); } } return uart_set_options(&sport->port, co, baud, parity, bits, flow); }
static int __init pl010_console_setup(struct console *co, char *options) { struct uart_port *port; int baud = 38400; int bits = 8; int parity = 'n'; int flow = 'n'; /* * Check whether an invalid uart number has been specified, and * if so, search for the first available port that does have * console support. */ if (co->index >= UART_NR) co->index = 0; if (!amba_ports[co->index]) return -ENODEV; port = &amba_ports[co->index]->port; if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); else pl010_console_get_options(port, &baud, &parity, &bits); return uart_set_options(port, co, baud, parity, bits, flow); }
static int __init bfin_serial_console_setup(struct console *co, char *options) { struct bfin_serial_port *uart; int baud = 57600; int bits = 8; int parity = 'n'; # ifdef CONFIG_SERIAL_BFIN_CTSRTS int flow = 'r'; # else int flow = 'n'; # endif /* * Check whether an invalid uart number has been specified, and * if so, search for the first available port that does have * console support. */ if (co->index == -1 || co->index >= nr_active_ports) co->index = 0; uart = &bfin_serial_ports[co->index]; if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); else bfin_serial_console_get_options(uart, &baud, &parity, &bits); return uart_set_options(&uart->port, co, baud, parity, bits, flow); }
static int __init uart00_console_setup(struct console *co, char *options) { struct uart_port *port; int baud = 38400; int bits = 8; int parity = 'n'; int flow= 'n'; #ifdef CONFIG_ARCH_CAMELOT /* * Check whether an invalid uart number has been specified, and * if so, search for the first available port that does have * console support. */ port = &uart00_ports[0]; co->index = 0; #else return -ENODEV; #endif if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); else uart00_console_get_options(port, &baud, &parity, &bits); return uart_set_options(port, co, baud, parity, bits, flow); }
static int __init pl011_console_setup(struct console *co, char *options) { struct uart_amba_port *uap; int baud = 38400; int bits = 8; int parity = 'n'; int flow = 'n'; int ret; /* * Check whether an invalid uart number has been specified, and * if so, search for the first available port that does have * console support. */ if (co->index >= UART_NR) co->index = 0; uap = amba_ports[co->index]; uap->port.uartclk = clk_get_rate(uap->clk); if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); else pl011_console_get_options(uap, &baud, &parity, &bits); return uart_set_options(&uap->port, co, baud, parity, bits, flow); }
static int __init parrot5_serial_console_setup(struct console *co, char *options) { struct uart_parrot5_port *up; int baud = 115200; int bits = 8; int parity = 'n'; int flow = 'n'; /* * Check whether an invalid uart number has been specified, and * if so, search for the first available port that does have * console support. */ if ((co->index < 0) || (co->index >= UART_NR)) { co->index = 0; } up = &p5_ports[co->index]; if (up->port.membase == NULL) return -ENODEV; up->console_active = 1; parrot5_serial_clk_enable(co->index); if (options) { uart_parse_options(options, &baud, &parity, &bits, &flow); } else { parrot5_serial_console_get_options(&up->port, &baud, &parity, &bits); } return uart_set_options(&up->port, co, baud, parity, bits, flow); }
static int __init apbuart_console_setup(struct console *co, char *options) { struct uart_port *port; int baud = 38400; int bits = 8; int parity = 'n'; int flow = 'n'; pr_debug("apbuart_console_setup co=%p, co->index=%i, options=%s\n", co, co->index, options); if (co->index >= grlib_apbuart_port_nr) co->index = 0; port = &grlib_apbuart_ports[co->index]; spin_lock_init(&port->lock); if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); else apbuart_console_get_options(port, &baud, &parity, &bits); return uart_set_options(port, co, baud, parity, bits, flow); }
static int __init sa1100_console_setup(struct console *co, char *options) { struct sa1100_port *sport; int baud = 9600; int bits = 8; int parity = 'n'; int flow = 'n'; /* * Check whether an invalid uart number has been specified, and * if so, search for the first available port that does have * console support. */ if (co->index == -1 || co->index >= NR_PORTS) co->index = 0; sport = &sa1100_ports[co->index]; if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); else sa1100_console_get_options(sport, &baud, &parity, &bits); return uart_set_options(&sport->port, co, baud, parity, bits, flow); }
static int __init serial_ambarella_console_setup(struct console *co, char *options) { struct uart_port *port; int baud = 115200; int bits = 8; int parity = 'n'; int flow = 'n'; if (co->index < 0 || co->index >= ambarella_uart_ports.total_port_num) co->index = 0; port = (struct uart_port *)( ambarella_uart_ports.amba_port[co->index].port); #if !defined(CONFIG_PLAT_AMBARELLA_BOSS) ambarella_uart_ports.amba_port[co->index].set_pll(); #endif port->uartclk = ambarella_uart_ports.amba_port[co->index].get_pll(); port->ops = &serial_ambarella_pops; port->private_data = &(ambarella_uart_ports.amba_port[co->index]); port->line = co->index; if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); return uart_set_options(port, co, baud, parity, bits, flow); }
static int __init at91_console_setup(struct console *co, char *options) { struct uart_port *port; int baud = 115200; int bits = 8; int parity = 'n'; int flow = 'n'; /* * Check whether an invalid uart number has been specified, and * if so, search for the first available port that does have * console support. */ port = uart_get_console(at91_ports, AT91_NR_UART, co); /* * Enable the serial console, in-case bootloader did not do it. */ at91_sys_write(AT91_PMC_PCER, 1 << port->irq); /* enable clock */ UART_PUT_IDR(port, -1); /* disable interrupts */ UART_PUT_CR(port, AT91_US_RSTSTA | AT91_US_RSTRX); UART_PUT_CR(port, AT91_US_TXEN | AT91_US_RXEN); if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); else at91_console_get_options(port, &baud, &parity, &bits); return uart_set_options(port, co, baud, parity, bits, flow); }
static int __init sbd_console_setup(struct console *co, char *options) { int chip = co->index / DUART_MAX_SIDE; int side = co->index % DUART_MAX_SIDE; struct sbd_port *sport = &sbd_duarts[chip].sport[side]; struct uart_port *uport = &sport->port; int baud = 115200; int bits = 8; int parity = 'n'; int flow = 'n'; int ret; if (!sport->duart) return -ENXIO; ret = sbd_map_port(uport); if (ret) return ret; sbd_init_port(sport); if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); return uart_set_options(uport, co, baud, parity, bits, flow); }
static int __init serial8250_console_setup(struct console *co, char *options) { struct uart_port *port; int baud = 9600; int bits = 8; int parity = 'n'; int flow = 'n'; /* * Check whether an invalid uart number has been specified, and * if so, search for the first available port that does have * console support. */ if (co->index >= UART_NR) co->index = 0; port = &serial8250_ports[co->index].port; /* * Temporary fix. */ spin_lock_init(&port->lock); if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); return uart_set_options(port, co, baud, parity, bits, flow); }
static int asc_console_setup(struct console *co, char *options) { struct asc_port *ascport; int baud = 115200; int bits = 8; int parity = 'n'; int flow = 'n'; if (co->index >= ASC_MAX_PORTS) return -ENODEV; ascport = &asc_ports[co->index]; /* * This driver does not support early console initialization * (use ARM early printk support instead), so we only expect * this to be called during the uart port registration when the * driver gets probed and the port should be mapped at that point. */ if (ascport->port.mapbase == 0 || ascport->port.membase == NULL) return -ENXIO; if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); return uart_set_options(&ascport->port, co, baud, parity, bits, flow); }
static int __init apbuart_console_setup(struct console *co, char *options) { struct uart_port *port; int baud = 38400; int bits = 8; int parity = 'n'; int flow = 'n'; pr_debug("apbuart_console_setup co=%p, co->index=%i, options=%s\n", co, co->index, options); /* * Check whether an invalid uart number has been specified, and * if so, search for the first available port that does have * console support. */ if (co->index >= grlib_apbuart_port_nr) co->index = 0; port = &grlib_apbuart_ports[co->index]; spin_lock_init(&port->lock); if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); else apbuart_console_get_options(port, &baud, &parity, &bits); return uart_set_options(port, co, baud, parity, bits, flow); }
static int __init dz_console_setup(struct console *co, char *options) { struct dz_port *dport = &dz_ports[CONSOLE_LINE]; int baud = 9600; int bits = 8; int parity = 'n'; int flow = 'n'; int ret; unsigned short mask, tmp; if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); dz_reset(dport); ret = uart_set_options(&dport->port, co, baud, parity, bits, flow); if (ret == 0) { mask = 1 << dport->port.line; tmp = dz_in(dport, DZ_TCR); /* read the TX flag */ if (!(tmp & mask)) { tmp |= mask; /* set the TX flag */ dz_out(dport, DZ_TCR, tmp); } } return ret; }
static int __init auart_console_setup(struct console *co, char *options) { struct mxs_auart_port *s; int baud = 9600; int bits = 8; int parity = 'n'; int flow = 'n'; int ret; /* * Check whether an invalid uart number has been specified, and * if so, search for the first available port that does have * console support. */ if (co->index == -1 || co->index >= ARRAY_SIZE(auart_port)) co->index = 0; s = auart_port[co->index]; if (!s) return -ENODEV; clk_enable(s->clk); if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); else auart_console_get_options(&s->port, &baud, &parity, &bits); ret = uart_set_options(&s->port, co, baud, parity, bits, flow); clk_disable(s->clk); return ret; }
static int ulite_console_setup(struct console *co, char *options) { struct uart_port *port; int baud = 9600; int bits = 8; int parity = 'n'; int flow = 'n'; if (co->index < 0 || co->index >= ULITE_NR_UARTS) return -EINVAL; port = &ulite_ports[co->index]; /* Has the device been initialized yet? */ if (!port->mapbase) { pr_debug("console on ttyUL%i not present\n", co->index); return -ENODEV; } /* not initialized yet? */ if (!port->membase) { if (ulite_request_port(port)) return -ENODEV; } if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); return uart_set_options(port, co, baud, parity, bits, flow); }
static int __init rk2818_console_setup(struct console *co, char *options) { struct uart_port *port; int baud, flow, bits, parity; if (unlikely(co->index >= UART_NR || co->index < 0)) return -ENXIO; port = get_port_from_line(co->index); if (unlikely(!port->membase)) return -ENXIO; port->cons = co; //rk2818_init_clock(port); if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); bits = 8; parity = 'n'; flow = 'n'; rk2818_uart_write(port,rk2818_uart_read(port,UART_LCR) | LCR_WLS_8 | PARITY_DISABLED | ONE_STOP_BIT,UART_LCR); /* 8N1 */ if (baud < 300 || baud > 115200) baud = 115200; rk2818_set_baud_rate(port, baud); printk(KERN_INFO "rk2818_serial: console setup on port %d\n", port->line); return uart_set_options(port, co, baud, parity, bits, flow); }
static int __init sirfsoc_uart_console_setup(struct console *co, char *options) { unsigned int baud = 115200; unsigned int bits = 8; unsigned int parity = 'n'; unsigned int flow = 'n'; struct uart_port *port = &sirfsoc_uart_ports[co->index].port; struct sirfsoc_uart_port *sirfport = to_sirfport(port); struct sirfsoc_register *ureg = &sirfport->uart_reg->uart_reg; if (co->index < 0 || co->index >= SIRFSOC_UART_NR) return -EINVAL; if (!port->mapbase) return -ENODEV; /* enable usp in mode1 register */ if (sirfport->uart_reg->uart_type == SIRF_USP_UART) wr_regl(port, ureg->sirfsoc_mode1, SIRFSOC_USP_EN | SIRFSOC_USP_ENDIAN_CTRL_LSBF); if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); port->cons = co; /* default console tx/rx transfer using io mode */ sirfport->rx_dma_chan = NULL; sirfport->tx_dma_chan = NULL; return uart_set_options(port, co, baud, parity, bits, flow); }
static int __init sw_console_setup(struct console *co, char *options) { struct uart_port *port = NULL; struct sw_uart_port *sw_uport; int baud = 115200; int bits = 8; int parity = 'n'; int flow = 'n'; if (unlikely(co->index >= SUNXI_UART_NUM || co->index < 0)) return -ENXIO; port = sw_console_get_port(co); if (port == NULL) return -ENODEV; sw_uport = UART_TO_SPORT(port); if (!port->iobase && !port->membase) return -ENODEV; if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); SERIAL_MSG("console setup baud %d parity %c bits %d, flow %c\n", baud, parity, bits, flow); return uart_set_options(port, co, baud, parity, bits, flow); }
/* * Setup console. Be careful is called early ! */ static int __init cpm_uart_console_setup(struct console *co, char *options) { struct uart_port *port; struct uart_cpm_port *pinfo; int baud = 38400; int bits = 8; int parity = 'n'; int flow = 'n'; int ret; port = (struct uart_port *)&cpm_uart_ports[cpm_uart_port_map[co->index]]; pinfo = (struct uart_cpm_port *)port; pinfo->flags |= FLAG_CONSOLE; if (options) { uart_parse_options(options, &baud, &parity, &bits, &flow); } else { bd_t *bd = (bd_t *) __res; if (bd->bi_baudrate) baud = bd->bi_baudrate; else baud = 9600; } /* * Setup any port IO, connect any baud rate generators, * etc. This is expected to be handled by board * dependant code */ if (pinfo->set_lineif) pinfo->set_lineif(pinfo); if (IS_SMC(pinfo)) { pinfo->smcp->smc_smcm &= ~(SMCM_RX | SMCM_TX); pinfo->smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN); } else { pinfo->sccp->scc_sccm &= ~(UART_SCCM_TX | UART_SCCM_RX); pinfo->sccp->scc_gsmrl &= ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT); } ret = cpm_uart_allocbuf(pinfo, 1); if (ret) return ret; cpm_uart_initbd(pinfo); if (IS_SMC(pinfo)) cpm_uart_init_smc(pinfo); else cpm_uart_init_scc(pinfo); uart_set_options(port, co, baud, parity, bits, flow); return 0; }
static int msm_hsl_console_setup(struct console *co, char *options) { struct uart_port *port; unsigned int vid; int baud = 0, flow, bits, parity; int ret; pr_info("%s: ir\n", __func__); if (unlikely(co->index >= UART_NR || co->index < 0)) return -ENXIO; port = get_port_from_line(co->index); vid = UART_TO_MSM(port)->ver_id; pr_info("%s ():port->line %d, ir\n", __func__, port->line); if (unlikely(!port->membase)) return -ENXIO; port->cons = co; pm_runtime_get_noresume(port->dev); #ifndef CONFIG_PM_RUNTIME msm_hsl_init_clock(port); #endif pm_runtime_resume(port->dev); if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); bits = 8; parity = 'n'; flow = 'n'; msm_hsl_write(port, UARTDM_MR2_BITS_PER_CHAR_8 | STOP_BIT_ONE, regmap[vid][UARTDM_MR2]); if (baud < 300 || baud > 115200) baud = 115200; msm_hsl_set_baud_rate(port, baud); pr_info("%s: cir port[%d] set baud=%d\n", __func__, port->line, baud); ret = uart_set_options(port, co, baud, parity, bits, flow); msm_hsl_reset(port); msm_hsl_write(port, CR_PROTECTION_EN, regmap[vid][UARTDM_CR]); msm_hsl_write(port, UARTDM_CR_TX_EN_BMSK, regmap[vid][UARTDM_CR]); printk(KERN_INFO "msm_serial_hsl: console setup on port #%d\n", port->line); pr_info("%s ():port->line %d, ok, ir\n", __func__, port->line); return ret; }
static int __init genode_console_setup(struct console *co, char *options) { struct uart_port *up; if (co->index >= 1 + MAX_PORTS) co->index = 0; up = &genode_serial_port[co->index].port; if (!up) return -ENODEV; return uart_set_options(up, co, 115200, 'n', 8, 'n'); }
/* * Setup the serial console */ static int __init pmz_console_setup(struct console *co, char *options) { struct uart_pmac_port *uap; struct uart_port *port; int baud = 38400; int bits = 8; int parity = 'n'; int flow = 'n'; unsigned long pwr_delay; /* * XServe's default to 57600 bps */ if (machine_is_compatible("RackMac1,1") || machine_is_compatible("RackMac1,2") || machine_is_compatible("MacRISC4")) baud = 57600; /* * Check whether an invalid uart number has been specified, and * if so, search for the first available port that does have * console support. */ if (co->index >= pmz_ports_count) co->index = 0; uap = &pmz_ports[co->index]; if (uap->node == NULL) return -ENODEV; port = &uap->port; /* * Mark port as beeing a console */ uap->flags |= PMACZILOG_FLAG_IS_CONS; /* * Temporary fix for uart layer who didn't setup the spinlock yet */ spin_lock_init(&port->lock); /* * Enable the hardware */ pwr_delay = __pmz_startup(uap); if (pwr_delay) mdelay(pwr_delay); if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); return uart_set_options(port, co, baud, parity, bits, flow); }
static int uart_clps711x_console_setup(struct console *co, char *options) { int baud = 38400, bits = 8, parity = 'n', flow = 'n'; struct clps711x_port *s = (struct clps711x_port *)co->data; struct uart_port *port = &s->port[(co->index > 0) ? co->index : 0]; if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); else uart_clps711x_console_get_options(port, &baud, &parity, &bits); return uart_set_options(port, co, baud, parity, bits, flow); }
static int __devinit apbuart_probe(struct of_device *op, const struct of_device_id *match) { struct console co; int node; int freq_khz; int baud_rates[UART_NR]; unsigned long clk; struct device_node *dp = op->node; int v = 0, d = 0; unsigned int addr; struct uart_leon_port *port; struct amba_prom_registers *regs; int irq, line, *irqs; int *vendor = of_get_property(dp, "vendor", NULL); int *device = of_get_property(dp, "device", NULL); regs = of_get_property(dp, "reg", NULL); irqs = of_get_property(dp, "interrupts", NULL); if (vendor) v = *vendor; if (device) d = *device; if (LEON3_GpTimer_Regs == 0 || irqs == 0 || regs == 0 || !(v == VENDOR_GAISLER && d == GAISLER_APBUART)) { return -ENODEV; } addr = regs->phys_addr ; irq = *irqs; port = kzalloc(sizeof(struct uart_leon_port), GFP_KERNEL); if (unlikely(!port)) return -ENOMEM; node = prom_getchild(prom_root_node); freq_khz = prom_getint(node, "clock-frequency"); clk = ((unsigned long)(((LEON3_BYPASS_LOAD_PA(&LEON3_GpTimer_Regs->scalar_reload)) + 1))); port->port.membase = (void *)addr; port->port.mapbase = addr; port->port.irq = irq; port->port.iotype = SERIAL_IO_MEM; port->port.uartclk = clk * 1000 * 1000; port->port.fifosize = 1; port->port.ops = &leon_pops; port->port.flags = ASYNC_BOOT_AUTOCONF; port->port.line = line = leon_line_nr++; port->port.uartclk = freq_khz * 1000; uart_add_one_port(&leon_reg, port); uart_set_options(port, &co, line >= UART_NR ? 9600 : baud_rates[line], 'n', 8, 'n'); port->port.fifosize = apbuart_scan_fifo_size(port, line); apbuart_flush_fifo(port); printk("---------------- Match %d: 0x%x@%d : %s ----------------\n",line,addr, irq,dp->path_component_name); return 0; }
static int __init msm_hsl_console_setup(struct console *co, char *options) { struct uart_port *port; int baud, flow, bits, parity; int ret; if (unlikely(co->index >= UART_NR || co->index < 0)) return -ENXIO; port = get_port_from_line(co->index); if (unlikely(!port->membase)) return -ENXIO; port->cons = co; pm_runtime_get_noresume(port->dev); #ifndef CONFIG_PM_RUNTIME msm_hsl_init_clock(port); #endif pm_runtime_resume(port->dev); if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); bits = 8; parity = 'n'; flow = 'n'; msm_hsl_write(port, UARTDM_MR2_BITS_PER_CHAR_8 | STOP_BIT_ONE, UARTDM_MR2_ADDR); /* 8N1 */ if (baud < 300 || baud > 115200) baud = 115200; msm_hsl_set_baud_rate(port, baud); ret = uart_set_options(port, co, baud, parity, bits, flow); msm_hsl_reset(port); /* Enable transmitter */ msm_hsl_write(port, CR_PROTECTION_EN, UARTDM_CR_ADDR); msm_hsl_write(port, UARTDM_CR_TX_EN_BMSK, UARTDM_CR_ADDR); printk(KERN_INFO "msm_serial_hsl: console setup on port #%d\n", port->line); console_uart_port = port; b_terminal_onoff = 0; return ret; }
static int __init tct_console_setup(struct console *co, char *options) { struct uart_port *port = &tctuart_ports[co->index]; int baud = 115200; int bits = 8; int parity = 'n'; int flow = 'n'; if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); return uart_set_options(port, co, baud, parity, bits, flow); }
static int __init dz_console_setup(struct console *co, char *options) { struct dz_port *dport = &dz_ports[co->index]; int baud = 9600; int bits = 8; int parity = 'n'; int flow = 'n'; if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); dz_reset(dport); return uart_set_options(&dport->port, co, baud, parity, bits, flow); }
static int __init sc26xx_console_setup(struct console *con, char *options) { struct uart_port *port = sc26xx_port; int baud = 9600; int bits = 8; int parity = 'n'; int flow = 'n'; if (port->type != PORT_SC26XX) return -1; printk(KERN_INFO "Console: ttySC%d (SC26XX)\n", con->index); if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); return uart_set_options(port, con, baud, parity, bits, flow); }