Release 4.7 drivers/tty/serial/8250/8250_early.c
/*
* Early serial console for 8250/16550 devices
*
* (c) Copyright 2004 Hewlett-Packard Development Company, L.P.
* Bjorn Helgaas <bjorn.helgaas@hp.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Based on the 8250.c serial driver, Copyright (C) 2001 Russell King,
* and on early_printk.c by Andi Kleen.
*
* This is for use before the serial driver has initialized, in
* particular, before the UARTs have been discovered and named.
* Instead of specifying the console device as, e.g., "ttyS0",
* we locate the device directly by its MMIO or I/O port address.
*
* The user can specify the device directly, e.g.,
* earlycon=uart8250,io,0x3f8,9600n8
* earlycon=uart8250,mmio,0xff5e0000,115200n8
* earlycon=uart8250,mmio32,0xff5e0000,115200n8
* or
* console=uart8250,io,0x3f8,9600n8
* console=uart8250,mmio,0xff5e0000,115200n8
* console=uart8250,mmio32,0xff5e0000,115200n8
*/
#include <linux/tty.h>
#include <linux/init.h>
#include <linux/console.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/serial_reg.h>
#include <linux/serial.h>
#include <linux/serial_8250.h>
#include <asm/io.h>
#include <asm/serial.h>
static unsigned int __init serial8250_early_in(struct uart_port *port, int offset)
{
offset <<= port->regshift;
switch (port->iotype) {
case UPIO_MEM:
return readb(port->membase + offset);
case UPIO_MEM16:
return readw(port->membase + offset);
case UPIO_MEM32:
return readl(port->membase + offset);
case UPIO_MEM32BE:
return ioread32be(port->membase + offset);
case UPIO_PORT:
return inb(port->iobase + offset);
default:
return 0;
}
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
bjorn helgaas | bjorn helgaas | 39 | 39.39% | 1 | 14.29% |
samium gromoff | samium gromoff | 26 | 26.26% | 1 | 14.29% |
kevin cernekee | kevin cernekee | 13 | 13.13% | 1 | 14.29% |
masahiro yamada | masahiro yamada | 13 | 13.13% | 1 | 14.29% |
peter hurley | peter hurley | 6 | 6.06% | 1 | 14.29% |
noam camus | noam camus | 1 | 1.01% | 1 | 14.29% |
vineet gupta | vineet gupta | 1 | 1.01% | 1 | 14.29% |
| Total | 99 | 100.00% | 7 | 100.00% |
static void __init serial8250_early_out(struct uart_port *port, int offset, int value)
{
offset <<= port->regshift;
switch (port->iotype) {
case UPIO_MEM:
writeb(value, port->membase + offset);
break;
case UPIO_MEM16:
writew(value, port->membase + offset);
break;
case UPIO_MEM32:
writel(value, port->membase + offset);
break;
case UPIO_MEM32BE:
iowrite32be(value, port->membase + offset);
break;
case UPIO_PORT:
outb(value, port->iobase + offset);
break;
}
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
bjorn helgaas | bjorn helgaas | 43 | 40.19% | 1 | 14.29% |
samium gromoff | samium gromoff | 32 | 29.91% | 1 | 14.29% |
masahiro yamada | masahiro yamada | 15 | 14.02% | 1 | 14.29% |
kevin cernekee | kevin cernekee | 9 | 8.41% | 1 | 14.29% |
peter hurley | peter hurley | 6 | 5.61% | 1 | 14.29% |
noam camus | noam camus | 1 | 0.93% | 1 | 14.29% |
vineet gupta | vineet gupta | 1 | 0.93% | 1 | 14.29% |
| Total | 107 | 100.00% | 7 | 100.00% |
#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
static void __init serial_putc(struct uart_port *port, int c)
{
unsigned int status;
serial8250_early_out(port, UART_TX, c);
for (;;) {
status = serial8250_early_in(port, UART_LSR);
if ((status & BOTH_EMPTY) == BOTH_EMPTY)
break;
cpu_relax();
}
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
bjorn helgaas | bjorn helgaas | 43 | 74.14% | 1 | 33.33% |
masahiro yamada | masahiro yamada | 14 | 24.14% | 1 | 33.33% |
noam camus | noam camus | 1 | 1.72% | 1 | 33.33% |
| Total | 58 | 100.00% | 3 | 100.00% |
static void __init early_serial8250_write(struct console *console,
const char *s, unsigned int count)
{
struct earlycon_device *device = console->data;
struct uart_port *port = &device->port;
uart_console_write(port, s, count, serial_putc);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
bjorn helgaas | bjorn helgaas | 35 | 68.63% | 1 | 16.67% |
peter hurley | peter hurley | 10 | 19.61% | 1 | 16.67% |
russell king | russell king | 3 | 5.88% | 1 | 16.67% |
yinghai lu | yinghai lu | 2 | 3.92% | 2 | 33.33% |
rob herring | rob herring | 1 | 1.96% | 1 | 16.67% |
| Total | 51 | 100.00% | 6 | 100.00% |
static void __init init_port(struct earlycon_device *device)
{
struct uart_port *port = &device->port;
unsigned int divisor;
unsigned char c;
unsigned int ier;
serial8250_early_out(port, UART_LCR, 0x3); /* 8n1 */
ier = serial8250_early_in(port, UART_IER);
serial8250_early_out(port, UART_IER, ier & UART_IER_UUE); /* no interrupt */
serial8250_early_out(port, UART_FCR, 0); /* no fifo */
serial8250_early_out(port, UART_MCR, 0x3); /* DTR + RTS */
divisor = DIV_ROUND_CLOSEST(port->uartclk, 16 * device->baud);
c = serial8250_early_in(port, UART_LCR);
serial8250_early_out(port, UART_LCR, c | UART_LCR_DLAB);
serial8250_early_out(port, UART_DLL, divisor & 0xff);
serial8250_early_out(port, UART_DLM, (divisor >> 8) & 0xff);
serial8250_early_out(port, UART_LCR, c & ~UART_LCR_DLAB);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
bjorn helgaas | bjorn helgaas | 128 | 81.01% | 1 | 20.00% |
rob herring | rob herring | 17 | 10.76% | 2 | 40.00% |
noam camus | noam camus | 9 | 5.70% | 1 | 20.00% |
alexey brodkin | alexey brodkin | 4 | 2.53% | 1 | 20.00% |
| Total | 158 | 100.00% | 5 | 100.00% |
int __init early_serial8250_setup(struct earlycon_device *device,
const char *options)
{
if (!(device->port.membase || device->port.iobase))
return -ENODEV;
if (!device->baud) {
struct uart_port *port = &device->port;
unsigned int ier;
/* assume the device was initialized, only mask interrupts */
ier = serial8250_early_in(port, UART_IER);
serial8250_early_out(port, UART_IER, ier & UART_IER_UUE);
} else
init_port(device);
device->con->write = early_serial8250_write;
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
peter hurley | peter hurley | 38 | 38.78% | 2 | 22.22% |
bjorn helgaas | bjorn helgaas | 37 | 37.76% | 1 | 11.11% |
rob herring | rob herring | 17 | 17.35% | 2 | 22.22% |
yinghai lu | yinghai lu | 2 | 2.04% | 1 | 11.11% |
alan cox | alan cox | 2 | 2.04% | 1 | 11.11% |
samium gromoff | samium gromoff | 1 | 1.02% | 1 | 11.11% |
josh boyer | josh boyer | 1 | 1.02% | 1 | 11.11% |
| Total | 98 | 100.00% | 9 | 100.00% |
EARLYCON_DECLARE(uart8250, early_serial8250_setup);
EARLYCON_DECLARE(uart, early_serial8250_setup);
OF_EARLYCON_DECLARE(ns16550, "ns16550", early_serial8250_setup);
OF_EARLYCON_DECLARE(ns16550a, "ns16550a", early_serial8250_setup);
OF_EARLYCON_DECLARE(uart, "nvidia,tegra20-uart", early_serial8250_setup);
#ifdef CONFIG_SERIAL_8250_OMAP
static int __init early_omap8250_setup(struct earlycon_device *device,
const char *options)
{
struct uart_port *port = &device->port;
if (!(device->port.membase || device->port.iobase))
return -ENODEV;
port->regshift = 2;
device->con->write = early_serial8250_write;
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
peter hurley | peter hurley | 65 | 100.00% | 1 | 100.00% |
| Total | 65 | 100.00% | 1 | 100.00% |
OF_EARLYCON_DECLARE(omap8250, "ti,omap2-uart", early_omap8250_setup);
OF_EARLYCON_DECLARE(omap8250, "ti,omap3-uart", early_omap8250_setup);
OF_EARLYCON_DECLARE(omap8250, "ti,omap4-uart", early_omap8250_setup);
#endif
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
bjorn helgaas | bjorn helgaas | 354 | 47.58% | 1 | 4.35% |
peter hurley | peter hurley | 157 | 21.10% | 5 | 21.74% |
samium gromoff | samium gromoff | 60 | 8.06% | 1 | 4.35% |
masahiro yamada | masahiro yamada | 42 | 5.65% | 2 | 8.70% |
rob herring | rob herring | 40 | 5.38% | 3 | 13.04% |
scott wood | scott wood | 24 | 3.23% | 1 | 4.35% |
kevin cernekee | kevin cernekee | 22 | 2.96% | 1 | 4.35% |
yinghai lu | yinghai lu | 12 | 1.61% | 2 | 8.70% |
noam camus | noam camus | 12 | 1.61% | 1 | 4.35% |
jon hunter | jon hunter | 9 | 1.21% | 1 | 4.35% |
alexey brodkin | alexey brodkin | 4 | 0.54% | 1 | 4.35% |
russell king | russell king | 3 | 0.40% | 1 | 4.35% |
alan cox | alan cox | 2 | 0.27% | 1 | 4.35% |
vineet gupta | vineet gupta | 2 | 0.27% | 1 | 4.35% |
josh boyer | josh boyer | 1 | 0.13% | 1 | 4.35% |
| Total | 744 | 100.00% | 23 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.