aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/boot/cpm-serial.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurentp@cse-semaphore.com>2008-04-10 11:03:04 -0400
committerKumar Gala <galak@kernel.crashing.org>2008-04-17 02:01:37 -0400
commitda0a5f0c65913e4ec0a70a5019ce0a7bcaab21c9 (patch)
tree6aab633690a25acaf46d61416cff6a808deaad8d /arch/powerpc/boot/cpm-serial.c
parentd464df2667cf181419604e656773f80996cf0470 (diff)
[POWERPC] Add bootwrapper function to get virtual reg from the device tree.
This patch adds a new generic device tree processing function that retrieves virtual reg addresses from the device tree to the bootwrapper code. It also updates the bootwrapper code to use the new function. dt_get_virtual_reg() retrieves the virtual reg addresses from the "virtual-reg" property. If the property can't be found, it uses the "reg" property and walks the tree to translate it to absolute addresses. Signed-off-by: Laurent Pinchart <laurentp@cse-semaphore.com> Acked-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/boot/cpm-serial.c')
-rw-r--r--arch/powerpc/boot/cpm-serial.c34
1 files changed, 6 insertions, 28 deletions
diff --git a/arch/powerpc/boot/cpm-serial.c b/arch/powerpc/boot/cpm-serial.c
index 28296facb2ae..1f6225aad298 100644
--- a/arch/powerpc/boot/cpm-serial.c
+++ b/arch/powerpc/boot/cpm-serial.c
@@ -177,7 +177,6 @@ int cpm_console_init(void *devp, struct serial_console_data *scdp)
177{ 177{
178 void *reg_virt[2]; 178 void *reg_virt[2];
179 int is_smc = 0, is_cpm2 = 0, n; 179 int is_smc = 0, is_cpm2 = 0, n;
180 unsigned long reg_phys;
181 void *parent, *muram; 180 void *parent, *muram;
182 181
183 if (dt_is_compatible(devp, "fsl,cpm1-smc-uart")) { 182 if (dt_is_compatible(devp, "fsl,cpm1-smc-uart")) {
@@ -206,15 +205,8 @@ int cpm_console_init(void *devp, struct serial_console_data *scdp)
206 if (n < 4) 205 if (n < 4)
207 return -1; 206 return -1;
208 207
209 n = getprop(devp, "virtual-reg", reg_virt, sizeof(reg_virt)); 208 if (dt_get_virtual_reg(devp, reg_virt, 2) < 2)
210 if (n < (int)sizeof(reg_virt)) { 209 return -1;
211 for (n = 0; n < 2; n++) {
212 if (!dt_xlate_reg(devp, n, &reg_phys, NULL))
213 return -1;
214
215 reg_virt[n] = (void *)reg_phys;
216 }
217 }
218 210
219 if (is_smc) 211 if (is_smc)
220 smc = reg_virt[0]; 212 smc = reg_virt[0];
@@ -227,15 +219,8 @@ int cpm_console_init(void *devp, struct serial_console_data *scdp)
227 if (!parent) 219 if (!parent)
228 return -1; 220 return -1;
229 221
230 n = getprop(parent, "virtual-reg", reg_virt, sizeof(reg_virt)); 222 if (dt_get_virtual_reg(parent, &cpcr, 1) < 1)
231 if (n < (int)sizeof(reg_virt)) { 223 return -1;
232 if (!dt_xlate_reg(parent, 0, &reg_phys, NULL))
233 return -1;
234
235 reg_virt[0] = (void *)reg_phys;
236 }
237
238 cpcr = reg_virt[0];
239 224
240 muram = finddevice("/soc/cpm/muram/data"); 225 muram = finddevice("/soc/cpm/muram/data");
241 if (!muram) 226 if (!muram)
@@ -246,15 +231,8 @@ int cpm_console_init(void *devp, struct serial_console_data *scdp)
246 * is one for both parent and child. 231 * is one for both parent and child.
247 */ 232 */
248 233
249 n = getprop(muram, "virtual-reg", reg_virt, sizeof(reg_virt)); 234 if (dt_get_virtual_reg(muram, (void **)&muram_start, 1) < 1)
250 if (n < (int)sizeof(reg_virt)) { 235 return -1;
251 if (!dt_xlate_reg(muram, 0, &reg_phys, NULL))
252 return -1;
253
254 reg_virt[0] = (void *)reg_phys;
255 }
256
257 muram_start = reg_virt[0];
258 236
259 n = getprop(muram, "reg", &muram_offset, 4); 237 n = getprop(muram, "reg", &muram_offset, 4);
260 if (n < 4) 238 if (n < 4)