diff --git a/board/hardkernel/odroidgou/odroidgou.c b/board/hardkernel/odroidgou/odroidgou.c index d08f0aac00..a9c6a13279 100755 --- a/board/hardkernel/odroidgou/odroidgou.c +++ b/board/hardkernel/odroidgou/odroidgou.c @@ -311,8 +311,29 @@ int board_late_init(void) gou_bmp_display(DISP_LOGO); #endif - setenv("variant", "gou"); - board_set_dtbfile("meson64_odroid%s.dtb"); +#define IS_RANGE(x, min, max) ((x) > (min) && (x) < (max)) + + int adc = get_adc_value(2); + int family = get_cpu_id().family_id; + int package = get_cpu_id().package_id; + printf("ADC:%d\n", adc); + printf("FAMILY:%d\n",family); + printf("PACKAGE:%d\n",package); + + /* Unfortunately while the ADC is available, both devices ADC values + are within the tolerance range of each other (IS_RANGE(adc, 510, 550) + therefor we need to use an alternative. The S922X SoC is 0x40 (64), + and the A311D SoC is 0x10 (16). */ + + if (package == 64) { + setenv("variant", "gou"); + setenv("fdtfile", "meson-g12b-odroid-go-ultra.dtb"); + } else { + setenv("variant", "max3"); + setenv("fdtfile", "meson-g12b-powkiddy-rgb10-max-3.dtb"); + } + + // board_set_dtbfile("meson64_odroid%s.dtb"); if (board_check_recovery() < 0) { gou_bmp_display(DISP_SYS_ERR); @@ -327,6 +348,8 @@ int board_late_init(void) } switch (get_bootmode()) { case BOOTMODE_RECOVERY : + setenv("variant", "gou"); + board_set_dtbfile("meson64_odroid%s.dtb"); gou_bmp_display(DISP_RECOVERY); mdelay(2000); break;