projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
SPI: mxc_spi: fix swapping bug and add missing swapping in unaligned rx case
[oweals/u-boot.git]
/
drivers
/
serial
/
mcfuart.c
diff --git
a/drivers/serial/mcfuart.c
b/drivers/serial/mcfuart.c
index bc7077de79e5d0d82c71a496e0d7bf5aa93d135d..d93b24b8970677e7331eaa4ca86c851783602003 100644
(file)
--- a/
drivers/serial/mcfuart.c
+++ b/
drivers/serial/mcfuart.c
@@
-28,22
+28,22
@@
*/
#include <common.h>
*/
#include <common.h>
+
#include <asm/immap.h>
#include <asm/uart.h>
DECLARE_GLOBAL_DATA_PTR;
#include <asm/immap.h>
#include <asm/uart.h>
DECLARE_GLOBAL_DATA_PTR;
-#ifdef CONFIG_MCFUART
-extern void uart_port_conf(void);
+extern void uart_port_conf(int port);
int serial_init(void)
{
volatile uart_t *uart;
u32 counter;
int serial_init(void)
{
volatile uart_t *uart;
u32 counter;
- uart = (volatile uart_t *)(C
FG
_UART_BASE);
+ uart = (volatile uart_t *)(C
ONFIG_SYS
_UART_BASE);
- uart_port_conf();
+ uart_port_conf(
CONFIG_SYS_UART_PORT
);
/* write to SICR: SIM2 = uart mode,dcd does not affect rx */
uart->ucr = UART_UCR_RESET_RX;
/* write to SICR: SIM2 = uart mode,dcd does not affect rx */
uart->ucr = UART_UCR_RESET_RX;
@@
-61,8
+61,8
@@
int serial_init(void)
uart->umr = UART_UMR_SB_STOP_BITS_1;
/* Setting up BaudRate */
uart->umr = UART_UMR_SB_STOP_BITS_1;
/* Setting up BaudRate */
- counter = (u32) (
gd->bus_clk / (gd->baudrate
));
- counter
>>= 5
;
+ counter = (u32) (
(gd->bus_clk / 32) + (gd->baudrate / 2
));
+ counter
= counter / gd->baudrate
;
/* write to CTUR: divide counter upper byte */
uart->ubg1 = (u8) ((counter & 0xff00) >> 8);
/* write to CTUR: divide counter upper byte */
uart->ubg1 = (u8) ((counter & 0xff00) >> 8);
@@
-76,7
+76,7
@@
int serial_init(void)
void serial_putc(const char c)
{
void serial_putc(const char c)
{
- volatile uart_t *uart = (volatile uart_t *)(C
FG
_UART_BASE);
+ volatile uart_t *uart = (volatile uart_t *)(C
ONFIG_SYS
_UART_BASE);
if (c == '\n')
serial_putc('\r');
if (c == '\n')
serial_putc('\r');
@@
-96,7
+96,7
@@
void serial_puts(const char *s)
int serial_getc(void)
{
int serial_getc(void)
{
- volatile uart_t *uart = (volatile uart_t *)(C
FG
_UART_BASE);
+ volatile uart_t *uart = (volatile uart_t *)(C
ONFIG_SYS
_UART_BASE);
/* Wait for a character to arrive. */
while (!(uart->usr & UART_USR_RXRDY)) ;
/* Wait for a character to arrive. */
while (!(uart->usr & UART_USR_RXRDY)) ;
@@
-105,18
+105,19
@@
int serial_getc(void)
int serial_tstc(void)
{
int serial_tstc(void)
{
- volatile uart_t *uart = (volatile uart_t *)(C
FG
_UART_BASE);
+ volatile uart_t *uart = (volatile uart_t *)(C
ONFIG_SYS
_UART_BASE);
return (uart->usr & UART_USR_RXRDY);
}
void serial_setbrg(void)
{
return (uart->usr & UART_USR_RXRDY);
}
void serial_setbrg(void)
{
- volatile uart_t *uart = (volatile uart_t *)(C
FG
_UART_BASE);
+ volatile uart_t *uart = (volatile uart_t *)(C
ONFIG_SYS
_UART_BASE);
u32 counter;
u32 counter;
- counter = ((gd->bus_clk / gd->baudrate)) >> 5;
- counter++;
+ /* Setting up BaudRate */
+ counter = (u32) ((gd->bus_clk / 32) + (gd->baudrate / 2));
+ counter = counter / gd->baudrate;
/* write to CTUR: divide counter upper byte */
uart->ubg1 = ((counter & 0xff00) >> 8);
/* write to CTUR: divide counter upper byte */
uart->ubg1 = ((counter & 0xff00) >> 8);
@@
-128,4
+129,3
@@
void serial_setbrg(void)
uart->ucr = UART_UCR_RX_ENABLED | UART_UCR_TX_ENABLED;
}
uart->ucr = UART_UCR_RX_ENABLED | UART_UCR_TX_ENABLED;
}
-#endif /* CONFIG_MCFUART */