mirror of
https://github.com/torvalds/linux.git
synced 2024-12-02 17:11:33 +00:00
MIPS: ingenic: Detect machtype from SoC compatible string
Previously, the mips_machtype variable was always initialized to MACH_INGENIC_JZ4740 even if running on different SoCs. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Reviewed-by: James Hogan <jhogan@kernel.org> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Maarten ter Huurne <maarten@treewalker.org> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/18486/ Signed-off-by: James Hogan <jhogan@kernel.org>
This commit is contained in:
parent
147b7910c8
commit
ce0d60f731
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
void __init prom_init(void)
|
void __init prom_init(void)
|
||||||
{
|
{
|
||||||
mips_machtype = MACH_INGENIC_JZ4740;
|
|
||||||
fw_init_cmdline();
|
fw_init_cmdline();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,6 +53,16 @@ static void __init jz4740_detect_mem(void)
|
|||||||
add_memory_region(0, size, BOOT_MEM_RAM);
|
add_memory_region(0, size, BOOT_MEM_RAM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned long __init get_board_mach_type(const void *fdt)
|
||||||
|
{
|
||||||
|
if (!fdt_node_check_compatible(fdt, 0, "ingenic,jz4780"))
|
||||||
|
return MACH_INGENIC_JZ4780;
|
||||||
|
if (!fdt_node_check_compatible(fdt, 0, "ingenic,jz4770"))
|
||||||
|
return MACH_INGENIC_JZ4770;
|
||||||
|
|
||||||
|
return MACH_INGENIC_JZ4740;
|
||||||
|
}
|
||||||
|
|
||||||
void __init plat_mem_setup(void)
|
void __init plat_mem_setup(void)
|
||||||
{
|
{
|
||||||
int offset;
|
int offset;
|
||||||
@ -63,6 +73,8 @@ void __init plat_mem_setup(void)
|
|||||||
offset = fdt_path_offset(__dtb_start, "/memory");
|
offset = fdt_path_offset(__dtb_start, "/memory");
|
||||||
if (offset < 0)
|
if (offset < 0)
|
||||||
jz4740_detect_mem();
|
jz4740_detect_mem();
|
||||||
|
|
||||||
|
mips_machtype = get_board_mach_type(__dtb_start);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __init device_tree_init(void)
|
void __init device_tree_init(void)
|
||||||
@ -75,10 +87,14 @@ void __init device_tree_init(void)
|
|||||||
|
|
||||||
const char *get_system_type(void)
|
const char *get_system_type(void)
|
||||||
{
|
{
|
||||||
if (IS_ENABLED(CONFIG_MACH_JZ4780))
|
switch (mips_machtype) {
|
||||||
|
case MACH_INGENIC_JZ4780:
|
||||||
return "JZ4780";
|
return "JZ4780";
|
||||||
|
case MACH_INGENIC_JZ4770:
|
||||||
return "JZ4740";
|
return "JZ4770";
|
||||||
|
default:
|
||||||
|
return "JZ4740";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void __init arch_init_irq(void)
|
void __init arch_init_irq(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user