diff options
author | wdenk | 2004-08-02 23:22:59 +0000 |
---|---|---|
committer | wdenk | 2004-08-02 23:22:59 +0000 |
commit | 6705d81e90ed4466d6e4f445104826096da0c521 (patch) | |
tree | 4ed03c864323dacd8609cb4f84a7a8000cea6792 /drivers | |
parent | 68ceb29e7133a0f972f53d3d61fd61207374baec (diff) |
* Patch by Andreas Engel, 12 Jul 2004:
Replaced hardcoded PL011 clock frequency with config variable.
Fixed wrong CONFIG_CMD_DFL doc.
* Patch by Thomas Viehweger, 09 Jun 2004:
make it possible to remove chpart when there is only one partition
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/serial_pl010.c | 7 | ||||
-rw-r--r-- | drivers/serial_pl011.c | 24 |
2 files changed, 8 insertions, 23 deletions
diff --git a/drivers/serial_pl010.c b/drivers/serial_pl010.c index 7ff4b85c35a..417b6aeda64 100644 --- a/drivers/serial_pl010.c +++ b/drivers/serial_pl010.c @@ -38,13 +38,10 @@ #define IO_READ(addr) (*(volatile unsigned int *)(addr)) /* Integrator AP has two UARTs, we use the first one, at 38400-8-N-1 */ -#define NUM_PORTS 2 #define CONSOLE_PORT CONFIG_CONS_INDEX #define baudRate CONFIG_BAUDRATE -static volatile unsigned char *const port[NUM_PORTS] = { - (void *) (CFG_SERIAL0), - (void *) (CFG_SERIAL1) -}; +static volatile unsigned char *const port[] = CONFIG_PL01x_PORTS; +#define NUM_PORTS (sizeof(port)/sizeof(port[0])) static void pl010_putc (int portnum, char c); diff --git a/drivers/serial_pl011.c b/drivers/serial_pl011.c index 0e132268c82..4d35fe5e9ed 100644 --- a/drivers/serial_pl011.c +++ b/drivers/serial_pl011.c @@ -41,14 +41,11 @@ * IntegratorCP has two UARTs, use the first one, at 38400-8-N-1 * Versatile PB has four UARTs. */ -#define NUM_PORTS 2 + #define CONSOLE_PORT CONFIG_CONS_INDEX #define baudRate CONFIG_BAUDRATE -static volatile unsigned char *const port[NUM_PORTS] = { - (void *) (CFG_SERIAL0), - (void *) (CFG_SERIAL1) -}; - +static volatile unsigned char *const port[] = CONFIG_PL01x_PORTS; +#define NUM_PORTS (sizeof(port)/sizeof(port[0])) static void pl011_putc (int portnum, char c); static int pl011_getc (int portnum); @@ -73,20 +70,11 @@ int serial_init (void) ** IBRD = UART_CLK / (16 * BAUD_RATE) ** FBRD = ROUND((64 * MOD(UART_CLK,(16 * BAUD_RATE))) / (16 * BAUD_RATE)) */ -#ifdef CONFIG_VERSATILE temp = 16 * baudRate; - divider = 24000000 / temp; - remainder = 24000000 % temp; + divider = CONFIG_PL011_CLOCK / temp; + remainder = CONFIG_PL011_CLOCK % temp; temp = (8 * remainder) / baudRate; fraction = (temp >> 1) + (temp & 1); -#endif -#ifdef CONFIG_INTEGRATOR - temp = 16 * baudRate; - divider = 14745600 / temp; - remainder = 14745600 % temp; - temp = (8 * remainder) / baudRate; - fraction = (temp >> 1) + (temp & 1); -#endif IO_WRITE (port[CONSOLE_PORT] + UART_PL011_IBRD, divider); IO_WRITE (port[CONSOLE_PORT] + UART_PL011_FBRD, fraction); @@ -104,7 +92,7 @@ int serial_init (void) (UART_PL011_CR_UARTEN | UART_PL011_CR_TXE | UART_PL011_CR_RXE)); - return (0); + return 0; } void serial_putc (const char c) |