| 1 | /* |
| 2 | * (C) Copyright 2007 OpenMoko, Inc. |
| 3 | * Author: xiangfu liu <xiangfu@openmoko.org> |
| 4 | * |
| 5 | * Configuation settings for the FIC Neo GTA02 Linux GSM phone |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU General Public License as |
| 9 | * published by the Free Software Foundation; either version 2 of |
| 10 | * the License, or (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 20 | * MA 02111-1307 USA |
| 21 | */ |
| 22 | |
| 23 | #include <qi.h> |
| 24 | #include <serial-s3c24xx.h> |
| 25 | |
| 26 | void serial_init_115200_s3c24xx(const int uart, const int pclk_MHz) |
| 27 | { |
| 28 | int div = (((54 * pclk_MHz) + 26) / 100) -1; |
| 29 | switch(uart) |
| 30 | { |
| 31 | case UART0: |
| 32 | rULCON0 = 0x3; |
| 33 | rUCON0 = 0x245; |
| 34 | rUFCON0 = 0x0; |
| 35 | rUMCON0 = 0x0; |
| 36 | rUBRDIV0 = div; |
| 37 | break; |
| 38 | case UART1: |
| 39 | rULCON1 = 0x3; |
| 40 | rUCON1 = 0x245; |
| 41 | rUFCON1 = 0x0; |
| 42 | rUMCON1 = 0x0; |
| 43 | rUBRDIV1 = div; |
| 44 | break; |
| 45 | case UART2: |
| 46 | rULCON2 = 0x3; |
| 47 | rUCON2 = 0x245; |
| 48 | rUFCON2 = 0x1; |
| 49 | rUBRDIV2 = div; |
| 50 | break; |
| 51 | default: |
| 52 | break; |
| 53 | } |
| 54 | } |
| 55 | /* |
| 56 | * Output a single byte to the serial port. |
| 57 | */ |
| 58 | void serial_putc_s3c24xx(const int uart, const char c) |
| 59 | { |
| 60 | switch(uart) |
| 61 | { |
| 62 | case UART0: |
| 63 | while ( !( rUTRSTAT0 & 0x2 ) ); |
| 64 | WrUTXH0(c); |
| 65 | break; |
| 66 | case UART1: |
| 67 | while ( !( rUTRSTAT1 & 0x2 ) ); |
| 68 | WrUTXH1(c); |
| 69 | break; |
| 70 | case UART2: |
| 71 | while ( !( rUTRSTAT2 & 0x2 ) ); |
| 72 | WrUTXH2(c); |
| 73 | break; |
| 74 | default: |
| 75 | break; |
| 76 | } |
| 77 | } |
| 78 | |