Commit a3827250 authored by Marek Vasut's avatar Marek Vasut Committed by Tom Rini

serial: Remove CONFIG_SERIAL_MULTI from serial drivers

Remove the support for not-CONFIG_SERIAL_MULTI part from serial
port drivers and some board files. Since CONFIG_SERIAL_MULTI is
now enabled by default, that part is a dead code. Remove it.
Signed-off-by: default avatarMarek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
Signed-off-by: default avatarTom Rini <trini@ti.com>
parent bffe31c1
......@@ -131,7 +131,6 @@ static int au1x00_serial_tstc(void)
return 0;
}
#ifdef CONFIG_SERIAL_MULTI
static struct serial_device au1x00_serial_drv = {
.name = "au1x00_serial",
.start = au1x00_serial_init,
......@@ -152,34 +151,3 @@ __weak struct serial_device *default_serial_console(void)
{
return &au1x00_serial_drv;
}
#else
int serial_init(void)
{
return au1x00_serial_init();
}
void serial_setbrg(void)
{
au1x00_serial_setbrg();
}
void serial_putc(const char c)
{
au1x00_serial_putc(c);
}
void serial_puts(const char *s)
{
au1x00_serial_puts(s);
}
int serial_getc(void)
{
return au1x00_serial_getc();
}
int serial_tstc(void)
{
return au1x00_serial_tstc();
}
#endif
......@@ -286,7 +286,6 @@ static int asc_serial_tstc(void)
return res;
}
#ifdef CONFIG_SERIAL_MULTI
static struct serial_device asc_serial_drv = {
.name = "asc_serial",
.start = asc_serial_init,
......@@ -307,34 +306,3 @@ __weak struct serial_device *default_serial_console(void)
{
return &asc_serial_drv;
}
#else
int serial_init(void)
{
return asc_serial_init();
}
void serial_setbrg(void)
{
asc_serial_setbrg();
}
void serial_putc(const char c)
{
asc_serial_putc(c);
}
void serial_puts(const char *s)
{
asc_serial_puts(s);
}
int serial_getc(void)
{
return asc_serial_getc();
}
int serial_tstc(void)
{
return asc_serial_tstc();
}
#endif
......@@ -115,7 +115,6 @@ static void jz_serial_puts(const char *s)
serial_putc(*s++);
}
#ifdef CONFIG_SERIAL_MULTI
static struct serial_device jz_serial_drv = {
.name = "jz_serial",
.start = jz_serial_init,
......@@ -136,34 +135,3 @@ __weak struct serial_device *default_serial_console(void)
{
return &jz_serial_drv;
}
#else
int serial_init(void)
{
return jz_serial_init();
}
void serial_setbrg(void)
{
jz_serial_setbrg();
}
void serial_putc(const char c)
{
jz_serial_putc(c);
}
void serial_puts(const char *s)
{
jz_serial_puts(s);
}
int serial_getc(void)
{
return jz_serial_getc();
}
int serial_tstc(void)
{
return jz_serial_tstc();
}
#endif
......@@ -37,7 +37,7 @@
DECLARE_GLOBAL_DATA_PTR;
#if defined(CONFIG_PSC_CONSOLE) || defined(CONFIG_SERIAL_MULTI)
#if defined(CONFIG_PSC_CONSOLE)
static void fifo_init (volatile psc512x_t *psc)
{
......@@ -52,7 +52,6 @@ static void fifo_init (volatile psc512x_t *psc)
out_be32(&psc->rfintmask, 0);
out_be32(&psc->tfintmask, 0);
#if defined(CONFIG_SERIAL_MULTI)
switch (((u32)psc & 0xf00) >> 8) {
case 0:
tfsize = FIFOC_PSC0_TX_SIZE | (FIFOC_PSC0_TX_ADDR << 16);
......@@ -105,10 +104,7 @@ static void fifo_init (volatile psc512x_t *psc)
default:
return;
}
#else
tfsize = CONSOLE_FIFO_TX_SIZE | (CONSOLE_FIFO_TX_ADDR << 16);
rfsize = CONSOLE_FIFO_RX_SIZE | (CONSOLE_FIFO_RX_ADDR << 16);
#endif
out_be32(&psc->tfsize, tfsize);
out_be32(&psc->rfsize, rfsize);
......@@ -155,12 +151,10 @@ int serial_init_dev(unsigned int idx)
{
volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
volatile psc512x_t *psc = (psc512x_t *) &im->psc[idx];
#if defined(CONFIG_SERIAL_MULTI)
u32 reg;
reg = in_be32(&im->clk.sccr[0]);
out_be32(&im->clk.sccr[0], reg | CLOCK_SCCR1_PSC_EN(idx));
#endif
fifo_init (psc);
......@@ -285,9 +279,7 @@ int serial_getcts_dev(unsigned int idx)
return (in_8(&psc->ip) & 0x1) ? 0 : 1;
}
#endif /* CONFIG_PSC_CONSOLE || CONFIG_SERIAL_MULTI */
#if defined(CONFIG_SERIAL_MULTI)
#endif /* CONFIG_PSC_CONSOLE */
#define DECLARE_PSC_SERIAL_FUNCTIONS(port) \
int serial##port##_init(void) \
......@@ -381,55 +373,6 @@ void mpc512x_serial_initialize(void)
#endif
}
#else
void serial_setbrg(void)
{
serial_setbrg_dev(CONFIG_PSC_CONSOLE);
}
int serial_init(void)
{
return serial_init_dev(CONFIG_PSC_CONSOLE);
}
void serial_putc(const char c)
{
serial_putc_dev(CONFIG_PSC_CONSOLE, c);
}
void serial_putc_raw(const char c)
{
serial_putc_raw_dev(CONFIG_PSC_CONSOLE, c);
}
void serial_puts(const char *s)
{
serial_puts_dev(CONFIG_PSC_CONSOLE, s);
}
int serial_getc(void)
{
return serial_getc_dev(CONFIG_PSC_CONSOLE);
}
int serial_tstc(void)
{
return serial_tstc_dev(CONFIG_PSC_CONSOLE);
}
void serial_setrts(int s)
{
return serial_setrts_dev(CONFIG_PSC_CONSOLE, s);
}
int serial_getcts(void)
{
return serial_getcts_dev(CONFIG_PSC_CONSOLE);
}
#endif /* CONFIG_PSC_CONSOLE */
#if defined(CONFIG_SERIAL_MULTI)
#include <stdio_dev.h>
/*
* Routines for communication with serial devices over PSC
......@@ -514,4 +457,3 @@ int read_port(struct stdio_dev *port, char *buf, int size)
return cnt;
}
#endif /* CONFIG_SERIAL_MULTI */
......@@ -169,7 +169,6 @@ static void mpc5xx_serial_puts(const char *s)
}
}
#ifdef CONFIG_SERIAL_MULTI
static struct serial_device mpc5xx_serial_drv = {
.name = "mpc5xx_serial",
.start = mpc5xx_serial_init,
......@@ -190,34 +189,3 @@ __weak struct serial_device *default_serial_console(void)
{
return &mpc5xx_serial_drv;
}
#else
int serial_init(void)
{
return mpc5xx_serial_init();
}
void serial_setbrg(void)
{
mpc5xx_serial_setbrg();
}
void serial_putc(const char c)
{
mpc5xx_serial_putc(c);
}
void serial_puts(const char *s)
{
mpc5xx_serial_puts(s);
}
int serial_getc(void)
{
return mpc5xx_serial_getc();
}
int serial_tstc(void)
{
return mpc5xx_serial_tstc();
}
#endif
......@@ -25,7 +25,7 @@
* Linux/PPC sources (m8260_tty.c had no copyright info in it).
*
* Martin Krause, 8 Jun 2006
* Added CONFIG_SERIAL_MULTI support
* Added SERIAL_MULTI support
*/
/*
......@@ -36,10 +36,7 @@
#include <common.h>
#include <linux/compiler.h>
#include <mpc5xxx.h>
#if defined (CONFIG_SERIAL_MULTI)
#include <serial.h>
#endif
DECLARE_GLOBAL_DATA_PTR;
......@@ -61,11 +58,8 @@ DECLARE_GLOBAL_DATA_PTR;
#error CONFIG_PSC_CONSOLE must be in 1 ... 6
#endif
#if defined(CONFIG_SERIAL_MULTI) && !defined(CONFIG_PSC_CONSOLE2)
#error you must define CONFIG_PSC_CONSOLE2 if CONFIG_SERIAL_MULTI is set
#endif
#if defined(CONFIG_PSC_CONSOLE2)
#if defined(CONFIG_SERIAL_MULTI)
#if CONFIG_PSC_CONSOLE2 == 1
#define PSC_BASE2 MPC5XXX_PSC1
#elif CONFIG_PSC_CONSOLE2 == 2
......@@ -81,19 +75,12 @@ DECLARE_GLOBAL_DATA_PTR;
#else
#error CONFIG_PSC_CONSOLE2 must be in 1 ... 6
#endif
#endif /* CONFIG_SERIAL_MULTI */
#if defined(CONFIG_SERIAL_MULTI)
int serial_init_dev (unsigned long dev_base)
#else
int serial_init (void)
#endif
int serial_init_dev (unsigned long dev_base)
{
#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
unsigned long baseclk;
int div;
......@@ -127,24 +114,12 @@ int serial_init (void)
return (0);
}
#if defined(CONFIG_SERIAL_MULTI)
void serial_putc_dev (unsigned long dev_base, const char c)
#else
void serial_putc(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
if (c == '\n')
#if defined(CONFIG_SERIAL_MULTI)
serial_putc_dev (dev_base, '\r');
#else
serial_putc('\r');
#endif
/* Wait for last character to go. */
while (!(psc->psc_status & PSC_SR_TXEMP))
......@@ -153,17 +128,9 @@ 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))
;
......@@ -172,32 +139,16 @@ void serial_putc_raw(const char c)
}
#if defined(CONFIG_SERIAL_MULTI)
void serial_puts_dev (unsigned long dev_base, const char *s)
#else
void serial_puts (const char *s)
#endif
{
while (*s) {
#if defined(CONFIG_SERIAL_MULTI)
serial_putc_dev (dev_base, *s++);
#else
serial_putc (*s++);
#endif
}
}
#if defined(CONFIG_SERIAL_MULTI)
int serial_getc_dev (unsigned long dev_base)
#else
int serial_getc(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
/* Wait for a character to arrive. */
while (!(psc->psc_status & PSC_SR_RXRDY))
......@@ -206,32 +157,16 @@ int serial_getc(void)
return psc->psc_buffer_8;
}
#if defined(CONFIG_SERIAL_MULTI)
int serial_tstc_dev (unsigned long dev_base)
#else
int serial_tstc(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->psc_status & PSC_SR_RXRDY);
}
#if defined(CONFIG_SERIAL_MULTI)
void serial_setbrg_dev (unsigned long dev_base)
#else
void serial_setbrg(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
unsigned long baseclk, div;
baseclk = (gd->ipb_clk + 16) / 32;
......@@ -242,17 +177,9 @@ 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) */
......@@ -264,78 +191,43 @@ void serial_setrts(int s)
}
}
#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)
{
return (serial_init_dev(PSC_BASE));
}
int serial1_init(void)
{
return (serial_init_dev(PSC_BASE2));
}
void serial0_setbrg (void)
{
serial_setbrg_dev(PSC_BASE);
}
void serial1_setbrg (void)
{
serial_setbrg_dev(PSC_BASE2);
}
void serial0_putc(const char c)
{
serial_putc_dev(PSC_BASE,c);
}
void serial1_putc(const char c)
{
serial_putc_dev(PSC_BASE2, c);
}
void serial0_puts(const char *s)
{
serial_puts_dev(PSC_BASE, s);
}
void serial1_puts(const char *s)
{
serial_puts_dev(PSC_BASE2, s);
}
int serial0_getc(void)
{
return(serial_getc_dev(PSC_BASE));
}
int serial1_getc(void)
{
return(serial_getc_dev(PSC_BASE2));
}
int serial0_tstc(void)
{
return (serial_tstc_dev(PSC_BASE));
}
int serial1_tstc(void)
{
return (serial_tstc_dev(PSC_BASE2));
}
struct serial_device serial0_device =
{
.name = "serial0",
......@@ -353,6 +245,37 @@ __weak struct serial_device *default_serial_console(void)
return &serial0_device;
}
#ifdef CONFIG_PSC_CONSOLE2
int serial1_init(void)
{
return serial_init_dev(PSC_BASE2);
}
void serial1_setbrg(void)
{
serial_setbrg_dev(PSC_BASE2);
}
void serial1_putc(const char c)
{
serial_putc_dev(PSC_BASE2, c);
}
void serial1_puts(const char *s)
{
serial_puts_dev(PSC_BASE2, s);
}
int serial1_getc(void)
{
return serial_getc_dev(PSC_BASE2);
}
int serial1_tstc(void)
{
return serial_tstc_dev(PSC_BASE2);
}
struct serial_device serial1_device =
{
.name = "serial1",
......@@ -364,6 +287,6 @@ struct serial_device serial1_device =
.putc = serial1_putc,
.puts = serial1_puts,
};
#endif /* CONFIG_SERIAL_MULTI */
#endif /* CONFIG_PSC_CONSOLE2 */
#endif /* CONFIG_PSC_CONSOLE */
......@@ -126,7 +126,6 @@ static void mpc8220_serial_setbrg(void)
psc->cr = PSC_CR_RX_ENABLE | PSC_CR_TX_ENABLE;
}
#ifdef CONFIG_SERIAL_MULTI
static struct serial_device mpc8220_serial_drv = {
.name = "mpc8220_serial",
.start = mpc8220_serial_init,
......@@ -147,35 +146,4 @@ __weak struct serial_device *default_serial_console(void)
{
return &mpc8220_serial_drv;
}
#else
int serial_init(void)
{
return mpc8220_serial_init();
}
void serial_setbrg(void)
{
mpc8220_serial_setbrg();
}
void serial_putc(const char c)
{
mpc8220_serial_putc(c);
}
void serial_puts(const char *s)
{
mpc8220_serial_puts(s);
}
int serial_getc(void)
{
return mpc8220_serial_getc();
}
int serial_tstc(void)
{
return mpc8220_serial_tstc();
}
#endif
#endif /* CONFIG_PSC_CONSOLE */
......@@ -261,7 +261,6 @@ static int mpc8260_scc_serial_tstc(void)
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,
......@@ -282,37 +281,6 @@ __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)
......
......@@ -264,7 +264,6 @@ static int mpc8260_smc_serial_tstc(void)
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,
......@@ -285,37 +284,6 @@ __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)
......
......@@ -262,7 +262,6 @@ static int mpc85xx_serial_tstc(void)
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,
......@@ -283,35 +282,4 @@ __weak struct serial_device *default_serial_console(void)
{
return &mpc85xx_serial_drv;
}
#else
int serial_init(void)
{