#include <common.h>
#include <mpc8260.h>
#include <asm/cpm_8260.h>
+#include <serial.h>
+#include <linux/compiler.h>
DECLARE_GLOBAL_DATA_PTR;
#endif
-int serial_init (void)
+static int mpc8260_scc_serial_init(void)
{
volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
volatile scc_t *sp;
return (0);
}
-void
-serial_setbrg (void)
+static void mpc8260_scc_serial_setbrg(void)
{
#if defined(CONFIG_CONS_USE_EXTC)
m8260_cpm_extcbrg(SCC_INDEX, gd->baudrate,
#endif
}
-void
-serial_putc(const char c)
+static void mpc8260_scc_serial_putc(const char c)
{
volatile scc_uart_t *up;
volatile cbd_t *tbdf;
tbdf->cbd_sc |= BD_SC_READY;
}
-void
-serial_puts (const char *s)
+static void mpc8260_scc_serial_puts(const char *s)
{
while (*s) {
serial_putc (*s++);
}
}
-int
-serial_getc(void)
+static int mpc8260_scc_serial_getc(void)
{
volatile cbd_t *rbdf;
volatile scc_uart_t *up;
return (c);
}
-int
-serial_tstc()
+static int mpc8260_scc_serial_tstc(void)
{
volatile cbd_t *rbdf;
volatile scc_uart_t *up;
return ((rbdf->cbd_sc & BD_SC_EMPTY) == 0);
}
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device mpc8260_scc_serial_drv = {
+ .name = "mpc8260_scc_uart",
+ .start = mpc8260_scc_serial_init,
+ .stop = NULL,
+ .setbrg = mpc8260_scc_serial_setbrg,
+ .putc = mpc8260_scc_serial_putc,
+ .puts = mpc8260_scc_serial_puts,
+ .getc = mpc8260_scc_serial_getc,
+ .tstc = mpc8260_scc_serial_tstc,
+};
+
+void mpc8260_scc_serial_initialize(void)
+{
+ serial_register(&mpc8260_scc_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+ return &mpc8260_scc_serial_drv;
+}
+#else
+int serial_init(void)
+{
+ return mpc8260_scc_serial_init();
+}
+
+void serial_setbrg(void)
+{
+ mpc8260_scc_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+ mpc8260_scc_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+ mpc8260_scc_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+ return mpc8260_scc_serial_getc();
+}
+
+int serial_tstc(void)
+{
+ return mpc8260_scc_serial_tstc();
+}
+#endif
#endif /* CONFIG_CONS_ON_SCC */
#if defined(CONFIG_KGDB_ON_SCC)
#include <common.h>
#include <mpc8260.h>
#include <asm/cpm_8260.h>
+#include <serial.h>
+#include <linux/compiler.h>
DECLARE_GLOBAL_DATA_PTR;
3, /* BRG1 for SCC4 */
};
-int serial_init (void)
+static int mpc8260_smc_serial_init(void)
{
volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
volatile smc_t *sp;
return (0);
}
-void
-serial_setbrg (void)
+static void mpc8260_smc_serial_setbrg(void)
{
#if defined(CONFIG_CONS_USE_EXTC)
m8260_cpm_extcbrg(brg_map[SMC_INDEX], gd->baudrate,
#endif
}
-void
-serial_putc(const char c)
+static void mpc8260_smc_serial_putc(const char c)
{
volatile smc_uart_t *up;
volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
rtx->txbd.cbd_sc |= BD_SC_READY;
}
-void
-serial_puts (const char *s)
+static void mpc8260_smc_serial_puts(const char *s)
{
while (*s) {
serial_putc (*s++);
}
}
-int
-serial_getc(void)
+static int mpc8260_smc_serial_getc(void)
{
volatile smc_uart_t *up;
volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
return(c);
}
-int
-serial_tstc()
+static int mpc8260_smc_serial_tstc(void)
{
volatile smc_uart_t *up;
volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
return !(rtx->rxbd.cbd_sc & BD_SC_EMPTY);
}
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device mpc8260_smc_serial_drv = {
+ .name = "mpc8260_smc_uart",
+ .start = mpc8260_smc_serial_init,
+ .stop = NULL,
+ .setbrg = mpc8260_smc_serial_setbrg,
+ .putc = mpc8260_smc_serial_putc,
+ .puts = mpc8260_smc_serial_puts,
+ .getc = mpc8260_smc_serial_getc,
+ .tstc = mpc8260_smc_serial_tstc,
+};
+
+void mpc8260_smc_serial_initialize(void)
+{
+ serial_register(&mpc8260_smc_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+ return &mpc8260_smc_serial_drv;
+}
+#else
+int serial_init(void)
+{
+ return mpc8260_smc_serial_init();
+}
+
+void serial_setbrg(void)
+{
+ mpc8260_smc_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+ mpc8260_smc_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+ mpc8260_smc_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+ return mpc8260_smc_serial_getc();
+}
+
+int serial_tstc(void)
+{
+ return mpc8260_smc_serial_tstc();
+}
+#endif
#endif /* CONFIG_CONS_ON_SMC */
#if defined(CONFIG_KGDB_ON_SMC)
serial_initfunc(jz_serial_initialize);
serial_initfunc(mpc5xx_serial_initialize);
serial_initfunc(mpc8220_serial_initialize);
+serial_initfunc(mpc8260_scc_serial_initialize);
+serial_initfunc(mpc8260_smc_serial_initialize);
void serial_register(struct serial_device *dev)
{
jz_serial_initialize();
mpc5xx_serial_initialize();
mpc8220_serial_initialize();
+ mpc8260_scc_serial_initialize();
+ mpc8260_smc_serial_initialize();
serial_assign(default_serial_console()->name);
}