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
/
serial.c
diff --git
a/drivers/serial/serial.c
b/drivers/serial/serial.c
index 4ccaee28b054379d5899a417246da191a0898743..cd3439ee6a23d9b54089396d244e070dbf795ee6 100644
(file)
--- a/
drivers/serial/serial.c
+++ b/
drivers/serial/serial.c
@@
-23,12
+23,17
@@
#include <common.h>
#include <common.h>
-#ifdef CFG_NS16550_SERIAL
-
#include <ns16550.h>
#include <ns16550.h>
-#ifdef C
F
G_NS87308
+#ifdef C
ONFI
G_NS87308
#include <ns87308.h>
#endif
#include <ns87308.h>
#endif
+#ifdef CONFIG_KIRKWOOD
+#include <asm/arch/kirkwood.h>
+#elif defined(CONFIG_ORION5X)
+#include <asm/arch/orion5x.h>
+#elif defined(CONFIG_ARMADA100)
+#include <asm/arch/armada100.h>
+#endif
#if defined (CONFIG_SERIAL_MULTI)
#include <serial.h>
#if defined (CONFIG_SERIAL_MULTI)
#include <serial.h>
@@
-48,13
+53,13
@@
DECLARE_GLOBAL_DATA_PTR;
#error "Invalid console index value."
#endif
#error "Invalid console index value."
#endif
-#if CONFIG_CONS_INDEX == 1 && !defined(C
FG
_NS16550_COM1)
+#if CONFIG_CONS_INDEX == 1 && !defined(C
ONFIG_SYS
_NS16550_COM1)
#error "Console port 1 defined but not configured."
#error "Console port 1 defined but not configured."
-#elif CONFIG_CONS_INDEX == 2 && !defined(C
FG
_NS16550_COM2)
+#elif CONFIG_CONS_INDEX == 2 && !defined(C
ONFIG_SYS
_NS16550_COM2)
#error "Console port 2 defined but not configured."
#error "Console port 2 defined but not configured."
-#elif CONFIG_CONS_INDEX == 3 && !defined(C
FG
_NS16550_COM3)
+#elif CONFIG_CONS_INDEX == 3 && !defined(C
ONFIG_SYS
_NS16550_COM3)
#error "Console port 3 defined but not configured."
#error "Console port 3 defined but not configured."
-#elif CONFIG_CONS_INDEX == 4 && !defined(C
FG
_NS16550_COM4)
+#elif CONFIG_CONS_INDEX == 4 && !defined(C
ONFIG_SYS
_NS16550_COM4)
#error "Console port 4 defined but not configured."
#endif
#error "Console port 4 defined but not configured."
#endif
@@
-62,23
+67,23
@@
DECLARE_GLOBAL_DATA_PTR;
* the array is 0 based.
*/
static NS16550_t serial_ports[4] = {
* the array is 0 based.
*/
static NS16550_t serial_ports[4] = {
-#ifdef C
FG
_NS16550_COM1
- (NS16550_t)C
FG
_NS16550_COM1,
+#ifdef C
ONFIG_SYS
_NS16550_COM1
+ (NS16550_t)C
ONFIG_SYS
_NS16550_COM1,
#else
NULL,
#endif
#else
NULL,
#endif
-#ifdef C
FG
_NS16550_COM2
- (NS16550_t)C
FG
_NS16550_COM2,
+#ifdef C
ONFIG_SYS
_NS16550_COM2
+ (NS16550_t)C
ONFIG_SYS
_NS16550_COM2,
#else
NULL,
#endif
#else
NULL,
#endif
-#ifdef C
FG
_NS16550_COM3
- (NS16550_t)C
FG
_NS16550_COM3,
+#ifdef C
ONFIG_SYS
_NS16550_COM3
+ (NS16550_t)C
ONFIG_SYS
_NS16550_COM3,
#else
NULL,
#endif
#else
NULL,
#endif
-#ifdef C
FG
_NS16550_COM4
- (NS16550_t)C
FG
_NS16550_COM4
+#ifdef C
ONFIG_SYS
_NS16550_COM4
+ (NS16550_t)C
ONFIG_SYS
_NS16550_COM4
#else
NULL
#endif
#else
NULL
#endif
@@
-114,6
+119,7
@@
static NS16550_t serial_ports[4] = {
name,\
bus,\
eserial##port##_init,\
name,\
bus,\
eserial##port##_init,\
+ NULL,\
eserial##port##_setbrg,\
eserial##port##_getc,\
eserial##port##_tstc,\
eserial##port##_setbrg,\
eserial##port##_getc,\
eserial##port##_tstc,\
@@
-124,11
+130,9
@@
static NS16550_t serial_ports[4] = {
static int calc_divisor (NS16550_t port)
{
static int calc_divisor (NS16550_t port)
{
- uint32_t clk_divisor;
-
#ifdef CONFIG_OMAP1510
/* If can't cleanly clock 115200 set div to 1 */
#ifdef CONFIG_OMAP1510
/* If can't cleanly clock 115200 set div to 1 */
- if ((C
FG
_NS16550_CLK == 12000000) && (gd->baudrate == 115200)) {
+ if ((C
ONFIG_SYS
_NS16550_CLK == 12000000) && (gd->baudrate == 115200)) {
port->osc_12m_sel = OSC_12M_SEL; /* enable 6.5 * divisor */
return (1); /* return 1 for base divisor */
}
port->osc_12m_sel = OSC_12M_SEL; /* enable 6.5 * divisor */
return (1); /* return 1 for base divisor */
}
@@
-136,7
+140,7
@@
static int calc_divisor (NS16550_t port)
#endif
#ifdef CONFIG_OMAP1610
/* If can't cleanly clock 115200 set div to 1 */
#endif
#ifdef CONFIG_OMAP1610
/* If can't cleanly clock 115200 set div to 1 */
- if ((C
FG
_NS16550_CLK == 48000000) && (gd->baudrate == 115200)) {
+ if ((C
ONFIG_SYS
_NS16550_CLK == 48000000) && (gd->baudrate == 115200)) {
return (26); /* return 26 for base divisor */
}
#endif
return (26); /* return 26 for base divisor */
}
#endif
@@
-148,16
+152,12
@@
static int calc_divisor (NS16550_t port)
#endif
/* Compute divisor value. Normally, we should simply return:
#endif
/* Compute divisor value. Normally, we should simply return:
- * C
FG
_NS16550_CLK) / MODE_X_DIV / gd->baudrate
- * but we need to round that value by adding 0.5
(2/4)
.
+ * C
ONFIG_SYS
_NS16550_CLK) / MODE_X_DIV / gd->baudrate
+ * but we need to round that value by adding 0.5.
* Rounding is especially important at high baud rates.
*/
* Rounding is especially important at high baud rates.
*/
- clk_divisor = (((4 * CFG_NS16550_CLK) /
- (MODE_X_DIV * gd->baudrate)) + 2) / 4;
-
- debug("NS16550 clock divisor = %d\n", clk_divisor);
-
- return clk_divisor;
+ return (CONFIG_SYS_NS16550_CLK + (gd->baudrate * (MODE_X_DIV / 2))) /
+ (MODE_X_DIV * gd->baudrate);
}
#if !defined(CONFIG_SERIAL_MULTI)
}
#if !defined(CONFIG_SERIAL_MULTI)
@@
-165,23
+165,23
@@
int serial_init (void)
{
int clock_divisor;
{
int clock_divisor;
-#ifdef C
F
G_NS87308
+#ifdef C
ONFI
G_NS87308
initialise_ns87308();
#endif
initialise_ns87308();
#endif
-#ifdef C
FG
_NS16550_COM1
+#ifdef C
ONFIG_SYS
_NS16550_COM1
clock_divisor = calc_divisor(serial_ports[0]);
NS16550_init(serial_ports[0], clock_divisor);
#endif
clock_divisor = calc_divisor(serial_ports[0]);
NS16550_init(serial_ports[0], clock_divisor);
#endif
-#ifdef C
FG
_NS16550_COM2
+#ifdef C
ONFIG_SYS
_NS16550_COM2
clock_divisor = calc_divisor(serial_ports[1]);
NS16550_init(serial_ports[1], clock_divisor);
#endif
clock_divisor = calc_divisor(serial_ports[1]);
NS16550_init(serial_ports[1], clock_divisor);
#endif
-#ifdef C
FG
_NS16550_COM3
+#ifdef C
ONFIG_SYS
_NS16550_COM3
clock_divisor = calc_divisor(serial_ports[2]);
NS16550_init(serial_ports[2], clock_divisor);
#endif
clock_divisor = calc_divisor(serial_ports[2]);
NS16550_init(serial_ports[2], clock_divisor);
#endif
-#ifdef C
FG
_NS16550_COM4
+#ifdef C
ONFIG_SYS
_NS16550_COM4
clock_divisor = calc_divisor(serial_ports[3]);
NS16550_init(serial_ports[3], clock_divisor);
#endif
clock_divisor = calc_divisor(serial_ports[3]);
NS16550_init(serial_ports[3], clock_divisor);
#endif
@@
-334,5
+334,3
@@
DECLARE_ESERIAL_FUNCTIONS(4);
struct serial_device eserial4_device =
INIT_ESERIAL_STRUCTURE(4,"eserial3","EUART4");
#endif /* CONFIG_SERIAL_MULTI */
struct serial_device eserial4_device =
INIT_ESERIAL_STRUCTURE(4,"eserial3","EUART4");
#endif /* CONFIG_SERIAL_MULTI */
-
-#endif