From patchwork Tue Feb 24 06:57:12 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 8556 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 n1O6xSKF006534 for ; Tue, 24 Feb 2009 06:59:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752732AbZBXG73 (ORCPT ); Tue, 24 Feb 2009 01:59:29 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752830AbZBXG73 (ORCPT ); Tue, 24 Feb 2009 01:59:29 -0500 Received: from rv-out-0506.google.com ([209.85.198.239]:28393 "EHLO rv-out-0506.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752732AbZBXG72 (ORCPT ); Tue, 24 Feb 2009 01:59:28 -0500 Received: by rv-out-0506.google.com with SMTP id g37so2338115rvb.1 for ; Mon, 23 Feb 2009 22:59:26 -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 :subject; bh=qWhEyAqkVksAXTgGAVkqPLz2SypumUG8UgN6yQcvUBE=; b=Os17/PuC9ZSAzb7OYI+VVVPaQbYzy5b8Xe6kYfKB90Ukg71brN4bFDAHot8ZQ/rfZj hvf9hjnBARpj0WW0oSu9GcJTfKDPpDvFW5JjiVoBm9eeQuGcO6eUSYYjkqQKLb5sjXdX bSjBreJet4Y+1DmZoaW0eqT8jJP9CJCpdf+9k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:subject; b=qStx3aSJGZnCiA4I0NG/1D4q2lOt440NtqeFOjf4V9Xkn6JF3pfjXihaW1QWgesFl9 TYz7bZ9brXIMZWmXNGES/kJquzAmaNGzw6qEXHkyOe6dzR6+g8YD7XmccHDyTc+GJFah L7dBy9UahgDF2PMpvoNEYzVIdrgfq0MitJWqA= Received: by 10.141.45.16 with SMTP id x16mr2418503rvj.290.1235458766667; Mon, 23 Feb 2009 22:59:26 -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 g31sm15685974rvb.7.2009.02.23.22.59.25 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 23 Feb 2009 22:59:25 -0800 (PST) From: Magnus Damm To: linux-sh@vger.kernel.org Cc: Magnus Damm , lethal@linux-sh.org Date: Tue, 24 Feb 2009 15:57:12 +0900 Message-Id: <20090224065712.31491.72199.sendpatchset@rx1.opensource.se> Subject: [PATCH] sh-sci: console drainage Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org From: Magnus Damm Modify the serial console code to wait for the transmit FIFO, make sure all bits have been put on the wire before returning. Signed-off-by: Magnus Damm --- This is the first step against clock framework integration, after all bits are sent we can disable the data clock. Also useful when debugging or shutting down a system. Tested with SCIF on sh7785lcr, not sure about SCI and SCIFA. drivers/serial/sh-sci.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) -- 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 --- 0001/drivers/serial/sh-sci.c +++ work/drivers/serial/sh-sci.c 2009-02-18 15:59:05.000000000 +0900 @@ -139,7 +139,7 @@ static void sci_poll_put_char(struct uar } while (!(status & SCxSR_TDxE(port))); sci_in(port, SCxSR); /* Dummy read */ - sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port)); + sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port) & ~SCxSR_TEND(port)); sci_out(port, SCxTDR, c); } #endif /* CONFIG_CONSOLE_POLL || CONFIG_SERIAL_SH_SCI_CONSOLE */ @@ -1095,6 +1095,7 @@ static void serial_console_write(struct unsigned count) { struct uart_port *port = &serial_console_port->port; + unsigned short bits; int i; for (i = 0; i < count; i++) { @@ -1103,6 +1104,11 @@ static void serial_console_write(struct sci_poll_put_char(port, *s++); } + + /* wait until fifo is empty and last bit has been transmitted */ + bits = SCxSR_TDxE(port) | SCxSR_TEND(port); + while ((sci_in(port, SCxSR) & bits) != bits) + cpu_relax(); } static int __init serial_console_setup(struct console *co, char *options)