[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit
Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/boot/common/src/loader/drivers/flash.c b/boot/common/src/loader/drivers/flash.c
new file mode 100755
index 0000000..75d5dd7
--- /dev/null
+++ b/boot/common/src/loader/drivers/flash.c
@@ -0,0 +1,50 @@
+/*
+ * (C) Copyright 2016 ZXIC Inc.
+ */
+#include <asm/io.h>
+#include <asm/arch/top_clock.h>
+
+#include "flash.h"
+
+struct flash_type flash;
+
+/*
+ ******************************************************************************
+ * Function:
+ * Description:
+ * Parameters:
+ * Input:
+ * Output:
+ * Returns:
+ * Others:
+ *******************************************************************************
+ */
+char get_boot_mode(void)
+{
+ char boot_info = 0;
+
+ boot_info = readl(BOOTSEL_INFO);
+
+ if(((boot_info >> 4)&0x3) == 0x3)
+ {
+ return NOR_BOOT;
+ }
+ else
+ {
+ if(((boot_info & 0x7) == 0x0) || ((boot_info & 0x7) == 0x1))
+ {
+ return NAND_BOOT;
+ }
+ else if(((boot_info & 0x7) == 0x4) || ((boot_info & 0x7) == 0x5))
+ {
+ return SPI_NAND_BOOT;
+ }
+ else
+ {
+ return OTHER_BOOT;
+ }
+ }
+}
+
+
+