Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[wrt350n-kernel.git] / arch / powerpc / boot / fsl-soc.c
blobb835ed69e1a1c644f030a2c2224ffb63d17b55b6
1 /*
2 * Freescale SOC support functions
4 * Author: Scott Wood <scottwood@freescale.com>
6 * Copyright (c) 2007 Freescale Semiconductor, Inc.
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 as published
10 * by the Free Software Foundation.
13 #include "ops.h"
14 #include "types.h"
15 #include "fsl-soc.h"
16 #include "stdio.h"
18 static u32 prop_buf[MAX_PROP_LEN / 4];
20 u32 *fsl_get_immr(void)
22 void *soc;
23 unsigned long ret = 0;
25 soc = find_node_by_devtype(NULL, "soc");
26 if (soc) {
27 int size;
28 u32 naddr;
30 size = getprop(soc, "#address-cells", prop_buf, MAX_PROP_LEN);
31 if (size == 4)
32 naddr = prop_buf[0];
33 else
34 naddr = 2;
36 if (naddr != 1 && naddr != 2)
37 goto err;
39 size = getprop(soc, "ranges", prop_buf, MAX_PROP_LEN);
41 if (size < 12)
42 goto err;
43 if (prop_buf[0] != 0)
44 goto err;
45 if (naddr == 2 && prop_buf[1] != 0)
46 goto err;
48 if (!dt_xlate_addr(soc, prop_buf + naddr, 8, &ret))
49 ret = 0;
52 err:
53 if (!ret)
54 printf("fsl_get_immr: Failed to find immr base\r\n");
56 return (u32 *)ret;