target: msm8994: Move boot device detection to common code

Boot device detection is common to all upcoming targets. So we can make
the code common instead of having target specific changes.

CRs-Fixed: 612217
Change-Id: Ic4f57af4baa48700929554674ad8dadfc57c6b7d
diff --git a/project/msm8994.mk b/project/msm8994.mk
index dbb392b..a53944b 100644
--- a/project/msm8994.mk
+++ b/project/msm8994.mk
@@ -10,6 +10,7 @@
 EMMC_BOOT := 1
 ENABLE_SDHCI_SUPPORT := 1
 ENABLE_UFS_SUPPORT   := 1
+ENABLE_BOOT_CONFIG_SUPPORT := 1
 
 #DEFINES += WITH_DEBUG_DCC=1
 DEFINES += WITH_DEBUG_UART=1
diff --git a/target/msm8994/init.c b/target/msm8994/init.c
index e9be0d6..5890110 100644
--- a/target/msm8994/init.c
+++ b/target/msm8994/init.c
@@ -52,6 +52,7 @@
 #include <platform/timer.h>
 #include <stdlib.h>
 #include <ufs.h>
+#include <boot_device.h>
 
 #define PMIC_ARB_CHANNEL_NUM    0
 #define PMIC_ARB_OWNER_ID       0
@@ -124,7 +125,7 @@
 
 void target_uninit(void)
 {
-	if (target_boot_device_emmc())
+	if (platform_boot_dev_isemmc())
 		mmc_put_card_to_sleep(dev);
 }
 
@@ -208,43 +209,9 @@
 	}
 }
 
-static uint32_t boot_device;
-static uint32_t target_read_boot_config()
-{
-	uint32_t val;
-
-	val = readl(BOOT_CONFIG_REG);
-
-	val = BOOT_DEVICE_MASK(val);
-
-	return val;
-}
-
-uint32_t target_get_boot_device()
-{
-	return boot_device;
-}
-
-/*
- * Return 1 if boot from emmc else 0
- */
-uint32_t target_boot_device_emmc()
-{
-	uint32_t boot_dev_type;
-
-	boot_dev_type = target_get_boot_device();
-
-	if (boot_dev_type == BOOT_EMMC || boot_dev_type == BOOT_DEFAULT)
-		boot_dev_type = 1;
-	else
-		boot_dev_type = 0;
-
-	return boot_dev_type;
-}
-
 void *target_mmc_device()
 {
-	if (target_boot_device_emmc())
+	if (platform_boot_dev_isemmc())
 		return (void *) dev;
 	else
 		return (void *) &ufs_device;
@@ -258,9 +225,9 @@
 
 	target_keystatus();
 
-	boot_device = target_read_boot_config();
+	platform_read_boot_config();
 
-	if (target_boot_device_emmc())
+	if (platform_boot_dev_isemmc())
 	{
 		target_sdc_init();
 	}