diff options
Diffstat (limited to 'drivers/serial/cpm_uart/cpm_uart.h')
-rw-r--r-- | drivers/serial/cpm_uart/cpm_uart.h | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/drivers/serial/cpm_uart/cpm_uart.h b/drivers/serial/cpm_uart/cpm_uart.h index a8f894c78194..32b9737759c4 100644 --- a/drivers/serial/cpm_uart/cpm_uart.h +++ b/drivers/serial/cpm_uart/cpm_uart.h | |||
@@ -56,21 +56,21 @@ struct uart_cpm_port { | |||
56 | u16 rx_fifosize; | 56 | u16 rx_fifosize; |
57 | u16 tx_nrfifos; | 57 | u16 tx_nrfifos; |
58 | u16 tx_fifosize; | 58 | u16 tx_fifosize; |
59 | smc_t *smcp; | 59 | smc_t __iomem *smcp; |
60 | smc_uart_t *smcup; | 60 | smc_uart_t __iomem *smcup; |
61 | scc_t *sccp; | 61 | scc_t __iomem *sccp; |
62 | scc_uart_t *sccup; | 62 | scc_uart_t __iomem *sccup; |
63 | volatile cbd_t *rx_bd_base; | 63 | cbd_t __iomem *rx_bd_base; |
64 | volatile cbd_t *rx_cur; | 64 | cbd_t __iomem *rx_cur; |
65 | volatile cbd_t *tx_bd_base; | 65 | cbd_t __iomem *tx_bd_base; |
66 | volatile cbd_t *tx_cur; | 66 | cbd_t __iomem *tx_cur; |
67 | unsigned char *tx_buf; | 67 | unsigned char *tx_buf; |
68 | unsigned char *rx_buf; | 68 | unsigned char *rx_buf; |
69 | u32 flags; | 69 | u32 flags; |
70 | void (*set_lineif)(struct uart_cpm_port *); | 70 | void (*set_lineif)(struct uart_cpm_port *); |
71 | u8 brg; | 71 | u8 brg; |
72 | uint dp_addr; | 72 | uint dp_addr; |
73 | void *mem_addr; | 73 | void *mem_addr; |
74 | dma_addr_t dma_addr; | 74 | dma_addr_t dma_addr; |
75 | u32 mem_size; | 75 | u32 mem_size; |
76 | /* helpers */ | 76 | /* helpers */ |
@@ -80,14 +80,18 @@ struct uart_cpm_port { | |||
80 | int is_portb; | 80 | int is_portb; |
81 | /* wait on close if needed */ | 81 | /* wait on close if needed */ |
82 | int wait_closing; | 82 | int wait_closing; |
83 | /* value to combine with opcode to form cpm command */ | ||
84 | u32 command; | ||
83 | }; | 85 | }; |
84 | 86 | ||
87 | #ifndef CONFIG_PPC_CPM_NEW_BINDING | ||
85 | extern int cpm_uart_port_map[UART_NR]; | 88 | extern int cpm_uart_port_map[UART_NR]; |
89 | #endif | ||
86 | extern int cpm_uart_nr; | 90 | extern int cpm_uart_nr; |
87 | extern struct uart_cpm_port cpm_uart_ports[UART_NR]; | 91 | extern struct uart_cpm_port cpm_uart_ports[UART_NR]; |
88 | 92 | ||
89 | /* these are located in their respective files */ | 93 | /* these are located in their respective files */ |
90 | void cpm_line_cr_cmd(int line, int cmd); | 94 | void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd); |
91 | int cpm_uart_init_portdesc(void); | 95 | int cpm_uart_init_portdesc(void); |
92 | int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con); | 96 | int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con); |
93 | void cpm_uart_freebuf(struct uart_cpm_port *pinfo); | 97 | void cpm_uart_freebuf(struct uart_cpm_port *pinfo); |
@@ -102,34 +106,36 @@ void scc4_lineif(struct uart_cpm_port *pinfo); | |||
102 | /* | 106 | /* |
103 | virtual to phys transtalion | 107 | virtual to phys transtalion |
104 | */ | 108 | */ |
105 | static inline unsigned long cpu2cpm_addr(void* addr, struct uart_cpm_port *pinfo) | 109 | static inline unsigned long cpu2cpm_addr(void *addr, |
110 | struct uart_cpm_port *pinfo) | ||
106 | { | 111 | { |
107 | int offset; | 112 | int offset; |
108 | u32 val = (u32)addr; | 113 | u32 val = (u32)addr; |
114 | u32 mem = (u32)pinfo->mem_addr; | ||
109 | /* sane check */ | 115 | /* sane check */ |
110 | if (likely((val >= (u32)pinfo->mem_addr)) && | 116 | if (likely(val >= mem && val < mem + pinfo->mem_size)) { |
111 | (val<((u32)pinfo->mem_addr + pinfo->mem_size))) { | 117 | offset = val - mem; |
112 | offset = val - (u32)pinfo->mem_addr; | 118 | return pinfo->dma_addr + offset; |
113 | return pinfo->dma_addr+offset; | ||
114 | } | 119 | } |
115 | /* something nasty happened */ | 120 | /* something nasty happened */ |
116 | BUG(); | 121 | BUG(); |
117 | return 0; | 122 | return 0; |
118 | } | 123 | } |
119 | 124 | ||
120 | static inline void *cpm2cpu_addr(unsigned long addr, struct uart_cpm_port *pinfo) | 125 | static inline void *cpm2cpu_addr(unsigned long addr, |
126 | struct uart_cpm_port *pinfo) | ||
121 | { | 127 | { |
122 | int offset; | 128 | int offset; |
123 | u32 val = addr; | 129 | u32 val = addr; |
130 | u32 dma = (u32)pinfo->dma_addr; | ||
124 | /* sane check */ | 131 | /* sane check */ |
125 | if (likely((val >= pinfo->dma_addr) && | 132 | if (likely(val >= dma && val < dma + pinfo->mem_size)) { |
126 | (val<(pinfo->dma_addr + pinfo->mem_size)))) { | 133 | offset = val - dma; |
127 | offset = val - (u32)pinfo->dma_addr; | 134 | return pinfo->mem_addr + offset; |
128 | return (void*)(pinfo->mem_addr+offset); | ||
129 | } | 135 | } |
130 | /* something nasty happened */ | 136 | /* something nasty happened */ |
131 | BUG(); | 137 | BUG(); |
132 | return 0; | 138 | return NULL; |
133 | } | 139 | } |
134 | 140 | ||
135 | 141 | ||