Skip to contentSkip to conversation

Post-mainline updates of serial_arc driver

PATCH New Alexey Brodkin 2 participants 6 messages Feb 8, 2014 – Feb 21, 2014

lore
Share & tools
lore
#0 lore raw

cover Post-mainline updates of serial_arc driver

serial_arc driver didn't exist in U-Boot Master branch until supoort of ARC700 architecture was accepted yesterday.

Because of that there was no way to apply pathes to initially approved version searial_arc driver.

So now when driver is in U-Boot source tree it's time to submit 2 minor fixes that are required for propoer driver operation in:
* Simulation
* On big-endian machines

Alexey Brodkin (2):
serial/serial_arc: add work-around of ISS bug serial/serial_arc: switch from {read|write}l to {read|write}b
accessors

 drivers/serial/serial_arc.c | 30 +++++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)
Signature · 1 line
1.8.5.3
#1 lore raw

PATCH 1/2 serial/serial_arc: add work-around of ISS bug

Explanation is in in-lined comment.

Cc Vineet Gupta <[email protected]>
Cc Noam Camus <[email protected]>
Cc Tom Rini <[email protected]>
---
 drivers/serial/serial_arc.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/serial/serial_arc.c +16 -0
index e63d25d..55d0769 100644
@@ -39,7 +39,23 @@ static void arc_serial_setbrg(void)
 
 	arc_console_baud = gd->cpu_clk / (gd->baudrate * 4) - 1;
 	writel(arc_console_baud & 0xff, &regs->baudl);
+
+#ifdef CONFIG_ARC
+	/*
+	 * UART ISS(Instruction Set simulator) emulation has a subtle bug:
+	 * A existing value of Baudh = 0 is used as a indication to startup
+	 * it's internal state machine.
+	 * Thus if baudh is set to 0, 2 times, it chokes.
+	 * This happens with BAUD=115200 and the formaula above
+	 * Until that is fixed, when running on ISS, we will set baudh to !0
+	 */
+	if (gd->arch.running_on_hw)
+		writel((arc_console_baud & 0xff00) >> 8, &regs->baudh);
+	else
+		writel(1, &regs->baudh);
+#else
 	writel((arc_console_baud & 0xff00) >> 8, &regs->baudh);
+#endif
 }
 
 static int arc_serial_init(void)
Signature · 1 line
1.8.5.3
#2 lore raw

PATCH 1/2 serial/serial_arc: add work-around of ISS bug

Quoted 7 lines · Alexey Brodkin

Explanation is in in-lined comment.

Cc Vineet Gupta <[email protected]>
Cc Noam Camus <[email protected]>
Cc Tom Rini <[email protected]>

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140221/72bc423f/attachment.pgp>
#3 lore raw

PATCH 2/2 serial/serial_arc: switch from {read|write}l to {read|write}b accessors

In reply to Alexey Brodkin

This is required for proper functionality on big-endian targets. Memory-mapped registres of ARC UART are not 32-bit words but 8-bit bytes so on little-endian target either acessor (_l or _b) works fine. On big-endian only _b accessors works as expected.

Cc Vineet Gupta <[email protected]>
Cc Noam Camus <[email protected]>
Cc Tom Rini <[email protected]>
---
 drivers/serial/serial_arc.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/serial/serial_arc.c +9 -9
index 55d0769..b21b12b 100644
@@ -38,7 +38,7 @@ static void arc_serial_setbrg(void)
 		gd->baudrate = CONFIG_BAUDRATE;
 
 	arc_console_baud = gd->cpu_clk / (gd->baudrate * 4) - 1;
-	writel(arc_console_baud & 0xff, &regs->baudl);
+	writeb(arc_console_baud & 0xff, &regs->baudl);
 
 #ifdef CONFIG_ARC
 	/*
@@ -50,11 +50,11 @@ static void arc_serial_setbrg(void)
 	 * Until that is fixed, when running on ISS, we will set baudh to !0
 	 */
 	if (gd->arch.running_on_hw)
-		writel((arc_console_baud & 0xff00) >> 8, &regs->baudh);
+		writeb((arc_console_baud & 0xff00) >> 8, &regs->baudh);
 	else
-		writel(1, &regs->baudh);
+		writeb(1, &regs->baudh);
 #else
-	writel((arc_console_baud & 0xff00) >> 8, &regs->baudh);
+	writeb((arc_console_baud & 0xff00) >> 8, &regs->baudh);
 #endif
 }
 
@@ -70,15 +70,15 @@ static void arc_serial_putc(const char c)
 	if (c == '\n')
 		arc_serial_putc('\r');
 
-	while (!(readl(&regs->status) & UART_TXEMPTY))
+	while (!(readb(&regs->status) & UART_TXEMPTY))
 		;
 
-	writel(c, &regs->data);
+	writeb(c, &regs->data);
 }
 
 static int arc_serial_tstc(void)
 {
-	return !(readl(&regs->status) & UART_RXEMPTY);
+	return !(readb(&regs->status) & UART_RXEMPTY);
 }
 
 static int arc_serial_getc(void)
@@ -87,10 +87,10 @@ static int arc_serial_getc(void)
 		;
 
 	/* Check for overflow errors */
-	if (readl(&regs->status) & UART_OVERFLOW_ERR)
+	if (readb(&regs->status) & UART_OVERFLOW_ERR)
 		return 0;
 
-	return readl(&regs->data) & 0xFF;
+	return readb(&regs->data) & 0xFF;
 }
 
 static void arc_serial_puts(const char *s)
Signature · 1 line
1.8.5.3
#4 lore raw

PATCH 2/2 serial/serial_arc: switch from {read|write}l to {read|write}b accessors

Quoted 10 lines · Alexey Brodkin

This is required for proper functionality on big-endian targets. Memory-mapped registres of ARC UART are not 32-bit words but 8-bit bytes so on little-endian target either acessor (_l or _b) works fine. On big-endian only _b accessors works as expected.

Cc Vineet Gupta <[email protected]>
Cc Noam Camus <[email protected]>
Cc Tom Rini <[email protected]>

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140221/7cb6c950/attachment.pgp>
#5 lore raw

cover Post-mainline updates of serial_arc driver

In reply to Alexey Brodkin
Quoted 11 lines · Alexey Brodkin

serial_arc driver didn't exist in U-Boot Master branch until supoort of ARC700 architecture was accepted yesterday.

Because of that there was no way to apply pathes to initially approved version searial_arc driver.

So now when driver is in U-Boot source tree it's time to submit 2 minor fixes that are required for propoer driver operation in:
* Simulation
* On big-endian machines

Quoted 8 lines

Alexey Brodkin (2):
serial/serial_arc: add work-around of ISS bug serial/serial_arc: switch from {read|write}l to {read|write}b
accessors

 drivers/serial/serial_arc.c | 30 +++++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)

Hello Tom,

Please treat it as a polite reminder.
Would be good to apply this series sometime soon

http://patchwork.ozlabs.org/patch/318373/
http://patchwork.ozlabs.org/patch/318374/

Regards,
Alexey