diff options
Diffstat (limited to 'drivers/serial/cpm_uart/cpm_uart.h')
-rw-r--r-- | drivers/serial/cpm_uart/cpm_uart.h | 49 |
1 files changed, 42 insertions, 7 deletions
diff --git a/drivers/serial/cpm_uart/cpm_uart.h b/drivers/serial/cpm_uart/cpm_uart.h index 73c8a088c160..aa5eb7ddeda9 100644 --- a/drivers/serial/cpm_uart/cpm_uart.h +++ b/drivers/serial/cpm_uart/cpm_uart.h | |||
@@ -10,6 +10,8 @@ | |||
10 | #define CPM_UART_H | 10 | #define CPM_UART_H |
11 | 11 | ||
12 | #include <linux/config.h> | 12 | #include <linux/config.h> |
13 | #include <linux/platform_device.h> | ||
14 | #include <linux/fs_uart_pd.h> | ||
13 | 15 | ||
14 | #if defined(CONFIG_CPM2) | 16 | #if defined(CONFIG_CPM2) |
15 | #include "cpm_uart_cpm2.h" | 17 | #include "cpm_uart_cpm2.h" |
@@ -26,14 +28,14 @@ | |||
26 | #define FLAG_SMC 0x00000002 | 28 | #define FLAG_SMC 0x00000002 |
27 | #define FLAG_CONSOLE 0x00000001 | 29 | #define FLAG_CONSOLE 0x00000001 |
28 | 30 | ||
29 | #define UART_SMC1 0 | 31 | #define UART_SMC1 fsid_smc1_uart |
30 | #define UART_SMC2 1 | 32 | #define UART_SMC2 fsid_smc2_uart |
31 | #define UART_SCC1 2 | 33 | #define UART_SCC1 fsid_scc1_uart |
32 | #define UART_SCC2 3 | 34 | #define UART_SCC2 fsid_scc2_uart |
33 | #define UART_SCC3 4 | 35 | #define UART_SCC3 fsid_scc3_uart |
34 | #define UART_SCC4 5 | 36 | #define UART_SCC4 fsid_scc4_uart |
35 | 37 | ||
36 | #define UART_NR 6 | 38 | #define UART_NR fs_uart_nr |
37 | 39 | ||
38 | #define RX_NUM_FIFO 4 | 40 | #define RX_NUM_FIFO 4 |
39 | #define RX_BUF_SIZE 32 | 41 | #define RX_BUF_SIZE 32 |
@@ -64,6 +66,7 @@ struct uart_cpm_port { | |||
64 | uint dp_addr; | 66 | uint dp_addr; |
65 | void *mem_addr; | 67 | void *mem_addr; |
66 | dma_addr_t dma_addr; | 68 | dma_addr_t dma_addr; |
69 | u32 mem_size; | ||
67 | /* helpers */ | 70 | /* helpers */ |
68 | int baud; | 71 | int baud; |
69 | int bits; | 72 | int bits; |
@@ -90,4 +93,36 @@ void scc2_lineif(struct uart_cpm_port *pinfo); | |||
90 | void scc3_lineif(struct uart_cpm_port *pinfo); | 93 | void scc3_lineif(struct uart_cpm_port *pinfo); |
91 | void scc4_lineif(struct uart_cpm_port *pinfo); | 94 | void scc4_lineif(struct uart_cpm_port *pinfo); |
92 | 95 | ||
96 | /* | ||
97 | virtual to phys transtalion | ||
98 | */ | ||
99 | static inline unsigned long cpu2cpm_addr(void* addr, struct uart_cpm_port *pinfo) | ||
100 | { | ||
101 | int offset; | ||
102 | u32 val = (u32)addr; | ||
103 | /* sane check */ | ||
104 | if ((val >= (u32)pinfo->mem_addr) && | ||
105 | (val<((u32)pinfo->mem_addr + pinfo->mem_size))) { | ||
106 | offset = val - (u32)pinfo->mem_addr; | ||
107 | return pinfo->dma_addr+offset; | ||
108 | } | ||
109 | printk("%s(): address %x to translate out of range!\n", __FUNCTION__, val); | ||
110 | return 0; | ||
111 | } | ||
112 | |||
113 | static inline void *cpm2cpu_addr(unsigned long addr, struct uart_cpm_port *pinfo) | ||
114 | { | ||
115 | int offset; | ||
116 | u32 val = addr; | ||
117 | /* sane check */ | ||
118 | if ((val >= pinfo->dma_addr) && | ||
119 | (val<(pinfo->dma_addr + pinfo->mem_size))) { | ||
120 | offset = val - (u32)pinfo->dma_addr; | ||
121 | return (void*)(pinfo->mem_addr+offset); | ||
122 | } | ||
123 | printk("%s(): address %x to translate out of range!\n", __FUNCTION__, val); | ||
124 | return 0; | ||
125 | } | ||
126 | |||
127 | |||
93 | #endif /* CPM_UART_H */ | 128 | #endif /* CPM_UART_H */ |