]> git.ipfire.org Git - people/ms/u-boot.git/blame - drivers/serial/serial_pxa.c
Blackfin: nand: drain the write buffer before returning
[people/ms/u-boot.git] / drivers / serial / serial_pxa.c
CommitLineData
c609719b
WD
1/*
2 * (C) Copyright 2002
3 * Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
4 *
5 * (C) Copyright 2002
6 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
7 * Marius Groeger <mgroeger@sysgo.de>
8 *
9 * (C) Copyright 2002
10 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
11 * Alex Zuepke <azu@sysgo.de>
12 *
13 * Copyright (C) 1999 2000 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl)
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
2a4741d9
MZ
38#define FFUART_INDEX 0
39#define BTUART_INDEX 1
40#define STUART_INDEX 2
80172c61
SB
41
42#ifndef CONFIG_SERIAL_MULTI
43#if defined (CONFIG_FFUART)
2a4741d9 44#define UART_INDEX FFUART_INDEX
80172c61 45#elif defined (CONFIG_BTUART)
2a4741d9 46#define UART_INDEX BTUART_INDEX
80172c61 47#elif defined (CONFIG_STUART)
2a4741d9 48#define UART_INDEX STUART_INDEX
80172c61
SB
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 73 switch (uart_index) {
2a4741d9 74 case FFUART_INDEX: