arm: Retreive the machine name from the device tree
authorChristoffer Dall <christoffer.dall@linaro.org>
Wed, 29 Oct 2014 14:58:57 +0000 (15:58 +0100)
committerChristoffer Dall <christoffer.dall@linaro.org>
Sat, 13 Dec 2014 15:13:46 +0000 (16:13 +0100)
Instead of using the mdesc descriptive name for the userspace exported
machine name, use the name from the device tree file.  This is
particularly useful for multi-flavored device-tree driven boards like
the ranchu board using the mach-virt board files.

Note that this patch is not intended for newer kernels that rework all
of the mach-virt logic to let a non-board machine be virt by default,
but it is useful in the context of Linux v3.10-based Android kernels.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
arch/arm/include/asm/prom.h
arch/arm/kernel/devtree.c
arch/arm/kernel/setup.c

index a219227c3e43815417887e2425d2c900d856333e..eba15e01d249d23bb3c59f95c1748bf882d6a40b 100644 (file)
 
 #define HAVE_ARCH_DEVTREE_FIXUPS
 
+struct machine_desc;
+
 #ifdef CONFIG_OF
 
+extern const char * __init setup_machine_name_fdt(struct machine_desc *mdesc);
 extern struct machine_desc *setup_machine_fdt(unsigned int dt_phys);
 extern void arm_dt_memblock_reserve(void);
 extern void __init arm_dt_init_cpu_maps(void);
 
 #else /* CONFIG_OF */
+const char * __init setup_machine_name_fdt(struct machine_desc *mdesc)
+{
+       return mdesc->name;
+}
 
 static inline struct machine_desc *setup_machine_fdt(unsigned int dt_phys)
 {
index 5859c8bc727c4254bc7e8fa254a4271d6b214242..5f3c5674e05aa19e77ddfee671f30a482e3d62b5 100644 (file)
@@ -169,6 +169,14 @@ void __init arm_dt_init_cpu_maps(void)
        }
 }
 
+const char * __init setup_machine_name_fdt(struct machine_desc *mdesc)
+{
+       if (!initial_boot_params)
+               return mdesc->name;
+
+       return of_flat_dt_get_machine_name();
+}
+
 /**
  * setup_machine_fdt - Machine setup when an dtb was passed to the kernel
  * @dt_phys: physical address of dt blob
@@ -191,6 +199,7 @@ struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
        mdesc_best = (struct machine_desc *)&__mach_desc_GENERIC_DT;
 #endif
 
+       initial_boot_params = NULL;
        if (!dt_phys)
                return NULL;
 
index df81eaf3a4f77d5560cd087498530aafb8d815a2..b76b69eee1d5dacfa0750e92506e9f4aa95ee5cf 100644 (file)
@@ -765,7 +765,7 @@ void __init setup_arch(char **cmdline_p)
        if (!mdesc)
                mdesc = setup_machine_tags(__atags_pointer, __machine_arch_type);
        machine_desc = mdesc;
-       machine_name = mdesc->name;
+       machine_name = setup_machine_name_fdt(mdesc);
 
        setup_dma_zone(mdesc);