mirror of
https://github.com/u-boot/u-boot.git
synced 2024-12-02 17:13:28 +08:00
serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc85xx serial driver
Implement support for CONFIG_SERIAL_MULTI into mpc85xx serial driver. This driver was so far only usable directly, but this patch also adds support for the multi method. This allows using more than one serial driver alongside the mpc85xx driver. Also, add a weak implementation of default_serial_console() returning this driver. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Marek Vasut <marek.vasut@gmail.com> Cc: Tom Rini <trini@ti.com> Cc: Anatolij Gustschin <agust@denx.de> Cc: Stefan Roese <sr@denx.de>
This commit is contained in:
parent
d68f4da2fa
commit
7a31154627
@ -34,6 +34,8 @@
|
||||
|
||||
#include <common.h>
|
||||
#include <asm/cpm_85xx.h>
|
||||
#include <serial.h>
|
||||
#include <linux/compiler.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
@ -85,7 +87,7 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
#endif
|
||||
|
||||
int serial_init (void)
|
||||
static int mpc85xx_serial_init(void)
|
||||
{
|
||||
volatile ccsr_cpm_t *cpm = (ccsr_cpm_t *)CONFIG_SYS_MPC85xx_CPM_ADDR;
|
||||
volatile ccsr_cpm_scc_t *sp;
|
||||
@ -184,8 +186,7 @@ int serial_init (void)
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
serial_setbrg (void)
|
||||
static void mpc85xx_serial_setbrg(void)
|
||||
{
|
||||
#if defined(CONFIG_CONS_USE_EXTC)
|
||||
m8560_cpm_extcbrg(SCC_INDEX, gd->baudrate,
|
||||
@ -195,8 +196,7 @@ serial_setbrg (void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
serial_putc(const char c)
|
||||
static void mpc85xx_serial_putc(const char c)
|
||||
{
|
||||
volatile scc_uart_t *up;
|
||||
volatile cbd_t *tbdf;
|
||||
@ -220,16 +220,14 @@ serial_putc(const char c)
|
||||
tbdf->cbd_sc |= BD_SC_READY;
|
||||
}
|
||||
|
||||
void
|
||||
serial_puts (const char *s)
|
||||
static void mpc85xx_serial_puts(const char *s)
|
||||
{
|
||||
while (*s) {
|
||||
serial_putc (*s++);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
serial_getc(void)
|
||||
static int mpc85xx_serial_getc(void)
|
||||
{
|
||||
volatile cbd_t *rbdf;
|
||||
volatile scc_uart_t *up;
|
||||
@ -252,8 +250,7 @@ serial_getc(void)
|
||||
return (c);
|
||||
}
|
||||
|
||||
int
|
||||
serial_tstc()
|
||||
static int mpc85xx_serial_tstc(void)
|
||||
{
|
||||
volatile cbd_t *rbdf;
|
||||
volatile scc_uart_t *up;
|
||||
@ -265,4 +262,56 @@ serial_tstc()
|
||||
return ((rbdf->cbd_sc & BD_SC_EMPTY) == 0);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SERIAL_MULTI
|
||||
static struct serial_device mpc85xx_serial_drv = {
|
||||
.name = "mpc85xx_serial",
|
||||
.start = mpc85xx_serial_init,
|
||||
.stop = NULL,
|
||||
.setbrg = mpc85xx_serial_setbrg,
|
||||
.putc = mpc85xx_serial_putc,
|
||||
.puts = mpc85xx_serial_puts,
|
||||
.getc = mpc85xx_serial_getc,
|
||||
.tstc = mpc85xx_serial_tstc,
|
||||
};
|
||||
|
||||
void mpc85xx_serial_initialize(void)
|
||||
{
|
||||
serial_register(&mpc85xx_serial_drv);
|
||||
}
|
||||
|
||||
__weak struct serial_device *default_serial_console(void)
|
||||
{
|
||||
return &mpc85xx_serial_drv;
|
||||
}
|
||||
#else
|
||||
int serial_init(void)
|
||||
{
|
||||
return mpc85xx_serial_init();
|
||||
}
|
||||
|
||||
void serial_setbrg(void)
|
||||
{
|
||||
mpc85xx_serial_setbrg();
|
||||
}
|
||||
|
||||
void serial_putc(const char c)
|
||||
{
|
||||
mpc85xx_serial_putc(c);
|
||||
}
|
||||
|
||||
void serial_puts(const char *s)
|
||||
{
|
||||
mpc85xx_serial_puts(s);
|
||||
}
|
||||
|
||||
int serial_getc(void)
|
||||
{
|
||||
return mpc85xx_serial_getc();
|
||||
}
|
||||
|
||||
int serial_tstc(void)
|
||||
{
|
||||
return mpc85xx_serial_tstc();
|
||||
}
|
||||
#endif
|
||||
#endif /* CONFIG_CONS_ON_SCC */
|
||||
|
@ -57,6 +57,7 @@ serial_initfunc(mpc5xx_serial_initialize);
|
||||
serial_initfunc(mpc8220_serial_initialize);
|
||||
serial_initfunc(mpc8260_scc_serial_initialize);
|
||||
serial_initfunc(mpc8260_smc_serial_initialize);
|
||||
serial_initfunc(mpc85xx_serial_initialize);
|
||||
|
||||
void serial_register(struct serial_device *dev)
|
||||
{
|
||||
@ -92,6 +93,7 @@ void serial_initialize(void)
|
||||
mpc8220_serial_initialize();
|
||||
mpc8260_scc_serial_initialize();
|
||||
mpc8260_smc_serial_initialize();
|
||||
mpc85xx_serial_initialize();
|
||||
|
||||
serial_assign(default_serial_console()->name);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user