Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 227077
b: refs/heads/master
c: 35c64e5
h: refs/heads/master
i:
  227075: 9746323
v: v3
  • Loading branch information
Thomas Gleixner authored and Greg Kroah-Hartman committed Dec 16, 2010
1 parent 34a5560 commit b925849
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 30 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: 3f960dbb9dfe29ff283810624c4340c79fde87f5
refs/heads/master: 35c64e5d13c3d7d8c4ad061ad5e20498b9160c24
48 changes: 19 additions & 29 deletions trunk/drivers/serial/apbuart.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,54 +593,44 @@ static struct of_platform_driver grlib_apbuart_of_driver = {
};


static void grlib_apbuart_configure(void)
static int grlib_apbuart_configure(void)
{
static int enum_done;
struct device_node *np, *rp;
struct uart_port *port = NULL;
const u32 *prop;
int freq_khz;
int v = 0, d = 0;
unsigned int addr;
int irq, line;
struct amba_prom_registers *regs;

if (enum_done)
return;
int freq_khz, line = 0;

/* Get bus frequency */
rp = of_find_node_by_path("/");
if (!rp)
return -ENODEV;
rp = of_get_next_child(rp, NULL);
if (!rp)
return -ENODEV;
prop = of_get_property(rp, "clock-frequency", NULL);
if (!prop)
return -ENODEV;
freq_khz = *prop;

line = 0;
for_each_matching_node(np, apbuart_match) {
const int *irqs = of_get_property(np, "interrupts", NULL);
const struct amba_prom_registers *regs;
struct uart_port *port;
unsigned long addr;

int *vendor = (int *) of_get_property(np, "vendor", NULL);
int *device = (int *) of_get_property(np, "device", NULL);
int *irqs = (int *) of_get_property(np, "interrupts", NULL);
regs = (struct amba_prom_registers *)
of_get_property(np, "reg", NULL);

if (vendor)
v = *vendor;
if (device)
d = *device;
regs = of_get_property(np, "reg", NULL);

if (!irqs || !regs)
return;
return -ENODEV;

grlib_apbuart_nodes[line] = np;

addr = regs->phys_addr;
irq = *irqs;

port = &grlib_apbuart_ports[line];

port->mapbase = addr;
port->membase = ioremap(addr, sizeof(struct grlib_apbuart_regs_map));
port->irq = irq;
port->irq = *irqs;
port->iotype = UPIO_MEM;
port->ops = &grlib_apbuart_ops;
port->flags = UPF_BOOT_AUTOCONF;
Expand All @@ -652,20 +642,20 @@ static void grlib_apbuart_configure(void)
/* We support maximum UART_NR uarts ... */
if (line == UART_NR)
break;

}

enum_done = 1;

grlib_apbuart_driver.nr = grlib_apbuart_port_nr = line;
return line ? 0 : -ENODEV;
}

static int __init grlib_apbuart_init(void)
{
int ret;

/* Find all APBUARTS in device the tree and initialize their ports */
grlib_apbuart_configure();
ret = grlib_apbuart_configure();
if (ret)
return ret;

printk(KERN_INFO "Serial: GRLIB APBUART driver\n");

Expand Down

0 comments on commit b925849

Please sign in to comment.