| 1 |
2 |
drasko |
/*
|
| 2 |
|
|
* OMAP UART Generic driver implementation.
|
| 3 |
|
|
*
|
| 4 |
|
|
* Copyright (C) 2007 Bahadir Balban
|
| 5 |
|
|
*
|
| 6 |
|
|
* The particular intention of this code is that it has been carefully written
|
| 7 |
|
|
* as decoupled from os-specific code and in a verbose way such that it clearly
|
| 8 |
|
|
* demonstrates how the device operates, reducing the amount of time to be spent
|
| 9 |
|
|
* for understanding the operational model and implementing a driver from
|
| 10 |
|
|
* scratch. This is the very first to be such a driver so far, hopefully it will
|
| 11 |
|
|
* turn out to be useful.
|
| 12 |
|
|
*/
|
| 13 |
|
|
|
| 14 |
|
|
#ifndef __OMAP_UART_H__
|
| 15 |
|
|
#define __OMAP_UART_H__
|
| 16 |
|
|
|
| 17 |
|
|
#include INC_PLAT(uart.h)
|
| 18 |
|
|
#include INC_ARCH(io.h)
|
| 19 |
|
|
|
| 20 |
|
|
/* Register offsets */
|
| 21 |
|
|
#define OMAP_UART_DLL 0x00
|
| 22 |
|
|
#define OMAP_UART_THR 0x00
|
| 23 |
|
|
#define OMAP_UART_RHR 0x00
|
| 24 |
|
|
#define OMAP_UART_DLH 0x04
|
| 25 |
|
|
#define OMAP_UART_IER 0x04
|
| 26 |
|
|
#define OMAP_UART_FCR 0x08
|
| 27 |
|
|
#define OMAP_UART_MCR 0x10
|
| 28 |
|
|
#define OMAP_UART_LSR 0x14
|
| 29 |
|
|
#define OMAP_UART_MDR1 0x20
|
| 30 |
|
|
#define OMAP_UART_LCR 0x0C
|
| 31 |
|
|
|
| 32 |
|
|
/* Modes supported by OMAP UART/IRDA/CIR IP */
|
| 33 |
|
|
#define OMAP_UART_MODE_UART16X 0x0
|
| 34 |
|
|
#define OMAP_UART_MODE_SIR 0x1
|
| 35 |
|
|
#define OMAP_UART_MODE_UART16X_AUTO_BAUD 0x2
|
| 36 |
|
|
#define OMAP_UART_MODE_UART13X 0x3
|
| 37 |
|
|
#define OMAP_UART_MODE_MIR 0x4
|
| 38 |
|
|
#define OMAP_UART_MODE_FIR 0x5
|
| 39 |
|
|
#define OMAP_UART_MODE_CIR 0x6
|
| 40 |
|
|
#define OMAP_UART_MODE_DEFAULT 0x7 /* Disable */
|
| 41 |
|
|
|
| 42 |
|
|
/* Number of data bits for UART */
|
| 43 |
|
|
#define OMAP_UART_DATA_BITS_5 0x0
|
| 44 |
|
|
#define OMAP_UART_DATA_BITS_6 0x1
|
| 45 |
|
|
#define OMAP_UART_DATA_BITS_7 0x2
|
| 46 |
|
|
#define OMAP_UART_DATA_BITS_8 0x3
|
| 47 |
|
|
|
| 48 |
|
|
/* Stop bits to be used for UART data */
|
| 49 |
|
|
#define OMAP_UART_STOP_BITS_1 0x0
|
| 50 |
|
|
#define OMAP_UART_STOP_BITS_1_5 0x1
|
| 51 |
|
|
|
| 52 |
|
|
/* Banked Register modes- ConfigA, ConfigB, Operational */
|
| 53 |
|
|
#define OMAP_UART_BANKED_MODE_OPERATIONAL 0x00
|
| 54 |
|
|
#define OMAP_UART_BANKED_MODE_CONFIG_A 0x80
|
| 55 |
|
|
#define OMAP_UART_BANKED_MODE_CONFIG_B 0xBF
|
| 56 |
|
|
|
| 57 |
|
|
void uart_tx_char(unsigned long base, char c);
|
| 58 |
|
|
char uart_rx_char(unsigned long uart_base);
|
| 59 |
|
|
void uart_set_baudrate(unsigned long uart_base, u32 baudrate, u32 clkrate);
|
| 60 |
|
|
void uart_init(unsigned long uart_base);
|
| 61 |
|
|
|
| 62 |
|
|
#endif /* __OMAP_UART_H__ */
|