[generic/3.3]: refresh patches to -rc3
[openwrt.git] / target / linux / leon / patches / 005-avoid_openprom_duplicates.patch
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
5
6 Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
7 ---
8 arch/sparc/kernel/prom_32.c | 27 +++++++++++++++++++--------
9 1 files changed, 19 insertions(+), 8 deletions(-)
10
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)
16 {
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;
22 + int interrupt = 0;
23
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
26 + */
27 prop = of_find_property(dp, "reg", NULL);
28 - if (!prop)
29 - return;
30 - regs = prop->value;
31 + if (!prop) {
32 + reg0 = (unsigned int)dp->phandle;
33 + } else {
34 + regs = prop->value;
35 + reg0 = regs->phys_addr;
36 + }
37 +
38 + /* Not all cores have Interrupt */
39 prop = of_find_property(dp, "interrupts", NULL);
40 if (!prop)
41 - return;
42 - intr = prop->value;
43 + intr = &interrupt; /* IRQ0 does not exist */
44 + else
45 + intr = prop->value;
46 +
47 prop = of_find_property(dp, "vendor", NULL);
48 if (!prop)
49 return;
50 @@ -159,7 +170,7 @@ static void __init ambapp_path_component
51
52 sprintf(tmp_buf, "%s:%d:%d@%x,%x",
53 dp->name, *vendor, *device,
54 - *intr, regs->phys_addr);
55 + *intr, reg0);
56 }
57
58 static void __init __build_path_component(struct device_node *dp, char *tmp_buf)
This page took 0.04582 seconds and 5 git commands to generate.