Esempio n. 1
0
/*
 * Start receiving - port is in process of being closed.
 */
static void atmel_start_rx(struct uart_port *port)
{
	struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port;

	if (atmel_port->use_dma_rx) {
		UART_PUT_PTCR(port, ATMEL_PDC_RXTEN); 		/* enable PDC receive */
		UART_PUT_IER(port, ATMEL_US_ENDRX | ATMEL_US_TIMEOUT);
	}
	else
		UART_PUT_IER(port, ATMEL_US_RXRDY);
}
Esempio n. 2
0
/*
 * Start transmitting.
 */
static void atmel_start_tx(struct uart_port *port)
{
	struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port;

	if (atmel_port->use_dma_tx) {
		if (UART_GET_PTSR(port) & ATMEL_PDC_TXTEN)
			/* The transmitter is already running.  Yes, we
			   really need this.*/
			return;

		UART_PUT_IER(port, ATMEL_US_ENDTX | ATMEL_US_TXBUFE);
		UART_PUT_PTCR(port, ATMEL_PDC_TXTEN);		/* re-enable PDC transmit */
	}
	else
		UART_PUT_IER(port, ATMEL_US_TXRDY);
}
static void ambauart_enable_ms(struct uart_port *port)
{
#if DEBUG
       printk("ambauart_enable_ms() called\n");
#endif
       UART_PUT_IER(port, UART_GET_IER(port) | KS8695_INT_ENABLE_MODEM);
}
static void ambauart_stop_rx(struct uart_port *port)
{
	unsigned int ier;

#if DEBUG
       printk("ambauart_stop_rx() called\n");

#endif
	ier = UART_GET_IER(port);
	ier &= ~KS8695_INT_ENABLE_RX;
	UART_PUT_IER(port, ier);
}
Esempio n. 5
0
static void ssauart_stop_rx (struct uart_port *port)
{
   unsigned int ier;
   unsigned long flags;

   local_irq_save (flags);          /* AMcCurdy: added paranoid irq protection */

   ier  = UART_GET_IER(port);
   ier &= ~(1 << 0);                /* disable Rx interrupts */
   UART_PUT_IER(port, ier);

   local_irq_restore (flags);
}
static int ambauart_startup(struct uart_port *port)
{
	int retval;

#if DEBUG
  	printk("ambauart_startup ier=%x\n",UART_GET_IER(port));
#endif

	/*
	 * Allocate the IRQ, let IRQ KS8695_INT_UART_RX, KS8695_INT_UART_TX comes to same 
         * routine
	 */

        UART_PUT_IER(port, UART_GET_IER(port) & 0xFFFFF0FF);

	retval = request_irq(KS8695_INT_UART_TX, ambauart_int, SA_SHIRQ | SA_INTERRUPT, "amba", port);
	if (retval)
		return retval;

        retval = request_irq(KS8695_INT_UART_RX, ambauart_int, SA_SHIRQ | SA_INTERRUPT, "amba", port);
        if (retval)
                return retval;

        retval = request_irq(KS8695_INT_UART_LINE_ERR, ambauart_int, SA_SHIRQ | SA_INTERRUPT, "amba", port);
        if (retval)
                return retval;

        retval = request_irq(KS8695_INT_UART_MODEMS, ambauart_int, SA_SHIRQ | SA_INTERRUPT, "amba", port);
        if (retval)
                return retval;
	
        /*
	 * Finally, enable interrupts
	 */
        UART_PUT_IER(port, ((UART_GET_IER(port) & 0xFFFFF0FF) | KS8695_INT_ENABLE_RX | 0x800 | 0x400));
	return 0;
}
Esempio n. 7
0
static int ssauart_startup (struct uart_port *port)
{
   int retval;

#if 1
   if ((retval = request_irq (port->irq, ssauart_int, 0, "uart", port)))
      return (retval);
#else
   if ((retval = request_irq (port->irq, ssauart_int, SA_INTERRUPT, "uart", port)))
      return (retval);
#endif

   UART_PUT_IER(port, 0x03);   /* enable Tx and Rx ints only (modem status enabled elsewhere ?) */

   return 0;
}
Esempio n. 8
0
static void ssauart_start_tx (struct uart_port *port, unsigned int from_tty)
{
   unsigned int ier;
   unsigned long flags;

   local_irq_save (flags);          /* AMcCurdy: added paranoid irq protection */

   ier  = UART_GET_IER(port);
   ier |= (1 << 1);                 /* enable Tx interrupts */
   UART_PUT_IER(port, ier);

   /* We may have something in the buffer already */
   ssauart_tx_one_char (port);

   local_irq_restore (flags);
}
Esempio n. 9
0
static void ssauart_enable_ms (struct uart_port *port)
{
#if 0

   unsigned int ier;
   unsigned long flags;

   local_irq_save (flags);          /* AMcCurdy: added paranoid irq protection */

   ier  = UART_GET_IER(port);
   ier |= (1 << 3);                 /* enable Modem Status interrupts */
   UART_PUT_IER(port, ier);

   local_irq_restore (flags);

#endif
}
static void ambauart_start_tx(struct uart_port *port, unsigned int tty_start)
{
	unsigned int ier;

#if DEBUG
       printk("ambauart_start_tx() called\n");

#endif

        ier = UART_GET_IER(port);
        if ( ier &  KS8695_INT_ENABLE_TX )
            return;
        else
        {
	    ier |= KS8695_INT_ENABLE_TX; 
	    UART_PUT_IER(port, ier);
	}
}
Esempio n. 11
0
/*
 * Perform initialization and enable port for reception
 */
static int atmel_startup(struct uart_port *port)
{
	struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port;
	int retval;

	/*
	 * Ensure that no interrupts are enabled otherwise when
	 * request_irq() is called we could get stuck trying to
	 * handle an unexpected interrupt
	 */
	UART_PUT_IDR(port, -1);

	/*
	 * Allocate the IRQ
	 */
	retval = request_irq(port->irq, atmel_interrupt, IRQF_SHARED, "atmel_serial", port);
	if (retval) {
		printk("atmel_serial: atmel_startup - Can't get irq\n");
		return retval;
	}

	/*
	 * If there is a specific "open" function (to register
	 * control line interrupts)
	 */
	if (atmel_open_hook) {
		retval = atmel_open_hook(port);
		if (retval) {
			free_irq(port->irq, port);
			return retval;
		}
	}

	/*
	 * Finally, enable the serial port
	 */
	UART_PUT_CR(port, ATMEL_US_RSTSTA | ATMEL_US_RSTRX);
	UART_PUT_CR(port, ATMEL_US_TXEN | ATMEL_US_RXEN);		/* enable xmit & rcvr */

	UART_PUT_IER(port, ATMEL_US_RXRDY);		/* enable receive only */

	return 0;
}
Esempio n. 12
0
/*
 * Perform initialization and enable port for reception
 */
static int at91_startup(struct uart_port *port)
{
	int retval;

	/*
	 * Ensure that no interrupts are enabled otherwise when
	 * request_irq() is called we could get stuck trying to
	 * handle an unexpected interrupt
	 */
	UART_PUT_IDR(port, -1);

	/*
	 * Allocate the IRQ
	 */
	retval = request_irq(port->irq, at91_interrupt, SA_SHIRQ, "at91_serial", port);
	if (retval) {
		printk("at91_serial: at91_startup - Can't get irq\n");
		return retval;
	}

	/*
	 * If there is a specific "open" function (to register
	 * control line interrupts)
	 */
	if (at91_open) {
		retval = at91_open(port);
		if (retval) {
			free_irq(port->irq, port);
			return retval;
		}
	}

	port->read_status_mask = AT91_US_RXRDY | AT91_US_TXRDY | AT91_US_OVRE
			| AT91_US_FRAME | AT91_US_PARE | AT91_US_RXBRK;
	/*
	 * Finally, enable the serial port
	 */
	UART_PUT_CR(port, AT91_US_RSTSTA | AT91_US_RSTRX);
	UART_PUT_CR(port, AT91_US_TXEN | AT91_US_RXEN);		/* enable xmit & rcvr */
	UART_PUT_IER(port, AT91_US_RXRDY);			/* do receive only */
	return 0;
}
static void ambauart_shutdown(struct uart_port *port)
{
#if DEBUG
       printk("ambauart_shutdown\n");
#endif
        /*
         * disable all interrupts, disable the port
         */

        UART_PUT_IER(port, UART_GET_IER(port) & 0xFFFFF0FF);

        /* disable break condition and fifos */
        UART_PUT_LCR(port, UART_GET_LCR(port) & ~KS8695_UART_LINEC_BRK);
        UART_PUT_FCR(port, UART_GET_FCR(port) & ~KS8695_UART_FIFO_FEN);

        free_irq(KS8695_INT_UART_RX, port);
        free_irq(KS8695_INT_UART_TX, port);
        free_irq(KS8695_INT_UART_MODEMS, port);
        free_irq(KS8695_INT_UART_LINE_ERR, port);
}
Esempio n. 14
0
/*
 * Interrupts are disabled on entering
 */
static void atmel_console_write(struct console *co, const char *s, u_int count)
{
	struct uart_port *port = &atmel_ports[co->index].uart;
	unsigned int status, imr;

	/*
	 *	First, save IMR and then disable interrupts
	 */
	imr = UART_GET_IMR(port);	/* get interrupt mask */
	UART_PUT_IDR(port, ATMEL_US_RXRDY | ATMEL_US_TXRDY);

	uart_console_write(port, s, count, atmel_console_putchar);

	/*
	 *	Finally, wait for transmitter to become empty
	 *	and restore IMR
	 */
	do {
		status = UART_GET_CSR(port);
	} while (!(status & ATMEL_US_TXRDY));
	UART_PUT_IER(port, imr);	/* set interrupts back the way they were */
}
Esempio n. 15
0
/*
 * Interrupts are disabled on entering
 */
static void at91_console_write(struct console *co, const char *s, u_int count)
{
	struct uart_port *port = at91_ports + co->index;
	unsigned int status, i, imr;

	/*
	 *	First, save IMR and then disable interrupts
	 */
	imr = UART_GET_IMR(port);	/* get interrupt mask */
	UART_PUT_IDR(port, AT91_US_RXRDY | AT91_US_TXRDY);

	/*
	 *	Now, do each character
	 */
	for (i = 0; i < count; i++) {
		do {
			status = UART_GET_CSR(port);
		} while (!(status & AT91_US_TXRDY));
		UART_PUT_CHAR(port, s[i]);
		if (s[i] == '\n') {
			do {
				status = UART_GET_CSR(port);
			} while (!(status & AT91_US_TXRDY));
			UART_PUT_CHAR(port, '\r');
		}
	}

	/*
	 *	Finally, wait for transmitter to become empty
	 *	and restore IMR
	 */
	do {
		status = UART_GET_CSR(port);
	} while (!(status & AT91_US_TXRDY));
	UART_PUT_IER(port, imr);	/* set interrupts back the way they were */
}
static void ambauart_change_speed(struct uart_port *port, u_int cflag, u_int iflag, u_int quot)
{
	u_int lcr, old_ier, fcr=0;
	unsigned long flags;

#if DEBUG
	printk("ambauart_set_cflag(0x%x) called\n", cflag);
#endif
	//printk("ambauart_change_speed\n");
	/* byte size and parity */
	switch (cflag & CSIZE) {
	case CS5: lcr = KS8695_UART_LINEC_WLEN5; break;
	case CS6: lcr = KS8695_UART_LINEC_WLEN6; break;
	case CS7: lcr = KS8695_UART_LINEC_WLEN7; break;
	default:  lcr = KS8695_UART_LINEC_WLEN8; break; // CS8
	}
	if (cflag & CSTOPB)
		lcr |= KS8695_UART_LINEC_STP2;
	if (cflag & PARENB) {
		lcr |= KS8695_UART_LINEC_PEN;
		if (!(cflag & PARODD))
			lcr |= KS8695_UART_LINEC_EPS;
	}
	if (port->fifosize > 1)
		fcr = KS8695_UART_FIFO_TRIG04 | KS8695_UART_FIFO_TXRST | KS8695_UART_FIFO_RXRST | KS8695_UART_FIFO_FEN;

	port->read_status_mask = KS8695_UART_LINES_OE;
	if (iflag & INPCK)
		port->read_status_mask |= (KS8695_UART_LINES_FE | KS8695_UART_LINES_PE);
	if (iflag & (BRKINT | PARMRK))
		port->read_status_mask |= KS8695_UART_LINES_BE;

	/*
	 * Characters to ignore
	 */
	port->ignore_status_mask = 0;
	if (iflag & IGNPAR)
		port->ignore_status_mask |= (KS8695_UART_LINES_FE | KS8695_UART_LINES_PE);
	if (iflag & IGNBRK) {
		port->ignore_status_mask |= KS8695_UART_LINES_BE;
		/*
		 * If we're ignoring parity and break indicators,
		 * ignore overruns too (for real raw support).
		 */
		if (iflag & IGNPAR)
			port->ignore_status_mask |= KS8695_UART_LINES_OE;
	}

	/*
	 * Ignore all characters if CREAD is not set.
	 */
	if ((cflag & CREAD) == 0)
		port->ignore_status_mask |= UART_DUMMY_LSR_RX;

	/* first, disable everything */
	save_flags(flags); cli();
	old_ier = UART_GET_IER(port);
	UART_PUT_IER(port, old_ier & 0xFFFFF0FF);
	old_ier &= ~KS8695_INT_ENABLE_MODEM;

	if ((port->flags & ASYNC_HARDPPS_CD) ||
	    (cflag & CRTSCTS) || !(cflag & CLOCAL))
		old_ier |= KS8695_INT_ENABLE_MODEM;


	/* Set baud rate */
	//	UART_PUT_BRDR(port, port->uartclk / quot); 
	UART_PUT_BRDR(port, 0x28B); 

	UART_PUT_LCR(port, lcr);
	UART_PUT_FCR(port, fcr);
	UART_PUT_IER(port, old_ier & 0xFFFFFEFF);

	restore_flags(flags);
}
Esempio n. 17
0
/*
 * Start transmitting.
 */
static void atmel_start_tx(struct uart_port *port)
{
	struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port;

	UART_PUT_IER(port, ATMEL_US_TXRDY);
}
Esempio n. 18
0
/*
 * Change the port parameters
 */
static void atmel_set_termios(struct uart_port *port, struct ktermios * termios, struct ktermios * old)
{
	struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port;
	unsigned long flags;
	unsigned int mode, imr, quot, baud;

	/* Get current mode register */
	mode = UART_GET_MR(port) & ~(ATMEL_US_USCLKS | ATMEL_US_CHRL | ATMEL_US_NBSTOP | ATMEL_US_PAR);

	baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
	quot = uart_get_divisor(port, baud);

	if (quot > 65535) {	/* BRGR is 16-bit, so switch to slower clock */
		quot /= 8;
		mode |= ATMEL_US_USCLKS_MCK_DIV8;
	}

	/* byte size */
	switch (termios->c_cflag & CSIZE) {
	case CS5:
		mode |= ATMEL_US_CHRL_5;
		break;
	case CS6:
		mode |= ATMEL_US_CHRL_6;
		break;
	case CS7:
		mode |= ATMEL_US_CHRL_7;
		break;
	default:
		mode |= ATMEL_US_CHRL_8;
		break;
	}

	/* stop bits */
	if (termios->c_cflag & CSTOPB)
		mode |= ATMEL_US_NBSTOP_2;

	/* parity */
	if (termios->c_cflag & PARENB) {
		if (termios->c_cflag & CMSPAR) {			/* Mark or Space parity */
			if (termios->c_cflag & PARODD)
				mode |= ATMEL_US_PAR_MARK;
			else
				mode |= ATMEL_US_PAR_SPACE;
		}
		else if (termios->c_cflag & PARODD)
			mode |= ATMEL_US_PAR_ODD;
		else
			mode |= ATMEL_US_PAR_EVEN;
	}
	else
		mode |= ATMEL_US_PAR_NONE;

	spin_lock_irqsave(&port->lock, flags);

	port->read_status_mask = ATMEL_US_OVRE;
	if (termios->c_iflag & INPCK)
		port->read_status_mask |= (ATMEL_US_FRAME | ATMEL_US_PARE);
	if (termios->c_iflag & (BRKINT | PARMRK))
		port->read_status_mask |= ATMEL_US_RXBRK;

	if (atmel_port->use_dma_rx)	/* need to enable error interrupts */
		UART_PUT_IER(port, port->read_status_mask);

	/*
	 * Characters to ignore
	 */
	port->ignore_status_mask = 0;
	if (termios->c_iflag & IGNPAR)
		port->ignore_status_mask |= (ATMEL_US_FRAME | ATMEL_US_PARE);
	if (termios->c_iflag & IGNBRK) {
		port->ignore_status_mask |= ATMEL_US_RXBRK;
		/*
		 * If we're ignoring parity and break indicators,
		 * ignore overruns too (for real raw support).
		 */
		if (termios->c_iflag & IGNPAR)
			port->ignore_status_mask |= ATMEL_US_OVRE;
	}

	// TODO: Ignore all characters if CREAD is set.

	/* update the per-port timeout */
	uart_update_timeout(port, termios->c_cflag, baud);

	/* disable interrupts and drain transmitter */
	imr = UART_GET_IMR(port);	/* get interrupt mask */
	UART_PUT_IDR(port, -1);		/* disable all interrupts */
	while (!(UART_GET_CSR(port) & ATMEL_US_TXEMPTY))
		cpu_relax();

	/* disable receiver and transmitter */
	UART_PUT_CR(port, ATMEL_US_TXDIS | ATMEL_US_RXDIS);

	/* set the parity, stop bits and data size */
	UART_PUT_MR(port, mode);

	/* set the baud rate */
	UART_PUT_BRGR(port, quot);
	UART_PUT_CR(port, ATMEL_US_RSTSTA | ATMEL_US_RSTRX);
	UART_PUT_CR(port, ATMEL_US_TXEN | ATMEL_US_RXEN);

	/* restore interrupts */
	UART_PUT_IER(port, imr);

	/* CTS flow-control and modem-status interrupts */
	if (UART_ENABLE_MS(port, termios->c_cflag))
		port->ops->enable_ms(port);

	spin_unlock_irqrestore(&port->lock, flags);
}
Esempio n. 19
0
/*
 * Perform initialization and enable port for reception
 */
static int atmel_startup(struct uart_port *port)
{
	struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port;
	int retval;

	/*
	 * Ensure that no interrupts are enabled otherwise when
	 * request_irq() is called we could get stuck trying to
	 * handle an unexpected interrupt
	 */
	UART_PUT_IDR(port, -1);

	/*
	 * Allocate the IRQ
	 */
	retval = request_irq(port->irq, atmel_interrupt, IRQF_SHARED, "atmel_serial", port);
	if (retval) {
		printk("atmel_serial: atmel_startup - Can't get irq\n");
		return retval;
	}

	/*
	 * Initialize DMA (if necessary)
	 */
	if (atmel_port->use_dma_rx) {
		int i;
		u32 pdc_buffer_size;
#ifdef INFRAD_NO_PDC_SUPPORT
		struct tty_struct *tty = port->info->tty;
		printk ("petworm: serial open index is %d.\n", tty->index);
		if (tty->index == 2)
		{
			printk ("petworm: DMA buffer is 16.\n");
			pdc_buffer_size = 16;
		}
		else
			pdc_buffer_size = PDC_BUFFER_SIZE;
#else
		pdc_buffer_size = PDC_BUFFER_SIZE;
#endif
		for (i = 0; i < 2; i++) {
			struct atmel_dma_buffer *pdc = &atmel_port->pdc_rx[i];

			pdc->buf = kmalloc(pdc_buffer_size, GFP_KERNEL);
			if (pdc->buf == NULL) {
				if (i != 0) {
					dma_unmap_single(port->dev, atmel_port->pdc_rx[0].dma_addr, pdc_buffer_size, DMA_FROM_DEVICE);
					kfree(atmel_port->pdc_rx[0].buf);
				}
				free_irq(port->irq, port);
				return -ENOMEM;
			}
			pdc->dma_addr = dma_map_single(port->dev, pdc->buf, pdc_buffer_size, DMA_FROM_DEVICE);
			pdc->dma_size = pdc_buffer_size;
			pdc->ofs = 0;
		}

		atmel_port->pdc_rx_idx = 0;

		UART_PUT_RPR(port, atmel_port->pdc_rx[0].dma_addr);
		UART_PUT_RCR(port, pdc_buffer_size);

		UART_PUT_RNPR(port, atmel_port->pdc_rx[1].dma_addr);
		UART_PUT_RNCR(port, pdc_buffer_size);
	}
	if (atmel_port->use_dma_tx) {
		struct atmel_dma_buffer *pdc = &atmel_port->pdc_tx;
		struct circ_buf *xmit = &port->info->xmit;

		pdc->buf = xmit->buf;
		pdc->dma_addr = dma_map_single(port->dev, pdc->buf, SERIAL_XMIT_SIZE, DMA_TO_DEVICE);
		pdc->dma_size = SERIAL_XMIT_SIZE;
		pdc->ofs = 0;
	}

	/*
	 * If there is a specific "open" function (to register
	 * control line interrupts)
	 */
	if (atmel_open_hook) {
		retval = atmel_open_hook(port);
		if (retval) {
			free_irq(port->irq, port);
			return retval;
		}
	}

	/*
	 * Finally, enable the serial port
	 */
	UART_PUT_CR(port, ATMEL_US_RSTSTA | ATMEL_US_RSTRX);
	UART_PUT_CR(port, ATMEL_US_TXEN | ATMEL_US_RXEN);		/* enable xmit & rcvr */

	if (atmel_port->use_dma_rx) {
		UART_PUT_RTOR(port, PDC_RX_TIMEOUT);		/* set UART timeout */
		UART_PUT_CR(port, ATMEL_US_STTTO);

		UART_PUT_IER(port, ATMEL_US_ENDRX | ATMEL_US_TIMEOUT);
		UART_PUT_PTCR(port, ATMEL_PDC_RXTEN);		/* enable PDC controller */
	}
	else
		UART_PUT_IER(port, ATMEL_US_RXRDY);		/* enable receive only */

	return 0;
}
Esempio n. 20
0
/*
 * Characters received (called from interrupt handler)
 */
static void atmel_rx_chars(struct uart_port *port)
{
	struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port;
	struct tty_struct *tty = port->info->tty;
	unsigned int status, ch, flg;

	status = UART_GET_CSR(port);
	while (status & ATMEL_US_RXRDY) {
		ch = UART_GET_CHAR(port);

		port->icount.rx++;

		flg = TTY_NORMAL;

		/*
		 * note that the error handling code is
		 * out of the main execution path
		 */
		if (unlikely(status & (ATMEL_US_PARE | ATMEL_US_FRAME
				       | ATMEL_US_OVRE | ATMEL_US_RXBRK)
			     || atmel_port->break_active)) {
			UART_PUT_CR(port, ATMEL_US_RSTSTA);	/* clear error */
			if (status & ATMEL_US_RXBRK
			    && !atmel_port->break_active) {
				status &= ~(ATMEL_US_PARE | ATMEL_US_FRAME);	/* ignore side-effect */
				port->icount.brk++;
				atmel_port->break_active = 1;
				UART_PUT_IER(port, ATMEL_US_RXBRK);
				if (uart_handle_break(port))
					goto ignore_char;
			} else {
				/*
				 * This is either the end-of-break
				 * condition or we've received at
				 * least one character without RXBRK
				 * being set. In both cases, the next
				 * RXBRK will indicate start-of-break.
				 */
				UART_PUT_IDR(port, ATMEL_US_RXBRK);
				status &= ~ATMEL_US_RXBRK;
				atmel_port->break_active = 0;
			}
			if (status & ATMEL_US_PARE)
				port->icount.parity++;
			if (status & ATMEL_US_FRAME)
				port->icount.frame++;
			if (status & ATMEL_US_OVRE)
				port->icount.overrun++;

			status &= port->read_status_mask;

			if (status & ATMEL_US_RXBRK)
				flg = TTY_BREAK;
			else if (status & ATMEL_US_PARE)
				flg = TTY_PARITY;
			else if (status & ATMEL_US_FRAME)
				flg = TTY_FRAME;
		}

		if (uart_handle_sysrq_char(port, ch))
			goto ignore_char;

		uart_insert_char(port, status, ATMEL_US_OVRE, ch, flg);

	ignore_char:
		status = UART_GET_CSR(port);
	}

	tty_flip_buffer_push(tty);
}
Esempio n. 21
0
/*
 * Enable modem status interrupts
 */
static void atmel_enable_ms(struct uart_port *port)
{
	UART_PUT_IER(port, ATMEL_US_RIIC | ATMEL_US_DSRIC | ATMEL_US_DCDIC | ATMEL_US_CTSIC);
}
static void ambauart_int(int irq, void *dev_id, struct pt_regs *regs)
{
    struct uart_port *port = dev_id;
    struct uart_info *info = port->info;
    unsigned int status, ier, old_ier, count, lsr;

    old_ier  = UART_GET_IER(port);
    UART_PUT_IER(port, (old_ier & 0xFFFFF0FF));

    status = UART_GET_INT_STATUS(port);
    
    lsr = UART_GET_LSR(port);
    
    /* KS8695_INTMASK_UART_RX is not set during breakpoint as it should (looks
     * like a HW bug), so we specifically check for a breakpoint condition in
     * the UART line status register.
     * Some bits from the UART line status register are cleared only when they
     * are read by CPU. That is why we cannot read the line status register
     * twice, and should pass the first read as argument to ambauart_rx_chars.
     * Refer to CENTAUR KS8695PX's Register Description document:
     * KS8695PX_REG_DESCP_v1.0.pdf, page 58: "UART Line Status Register".
     */
    if (status & KS8695_INTMASK_UART_RX || lsr & KS8695_UART_LINES_BE)
    {
#ifdef SUPPORT_SYSRQ
	ambauart_rx_chars(port, regs, lsr);
#else
	ambauart_rx_chars(port, lsr);
#endif
    }
    if (status & KS8695_INTMASK_UART_TX) 
    {
        if (port->x_char)
        {
                UART_CLR_INT_STATUS(port, KS8695_INTMASK_UART_TX);
                UART_PUT_CHAR(port, (u_int) port->x_char);
                port->icount.tx++;
                port->x_char = 0;
                ier = UART_GET_IER(port);
                ier &= 0xFFFFFEFF;
                UART_PUT_IER(port, ier);
                printk("XOn/Off sent\n");
                return;
        }
        for ( count = 0; count < 16; count++)
        {
              if (info->xmit.head == info->xmit.tail)
              {
                 /*ier = UART_GET_IER(port);
                 ier &= 0xFFFFFEFF;
                 UART_PUT_IER(port, ier);*/
                 break;
              }
              UART_CLR_INT_STATUS(port, KS8695_INTMASK_UART_TX);
              UART_PUT_CHAR(port, (u_int) (info->xmit.buf[info->xmit.tail]));
              info->xmit.tail = (info->xmit.tail + 1) & (UART_XMIT_SIZE - 1);
              port->icount.tx++;
        };
        if (CIRC_CNT(info->xmit.head, info->xmit.tail, UART_XMIT_SIZE) < WAKEUP_CHARS)
                uart_write_wakeup(port);
 
        if (info->xmit.head == info->xmit.tail)
        {
           ier = UART_GET_IER(port);
           ier &= 0xFFFFFEFF;
           UART_PUT_IER(port, ier);
        }
    }
    if (status & KS8695_INTMASK_UART_MODEMS)
    {
	ambauart_modem_status(port);
    }
    if (status & KS8695_INTMASK_UART_MODEMS)
    {
         ambauart_modem_status(port);
    }
    if ( status & KS8695_INTMASK_UART_LINE_ERR)
    {
         UART_GET_LSR(port);
    }
    if (info->xmit.head == info->xmit.tail)
       UART_PUT_IER(port, (old_ier & 0xFFFFFEFF));
    else
       UART_PUT_IER(port, old_ier | KS8695_INTMASK_UART_TX);
}
Esempio n. 23
0
/*
 * Enable modem status interrupts
 */
static void at91_enable_ms(struct uart_port *port)
{
	port->read_status_mask |= (AT91_US_RIIC | AT91_US_DSRIC | AT91_US_DCDIC | AT91_US_CTSIC);
	UART_PUT_IER(port, AT91_US_RIIC | AT91_US_DSRIC | AT91_US_DCDIC | AT91_US_CTSIC);
}
Esempio n. 24
0
static void ssauart_shutdown (struct uart_port *port)
{
   UART_PUT_IER (port, 0x00);   /* disable all interrupts */
   free_irq (port->irq, port);
}
Esempio n. 25
0
/*
 * Start transmitting.
 */
static void at91_start_tx(struct uart_port *port)
{
	port->read_status_mask |= AT91_US_TXRDY;
	UART_PUT_IER(port, AT91_US_TXRDY);
}