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) ...@@ -131,7 +131,6 @@ static int au1x00_serial_tstc(void)
return 0; return 0;
} }
#ifdef CONFIG_SERIAL_MULTI
static struct serial_device au1x00_serial_drv = { static struct serial_device au1x00_serial_drv = {
.name = "au1x00_serial", .name = "au1x00_serial",
.start = au1x00_serial_init, .start = au1x00_serial_init,
...@@ -152,34 +151,3 @@ __weak struct serial_device *default_serial_console(void) ...@@ -152,34 +151,3 @@ __weak struct serial_device *default_serial_console(void)
{ {
return &au1x00_serial_drv; 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) ...@@ -286,7 +286,6 @@ static int asc_serial_tstc(void)
return res; return res;
} }
#ifdef CONFIG_SERIAL_MULTI
static struct serial_device asc_serial_drv = { static struct serial_device asc_serial_drv = {
.name = "asc_serial", .name = "asc_serial",
.start = asc_serial_init, .start = asc_serial_init,
...@@ -307,34 +306,3 @@ __weak struct serial_device *default_serial_console(void) ...@@ -307,34 +306,3 @@ __weak struct serial_device *default_serial_console(void)
{ {
return &asc_serial_drv; 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) ...@@ -115,7 +115,6 @@ static void jz_serial_puts(const char *s)
serial_putc(*s++); serial_putc(*s++);
} }
#ifdef CONFIG_SERIAL_MULTI
static struct serial_device jz_serial_drv = { static struct serial_device jz_serial_drv = {
.name = "jz_serial", .name = "jz_serial",
.start = jz_serial_init, .start = jz_serial_init,
...@@ -136,34 +135,3 @@ __weak struct serial_device *default_serial_console(void) ...@@ -136,34 +135,3 @@ __weak struct serial_device *default_serial_console(void)
{ {
return &jz_serial_drv; 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 @@ ...@@ -37,7 +37,7 @@
DECLARE_GLOBAL_DATA_PTR; 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) static void fifo_init (volatile psc512x_t *psc)
{ {
...@@ -52,7 +52,6 @@ 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->rfintmask, 0);
out_be32(&psc->tfintmask, 0); out_be32(&psc->tfintmask, 0);
#if defined(CONFIG_SERIAL_MULTI)
switch (((u32)psc & 0xf00) >> 8) { switch (((u32)psc & 0xf00) >> 8) {
case 0: case 0:
tfsize = FIFOC_PSC0_TX_SIZE | (FIFOC_PSC0_TX_ADDR << 16); tfsize = FIFOC_PSC0_TX_SIZE | (FIFOC_PSC0_TX_ADDR << 16);
...@@ -105,10 +104,7 @@ static void fifo_init (volatile psc512x_t *psc) ...@@ -105,10 +104,7 @@ static void fifo_init (volatile psc512x_t *psc)
default: default:
return; 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->tfsize, tfsize);
out_be32(&psc->rfsize, rfsize); out_be32(&psc->rfsize, rfsize);
...@@ -155,12 +151,10 @@ int serial_init_dev(unsigned int idx) ...@@ -155,12 +151,10 @@ int serial_init_dev(unsigned int idx)
{ {
volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR; volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
volatile psc512x_t *psc = (psc512x_t *) &im->psc[idx]; volatile psc512x_t *psc = (psc512x_t *) &im->psc[idx];
#if defined(CONFIG_SERIAL_MULTI)
u32 reg; u32 reg;
reg = in_be32(&im->clk.sccr[0]); reg = in_be32(&im->clk.sccr[0]);
out_be32(&im->clk.sccr[0], reg | CLOCK_SCCR1_PSC_EN(idx)); out_be32(&im->clk.sccr[0], reg | CLOCK_SCCR1_PSC_EN(idx));
#endif
fifo_init (psc); fifo_init (psc);
...@@ -285,9 +279,7 @@ int serial_getcts_dev(unsigned int idx) ...@@ -285,9 +279,7 @@ int serial_getcts_dev(unsigned int idx)
return (in_8(&psc->ip) & 0x1) ? 0 : 1; return (in_8(&psc->ip) & 0x1) ? 0 : 1;
} }
#endif /* CONFIG_PSC_CONSOLE || CONFIG_SERIAL_MULTI */ #endif /* CONFIG_PSC_CONSOLE */
#if defined(CONFIG_SERIAL_MULTI)
#define DECLARE_PSC_SERIAL_FUNCTIONS(port) \ #define DECLARE_PSC_SERIAL_FUNCTIONS(port) \
int serial##port##_init(void) \ int serial##port##_init(void) \
...@@ -381,55 +373,6 @@ void mpc512x_serial_initialize(void) ...@@ -381,55 +373,6 @@ void mpc512x_serial_initialize(void)
#endif #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> #include <stdio_dev.h>
/* /*
* Routines for communication with serial devices over PSC * Routines for communication with serial devices over PSC
...@@ -514,4 +457,3 @@ int read_port(struct stdio_dev *port, char *buf, int size) ...@@ -514,4 +457,3 @@ int read_port(struct stdio_dev *port, char *buf, int size)
return cnt; return cnt;
} }
#endif /* CONFIG_SERIAL_MULTI */
...@@ -169,7 +169,6 @@ static void mpc5xx_serial_puts(const char *s) ...@@ -169,7 +169,6 @@ static void mpc5xx_serial_puts(const char *s)
} }
} }
#ifdef CONFIG_SERIAL_MULTI
static struct serial_device mpc5xx_serial_drv = { static struct serial_device mpc5xx_serial_drv = {
.name = "mpc5xx_serial", .name = "mpc5xx_serial",
.start = mpc5xx_serial_init, .start = mpc5xx_serial_init,
...@@ -190,34 +189,3 @@ __weak struct serial_device *default_serial_console(void) ...@@ -190,34 +189,3 @@ __weak struct serial_device *default_serial_console(void)
{ {
return &mpc5xx_serial_drv; 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 @@ ...@@ -25,7 +25,7 @@
* Linux/PPC sources (m8260_tty.c had no copyright info in it). * Linux/PPC sources (m8260_tty.c had no copyright info in it).
* *
* Martin Krause, 8 Jun 2006 * Martin Krause, 8 Jun 2006
* Added CONFIG_SERIAL_MULTI support * Added SERIAL_MULTI support
*/ */
/* /*
...@@ -36,10 +36,7 @@ ...@@ -36,10 +36,7 @@
#include <common.h> #include <common.h>
#include <linux/compiler.h> #include <linux/compiler.h>
#include <mpc5xxx.h> #include <mpc5xxx.h>
#if defined (CONFIG_SERIAL_MULTI)
#include <serial.h> #include <serial.h>
#endif
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;
...@@ -61,11 +58,8 @@ DECLARE_GLOBAL_DATA_PTR; ...@@ -61,11 +58,8 @@ DECLARE_GLOBAL_DATA_PTR;
#error CONFIG_PSC_CONSOLE must be in 1 ... 6 #error CONFIG_PSC_CONSOLE must be in 1 ... 6
#endif #endif
#if defined(CONFIG_SERIAL_MULTI) && !defined(CONFIG_PSC_CONSOLE2) #if defined(CONFIG_PSC_CONSOLE2)
#error you must define CONFIG_PSC_CONSOLE2 if CONFIG_SERIAL_MULTI is set
#endif
#if defined(CONFIG_SERIAL_MULTI)
#if CONFIG_PSC_CONSOLE2 == 1 #if CONFIG_PSC_CONSOLE2 == 1
#define PSC_BASE2 MPC5XXX_PSC1 #define PSC_BASE2 MPC5XXX_PSC1
#elif CONFIG_PSC_CONSOLE2 == 2 #elif CONFIG_PSC_CONSOLE2 == 2
...@@ -81,19 +75,12 @@ DECLARE_GLOBAL_DATA_PTR; ...@@ -81,19 +75,12 @@ DECLARE_GLOBAL_DATA_PTR;
#else #else
#error CONFIG_PSC_CONSOLE2 must be in 1 ... 6 #error CONFIG_PSC_CONSOLE2 must be in 1 ... 6
#endif #endif
#endif /* CONFIG_SERIAL_MULTI */
#if defined(CONFIG_SERIAL_MULTI)
int serial_init_dev (unsigned long dev_base)
#else
int serial_init (void)
#endif #endif
int serial_init_dev (unsigned long dev_base)
{ {
#if defined(CONFIG_SERIAL_MULTI)
volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base; 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; unsigned long baseclk;
int div; int div;
...@@ -127,24 +114,12 @@ int serial_init (void) ...@@ -127,24 +114,12 @@ int serial_init (void)
return (0); return (0);
} }
#if defined(CONFIG_SERIAL_MULTI)
void serial_putc_dev (unsigned long dev_base, const char c) 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; 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 (c == '\n')
#if defined(CONFIG_SERIAL_MULTI)
serial_putc_dev (dev_base, '\r'); serial_putc_dev (dev_base, '\r');
#else
serial_putc('\r');
#endif
/* Wait for last character to go. */ /* Wait for last character to go. */
while (!(psc->psc_status & PSC_SR_TXEMP)) while (!(psc->psc_status & PSC_SR_TXEMP))
...@@ -153,17 +128,9 @@ void serial_putc(const char c) ...@@ -153,17 +128,9 @@ void serial_putc(const char c)
psc->psc_buffer_8 = c; psc->psc_buffer_8 = c;
} }
#if defined(CONFIG_SERIAL_MULTI)
void serial_putc_raw_dev(unsigned long dev_base, const char c) 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; 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. */ /* Wait for last character to go. */
while (!(psc->psc_status & PSC_SR_TXEMP)) while (!(psc->psc_status & PSC_SR_TXEMP))
; ;
...@@ -172,32 +139,16 @@ void serial_putc_raw(const char c) ...@@ -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) void serial_puts_dev (unsigned long dev_base, const char *s)
#else
void serial_puts (const char *s)
#endif
{ {
while (*s) { while (*s) {
#if defined(CONFIG_SERIAL_MULTI)
serial_putc_dev (dev_base, *s++); serial_putc_dev (dev_base, *s++);
#else
serial_putc (*s++);
#endif
} }
} }
#if defined(CONFIG_SERIAL_MULTI)
int serial_getc_dev (unsigned long dev_base) 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; 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. */ /* Wait for a character to arrive. */
while (!(psc->psc_status & PSC_SR_RXRDY)) while (!(psc->psc_status & PSC_SR_RXRDY))
...@@ -206,32 +157,16 @@ int serial_getc(void) ...@@ -206,32 +157,16 @@ int serial_getc(void)
return psc->psc_buffer_8; return psc->psc_buffer_8;
} }
#if defined(CONFIG_SERIAL_MULTI)
int serial_tstc_dev (unsigned long dev_base) 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; 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); return (psc->psc_status & PSC_SR_RXRDY);
} }
#if defined(CONFIG_SERIAL_MULTI)
void serial_setbrg_dev (unsigned long dev_base) 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; 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; unsigned long baseclk, div;
baseclk = (gd->ipb_clk + 16) / 32; baseclk = (gd->ipb_clk + 16) / 32;
...@@ -242,17 +177,9 @@ void serial_setbrg(void) ...@@ -242,17 +177,9 @@ void serial_setbrg(void)
psc->ctlr = div & 0xff; psc->ctlr = div & 0xff;
} }
#if defined(CONFIG_SERIAL_MULTI)
void serial_setrts_dev (unsigned long dev_base, int s) 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; volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
#else
volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
#endif
if (s) { if (s) {
/* Assert RTS (become LOW) */ /* Assert RTS (become LOW) */
...@@ -264,78 +191,43 @@ void serial_setrts(int s) ...@@ -264,78 +191,43 @@ void serial_setrts(int s)
} }
} }
#if defined(CONFIG_SERIAL_MULTI)
int serial_getcts_dev (unsigned long dev_base) 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; 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; return (psc->ip & 0x1) ? 0 : 1;
} }
#if defined(CONFIG_SERIAL_MULTI)
int serial0_init(void) int serial0_init(void)
{ {
return (serial_init_dev(PSC_BASE)); return (serial_init_dev(PSC_BASE));
} }
int serial1_init(void)
{
return (serial_init_dev(PSC_BASE2));
}
void serial0_setbrg (void) void serial0_setbrg (void)
{ {
serial_setbrg_dev(PSC_BASE); serial_setbrg_dev(PSC_BASE);
} }
void serial1_setbrg (void)
{
serial_setbrg_dev(PSC_BASE2);
}
void serial0_putc(const char c) void serial0_putc(const char c)
{ {
serial_putc_dev(PSC_BASE,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) void serial0_puts(const char *s)
{ {
serial_puts_dev(PSC_BASE, s); serial_puts_dev(PSC_BASE, s);
} }
void serial1_puts(const char *s)
{
serial_puts_dev(PSC_BASE2, s);
}
int serial0_getc(void) int serial0_getc(void)
{ {
return(serial_getc_dev(PSC_BASE)); return(serial_getc_dev(PSC_BASE));
} }
int serial1_getc(void)
{
return(serial_getc_dev(PSC_BASE2));
}
int serial0_tstc(void) int serial0_tstc(void)
{ {
return (serial_tstc_dev(PSC_BASE)); return (serial_tstc_dev(PSC_BASE));
} }
int serial1_tstc(void)
{
return (serial_tstc_dev(PSC_BASE2));
}
struct serial_device serial0_device = struct serial_device serial0_device =
{ {
.name = "serial0", .name = "serial0",
...@@ -353,6 +245,37 @@ __weak struct serial_device *default_serial_console(void) ...@@ -353,6 +245,37 @@ __weak struct serial_device *default_serial_console(void)
return &serial0_device; 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);