]> Git Repo - u-boot.git/blame - cpu/pxa/serial.c
PXA270: Add support for multiple serial ports.
[u-boot.git] / cpu / pxa / serial.c
CommitLineData
c609719b
WD
1/*
2 * (C) Copyright 2002
3 * Wolfgang Denk, DENX Software Engineering, <[email protected]>
4 *
5 * (C) Copyright 2002
6 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
7 * Marius Groeger <[email protected]>
8 *
9 * (C) Copyright 2002
10 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
11 * Alex Zuepke <[email protected]>
12 *
13 * Copyright (C) 1999 2000 2001 Erik Mouw ([email protected])
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 *
29 */
30
31#include <common.h>
5f535fe1 32#include <watchdog.h>
80172c61 33#include <serial.h>
c609719b
WD
34#include <asm/arch/pxa-regs.h>
35
d87080b7
WD
36DECLARE_GLOBAL_DATA_PTR;
37
80172c61
SB
38#define FFUART 0
39#define BTUART 1
40#define STUART 2
41
42#ifndef CONFIG_SERIAL_MULTI
43#if defined (CONFIG_FFUART)
44#define UART_INDEX FFUART
45#elif defined (CONFIG_BTUART)
46#define UART_INDEX BTUART
47#elif defined (CONFIG_STUART)
48#define UART_INDEX STUART
49#else
50#error "Bad: you didn't configure serial ..."
51#endif
52#endif
53
54void pxa_setbrg_dev (unsigned int uart_index)
c609719b 55{
c609719b
WD
56 unsigned int quot = 0;
57
58 if (gd->baudrate == 1200)
5f535fe1 59 quot = 768;
c609719b
WD
60 else if (gd->baudrate == 9600)
61 quot = 96;
62 else if (gd->baudrate == 19200)
63 quot = 48;
64 else if (gd->baudrate == 38400)
65 quot = 24;
66 else if (gd->baudrate == 57600)
67 quot = 16;
68 else if (gd->baudrate == 115200)
69 quot = 8;
70 else
71 hang ();
72
80172c61
SB
73 switch (uart_index) {
74 case FFUART: