1 From 486a578298b7ab45c3edfdce8d4feaef93c3229b Mon Sep 17 00:00:00 2001
2 From: Daniel Hellstrom <daniel@gaisler.com>
3 Date: Thu, 16 Sep 2010 11:15:37 +0200
4 Subject: [PATCH] SPARC/LEON: to avoid name duplicates in openprom fs when REG is not available the NAME now includes NODE ID when REG not present
6 Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
8 arch/sparc/kernel/prom_32.c | 27 +++++++++++++++++++--------
9 1 files changed, 19 insertions(+), 8 deletions(-)
11 --- a/arch/sparc/kernel/prom_32.c
12 +++ b/arch/sparc/kernel/prom_32.c
13 @@ -136,18 +136,29 @@ static void __init ebus_path_component(s
14 /* "name:vendor:device@irq,addrlo" */
15 static void __init ambapp_path_component(struct device_node *dp, char *tmp_buf)
17 - struct amba_prom_registers *regs; unsigned int *intr;
18 - unsigned int *device, *vendor;
19 + struct amba_prom_registers *regs;
20 + unsigned int *intr, *device, *vendor, reg0;
21 struct property *prop;
24 + /* In order to get a unique ID in the device tree (multiple AMBA devices
25 + * may have the same name) the node number is printed
27 prop = of_find_property(dp, "reg", NULL);
32 + reg0 = (unsigned int)dp->phandle;
35 + reg0 = regs->phys_addr;
38 + /* Not all cores have Interrupt */
39 prop = of_find_property(dp, "interrupts", NULL);
43 + intr = &interrupt; /* IRQ0 does not exist */
47 prop = of_find_property(dp, "vendor", NULL);
50 @@ -159,7 +170,7 @@ static void __init ambapp_path_component
52 sprintf(tmp_buf, "%s:%d:%d@%x,%x",
53 dp->name, *vendor, *device,
54 - *intr, regs->phys_addr);
58 static void __init __build_path_component(struct device_node *dp, char *tmp_buf)