summaryrefslogtreecommitdiff
path: root/cpu/mcf52x2/serial.c
diff options
context:
space:
mode:
authorHeiko Schocher <hs@pollux.denx.de>2006-04-20 08:42:42 +0200
committerHeiko Schocher <hs@pollux.denx.de>2006-04-20 08:42:42 +0200
commit9acb626fc145e7327f94fd77f927dce08dd978a8 (patch)
tree8597a60515c10ec608ad756699460226ccb63343 /cpu/mcf52x2/serial.c
parent8419c013048b1f15f3fa2fc7c0463d860a04ee3e (diff)
Add MCF5282 support (without preloader)
relocate ichache_State to ram u-boot can run from internal flash Add EB+MCF-EV123 board support. Add m68k Boards to MAKEALL Patch from Jens Scharsig, 08 Aug 2005
Diffstat (limited to 'cpu/mcf52x2/serial.c')
-rw-r--r--cpu/mcf52x2/serial.c39
1 files changed, 35 insertions, 4 deletions
diff --git a/cpu/mcf52x2/serial.c b/cpu/mcf52x2/serial.c
index 79628d03e6..fe412a0a3a 100644
--- a/cpu/mcf52x2/serial.c
+++ b/cpu/mcf52x2/serial.c
@@ -65,6 +65,28 @@ void rs_serial_setbaudrate(int port,int baudrate)
uartp[MCFUART_UBG2] = ((int)clock & 0xff); /* set lsb baud */
uartp[MCFUART_UFPD] = ((int)fraction & 0xf); /* set baud fraction adjust */
#endif
+#if defined(CONFIG_M5282)
+ volatile unsigned char *uartp;
+ long clock;
+
+ switch (port)
+ {
+ case 1:
+ uartp = (volatile unsigned char *) (CFG_MBAR + MCFUART_BASE2);
+ break;
+ case 2:
+ uartp = (volatile unsigned char *) (CFG_MBAR + MCFUART_BASE3);
+ break;
+ default:
+ uartp = (volatile unsigned char *) (CFG_MBAR + MCFUART_BASE1);
+ }
+
+ clock = (long) CFG_CLK / ((long) 32 * baudrate); /* Set baud above */
+
+ uartp[MCFUART_UBG1] = (((int)clock >> 8) & 0xff); /* set msb baud */
+ uartp[MCFUART_UBG2] = ((int) clock & 0xff); /* set lsb baud */
+
+#endif
};
void rs_serial_init(int port,int baudrate)
@@ -74,10 +96,19 @@ void rs_serial_init(int port,int baudrate)
/*
* Reset UART, get it into known state...
*/
- if (port == 0)
- uartp = (volatile unsigned char *) (CFG_MBAR + MCFUART_BASE1);
- else
- uartp = (volatile unsigned char *) (CFG_MBAR + MCFUART_BASE2);
+ switch (port)
+ {
+ case 1:
+ uartp = (volatile unsigned char *) (CFG_MBAR + MCFUART_BASE2);
+ break;
+ #if defined(CONFIG_M5282)
+ case 2:
+ uartp = (volatile unsigned char *) (CFG_MBAR + MCFUART_BASE3);
+ break;
+ #endif
+ default:
+ uartp = (volatile unsigned char *) (CFG_MBAR + MCFUART_BASE1);
+ }
uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETRX; /* reset RX */
uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETTX; /* reset TX */