Index: sys/arm/amlogic/aml8726/aml8726_machdep.c =================================================================== --- sys/arm/amlogic/aml8726/aml8726_machdep.c +++ sys/arm/amlogic/aml8726/aml8726_machdep.c @@ -38,6 +38,7 @@ #include #include +#include #include #include #include @@ -114,6 +115,19 @@ aml8726_identify_soc(); /* + * My aml8726-m3 development box identifies the CPU as a + * Cortex A9-r2 rev 4 and randomly locks up during boot + * when WFI is used. + */ + switch (aml8726_soc_hw_rev) { + case AML_SOC_HW_REV_M3: + cpu_do_powersave = 0; + break; + default: + break; + } + + /* * This FDT fixup should arguably be called through fdt_fixup_table, * however currently there's no mechanism to specify a fixup which * should always be invoked. Index: sys/arm/include/cpufunc.h =================================================================== --- sys/arm/include/cpufunc.h +++ sys/arm/include/cpufunc.h @@ -174,6 +174,7 @@ extern struct cpu_functions cpufuncs; extern u_int cputype; +extern int cpu_do_powersave; #define cpu_ident() cpufuncs.cf_id() #define cpu_cpwait() cpufuncs.cf_cpwait() @@ -260,7 +261,10 @@ #define cpu_flush_brnchtgt_C() cpufuncs.cf_flush_brnchtgt_C() #define cpu_flush_brnchtgt_E(e) cpufuncs.cf_flush_brnchtgt_E(e) -#define cpu_sleep(m) cpufuncs.cf_sleep(m) +#define cpu_sleep(m) do { \ + if (cpu_do_powersave) \ + cpufuncs.cf_sleep(m); \ +} while(0) #define cpu_dataabt_fixup(a) cpufuncs.cf_dataabt_fixup(a) #define cpu_prefetchabt_fixup(a) cpufuncs.cf_prefetchabt_fixup(a)