firewall: update to git head
[openwrt.git] / target / linux / lantiq / patches-3.7 / 0100-MIPS-lantiq-honour-model-property-inside-devicetree-.patch
1 From 60bc3043590bf74ca1c9dd88a4e5f28a40d5b348 Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Thu, 6 Dec 2012 10:26:05 +0100
4 Subject: [PATCH 100/123] MIPS: lantiq: honour model property inside
5  devicetree during board init
6
7 ---
8  arch/mips/lantiq/prom.c |   20 ++++++++++++++++++--
9  1 file changed, 18 insertions(+), 2 deletions(-)
10
11 --- a/arch/mips/lantiq/prom.c
12 +++ b/arch/mips/lantiq/prom.c
13 @@ -57,6 +57,21 @@ static void __init prom_init_cmdline(voi
14         }
15  }
16  
17 +int __init early_init_dt_scan_model(unsigned long node,
18 +                                       const char *uname, int depth,
19 +                                       void *data)
20 +{
21 +       if (!depth) {
22 +               char *model = of_get_flat_dt_prop(node, "model", NULL);
23 +               if (model) {
24 +                       pr_info("Board: %s\n", model);
25 +                       snprintf(soc_info.sys_type, LTQ_SYS_TYPE_LEN, "%s - %s",
26 +                               soc_info.sys_type, model);
27 +               }
28 +       }
29 +       return 0;
30 +}
31 +
32  void __init plat_mem_setup(void)
33  {
34         ioport_resource.start = IOPORT_RESOURCE_START;
35 @@ -71,6 +86,8 @@ void __init plat_mem_setup(void)
36          * parsed resulting in our memory appearing
37          */
38         __dt_setup_arch(&__dtb_start);
39 +
40 +       of_scan_flat_dt(early_init_dt_scan_model, NULL);
41  }
42  
43  void __init device_tree_init(void)
44 @@ -93,9 +110,8 @@ void __init prom_init(void)
45  {
46         /* call the soc specific detetcion code and get it to fill soc_info */
47         ltq_soc_detect(&soc_info);
48 -       snprintf(soc_info.sys_type, LTQ_SYS_TYPE_LEN - 1, "%s rev %s",
49 +       snprintf(soc_info.sys_type, LTQ_SYS_TYPE_LEN, "%s rev %s",
50                 soc_info.name, soc_info.rev_type);
51 -       soc_info.sys_type[LTQ_SYS_TYPE_LEN - 1] = '\0';
52         pr_info("SoC: %s\n", soc_info.sys_type);
53         prom_init_cmdline();
54