Commit 1d568c7666e81fa920de38a3c83895764ea8cf0f

Authored by Alexey Brodkin
Committed by Tom Rini
1 parent 6853e6aa77

serial/serial_arc: add work-around of ISS bug

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>

Showing 1 changed file with 16 additions and 0 deletions Side-by-side Diff

drivers/serial/serial_arc.c
... ... @@ -39,7 +39,23 @@
39 39  
40 40 arc_console_baud = gd->cpu_clk / (gd->baudrate * 4) - 1;
41 41 writel(arc_console_baud & 0xff, &regs->baudl);
  42 +
  43 +#ifdef CONFIG_ARC
  44 + /*
  45 + * UART ISS(Instruction Set simulator) emulation has a subtle bug:
  46 + * A existing value of Baudh = 0 is used as a indication to startup
  47 + * it's internal state machine.
  48 + * Thus if baudh is set to 0, 2 times, it chokes.
  49 + * This happens with BAUD=115200 and the formaula above
  50 + * Until that is fixed, when running on ISS, we will set baudh to !0
  51 + */
  52 + if (gd->arch.running_on_hw)
  53 + writel((arc_console_baud & 0xff00) >> 8, &regs->baudh);
  54 + else
  55 + writel(1, &regs->baudh);
  56 +#else
42 57 writel((arc_console_baud & 0xff00) >> 8, &regs->baudh);
  58 +#endif
43 59 }
44 60  
45 61 static int arc_serial_init(void)