Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 146746
b: refs/heads/master
c: 08f8cb3
h: refs/heads/master
v: v3
  • Loading branch information
Magnus Damm authored and Paul Mundt committed May 8, 2009
1 parent d4f309d commit 1edee4b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 35 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7ed7e0711b3ff85b3e15591081b42f2af96d584b
refs/heads/master: 08f8cb315fdf9195b472aeb440ae65b189b151da
54 changes: 20 additions & 34 deletions trunk/drivers/serial/sh-sci.c
Original file line number Diff line number Diff line change
Expand Up @@ -994,9 +994,21 @@ static void sci_config_port(struct uart_port *port, int flags)

port->type = s->type;

if (port->flags & UPF_IOREMAP && !port->membase) {
if (port->membase)
return;

if (port->flags & UPF_IOREMAP) {
port->membase = ioremap_nocache(port->mapbase, 0x40);
dev_err(port->dev, "can't remap port#%d\n", port->line);

if (IS_ERR(port->membase))
dev_err(port->dev, "can't remap port#%d\n", port->line);
} else {
/*
* For the simple (and majority of) cases where we don't
* need to do any remapping, just cast the cookie
* directly.
*/
port->membase = (void __iomem *)port->mapbase;
}
}

Expand Down Expand Up @@ -1036,9 +1048,9 @@ static struct uart_ops sci_uart_ops = {
#endif
};

static int __devinit sci_init_single(struct sci_port *sci_port,
unsigned int index,
struct plat_sci_port *p)
static void __devinit sci_init_single(struct sci_port *sci_port,
unsigned int index,
struct plat_sci_port *p)
{
sci_port->port.ops = &sci_uart_ops;
sci_port->port.iotype = UPIO_MEM;
Expand Down Expand Up @@ -1069,31 +1081,13 @@ static int __devinit sci_init_single(struct sci_port *sci_port,
init_timer(&sci_port->break_timer);

sci_port->port.mapbase = p->mapbase;

if (p->mapbase && !p->membase) {
if (p->flags & UPF_IOREMAP) {
p->membase = ioremap_nocache(p->mapbase, 0x40);
if (IS_ERR(p->membase))
return PTR_ERR(p->membase);
} else {
/*
* For the simple (and majority of) cases
* where we don't need to do any remapping,
* just cast the cookie directly.
*/
p->membase = (void __iomem *)p->mapbase;
}
}

sci_port->port.membase = p->membase;

sci_port->port.irq = p->irqs[SCIx_TXI_IRQ];
sci_port->port.flags = p->flags;
sci_port->type = sci_port->port.type = p->type;

memcpy(&sci_port->irqs, &p->irqs, sizeof(p->irqs));

return 0;
}

#ifdef CONFIG_SERIAL_SH_SCI_CONSOLE
Expand Down Expand Up @@ -1163,8 +1157,7 @@ static int __init serial_console_setup(struct console *co, char *options)
sci_port->clk = clk_get(NULL, "module_clk");
#endif

if (port->flags & UPF_IOREMAP)
sci_config_port(port, 0);
sci_config_port(port, 0);

if (sci_port->enable)
sci_port->enable(port);
Expand Down Expand Up @@ -1258,18 +1251,11 @@ static int __devinit sci_probe_single(struct platform_device *dev,
}

sciport->port.dev = &dev->dev;
ret = sci_init_single(sciport, index, p);
if (ret)
return ret;
sci_init_single(sciport, index, p);

ret = uart_add_one_port(&sci_uart_driver, &sciport->port);

if (ret) {
if (p->flags & UPF_IOREMAP)
iounmap(p->membase);

if (ret)
return ret;
}

INIT_LIST_HEAD(&sciport->node);

Expand Down

0 comments on commit 1edee4b

Please sign in to comment.