Example #1
0
static void serial_omap_start_tx(struct uart_port *port)
{
	struct uart_omap_port *up = to_uart_omap_port(port);
	int res;

	pm_runtime_get_sync(up->dev);

	/* Handle RS-485 */
	if (port->rs485.flags & SER_RS485_ENABLED) {
		/* Fire THR interrupts when FIFO is below trigger level */
		up->scr &= ~OMAP_UART_SCR_TX_EMPTY;
		serial_out(up, UART_OMAP_SCR, up->scr);

		/* if rts not already enabled */
		res = (port->rs485.flags & SER_RS485_RTS_ON_SEND) ? 1 : 0;
		if (gpio_get_value(up->rts_gpio) != res) {
			gpio_set_value(up->rts_gpio, res);
			if (port->rs485.delay_rts_before_send > 0)
				mdelay(port->rs485.delay_rts_before_send);
		}
	}

	if ((port->rs485.flags & SER_RS485_ENABLED) &&
	    !(port->rs485.flags & SER_RS485_RX_DURING_TX))
		serial_omap_stop_rx(port);

	serial_omap_enable_ier_thri(up);
	pm_runtime_mark_last_busy(up->dev);
	pm_runtime_put_autosuspend(up->dev);
}
static void serial_omap_shutdown(struct uart_port *port)
{
	struct uart_omap_port *up = (struct uart_omap_port *)port;
	unsigned long flags = 0;
	u8 lcr, efr;

	dev_dbg(up->port.dev, "serial_omap_shutdown+%d\n", up->pdev->id);

	/*
	 * Disable interrupts from this port
	 */
	up->ier = 0;
	serial_out(up, UART_IER, 0);

	/* If we're using auto-rts then disable it.  */
	spin_lock_irqsave(&up->port.lock, flags);
	lcr = serial_in(up, UART_LCR);
	serial_out(up, UART_LCR, 0xbf);
	efr = serial_in(up, UART_EFR);
	serial_out(up, UART_LCR, lcr);

	if (efr & UART_EFR_RTS) {
		serial_omap_set_autorts(up, 0);
		up->restore_autorts = 1;
	}

	up->port.mctrl &= ~TIOCM_OUT2;
	serial_omap_set_mctrl(&up->port, (up->port.mctrl & ~TIOCM_RTS));
	spin_unlock_irqrestore(&up->port.lock, flags);

	/*
	 * Disable break condition and FIFOs
	 */
	serial_out(up, UART_LCR, serial_in(up, UART_LCR) & ~UART_LCR_SBC);
	serial_omap_clear_fifos(up);

	/*
	 * Read data port to reset things, and then free the irq
	 */
	if (serial_in(up, UART_LSR) & UART_LSR_DR)
		(void) serial_in(up, UART_RX);
	if (up->use_dma) {
		int tmp;
		dma_free_coherent(up->port.dev,
			UART_XMIT_SIZE,	up->port.state->xmit.buf,
			up->uart_dma.tx_buf_dma_phys);
		up->port.state->xmit.buf = NULL;
		serial_omap_stop_rx(port);
		dma_free_coherent(up->port.dev,
			up->uart_dma.rx_buf_size, up->uart_dma.rx_buf,
			up->uart_dma.rx_buf_dma_phys);
		up->uart_dma.rx_buf = NULL;
		tmp = serial_in(up, UART_OMAP_SYSC) & OMAP_UART_SYSC_RESET;
		serial_out(up, UART_OMAP_SYSC, tmp); /* force-idle */
	}
	free_irq(up->port.irq, up);
}
Example #3
0
static void serial_omap_shutdown(struct uart_port *port)
{
	struct uart_omap_port *up = (struct uart_omap_port *)port;
	unsigned long flags = 0;

	dev_dbg(up->port.dev, "serial_omap_shutdown+%d\n", up->pdev->id);
	/*
	 * Disable interrupts from this port
	 */
	up->ier = 0;
	serial_out(up, UART_IER, 0);

	spin_lock_irqsave(&up->port.lock, flags);
	up->port.mctrl &= ~TIOCM_OUT2;
	serial_omap_set_mctrl(&up->port, up->port.mctrl);
	spin_unlock_irqrestore(&up->port.lock, flags);

	/*
	 * Disable break condition and FIFOs
	 */
	serial_out(up, UART_LCR, serial_in(up, UART_LCR) & ~UART_LCR_SBC);
	serial_omap_clear_fifos(up);

	/*
	 * Read data port to reset things, and then free the irq
	 */
	if (serial_in(up, UART_LSR) & UART_LSR_DR)
		(void) serial_in(up, UART_RX);
	if (up->use_dma) {
		int tmp;
		dma_free_coherent(up->port.dev,
			UART_XMIT_SIZE,	up->port.state->xmit.buf,
			up->uart_dma.tx_buf_dma_phys);
		up->port.state->xmit.buf = NULL;
		serial_omap_stop_rx(port);
		dma_free_coherent(up->port.dev,
			up->uart_dma.rx_buf_size, up->uart_dma.rx_buf,
			up->uart_dma.rx_buf_dma_phys);
		up->uart_dma.rx_buf = NULL;
		tmp = serial_in(up, UART_OMAP_SYSC) & OMAP_UART_SYSC_RESET;
		serial_out(up, UART_OMAP_SYSC, tmp); /* force-idle */
	}
	free_irq(up->port.irq, up);

#if defined(CONFIG_KEYBOARD_P1)
    if((up->port.line == 2)&&(g_keyboard))
    {
        send_keyevent(0);
    }
#endif

	/* Set this to zero, would be initialsed
	 * to the corrcet value at set_stermios.
	 */
	up->baud_rate = 0;
}
Example #4
0
static void serial_omap_shutdown(struct uart_port *port)
{
	struct uart_omap_port *up = (struct uart_omap_port *)port;
	unsigned long flags;

	DPRINTK("serial_omap_shutdown+%d\n", up->pdev->id);
	/*
	 * Disable interrupts from this port
	 */
	up->ier = 0;
	serial_out(up, UART_IER, 0);

	spin_lock_irqsave(&up->port.lock, flags);
	if (up->port.flags & UPF_FOURPORT) {
		/* reset interrupts on the AST Fourport board */
		inb((up->port.iobase & 0xfe0) | 0x1f);
		up->port.mctrl |= TIOCM_OUT1;
	} else
		up->port.mctrl &= ~TIOCM_OUT2;
	serial_omap_set_mctrl(&up->port, up->port.mctrl);
	spin_unlock_irqrestore(&up->port.lock, flags);

	/*
	 * Disable break condition and FIFOs
	 */
	serial_out(up, UART_LCR, serial_in(up, UART_LCR) & ~UART_LCR_SBC);
	serial_omap_clear_fifos(up);

	/*
	 * Read data port to reset things, and then free the irq
	 */
	(void) serial_in(up, UART_RX);
	if (up->use_dma) {
		int tmp;
		if (up->is_buf_dma_alloced) {
			dma_free_coherent(up->port.dev,
				  UART_XMIT_SIZE,
				  up->port.info->xmit.buf,
				  up->uart_dma.tx_buf_dma_phys);
			up->port.info->xmit.buf = NULL;
			up->is_buf_dma_alloced = 0;
		}
		/*TBD: Check if this is really needed here*/
		serial_omap_stop_rx(port);
		dma_free_coherent(up->port.dev,
				  up->uart_dma.rx_buf_size,
				  up->uart_dma.rx_buf,
				  up->uart_dma.rx_buf_dma_phys);
		up->uart_dma.rx_buf = NULL;
		tmp = serial_in(up, UART_OMAP_SYSC) & 0x7;
		serial_out(up, UART_OMAP_SYSC, tmp); /* force-idle */
	}

	free_irq(up->port.irq, up);
}
static void serial_omap_shutdown(struct uart_port *port)
{
	struct uart_omap_port *up = (struct uart_omap_port *)port;
	unsigned long flags = 0;

	dev_dbg(up->port.dev, "serial_omap_shutdown+%d\n", up->pdev->id);

	serial_omap_port_enable(up);
	/*
	 * Disable interrupts & wakeup events from this port
	 */
	up->ier = 0;
	up->wer_restore = 0;
	serial_out(up, UART_OMAP_WER, 0);
	serial_out(up, UART_IER, 0);

	spin_lock_irqsave(&up->port.lock, flags);
	up->port.mctrl &= ~TIOCM_OUT2;
	serial_omap_set_mctrl(&up->port, up->port.mctrl);
	spin_unlock_irqrestore(&up->port.lock, flags);

	/*
	 * Disable break condition and FIFOs
	 */
	serial_out(up, UART_LCR, serial_in(up, UART_LCR) & ~UART_LCR_SBC);
	serial_omap_clear_fifos(up);

	/*
	 * Read data port to reset things, and then free the irq
	 */
	if (serial_in(up, UART_LSR) & UART_LSR_DR)
		(void) serial_in(up, UART_RX);
	if (up->use_dma) {
		dma_free_coherent(up->port.dev,
			UART_XMIT_SIZE,	up->port.state->xmit.buf,
			up->uart_dma.tx_buf_dma_phys);
		up->port.state->xmit.buf = NULL;
		serial_omap_stop_rx(port);
		dma_free_coherent(up->port.dev,
			up->uart_dma.rx_buf_size, up->uart_dma.rx_buf,
			up->uart_dma.rx_buf_dma_phys);
		up->uart_dma.rx_buf = NULL;
	}
	serial_omap_port_disable(up);
	free_irq(up->port.irq, up);
}
static void serial_omap_shutdown(struct uart_port *port)
{
	struct uart_omap_port *up = (struct uart_omap_port *)port;
	unsigned long flags = 0;

	dev_dbg(up->port.dev, "serial_omap_shutdown+%d\n", up->port.line);

	pm_runtime_get_sync(&up->pdev->dev);
	up->ier = 0;
	serial_out(up, UART_IER, 0);

	spin_lock_irqsave(&up->port.lock, flags);
	up->port.mctrl &= ~TIOCM_OUT2;
	serial_omap_set_mctrl(&up->port, up->port.mctrl);
	spin_unlock_irqrestore(&up->port.lock, flags);

	serial_out(up, UART_LCR, serial_in(up, UART_LCR) & ~UART_LCR_SBC);
	serial_omap_clear_fifos(up);

	if (serial_in(up, UART_LSR) & UART_LSR_DR)
		(void) serial_in(up, UART_RX);
	if (up->use_dma) {
		dma_free_coherent(up->port.dev,
			UART_XMIT_SIZE,	up->port.state->xmit.buf,
			up->uart_dma.tx_buf_dma_phys);
		up->port.state->xmit.buf = NULL;
		serial_omap_stop_rx(port);
		dma_free_coherent(up->port.dev,
			up->uart_dma.rx_buf_size, up->uart_dma.rx_buf,
			up->uart_dma.rx_buf_dma_phys);
		up->uart_dma.rx_buf = NULL;
	}

	pm_runtime_put(&up->pdev->dev);
	free_irq(up->port.irq, up);
}
Example #7
0
static void serial_omap_shutdown(struct uart_port *port)
{
	struct uart_omap_port *up = (struct uart_omap_port *)port;
	unsigned long flags;
	u8 lcr, efr;

	DPRINTK("serial_omap_shutdown+%d\n", up->pdev->id);
	/* 
	 * If we're using auto-rts then disable it.
	 */
	lcr = serial_in(up, UART_LCR);
	serial_out(up, UART_LCR, 0xbf);
	efr = serial_in(up, UART_EFR);
	serial_out(up, UART_LCR, lcr);

	if (efr & UART_EFR_RTS) {
		serial_omap_set_autorts(up, 0);
		up->restore_autorts = 1;
	}

	/*
	 * Disable interrupts from this port
	 */
	up->ier = 0;
	serial_out(up, UART_IER, 0);

	spin_lock_irqsave(&up->port.lock, flags);
	if (up->port.flags & UPF_FOURPORT) {
		/* reset interrupts on the AST Fourport board */
		inb((up->port.iobase & 0xfe0) | 0x1f);
		up->port.mctrl |= TIOCM_OUT1;
	} else
		up->port.mctrl &= ~TIOCM_OUT2;
	serial_omap_set_mctrl(&up->port, (up->port.mctrl & ~TIOCM_RTS));
	spin_unlock_irqrestore(&up->port.lock, flags);

	if (up->pdev->id == gps_port) {
		serial_out(up, UART_LCR, UART_LCR_DLAB);
		serial_out(up, UART_DLL, 0);
		serial_out(up, UART_DLM, 0);
		serial_out(up, UART_LCR, 0);
		serial_out(up, UART_OMAP_MDR1, OMAP_MDR1_DISABLE);
	}

	/*
	 * Disable break condition and FIFOs
	 */
	serial_out(up, UART_LCR, serial_in(up, UART_LCR) & ~UART_LCR_SBC);
	serial_omap_clear_fifos(up);

	/*
	 * Read data port to reset things, and then free the irq
	 */
	if (serial_in(up, UART_LSR) & UART_LSR_DR)
		(void) serial_in(up, UART_RX);
	if (up->use_dma) {
		int tmp;
		if (up->is_buf_dma_alloced) {
			dma_free_coherent(up->port.dev,
					  UART_XMIT_SIZE,
					  up->port.state->xmit.buf,
					  up->uart_dma.tx_buf_dma_phys);
			up->port.state->xmit.buf = NULL;
			up->is_buf_dma_alloced = 0;
		}
		/*TBD: Check if this is really needed here*/
		serial_omap_stop_rx(port);
		dma_free_coherent(up->port.dev,
				  up->uart_dma.rx_buf_size,
				  up->uart_dma.rx_buf, up->uart_dma.rx_buf_dma_phys);
		up->uart_dma.rx_buf = NULL;
		tmp = serial_in(up, UART_OMAP_SYSC) & 0x7;
		serial_out(up, UART_OMAP_SYSC, tmp); /* force-idle */
	}

	free_irq(up->port.irq, up);

	if (cancel_work_sync(&up->tty_work))
		tty_flip_buffer_work(&up->tty_work);
}