]> git.sur5r.net Git - u-boot/blobdiff - cpu/mpc5xxx/serial.c
Merge branch 'reloc'
[u-boot] / cpu / mpc5xxx / serial.c
index 6cb523d3c7bf5428d03497341d11906e93d50bcf..a8a384aa58b005ea0e4b185c9cd46148704f3700 100644 (file)
@@ -106,7 +106,7 @@ int serial_init (void)
        /* select clock sources */
 #if defined(CONFIG_MGT5100)
        psc->psc_clock_select = 0xdd00;
-       baseclk = (CFG_MPC5XXX_CLKIN + 16) / 32;
+       baseclk = (CONFIG_SYS_MPC5XXX_CLKIN + 16) / 32;
 #elif defined(CONFIG_MPC5200)
        psc->psc_clock_select = 0;
        baseclk = (gd->ipb_clk + 16) / 32;
@@ -165,6 +165,25 @@ void serial_putc(const char c)
        psc->psc_buffer_8 = c;
 }
 
+#if defined(CONFIG_SERIAL_MULTI)
+void serial_putc_raw_dev(unsigned long dev_base, const char c)
+#else
+void serial_putc_raw(const char c)
+#endif
+{
+#if defined(CONFIG_SERIAL_MULTI)
+       volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
+#else
+       volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
+#endif
+       /* Wait for last character to go. */
+       while (!(psc->psc_status & PSC_SR_TXEMP))
+               ;
+
+       psc->psc_buffer_8 = c;
+}
+
+
 #if defined(CONFIG_SERIAL_MULTI)
 void serial_puts_dev (unsigned long dev_base, const char *s)
 #else
@@ -228,7 +247,7 @@ void serial_setbrg(void)
        unsigned long baseclk, div;
 
 #if defined(CONFIG_MGT5100)
-       baseclk = (CFG_MPC5XXX_CLKIN + 16) / 32;
+       baseclk = (CONFIG_SYS_MPC5XXX_CLKIN + 16) / 32;
 #elif defined(CONFIG_MPC5200)
        baseclk = (gd->ipb_clk + 16) / 32;
 #endif
@@ -239,6 +258,43 @@ void serial_setbrg(void)
        psc->ctlr =  div & 0xff;
 }
 
+#if defined(CONFIG_SERIAL_MULTI)
+void serial_setrts_dev (unsigned long dev_base, int s)
+#else
+void serial_setrts(int s)
+#endif
+{
+#if defined(CONFIG_SERIAL_MULTI)
+       volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
+#else
+       volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
+#endif
+
+       if (s) {
+               /* Assert RTS (become LOW) */
+               psc->op1 = 0x1;
+       }
+       else {
+               /* Negate RTS (become HIGH) */
+               psc->op0 = 0x1;
+       }
+}
+
+#if defined(CONFIG_SERIAL_MULTI)
+int serial_getcts_dev (unsigned long dev_base)
+#else
+int serial_getcts(void)
+#endif
+{
+#if defined(CONFIG_SERIAL_MULTI)
+       volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
+#else
+       volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
+#endif
+
+       return (psc->ip & 0x1) ? 0 : 1;
+}
+
 #if defined(CONFIG_SERIAL_MULTI)
 int serial0_init(void)
 {