Merge branch 'drm-patches' of master.kernel.org:/pub/scm/linux/kernel/git/airlied...
[linux-drm-fsl-dcu.git] / arch / powerpc / kernel / udbg_16550.c
index 5d29dcca523c113e62e9a6332552c145fbe01270..a963f657222b3341eabdc7aa9272ca56cd4b84a0 100644 (file)
@@ -8,13 +8,14 @@
  *      as published by the Free Software Foundation; either version
  *      2 of the License, or (at your option) any later version.
  */
-#include <linux/config.h>
 #include <linux/types.h>
 #include <asm/udbg.h>
 #include <asm/io.h>
 
 extern u8 real_readb(volatile u8 __iomem  *addr);
 extern void real_writeb(u8 data, volatile u8 __iomem *addr);
+extern u8 real_205_readb(volatile u8 __iomem  *addr);
+extern void real_205_writeb(u8 data, volatile u8 __iomem *addr);
 
 struct NS16550 {
        /* this struct must be packed */
@@ -82,10 +83,14 @@ static int udbg_550_getc(void)
 void udbg_init_uart(void __iomem *comport, unsigned int speed,
                    unsigned int clock)
 {
-       unsigned int dll, base_bauds = clock / 16;
+       unsigned int dll, base_bauds;
 
+       if (clock == 0)
+               clock = 1843200;
        if (speed == 0)
                speed = 9600;
+
+       base_bauds = clock / 16;
        dll = base_bauds / speed;
 
        if (comport) {
@@ -164,3 +169,25 @@ void __init udbg_init_maple_realmode(void)
        udbg_getc_poll = NULL;
 }
 #endif /* CONFIG_PPC_MAPLE */
+
+#ifdef CONFIG_PPC_PASEMI
+void udbg_pas_real_putc(char c)
+{
+       if (udbg_comport) {
+               while ((real_205_readb(&udbg_comport->lsr) & LSR_THRE) == 0)
+                       /* wait for idle */;
+               real_205_writeb(c, &udbg_comport->thr); eieio();
+               if (c == '\n')
+                       udbg_pas_real_putc('\r');
+       }
+}
+
+void udbg_init_pas_realmode(void)
+{
+       udbg_comport = (volatile struct NS16550 __iomem *)0xfcff03f8UL;
+
+       udbg_putc = udbg_pas_real_putc;
+       udbg_getc = NULL;
+       udbg_getc_poll = NULL;
+}
+#endif /* CONFIG_PPC_MAPLE */