board: amlogic: odroid: add runtime detection of the N2/N2+/C4/HC4 variants

Use the ADC channel 1 to check the hardware revision of the board and
detect the N2 vs. N2+ and the C4 vs. HC4 variants. Each of them use
different dtb file, so adjust fdtfile environment variable to the
detected variant.

The ADC min/max values for each variant are taken from the vendor code,
adjusted to the 12-bit ADC driver operation mode (vendor code use 10-bit
mode).

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
This commit is contained in:
Marek Szyprowski
2021-02-04 10:11:45 +01:00
committed by Neil Armstrong
parent 4547551aa0
commit 8bc780106c
5 changed files with 98 additions and 2 deletions

View File

@@ -5,3 +5,9 @@
*/
#include "meson-g12-common-u-boot.dtsi"
/* SARADC is needed for proper board variant detection */
&saradc {
status = "okay";
vref-supply = <&vddao_1v8>;
};

View File

@@ -12,6 +12,12 @@
snps,reset-active-low;
};
/* SARADC is needed for proper board variant detection */
&saradc {
status = "okay";
vref-supply = <&vddao_1v8>;
};
&tflash_vdd {
gpio = <&gpio_ao GPIOAO_3 GPIO_OPEN_DRAIN>;
};