Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Blackfin: bfin_serial.h: unify heavily duplicated serial code

Each Blackfin port has been duplicating UART structures and defines when
there really is no need for it. So start a new bfin_serial.h header to
unify all these pieces and give ourselves a fresh start.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

+377 -1024
+263
arch/blackfin/include/asm/bfin_serial.h
··· 1 + /* 2 + * bfin_serial.h - Blackfin UART/Serial definitions 3 + * 4 + * Copyright 2006-2010 Analog Devices Inc. 5 + * 6 + * Licensed under the GPL-2 or later. 7 + */ 8 + 9 + #ifndef __BFIN_ASM_SERIAL_H__ 10 + #define __BFIN_ASM_SERIAL_H__ 11 + 12 + #include <linux/serial_core.h> 13 + #include <mach/anomaly.h> 14 + #include <mach/bfin_serial.h> 15 + 16 + struct circ_buf; 17 + struct timer_list; 18 + struct work_struct; 19 + 20 + struct bfin_serial_port { 21 + struct uart_port port; 22 + unsigned int old_status; 23 + int status_irq; 24 + #ifndef BFIN_UART_BF54X_STYLE 25 + unsigned int lsr; 26 + #endif 27 + #ifdef CONFIG_SERIAL_BFIN_DMA 28 + int tx_done; 29 + int tx_count; 30 + struct circ_buf rx_dma_buf; 31 + struct timer_list rx_dma_timer; 32 + int rx_dma_nrows; 33 + unsigned int tx_dma_channel; 34 + unsigned int rx_dma_channel; 35 + struct work_struct tx_dma_workqueue; 36 + #elif ANOMALY_05000363 37 + unsigned int anomaly_threshold; 38 + #endif 39 + #ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS 40 + int scts; 41 + #endif 42 + #if defined(CONFIG_SERIAL_BFIN_CTSRTS) || \ 43 + defined(CONFIG_SERIAL_BFIN_HARD_CTSRTS) 44 + int cts_pin; 45 + int rts_pin; 46 + #endif 47 + }; 48 + 49 + /* UART_LCR Masks */ 50 + #define WLS(x) (((x)-5) & 0x03) /* Word Length Select */ 51 + #define STB 0x04 /* Stop Bits */ 52 + #define PEN 0x08 /* Parity Enable */ 53 + #define EPS 0x10 /* Even Parity Select */ 54 + #define STP 0x20 /* Stick Parity */ 55 + #define SB 0x40 /* Set Break */ 56 + #define DLAB 0x80 /* Divisor Latch Access */ 57 + 58 + /* UART_LSR Masks */ 59 + #define DR 0x01 /* Data Ready */ 60 + #define OE 0x02 /* Overrun Error */ 61 + #define PE 0x04 /* Parity Error */ 62 + #define FE 0x08 /* Framing Error */ 63 + #define BI 0x10 /* Break Interrupt */ 64 + #define THRE 0x20 /* THR Empty */ 65 + #define TEMT 0x40 /* TSR and UART_THR Empty */ 66 + #define TFI 0x80 /* Transmission Finished Indicator */ 67 + 68 + /* UART_IER Masks */ 69 + #define ERBFI 0x01 /* Enable Receive Buffer Full Interrupt */ 70 + #define ETBEI 0x02 /* Enable Transmit Buffer Empty Interrupt */ 71 + #define ELSI 0x04 /* Enable RX Status Interrupt */ 72 + #define EDSSI 0x08 /* Enable Modem Status Interrupt */ 73 + #define EDTPTI 0x10 /* Enable DMA Transmit PIRQ Interrupt */ 74 + #define ETFI 0x20 /* Enable Transmission Finished Interrupt */ 75 + #define ERFCI 0x40 /* Enable Receive FIFO Count Interrupt */ 76 + 77 + /* UART_MCR Masks */ 78 + #define XOFF 0x01 /* Transmitter Off */ 79 + #define MRTS 0x02 /* Manual Request To Send */ 80 + #define RFIT 0x04 /* Receive FIFO IRQ Threshold */ 81 + #define RFRT 0x08 /* Receive FIFO RTS Threshold */ 82 + #define LOOP_ENA 0x10 /* Loopback Mode Enable */ 83 + #define FCPOL 0x20 /* Flow Control Pin Polarity */ 84 + #define ARTS 0x40 /* Automatic Request To Send */ 85 + #define ACTS 0x80 /* Automatic Clear To Send */ 86 + 87 + /* UART_MSR Masks */ 88 + #define SCTS 0x01 /* Sticky CTS */ 89 + #define CTS 0x10 /* Clear To Send */ 90 + #define RFCS 0x20 /* Receive FIFO Count Status */ 91 + 92 + /* UART_GCTL Masks */ 93 + #define UCEN 0x01 /* Enable UARTx Clocks */ 94 + #define IREN 0x02 /* Enable IrDA Mode */ 95 + #define TPOLC 0x04 /* IrDA TX Polarity Change */ 96 + #define RPOLC 0x08 /* IrDA RX Polarity Change */ 97 + #define FPE 0x10 /* Force Parity Error On Transmit */ 98 + #define FFE 0x20 /* Force Framing Error On Transmit */ 99 + 100 + #ifdef BFIN_UART_BF54X_STYLE 101 + # define OFFSET_DLL 0x00 /* Divisor Latch (Low-Byte) */ 102 + # define OFFSET_DLH 0x04 /* Divisor Latch (High-Byte) */ 103 + # define OFFSET_GCTL 0x08 /* Global Control Register */ 104 + # define OFFSET_LCR 0x0C /* Line Control Register */ 105 + # define OFFSET_MCR 0x10 /* Modem Control Register */ 106 + # define OFFSET_LSR 0x14 /* Line Status Register */ 107 + # define OFFSET_MSR 0x18 /* Modem Status Register */ 108 + # define OFFSET_SCR 0x1C /* SCR Scratch Register */ 109 + # define OFFSET_IER_SET 0x20 /* Set Interrupt Enable Register */ 110 + # define OFFSET_IER_CLEAR 0x24 /* Clear Interrupt Enable Register */ 111 + # define OFFSET_THR 0x28 /* Transmit Holding register */ 112 + # define OFFSET_RBR 0x2C /* Receive Buffer register */ 113 + #else /* BF533 style */ 114 + # define OFFSET_THR 0x00 /* Transmit Holding register */ 115 + # define OFFSET_RBR 0x00 /* Receive Buffer register */ 116 + # define OFFSET_DLL 0x00 /* Divisor Latch (Low-Byte) */ 117 + # define OFFSET_DLH 0x04 /* Divisor Latch (High-Byte) */ 118 + # define OFFSET_IER 0x04 /* Interrupt Enable Register */ 119 + # define OFFSET_IIR 0x08 /* Interrupt Identification Register */ 120 + # define OFFSET_LCR 0x0C /* Line Control Register */ 121 + # define OFFSET_MCR 0x10 /* Modem Control Register */ 122 + # define OFFSET_LSR 0x14 /* Line Status Register */ 123 + # define OFFSET_MSR 0x18 /* Modem Status Register */ 124 + # define OFFSET_SCR 0x1C /* SCR Scratch Register */ 125 + # define OFFSET_GCTL 0x24 /* Global Control Register */ 126 + /* code should not need IIR, so force build error if they use it */ 127 + # undef OFFSET_IIR 128 + #endif 129 + 130 + /* 131 + * All Blackfin system MMRs are padded to 32bits even if the register 132 + * itself is only 16bits. So use a helper macro to streamline this. 133 + */ 134 + #define __BFP(m) u16 m; u16 __pad_##m 135 + struct bfin_uart_regs { 136 + #ifdef BFIN_UART_BF54X_STYLE 137 + __BFP(dll); 138 + __BFP(dlh); 139 + __BFP(gctl); 140 + __BFP(lcr); 141 + __BFP(mcr); 142 + __BFP(lsr); 143 + __BFP(msr); 144 + __BFP(scr); 145 + __BFP(ier_set); 146 + __BFP(ier_clear); 147 + __BFP(thr); 148 + __BFP(rbr); 149 + #else 150 + union { 151 + u16 dll; 152 + u16 thr; 153 + const u16 rbr; 154 + }; 155 + const u16 __pad0; 156 + union { 157 + u16 dlh; 158 + u16 ier; 159 + }; 160 + const u16 __pad1; 161 + const __BFP(iir); 162 + __BFP(lcr); 163 + __BFP(mcr); 164 + __BFP(lsr); 165 + __BFP(msr); 166 + __BFP(scr); 167 + const u32 __pad2; 168 + __BFP(gctl); 169 + #endif 170 + }; 171 + #undef __BFP 172 + 173 + #ifndef port_membase 174 + # define port_membase(p) (((struct bfin_serial_port *)(p))->port.membase) 175 + #endif 176 + 177 + #define UART_GET_CHAR(p) bfin_read16(port_membase(p) + OFFSET_RBR) 178 + #define UART_GET_DLL(p) bfin_read16(port_membase(p) + OFFSET_DLL) 179 + #define UART_GET_DLH(p) bfin_read16(port_membase(p) + OFFSET_DLH) 180 + #define UART_GET_GCTL(p) bfin_read16(port_membase(p) + OFFSET_GCTL) 181 + #define UART_GET_LCR(p) bfin_read16(port_membase(p) + OFFSET_LCR) 182 + #define UART_GET_MCR(p) bfin_read16(port_membase(p) + OFFSET_MCR) 183 + #define UART_GET_MSR(p) bfin_read16(port_membase(p) + OFFSET_MSR) 184 + 185 + #define UART_PUT_CHAR(p, v) bfin_write16(port_membase(p) + OFFSET_THR, v) 186 + #define UART_PUT_DLL(p, v) bfin_write16(port_membase(p) + OFFSET_DLL, v) 187 + #define UART_PUT_DLH(p, v) bfin_write16(port_membase(p) + OFFSET_DLH, v) 188 + #define UART_PUT_GCTL(p, v) bfin_write16(port_membase(p) + OFFSET_GCTL, v) 189 + #define UART_PUT_LCR(p, v) bfin_write16(port_membase(p) + OFFSET_LCR, v) 190 + #define UART_PUT_MCR(p, v) bfin_write16(port_membase(p) + OFFSET_MCR, v) 191 + 192 + #ifdef BFIN_UART_BF54X_STYLE 193 + 194 + #define UART_CLEAR_IER(p, v) bfin_write16(port_membase(p) + OFFSET_IER_CLEAR, v) 195 + #define UART_GET_IER(p) bfin_read16(port_membase(p) + OFFSET_IER_SET) 196 + #define UART_SET_IER(p, v) bfin_write16(port_membase(p) + OFFSET_IER_SET, v) 197 + 198 + #define UART_CLEAR_DLAB(p) /* MMRs not muxed on BF54x */ 199 + #define UART_SET_DLAB(p) /* MMRs not muxed on BF54x */ 200 + 201 + #define UART_CLEAR_LSR(p) bfin_write16(port_membase(p) + OFFSET_LSR, -1) 202 + #define UART_GET_LSR(p) bfin_read16(port_membase(p) + OFFSET_LSR) 203 + #define UART_PUT_LSR(p, v) bfin_write16(port_membase(p) + OFFSET_LSR, v) 204 + 205 + /* This handles hard CTS/RTS */ 206 + #define UART_CLEAR_SCTS(p) bfin_write16((port_membase(p) + OFFSET_MSR), SCTS) 207 + #define UART_GET_CTS(x) (UART_GET_MSR(x) & CTS) 208 + #define UART_DISABLE_RTS(x) UART_PUT_MCR(x, UART_GET_MCR(x) & ~(ARTS | MRTS)) 209 + #define UART_ENABLE_RTS(x) UART_PUT_MCR(x, UART_GET_MCR(x) | MRTS | ARTS) 210 + #define UART_ENABLE_INTS(x, v) UART_SET_IER(x, v) 211 + #define UART_DISABLE_INTS(x) UART_CLEAR_IER(x, 0xF) 212 + 213 + #else /* BF533 style */ 214 + 215 + #define UART_CLEAR_IER(p, v) UART_PUT_IER(p, UART_GET_IER(p) & ~(v)) 216 + #define UART_GET_IER(p) bfin_read16(port_membase(p) + OFFSET_IER) 217 + #define UART_PUT_IER(p, v) bfin_write16(port_membase(p) + OFFSET_IER, v) 218 + #define UART_SET_IER(p, v) UART_PUT_IER(p, UART_GET_IER(p) | (v)) 219 + 220 + #define UART_CLEAR_DLAB(p) do { UART_PUT_LCR(p, UART_GET_LCR(p) & ~DLAB); SSYNC(); } while (0) 221 + #define UART_SET_DLAB(p) do { UART_PUT_LCR(p, UART_GET_LCR(p) | DLAB); SSYNC(); } while (0) 222 + 223 + #ifndef put_lsr_cache 224 + # define put_lsr_cache(p, v) (((struct bfin_serial_port *)(p))->lsr = (v)) 225 + #endif 226 + #ifndef get_lsr_cache 227 + # define get_lsr_cache(p) (((struct bfin_serial_port *)(p))->lsr) 228 + #endif 229 + 230 + /* The hardware clears the LSR bits upon read, so we need to cache 231 + * some of the more fun bits in software so they don't get lost 232 + * when checking the LSR in other code paths (TX). 233 + */ 234 + static inline void UART_CLEAR_LSR(void *p) 235 + { 236 + put_lsr_cache(p, 0); 237 + bfin_write16(port_membase(p) + OFFSET_LSR, -1); 238 + } 239 + static inline unsigned int UART_GET_LSR(void *p) 240 + { 241 + unsigned int lsr = bfin_read16(port_membase(p) + OFFSET_LSR); 242 + put_lsr_cache(p, get_lsr_cache(p) | (lsr & (BI|FE|PE|OE))); 243 + return lsr | get_lsr_cache(p); 244 + } 245 + static inline void UART_PUT_LSR(void *p, uint16_t val) 246 + { 247 + put_lsr_cache(p, get_lsr_cache(p) & ~val); 248 + } 249 + 250 + /* This handles soft CTS/RTS */ 251 + #define UART_GET_CTS(x) gpio_get_value((x)->cts_pin) 252 + #define UART_DISABLE_RTS(x) gpio_set_value((x)->rts_pin, 1) 253 + #define UART_ENABLE_RTS(x) gpio_set_value((x)->rts_pin, 0) 254 + #define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v) 255 + #define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0) 256 + 257 + #endif 258 + 259 + #ifndef BFIN_UART_TX_FIFO_SIZE 260 + # define BFIN_UART_TX_FIFO_SIZE 2 261 + #endif 262 + 263 + #endif /* __BFIN_ASM_SERIAL_H__ */
+14
arch/blackfin/mach-bf518/include/mach/bfin_serial.h
··· 1 + /* 2 + * mach/bfin_serial.h - Blackfin UART/Serial definitions 3 + * 4 + * Copyright 2006-2010 Analog Devices Inc. 5 + * 6 + * Licensed under the GPL-2 or later. 7 + */ 8 + 9 + #ifndef __BFIN_MACH_SERIAL_H__ 10 + #define __BFIN_MACH_SERIAL_H__ 11 + 12 + #define BFIN_UART_NR_PORTS 2 13 + 14 + #endif
+2 -71
arch/blackfin/mach-bf518/include/mach/bfin_serial_5xx.h
··· 4 4 * Licensed under the GPL-2 or later 5 5 */ 6 6 7 - #include <linux/serial.h> 8 7 #include <asm/dma.h> 9 8 #include <asm/portmux.h> 10 - 11 - #define UART_GET_CHAR(uart) bfin_read16(((uart)->port.membase + OFFSET_RBR)) 12 - #define UART_GET_DLL(uart) bfin_read16(((uart)->port.membase + OFFSET_DLL)) 13 - #define UART_GET_IER(uart) bfin_read16(((uart)->port.membase + OFFSET_IER)) 14 - #define UART_GET_DLH(uart) bfin_read16(((uart)->port.membase + OFFSET_DLH)) 15 - #define UART_GET_IIR(uart) bfin_read16(((uart)->port.membase + OFFSET_IIR)) 16 - #define UART_GET_LCR(uart) bfin_read16(((uart)->port.membase + OFFSET_LCR)) 17 - #define UART_GET_GCTL(uart) bfin_read16(((uart)->port.membase + OFFSET_GCTL)) 18 - 19 - #define UART_PUT_CHAR(uart, v) bfin_write16(((uart)->port.membase + OFFSET_THR), v) 20 - #define UART_PUT_DLL(uart, v) bfin_write16(((uart)->port.membase + OFFSET_DLL), v) 21 - #define UART_PUT_IER(uart, v) bfin_write16(((uart)->port.membase + OFFSET_IER), v) 22 - #define UART_SET_IER(uart, v) UART_PUT_IER(uart, UART_GET_IER(uart) | (v)) 23 - #define UART_CLEAR_IER(uart, v) UART_PUT_IER(uart, UART_GET_IER(uart) & ~(v)) 24 - #define UART_PUT_DLH(uart, v) bfin_write16(((uart)->port.membase + OFFSET_DLH), v) 25 - #define UART_PUT_LCR(uart, v) bfin_write16(((uart)->port.membase + OFFSET_LCR), v) 26 - #define UART_PUT_GCTL(uart, v) bfin_write16(((uart)->port.membase + OFFSET_GCTL), v) 27 - 28 - #define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0) 29 - #define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) 30 - 31 - #define UART_GET_CTS(x) gpio_get_value(x->cts_pin) 32 - #define UART_DISABLE_RTS(x) gpio_set_value(x->rts_pin, 1) 33 - #define UART_ENABLE_RTS(x) gpio_set_value(x->rts_pin, 0) 34 - #define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v) 35 - #define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0) 36 9 37 10 #if defined(CONFIG_BFIN_UART0_CTSRTS) || defined(CONFIG_BFIN_UART1_CTSRTS) 38 11 # define CONFIG_SERIAL_BFIN_CTSRTS ··· 26 53 # define CONFIG_UART1_RTS_PIN -1 27 54 # endif 28 55 #endif 29 - 30 - #define BFIN_UART_TX_FIFO_SIZE 2 31 - 32 - /* 33 - * The pin configuration is different from schematic 34 - */ 35 - struct bfin_serial_port { 36 - struct uart_port port; 37 - unsigned int old_status; 38 - int status_irq; 39 - unsigned int lsr; 40 - #ifdef CONFIG_SERIAL_BFIN_DMA 41 - int tx_done; 42 - int tx_count; 43 - struct circ_buf rx_dma_buf; 44 - struct timer_list rx_dma_timer; 45 - int rx_dma_nrows; 46 - unsigned int tx_dma_channel; 47 - unsigned int rx_dma_channel; 48 - struct work_struct tx_dma_workqueue; 49 - #endif 50 - #ifdef CONFIG_SERIAL_BFIN_CTSRTS 51 - struct timer_list cts_timer; 52 - int cts_pin; 53 - int rts_pin; 54 - #endif 55 - }; 56 - 57 - /* The hardware clears the LSR bits upon read, so we need to cache 58 - * some of the more fun bits in software so they don't get lost 59 - * when checking the LSR in other code paths (TX). 60 - */ 61 - static inline unsigned int UART_GET_LSR(struct bfin_serial_port *uart) 62 - { 63 - unsigned int lsr = bfin_read16(uart->port.membase + OFFSET_LSR); 64 - uart->lsr |= (lsr & (BI|FE|PE|OE)); 65 - return lsr | uart->lsr; 66 - } 67 - 68 - static inline void UART_CLEAR_LSR(struct bfin_serial_port *uart) 69 - { 70 - uart->lsr = 0; 71 - bfin_write16(uart->port.membase + OFFSET_LSR, -1); 72 - } 73 56 74 57 struct bfin_serial_res { 75 58 unsigned long uart_base_addr; ··· 75 146 }; 76 147 77 148 #define DRIVER_NAME "bfin-uart" 149 + 150 + #include <asm/bfin_serial.h>
-15
arch/blackfin/mach-bf518/include/mach/blackfin.h
··· 43 43 #endif 44 44 #endif 45 45 46 - #define BFIN_UART_NR_PORTS 2 47 - 48 - #define OFFSET_THR 0x00 /* Transmit Holding register */ 49 - #define OFFSET_RBR 0x00 /* Receive Buffer register */ 50 - #define OFFSET_DLL 0x00 /* Divisor Latch (Low-Byte) */ 51 - #define OFFSET_IER 0x04 /* Interrupt Enable Register */ 52 - #define OFFSET_DLH 0x04 /* Divisor Latch (High-Byte) */ 53 - #define OFFSET_IIR 0x08 /* Interrupt Identification Register */ 54 - #define OFFSET_LCR 0x0C /* Line Control Register */ 55 - #define OFFSET_MCR 0x10 /* Modem Control Register */ 56 - #define OFFSET_LSR 0x14 /* Line Status Register */ 57 - #define OFFSET_MSR 0x18 /* Modem Status Register */ 58 - #define OFFSET_SCR 0x1C /* SCR Scratch Register */ 59 - #define OFFSET_GCTL 0x24 /* Global Control Register */ 60 - 61 46 #endif
-45
arch/blackfin/mach-bf518/include/mach/defBF51x_base.h
··· 703 703 #define IWR_ENABLE(x) (1 << ((x)&0x1F)) /* Wakeup Enable Peripheral #x */ 704 704 #define IWR_DISABLE(x) (0xFFFFFFFF ^ (1 << ((x)&0x1F))) /* Wakeup Disable Peripheral #x */ 705 705 706 - 707 - /* ************** UART CONTROLLER MASKS *************************/ 708 - /* UARTx_LCR Masks */ 709 - #define WLS(x) (((x)-5) & 0x03) /* Word Length Select */ 710 - #define STB 0x04 /* Stop Bits */ 711 - #define PEN 0x08 /* Parity Enable */ 712 - #define EPS 0x10 /* Even Parity Select */ 713 - #define STP 0x20 /* Stick Parity */ 714 - #define SB 0x40 /* Set Break */ 715 - #define DLAB 0x80 /* Divisor Latch Access */ 716 - 717 - /* UARTx_MCR Mask */ 718 - #define LOOP_ENA 0x10 /* Loopback Mode Enable */ 719 - #define LOOP_ENA_P 0x04 720 - 721 - /* UARTx_LSR Masks */ 722 - #define DR 0x01 /* Data Ready */ 723 - #define OE 0x02 /* Overrun Error */ 724 - #define PE 0x04 /* Parity Error */ 725 - #define FE 0x08 /* Framing Error */ 726 - #define BI 0x10 /* Break Interrupt */ 727 - #define THRE 0x20 /* THR Empty */ 728 - #define TEMT 0x40 /* TSR and UART_THR Empty */ 729 - 730 - /* UARTx_IER Masks */ 731 - #define ERBFI 0x01 /* Enable Receive Buffer Full Interrupt */ 732 - #define ETBEI 0x02 /* Enable Transmit Buffer Empty Interrupt */ 733 - #define ELSI 0x04 /* Enable RX Status Interrupt */ 734 - 735 - /* UARTx_IIR Masks */ 736 - #define NINT 0x01 /* Pending Interrupt */ 737 - #define IIR_TX_READY 0x02 /* UART_THR empty */ 738 - #define IIR_RX_READY 0x04 /* Receive data ready */ 739 - #define IIR_LINE_CHANGE 0x06 /* Receive line status */ 740 - #define IIR_STATUS 0x06 /* Highest Priority Pending Interrupt */ 741 - 742 - /* UARTx_GCTL Masks */ 743 - #define UCEN 0x01 /* Enable UARTx Clocks */ 744 - #define IREN 0x02 /* Enable IrDA Mode */ 745 - #define TPOLC 0x04 /* IrDA TX Polarity Change */ 746 - #define RPOLC 0x08 /* IrDA RX Polarity Change */ 747 - #define FPE 0x10 /* Force Parity Error On Transmit */ 748 - #define FFE 0x20 /* Force Framing Error On Transmit */ 749 - 750 - 751 706 /* **************** GENERAL PURPOSE TIMER MASKS **********************/ 752 707 /* TIMER_ENABLE Masks */ 753 708 #define TIMEN0 0x0001 /* Enable Timer 0 */
+14
arch/blackfin/mach-bf527/include/mach/bfin_serial.h
··· 1 + /* 2 + * mach/bfin_serial.h - Blackfin UART/Serial definitions 3 + * 4 + * Copyright 2006-2010 Analog Devices Inc. 5 + * 6 + * Licensed under the GPL-2 or later. 7 + */ 8 + 9 + #ifndef __BFIN_MACH_SERIAL_H__ 10 + #define __BFIN_MACH_SERIAL_H__ 11 + 12 + #define BFIN_UART_NR_PORTS 2 13 + 14 + #endif
+2 -71
arch/blackfin/mach-bf527/include/mach/bfin_serial_5xx.h
··· 4 4 * Licensed under the GPL-2 or later 5 5 */ 6 6 7 - #include <linux/serial.h> 8 7 #include <asm/dma.h> 9 8 #include <asm/portmux.h> 10 - 11 - #define UART_GET_CHAR(uart) bfin_read16(((uart)->port.membase + OFFSET_RBR)) 12 - #define UART_GET_DLL(uart) bfin_read16(((uart)->port.membase + OFFSET_DLL)) 13 - #define UART_GET_IER(uart) bfin_read16(((uart)->port.membase + OFFSET_IER)) 14 - #define UART_GET_DLH(uart) bfin_read16(((uart)->port.membase + OFFSET_DLH)) 15 - #define UART_GET_IIR(uart) bfin_read16(((uart)->port.membase + OFFSET_IIR)) 16 - #define UART_GET_LCR(uart) bfin_read16(((uart)->port.membase + OFFSET_LCR)) 17 - #define UART_GET_GCTL(uart) bfin_read16(((uart)->port.membase + OFFSET_GCTL)) 18 - 19 - #define UART_PUT_CHAR(uart, v) bfin_write16(((uart)->port.membase + OFFSET_THR), v) 20 - #define UART_PUT_DLL(uart, v) bfin_write16(((uart)->port.membase + OFFSET_DLL), v) 21 - #define UART_PUT_IER(uart, v) bfin_write16(((uart)->port.membase + OFFSET_IER), v) 22 - #define UART_SET_IER(uart, v) UART_PUT_IER(uart, UART_GET_IER(uart) | (v)) 23 - #define UART_CLEAR_IER(uart, v) UART_PUT_IER(uart, UART_GET_IER(uart) & ~(v)) 24 - #define UART_PUT_DLH(uart, v) bfin_write16(((uart)->port.membase + OFFSET_DLH), v) 25 - #define UART_PUT_LCR(uart, v) bfin_write16(((uart)->port.membase + OFFSET_LCR), v) 26 - #define UART_PUT_GCTL(uart, v) bfin_write16(((uart)->port.membase + OFFSET_GCTL), v) 27 - 28 - #define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0) 29 - #define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) 30 - 31 - #define UART_GET_CTS(x) gpio_get_value(x->cts_pin) 32 - #define UART_DISABLE_RTS(x) gpio_set_value(x->rts_pin, 1) 33 - #define UART_ENABLE_RTS(x) gpio_set_value(x->rts_pin, 0) 34 - #define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v) 35 - #define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0) 36 9 37 10 #if defined(CONFIG_BFIN_UART0_CTSRTS) || defined(CONFIG_BFIN_UART1_CTSRTS) 38 11 # define CONFIG_SERIAL_BFIN_CTSRTS ··· 26 53 # define CONFIG_UART1_RTS_PIN -1 27 54 # endif 28 55 #endif 29 - 30 - #define BFIN_UART_TX_FIFO_SIZE 2 31 - 32 - /* 33 - * The pin configuration is different from schematic 34 - */ 35 - struct bfin_serial_port { 36 - struct uart_port port; 37 - unsigned int old_status; 38 - int status_irq; 39 - unsigned int lsr; 40 - #ifdef CONFIG_SERIAL_BFIN_DMA 41 - int tx_done; 42 - int tx_count; 43 - struct circ_buf rx_dma_buf; 44 - struct timer_list rx_dma_timer; 45 - int rx_dma_nrows; 46 - unsigned int tx_dma_channel; 47 - unsigned int rx_dma_channel; 48 - struct work_struct tx_dma_workqueue; 49 - #endif 50 - #ifdef CONFIG_SERIAL_BFIN_CTSRTS 51 - struct timer_list cts_timer; 52 - int cts_pin; 53 - int rts_pin; 54 - #endif 55 - }; 56 - 57 - /* The hardware clears the LSR bits upon read, so we need to cache 58 - * some of the more fun bits in software so they don't get lost 59 - * when checking the LSR in other code paths (TX). 60 - */ 61 - static inline unsigned int UART_GET_LSR(struct bfin_serial_port *uart) 62 - { 63 - unsigned int lsr = bfin_read16(uart->port.membase + OFFSET_LSR); 64 - uart->lsr |= (lsr & (BI|FE|PE|OE)); 65 - return lsr | uart->lsr; 66 - } 67 - 68 - static inline void UART_CLEAR_LSR(struct bfin_serial_port *uart) 69 - { 70 - uart->lsr = 0; 71 - bfin_write16(uart->port.membase + OFFSET_LSR, -1); 72 - } 73 56 74 57 struct bfin_serial_res { 75 58 unsigned long uart_base_addr; ··· 75 146 }; 76 147 77 148 #define DRIVER_NAME "bfin-uart" 149 + 150 + #include <asm/bfin_serial.h>
-15
arch/blackfin/mach-bf527/include/mach/blackfin.h
··· 31 31 #endif 32 32 #endif 33 33 34 - #define BFIN_UART_NR_PORTS 2 35 - 36 - #define OFFSET_THR 0x00 /* Transmit Holding register */ 37 - #define OFFSET_RBR 0x00 /* Receive Buffer register */ 38 - #define OFFSET_DLL 0x00 /* Divisor Latch (Low-Byte) */ 39 - #define OFFSET_IER 0x04 /* Interrupt Enable Register */ 40 - #define OFFSET_DLH 0x04 /* Divisor Latch (High-Byte) */ 41 - #define OFFSET_IIR 0x08 /* Interrupt Identification Register */ 42 - #define OFFSET_LCR 0x0C /* Line Control Register */ 43 - #define OFFSET_MCR 0x10 /* Modem Control Register */ 44 - #define OFFSET_LSR 0x14 /* Line Status Register */ 45 - #define OFFSET_MSR 0x18 /* Modem Status Register */ 46 - #define OFFSET_SCR 0x1C /* SCR Scratch Register */ 47 - #define OFFSET_GCTL 0x24 /* Global Control Register */ 48 - 49 34 #endif
-45
arch/blackfin/mach-bf527/include/mach/defBF52x_base.h
··· 704 704 #define IWR_ENABLE(x) (1 << ((x)&0x1F)) /* Wakeup Enable Peripheral #x */ 705 705 #define IWR_DISABLE(x) (0xFFFFFFFF ^ (1 << ((x)&0x1F))) /* Wakeup Disable Peripheral #x */ 706 706 707 - 708 - /* ************** UART CONTROLLER MASKS *************************/ 709 - /* UARTx_LCR Masks */ 710 - #define WLS(x) (((x)-5) & 0x03) /* Word Length Select */ 711 - #define STB 0x04 /* Stop Bits */ 712 - #define PEN 0x08 /* Parity Enable */ 713 - #define EPS 0x10 /* Even Parity Select */ 714 - #define STP 0x20 /* Stick Parity */ 715 - #define SB 0x40 /* Set Break */ 716 - #define DLAB 0x80 /* Divisor Latch Access */ 717 - 718 - /* UARTx_MCR Mask */ 719 - #define LOOP_ENA 0x10 /* Loopback Mode Enable */ 720 - #define LOOP_ENA_P 0x04 721 - 722 - /* UARTx_LSR Masks */ 723 - #define DR 0x01 /* Data Ready */ 724 - #define OE 0x02 /* Overrun Error */ 725 - #define PE 0x04 /* Parity Error */ 726 - #define FE 0x08 /* Framing Error */ 727 - #define BI 0x10 /* Break Interrupt */ 728 - #define THRE 0x20 /* THR Empty */ 729 - #define TEMT 0x40 /* TSR and UART_THR Empty */ 730 - 731 - /* UARTx_IER Masks */ 732 - #define ERBFI 0x01 /* Enable Receive Buffer Full Interrupt */ 733 - #define ETBEI 0x02 /* Enable Transmit Buffer Empty Interrupt */ 734 - #define ELSI 0x04 /* Enable RX Status Interrupt */ 735 - 736 - /* UARTx_IIR Masks */ 737 - #define NINT 0x01 /* Pending Interrupt */ 738 - #define IIR_TX_READY 0x02 /* UART_THR empty */ 739 - #define IIR_RX_READY 0x04 /* Receive data ready */ 740 - #define IIR_LINE_CHANGE 0x06 /* Receive line status */ 741 - #define IIR_STATUS 0x06 /* Highest Priority Pending Interrupt */ 742 - 743 - /* UARTx_GCTL Masks */ 744 - #define UCEN 0x01 /* Enable UARTx Clocks */ 745 - #define IREN 0x02 /* Enable IrDA Mode */ 746 - #define TPOLC 0x04 /* IrDA TX Polarity Change */ 747 - #define RPOLC 0x08 /* IrDA RX Polarity Change */ 748 - #define FPE 0x10 /* Force Parity Error On Transmit */ 749 - #define FFE 0x20 /* Force Framing Error On Transmit */ 750 - 751 - 752 707 /* **************** GENERAL PURPOSE TIMER MASKS **********************/ 753 708 /* TIMER_ENABLE Masks */ 754 709 #define TIMEN0 0x0001 /* Enable Timer 0 */
+14
arch/blackfin/mach-bf533/include/mach/bfin_serial.h
··· 1 + /* 2 + * mach/bfin_serial.h - Blackfin UART/Serial definitions 3 + * 4 + * Copyright 2006-2010 Analog Devices Inc. 5 + * 6 + * Licensed under the GPL-2 or later. 7 + */ 8 + 9 + #ifndef __BFIN_MACH_SERIAL_H__ 10 + #define __BFIN_MACH_SERIAL_H__ 11 + 12 + #define BFIN_UART_NR_PORTS 1 13 + 14 + #endif
+2 -72
arch/blackfin/mach-bf533/include/mach/bfin_serial_5xx.h
··· 4 4 * Licensed under the GPL-2 or later 5 5 */ 6 6 7 - #include <linux/serial.h> 8 7 #include <asm/dma.h> 9 8 #include <asm/portmux.h> 10 - 11 - #define UART_GET_CHAR(uart) bfin_read16(((uart)->port.membase + OFFSET_RBR)) 12 - #define UART_GET_DLL(uart) bfin_read16(((uart)->port.membase + OFFSET_DLL)) 13 - #define UART_GET_IER(uart) bfin_read16(((uart)->port.membase + OFFSET_IER)) 14 - #define UART_GET_DLH(uart) bfin_read16(((uart)->port.membase + OFFSET_DLH)) 15 - #define UART_GET_IIR(uart) bfin_read16(((uart)->port.membase + OFFSET_IIR)) 16 - #define UART_GET_LCR(uart) bfin_read16(((uart)->port.membase + OFFSET_LCR)) 17 - #define UART_GET_GCTL(uart) bfin_read16(((uart)->port.membase + OFFSET_GCTL)) 18 - 19 - #define UART_PUT_CHAR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_THR),v) 20 - #define UART_PUT_DLL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLL),v) 21 - #define UART_PUT_IER(uart,v) bfin_write16(((uart)->port.membase + OFFSET_IER),v) 22 - #define UART_SET_IER(uart,v) UART_PUT_IER(uart, UART_GET_IER(uart) | (v)) 23 - #define UART_CLEAR_IER(uart,v) UART_PUT_IER(uart, UART_GET_IER(uart) & ~(v)) 24 - #define UART_PUT_DLH(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLH),v) 25 - #define UART_PUT_LCR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_LCR),v) 26 - #define UART_PUT_GCTL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_GCTL),v) 27 - 28 - #define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0) 29 - #define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) 30 - 31 - #define UART_GET_CTS(x) gpio_get_value(x->cts_pin) 32 - #define UART_DISABLE_RTS(x) gpio_set_value(x->rts_pin, 1) 33 - #define UART_ENABLE_RTS(x) gpio_set_value(x->rts_pin, 0) 34 - #define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v) 35 - #define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0) 36 9 37 10 #ifdef CONFIG_BFIN_UART0_CTSRTS 38 11 # define CONFIG_SERIAL_BFIN_CTSRTS ··· 16 43 # define CONFIG_UART0_RTS_PIN -1 17 44 # endif 18 45 #endif 19 - 20 - #define BFIN_UART_TX_FIFO_SIZE 2 21 - 22 - struct bfin_serial_port { 23 - struct uart_port port; 24 - unsigned int old_status; 25 - int status_irq; 26 - unsigned int lsr; 27 - #ifdef CONFIG_SERIAL_BFIN_DMA 28 - int tx_done; 29 - int tx_count; 30 - struct circ_buf rx_dma_buf; 31 - struct timer_list rx_dma_timer; 32 - int rx_dma_nrows; 33 - unsigned int tx_dma_channel; 34 - unsigned int rx_dma_channel; 35 - struct work_struct tx_dma_workqueue; 36 - #else 37 - # if ANOMALY_05000363 38 - unsigned int anomaly_threshold; 39 - # endif 40 - #endif 41 - #ifdef CONFIG_SERIAL_BFIN_CTSRTS 42 - struct timer_list cts_timer; 43 - int cts_pin; 44 - int rts_pin; 45 - #endif 46 - }; 47 - 48 - /* The hardware clears the LSR bits upon read, so we need to cache 49 - * some of the more fun bits in software so they don't get lost 50 - * when checking the LSR in other code paths (TX). 51 - */ 52 - static inline unsigned int UART_GET_LSR(struct bfin_serial_port *uart) 53 - { 54 - unsigned int lsr = bfin_read16(uart->port.membase + OFFSET_LSR); 55 - uart->lsr |= (lsr & (BI|FE|PE|OE)); 56 - return lsr | uart->lsr; 57 - } 58 - 59 - static inline void UART_CLEAR_LSR(struct bfin_serial_port *uart) 60 - { 61 - uart->lsr = 0; 62 - bfin_write16(uart->port.membase + OFFSET_LSR, -1); 63 - } 64 46 65 47 struct bfin_serial_res { 66 48 unsigned long uart_base_addr; ··· 48 120 }; 49 121 50 122 #define DRIVER_NAME "bfin-uart" 123 + 124 + #include <asm/bfin_serial.h>
-15
arch/blackfin/mach-bf533/include/mach/blackfin.h
··· 17 17 #include "cdefBF532.h" 18 18 #endif 19 19 20 - #define BFIN_UART_NR_PORTS 1 21 - 22 - #define OFFSET_THR 0x00 /* Transmit Holding register */ 23 - #define OFFSET_RBR 0x00 /* Receive Buffer register */ 24 - #define OFFSET_DLL 0x00 /* Divisor Latch (Low-Byte) */ 25 - #define OFFSET_IER 0x04 /* Interrupt Enable Register */ 26 - #define OFFSET_DLH 0x04 /* Divisor Latch (High-Byte) */ 27 - #define OFFSET_IIR 0x08 /* Interrupt Identification Register */ 28 - #define OFFSET_LCR 0x0C /* Line Control Register */ 29 - #define OFFSET_MCR 0x10 /* Modem Control Register */ 30 - #define OFFSET_LSR 0x14 /* Line Status Register */ 31 - #define OFFSET_MSR 0x18 /* Modem Status Register */ 32 - #define OFFSET_SCR 0x1C /* SCR Scratch Register */ 33 - #define OFFSET_GCTL 0x24 /* Global Control Register */ 34 - 35 20 #endif /* _MACH_BLACKFIN_H_ */
-77
arch/blackfin/mach-bf533/include/mach/defBF532.h
··· 432 432 #define IWR_ENABLE(x) (1 << (x)) /* Wakeup Enable Peripheral #x */ 433 433 #define IWR_DISABLE(x) (0xFFFFFFFF ^ (1 << (x))) /* Wakeup Disable Peripheral #x */ 434 434 435 - /* ***************************** UART CONTROLLER MASKS ********************** */ 436 - 437 - /* UART_LCR Register */ 438 - 439 - #define DLAB 0x80 440 - #define SB 0x40 441 - #define STP 0x20 442 - #define EPS 0x10 443 - #define PEN 0x08 444 - #define STB 0x04 445 - #define WLS(x) ((x-5) & 0x03) 446 - 447 - #define DLAB_P 0x07 448 - #define SB_P 0x06 449 - #define STP_P 0x05 450 - #define EPS_P 0x04 451 - #define PEN_P 0x03 452 - #define STB_P 0x02 453 - #define WLS_P1 0x01 454 - #define WLS_P0 0x00 455 - 456 - /* UART_MCR Register */ 457 - #define LOOP_ENA 0x10 458 - #define LOOP_ENA_P 0x04 459 - 460 - /* UART_LSR Register */ 461 - #define TEMT 0x40 462 - #define THRE 0x20 463 - #define BI 0x10 464 - #define FE 0x08 465 - #define PE 0x04 466 - #define OE 0x02 467 - #define DR 0x01 468 - 469 - #define TEMP_P 0x06 470 - #define THRE_P 0x05 471 - #define BI_P 0x04 472 - #define FE_P 0x03 473 - #define PE_P 0x02 474 - #define OE_P 0x01 475 - #define DR_P 0x00 476 - 477 - /* UART_IER Register */ 478 - #define ELSI 0x04 479 - #define ETBEI 0x02 480 - #define ERBFI 0x01 481 - 482 - #define ELSI_P 0x02 483 - #define ETBEI_P 0x01 484 - #define ERBFI_P 0x00 485 - 486 - /* UART_IIR Register */ 487 - #define STATUS(x) ((x << 1) & 0x06) 488 - #define NINT 0x01 489 - #define STATUS_P1 0x02 490 - #define STATUS_P0 0x01 491 - #define NINT_P 0x00 492 - #define IIR_TX_READY 0x02 /* UART_THR empty */ 493 - #define IIR_RX_READY 0x04 /* Receive data ready */ 494 - #define IIR_LINE_CHANGE 0x06 /* Receive line status */ 495 - #define IIR_STATUS 0x06 496 - 497 - /* UART_GCTL Register */ 498 - #define FFE 0x20 499 - #define FPE 0x10 500 - #define RPOLC 0x08 501 - #define TPOLC 0x04 502 - #define IREN 0x02 503 - #define UCEN 0x01 504 - 505 - #define FFE_P 0x05 506 - #define FPE_P 0x04 507 - #define RPOLC_P 0x03 508 - #define TPOLC_P 0x02 509 - #define IREN_P 0x01 510 - #define UCEN_P 0x00 511 - 512 435 /* ********* PARALLEL PERIPHERAL INTERFACE (PPI) MASKS **************** */ 513 436 514 437 /* PPI_CONTROL Masks */
+14
arch/blackfin/mach-bf537/include/mach/bfin_serial.h
··· 1 + /* 2 + * mach/bfin_serial.h - Blackfin UART/Serial definitions 3 + * 4 + * Copyright 2006-2010 Analog Devices Inc. 5 + * 6 + * Licensed under the GPL-2 or later. 7 + */ 8 + 9 + #ifndef __BFIN_MACH_SERIAL_H__ 10 + #define __BFIN_MACH_SERIAL_H__ 11 + 12 + #define BFIN_UART_NR_PORTS 2 13 + 14 + #endif
+2 -70
arch/blackfin/mach-bf537/include/mach/bfin_serial_5xx.h
··· 4 4 * Licensed under the GPL-2 or later 5 5 */ 6 6 7 - #include <linux/serial.h> 8 7 #include <asm/dma.h> 9 8 #include <asm/portmux.h> 10 - 11 - #define UART_GET_CHAR(uart) bfin_read16(((uart)->port.membase + OFFSET_RBR)) 12 - #define UART_GET_DLL(uart) bfin_read16(((uart)->port.membase + OFFSET_DLL)) 13 - #define UART_GET_IER(uart) bfin_read16(((uart)->port.membase + OFFSET_IER)) 14 - #define UART_GET_DLH(uart) bfin_read16(((uart)->port.membase + OFFSET_DLH)) 15 - #define UART_GET_IIR(uart) bfin_read16(((uart)->port.membase + OFFSET_IIR)) 16 - #define UART_GET_LCR(uart) bfin_read16(((uart)->port.membase + OFFSET_LCR)) 17 - #define UART_GET_GCTL(uart) bfin_read16(((uart)->port.membase + OFFSET_GCTL)) 18 - 19 - #define UART_PUT_CHAR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_THR),v) 20 - #define UART_PUT_DLL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLL),v) 21 - #define UART_PUT_IER(uart,v) bfin_write16(((uart)->port.membase + OFFSET_IER),v) 22 - #define UART_SET_IER(uart,v) UART_PUT_IER(uart, UART_GET_IER(uart) | (v)) 23 - #define UART_CLEAR_IER(uart,v) UART_PUT_IER(uart, UART_GET_IER(uart) & ~(v)) 24 - #define UART_PUT_DLH(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLH),v) 25 - #define UART_PUT_LCR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_LCR),v) 26 - #define UART_PUT_GCTL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_GCTL),v) 27 - 28 - #define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0) 29 - #define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) 30 - 31 - #define UART_GET_CTS(x) gpio_get_value(x->cts_pin) 32 - #define UART_DISABLE_RTS(x) gpio_set_value(x->rts_pin, 1) 33 - #define UART_ENABLE_RTS(x) gpio_set_value(x->rts_pin, 0) 34 - #define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v) 35 - #define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0) 36 9 37 10 #if defined(CONFIG_BFIN_UART0_CTSRTS) || defined(CONFIG_BFIN_UART1_CTSRTS) 38 11 # define CONFIG_SERIAL_BFIN_CTSRTS ··· 26 53 # define CONFIG_UART1_RTS_PIN -1 27 54 # endif 28 55 #endif 29 - 30 - #define BFIN_UART_TX_FIFO_SIZE 2 31 - 32 - /* 33 - * The pin configuration is different from schematic 34 - */ 35 - struct bfin_serial_port { 36 - struct uart_port port; 37 - unsigned int old_status; 38 - int status_irq; 39 - unsigned int lsr; 40 - #ifdef CONFIG_SERIAL_BFIN_DMA 41 - int tx_done; 42 - int tx_count; 43 - struct circ_buf rx_dma_buf; 44 - struct timer_list rx_dma_timer; 45 - int rx_dma_nrows; 46 - unsigned int tx_dma_channel; 47 - unsigned int rx_dma_channel; 48 - struct work_struct tx_dma_workqueue; 49 - #endif 50 - #ifdef CONFIG_SERIAL_BFIN_CTSRTS 51 - int cts_pin; 52 - int rts_pin; 53 - #endif 54 - }; 55 - 56 - /* The hardware clears the LSR bits upon read, so we need to cache 57 - * some of the more fun bits in software so they don't get lost 58 - * when checking the LSR in other code paths (TX). 59 - */ 60 - static inline unsigned int UART_GET_LSR(struct bfin_serial_port *uart) 61 - { 62 - unsigned int lsr = bfin_read16(uart->port.membase + OFFSET_LSR); 63 - uart->lsr |= (lsr & (BI|FE|PE|OE)); 64 - return lsr | uart->lsr; 65 - } 66 - 67 - static inline void UART_CLEAR_LSR(struct bfin_serial_port *uart) 68 - { 69 - uart->lsr = 0; 70 - bfin_write16(uart->port.membase + OFFSET_LSR, -1); 71 - } 72 56 73 57 struct bfin_serial_res { 74 58 unsigned long uart_base_addr; ··· 75 145 }; 76 146 77 147 #define DRIVER_NAME "bfin-uart" 148 + 149 + #include <asm/bfin_serial.h>
-15
arch/blackfin/mach-bf537/include/mach/blackfin.h
··· 25 25 #endif 26 26 #endif 27 27 28 - #define BFIN_UART_NR_PORTS 2 29 - 30 - #define OFFSET_THR 0x00 /* Transmit Holding register */ 31 - #define OFFSET_RBR 0x00 /* Receive Buffer register */ 32 - #define OFFSET_DLL 0x00 /* Divisor Latch (Low-Byte) */ 33 - #define OFFSET_IER 0x04 /* Interrupt Enable Register */ 34 - #define OFFSET_DLH 0x04 /* Divisor Latch (High-Byte) */ 35 - #define OFFSET_IIR 0x08 /* Interrupt Identification Register */ 36 - #define OFFSET_LCR 0x0C /* Line Control Register */ 37 - #define OFFSET_MCR 0x10 /* Modem Control Register */ 38 - #define OFFSET_LSR 0x14 /* Line Status Register */ 39 - #define OFFSET_MSR 0x18 /* Modem Status Register */ 40 - #define OFFSET_SCR 0x1C /* SCR Scratch Register */ 41 - #define OFFSET_GCTL 0x24 /* Global Control Register */ 42 - 43 28 #endif
-42
arch/blackfin/mach-bf537/include/mach/defBF534.h
··· 1029 1029 #define IWR_ENABLE(x) (1 << ((x)&0x1F)) /* Wakeup Enable Peripheral #x */ 1030 1030 #define IWR_DISABLE(x) (0xFFFFFFFF ^ (1 << ((x)&0x1F))) /* Wakeup Disable Peripheral #x */ 1031 1031 1032 - /* ************** UART CONTROLLER MASKS *************************/ 1033 - /* UARTx_LCR Masks */ 1034 - #define WLS(x) (((x)-5) & 0x03) /* Word Length Select */ 1035 - #define STB 0x04 /* Stop Bits */ 1036 - #define PEN 0x08 /* Parity Enable */ 1037 - #define EPS 0x10 /* Even Parity Select */ 1038 - #define STP 0x20 /* Stick Parity */ 1039 - #define SB 0x40 /* Set Break */ 1040 - #define DLAB 0x80 /* Divisor Latch Access */ 1041 - 1042 - /* UARTx_MCR Mask */ 1043 - #define LOOP_ENA 0x10 /* Loopback Mode Enable */ 1044 - #define LOOP_ENA_P 0x04 1045 - /* UARTx_LSR Masks */ 1046 - #define DR 0x01 /* Data Ready */ 1047 - #define OE 0x02 /* Overrun Error */ 1048 - #define PE 0x04 /* Parity Error */ 1049 - #define FE 0x08 /* Framing Error */ 1050 - #define BI 0x10 /* Break Interrupt */ 1051 - #define THRE 0x20 /* THR Empty */ 1052 - #define TEMT 0x40 /* TSR and UART_THR Empty */ 1053 - 1054 - /* UARTx_IER Masks */ 1055 - #define ERBFI 0x01 /* Enable Receive Buffer Full Interrupt */ 1056 - #define ETBEI 0x02 /* Enable Transmit Buffer Empty Interrupt */ 1057 - #define ELSI 0x04 /* Enable RX Status Interrupt */ 1058 - 1059 - /* UARTx_IIR Masks */ 1060 - #define NINT 0x01 /* Pending Interrupt */ 1061 - #define IIR_TX_READY 0x02 /* UART_THR empty */ 1062 - #define IIR_RX_READY 0x04 /* Receive data ready */ 1063 - #define IIR_LINE_CHANGE 0x06 /* Receive line status */ 1064 - #define IIR_STATUS 0x06 1065 - 1066 - /* UARTx_GCTL Masks */ 1067 - #define UCEN 0x01 /* Enable UARTx Clocks */ 1068 - #define IREN 0x02 /* Enable IrDA Mode */ 1069 - #define TPOLC 0x04 /* IrDA TX Polarity Change */ 1070 - #define RPOLC 0x08 /* IrDA RX Polarity Change */ 1071 - #define FPE 0x10 /* Force Parity Error On Transmit */ 1072 - #define FFE 0x20 /* Force Framing Error On Transmit */ 1073 - 1074 1032 /* **************** GENERAL PURPOSE TIMER MASKS **********************/ 1075 1033 /* TIMER_ENABLE Masks */ 1076 1034 #define TIMEN0 0x0001 /* Enable Timer 0 */
+14
arch/blackfin/mach-bf538/include/mach/bfin_serial.h
··· 1 + /* 2 + * mach/bfin_serial.h - Blackfin UART/Serial definitions 3 + * 4 + * Copyright 2006-2010 Analog Devices Inc. 5 + * 6 + * Licensed under the GPL-2 or later. 7 + */ 8 + 9 + #ifndef __BFIN_MACH_SERIAL_H__ 10 + #define __BFIN_MACH_SERIAL_H__ 11 + 12 + #define BFIN_UART_NR_PORTS 3 13 + 14 + #endif
+2 -71
arch/blackfin/mach-bf538/include/mach/bfin_serial_5xx.h
··· 4 4 * Licensed under the GPL-2 or later. 5 5 */ 6 6 7 - #include <linux/serial.h> 8 7 #include <asm/dma.h> 9 8 #include <asm/portmux.h> 10 - 11 - #define UART_GET_CHAR(uart) bfin_read16(((uart)->port.membase + OFFSET_RBR)) 12 - #define UART_GET_DLL(uart) bfin_read16(((uart)->port.membase + OFFSET_DLL)) 13 - #define UART_GET_IER(uart) bfin_read16(((uart)->port.membase + OFFSET_IER)) 14 - #define UART_GET_DLH(uart) bfin_read16(((uart)->port.membase + OFFSET_DLH)) 15 - #define UART_GET_IIR(uart) bfin_read16(((uart)->port.membase + OFFSET_IIR)) 16 - #define UART_GET_LCR(uart) bfin_read16(((uart)->port.membase + OFFSET_LCR)) 17 - #define UART_GET_GCTL(uart) bfin_read16(((uart)->port.membase + OFFSET_GCTL)) 18 - 19 - #define UART_PUT_CHAR(uart, v) bfin_write16(((uart)->port.membase + OFFSET_THR), v) 20 - #define UART_PUT_DLL(uart, v) bfin_write16(((uart)->port.membase + OFFSET_DLL), v) 21 - #define UART_PUT_IER(uart, v) bfin_write16(((uart)->port.membase + OFFSET_IER), v) 22 - #define UART_SET_IER(uart, v) UART_PUT_IER(uart, UART_GET_IER(uart) | (v)) 23 - #define UART_CLEAR_IER(uart, v) UART_PUT_IER(uart, UART_GET_IER(uart) & ~(v)) 24 - #define UART_PUT_DLH(uart, v) bfin_write16(((uart)->port.membase + OFFSET_DLH), v) 25 - #define UART_PUT_LCR(uart, v) bfin_write16(((uart)->port.membase + OFFSET_LCR), v) 26 - #define UART_PUT_GCTL(uart, v) bfin_write16(((uart)->port.membase + OFFSET_GCTL), v) 27 - 28 - #define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0) 29 - #define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) 30 - 31 - #define UART_GET_CTS(x) gpio_get_value(x->cts_pin) 32 - #define UART_DISABLE_RTS(x) gpio_set_value(x->rts_pin, 1) 33 - #define UART_ENABLE_RTS(x) gpio_set_value(x->rts_pin, 0) 34 - #define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v) 35 - #define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0) 36 9 37 10 #if defined(CONFIG_BFIN_UART0_CTSRTS) || defined(CONFIG_BFIN_UART1_CTSRTS) 38 11 # define CONFIG_SERIAL_BFIN_CTSRTS ··· 26 53 # define CONFIG_UART1_RTS_PIN -1 27 54 # endif 28 55 #endif 29 - 30 - #define BFIN_UART_TX_FIFO_SIZE 2 31 - 32 - /* 33 - * The pin configuration is different from schematic 34 - */ 35 - struct bfin_serial_port { 36 - struct uart_port port; 37 - unsigned int old_status; 38 - int status_irq; 39 - unsigned int lsr; 40 - #ifdef CONFIG_SERIAL_BFIN_DMA 41 - int tx_done; 42 - int tx_count; 43 - struct circ_buf rx_dma_buf; 44 - struct timer_list rx_dma_timer; 45 - int rx_dma_nrows; 46 - unsigned int tx_dma_channel; 47 - unsigned int rx_dma_channel; 48 - struct work_struct tx_dma_workqueue; 49 - #endif 50 - #ifdef CONFIG_SERIAL_BFIN_CTSRTS 51 - struct timer_list cts_timer; 52 - int cts_pin; 53 - int rts_pin; 54 - #endif 55 - }; 56 - 57 - /* The hardware clears the LSR bits upon read, so we need to cache 58 - * some of the more fun bits in software so they don't get lost 59 - * when checking the LSR in other code paths (TX). 60 - */ 61 - static inline unsigned int UART_GET_LSR(struct bfin_serial_port *uart) 62 - { 63 - unsigned int lsr = bfin_read16(uart->port.membase + OFFSET_LSR); 64 - uart->lsr |= (lsr & (BI|FE|PE|OE)); 65 - return lsr | uart->lsr; 66 - } 67 - 68 - static inline void UART_CLEAR_LSR(struct bfin_serial_port *uart) 69 - { 70 - uart->lsr = 0; 71 - bfin_write16(uart->port.membase + OFFSET_LSR, -1); 72 - } 73 56 74 57 struct bfin_serial_res { 75 58 unsigned long uart_base_addr; ··· 89 160 }; 90 161 91 162 #define DRIVER_NAME "bfin-uart" 163 + 164 + #include <asm/bfin_serial.h>
-15
arch/blackfin/mach-bf538/include/mach/blackfin.h
··· 22 22 #endif 23 23 #endif 24 24 25 - #define BFIN_UART_NR_PORTS 3 26 - 27 - #define OFFSET_THR 0x00 /* Transmit Holding register */ 28 - #define OFFSET_RBR 0x00 /* Receive Buffer register */ 29 - #define OFFSET_DLL 0x00 /* Divisor Latch (Low-Byte) */ 30 - #define OFFSET_IER 0x04 /* Interrupt Enable Register */ 31 - #define OFFSET_DLH 0x04 /* Divisor Latch (High-Byte) */ 32 - #define OFFSET_IIR 0x08 /* Interrupt Identification Register */ 33 - #define OFFSET_LCR 0x0C /* Line Control Register */ 34 - #define OFFSET_MCR 0x10 /* Modem Control Register */ 35 - #define OFFSET_LSR 0x14 /* Line Status Register */ 36 - #define OFFSET_MSR 0x18 /* Modem Status Register */ 37 - #define OFFSET_SCR 0x1C /* SCR Scratch Register */ 38 - #define OFFSET_GCTL 0x24 /* Global Control Register */ 39 - 40 25 #endif
-77
arch/blackfin/mach-bf538/include/mach/defBF539.h
··· 1534 1534 #define IWR_DISABLE(x) (0xFFFFFFFF ^ (1 << ((x)&0x1F))) /* Wakeup Disable Peripheral #x */ 1535 1535 #endif /* _MISRA_RULES */ 1536 1536 1537 - 1538 - /* ***************************** UART CONTROLLER MASKS ********************** */ 1539 - /* UARTx_LCR Register */ 1540 - #ifdef _MISRA_RULES 1541 - #define WLS(x) (((x)-5u) & 0x03u) /* Word Length Select */ 1542 - #else 1543 - #define WLS(x) (((x)-5) & 0x03) /* Word Length Select */ 1544 - #endif /* _MISRA_RULES */ 1545 - #define STB 0x04 /* Stop Bits */ 1546 - #define PEN 0x08 /* Parity Enable */ 1547 - #define EPS 0x10 /* Even Parity Select */ 1548 - #define STP 0x20 /* Stick Parity */ 1549 - #define SB 0x40 /* Set Break */ 1550 - #define DLAB 0x80 /* Divisor Latch Access */ 1551 - 1552 - #define DLAB_P 0x07 1553 - #define SB_P 0x06 1554 - #define STP_P 0x05 1555 - #define EPS_P 0x04 1556 - #define PEN_P 0x03 1557 - #define STB_P 0x02 1558 - #define WLS_P1 0x01 1559 - #define WLS_P0 0x00 1560 - 1561 - /* UARTx_MCR Register */ 1562 - #define LOOP_ENA 0x10 /* Loopback Mode Enable */ 1563 - #define LOOP_ENA_P 0x04 1564 - /* Deprecated UARTx_MCR Mask */ 1565 - 1566 - /* UARTx_LSR Register */ 1567 - #define DR 0x01 /* Data Ready */ 1568 - #define OE 0x02 /* Overrun Error */ 1569 - #define PE 0x04 /* Parity Error */ 1570 - #define FE 0x08 /* Framing Error */ 1571 - #define BI 0x10 /* Break Interrupt */ 1572 - #define THRE 0x20 /* THR Empty */ 1573 - #define TEMT 0x40 /* TSR and UART_THR Empty */ 1574 - 1575 - #define TEMP_P 0x06 1576 - #define THRE_P 0x05 1577 - #define BI_P 0x04 1578 - #define FE_P 0x03 1579 - #define PE_P 0x02 1580 - #define OE_P 0x01 1581 - #define DR_P 0x00 1582 - 1583 - /* UARTx_IER Register */ 1584 - #define ERBFI 0x01 /* Enable Receive Buffer Full Interrupt */ 1585 - #define ETBEI 0x02 /* Enable Transmit Buffer Empty Interrupt */ 1586 - #define ELSI 0x04 /* Enable RX Status Interrupt */ 1587 - 1588 - #define ELSI_P 0x02 1589 - #define ETBEI_P 0x01 1590 - #define ERBFI_P 0x00 1591 - 1592 - /* UARTx_IIR Register */ 1593 - #define NINT 0x01 1594 - #define STATUS_P1 0x02 1595 - #define STATUS_P0 0x01 1596 - #define NINT_P 0x00 1597 - 1598 - /* UARTx_GCTL Register */ 1599 - #define UCEN 0x01 /* Enable UARTx Clocks */ 1600 - #define IREN 0x02 /* Enable IrDA Mode */ 1601 - #define TPOLC 0x04 /* IrDA TX Polarity Change */ 1602 - #define RPOLC 0x08 /* IrDA RX Polarity Change */ 1603 - #define FPE 0x10 /* Force Parity Error On Transmit */ 1604 - #define FFE 0x20 /* Force Framing Error On Transmit */ 1605 - 1606 - #define FFE_P 0x05 1607 - #define FPE_P 0x04 1608 - #define RPOLC_P 0x03 1609 - #define TPOLC_P 0x02 1610 - #define IREN_P 0x01 1611 - #define UCEN_P 0x00 1612 - 1613 - 1614 1537 /* ********* PARALLEL PERIPHERAL INTERFACE (PPI) MASKS **************** */ 1615 1538 /* PPI_CONTROL Masks */ 1616 1539 #define PORT_EN 0x0001 /* PPI Port Enable */
+16
arch/blackfin/mach-bf548/include/mach/bfin_serial.h
··· 1 + /* 2 + * mach/bfin_serial.h - Blackfin UART/Serial definitions 3 + * 4 + * Copyright 2006-2010 Analog Devices Inc. 5 + * 6 + * Licensed under the GPL-2 or later. 7 + */ 8 + 9 + #ifndef __BFIN_MACH_SERIAL_H__ 10 + #define __BFIN_MACH_SERIAL_H__ 11 + 12 + #define BFIN_UART_NR_PORTS 4 13 + 14 + #define BFIN_UART_BF54X_STYLE 15 + 16 + #endif
+2 -58
arch/blackfin/mach-bf548/include/mach/bfin_serial_5xx.h
··· 4 4 * Licensed under the GPL-2 or later. 5 5 */ 6 6 7 - #include <linux/serial.h> 8 7 #include <asm/dma.h> 9 8 #include <asm/portmux.h> 10 - 11 - #define UART_GET_CHAR(uart) bfin_read16(((uart)->port.membase + OFFSET_RBR)) 12 - #define UART_GET_DLL(uart) bfin_read16(((uart)->port.membase + OFFSET_DLL)) 13 - #define UART_GET_DLH(uart) bfin_read16(((uart)->port.membase + OFFSET_DLH)) 14 - #define UART_GET_IER(uart) bfin_read16(((uart)->port.membase + OFFSET_IER_SET)) 15 - #define UART_GET_LCR(uart) bfin_read16(((uart)->port.membase + OFFSET_LCR)) 16 - #define UART_GET_LSR(uart) bfin_read16(((uart)->port.membase + OFFSET_LSR)) 17 - #define UART_GET_GCTL(uart) bfin_read16(((uart)->port.membase + OFFSET_GCTL)) 18 - #define UART_GET_MSR(uart) bfin_read16(((uart)->port.membase + OFFSET_MSR)) 19 - #define UART_GET_MCR(uart) bfin_read16(((uart)->port.membase + OFFSET_MCR)) 20 - 21 - #define UART_PUT_CHAR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_THR),v) 22 - #define UART_PUT_DLL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLL),v) 23 - #define UART_SET_IER(uart,v) bfin_write16(((uart)->port.membase + OFFSET_IER_SET),v) 24 - #define UART_CLEAR_IER(uart,v) bfin_write16(((uart)->port.membase + OFFSET_IER_CLEAR),v) 25 - #define UART_PUT_DLH(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLH),v) 26 - #define UART_PUT_LSR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_LSR),v) 27 - #define UART_PUT_LCR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_LCR),v) 28 - #define UART_CLEAR_LSR(uart) bfin_write16(((uart)->port.membase + OFFSET_LSR), -1) 29 - #define UART_PUT_GCTL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_GCTL),v) 30 - #define UART_PUT_MCR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_MCR),v) 31 - #define UART_CLEAR_SCTS(uart) bfin_write16(((uart)->port.membase + OFFSET_MSR),SCTS) 32 - 33 - #define UART_SET_DLAB(uart) /* MMRs not muxed on BF54x */ 34 - #define UART_CLEAR_DLAB(uart) /* MMRs not muxed on BF54x */ 35 - 36 - #define UART_GET_CTS(x) (UART_GET_MSR(x) & CTS) 37 - #define UART_DISABLE_RTS(x) UART_PUT_MCR(x, UART_GET_MCR(x) & ~(ARTS|MRTS)) 38 - #define UART_ENABLE_RTS(x) UART_PUT_MCR(x, UART_GET_MCR(x) | MRTS | ARTS) 39 - #define UART_ENABLE_INTS(x, v) UART_SET_IER(x, v) 40 - #define UART_DISABLE_INTS(x) UART_CLEAR_IER(x, 0xF) 41 9 42 10 #if defined(CONFIG_BFIN_UART0_CTSRTS) || defined(CONFIG_BFIN_UART1_CTSRTS) || \ 43 11 defined(CONFIG_BFIN_UART2_CTSRTS) || defined(CONFIG_BFIN_UART3_CTSRTS) 44 12 # define CONFIG_SERIAL_BFIN_HARD_CTSRTS 45 13 #endif 46 - 47 - #define BFIN_UART_TX_FIFO_SIZE 2 48 - 49 - /* 50 - * The pin configuration is different from schematic 51 - */ 52 - struct bfin_serial_port { 53 - struct uart_port port; 54 - unsigned int old_status; 55 - int status_irq; 56 - #ifdef CONFIG_SERIAL_BFIN_DMA 57 - int tx_done; 58 - int tx_count; 59 - struct circ_buf rx_dma_buf; 60 - struct timer_list rx_dma_timer; 61 - int rx_dma_nrows; 62 - unsigned int tx_dma_channel; 63 - unsigned int rx_dma_channel; 64 - struct work_struct tx_dma_workqueue; 65 - #endif 66 - #ifdef CONFIG_SERIAL_BFIN_HARD_CTSRTS 67 - int scts; 68 - int cts_pin; 69 - int rts_pin; 70 - #endif 71 - }; 72 14 73 15 struct bfin_serial_res { 74 16 unsigned long uart_base_addr; ··· 90 148 }; 91 149 92 150 #define DRIVER_NAME "bfin-uart" 151 + 152 + #include <asm/bfin_serial.h>
-15
arch/blackfin/mach-bf548/include/mach/blackfin.h
··· 49 49 50 50 #endif 51 51 52 - #define BFIN_UART_NR_PORTS 4 53 - 54 - #define OFFSET_DLL 0x00 /* Divisor Latch (Low-Byte) */ 55 - #define OFFSET_DLH 0x04 /* Divisor Latch (High-Byte) */ 56 - #define OFFSET_GCTL 0x08 /* Global Control Register */ 57 - #define OFFSET_LCR 0x0C /* Line Control Register */ 58 - #define OFFSET_MCR 0x10 /* Modem Control Register */ 59 - #define OFFSET_LSR 0x14 /* Line Status Register */ 60 - #define OFFSET_MSR 0x18 /* Modem Status Register */ 61 - #define OFFSET_SCR 0x1C /* SCR Scratch Register */ 62 - #define OFFSET_IER_SET 0x20 /* Set Interrupt Enable Register */ 63 - #define OFFSET_IER_CLEAR 0x24 /* Clear Interrupt Enable Register */ 64 - #define OFFSET_THR 0x28 /* Transmit Holding register */ 65 - #define OFFSET_RBR 0x2C /* Receive Buffer register */ 66 - 67 52 #endif
-71
arch/blackfin/mach-bf548/include/mach/defBF54x_base.h
··· 2172 2172 2173 2173 #define RCVDATA16 0xffff /* Receive FIFO 16-Bit Data */ 2174 2174 2175 - /* Bit masks for UARTx_LCR */ 2176 - 2177 - #if 0 2178 - /* conflicts with legacy one in last section */ 2179 - #define WLS 0x3 /* Word Length Select */ 2180 - #endif 2181 - #define STB 0x4 /* Stop Bits */ 2182 - #define PEN 0x8 /* Parity Enable */ 2183 - #define EPS 0x10 /* Even Parity Select */ 2184 - #define STP 0x20 /* Sticky Parity */ 2185 - #define SB 0x40 /* Set Break */ 2186 - 2187 - /* Bit masks for UARTx_MCR */ 2188 - 2189 - #define XOFF 0x1 /* Transmitter Off */ 2190 - #define MRTS 0x2 /* Manual Request To Send */ 2191 - #define RFIT 0x4 /* Receive FIFO IRQ Threshold */ 2192 - #define RFRT 0x8 /* Receive FIFO RTS Threshold */ 2193 - #define LOOP_ENA 0x10 /* Loopback Mode Enable */ 2194 - #define FCPOL 0x20 /* Flow Control Pin Polarity */ 2195 - #define ARTS 0x40 /* Automatic Request To Send */ 2196 - #define ACTS 0x80 /* Automatic Clear To Send */ 2197 - 2198 - /* Bit masks for UARTx_LSR */ 2199 - 2200 - #define DR 0x1 /* Data Ready */ 2201 - #define OE 0x2 /* Overrun Error */ 2202 - #define PE 0x4 /* Parity Error */ 2203 - #define FE 0x8 /* Framing Error */ 2204 - #define BI 0x10 /* Break Interrupt */ 2205 - #define THRE 0x20 /* THR Empty */ 2206 - #define TEMT 0x40 /* Transmitter Empty */ 2207 - #define TFI 0x80 /* Transmission Finished Indicator */ 2208 - 2209 - /* Bit masks for UARTx_MSR */ 2210 - 2211 - #define SCTS 0x1 /* Sticky CTS */ 2212 - #define CTS 0x10 /* Clear To Send */ 2213 - #define RFCS 0x20 /* Receive FIFO Count Status */ 2214 - 2215 - /* Bit masks for UARTx_IER_SET & UARTx_IER_CLEAR */ 2216 - 2217 - #define ERBFI 0x1 /* Enable Receive Buffer Full Interrupt */ 2218 - #define ETBEI 0x2 /* Enable Transmit Buffer Empty Interrupt */ 2219 - #define ELSI 0x4 /* Enable Receive Status Interrupt */ 2220 - #define EDSSI 0x8 /* Enable Modem Status Interrupt */ 2221 - #define EDTPTI 0x10 /* Enable DMA Transmit PIRQ Interrupt */ 2222 - #define ETFI 0x20 /* Enable Transmission Finished Interrupt */ 2223 - #define ERFCI 0x40 /* Enable Receive FIFO Count Interrupt */ 2224 - 2225 - /* Bit masks for UARTx_GCTL */ 2226 - 2227 - #define UCEN 0x1 /* UART Enable */ 2228 - #define IREN 0x2 /* IrDA Mode Enable */ 2229 - #define TPOLC 0x4 /* IrDA TX Polarity Change */ 2230 - #define RPOLC 0x8 /* IrDA RX Polarity Change */ 2231 - #define FPE 0x10 /* Force Parity Error */ 2232 - #define FFE 0x20 /* Force Framing Error */ 2233 - #define EDBO 0x40 /* Enable Divide-by-One */ 2234 - #define EGLSI 0x80 /* Enable Global LS Interrupt */ 2235 - 2236 - 2237 2175 /* ******************************************* */ 2238 2176 /* MULTI BIT MACRO ENUMERATIONS */ 2239 2177 /* ******************************************* */ ··· 2188 2250 #define PWM_OUT 0x0001 2189 2251 #define WDTH_CAP 0x0002 2190 2252 #define EXT_CLK 0x0003 2191 - 2192 - /* UARTx_LCR bit field options */ 2193 - 2194 - #define WLS_5 0x0000 /* 5 data bits */ 2195 - #define WLS_6 0x0001 /* 6 data bits */ 2196 - #define WLS_7 0x0002 /* 7 data bits */ 2197 - #define WLS_8 0x0003 /* 8 data bits */ 2198 2253 2199 2254 /* PINTx Register Bit Definitions */ 2200 2255 ··· 2637 2706 2638 2707 /* for legacy compatibility */ 2639 2708 2640 - #define WLS(x) (((x)-5) & 0x03) /* Word Length Select */ 2641 - #define W1LMAX_MAX W1LMAX_MIN 2642 2709 #define EBIU_AMCBCTL0 EBIU_AMBCTL0 2643 2710 #define EBIU_AMCBCTL1 EBIU_AMBCTL1 2644 2711 #define PINT0_IRQ PINT0_REQUEST
+14
arch/blackfin/mach-bf561/include/mach/bfin_serial.h
··· 1 + /* 2 + * mach/bfin_serial.h - Blackfin UART/Serial definitions 3 + * 4 + * Copyright 2006-2010 Analog Devices Inc. 5 + * 6 + * Licensed under the GPL-2 or later. 7 + */ 8 + 9 + #ifndef __BFIN_MACH_SERIAL_H__ 10 + #define __BFIN_MACH_SERIAL_H__ 11 + 12 + #define BFIN_UART_NR_PORTS 1 13 + 14 + #endif
+2 -72
arch/blackfin/mach-bf561/include/mach/bfin_serial_5xx.h
··· 4 4 * Licensed under the GPL-2 or later. 5 5 */ 6 6 7 - #include <linux/serial.h> 8 7 #include <asm/dma.h> 9 8 #include <asm/portmux.h> 10 - 11 - #define UART_GET_CHAR(uart) bfin_read16(((uart)->port.membase + OFFSET_RBR)) 12 - #define UART_GET_DLL(uart) bfin_read16(((uart)->port.membase + OFFSET_DLL)) 13 - #define UART_GET_IER(uart) bfin_read16(((uart)->port.membase + OFFSET_IER)) 14 - #define UART_GET_DLH(uart) bfin_read16(((uart)->port.membase + OFFSET_DLH)) 15 - #define UART_GET_IIR(uart) bfin_read16(((uart)->port.membase + OFFSET_IIR)) 16 - #define UART_GET_LCR(uart) bfin_read16(((uart)->port.membase + OFFSET_LCR)) 17 - #define UART_GET_GCTL(uart) bfin_read16(((uart)->port.membase + OFFSET_GCTL)) 18 - 19 - #define UART_PUT_CHAR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_THR),v) 20 - #define UART_PUT_DLL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLL),v) 21 - #define UART_PUT_IER(uart,v) bfin_write16(((uart)->port.membase + OFFSET_IER),v) 22 - #define UART_SET_IER(uart,v) UART_PUT_IER(uart, UART_GET_IER(uart) | (v)) 23 - #define UART_CLEAR_IER(uart,v) UART_PUT_IER(uart, UART_GET_IER(uart) & ~(v)) 24 - #define UART_PUT_DLH(uart,v) bfin_write16(((uart)->port.membase + OFFSET_DLH),v) 25 - #define UART_PUT_LCR(uart,v) bfin_write16(((uart)->port.membase + OFFSET_LCR),v) 26 - #define UART_PUT_GCTL(uart,v) bfin_write16(((uart)->port.membase + OFFSET_GCTL),v) 27 - 28 - #define UART_SET_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) | DLAB); SSYNC(); } while (0) 29 - #define UART_CLEAR_DLAB(uart) do { UART_PUT_LCR(uart, UART_GET_LCR(uart) & ~DLAB); SSYNC(); } while (0) 30 - 31 - #define UART_GET_CTS(x) gpio_get_value(x->cts_pin) 32 - #define UART_DISABLE_RTS(x) gpio_set_value(x->rts_pin, 1) 33 - #define UART_ENABLE_RTS(x) gpio_set_value(x->rts_pin, 0) 34 - #define UART_ENABLE_INTS(x, v) UART_PUT_IER(x, v) 35 - #define UART_DISABLE_INTS(x) UART_PUT_IER(x, 0) 36 9 37 10 #ifdef CONFIG_BFIN_UART0_CTSRTS 38 11 # define CONFIG_SERIAL_BFIN_CTSRTS ··· 16 43 # define CONFIG_UART0_RTS_PIN -1 17 44 # endif 18 45 #endif 19 - 20 - #define BFIN_UART_TX_FIFO_SIZE 2 21 - 22 - struct bfin_serial_port { 23 - struct uart_port port; 24 - unsigned int old_status; 25 - int status_irq; 26 - unsigned int lsr; 27 - #ifdef CONFIG_SERIAL_BFIN_DMA 28 - int tx_done; 29 - int tx_count; 30 - struct circ_buf rx_dma_buf; 31 - struct timer_list rx_dma_timer; 32 - int rx_dma_nrows; 33 - unsigned int tx_dma_channel; 34 - unsigned int rx_dma_channel; 35 - struct work_struct tx_dma_workqueue; 36 - #else 37 - # if ANOMALY_05000363 38 - unsigned int anomaly_threshold; 39 - # endif 40 - #endif 41 - #ifdef CONFIG_SERIAL_BFIN_CTSRTS 42 - struct timer_list cts_timer; 43 - int cts_pin; 44 - int rts_pin; 45 - #endif 46 - }; 47 - 48 - /* The hardware clears the LSR bits upon read, so we need to cache 49 - * some of the more fun bits in software so they don't get lost 50 - * when checking the LSR in other code paths (TX). 51 - */ 52 - static inline unsigned int UART_GET_LSR(struct bfin_serial_port *uart) 53 - { 54 - unsigned int lsr = bfin_read16(uart->port.membase + OFFSET_LSR); 55 - uart->lsr |= (lsr & (BI|FE|PE|OE)); 56 - return lsr | uart->lsr; 57 - } 58 - 59 - static inline void UART_CLEAR_LSR(struct bfin_serial_port *uart) 60 - { 61 - uart->lsr = 0; 62 - bfin_write16(uart->port.membase + OFFSET_LSR, -1); 63 - } 64 46 65 47 struct bfin_serial_res { 66 48 unsigned long uart_base_addr; ··· 48 120 }; 49 121 50 122 #define DRIVER_NAME "bfin-uart" 123 + 124 + #include <asm/bfin_serial.h>
-15
arch/blackfin/mach-bf561/include/mach/blackfin.h
··· 35 35 #define bfin_read_SICB_ISR(x) bfin_read32(__SIC_MUX(SICB_ISR0, x)) 36 36 #define bfin_write_SICB_ISR(x, val) bfin_write32(__SIC_MUX(SICB_ISR0, x), val) 37 37 38 - #define BFIN_UART_NR_PORTS 1 39 - 40 - #define OFFSET_THR 0x00 /* Transmit Holding register */ 41 - #define OFFSET_RBR 0x00 /* Receive Buffer register */ 42 - #define OFFSET_DLL 0x00 /* Divisor Latch (Low-Byte) */ 43 - #define OFFSET_IER 0x04 /* Interrupt Enable Register */ 44 - #define OFFSET_DLH 0x04 /* Divisor Latch (High-Byte) */ 45 - #define OFFSET_IIR 0x08 /* Interrupt Identification Register */ 46 - #define OFFSET_LCR 0x0C /* Line Control Register */ 47 - #define OFFSET_MCR 0x10 /* Modem Control Register */ 48 - #define OFFSET_LSR 0x14 /* Line Status Register */ 49 - #define OFFSET_MSR 0x18 /* Modem Status Register */ 50 - #define OFFSET_SCR 0x1C /* SCR Scratch Register */ 51 - #define OFFSET_GCTL 0x24 /* Global Control Register */ 52 - 53 38 #endif /* _MACH_BLACKFIN_H_ */
-77
arch/blackfin/mach-bf561/include/mach/defBF561.h
··· 927 927 #define IWR_ENABLE(x) (1 << (x)) /* Wakeup Enable Peripheral #x */ 928 928 #define IWR_DISABLE(x) (0xFFFFFFFF ^ (1 << (x))) /* Wakeup Disable Peripheral #x */ 929 929 930 - /* ***************************** UART CONTROLLER MASKS ********************** */ 931 - 932 - /* UART_LCR Register */ 933 - 934 - #define DLAB 0x80 935 - #define SB 0x40 936 - #define STP 0x20 937 - #define EPS 0x10 938 - #define PEN 0x08 939 - #define STB 0x04 940 - #define WLS(x) ((x-5) & 0x03) 941 - 942 - #define DLAB_P 0x07 943 - #define SB_P 0x06 944 - #define STP_P 0x05 945 - #define EPS_P 0x04 946 - #define PEN_P 0x03 947 - #define STB_P 0x02 948 - #define WLS_P1 0x01 949 - #define WLS_P0 0x00 950 - 951 - /* UART_MCR Register */ 952 - #define LOOP_ENA 0x10 953 - #define LOOP_ENA_P 0x04 954 - 955 - /* UART_LSR Register */ 956 - #define TEMT 0x40 957 - #define THRE 0x20 958 - #define BI 0x10 959 - #define FE 0x08 960 - #define PE 0x04 961 - #define OE 0x02 962 - #define DR 0x01 963 - 964 - #define TEMP_P 0x06 965 - #define THRE_P 0x05 966 - #define BI_P 0x04 967 - #define FE_P 0x03 968 - #define PE_P 0x02 969 - #define OE_P 0x01 970 - #define DR_P 0x00 971 - 972 - /* UART_IER Register */ 973 - #define ELSI 0x04 974 - #define ETBEI 0x02 975 - #define ERBFI 0x01 976 - 977 - #define ELSI_P 0x02 978 - #define ETBEI_P 0x01 979 - #define ERBFI_P 0x00 980 - 981 - /* UART_IIR Register */ 982 - #define STATUS(x) ((x << 1) & 0x06) 983 - #define NINT 0x01 984 - #define STATUS_P1 0x02 985 - #define STATUS_P0 0x01 986 - #define NINT_P 0x00 987 - #define IIR_TX_READY 0x02 /* UART_THR empty */ 988 - #define IIR_RX_READY 0x04 /* Receive data ready */ 989 - #define IIR_LINE_CHANGE 0x06 /* Receive line status */ 990 - #define IIR_STATUS 0x06 991 - 992 - /* UART_GCTL Register */ 993 - #define FFE 0x20 994 - #define FPE 0x10 995 - #define RPOLC 0x08 996 - #define TPOLC 0x04 997 - #define IREN 0x02 998 - #define UCEN 0x01 999 - 1000 - #define FFE_P 0x05 1001 - #define FPE_P 0x04 1002 - #define RPOLC_P 0x03 1003 - #define TPOLC_P 0x02 1004 - #define IREN_P 0x01 1005 - #define UCEN_P 0x00 1006 - 1007 930 /* ********* PARALLEL PERIPHERAL INTERFACE (PPI) MASKS **************** */ 1008 931 1009 932 /* PPI_CONTROL Masks */