Hi John,<br><br>I've a small question about ns16550 boot support.<br>I can't see any code related to either "clock-frequency" or "current-speed" key words.<br>Such actions are performed in of_serial.c to get appropriate baud rate (update of UART_DLL and UART_DLM).<br>
<br>Is it needed or is it a misunderstanding? <br>Personally, I have added this below debug code (dirty :)) to make it work.<br><br>diff --git a/arch/powerpc/boot/ns16550.c b/arch/powerpc/boot/ns16550.c<br>index f8f1b2f..850e223 100644<br>
--- a/arch/powerpc/boot/ns16550.c<br>+++ b/arch/powerpc/boot/ns16550.c<br>@@ -26,6 +26,9 @@<br> #define UART_MSR 6 /* In: Modem Status Register */<br> #define UART_SCR 7 /* I/O: Scratch Register */<br> <br>+#define UART_LCR_DLAB 0x80 /* Divisor latch access */<br>
+#define UART_LCR_8_DATA_BITS 0x03<br>+<br> static unsigned char *reg_base;<br> static u32 reg_shift;<br> <br>@@ -56,6 +59,10 @@ int ns16550_console_init(void *devp, struct serial_console_data *scdp)<br> {<br> int n;<br>
unsigned long reg_phys;<br>+ unsigned long divisor=0;<br>+ unsigned long spd=0, clk=0;<br>+<br>+<br> <br> n = getprop(devp, "virtual-reg", &reg_base, sizeof(reg_base));<br> if (n != sizeof(reg_base)) {<br>
@@ -75,5 +82,23 @@ int ns16550_console_init(void *devp, struct serial_console_data *scdp)<br> scdp->tstc = ns16550_tstc;<br> scdp->close = NULL;<br> <br>+ n = getprop(devp, "current-speed", &spd, sizeof(spd));<br>
+<br>+<br>+ n = getprop(devp, "clock-frequency", &clk, sizeof(clk));<br>+<br>+<br>+ if(spd&&clk)<br>+ {<br>+<br>+ divisor = clk / (spd * 16UL);<br>+<br>+ out_8(reg_base + (UART_FCR << reg_shift), 0x06);<br>
+ out_8(reg_base + (UART_LCR << reg_shift), UART_LCR_8_DATA_BITS|UART_LCR_DLAB);<br>+ out_8(reg_base + (UART_DLL << reg_shift), divisor&0xff);<br>+ out_8(reg_base + (UART_DLM << reg_shift), (divisor>>8)&0xff);<br>
+ out_8(reg_base + (UART_LCR << reg_shift), UART_LCR_8_DATA_BITS);<br>+<br>+ }<br> return 0;<br> <br>Best regards,<br>Johann<br><br><div class="gmail_quote">On Wed, Apr 2, 2008 at 4:52 PM, John Linn <<a href="mailto:john.linn@xilinx.com">john.linn@xilinx.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">The Xilinx 16550 uart core is not a standard 16550 because it uses<br>
word-based addressing rather than byte-based adressing. With<br>
additional properties it is compatible with the open firmware<br>
'ns16550' compatible binding.<br>
<br>
This code updates the ns16550 driver to use the reg-offset property<br>
so that the Xilinx UART 16550 can be used with it. The reg-shift<br>
was already being handled.<br>
<br>
Signed-off-by: John Linn <<a href="mailto:john.linn@xilinx.com">john.linn@xilinx.com</a>><br>
---<br>
arch/powerpc/boot/ns16550.c | 5 +++++<br>
1 files changed, 5 insertions(+), 0 deletions(-)<br>
<br>
diff --git a/arch/powerpc/boot/ns16550.c b/arch/powerpc/boot/ns16550.c<br>
index f8f1b2f..da9d2c2 100644<br>
--- a/arch/powerpc/boot/ns16550.c<br>
+++ b/arch/powerpc/boot/ns16550.c<br>
@@ -56,6 +56,7 @@ int ns16550_console_init(void *devp, struct serial_console_data *scdp)<br>
{<br>
int n;<br>
unsigned long reg_phys;<br>
+ u32 reg_offset;<br>
<br>
n = getprop(devp, "virtual-reg", &reg_base, sizeof(reg_base));<br>
if (n != sizeof(reg_base)) {<br>
@@ -65,6 +66,10 @@ int ns16550_console_init(void *devp, struct serial_console_data *scdp)<br>
reg_base = (void *)reg_phys;<br>
}<br>
<br>
+ n = getprop(devp, "reg-offset", &reg_offset, sizeof(reg_offset));<br>
+ if (n == sizeof(reg_offset))<br>
+ reg_base += reg_offset;<br>
+<br>
n = getprop(devp, "reg-shift", &reg_shift, sizeof(reg_shift));<br>
if (n != sizeof(reg_shift))<br>
reg_shift = 0;<br>
--<br>
<a href="http://1.5.2.1" target="_blank">1.5.2.1</a><br>
<br>
<br>
<br>
_______________________________________________<br>
Linuxppc-dev mailing list<br>
<a href="mailto:Linuxppc-dev@ozlabs.org">Linuxppc-dev@ozlabs.org</a><br>
<a href="https://ozlabs.org/mailman/listinfo/linuxppc-dev" target="_blank">https://ozlabs.org/mailman/listinfo/linuxppc-dev</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Johann Baudy<br><a href="mailto:johaahn@gmail.com">johaahn@gmail.com</a>