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

net/irda: convert bfin_sir to common Blackfin UART header

No need to duplicate these defines now that the common Blackfin code has
unified these for all UART devices.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Cc: Samuel Ortiz <samuel@sortiz.org>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Mike Frysinger and committed by
David S. Miller
229de618 6ac3f664

+33 -89
+29 -30
drivers/net/irda/bfin_sir.c
··· 67 67 disable_dma(port->tx_dma_channel); 68 68 #endif 69 69 70 - while (!(SIR_UART_GET_LSR(port) & THRE)) { 70 + while (!(UART_GET_LSR(port) & THRE)) { 71 71 cpu_relax(); 72 72 continue; 73 73 } 74 74 75 - SIR_UART_STOP_TX(port); 75 + UART_CLEAR_IER(port, ETBEI); 76 76 } 77 77 78 78 static void bfin_sir_enable_tx(struct bfin_sir_port *port) 79 79 { 80 - SIR_UART_ENABLE_TX(port); 80 + UART_SET_IER(port, ETBEI); 81 81 } 82 82 83 83 static void bfin_sir_stop_rx(struct bfin_sir_port *port) 84 84 { 85 - SIR_UART_STOP_RX(port); 85 + UART_CLEAR_IER(port, ERBFI); 86 86 } 87 87 88 88 static void bfin_sir_enable_rx(struct bfin_sir_port *port) 89 89 { 90 - SIR_UART_ENABLE_RX(port); 90 + UART_SET_IER(port, ERBFI); 91 91 } 92 92 93 93 static int bfin_sir_set_speed(struct bfin_sir_port *port, int speed) ··· 116 116 117 117 do { 118 118 udelay(utime); 119 - lsr = SIR_UART_GET_LSR(port); 119 + lsr = UART_GET_LSR(port); 120 120 } while (!(lsr & TEMT) && count--); 121 121 122 122 /* The useconds for 1 bits to transmit */ ··· 125 125 /* Clear UCEN bit to reset the UART state machine 126 126 * and control registers 127 127 */ 128 - val = SIR_UART_GET_GCTL(port); 128 + val = UART_GET_GCTL(port); 129 129 val &= ~UCEN; 130 - SIR_UART_PUT_GCTL(port, val); 130 + UART_PUT_GCTL(port, val); 131 131 132 132 /* Set DLAB in LCR to Access THR RBR IER */ 133 - SIR_UART_SET_DLAB(port); 133 + UART_SET_DLAB(port); 134 134 SSYNC(); 135 135 136 - SIR_UART_PUT_DLL(port, quot & 0xFF); 137 - SIR_UART_PUT_DLH(port, (quot >> 8) & 0xFF); 136 + UART_PUT_DLL(port, quot & 0xFF); 137 + UART_PUT_DLH(port, (quot >> 8) & 0xFF); 138 138 SSYNC(); 139 139 140 140 /* Clear DLAB in LCR */ 141 - SIR_UART_CLEAR_DLAB(port); 141 + UART_CLEAR_DLAB(port); 142 142 SSYNC(); 143 143 144 - SIR_UART_PUT_LCR(port, lcr); 144 + UART_PUT_LCR(port, lcr); 145 145 146 - val = SIR_UART_GET_GCTL(port); 146 + val = UART_GET_GCTL(port); 147 147 val |= UCEN; 148 - SIR_UART_PUT_GCTL(port, val); 148 + UART_PUT_GCTL(port, val); 149 149 150 150 ret = 0; 151 151 break; ··· 154 154 break; 155 155 } 156 156 157 - val = SIR_UART_GET_GCTL(port); 157 + val = UART_GET_GCTL(port); 158 158 /* If not add the 'RPOLC', we can't catch the receive interrupt. 159 159 * It's related with the HW layout and the IR transiver. 160 160 */ 161 161 val |= IREN | RPOLC; 162 - SIR_UART_PUT_GCTL(port, val); 162 + UART_PUT_GCTL(port, val); 163 163 return ret; 164 164 } 165 165 ··· 168 168 struct bfin_sir_self *self = netdev_priv(dev); 169 169 struct bfin_sir_port *port = self->sir_port; 170 170 171 - if (!(SIR_UART_GET_IER(port) & ERBFI)) 171 + if (!(UART_GET_IER(port) & ERBFI)) 172 172 return 0; 173 173 return self->rx_buff.state != OUTSIDE_FRAME; 174 174 } ··· 182 182 183 183 if (self->tx_buff.len != 0) { 184 184 chr = *(self->tx_buff.data); 185 - SIR_UART_PUT_CHAR(port, chr); 185 + UART_PUT_CHAR(port, chr); 186 186 self->tx_buff.data++; 187 187 self->tx_buff.len--; 188 188 } else { ··· 206 206 struct bfin_sir_port *port = self->sir_port; 207 207 unsigned char ch; 208 208 209 - SIR_UART_CLEAR_LSR(port); 210 - ch = SIR_UART_GET_CHAR(port); 209 + UART_CLEAR_LSR(port); 210 + ch = UART_GET_CHAR(port); 211 211 async_unwrap_char(dev, &self->stats, &self->rx_buff, ch); 212 212 dev->last_rx = jiffies; 213 213 } ··· 219 219 struct bfin_sir_port *port = self->sir_port; 220 220 221 221 spin_lock(&self->lock); 222 - while ((SIR_UART_GET_LSR(port) & DR)) 222 + while ((UART_GET_LSR(port) & DR)) 223 223 bfin_sir_rx_chars(dev); 224 224 spin_unlock(&self->lock); 225 225 ··· 233 233 struct bfin_sir_port *port = self->sir_port; 234 234 235 235 spin_lock(&self->lock); 236 - if (SIR_UART_GET_LSR(port) & THRE) 236 + if (UART_GET_LSR(port) & THRE) 237 237 bfin_sir_tx_chars(dev); 238 238 spin_unlock(&self->lock); 239 239 ··· 312 312 struct bfin_sir_port *port = self->sir_port; 313 313 int i; 314 314 315 - SIR_UART_CLEAR_LSR(port); 315 + UART_CLEAR_LSR(port); 316 316 317 317 for (i = port->rx_dma_buf.head; i < port->rx_dma_buf.tail; i++) 318 318 async_unwrap_char(dev, &self->stats, &self->rx_buff, port->rx_dma_buf.buf[i]); ··· 430 430 unsigned short val; 431 431 432 432 bfin_sir_stop_rx(port); 433 - SIR_UART_DISABLE_INTS(port); 434 433 435 - val = SIR_UART_GET_GCTL(port); 434 + val = UART_GET_GCTL(port); 436 435 val &= ~(UCEN | IREN | RPOLC); 437 - SIR_UART_PUT_GCTL(port, val); 436 + UART_PUT_GCTL(port, val); 438 437 439 438 #ifdef CONFIG_SIR_BFIN_DMA 440 439 disable_dma(port->tx_dma_channel); ··· 517 518 * sending data. We also can set the speed, which will 518 519 * reset all the UART. 519 520 */ 520 - val = SIR_UART_GET_GCTL(port); 521 + val = UART_GET_GCTL(port); 521 522 val &= ~(IREN | RPOLC); 522 - SIR_UART_PUT_GCTL(port, val); 523 + UART_PUT_GCTL(port, val); 523 524 SSYNC(); 524 525 val |= IREN | RPOLC; 525 - SIR_UART_PUT_GCTL(port, val); 526 + UART_PUT_GCTL(port, val); 526 527 SSYNC(); 527 528 /* bfin_sir_set_speed(port, self->speed); */ 528 529
+4 -59
drivers/net/irda/bfin_sir.h
··· 26 26 #include <asm/cacheflush.h> 27 27 #include <asm/dma.h> 28 28 #include <asm/portmux.h> 29 - #include <mach/bfin_serial_5xx.h> 30 29 #undef DRIVER_NAME 31 30 32 31 #ifdef CONFIG_SIR_BFIN_DMA ··· 82 83 83 84 #define DRIVER_NAME "bfin_sir" 84 85 85 - #define SIR_UART_GET_CHAR(port) bfin_read16((port)->membase + OFFSET_RBR) 86 - #define SIR_UART_GET_DLL(port) bfin_read16((port)->membase + OFFSET_DLL) 87 - #define SIR_UART_GET_DLH(port) bfin_read16((port)->membase + OFFSET_DLH) 88 - #define SIR_UART_GET_LCR(port) bfin_read16((port)->membase + OFFSET_LCR) 89 - #define SIR_UART_GET_GCTL(port) bfin_read16((port)->membase + OFFSET_GCTL) 90 - 91 - #define SIR_UART_PUT_CHAR(port, v) bfin_write16(((port)->membase + OFFSET_THR), v) 92 - #define SIR_UART_PUT_DLL(port, v) bfin_write16(((port)->membase + OFFSET_DLL), v) 93 - #define SIR_UART_PUT_DLH(port, v) bfin_write16(((port)->membase + OFFSET_DLH), v) 94 - #define SIR_UART_PUT_LCR(port, v) bfin_write16(((port)->membase + OFFSET_LCR), v) 95 - #define SIR_UART_PUT_GCTL(port, v) bfin_write16(((port)->membase + OFFSET_GCTL), v) 96 - 97 - #ifdef CONFIG_BF54x 98 - #define SIR_UART_GET_LSR(port) bfin_read16((port)->membase + OFFSET_LSR) 99 - #define SIR_UART_GET_IER(port) bfin_read16((port)->membase + OFFSET_IER_SET) 100 - #define SIR_UART_SET_IER(port, v) bfin_write16(((port)->membase + OFFSET_IER_SET), v) 101 - #define SIR_UART_CLEAR_IER(port, v) bfin_write16(((port)->membase + OFFSET_IER_CLEAR), v) 102 - #define SIR_UART_PUT_LSR(port, v) bfin_write16(((port)->membase + OFFSET_LSR), v) 103 - #define SIR_UART_CLEAR_LSR(port) bfin_write16(((port)->membase + OFFSET_LSR), -1) 104 - 105 - #define SIR_UART_SET_DLAB(port) 106 - #define SIR_UART_CLEAR_DLAB(port) 107 - 108 - #define SIR_UART_ENABLE_INTS(port, v) SIR_UART_SET_IER(port, v) 109 - #define SIR_UART_DISABLE_INTS(port) SIR_UART_CLEAR_IER(port, 0xF) 110 - #define SIR_UART_STOP_TX(port) do { SIR_UART_PUT_LSR(port, TFI); SIR_UART_CLEAR_IER(port, ETBEI); } while (0) 111 - #define SIR_UART_ENABLE_TX(port) do { SIR_UART_SET_IER(port, ETBEI); } while (0) 112 - #define SIR_UART_STOP_RX(port) do { SIR_UART_CLEAR_IER(port, ERBFI); } while (0) 113 - #define SIR_UART_ENABLE_RX(port) do { SIR_UART_SET_IER(port, ERBFI); } while (0) 114 - #else 115 - 116 - #define SIR_UART_GET_IIR(port) bfin_read16((port)->membase + OFFSET_IIR) 117 - #define SIR_UART_GET_IER(port) bfin_read16((port)->membase + OFFSET_IER) 118 - #define SIR_UART_PUT_IER(port, v) bfin_write16(((port)->membase + OFFSET_IER), v) 119 - 120 - #define SIR_UART_SET_DLAB(port) do { SIR_UART_PUT_LCR(port, SIR_UART_GET_LCR(port) | DLAB); } while (0) 121 - #define SIR_UART_CLEAR_DLAB(port) do { SIR_UART_PUT_LCR(port, SIR_UART_GET_LCR(port) & ~DLAB); } while (0) 122 - 123 - #define SIR_UART_ENABLE_INTS(port, v) SIR_UART_PUT_IER(port, v) 124 - #define SIR_UART_DISABLE_INTS(port) SIR_UART_PUT_IER(port, 0) 125 - #define SIR_UART_STOP_TX(port) do { SIR_UART_PUT_IER(port, SIR_UART_GET_IER(port) & ~ETBEI); } while (0) 126 - #define SIR_UART_ENABLE_TX(port) do { SIR_UART_PUT_IER(port, SIR_UART_GET_IER(port) | ETBEI); } while (0) 127 - #define SIR_UART_STOP_RX(port) do { SIR_UART_PUT_IER(port, SIR_UART_GET_IER(port) & ~ERBFI); } while (0) 128 - #define SIR_UART_ENABLE_RX(port) do { SIR_UART_PUT_IER(port, SIR_UART_GET_IER(port) | ERBFI); } while (0) 129 - 130 - static inline unsigned int SIR_UART_GET_LSR(struct bfin_sir_port *port) 131 - { 132 - unsigned int lsr = bfin_read16(port->membase + OFFSET_LSR); 133 - port->lsr |= (lsr & (BI|FE|PE|OE)); 134 - return lsr | port->lsr; 135 - } 136 - 137 - static inline void SIR_UART_CLEAR_LSR(struct bfin_sir_port *port) 138 - { 139 - port->lsr = 0; 140 - bfin_read16(port->membase + OFFSET_LSR); 141 - } 142 - #endif 86 + #define port_membase(port) (((struct bfin_sir_port *)(port))->membase) 87 + #define get_lsr_cache(port) (((struct bfin_sir_port *)(port))->lsr) 88 + #define put_lsr_cache(port, v) (((struct bfin_sir_port *)(port))->lsr = (v)) 89 + #include <asm/bfin_serial.h> 143 90 144 91 static const unsigned short per[][4] = { 145 92 /* rx pin tx pin NULL uart_number */