diff options
author | Konrad Eisele <konrad@gaisler.com> | 2009-08-16 20:13:32 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-08-17 21:32:10 -0400 |
commit | e63829de3d03f92cea2b26119e0aa9a7043b9913 (patch) | |
tree | 0f0bbf2f86ef8a447e9b2a298662003602650e87 /arch/sparc/kernel/prom_32.c | |
parent | 0fd7ef1fe0e6e70c7851ce65a2eb8a8d3f49147e (diff) |
sparc,leon: Added support for AMBAPP bus.
The device is a AMBA bus if it is a child of prom node "ambapp" (AMBA
plug and play). Two functions
leon_trans_init() and leon_node_init() (defined in
sparc/kernel/leon_kernel.c) are called in the
prom_build_tree() path if CONFIG_SPARC_LEON is
defined. leon_node_init() will build up the device
tree using AMBA plug and play. Also: a extra check was addes to
prom_common.c:build_one_prop()
in case a rom-node is undefined which can happen for SPARC-LEON
because it creates only a minimum
nodes to emulate sparc behaviour.
Signed-off-by: Konrad Eisele <konrad@gaisler.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/kernel/prom_32.c')
-rw-r--r-- | arch/sparc/kernel/prom_32.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/arch/sparc/kernel/prom_32.c b/arch/sparc/kernel/prom_32.c index fe43e80772db..0a37e8cfd160 100644 --- a/arch/sparc/kernel/prom_32.c +++ b/arch/sparc/kernel/prom_32.c | |||
@@ -24,6 +24,8 @@ | |||
24 | 24 | ||
25 | #include <asm/prom.h> | 25 | #include <asm/prom.h> |
26 | #include <asm/oplib.h> | 26 | #include <asm/oplib.h> |
27 | #include <asm/leon.h> | ||
28 | #include <asm/leon_amba.h> | ||
27 | 29 | ||
28 | #include "prom.h" | 30 | #include "prom.h" |
29 | 31 | ||
@@ -131,6 +133,35 @@ static void __init ebus_path_component(struct device_node *dp, char *tmp_buf) | |||
131 | regs->which_io, regs->phys_addr); | 133 | regs->which_io, regs->phys_addr); |
132 | } | 134 | } |
133 | 135 | ||
136 | /* "name:vendor:device@irq,addrlo" */ | ||
137 | static void __init ambapp_path_component(struct device_node *dp, char *tmp_buf) | ||
138 | { | ||
139 | struct amba_prom_registers *regs; unsigned int *intr; | ||
140 | unsigned int *device, *vendor; | ||
141 | struct property *prop; | ||
142 | |||
143 | prop = of_find_property(dp, "reg", NULL); | ||
144 | if (!prop) | ||
145 | return; | ||
146 | regs = prop->value; | ||
147 | prop = of_find_property(dp, "interrupts", NULL); | ||
148 | if (!prop) | ||
149 | return; | ||
150 | intr = prop->value; | ||
151 | prop = of_find_property(dp, "vendor", NULL); | ||
152 | if (!prop) | ||
153 | return; | ||
154 | vendor = prop->value; | ||
155 | prop = of_find_property(dp, "device", NULL); | ||
156 | if (!prop) | ||
157 | return; | ||
158 | device = prop->value; | ||
159 | |||
160 | sprintf(tmp_buf, "%s:%d:%d@%x,%x", | ||
161 | dp->name, *vendor, *device, | ||
162 | *intr, regs->phys_addr); | ||
163 | } | ||
164 | |||
134 | static void __init __build_path_component(struct device_node *dp, char *tmp_buf) | 165 | static void __init __build_path_component(struct device_node *dp, char *tmp_buf) |
135 | { | 166 | { |
136 | struct device_node *parent = dp->parent; | 167 | struct device_node *parent = dp->parent; |
@@ -143,6 +174,8 @@ static void __init __build_path_component(struct device_node *dp, char *tmp_buf) | |||
143 | return sbus_path_component(dp, tmp_buf); | 174 | return sbus_path_component(dp, tmp_buf); |
144 | if (!strcmp(parent->type, "ebus")) | 175 | if (!strcmp(parent->type, "ebus")) |
145 | return ebus_path_component(dp, tmp_buf); | 176 | return ebus_path_component(dp, tmp_buf); |
177 | if (!strcmp(parent->type, "ambapp")) | ||
178 | return ambapp_path_component(dp, tmp_buf); | ||
146 | 179 | ||
147 | /* "isa" is handled with platform naming */ | 180 | /* "isa" is handled with platform naming */ |
148 | } | 181 | } |