From patchwork Wed Jan 21 15:14:06 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 3460 X-Patchwork-Delegate: lethal@linux-sh.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n0LFBI90023064 for ; Wed, 21 Jan 2009 07:11:28 -0800 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755829AbZAUPQF (ORCPT ); Wed, 21 Jan 2009 10:16:05 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756214AbZAUPQF (ORCPT ); Wed, 21 Jan 2009 10:16:05 -0500 Received: from rv-out-0506.google.com ([209.85.198.232]:37964 "EHLO rv-out-0506.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755829AbZAUPQC (ORCPT ); Wed, 21 Jan 2009 10:16:02 -0500 Received: by rv-out-0506.google.com with SMTP id k40so3654714rvb.1 for ; Wed, 21 Jan 2009 07:16:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:date:message-id :in-reply-to:references:subject; bh=eS5Uw5A7ON6M7HWgIYVnHBbmvIl9VTPnaE1TKkYuLOA=; b=myKfQuoVGWTWaKy1ry69TvcIsFNmqwYG/wYsk+Mda6iQZFA3HlWsqaslQFdmfLklgS 8fvtStIFukzjOZJgATNdEeNT83KoTsW+kw1pAkJkzvpmN/cwgJMd1at+NUssKtPE5I4M X+UdrzrO8+QlcBiVD+GbqXjeFXf7C0iwUbHwk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:in-reply-to:references:subject; b=kOdZPXxEQ8atOHEZta8VxR5641tquUhfRBu+dwVdvg5M9MYUpTkgQygF3FHY84f2qJ XPVHDfIhtcchmbpuV2+O+YQnREfgrLMifDk1Oi8Zu2XPNFmcpk3mNSwUAZZe5RYoPYT0 hFvDE3BLlU8a10Fs8ag4hOO176X5KXvktQZmc= Received: by 10.141.96.19 with SMTP id y19mr2564487rvl.201.1232550961916; Wed, 21 Jan 2009 07:16:01 -0800 (PST) Received: from rx1.opensource.se (114.8.221.202.ts.2iij.net [202.221.8.114]) by mx.google.com with ESMTPS id b8sm15599417rvf.9.2009.01.21.07.16.00 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 21 Jan 2009 07:16:01 -0800 (PST) From: Magnus Damm To: linux-sh@vger.kernel.org Cc: Magnus Damm , lethal@linux-sh.org Date: Thu, 22 Jan 2009 00:14:06 +0900 Message-Id: <20090121151406.29269.2905.sendpatchset@rx1.opensource.se> In-Reply-To: <20090121151334.29269.55519.sendpatchset@rx1.opensource.se> References: <20090121151334.29269.55519.sendpatchset@rx1.opensource.se> Subject: [PATCH 004/013] sh-sci: rework serial console support Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org From: Magnus Damm Rework sh-sci serial console code. Signed-off-by: Magnus Damm --- drivers/serial/sh-sci.c | 48 ++++++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 25 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 0004/drivers/serial/sh-sci.c +++ work/drivers/serial/sh-sci.c 2009-01-21 19:17:10.000000000 +0900 @@ -91,10 +91,6 @@ struct sh_sci_priv { #endif }; -#ifdef CONFIG_SERIAL_SH_SCI_CONSOLE -static struct sci_port *serial_console_port; -#endif - /* Function prototypes */ static void sci_stop_tx(struct uart_port *port); @@ -1087,6 +1083,19 @@ static void __init sci_init_ports(void) } #ifdef CONFIG_SERIAL_SH_SCI_CONSOLE + +struct tty_driver *serial_console_device(struct console *co, int *index) +{ + struct uart_driver *p = &sci_uart_driver; + *index = co->index; + return p->tty_driver; +} + +static void serial_console_putchar(struct uart_port *port, int ch) +{ + sci_poll_put_char(port, ch); +} + /* * Print a string to the serial port trying not to disturb * any possible real use of the port... @@ -1094,19 +1103,12 @@ static void __init sci_init_ports(void) static void serial_console_write(struct console *co, const char *s, unsigned count) { - struct uart_port *port = &serial_console_port->port; - int i; - - for (i = 0; i < count; i++) { - if (*s == 10) - sci_poll_put_char(port, '\r'); - - sci_poll_put_char(port, *s++); - } + uart_console_write(co->data, s, count, serial_console_putchar); } static int __init serial_console_setup(struct console *co, char *options) { + struct sci_port *sci_port; struct uart_port *port; int baud = 115200; int bits = 8; @@ -1122,8 +1124,9 @@ static int __init serial_console_setup(s if (co->index >= SCI_NPORTS) co->index = 0; - serial_console_port = &sci_ports[co->index]; - port = &serial_console_port->port; + sci_port = &sci_ports[co->index]; + port = &sci_port->port; + co->data = port; /* * Also need to check port->type, we don't actually have any @@ -1133,21 +1136,17 @@ static int __init serial_console_setup(s */ if (!port->type) return -ENODEV; - if (!port->membase || !port->mapbase) - return -ENODEV; - - port->type = serial_console_port->type; #ifdef CONFIG_HAVE_CLK - if (!serial_console_port->clk) - serial_console_port->clk = clk_get(NULL, "module_clk"); + if (!sci_port->clk) + sci_port->clk = clk_get(NULL, "module_clk"); #endif if (port->flags & UPF_IOREMAP) sci_config_port(port, 0); - if (serial_console_port->enable) - serial_console_port->enable(port); + if (sci_port->enable) + sci_port->enable(port); if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); @@ -1163,12 +1162,11 @@ static int __init serial_console_setup(s static struct console serial_console = { .name = "ttySC", - .device = uart_console_device, + .device = serial_console_device, .write = serial_console_write, .setup = serial_console_setup, .flags = CON_PRINTBUFFER, .index = -1, - .data = &sci_uart_driver, }; static int __init sci_console_init(void)