示例#1
0
static int s3c24xx_serial_resume(struct platform_device *dev)
{
    struct uart_port *port = s3c24xx_dev_to_port(&dev->dev);
    struct s3c24xx_uart_port *ourport = to_ourport(port);

    if (port) {
        clk_enable(ourport->clk);
        s3c24xx_serial_resetport(port, s3c24xx_port_to_cfg(port));
        clk_disable(ourport->clk);

        uart_resume_port(&s3c24xx_uart_drv, port);
    }

    return 0;
}
示例#2
0
int s3c24xx_serial_resume(struct device *dev, u32 level)
{
	struct uart_port *port = s3c24xx_dev_to_port(dev);
	struct s3c24xx_uart_port *ourport = to_ourport(port);

	if (port && level == RESUME_ENABLE) {
		clk_enable(ourport->clk);
		s3c24xx_serial_resetport(port, s3c24xx_port_to_cfg(port));
		clk_disable(ourport->clk);

		uart_resume_port(&s3c24xx_uart_drv, port);
	}

	return 0;
}
示例#3
0
static int s3c24xx_serial_resume(struct platform_device *dev)
{
	struct uart_port *port = s3c24xx_dev_to_port(&dev->dev);
	struct s3c24xx_uart_port *ourport = to_ourport(port);

	if (port) {
		clk_enable(ourport->clk);
		s3c24xx_serial_resetport(port, s3c24xx_port_to_cfg(port));
		clk_disable(ourport->clk);
		s3c_pm_do_restore(uart_save + port->line * SAVE_UART_PORT,
				SAVE_UART_PORT);
		uart_resume_port(&s3c24xx_uart_drv, port);
	}

	return 0;
}
示例#4
0
static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
                                    struct s3c24xx_uart_info *info,
                                    struct platform_device *platdev)
{
    struct uart_port *port = &ourport->port;
    struct s3c2410_uartcfg *cfg;
    struct resource *res;
    int ret;

    dbg("s3c24xx_serial_init_port: port=%p, platdev=%p\n", port, platdev);

    if (platdev == NULL)
        return -ENODEV;

    cfg = s3c24xx_dev_to_cfg(&platdev->dev);

    if (port->mapbase != 0)
        return 0;

    if (cfg->hwport > CONFIG_SERIAL_SAMSUNG_UARTS) {
        printk(KERN_ERR "%s: port %d bigger than %d\n", __func__,
               cfg->hwport, CONFIG_SERIAL_SAMSUNG_UARTS);
        return -ERANGE;
    }

    /* setup info for port */
    port->dev	= &platdev->dev;
    ourport->info	= info;

    /* copy the info in from provided structure */
    ourport->port.fifosize = info->fifosize;

    dbg("s3c24xx_serial_init_port: %p (hw %d)...\n", port, cfg->hwport);

    port->uartclk = 1;

    if (cfg->uart_flags & UPF_CONS_FLOW) {
        dbg("s3c24xx_serial_init_port: enabling flow control\n");
        port->flags |= UPF_CONS_FLOW;
    }

    /* sort our the physical and virtual addresses for each UART */

    res = platform_get_resource(platdev, IORESOURCE_MEM, 0);
    if (res == NULL) {
        printk(KERN_ERR "failed to find memory resource for uart\n");
        return -EINVAL;
    }

    dbg("resource %p (%lx..%lx)\n", res, res->start, res->end);

    port->mapbase = res->start;
    port->membase = S3C_VA_UART + res->start - (S3C_PA_UART & 0xfff00000);
    ret = platform_get_irq(platdev, 0);
    if (ret < 0)
        port->irq = 0;
    else {
        port->irq = ret;
        ourport->rx_irq = ret;
        ourport->tx_irq = ret + 1;
    }

    ret = platform_get_irq(platdev, 1);
    if (ret > 0)
        ourport->tx_irq = ret;

    ourport->clk	= clk_get(&platdev->dev, "uart");

    dbg("port: map=%08x, mem=%08x, irq=%d (%d,%d), clock=%ld\n",
        port->mapbase, port->membase, port->irq,
        ourport->rx_irq, ourport->tx_irq, port->uartclk);

    /* reset the fifos (and setup the uart) */
    s3c24xx_serial_resetport(port, cfg);
    return 0;
}
示例#5
0
static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
				    struct s3c24xx_uart_info *info,
				    struct platform_device *platdev)
{
	struct uart_port *port = &ourport->port;
	struct s3c2410_uartcfg *cfg;
	struct resource *res;

	dbg("s3c24xx_serial_init_port: port=%p, platdev=%p\n", port, platdev);

	if (platdev == NULL)
		return -ENODEV;

	cfg = s3c24xx_dev_to_cfg(&platdev->dev);

	if (port->mapbase != 0)
		return 0;

	if (cfg->hwport > 3)
		return -EINVAL;

	/* setup info for port */
	port->dev	= &platdev->dev;
	ourport->info	= info;

	/* copy the info in from provided structure */
	ourport->port.fifosize = info->fifosize;

	dbg("s3c24xx_serial_init_port: %p (hw %d)...\n", port, cfg->hwport);

	port->uartclk = 1;

	if (cfg->uart_flags & UPF_CONS_FLOW) {
		dbg("s3c24xx_serial_init_port: enabling flow control\n");
		port->flags |= UPF_CONS_FLOW;
	}

	/* sort our the physical and virtual addresses for each UART */

	res = platform_get_resource(platdev, IORESOURCE_MEM, 0);
	if (res == NULL) {
		printk(KERN_ERR "failed to find memory resource for uart\n");
		return -EINVAL;
	}

	dbg("resource %p (%lx..%lx)\n", res, res->start, res->end);

	port->mapbase	= res->start;
	port->membase	= S3C24XX_VA_UART + (res->start - S3C2410_PA_UART);
	port->irq	= platform_get_irq(platdev, 0);

	ourport->clk	= clk_get(&platdev->dev, "uart");

	if (ourport->clk != NULL && !IS_ERR(ourport->clk))
		clk_use(ourport->clk);

	dbg("port: map=%08x, mem=%08x, irq=%d, clock=%ld\n",
	    port->mapbase, port->membase, port->irq, port->uartclk);

	/* reset the fifos (and setup the uart) */
	s3c24xx_serial_resetport(port, cfg);
	return 0;
}