int checkboard(void)
{
if (IS_ENABLED(CONFIG_BOARD_TYPES)) {
- const char *board_info = get_board_type();
+ const char *board_info;
+
+ if (IS_ENABLED(CONFIG_DISPLAY_BOARDINFO_LATE)) {
+ /*
+ * Printing type requires having revision, although
+ * this will succeed only if done late.
+ * Otherwise revision will be set in misc_init_r().
+ */
+ set_board_revision();
+ }
+
+ board_info = get_board_type();
if (board_info)
printf("Type: %s\n", board_info);
#ifdef CONFIG_MISC_INIT_R
int misc_init_r(void)
{
+ if (IS_ENABLED(CONFIG_BOARD_TYPES) &&
+ !IS_ENABLED(CONFIG_DISPLAY_BOARDINFO_LATE)) {
+ /*
+ * If revision was not set by late display boardinfo,
+ * set it here. At this point regulators should be already
+ * available.
+ */
+ set_board_revision();
+ }
+
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
set_board_info();
#endif
/**
* set_board_type() - set board type in gd->board_type.
- * As default type set EXYNOS5_BOARD_GENERIC, if detect Odroid,
- * then set its proper type.
+ * As default type set EXYNOS5_BOARD_GENERIC. If Odroid is detected,
+ * set its proper type based on device tree.
+ *
+ * This might be called early when some more specific ways to detect revision
+ * are not yet available.
*/
void set_board_type(void)
{
gd->board_type = of_match->data;
break;
}
+}
- /* If Odroid, then check its revision */
+/**
+ * set_board_revision() - set detailed board type in gd->board_type.
+ * Should be called when resources (e.g. regulators) are available
+ * so ADC can be used to detect the specific revision of a board.
+ */
+void set_board_revision(void)
+{
if (board_is_odroidxu3())
gd->board_type = odroid_get_board_type();
}
gd->board_type = ODROID_TYPE_U3;
}
+void set_board_revision(void)
+{
+ /*
+ * Revision already set by set_board_type() because it can be
+ * executed early.
+ */
+}
+
const char *get_board_type(void)
{
const char *board_type[] = {"u3", "x2"};
char *get_dfu_alt_boot(char *interface, char *devstr);
#endif
void set_board_type(void);
+void set_board_revision(void);
const char *get_board_type(void);
#endif /* __SAMSUNG_MISC_COMMON_H__ */