aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/boot/cuboot-pq2.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/boot/cuboot-pq2.c')
-rw-r--r--arch/powerpc/boot/cuboot-pq2.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/arch/powerpc/boot/cuboot-pq2.c b/arch/powerpc/boot/cuboot-pq2.c
index b150bd4f1b73..d3d3388d552f 100644
--- a/arch/powerpc/boot/cuboot-pq2.c
+++ b/arch/powerpc/boot/cuboot-pq2.c
@@ -139,11 +139,11 @@ static void fixup_pci(void)
139 u32 *pci_regs[3]; 139 u32 *pci_regs[3];
140 u8 *soc_regs; 140 u8 *soc_regs;
141 int i, len; 141 int i, len;
142 void *ctrl_node, *bus_node, *parent_node, *soc_node; 142 void *node, *parent_node, *soc_node;
143 u32 naddr, nsize, bus_ph, mem_log2; 143 u32 naddr, nsize, mem_log2;
144 144
145 ctrl_node = finddevice("/soc/pci"); 145 node = finddevice("/pci");
146 if (!ctrl_node || !dt_is_compatible(ctrl_node, "fsl,pq2-pci")) 146 if (!node || !dt_is_compatible(node, "fsl,pq2-pci"))
147 return; 147 return;
148 148
149 soc_node = finddevice("/soc"); 149 soc_node = finddevice("/soc");
@@ -151,27 +151,18 @@ static void fixup_pci(void)
151 goto err; 151 goto err;
152 152
153 for (i = 0; i < 3; i++) 153 for (i = 0; i < 3; i++)
154 if (!dt_xlate_reg(ctrl_node, i, 154 if (!dt_xlate_reg(node, i,
155 (unsigned long *)&pci_regs[i], NULL)) 155 (unsigned long *)&pci_regs[i], NULL))
156 goto err; 156 goto err;
157 157
158 if (!dt_xlate_reg(soc_node, 0, (unsigned long *)&soc_regs, NULL)) 158 if (!dt_xlate_reg(soc_node, 0, (unsigned long *)&soc_regs, NULL))
159 goto err; 159 goto err;
160 160
161 len = getprop(ctrl_node, "fsl,bus", &bus_ph, 4); 161 dt_get_reg_format(node, &naddr, &nsize);
162 if (len != 4)
163 goto err;
164
165 bus_node = find_node_by_prop_value(NULL, "linux,phandle",
166 (char *)&bus_ph, 4);
167 if (!bus_node)
168 goto err;
169
170 dt_get_reg_format(bus_node, &naddr, &nsize);
171 if (naddr != 3 || nsize != 2) 162 if (naddr != 3 || nsize != 2)
172 goto err; 163 goto err;
173 164
174 parent_node = get_parent(bus_node); 165 parent_node = get_parent(node);
175 if (!parent_node) 166 if (!parent_node)
176 goto err; 167 goto err;
177 168
@@ -179,7 +170,7 @@ static void fixup_pci(void)
179 if (naddr != 1 || nsize != 1) 170 if (naddr != 1 || nsize != 1)
180 goto err; 171 goto err;
181 172
182 len = getprop(bus_node, "ranges", pci_ranges_buf, 173 len = getprop(node, "ranges", pci_ranges_buf,
183 sizeof(pci_ranges_buf)); 174 sizeof(pci_ranges_buf));
184 175
185 for (i = 0; i < len / sizeof(struct pci_range); i++) { 176 for (i = 0; i < len / sizeof(struct pci_range); i++) {