drivers: serial: get rid of non DM mpc8xx driver
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
This commit is contained in:
parent
a8b8645fa9
commit
42b54013a0
@ -119,7 +119,6 @@ U_BOOT_ENV_CALLBACK(baudrate, on_baudrate);
|
||||
serial_initfunc(atmel_serial_initialize);
|
||||
serial_initfunc(mcf_serial_initialize);
|
||||
serial_initfunc(mpc85xx_serial_initialize);
|
||||
serial_initfunc(mpc8xx_serial_initialize);
|
||||
serial_initfunc(mxc_serial_initialize);
|
||||
serial_initfunc(ns16550_serial_initialize);
|
||||
serial_initfunc(pl01x_serial_initialize);
|
||||
@ -173,7 +172,6 @@ void serial_initialize(void)
|
||||
atmel_serial_initialize();
|
||||
mcf_serial_initialize();
|
||||
mpc85xx_serial_initialize();
|
||||
mpc8xx_serial_initialize();
|
||||
mxc_serial_initialize();
|
||||
ns16550_serial_initialize();
|
||||
pl01x_serial_initialize();
|
||||
|
@ -59,7 +59,7 @@ static void serial_setdivisor(cpm8xx_t __iomem *cp, int baudrate)
|
||||
* as serial console interface.
|
||||
*/
|
||||
|
||||
static void smc_setbrg(void)
|
||||
static int serial_mpc8xx_setbrg(struct udevice *dev, int baudrate)
|
||||
{
|
||||
immap_t __iomem *im = (immap_t __iomem *)CONFIG_SYS_IMMR;
|
||||
cpm8xx_t __iomem *cp = &(im->im_cpm);
|
||||
@ -72,10 +72,12 @@ static void smc_setbrg(void)
|
||||
|
||||
out_be32(&cp->cp_simode, 0);
|
||||
|
||||
serial_setdivisor(cp, gd->baudrate);
|
||||
serial_setdivisor(cp, baudrate);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int smc_init(void)
|
||||
static int serial_mpc8xx_probe(struct udevice *dev)
|
||||
{
|
||||
immap_t __iomem *im = (immap_t __iomem *)CONFIG_SYS_IMMR;
|
||||
smc_t __iomem *sp;
|
||||
@ -140,7 +142,7 @@ static int smc_init(void)
|
||||
out_8(&sp->smc_smce, 0xff);
|
||||
|
||||
/* Set up the baud rate generator */
|
||||
smc_setbrg();
|
||||
serial_mpc8xx_setbrg(dev, gd->baudrate);
|
||||
|
||||
/* Make the first buffer the only buffer. */
|
||||
setbits_be16(&rtx->txbd.cbd_sc, BD_SC_WRAP);
|
||||
@ -167,14 +169,14 @@ static int smc_init(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void smc_putc(const char c)
|
||||
static int serial_mpc8xx_putc(struct udevice *dev, const char c)
|
||||
{
|
||||
immap_t __iomem *im = (immap_t __iomem *)CONFIG_SYS_IMMR;
|
||||
cpm8xx_t __iomem *cpmp = &(im->im_cpm);
|
||||
struct serialbuffer __iomem *rtx;
|
||||
|
||||
if (c == '\n')
|
||||
smc_putc('\r');
|
||||
serial_mpc8xx_putc(dev, '\r');
|
||||
|
||||
rtx = (struct serialbuffer __iomem *)&cpmp->cp_dpmem[CPM_SERIAL_BASE];
|
||||
|
||||
@ -185,17 +187,11 @@ static void smc_putc(const char c)
|
||||
|
||||
while (in_be16(&rtx->txbd.cbd_sc) & BD_SC_READY)
|
||||
WATCHDOG_RESET();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_DM_SERIAL
|
||||
static void smc_puts(const char *s)
|
||||
{
|
||||
while (*s)
|
||||
smc_putc(*s++);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int smc_getc(void)
|
||||
static int serial_mpc8xx_getc(struct udevice *dev)
|
||||
{
|
||||
immap_t __iomem *im = (immap_t __iomem *)CONFIG_SYS_IMMR;
|
||||
cpm8xx_t __iomem *cpmp = &(im->im_cpm);
|
||||
@ -225,84 +221,20 @@ static int smc_getc(void)
|
||||
return c;
|
||||
}
|
||||
|
||||
static int smc_tstc(void)
|
||||
static int serial_mpc8xx_pending(struct udevice *dev, bool input)
|
||||
{
|
||||
immap_t __iomem *im = (immap_t __iomem *)CONFIG_SYS_IMMR;
|
||||
cpm8xx_t __iomem *cpmp = &(im->im_cpm);
|
||||
struct serialbuffer __iomem *rtx;
|
||||
|
||||
if (!input)
|
||||
return 0;
|
||||
|
||||
rtx = (struct serialbuffer __iomem *)&cpmp->cp_dpmem[CPM_SERIAL_BASE];
|
||||
|
||||
return !(in_be16(&rtx->rxbd.cbd_sc) & BD_SC_EMPTY);
|
||||
}
|
||||
|
||||
#ifndef CONFIG_DM_SERIAL
|
||||
struct serial_device serial_smc_device = {
|
||||
.name = "serial_smc",
|
||||
.start = smc_init,
|
||||
.stop = NULL,
|
||||
.setbrg = smc_setbrg,
|
||||
.getc = smc_getc,
|
||||
.tstc = smc_tstc,
|
||||
.putc = smc_putc,
|
||||
.puts = smc_puts,
|
||||
};
|
||||
|
||||
__weak struct serial_device *default_serial_console(void)
|
||||
{
|
||||
return &serial_smc_device;
|
||||
}
|
||||
|
||||
void mpc8xx_serial_initialize(void)
|
||||
{
|
||||
serial_register(&serial_smc_device);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DM_SERIAL
|
||||
static int serial_mpc8xx_setbrg(struct udevice *dev, int baudrate)
|
||||
{
|
||||
immap_t __iomem *im = (immap_t __iomem *)CONFIG_SYS_IMMR;
|
||||
cpm8xx_t __iomem *cp = &(im->im_cpm);
|
||||
|
||||
/* Set up the baud rate generator.
|
||||
* See 8xx_io/commproc.c for details.
|
||||
*
|
||||
* Wire BRG1 to SMCx
|
||||
*/
|
||||
|
||||
out_be32(&cp->cp_simode, 0);
|
||||
|
||||
serial_setdivisor(cp, baudrate);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int serial_mpc8xx_probe(struct udevice *dev)
|
||||
{
|
||||
return smc_init();
|
||||
}
|
||||
|
||||
static int serial_mpc8xx_putc(struct udevice *dev, const char ch)
|
||||
{
|
||||
smc_putc(ch);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int serial_mpc8xx_getc(struct udevice *dev)
|
||||
{
|
||||
return smc_getc();
|
||||
}
|
||||
|
||||
static int serial_mpc8xx_pending(struct udevice *dev, bool input)
|
||||
{
|
||||
if (input)
|
||||
return smc_tstc();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct dm_serial_ops serial_mpc8xx_ops = {
|
||||
.putc = serial_mpc8xx_putc,
|
||||
.pending = serial_mpc8xx_pending,
|
||||
@ -323,4 +255,3 @@ U_BOOT_DRIVER(serial_mpc8xx) = {
|
||||
.ops = &serial_mpc8xx_ops,
|
||||
.flags = DM_FLAG_PRE_RELOC,
|
||||
};
|
||||
#endif
|
||||
|
@ -224,7 +224,6 @@ struct serial_dev_priv {
|
||||
void atmel_serial_initialize(void);
|
||||
void mcf_serial_initialize(void);
|
||||
void mpc85xx_serial_initialize(void);
|
||||
void mpc8xx_serial_initialize(void);
|
||||
void mxc_serial_initialize(void);
|
||||
void ns16550_serial_initialize(void);
|
||||
void pl01x_serial_initialize(void);
|
||||
|
Loading…
Reference in New Issue
Block a user