public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/2] Post-mainline updates of serial_arc driver
@ 2014-02-08  6:10 Alexey Brodkin
  2014-02-08  6:10 ` [U-Boot] [PATCH 1/2] serial/serial_arc: add work-around of ISS bug Alexey Brodkin
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Alexey Brodkin @ 2014-02-08  6:10 UTC (permalink / raw)
  To: u-boot

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

-- 
1.8.5.3

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

* [U-Boot] [PATCH 1/2] serial/serial_arc: add work-around of ISS bug
  2014-02-08  6:10 [U-Boot] [PATCH 0/2] Post-mainline updates of serial_arc driver Alexey Brodkin
@ 2014-02-08  6:10 ` Alexey Brodkin
  2014-02-21 14:35   ` [U-Boot] [U-Boot, " Tom Rini
  2014-02-08  6:10 ` [U-Boot] [PATCH 2/2] serial/serial_arc: switch from {read|write}l to {read|write}b accessors Alexey Brodkin
  2014-02-21 10:09 ` [U-Boot] [PATCH 0/2] Post-mainline updates of serial_arc driver Alexey Brodkin
  2 siblings, 1 reply; 6+ messages in thread
From: Alexey Brodkin @ 2014-02-08  6:10 UTC (permalink / raw)
  To: u-boot

Explanation is in in-lined comment.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Noam Camus <noamc@ezchip.com>
Cc: Tom Rini <trini@ti.com>
---
 drivers/serial/serial_arc.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/serial/serial_arc.c b/drivers/serial/serial_arc.c
index e63d25d..55d0769 100644
--- a/drivers/serial/serial_arc.c
+++ b/drivers/serial/serial_arc.c
@@ -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)
-- 
1.8.5.3

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

* [U-Boot] [PATCH 2/2] serial/serial_arc: switch from {read|write}l to {read|write}b accessors
  2014-02-08  6:10 [U-Boot] [PATCH 0/2] Post-mainline updates of serial_arc driver Alexey Brodkin
  2014-02-08  6:10 ` [U-Boot] [PATCH 1/2] serial/serial_arc: add work-around of ISS bug Alexey Brodkin
@ 2014-02-08  6:10 ` Alexey Brodkin
  2014-02-21 14:36   ` [U-Boot] [U-Boot, " Tom Rini
  2014-02-21 10:09 ` [U-Boot] [PATCH 0/2] Post-mainline updates of serial_arc driver Alexey Brodkin
  2 siblings, 1 reply; 6+ messages in thread
From: Alexey Brodkin @ 2014-02-08  6:10 UTC (permalink / raw)
  To: u-boot

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.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Noam Camus <noamc@ezchip.com>
Cc: Tom Rini <trini@ti.com>
---
 drivers/serial/serial_arc.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/serial/serial_arc.c b/drivers/serial/serial_arc.c
index 55d0769..b21b12b 100644
--- a/drivers/serial/serial_arc.c
+++ b/drivers/serial/serial_arc.c
@@ -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)
-- 
1.8.5.3

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

* [U-Boot] [PATCH 0/2] Post-mainline updates of serial_arc driver
  2014-02-08  6:10 [U-Boot] [PATCH 0/2] Post-mainline updates of serial_arc driver Alexey Brodkin
  2014-02-08  6:10 ` [U-Boot] [PATCH 1/2] serial/serial_arc: add work-around of ISS bug Alexey Brodkin
  2014-02-08  6:10 ` [U-Boot] [PATCH 2/2] serial/serial_arc: switch from {read|write}l to {read|write}b accessors Alexey Brodkin
@ 2014-02-21 10:09 ` Alexey Brodkin
  2 siblings, 0 replies; 6+ messages in thread
From: Alexey Brodkin @ 2014-02-21 10:09 UTC (permalink / raw)
  To: u-boot

On Sat, 2014-02-08 at 10:10 +0400, Alexey Brodkin wrote:
> 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(-)
> 

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

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

* [U-Boot] [U-Boot, 1/2] serial/serial_arc: add work-around of ISS bug
  2014-02-08  6:10 ` [U-Boot] [PATCH 1/2] serial/serial_arc: add work-around of ISS bug Alexey Brodkin
@ 2014-02-21 14:35   ` Tom Rini
  0 siblings, 0 replies; 6+ messages in thread
From: Tom Rini @ 2014-02-21 14:35 UTC (permalink / raw)
  To: u-boot

On Sat, Feb 08, 2014 at 10:10:01AM +0400, Alexey Brodkin wrote:

> Explanation is in in-lined comment.
> 
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> 
> Cc: Vineet Gupta <vgupta@synopsys.com>
> Cc: Noam Camus <noamc@ezchip.com>
> Cc: Tom Rini <trini@ti.com>

Applied to u-boot/master, thanks!

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

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

* [U-Boot] [U-Boot, 2/2] serial/serial_arc: switch from {read|write}l to {read|write}b accessors
  2014-02-08  6:10 ` [U-Boot] [PATCH 2/2] serial/serial_arc: switch from {read|write}l to {read|write}b accessors Alexey Brodkin
@ 2014-02-21 14:36   ` Tom Rini
  0 siblings, 0 replies; 6+ messages in thread
From: Tom Rini @ 2014-02-21 14:36 UTC (permalink / raw)
  To: u-boot

On Sat, Feb 08, 2014 at 10:10:02AM +0400, Alexey Brodkin wrote:

> 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.
> 
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> 
> Cc: Vineet Gupta <vgupta@synopsys.com>
> Cc: Noam Camus <noamc@ezchip.com>
> Cc: Tom Rini <trini@ti.com>

Applied to u-boot/master, thanks!

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

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

end of thread, other threads:[~2014-02-21 14:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-08  6:10 [U-Boot] [PATCH 0/2] Post-mainline updates of serial_arc driver Alexey Brodkin
2014-02-08  6:10 ` [U-Boot] [PATCH 1/2] serial/serial_arc: add work-around of ISS bug Alexey Brodkin
2014-02-21 14:35   ` [U-Boot] [U-Boot, " Tom Rini
2014-02-08  6:10 ` [U-Boot] [PATCH 2/2] serial/serial_arc: switch from {read|write}l to {read|write}b accessors Alexey Brodkin
2014-02-21 14:36   ` [U-Boot] [U-Boot, " Tom Rini
2014-02-21 10:09 ` [U-Boot] [PATCH 0/2] Post-mainline updates of serial_arc driver Alexey Brodkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox