diff mbox

sh-sci: console drainage

Message ID 20090224065712.31491.72199.sendpatchset@rx1.opensource.se (mailing list archive)
State Accepted
Delegated to: Paul Mundt
Headers show

Commit Message

Magnus Damm Feb. 24, 2009, 6:57 a.m. UTC
From: Magnus Damm <damm@igel.co.jp>

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 <damm@igel.co.jp>
---

 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

Comments

Paul Mundt March 3, 2009, 6:18 a.m. UTC | #1
On Tue, Feb 24, 2009 at 03:57:12PM +0900, Magnus Damm wrote:
> Modify the serial console code to wait for the transmit FIFO,
> make sure all bits have been put on the wire before returning.

On Tue, Feb 24, 2009 at 10:11:03PM +0900, Magnus Damm wrote:
> Add support for single IRQ hardware to the sh-rtc driver.
> 
> This is useful for processors with limited interrupt masking
> support such as sh7750 and sh7780. With this patch in place we
> can add logic to the intc code that merges all RTC vectors into
> a single linux interrupt with proper masking/unmasking support.
> 
> Specify a single IRQ in the platform data to use this new shared
> IRQ feature. Separate Periodic/Carry/Alarm IRQs are still supported.

On Tue, Feb 24, 2009 at 10:23:51PM +0900, Magnus Damm wrote:
> Fix iounmap() of pass-through P4 addresses. Without this patch
> iounmap() on the sh7780 rtc area results in a warning message.

On Tue, Feb 24, 2009 at 10:58:57PM +0900, Magnus Damm wrote:
> Instead of keeping the single vector -> single linux irq mapping
> we extend the intc code to support merging of vectors to a single
> linux irq. This helps processors such as sh7750, sh7780 and sh7785
> which have more vectors than masking ability. With this patch in
> place we can modify the intc tables to use one irq per maskable
> irq source. Please note the following:
> 
>  - If multiple vectors share the same enum then only the
>    first vector will be available as a linux irq.
> 
>  - Drivers may need to be rewritten to get pending irq 
>    source from the hardware block instead of irq number.
> 
> This patch together with the sh7785 specific intc tables solves
> DMA controller irq issues related to buggy interrupt masking.
> 
> Signed-off-by: Magnus Damm <damm@igel.co.jp>
> Reported-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>

Please try to keep the flow consistent here. Reported-by should always be
first, while Tested-by and so on tend to follow your Signed-off-by.

On Tue, Feb 24, 2009 at 10:59:04PM +0900, Magnus Damm wrote:
> Update intc tables and platform data to use one linux irq
> per maskable interrupt source instead of keeping the one-to-one
> mapping between vectors and linux irqs.
> 
> This fixes potential irq masking issues for sh775x hardware
> blocks such as SCI/SCIF/RTC/DMAC/TMU2/REF.

On Tue, Feb 24, 2009 at 10:59:12PM +0900, Magnus Damm wrote:
> Update intc tables and platform data to use one linux irq
> per maskable interrupt source instead of keeping the one-to-one
> mapping between vectors and linux irqs.
> 
> This fixes potential irq masking issues for sh7780 hardware
> blocks such as SCIF/RTC/DMAC/PCIC5/MMCIF/FLCTL/GPIO

On Tue, Feb 24, 2009 at 10:59:19PM +0900, Magnus Damm wrote:
> Update intc tables and platform data to use one linux irq
> per maskable interrupt source instead of keeping the one-to-one
> mapping between vectors and linux irqs.
> 
> This fixes potential irq masking issues for sh7785 hardware
> blocks such as SCIF/DMAC/PCIC5/MMCIF/GDTA/FLCTL/GPIO

All applied, thanks.
--
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
diff mbox

Patch

--- 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)