--- zzzz-none-000/linux-3.10.107/arch/mips/lantiq/prom.c 2017-06-27 09:49:32.000000000 +0000 +++ vr9-7490-729/linux-3.10.107/arch/mips/lantiq/prom.c 2021-11-10 11:53:54.000000000 +0000 @@ -12,6 +12,8 @@ #include #include +#include + #include #include @@ -39,7 +41,7 @@ { } -static void __init prom_init_cmdline(void) +void __init prom_init_cmdline(void) { int argc = fw_arg0; char **argv = (char **) KSEG1ADDR(fw_arg1); @@ -70,6 +72,39 @@ * Load the builtin devicetree. This causes the chosen node to be * parsed resulting in our memory appearing */ + + if (IS_ENABLED(CONFIG_AVM_ENHANCED)) { + char *subrev_str; + int subrev = 0; + + subrev_str = prom_getenv("HWSubRevision"); + if (subrev_str) { + if (sscanf(subrev_str, "%u", &subrev) != 1) + subrev_str = NULL; + } + if (!subrev_str) { + pr_emerg("%s: Unable to read AVM hardware " + "subrevision! Identity crisis... who am I?", + __func__); + } + + pr_emerg("%s: AVM hardware subrevision %d\n", __func__, + subrev); + + if (subrev > avm_subrev_max) { + pr_emerg("%s: Too many hardware subrevisions!\n", __func__); + panic(); + } + + __dtb_start = avm_kernel_config_device_tree[subrev]; + + if (!__dtb_start) { + pr_emerg("%s: Missing device-tree for AVM hardware " + "subrevision %d\n", __func__, subrev); + panic(); + } + } + __dt_setup_arch(&__dtb_start); }