mcf.c (2fc0184dae7be565e4ad47c720e6014cd5543a21) | mcf.c (bd737f8738b7e15930aa7b47c94c28a8d83148ac) |
---|---|
1/****************************************************************************/ 2 3/* 4 * mcf.c -- Freescale ColdFire UART driver 5 * 6 * (C) Copyright 2003-2007, Greg Ungerer <gerg@snapgear.com> 7 * 8 * This program is free software; you can redistribute it and/or modify --- 243 unchanged lines hidden (view full) --- 252 else 253 mr2 |= MCFUART_MR2_STOP1; 254 255 if (termios->c_cflag & CRTSCTS) { 256 mr1 |= MCFUART_MR1_RXRTS; 257 mr2 |= MCFUART_MR2_TXCTS; 258 } 259 | 1/****************************************************************************/ 2 3/* 4 * mcf.c -- Freescale ColdFire UART driver 5 * 6 * (C) Copyright 2003-2007, Greg Ungerer <gerg@snapgear.com> 7 * 8 * This program is free software; you can redistribute it and/or modify --- 243 unchanged lines hidden (view full) --- 252 else 253 mr2 |= MCFUART_MR2_STOP1; 254 255 if (termios->c_cflag & CRTSCTS) { 256 mr1 |= MCFUART_MR1_RXRTS; 257 mr2 |= MCFUART_MR2_TXCTS; 258 } 259 |
260 spin_lock_irqsave(&port->lock, flags); |
|
260 if (port->rs485.flags & SER_RS485_ENABLED) { 261 dev_dbg(port->dev, "Setting UART to RS485\n"); 262 mr2 |= MCFUART_MR2_TXRTS; 263 } 264 | 261 if (port->rs485.flags & SER_RS485_ENABLED) { 262 dev_dbg(port->dev, "Setting UART to RS485\n"); 263 mr2 |= MCFUART_MR2_TXRTS; 264 } 265 |
265 spin_lock_irqsave(&port->lock, flags); | |
266 uart_update_timeout(port, termios->c_cflag, baud); 267 writeb(MCFUART_UCR_CMDRESETRX, port->membase + MCFUART_UCR); 268 writeb(MCFUART_UCR_CMDRESETTX, port->membase + MCFUART_UCR); 269 writeb(MCFUART_UCR_CMDRESETMRPTR, port->membase + MCFUART_UCR); 270 writeb(mr1, port->membase + MCFUART_UMR); 271 writeb(mr2, port->membase + MCFUART_UMR); 272 writeb((baudclk & 0xff00) >> 8, port->membase + MCFUART_UBG1); 273 writeb((baudclk & 0xff), port->membase + MCFUART_UBG2); --- 163 unchanged lines hidden (view full) --- 437} 438 439/****************************************************************************/ 440 441/* Enable or disable the RS485 support */ 442static int mcf_config_rs485(struct uart_port *port, struct serial_rs485 *rs485) 443{ 444 struct mcf_uart *pp = container_of(port, struct mcf_uart, port); | 266 uart_update_timeout(port, termios->c_cflag, baud); 267 writeb(MCFUART_UCR_CMDRESETRX, port->membase + MCFUART_UCR); 268 writeb(MCFUART_UCR_CMDRESETTX, port->membase + MCFUART_UCR); 269 writeb(MCFUART_UCR_CMDRESETMRPTR, port->membase + MCFUART_UCR); 270 writeb(mr1, port->membase + MCFUART_UMR); 271 writeb(mr2, port->membase + MCFUART_UMR); 272 writeb((baudclk & 0xff00) >> 8, port->membase + MCFUART_UBG1); 273 writeb((baudclk & 0xff), port->membase + MCFUART_UBG2); --- 163 unchanged lines hidden (view full) --- 437} 438 439/****************************************************************************/ 440 441/* Enable or disable the RS485 support */ 442static int mcf_config_rs485(struct uart_port *port, struct serial_rs485 *rs485) 443{ 444 struct mcf_uart *pp = container_of(port, struct mcf_uart, port); |
445 unsigned long flags; | |
446 unsigned char mr1, mr2; 447 | 445 unsigned char mr1, mr2; 446 |
448 spin_lock_irqsave(&port->lock, flags); | |
449 /* Get mode registers */ 450 mr1 = readb(port->membase + MCFUART_UMR); 451 mr2 = readb(port->membase + MCFUART_UMR); 452 if (rs485->flags & SER_RS485_ENABLED) { 453 dev_dbg(port->dev, "Setting UART to RS485\n"); 454 /* Automatically negate RTS after TX completes */ 455 mr2 |= MCFUART_MR2_TXRTS; 456 } else { 457 dev_dbg(port->dev, "Setting UART to RS232\n"); 458 mr2 &= ~MCFUART_MR2_TXRTS; 459 } 460 writeb(mr1, port->membase + MCFUART_UMR); 461 writeb(mr2, port->membase + MCFUART_UMR); 462 port->rs485 = *rs485; | 447 /* Get mode registers */ 448 mr1 = readb(port->membase + MCFUART_UMR); 449 mr2 = readb(port->membase + MCFUART_UMR); 450 if (rs485->flags & SER_RS485_ENABLED) { 451 dev_dbg(port->dev, "Setting UART to RS485\n"); 452 /* Automatically negate RTS after TX completes */ 453 mr2 |= MCFUART_MR2_TXRTS; 454 } else { 455 dev_dbg(port->dev, "Setting UART to RS232\n"); 456 mr2 &= ~MCFUART_MR2_TXRTS; 457 } 458 writeb(mr1, port->membase + MCFUART_UMR); 459 writeb(mr2, port->membase + MCFUART_UMR); 460 port->rs485 = *rs485; |
463 spin_unlock_irqrestore(&port->lock, flags); | |
464 465 return 0; 466} 467 468/****************************************************************************/ 469 470/* 471 * Define the basic serial functions we support. --- 243 unchanged lines hidden --- | 461 462 return 0; 463} 464 465/****************************************************************************/ 466 467/* 468 * Define the basic serial functions we support. --- 243 unchanged lines hidden --- |