Exemple #1
0
static void
s3c24xx_serial_console_putchar(struct uart_port *port, int ch)
{
	unsigned int ufcon = rd_regl(cons_uart, S3C2410_UFCON);
	while (!s3c24xx_serial_console_txrdy(port, ufcon))
		barrier();
	wr_regb(cons_uart, S3C2410_UTXH, ch);
}
Exemple #2
0
static irqreturn_t s3c_serial_tx_chars(int irq, void *id)
{
	struct s3c_uart_port *ourport = id;
	struct uart_port *port = &ourport->port;
	struct circ_buf *xmit = &port->info->xmit;
	int count = 256;

	if (port->x_char) {
		wr_regb(port, S3C_UTXH, port->x_char);
		port->icount.tx++;
		port->x_char = 0;
		goto out;
	}

	/* if there isnt anything more to transmit, or the uart is now
	 * stopped, disable the uart and exit
	*/

	if (uart_circ_empty(xmit) || uart_tx_stopped(port)) {
		s3c_serial_stop_tx(port);
		goto out;
	}

	/* try and drain the buffer... */

	while (!uart_circ_empty(xmit) && count-- > 0) {
		if (rd_regl(port, S3C_UFSTAT) & ourport->info->tx_fifofull)
			break;

		wr_regb(port, S3C_UTXH, xmit->buf[xmit->tail]);
		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
		port->icount.tx++;
	}

	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
		uart_write_wakeup(port);

	if (uart_circ_empty(xmit))
		s3c_serial_stop_tx(port);

 out:
	wake_lock_timeout(&uart_wakelock, HZ / 2);
	return IRQ_HANDLED;
}
static void sirfsoc_uart_console_putchar(struct uart_port *port, int ch)
{
	struct sirfsoc_uart_port *sirfport = to_sirfport(port);
	struct sirfsoc_register *ureg = &sirfport->uart_reg->uart_reg;
	struct sirfsoc_fifo_status *ufifo_st = &sirfport->uart_reg->fifo_status;
	while (rd_regl(port,
		ureg->sirfsoc_tx_fifo_status) & ufifo_st->ff_full(port->line))
		cpu_relax();
	wr_regb(port, ureg->sirfsoc_tx_fifo_data, ch);
}
Exemple #4
0
static irqreturn_t s3c24xx_serial_tx_chars(int irq, void *id)
{
	struct s3c24xx_uart_port *ourport = id;
	struct uart_port *port = &ourport->port;
	struct circ_buf *xmit = &port->state->xmit;
	int count = 256;

	if (port->x_char) {
		wr_regb(port, S3C2410_UTXH, port->x_char);
		port->icount.tx++;
		port->x_char = 0;
		goto out;
	}

	

	if (uart_circ_empty(xmit) || uart_tx_stopped(port)) {
		s3c24xx_serial_stop_tx(port);
		goto out;
	}

	

	while (!uart_circ_empty(xmit) && count-- > 0) {
		if (rd_regl(port, S3C2410_UFSTAT) & ourport->info->tx_fifofull)
			break;

		wr_regb(port, S3C2410_UTXH, xmit->buf[xmit->tail]);
		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
		port->icount.tx++;
	}

	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
		uart_write_wakeup(port);

	if (uart_circ_empty(xmit))
		s3c24xx_serial_stop_tx(port);

 out:
	return IRQ_HANDLED;
}
Exemple #5
0
static void
s3c24xx_serial_console_write(struct console *co, const char *s,
			     unsigned int count)
{
	int i;
	unsigned int ufcon = rd_regl(cons_uart, S3C2410_UFCON);

	for (i = 0; i < count; i++) {
		while (!s3c24xx_serial_console_txrdy(cons_uart, ufcon))
			barrier();

		wr_regb(cons_uart, S3C2410_UTXH, s[i]);

		if (s[i] == '\n') {
			while (!s3c24xx_serial_console_txrdy(cons_uart, ufcon))
				barrier();

			wr_regb(cons_uart, S3C2410_UTXH, '\r');
		}
	}
}
Exemple #6
0
void s3c_setup_uart_cfg_gpio(unsigned char hwport, struct uart_port* port)
{
	switch (hwport)
	{
	case 0:
		s3c_gpio_cfgpin(S3C64XX_GPA(0),S3C64XX_GPA0_UART_RXD0);
		s3c_gpio_setpull(S3C64XX_GPA(0), S3C_GPIO_PULL_DOWN);
		s3c_gpio_cfgpin(S3C64XX_GPA(1),S3C64XX_GPA1_UART_TXD0);
		s3c_gpio_setpull(S3C64XX_GPA(1), S3C_GPIO_PULL_DOWN);
		s3c_gpio_cfgpin(S3C64XX_GPA(2),S3C_GPIO_INPUT);
		s3c_gpio_setpull(S3C64XX_GPA(2), S3C_GPIO_PULL_DOWN);
		s3c_gpio_cfgpin(S3C64XX_GPA(3),S3C_GPIO_OUTPUT);
		s3c_gpio_setpull(S3C64XX_GPA(3), S3C_GPIO_PULL_DOWN);
		wr_regb(port, S3C_UMSTAT, 0);
		break;
	case 1:
		s3c_gpio_cfgpin(S3C64XX_GPA(4),S3C64XX_GPA4_UART_RXD1);
		s3c_gpio_setpull(S3C64XX_GPA(4), S3C_GPIO_PULL_DOWN);
		s3c_gpio_cfgpin(S3C64XX_GPA(5),S3C64XX_GPA5_UART_TXD1);
		s3c_gpio_setpull(S3C64XX_GPA(5), S3C_GPIO_PULL_DOWN);
		//s3c_gpio_cfgpin(S3C64XX_GPA(6),S3C64XX_GPA6_UART_nCTS1);
		s3c_gpio_setpull(S3C64XX_GPA(6), S3C_GPIO_PULL_DOWN);
		//s3c_gpio_cfgpin(S3C64XX_GPA(7),S3C64XX_GPA7_UART_nRTS1);
		s3c_gpio_setpull(S3C64XX_GPA(7), S3C_GPIO_PULL_DOWN);
		wr_regb(port, S3C_UMSTAT, 0);
		break;
	case 2:
		s3c_gpio_cfgpin(S3C64XX_GPB(0),S3C64XX_GPB0_UART_RXD2);
		s3c_gpio_setpull(S3C64XX_GPB(0), S3C_GPIO_PULL_DOWN);
		s3c_gpio_cfgpin(S3C64XX_GPB(1),S3C64XX_GPB1_UART_TXD2);
		s3c_gpio_setpull(S3C64XX_GPB(1), S3C_GPIO_PULL_DOWN);
		break;
	case 3:
		printk("UART 3 is used as I2C bus in M8\n");
		break;
	default:
		printk("Unknown UART port ID\n");
		break;
	}
}
Exemple #7
0
static irqreturn_t s3c24xx_serial_tx_chars(int irq, void *id)
{
	struct s3c24xx_uart_port *ourport = id;
	struct uart_port *port = &ourport->port;
	struct circ_buf *xmit = &port->state->xmit;
	unsigned long flags;
	int count, dma_count = 0;

	spin_lock_irqsave(&port->lock, flags);

	count = CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE);

	if (ourport->dma && ourport->dma->tx_chan &&
	    count >= ourport->min_dma_size) {
		int align = dma_get_cache_alignment() -
			(xmit->tail & (dma_get_cache_alignment() - 1));
		if (count-align >= ourport->min_dma_size) {
			dma_count = count-align;
			count = align;
		}
	}

	if (port->x_char) {
		wr_regb(port, S3C2410_UTXH, port->x_char);
		port->icount.tx++;
		port->x_char = 0;
		goto out;
	}

	/* if there isn't anything more to transmit, or the uart is now
	 * stopped, disable the uart and exit
	*/

	if (uart_circ_empty(xmit) || uart_tx_stopped(port)) {
		s3c24xx_serial_stop_tx(port);
		goto out;
	}

	/* try and drain the buffer... */

	if (count > port->fifosize) {
		count = port->fifosize;
		dma_count = 0;
	}

	while (!uart_circ_empty(xmit) && count > 0) {
		if (rd_regl(port, S3C2410_UFSTAT) & ourport->info->tx_fifofull)
			break;

		wr_regb(port, S3C2410_UTXH, xmit->buf[xmit->tail]);
		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
		port->icount.tx++;
		count--;
	}

	if (!count && dma_count) {
		s3c24xx_serial_start_tx_dma(ourport, dma_count);
		goto out;
	}

	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) {
		spin_unlock(&port->lock);
		uart_write_wakeup(port);
		spin_lock(&port->lock);
	}

	if (uart_circ_empty(xmit))
		s3c24xx_serial_stop_tx(port);

out:
	spin_unlock_irqrestore(&port->lock, flags);
	return IRQ_HANDLED;
}
Exemple #8
0
void dock_keyboard_tx(u8 val)
{    
    wr_regb(cons_uart, S3C2410_UTXH, val);
}