#include <env.h>
#include <stdlib.h>
+DECLARE_GLOBAL_DATA_PTR;
+
#define DTB_DIR "rockchip/"
struct oga_model {
};
enum oga_device_id {
- OGA,
+ OGA = 1,
OGA_V11,
OGS,
};
},
};
-/* Detect which Odroid Go Advance device we are using so as to load the
- * correct devicetree for Linux. Set an environment variable once
- * found. The detection depends on the value of ADC channel 0.
- */
-int oga_detect_device(void)
+static int oga_read_board_id(void)
{
u32 adc_info;
- int ret, i;
- int board_id = -ENXIO;
+ int i, ret;
ret = adc_channel_single_shot("saradc@ff288000", 0, &adc_info);
if (ret) {
* accounted for this with a 5% tolerance, so assume a +- value
* of 50 should be enough.
*/
- for (i = 0; i < ARRAY_SIZE(oga_model_details); i++) {
+ for (i = 1; i < ARRAY_SIZE(oga_model_details); i++) {
u32 adc_min = oga_model_details[i].adc_value - 50;
u32 adc_max = oga_model_details[i].adc_value + 50;
- if (adc_min < adc_info && adc_max > adc_info) {
- board_id = i;
- break;
- }
+ if (adc_min < adc_info && adc_max > adc_info)
+ return i;
}
+ return -ENODEV;
+}
+
+/* Detect which Odroid Go Advance device we are using so as to load the
+ * correct devicetree for Linux. Set an environment variable once
+ * found. The detection depends on the value of ADC channel 0.
+ */
+static int oga_detect_device(void)
+{
+ int board_id;
+
+ board_id = oga_read_board_id();
if (board_id < 0)
return board_id;
+ gd->board_type = board_id;
env_set("board", oga_model_details[board_id].board);
- env_set("board_name",
- oga_model_details[board_id].board_name);
+ env_set("board_name", oga_model_details[board_id].board_name);
env_set("fdtfile", oga_model_details[board_id].fdtfile);
return 0;
return 0;
}
+
+int board_fit_config_name_match(const char *name)
+{
+ int board_id;
+
+ if (!gd->board_type) {
+ board_id = oga_read_board_id();
+ if (board_id < 0)
+ return board_id;
+ gd->board_type = board_id;
+ }
+
+ if (!strcmp(name, oga_model_details[gd->board_type].fdtfile))
+ return 0;
+
+ return -EINVAL;
+}
CONFIG_ENV_SIZE=0x4000
CONFIG_ENV_OFFSET=0x4000
CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3326-odroid-go2"
+CONFIG_OF_LIBFDT_OVERLAY=y
CONFIG_DM_RESET=y
CONFIG_ROCKCHIP_PX30=y
CONFIG_ROCKCHIP_RK8XX_DISABLE_BOOT_ON_POWERON=y
CONFIG_EFI_PARTITION_ENTRIES_NUMBERS=64
CONFIG_SPL_OF_CONTROL=y
CONFIG_OF_LIVE=y
+CONFIG_OF_LIST="rockchip/rk3326-odroid-go2 rockchip/rk3326-odroid-go2-v11 rockchip/rk3326-odroid-go3"
CONFIG_OF_SPL_REMOVE_PROPS="interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
CONFIG_ENV_IS_IN_MMC=y
CONFIG_SPL_DM_SEQ_ALIAS=y