コード例 #1
0
ファイル: clps711x.c プロジェクト: niubl/camera_project
static int clps711xuart_startup(struct uart_port *port, struct uart_info *info)
{
	u_int syscon;
	int retval;

	/*
	 * Allocate the IRQs
	 */
	retval = request_irq(TX_IRQ(port), clps711xuart_int_tx, 0,
			     "clps711xuart_tx", info);
	if (retval)
		return retval;

	retval = request_irq(RX_IRQ(port), clps711xuart_int_rx, 0,
			     "clps711xuart_rx", info);
	if (retval) {
		free_irq(TX_IRQ(port), info);
		return retval;
	}

	port->ops->set_mctrl(port, info->mctrl);

	/*
	 * enable the port
	 */
	syscon = clps_readl(SYSCON(port));
	syscon |= SYSCON_UARTEN;
	clps_writel(syscon, SYSCON(port));

	return 0;
}
コード例 #2
0
ファイル: clps711x.c プロジェクト: AdrianHuang/linux-3.8.13
static int uart_clps711x_startup(struct uart_port *port)
{
	struct clps711x_port *s = dev_get_drvdata(port->dev);
	int ret;

	s->tx_enabled[port->line] = 1;
	/* Allocate the IRQs */
	ret = devm_request_irq(port->dev, TX_IRQ(port), uart_clps711x_int_tx,
			       0, UART_CLPS711X_NAME " TX", port);
	if (ret)
		return ret;

	ret = devm_request_irq(port->dev, RX_IRQ(port), uart_clps711x_int_rx,
			       0, UART_CLPS711X_NAME " RX", port);
	if (ret) {
		devm_free_irq(port->dev, TX_IRQ(port), port);
		return ret;
	}

	/* Disable break */
	clps_writel(clps_readl(UBRLCR(port)) & ~UBRLCR_BREAK, UBRLCR(port));

	/* Enable the port */
	clps_writel(clps_readl(SYSCON(port)) | SYSCON_UARTEN, SYSCON(port));

	return 0;
}
コード例 #3
0
static int clps711xuart_startup(struct uart_port *port)
{
	unsigned int syscon;
	int retval;

	tx_enabled(port) = 1;

	/*
	 * Allocate the IRQs
	 */
	retval = request_irq(TX_IRQ(port), clps711xuart_int_tx, 0,
			     "clps711xuart_tx", port);
	if (retval)
		return retval;

	retval = request_irq(RX_IRQ(port), clps711xuart_int_rx, 0,
			     "clps711xuart_rx", port);
	if (retval) {
		free_irq(TX_IRQ(port), port);
		return retval;
	}

	/*
	 * enable the port
	 */
	syscon = clps_readl(SYSCON(port));
	syscon |= SYSCON_UARTEN;
	clps_writel(syscon, SYSCON(port));

	return 0;
}
コード例 #4
0
static int s3c24xx_serial_startup(struct uart_port *port)
{
	struct s3c24xx_uart_port *ourport = to_ourport(port);
	int ret;

	dbg("s3c24xx_serial_startup: port=%p (%08lx,%p)\n",
	    port->mapbase, port->membase);

        if (port->line == 2) {
       	    s3c2410_gpio_cfgpin(S3C2410_GPH6, S3C2410_GPH6_TXD2);
    	    s3c2410_gpio_pullup(S3C2410_GPH6, 1); 

    	    s3c2410_gpio_cfgpin(S3C2410_GPH7, S3C2410_GPH7_RXD2);
    	    s3c2410_gpio_pullup(S3C2410_GPH7, 1); 
        }

	rx_enabled(port) = 1;

	ret = request_irq(RX_IRQ(port),
			  s3c24xx_serial_rx_chars, 0,
			  s3c24xx_serial_portname(port), ourport);

	if (ret != 0) {
		printk(KERN_ERR "cannot get irq %d\n", RX_IRQ(port));
		return ret;
	}

	ourport->rx_claimed = 1;

	dbg("requesting tx irq...\n");

	tx_enabled(port) = 1;

	ret = request_irq(TX_IRQ(port),
			  s3c24xx_serial_tx_chars, 0,
			  s3c24xx_serial_portname(port), ourport);

	if (ret) {
		printk(KERN_ERR "cannot get irq %d\n", TX_IRQ(port));
		goto err;
	}

	ourport->tx_claimed = 1;

	dbg("s3c24xx_serial_startup ok\n");

	/* the port reset code should have done the correct
	 * register setup for the port controls */

	return ret;

 err:
	s3c24xx_serial_shutdown(port);
	return ret;
}
コード例 #5
0
ファイル: s3c2410.c プロジェクト: QiuLihua83/linux-2.6.10
static int s3c24xx_serial_startup(struct uart_port *port)
{
	struct s3c24xx_uart_port *ourport = to_ourport(port);
	unsigned long flags;
	int ret;

	dbg("s3c24xx_serial_startup: port=%p (%08lx,%p)\n",
	    port->mapbase, port->membase);

	local_irq_save(flags);

	rx_enabled(port) = 1;

	ret = request_irq(RX_IRQ(port),
			  s3c24xx_serial_rx_chars, 0,
			  s3c24xx_serial_portname(port), ourport);

	if (ret != 0) {
		printk(KERN_ERR "cannot get irq %d\n", RX_IRQ(port));
		return ret;
	}

	ourport->rx_claimed = 1;

	dbg("requesting tx irq...\n");

	tx_enabled(port) = 1;

	ret = request_irq(TX_IRQ(port),
			  s3c24xx_serial_tx_chars, 0,
			  s3c24xx_serial_portname(port), ourport);

	if (ret) {
		printk(KERN_ERR "cannot get irq %d\n", TX_IRQ(port));
		goto err;
	}

	ourport->tx_claimed = 1;

	dbg("s3c24xx_serial_startup ok\n");

	/* the port reset code should have done the correct
	 * register setup for the port controls */

	local_irq_restore(flags);
	return ret;

 err:
	s3c24xx_serial_shutdown(port);
	local_irq_restore(flags);
	return ret;
}
コード例 #6
0
static int s3c_serial_startup(struct uart_port *port)
{
	struct s3c_uart_port *ourport = to_ourport(port);
	unsigned long flags;
	int ret;

	dbg("s3c_serial_startup: port=%p (%08lx,%p)\n",
	    port->mapbase, port->membase);

	local_irq_save(flags);

	rx_enabled(port) = 1;
	tx_enabled(port) = 1;
	
#ifdef UART_HAS_INTMSK
	uart_enable_irq(port, UART_TX_INT | UART_RX_INT);
	ret = request_irq(UART_IRQ(port), s3c_serial_interrupt, 0,
			  s3c_serial_portname(port), ourport);
	if (ret != 0) {
		printk(KERN_ERR "cannot get irq %d\n", UART_IRQ(port));
		return ret;
	}
#else
	ret = request_irq(RX_IRQ(port),
			  s3c_serial_rx_chars, 0,
			  s3c_serial_portname(port), ourport);
	if (ret != 0) {
		printk(KERN_ERR "cannot get irq %d\n", RX_IRQ(port));
		return ret;
	}

	ret = request_irq(TX_IRQ(port),
			  s3c_serial_tx_chars, 0,
			  s3c_serial_portname(port), ourport);
	if (ret) {
		printk(KERN_ERR "cannot get irq %d\n", TX_IRQ(port));
		s3c_serial_shutdown(port);
		local_irq_restore(flags);
		return ret;
	}
#endif

	ourport->rx_claimed = 1;
	ourport->tx_claimed = 1;

	dbg("s3c_serial_startup ok\n");

	/* the port reset code should have done the correct
	 * register setup for the port controls */
	local_irq_restore(flags);
	return ret;
}
コード例 #7
0
static void s3c_serial_shutdown(struct uart_port *port)
{
	struct s3c_uart_port *ourport = to_ourport(port);

#ifdef UART_HAS_INTMSK
	if (ourport->tx_claimed || ourport->rx_claimed) {
		free_irq(UART_IRQ(port), ourport);

		ourport->tx_claimed = 0;
		ourport->rx_claimed = 0;
		tx_enabled(port) = 0;
		rx_enabled(port) = 0;
	}
#else
	if (ourport->tx_claimed) {
		free_irq(TX_IRQ(port), ourport);
		tx_enabled(port) = 0;
		ourport->tx_claimed = 0;
	}

	if (ourport->rx_claimed) {
		free_irq(RX_IRQ(port), ourport);
		ourport->rx_claimed = 0;
		rx_enabled(port) = 0;
	}
#endif
}
コード例 #8
0
static void clps711xuart_stop_tx(struct uart_port *port)
{
	if (tx_enabled(port)) {
		disable_irq(TX_IRQ(port));
		tx_enabled(port) = 0;
	}
}
コード例 #9
0
ファイル: clps711x.c プロジェクト: AdrianHuang/linux-3.8.13
static irqreturn_t uart_clps711x_int_tx(int irq, void *dev_id)
{
	struct uart_port *port = dev_id;
	struct clps711x_port *s = dev_get_drvdata(port->dev);
	struct circ_buf *xmit = &port->state->xmit;

	if (port->x_char) {
		clps_writew(port->x_char, UARTDR(port));
		port->icount.tx++;
		port->x_char = 0;
		return IRQ_HANDLED;
	}

	if (uart_circ_empty(xmit) || uart_tx_stopped(port)) {
		disable_irq_nosync(TX_IRQ(port));
		s->tx_enabled[port->line] = 0;
		return IRQ_HANDLED;
	}

	while (!uart_circ_empty(xmit)) {
		clps_writew(xmit->buf[xmit->tail], UARTDR(port));
		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
		port->icount.tx++;
		if (clps_readl(SYSFLG(port) & SYSFLG_UTXFF))
			break;
	}

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

	return IRQ_HANDLED;
}
コード例 #10
0
static void clps711xuart_start_tx(struct uart_port *port)
{
	if (!tx_enabled(port)) {
		enable_irq(TX_IRQ(port));
		tx_enabled(port) = 1;
	}
}
コード例 #11
0
ファイル: clps711x.c プロジェクト: AdrianHuang/linux-3.8.13
static void uart_clps711x_shutdown(struct uart_port *port)
{
	/* Free the interrupts */
	devm_free_irq(port->dev, TX_IRQ(port), port);
	devm_free_irq(port->dev, RX_IRQ(port), port);

	/* Disable the port */
	clps_writel(clps_readl(SYSCON(port)) & ~SYSCON_UARTEN, SYSCON(port));
}
コード例 #12
0
ファイル: clps711x.c プロジェクト: AdrianHuang/linux-3.8.13
static void uart_clps711x_start_tx(struct uart_port *port)
{
	struct clps711x_port *s = dev_get_drvdata(port->dev);

	if (!s->tx_enabled[port->line]) {
		enable_irq(TX_IRQ(port));
		s->tx_enabled[port->line] = 1;
	}
}
コード例 #13
0
static void omahauart_shutdown(struct uart_port *port, struct uart_info *info)
{
	/*
	 * Free the interrupt
	 */
	free_irq(TX_IRQ(port), info);	/* TX interrupt */
	free_irq(RX_IRQ(port), info);	/* RX interrupt */

}
コード例 #14
0
static void s3c24xx_serial_stop_tx(struct uart_port *port)
{
	if (tx_enabled(port)) {
		disable_irq(TX_IRQ(port));
		tx_enabled(port) = 0;
		if (port->flags & UPF_CONS_FLOW)
			s3c24xx_serial_rx_enable(port);
	}
}
コード例 #15
0
static int s3c2440_startup(struct uart_port *port, struct uart_info *info)
{
	int retval, ucon, irq_name_num;
	char irq_name[3][3][20] = {{"s3c2440_uart0_rx", "s3c2440_uart0_tx", "s3c2440_uart0_err"},
				{"s3c2440_uart1_rx", "s3c2440_uart1_tx", "s3c2440_uart1_err"},
				{"s3c2440_uart2_rx", "s3c2440_uart2_tx", "s3c2440_uart2_err"}};
	
	if (RX_IRQ(port) == IRQ_RXD0)
		irq_name_num = 0;
	else if (RX_IRQ(port) == IRQ_RXD1)
		irq_name_num = 1;
	else if (RX_IRQ(port) == IRQ_RXD2)
		irq_name_num = 2;
	else
		return (1);

	retval = request_irq(RX_IRQ(port), s3c2440_rx_int, SA_INTERRUPT,
			     irq_name[irq_name_num][0], info);
	if (retval){
		return retval;
	}

	retval = request_irq(TX_IRQ(port), s3c2440_tx_int, SA_INTERRUPT,
			     irq_name[irq_name_num][1], info);
	if (retval) {
		free_irq (RX_IRQ(port), info);
		return retval;
	}

	retval = request_irq(ERR_IRQ(port), s3c2440_err_int, SA_INTERRUPT,
			     irq_name[irq_name_num][2], info);
	if (retval) {
		free_irq (RX_IRQ(port), info);
		free_irq (TX_IRQ(port), info);
		return retval;
	}

	ucon = (UCON_TX_INT_LVL | UCON_RX_INT_LVL |
	                UCON_TX_INT | UCON_RX_INT | UCON_RX_TIMEOUT);
	UART_PUT_UCON (port, ucon);

	return 0;
}
コード例 #16
0
ファイル: s3c2410.c プロジェクト: QiuLihua83/linux-2.6.10
static void
s3c24xx_serial_start_tx(struct uart_port *port, unsigned int tty_start)
{
	if (!tx_enabled(port)) {
		if (port->flags & UPF_CONS_FLOW)
			s3c24xx_serial_rx_disable(port);

		enable_irq(TX_IRQ(port));
		tx_enabled(port) = 1;
	}
}
コード例 #17
0
static void s3c_serial_stop_tx(struct uart_port *port)
{
	if (tx_enabled(port)) {
#ifdef UART_HAS_INTMSK
		uart_disable_irq(port, UART_TX_INT);
#else
		disable_irq(TX_IRQ(port));
#endif
		tx_enabled(port) = 0;
		if (port->flags & UPF_CONS_FLOW)
			s3c_serial_rx_enable(port);
	}
}
コード例 #18
0
static int omahauart_startup(struct uart_port *port, struct uart_info *info)
{
	unsigned int tmp;
	int retval;

	/*
	 * Allocate the IRQs
	 */
	retval = request_irq(TX_IRQ(port), omahauart_int_tx, 0, "omaha_uart_tx", info);
	if (retval)
		return retval;

	retval = request_irq(RX_IRQ(port), omahauart_int_rx, 0, "omaha_uart_rx", info);
	
	if (retval)
	{
		free_irq(TX_IRQ(port), info);
		return retval;
	}
	
	/*
	 * initialise the old status of the modem signals
	 */
	info->drv_old_status = 0;

	// Clear all errors
	writel(0, port->membase + OMAHA_UERSTAT);
	
	// Enable FIFO, 16-byte watermark, also do reset (auto-clearing)
	writel(0xF7, port->membase + OMAHA_UFCON);

	// Level driven TX/RX ints, with rx timeout enabled
	tmp = readl(port->membase + OMAHA_UCON);
	tmp |= 0x280; // rx is pulse driven...
	writel(tmp, port->membase + OMAHA_UCON);

	return 0;
}
コード例 #19
0
static void s3c24xx_serial_shutdown(struct uart_port *port)
{
	struct s3c24xx_uart_port *ourport = to_ourport(port);

	if (ourport->tx_claimed) {
		free_irq(TX_IRQ(port), ourport);
		tx_enabled(port) = 0;
		ourport->tx_claimed = 0;
	}

	if (ourport->rx_claimed) {
		free_irq(RX_IRQ(port), ourport);
		ourport->rx_claimed = 0;
		rx_enabled(port) = 0;
	}
}
コード例 #20
0
static void clps711xuart_shutdown(struct uart_port *port)
{
	unsigned int ubrlcr, syscon;

	/*
	 * Free the interrupt
	 */
	free_irq(TX_IRQ(port), port);	/* TX interrupt */
	free_irq(RX_IRQ(port), port);	/* RX interrupt */

	/*
	 * disable the port
	 */
	syscon = clps_readl(SYSCON(port));
	syscon &= ~SYSCON_UARTEN;
	clps_writel(syscon, SYSCON(port));

	/*
	 * disable break condition and fifos
	 */
	ubrlcr = clps_readl(UBRLCR(port));
	ubrlcr &= ~(UBRLCR_FIFOEN | UBRLCR_BREAK);
	clps_writel(ubrlcr, UBRLCR(port));
}
コード例 #21
0
static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id)
{
	struct uart_port *port = dev_id;
	struct circ_buf *xmit = &port->state->xmit;
	int count;

	if (port->x_char) {
		clps_writel(port->x_char, UARTDR(port));
		port->icount.tx++;
		port->x_char = 0;
		return IRQ_HANDLED;
	}

	if (uart_circ_empty(xmit) || uart_tx_stopped(port))
		goto disable_tx_irq;

	count = port->fifosize >> 1;
	do {
		clps_writel(xmit->buf[xmit->tail], UARTDR(port));
		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
		port->icount.tx++;
		if (uart_circ_empty(xmit))
			break;
	} while (--count > 0);

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

	if (uart_circ_empty(xmit)) {
	disable_tx_irq:
		disable_irq_nosync(TX_IRQ(port));
		tx_enabled(port) = 0;
	}

	return IRQ_HANDLED;
}
コード例 #22
0
static void omahauart_stop_tx(struct uart_port *port, u_int from_tty)
{
	disable_irq(TX_IRQ(port));
}
コード例 #23
0
static void omahauart_start_tx(struct uart_port *port, u_int nonempty, u_int from_tty)
{
	if (nonempty)
		enable_irq(TX_IRQ(port));
}
コード例 #24
0
ファイル: clps711x.c プロジェクト: AdrianHuang/linux-3.8.13
static int uart_clps711x_probe(struct platform_device *pdev)
{
	struct clps711x_port *s;
	int ret, i;

	s = devm_kzalloc(&pdev->dev, sizeof(struct clps711x_port), GFP_KERNEL);
	if (!s) {
		dev_err(&pdev->dev, "Error allocating port structure\n");
		return -ENOMEM;
	}
	platform_set_drvdata(pdev, s);

	s->uart_clk = devm_clk_get(&pdev->dev, "uart");
	if (IS_ERR(s->uart_clk)) {
		dev_err(&pdev->dev, "Can't get UART clocks\n");
		ret = PTR_ERR(s->uart_clk);
		goto err_out;
	}

	s->uart.owner		= THIS_MODULE;
	s->uart.dev_name	= "ttyCL";
	s->uart.major		= UART_CLPS711X_MAJOR;
	s->uart.minor		= UART_CLPS711X_MINOR;
	s->uart.nr		= UART_CLPS711X_NR;
#ifdef CONFIG_SERIAL_CLPS711X_CONSOLE
	s->uart.cons		= &s->console;
	s->uart.cons->device	= uart_console_device;
	s->uart.cons->write	= uart_clps711x_console_write;
	s->uart.cons->setup	= uart_clps711x_console_setup;
	s->uart.cons->flags	= CON_PRINTBUFFER;
	s->uart.cons->index	= -1;
	s->uart.cons->data	= s;
	strcpy(s->uart.cons->name, "ttyCL");
#endif
	ret = uart_register_driver(&s->uart);
	if (ret) {
		dev_err(&pdev->dev, "Registering UART driver failed\n");
		devm_clk_put(&pdev->dev, s->uart_clk);
		goto err_out;
	}

	for (i = 0; i < UART_CLPS711X_NR; i++) {
		s->port[i].line		= i;
		s->port[i].dev		= &pdev->dev;
		s->port[i].irq		= TX_IRQ(&s->port[i]);
		s->port[i].iobase	= SYSCON(&s->port[i]);
		s->port[i].type		= PORT_CLPS711X;
		s->port[i].fifosize	= 16;
		s->port[i].flags	= UPF_SKIP_TEST | UPF_FIXED_TYPE;
		s->port[i].uartclk	= clk_get_rate(s->uart_clk);
		s->port[i].ops		= &uart_clps711x_ops;
		WARN_ON(uart_add_one_port(&s->uart, &s->port[i]));
	}

	return 0;

err_out:
	platform_set_drvdata(pdev, NULL);

	return ret;
}
コード例 #25
0
static void s3c2440_stop_tx(struct uart_port *port, u_int from_tty)
{
	disable_irq (TX_IRQ(port));
	tx_irq_enabled = 0;
}
コード例 #26
0
/*
 * interrupts may not be disabled on entry
 */
static void s3c2440_start_tx(struct uart_port *port, u_int nonempty, u_int from_tty)
{
	if (!tx_irq_enabled)
		enable_irq (TX_IRQ(port));
	tx_irq_enabled = 1;
}
コード例 #27
0
static void s3c2440_shutdown(struct uart_port *port, struct uart_info *info)
{
	free_irq (RX_IRQ(port), info);
	free_irq (TX_IRQ(port), info);
	free_irq (ERR_IRQ(port), info);
}