All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] serial: cpm_uart: implement the cpm_uart_early_write() function for console poll
@ 2010-06-17  3:13 Dongdong Deng
  2010-06-17 17:31 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Dongdong Deng @ 2010-06-17  3:13 UTC (permalink / raw)
  To: jason.wessel, gregkh, galak, bruce.ashfield, dongdong.deng; +Cc: linux-kernel

The cpm_uart_early_write() function which was used for console poll
isn't implemented in the cpm uart driver.

Implementing this function both fixes the build and allows
kgdboc to work via the cpm uart.

Signed-off-by: Dongdong Deng <dongdong.deng@windriver.com>
Reviewed-by: Bruce Ashfield <bruce.ashfield@windriver.com>
---
 drivers/serial/cpm_uart/cpm_uart_core.c |  143 +++++++++++++++++--------------
 1 files changed, 79 insertions(+), 64 deletions(-)

diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c
index 9eb62a2..cd6cf57 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -930,6 +930,83 @@ static void cpm_uart_config_port(struct uart_port *port, int flags)
 	}
 }
 
+#if defined(CONFIG_CONSOLE_POLL) || defined(CONFIG_SERIAL_CPM_CONSOLE)
+/*
+ * Write a string to the serial port
+ * Note that this is called with interrupts already disabled
+ */
+static void cpm_uart_early_write(struct uart_cpm_port *pinfo,
+		const char *string, u_int count)
+{
+	unsigned int i;
+	cbd_t __iomem *bdp, *bdbase;
+	unsigned char *cpm_outp_addr;
+
+	/* Get the address of the host memory buffer.
+	 */
+	bdp = pinfo->tx_cur;
+	bdbase = pinfo->tx_bd_base;
+
+	/*
+	 * Now, do each character.  This is not as bad as it looks
+	 * since this is a holding FIFO and not a transmitting FIFO.
+	 * We could add the complexity of filling the entire transmit
+	 * buffer, but we would just wait longer between accesses......
+	 */
+	for (i = 0; i < count; i++, string++) {
+		/* Wait for transmitter fifo to empty.
+		 * Ready indicates output is ready, and xmt is doing
+		 * that, not that it is ready for us to send.
+		 */
+		while ((in_be16(&bdp->cbd_sc) & BD_SC_READY) != 0)
+			;
+
+		/* Send the character out.
+		 * If the buffer address is in the CPM DPRAM, don't
+		 * convert it.
+		 */
+		cpm_outp_addr = cpm2cpu_addr(in_be32(&bdp->cbd_bufaddr),
+					pinfo);
+		*cpm_outp_addr = *string;
+
+		out_be16(&bdp->cbd_datlen, 1);
+		setbits16(&bdp->cbd_sc, BD_SC_READY);
+
+		if (in_be16(&bdp->cbd_sc) & BD_SC_WRAP)
+			bdp = bdbase;
+		else
+			bdp++;
+
+		/* if a LF, also do CR... */
+		if (*string == 10) {
+			while ((in_be16(&bdp->cbd_sc) & BD_SC_READY) != 0)
+				;
+
+			cpm_outp_addr = cpm2cpu_addr(in_be32(&bdp->cbd_bufaddr),
+						pinfo);
+			*cpm_outp_addr = 13;
+
+			out_be16(&bdp->cbd_datlen, 1);
+			setbits16(&bdp->cbd_sc, BD_SC_READY);
+
+			if (in_be16(&bdp->cbd_sc) & BD_SC_WRAP)
+				bdp = bdbase;
+			else
+				bdp++;
+		}
+	}
+
+	/*
+	 * Finally, Wait for transmitter & holding register to empty
+	 *  and restore the IER
+	 */
+	while ((in_be16(&bdp->cbd_sc) & BD_SC_READY) != 0)
+		;
+
+	pinfo->tx_cur = bdp;
+}
+#endif
+
 #ifdef CONFIG_CONSOLE_POLL
 /* Serial polling routines for writing and reading from the uart while
  * in an interrupt or debug context.
@@ -999,7 +1076,7 @@ static void cpm_put_poll_char(struct uart_port *port,
 	static char ch[2];
 
 	ch[0] = (char)c;
-	cpm_uart_early_write(pinfo->port.line, ch, 1);
+	cpm_uart_early_write(pinfo, ch, 1);
 }
 #endif /* CONFIG_CONSOLE_POLL */
 
@@ -1130,9 +1207,6 @@ static void cpm_uart_console_write(struct console *co, const char *s,
 				   u_int count)
 {
 	struct uart_cpm_port *pinfo = &cpm_uart_ports[co->index];
-	unsigned int i;
-	cbd_t __iomem *bdp, *bdbase;
-	unsigned char *cp;
 	unsigned long flags;
 	int nolock = oops_in_progress;
 
@@ -1142,66 +1216,7 @@ static void cpm_uart_console_write(struct console *co, const char *s,
 		spin_lock_irqsave(&pinfo->port.lock, flags);
 	}
 
-	/* Get the address of the host memory buffer.
-	 */
-	bdp = pinfo->tx_cur;
-	bdbase = pinfo->tx_bd_base;
-
-	/*
-	 * Now, do each character.  This is not as bad as it looks
-	 * since this is a holding FIFO and not a transmitting FIFO.
-	 * We could add the complexity of filling the entire transmit
-	 * buffer, but we would just wait longer between accesses......
-	 */
-	for (i = 0; i < count; i++, s++) {
-		/* Wait for transmitter fifo to empty.
-		 * Ready indicates output is ready, and xmt is doing
-		 * that, not that it is ready for us to send.
-		 */
-		while ((in_be16(&bdp->cbd_sc) & BD_SC_READY) != 0)
-			;
-
-		/* Send the character out.
-		 * If the buffer address is in the CPM DPRAM, don't
-		 * convert it.
-		 */
-		cp = cpm2cpu_addr(in_be32(&bdp->cbd_bufaddr), pinfo);
-		*cp = *s;
-
-		out_be16(&bdp->cbd_datlen, 1);
-		setbits16(&bdp->cbd_sc, BD_SC_READY);
-
-		if (in_be16(&bdp->cbd_sc) & BD_SC_WRAP)
-			bdp = bdbase;
-		else
-			bdp++;
-
-		/* if a LF, also do CR... */
-		if (*s == 10) {
-			while ((in_be16(&bdp->cbd_sc) & BD_SC_READY) != 0)
-				;
-
-			cp = cpm2cpu_addr(in_be32(&bdp->cbd_bufaddr), pinfo);
-			*cp = 13;
-
-			out_be16(&bdp->cbd_datlen, 1);
-			setbits16(&bdp->cbd_sc, BD_SC_READY);
-
-			if (in_be16(&bdp->cbd_sc) & BD_SC_WRAP)
-				bdp = bdbase;
-			else
-				bdp++;
-		}
-	}
-
-	/*
-	 * Finally, Wait for transmitter & holding register to empty
-	 *  and restore the IER
-	 */
-	while ((in_be16(&bdp->cbd_sc) & BD_SC_READY) != 0)
-		;
-
-	pinfo->tx_cur = bdp;
+	cpm_uart_early_write(pinfo, s, count);
 
 	if (unlikely(nolock)) {
 		local_irq_restore(flags);
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] serial: cpm_uart: implement the cpm_uart_early_write() function for console poll
  2010-06-17  3:13 [PATCH] serial: cpm_uart: implement the cpm_uart_early_write() function for console poll Dongdong Deng
@ 2010-06-17 17:31 ` Greg KH
  2010-06-18  2:10   ` DDD
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2010-06-17 17:31 UTC (permalink / raw)
  To: Dongdong Deng; +Cc: jason.wessel, gregkh, galak, bruce.ashfield, linux-kernel

On Thu, Jun 17, 2010 at 11:13:40AM +0800, Dongdong Deng wrote:
> The cpm_uart_early_write() function which was used for console poll
> isn't implemented in the cpm uart driver.
> 
> Implementing this function both fixes the build and allows
> kgdboc to work via the cpm uart.

So this is needed for the .35 release, right?  Any older kernel releases
as well?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] serial: cpm_uart: implement the cpm_uart_early_write() function for console poll
  2010-06-17 17:31 ` Greg KH
@ 2010-06-18  2:10   ` DDD
  2010-06-18  2:37     ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: DDD @ 2010-06-18  2:10 UTC (permalink / raw)
  To: Greg KH; +Cc: jason.wessel, gregkh, galak, bruce.ashfield, linux-kernel

Greg KH wrote:
> On Thu, Jun 17, 2010 at 11:13:40AM +0800, Dongdong Deng wrote:
>> The cpm_uart_early_write() function which was used for console poll
>> isn't implemented in the cpm uart driver.
>>
>> Implementing this function both fixes the build and allows
>> kgdboc to work via the cpm uart.
> 
> So this is needed for the .35 release, right?  Any older kernel releases
> as well?

Yes, it is needed for the .35 release.

The cpm_uart_early_write() of cpm_uart was introduced at 2.6.27,
so this patch is needed from 2.6.27.

Thanks,
Dongdong

> 
> thanks,
> 
> greg k-h
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] serial: cpm_uart: implement the cpm_uart_early_write() function for console poll
  2010-06-18  2:10   ` DDD
@ 2010-06-18  2:37     ` Greg KH
  2010-06-18  2:58       ` DDD
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2010-06-18  2:37 UTC (permalink / raw)
  To: DDD; +Cc: Greg KH, jason.wessel, galak, bruce.ashfield, linux-kernel

On Fri, Jun 18, 2010 at 10:10:48AM +0800, DDD wrote:
> Greg KH wrote:
> >On Thu, Jun 17, 2010 at 11:13:40AM +0800, Dongdong Deng wrote:
> >>The cpm_uart_early_write() function which was used for console poll
> >>isn't implemented in the cpm uart driver.
> >>
> >>Implementing this function both fixes the build and allows
> >>kgdboc to work via the cpm uart.
> >
> >So this is needed for the .35 release, right?  Any older kernel releases
> >as well?
> 
> Yes, it is needed for the .35 release.
> 
> The cpm_uart_early_write() of cpm_uart was introduced at 2.6.27,
> so this patch is needed from 2.6.27.

So no one has noticed that the driver doesn't build at all since the .27
kernel release?  Over 2 years?  I hardly think that it's a rush to fix
it over the next few weeks then :)

I'll go queue it up.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] serial: cpm_uart: implement the cpm_uart_early_write() function for console poll
  2010-06-18  2:37     ` Greg KH
@ 2010-06-18  2:58       ` DDD
  0 siblings, 0 replies; 5+ messages in thread
From: DDD @ 2010-06-18  2:58 UTC (permalink / raw)
  To: Greg KH; +Cc: Greg KH, jason.wessel, galak, bruce.ashfield, linux-kernel

Greg KH wrote:
> On Fri, Jun 18, 2010 at 10:10:48AM +0800, DDD wrote:
>> Greg KH wrote:
>>> On Thu, Jun 17, 2010 at 11:13:40AM +0800, Dongdong Deng wrote:
>>>> The cpm_uart_early_write() function which was used for console poll
>>>> isn't implemented in the cpm uart driver.
>>>>
>>>> Implementing this function both fixes the build and allows
>>>> kgdboc to work via the cpm uart.
>>> So this is needed for the .35 release, right?  Any older kernel releases
>>> as well?
>> Yes, it is needed for the .35 release.
>>
>> The cpm_uart_early_write() of cpm_uart was introduced at 2.6.27,
>> so this patch is needed from 2.6.27.
> 
> So no one has noticed that the driver doesn't build at all since the .27
> kernel release?  Over 2 years?  I hardly think that it's a rush to fix
> it over the next few weeks then :)
>

Hi greg,

The build error just happens when enable the CONFIG_CONSOLE_POLL option.

> I'll go queue it up.

Thanks,

Dongdong

> 
> thanks,
> 
> greg k-h
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-06-18  2:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-17  3:13 [PATCH] serial: cpm_uart: implement the cpm_uart_early_write() function for console poll Dongdong Deng
2010-06-17 17:31 ` Greg KH
2010-06-18  2:10   ` DDD
2010-06-18  2:37     ` Greg KH
2010-06-18  2:58       ` DDD

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.