blob: 809bb9ffc78846fbc2f8b5747ef42b225d8c4940 [file] [log] [blame]
Vitaly Bordug6e1976962006-04-29 23:06:00 +04001/*
2 * Platform information definitions for the CPM Uart driver.
3 *
4 * 2006 (c) MontaVista Software, Inc.
5 * Vitaly Bordug <vbordug@ru.mvista.com>
6 *
7 * This file is licensed under the terms of the GNU General Public License
8 * version 2. This program is licensed "as is" without any warranty of any
9 * kind, whether express or implied.
10 */
11
12#ifndef FS_UART_PD_H
13#define FS_UART_PD_H
14
15#include <linux/version.h>
16#include <asm/types.h>
17
18enum fs_uart_id {
19 fsid_smc1_uart,
20 fsid_smc2_uart,
21 fsid_scc1_uart,
22 fsid_scc2_uart,
23 fsid_scc3_uart,
24 fsid_scc4_uart,
25 fs_uart_nr,
26};
27
28static inline int fs_uart_id_scc2fsid(int id)
29{
30 return fsid_scc1_uart + id - 1;
31}
32
33static inline int fs_uart_id_fsid2scc(int id)
34{
35 return id - fsid_scc1_uart + 1;
36}
37
38static inline int fs_uart_id_smc2fsid(int id)
39{
40 return fsid_smc1_uart + id - 1;
41}
42
43static inline int fs_uart_id_fsid2smc(int id)
44{
45 return id - fsid_smc1_uart + 1;
46}
47
48struct fs_uart_platform_info {
Vitaly Bordugd3465c92006-09-21 22:38:05 +040049 void(*init_ioports)(struct fs_uart_platform_info *);
Vitaly Bordug6e1976962006-04-29 23:06:00 +040050 /* device specific information */
51 int fs_no; /* controller index */
Vitaly Bordug611a15a2006-09-21 22:38:05 +040052 char fs_type[4]; /* controller type */
Vitaly Bordug6e1976962006-04-29 23:06:00 +040053 u32 uart_clk;
54 u8 tx_num_fifo;
55 u8 tx_buf_size;
56 u8 rx_num_fifo;
57 u8 rx_buf_size;
58 u8 brg;
Vitaly Bordugd3465c92006-09-21 22:38:05 +040059 u8 clk_rx;
60 u8 clk_tx;
Vitaly Bordug6e1976962006-04-29 23:06:00 +040061};
62
Vitaly Bordug611a15a2006-09-21 22:38:05 +040063static inline int fs_uart_get_id(struct fs_uart_platform_info *fpi)
64{
65 if(strstr(fpi->fs_type, "SMC"))
66 return fs_uart_id_smc2fsid(fpi->fs_no);
67 if(strstr(fpi->fs_type, "SCC"))
68 return fs_uart_id_scc2fsid(fpi->fs_no);
69 return fpi->fs_no;
70}
71
Vitaly Bordug6e1976962006-04-29 23:06:00 +040072#endif