Re: [PATCH] serial: cpm_uart: implement the cpm_uart_early_write() function for console poll

Previous thread: pcmcia: fix 'driver ... did not release config properly' warning by Patrick McHardy on Wednesday, June 16, 2010 - 7:47 pm. (2 messages)

Next thread: [RFC] High availability in KVM by Fernando Luis Vazquez Cao on Wednesday, June 16, 2010 - 8:15 pm. (7 messages)
From: Dongdong Deng
Date: Wednesday, June 16, 2010 - 8:13 pm

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 = ...
From: Greg KH
Date: Thursday, June 17, 2010 - 10:31 am

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

thanks,

greg k-h
--


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,

--

From: Greg KH
Date: Thursday, June 17, 2010 - 7:37 pm

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

Previous thread: pcmcia: fix 'driver ... did not release config properly' warning by Patrick McHardy on Wednesday, June 16, 2010 - 7:47 pm. (2 messages)

Next thread: [RFC] High availability in KVM by Fernando Luis Vazquez Cao on Wednesday, June 16, 2010 - 8:15 pm. (7 messages)