Skip to contentSkip to conversation

ARM/serial: add a DCC based console driver

RFC In review Juergen Beisert 2 participants 4 messages Mar 13, 2012

lore
Share & tools
lore
#0 lore raw

RFC 1/1 ARM/serial: add a DCC based console driver

Hi,

please find attached an DCC based driver for Barebox to be able to get early boot messages. It acts as a regular serial console and can be used in conjunction with a JTAG debugger. This is really useful when no serial console is available (don't ask why...) and the bootloader hangs prior it can enable a network based console.

One issue is still present and I need some hints what might be going wrong here:

Sending chars via DCC blocks for ever, when I'm using a simple while loop waiting for the DCC_OUTPUT_BUSY to be cleared. After adding a timeout loop I receive every other char at the JTAG side. When I write the char to the DCC even if it timeout, I receive *every* char. Only some chars are lost when I reduce the timeout value below 750 us.
Any idea? I checked the kernel source, but they doing the same: Waiting for the DCC_OUTPUT_BUSY to be cleared and timeout after a specific amount of loops (but without writing the char in this case).

Comments are welcome.

commit 809d26930dc734faad2a4ac4cc5126487a8af261

Author: Juergen Beisert <[email protected]>
Date:   Tue Mar 13 13:01:22 2012 +0100

ARM/serial: add a DCC based console driver

drivers/serial/Kconfig +6 -0
index 9c7f9cf..a71efcf 100644
@@ -103,4 +103,10 @@ config DRIVER_SERIAL_DUMMY
 	   an input character. Its sole purpose is to provide a regular console
 	   to work with the netconsole.
 
+config DRIVER_SERIAL_DCC
+	bool "DCC serial driver"
+	help
+	   This is a DCC based console driver. DCC is an ARM core internal
+	   EmbeddedICE feature and can be used with a JTAG debugger.
+
 endmenu
drivers/serial/Makefile +1 -0
index 0e89c01..91412bb 100644
@@ -20,3 +20,4 @@ obj-$(CONFIG_DRIVER_SERIAL_ALTERA)		+= serial_altera.o
 obj-$(CONFIG_DRIVER_SERIAL_ALTERA_JTAG)		+= serial_altera_jtag.o
 obj-$(CONFIG_DRIVER_SERIAL_PXA)			+= serial_pxa.o
 obj-$(CONFIG_DRIVER_SERIAL_DUMMY)		+= serial_dummy.o
+obj-$(CONFIG_DRIVER_SERIAL_DCC)			+= serial_dcc.o
drivers/serial/serial_dcc.c new file +177 -0

177 lines not on this page · raw message

jbe

Signature · 7 lines
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw
Quoted 20 lines · Juergen Beisert

Hi,

please find attached an DCC based driver for Barebox to be able to get early boot messages. It acts as a regular serial console and can be used in conjunction with a JTAG debugger. This is really useful when no serial console is available (don't ask why...) and the bootloader hangs prior it can enable a network based console.

One issue is still present and I need some hints what might be going wrong here:

Sending chars via DCC blocks for ever, when I'm using a simple while loop waiting for the DCC_OUTPUT_BUSY to be cleared. After adding a timeout loop I receive every other char at the JTAG side. When I write the char to the DCC even if it timeout, I receive *every* char. Only some chars are lost when I reduce the timeout value below 750 us.
Any idea? I checked the kernel source, but they doing the same: Waiting for the DCC_OUTPUT_BUSY to be cleared and timeout after a specific amount of loops (but without writing the char in this case).

Quoted 1 line

Comments are welcome.

You are probably not aware that we already have such a driver in drivers/serial/arm_dcc.c.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw
Quoted 5 lines · Sascha Hauer

[...]

Quoted 1 line

Comments are welcome.

You are probably not aware that we already have such a driver in drivers/serial/arm_dcc.c.

Ups, you are right. :)

jbe

Signature · 9 lines
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | Phone: +49-5121-206917-5128 |
Vertretung Sued/Muenchen, Germany             | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686              | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw
In reply to Juergen Beisert
Quoted 10 lines · Myself

[...]
Sending chars via DCC blocks for ever, when I'm using a simple while loop waiting for the DCC_OUTPUT_BUSY to be cleared. After adding a timeout loop I receive every other char at the JTAG side. When I write the char to the DCC even if it timeout, I receive *every* char. Only some chars are lost when I reduce the timeout value below 750 us.
Any idea? I checked the kernel source, but they doing the same: Waiting for the DCC_OUTPUT_BUSY to be cleared and timeout after a specific amount of loops (but without writing the char in this case).
[...]

Forget about that. The dcc_serial_putc() is broken in this patch. My ARMv5 *always* signals a DCC_OUTPUT_BUSY. If I ignore this bit and just wait about 750 µs between the chars it works as expected. Still have to find out, why it always signals a DCC_OUTPUT_BUSY...

jbe

Signature · 7 lines
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox