serial: mxs-auart: clean get_mctrl and set_mctrl
Russell King: The only thing which the .get_mctrl method is supposed to do is to return the state of the /input/ lines, which are CTS, DCD, DSR, RI. The output line state is stored in port->mctrl, and is added to the returned value by serial_core when it's required. RTS output state should not be returned from the .get_mctrl method. This patch removes ctrl variable from mxs_auart_port and removes useless reading back RTS line. The ctrl variable in mxs_auart_port duplicated mctrl, member of uart_port structure in serial_core.h. The removed code from mxs_auart_set_mctrl() and mxs_auart_get_mctrl duplicated uart_update_mctrl() and uart_tiocmget() in serial_core.c. Signed-off-by: Janusz Uzycki <j.uzycki@elproma.com.pl> Reviewed-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
66f37aafd6
commit
42b4eba061
@@ -143,7 +143,6 @@ struct mxs_auart_port {
|
|||||||
#define MXS_AUART_DMA_RX_READY 3 /* bit 3 */
|
#define MXS_AUART_DMA_RX_READY 3 /* bit 3 */
|
||||||
#define MXS_AUART_RTSCTS 4 /* bit 4 */
|
#define MXS_AUART_RTSCTS 4 /* bit 4 */
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
unsigned int ctrl;
|
|
||||||
enum mxs_auart_type devtype;
|
enum mxs_auart_type devtype;
|
||||||
|
|
||||||
unsigned int irq;
|
unsigned int irq;
|
||||||
@@ -406,8 +405,6 @@ static void mxs_auart_release_port(struct uart_port *u)
|
|||||||
|
|
||||||
static void mxs_auart_set_mctrl(struct uart_port *u, unsigned mctrl)
|
static void mxs_auart_set_mctrl(struct uart_port *u, unsigned mctrl)
|
||||||
{
|
{
|
||||||
struct mxs_auart_port *s = to_auart_port(u);
|
|
||||||
|
|
||||||
u32 ctrl = readl(u->membase + AUART_CTRL2);
|
u32 ctrl = readl(u->membase + AUART_CTRL2);
|
||||||
|
|
||||||
ctrl &= ~(AUART_CTRL2_RTSEN | AUART_CTRL2_RTS);
|
ctrl &= ~(AUART_CTRL2_RTSEN | AUART_CTRL2_RTS);
|
||||||
@@ -418,24 +415,17 @@ static void mxs_auart_set_mctrl(struct uart_port *u, unsigned mctrl)
|
|||||||
ctrl |= AUART_CTRL2_RTS;
|
ctrl |= AUART_CTRL2_RTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
s->ctrl = mctrl;
|
|
||||||
writel(ctrl, u->membase + AUART_CTRL2);
|
writel(ctrl, u->membase + AUART_CTRL2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 mxs_auart_get_mctrl(struct uart_port *u)
|
static u32 mxs_auart_get_mctrl(struct uart_port *u)
|
||||||
{
|
{
|
||||||
struct mxs_auart_port *s = to_auart_port(u);
|
|
||||||
u32 stat = readl(u->membase + AUART_STAT);
|
u32 stat = readl(u->membase + AUART_STAT);
|
||||||
int ctrl2 = readl(u->membase + AUART_CTRL2);
|
u32 mctrl = 0;
|
||||||
u32 mctrl = s->ctrl;
|
|
||||||
|
|
||||||
mctrl &= ~TIOCM_CTS;
|
|
||||||
if (stat & AUART_STAT_CTS)
|
if (stat & AUART_STAT_CTS)
|
||||||
mctrl |= TIOCM_CTS;
|
mctrl |= TIOCM_CTS;
|
||||||
|
|
||||||
if (ctrl2 & AUART_CTRL2_RTS)
|
|
||||||
mctrl |= TIOCM_RTS;
|
|
||||||
|
|
||||||
return mctrl;
|
return mctrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1071,8 +1061,6 @@ static int mxs_auart_probe(struct platform_device *pdev)
|
|||||||
s->port.type = PORT_IMX;
|
s->port.type = PORT_IMX;
|
||||||
s->port.dev = s->dev = &pdev->dev;
|
s->port.dev = s->dev = &pdev->dev;
|
||||||
|
|
||||||
s->ctrl = 0;
|
|
||||||
|
|
||||||
s->irq = platform_get_irq(pdev, 0);
|
s->irq = platform_get_irq(pdev, 0);
|
||||||
s->port.irq = s->irq;
|
s->port.irq = s->irq;
|
||||||
ret = request_irq(s->irq, mxs_auart_irq_handle, 0, dev_name(&pdev->dev), s);
|
ret = request_irq(s->irq, mxs_auart_irq_handle, 0, dev_name(&pdev->dev), s);
|
||||||
|
Reference in New Issue
Block a user