Commit b82e324b authored by Mika Westerberg's avatar Mika Westerberg Committed by Greg Kroah-Hartman

serial, mfd: don't hardcode the console

Add support to specify which HSU port to use as an early console. This can
be selected by passing "earlyprintk=hsu<n>" on the kernel command line. By
default port 0 is still used.
Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 66ef27c3
...@@ -51,7 +51,7 @@ extern struct console early_mrst_console; ...@@ -51,7 +51,7 @@ extern struct console early_mrst_console;
extern void mrst_early_console_init(void); extern void mrst_early_console_init(void);
extern struct console early_hsu_console; extern struct console early_hsu_console;
extern void hsu_early_console_init(void); extern void hsu_early_console_init(const char *);
extern void intel_scu_devices_create(void); extern void intel_scu_devices_create(void);
extern void intel_scu_devices_destroy(void); extern void intel_scu_devices_destroy(void);
......
...@@ -247,7 +247,7 @@ static int __init setup_early_printk(char *buf) ...@@ -247,7 +247,7 @@ static int __init setup_early_printk(char *buf)
} }
if (!strncmp(buf, "hsu", 3)) { if (!strncmp(buf, "hsu", 3)) {
hsu_early_console_init(); hsu_early_console_init(buf + 3);
early_console_register(&early_hsu_console, keep); early_console_register(&early_hsu_console, keep);
} }
#endif #endif
......
...@@ -245,16 +245,24 @@ struct console early_mrst_console = { ...@@ -245,16 +245,24 @@ struct console early_mrst_console = {
* Following is the early console based on Medfield HSU (High * Following is the early console based on Medfield HSU (High
* Speed UART) device. * Speed UART) device.
*/ */
#define HSU_PORT2_PADDR 0xffa28180 #define HSU_PORT_BASE 0xffa28080
static void __iomem *phsu; static void __iomem *phsu;
void hsu_early_console_init(void) void hsu_early_console_init(const char *s)
{ {
unsigned long paddr, port = 0;
u8 lcr; u8 lcr;
phsu = (void *)set_fixmap_offset_nocache(FIX_EARLYCON_MEM_BASE, /*
HSU_PORT2_PADDR); * Select the early HSU console port if specified by user in the
* kernel command line.
*/
if (*s && !kstrtoul(s, 10, &port))
port = clamp_val(port, 0, 2);
paddr = HSU_PORT_BASE + port * 0x80;
phsu = (void *)set_fixmap_offset_nocache(FIX_EARLYCON_MEM_BASE, paddr);
/* Disable FIFO */ /* Disable FIFO */
writeb(0x0, phsu + UART_FCR); writeb(0x0, phsu + UART_FCR);
......
...@@ -1156,7 +1156,6 @@ serial_hsu_console_setup(struct console *co, char *options) ...@@ -1156,7 +1156,6 @@ serial_hsu_console_setup(struct console *co, char *options)
int bits = 8; int bits = 8;
int parity = 'n'; int parity = 'n';
int flow = 'n'; int flow = 'n';
int ret;
if (co->index == -1 || co->index >= serial_hsu_reg.nr) if (co->index == -1 || co->index >= serial_hsu_reg.nr)
co->index = 0; co->index = 0;
...@@ -1167,9 +1166,7 @@ serial_hsu_console_setup(struct console *co, char *options) ...@@ -1167,9 +1166,7 @@ serial_hsu_console_setup(struct console *co, char *options)
if (options) if (options)
uart_parse_options(options, &baud, &parity, &bits, &flow); uart_parse_options(options, &baud, &parity, &bits, &flow);
ret = uart_set_options(&up->port, co, baud, parity, bits, flow); return uart_set_options(&up->port, co, baud, parity, bits, flow);
return ret;
} }
static struct console serial_hsu_console = { static struct console serial_hsu_console = {
...@@ -1178,9 +1175,13 @@ static struct console serial_hsu_console = { ...@@ -1178,9 +1175,13 @@ static struct console serial_hsu_console = {
.device = uart_console_device, .device = uart_console_device,
.setup = serial_hsu_console_setup, .setup = serial_hsu_console_setup,
.flags = CON_PRINTBUFFER, .flags = CON_PRINTBUFFER,
.index = 2, .index = -1,
.data = &serial_hsu_reg, .data = &serial_hsu_reg,
}; };
#define SERIAL_HSU_CONSOLE (&serial_hsu_console)
#else
#define SERIAL_HSU_CONSOLE NULL
#endif #endif
struct uart_ops serial_hsu_pops = { struct uart_ops serial_hsu_pops = {
...@@ -1210,6 +1211,7 @@ static struct uart_driver serial_hsu_reg = { ...@@ -1210,6 +1211,7 @@ static struct uart_driver serial_hsu_reg = {
.major = TTY_MAJOR, .major = TTY_MAJOR,
.minor = 128, .minor = 128,
.nr = 3, .nr = 3,
.cons = SERIAL_HSU_CONSOLE,
}; };
#ifdef CONFIG_PM #ifdef CONFIG_PM
...@@ -1344,12 +1346,6 @@ static int serial_hsu_probe(struct pci_dev *pdev, ...@@ -1344,12 +1346,6 @@ static int serial_hsu_probe(struct pci_dev *pdev,
} }
uart_add_one_port(&serial_hsu_reg, &uport->port); uart_add_one_port(&serial_hsu_reg, &uport->port);
#ifdef CONFIG_SERIAL_MFD_HSU_CONSOLE
if (index == 2) {
register_console(&serial_hsu_console);
uport->port.cons = &serial_hsu_console;
}
#endif
pci_set_drvdata(pdev, uport); pci_set_drvdata(pdev, uport);
} }
......
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