aboutsummaryrefslogtreecommitdiff
path: root/arch/powerpc/cpu/mpc5xxx
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/cpu/mpc5xxx')
-rw-r--r--arch/powerpc/cpu/mpc5xxx/serial.c181
-rw-r--r--arch/powerpc/cpu/mpc5xxx/usb_ohci.c4
2 files changed, 54 insertions, 131 deletions
diff --git a/arch/powerpc/cpu/mpc5xxx/serial.c b/arch/powerpc/cpu/mpc5xxx/serial.c
index aa09f67cc..eb141619b 100644
--- a/arch/powerpc/cpu/mpc5xxx/serial.c
+++ b/arch/powerpc/cpu/mpc5xxx/serial.c
@@ -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,88 +191,53 @@ 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 =
{
- "serial0",
- serial0_init,
- NULL,
- serial0_setbrg,
- serial0_getc,
- serial0_tstc,
- serial0_putc,
- serial0_puts,
+ .name = "serial0",
+ .start = serial0_init,
+ .stop = NULL,
+ .setbrg = serial0_setbrg,
+ .getc = serial0_getc,
+ .tstc = serial0_tstc,
+ .putc = serial0_putc,
+ .puts = serial0_puts,
};
__weak struct serial_device *default_serial_console(void)
@@ -353,17 +245,48 @@ __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 =
{
- "serial1",
- serial1_init,
- NULL,
- serial1_setbrg,
- serial1_getc,
- serial1_tstc,
- serial1_putc,
- serial1_puts,
+ .name = "serial1",
+ .start = serial1_init,
+ .stop = NULL,
+ .setbrg = serial1_setbrg,
+ .getc = serial1_getc,
+ .tstc = serial1_tstc,
+ .putc = serial1_putc,
+ .puts = serial1_puts,
};
-#endif /* CONFIG_SERIAL_MULTI */
+#endif /* CONFIG_PSC_CONSOLE2 */
#endif /* CONFIG_PSC_CONSOLE */
diff --git a/arch/powerpc/cpu/mpc5xxx/usb_ohci.c b/arch/powerpc/cpu/mpc5xxx/usb_ohci.c
index 6d915256a..607034b7c 100644
--- a/arch/powerpc/cpu/mpc5xxx/usb_ohci.c
+++ b/arch/powerpc/cpu/mpc5xxx/usb_ohci.c
@@ -1561,7 +1561,7 @@ static void hc_release_ohci (ohci_t *ohci)
*/
static char ohci_inited = 0;
-int usb_lowlevel_init(void)
+int usb_lowlevel_init(int index, void **controller)
{
/* Set the USB Clock */
@@ -1629,7 +1629,7 @@ int usb_lowlevel_init(void)
return 0;
}
-int usb_lowlevel_stop(void)
+int usb_lowlevel_stop(int index)
{
/* this gets called really early - before the controller has */
/* even been initialized! */