Vitaly Bordug | 6e197696 | 2006-04-29 23:06:00 +0400 | [diff] [blame] | 1 | /* |
| 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 | |
Vitaly Bordug | 6e197696 | 2006-04-29 23:06:00 +0400 | [diff] [blame] | 15 | #include <asm/types.h> |
| 16 | |
| 17 | enum fs_uart_id { |
| 18 | fsid_smc1_uart, |
| 19 | fsid_smc2_uart, |
| 20 | fsid_scc1_uart, |
| 21 | fsid_scc2_uart, |
| 22 | fsid_scc3_uart, |
| 23 | fsid_scc4_uart, |
| 24 | fs_uart_nr, |
| 25 | }; |
| 26 | |
| 27 | static inline int fs_uart_id_scc2fsid(int id) |
| 28 | { |
| 29 | return fsid_scc1_uart + id - 1; |
| 30 | } |
| 31 | |
| 32 | static inline int fs_uart_id_fsid2scc(int id) |
| 33 | { |
| 34 | return id - fsid_scc1_uart + 1; |
| 35 | } |
| 36 | |
| 37 | static inline int fs_uart_id_smc2fsid(int id) |
| 38 | { |
| 39 | return fsid_smc1_uart + id - 1; |
| 40 | } |
| 41 | |
| 42 | static inline int fs_uart_id_fsid2smc(int id) |
| 43 | { |
| 44 | return id - fsid_smc1_uart + 1; |
| 45 | } |
| 46 | |
| 47 | struct fs_uart_platform_info { |
Vitaly Bordug | d3465c9 | 2006-09-21 22:38:05 +0400 | [diff] [blame] | 48 | void(*init_ioports)(struct fs_uart_platform_info *); |
Vitaly Bordug | 6e197696 | 2006-04-29 23:06:00 +0400 | [diff] [blame] | 49 | /* device specific information */ |
| 50 | int fs_no; /* controller index */ |
Vitaly Bordug | 611a15a | 2006-09-21 22:38:05 +0400 | [diff] [blame] | 51 | char fs_type[4]; /* controller type */ |
Vitaly Bordug | 6e197696 | 2006-04-29 23:06:00 +0400 | [diff] [blame] | 52 | u32 uart_clk; |
| 53 | u8 tx_num_fifo; |
| 54 | u8 tx_buf_size; |
| 55 | u8 rx_num_fifo; |
| 56 | u8 rx_buf_size; |
| 57 | u8 brg; |
Vitaly Bordug | d3465c9 | 2006-09-21 22:38:05 +0400 | [diff] [blame] | 58 | u8 clk_rx; |
| 59 | u8 clk_tx; |
Vitaly Bordug | 6e197696 | 2006-04-29 23:06:00 +0400 | [diff] [blame] | 60 | }; |
| 61 | |
Vitaly Bordug | 611a15a | 2006-09-21 22:38:05 +0400 | [diff] [blame] | 62 | static inline int fs_uart_get_id(struct fs_uart_platform_info *fpi) |
| 63 | { |
| 64 | if(strstr(fpi->fs_type, "SMC")) |
| 65 | return fs_uart_id_smc2fsid(fpi->fs_no); |
| 66 | if(strstr(fpi->fs_type, "SCC")) |
| 67 | return fs_uart_id_scc2fsid(fpi->fs_no); |
| 68 | return fpi->fs_no; |
| 69 | } |
| 70 | |
Vitaly Bordug | 6e197696 | 2006-04-29 23:06:00 +0400 | [diff] [blame] | 71 | #endif |