msm8960: sglte baseband detect

Added support to detect sglte baseband.
Also moved the target specific detection code to target directory.

Change-Id: Iff8c8c538b14fc4d92091a28a62a9dcaec6b8e08
diff --git a/platform/msm_shared/board.c b/platform/msm_shared/board.c
index 0748837..c9d48bf 100644
--- a/platform/msm_shared/board.c
+++ b/platform/msm_shared/board.c
@@ -31,11 +31,13 @@
 #include <board.h>
 #include <smem.h>
 #include <baseband.h>
+#include <board.h>
 
 static struct board_data board = {UNKNOWN,
 	HW_PLATFORM_UNKNOWN,
 	HW_PLATFORM_SUBTYPE_UNKNOWN,
-	LINUX_MACHTYPE_UNKNOWN,};
+	LINUX_MACHTYPE_UNKNOWN,
+	BASEBAND_MSM};
 
 static void platform_detect()
 {
@@ -69,138 +71,24 @@
 	}
 }
 
-static void target_detect()
-{
-	unsigned platform_id;
-	unsigned platform_hw;
-	unsigned target_id;
-
-	platform_id = board.platform;
-	platform_hw = board.platform_hw;
-
-	/* Detect the board we are running on */
-	if ((platform_id == MSM8960) || (platform_id == MSM8660A)
-	    || (platform_id == MSM8260A) || (platform_id == APQ8060A)) {
-		switch (platform_hw) {
-		case HW_PLATFORM_SURF:
-			target_id = LINUX_MACHTYPE_8960_CDP;
-			break;
-		case HW_PLATFORM_MTP:
-			target_id = LINUX_MACHTYPE_8960_MTP;
-			break;
-		case HW_PLATFORM_FLUID:
-			target_id = LINUX_MACHTYPE_8960_FLUID;
-			break;
-		case HW_PLATFORM_LIQUID:
-			target_id = LINUX_MACHTYPE_8960_LIQUID;
-			break;
-		default:
-			target_id = LINUX_MACHTYPE_8960_CDP;
-		}
-	} else if ((platform_id == MSM8230) || (platform_id == MSM8630)
-		   || (platform_id == MSM8930) || (platform_id == APQ8030)) {
-		switch (platform_hw) {
-		case HW_PLATFORM_SURF:
-			target_id = LINUX_MACHTYPE_8930_CDP;
-			break;
-		case HW_PLATFORM_MTP:
-			target_id = LINUX_MACHTYPE_8930_MTP;
-			break;
-		case HW_PLATFORM_FLUID:
-			target_id = LINUX_MACHTYPE_8930_FLUID;
-			break;
-		default:
-			target_id = LINUX_MACHTYPE_8930_CDP;
-		}
-	} else if ((platform_id == MSM8227) || (platform_id == MSM8627)) {
-		switch (platform_hw) {
-		case HW_PLATFORM_SURF:
-			target_id = LINUX_MACHTYPE_8627_CDP;
-			break;
-		case HW_PLATFORM_MTP:
-			target_id = LINUX_MACHTYPE_8627_MTP;
-			break;
-		default:
-			target_id = LINUX_MACHTYPE_8627_CDP;
-		}
-	} else if (platform_id == MPQ8064) {
-		switch (platform_hw) {
-		case HW_PLATFORM_SURF:
-			target_id = LINUX_MACHTYPE_8064_MPQ_CDP;
-			break;
-		case HW_PLATFORM_HRD:
-			target_id = LINUX_MACHTYPE_8064_HRD;
-			break;
-		case HW_PLATFORM_DTV:
-			target_id = LINUX_MACHTYPE_8064_DTV;
-			break;
-		default:
-			target_id = LINUX_MACHTYPE_8064_MPQ_CDP;
-		}
-	} else if ((platform_id == APQ8064)) {
-		switch (platform_hw) {
-		case HW_PLATFORM_SURF:
-			target_id = LINUX_MACHTYPE_8064_CDP;
-			break;
-		case HW_PLATFORM_MTP:
-			target_id = LINUX_MACHTYPE_8064_MTP;
-			break;
-		case HW_PLATFORM_LIQUID:
-			target_id = LINUX_MACHTYPE_8064_LIQUID;
-			break;
-		default:
-			target_id = LINUX_MACHTYPE_8064_CDP;
-		}
-	} else {
-		dprintf(CRITICAL, "platform_id (%d) is not identified.\n",
-			platform_id);
-		ASSERT(0);
-	}
-	board.target = target_id;
-}
-
-static void baseband_detect()
-{
-	unsigned baseband = BASEBAND_MSM;
-	unsigned platform_subtype;
-	unsigned platform_id;
-
-	platform_id = board.platform;
-	platform_subtype = board.platform_subtype;
-
-	/* Check for MDM or APQ baseband variants.  Default to MSM */
-	if (platform_subtype == HW_PLATFORM_SUBTYPE_MDM)
-		baseband = BASEBAND_MDM;
-	else if (platform_id == APQ8060)
-		baseband = BASEBAND_APQ;
-	else if (platform_id == APQ8064)
-		baseband = BASEBAND_APQ;
-	else if (platform_id == MPQ8064)
-		baseband = BASEBAND_APQ;
-	else
-		baseband = BASEBAND_MSM;
-
-	board.baseband = baseband;
-}
-
 void board_init()
 {
 	platform_detect();
-	target_detect();
-	baseband_detect();
+	target_detect(&board);
+	target_baseband_detect(&board);
 }
 
-unsigned board_platform_id(void)
+uint32_t board_platform_id(void)
 {
 	return board.platform;
 }
 
-unsigned board_target_id()
+uint32_t board_target_id()
 {
 	return board.target;
 }
 
-unsigned board_baseband()
+uint32_t board_baseband()
 {
 	return board.baseband;
 }
diff --git a/platform/msm_shared/include/baseband.h b/platform/msm_shared/include/baseband.h
index 128da30..80f144a 100644
--- a/platform/msm_shared/include/baseband.h
+++ b/platform/msm_shared/include/baseband.h
@@ -36,6 +36,7 @@
 	BASEBAND_SVLTE1 = 3,
 	BASEBAND_SVLTE2A = 4,
 	BASEBAND_MDM = 5,
+	BASEBAND_SGLTE = 6,
 	BASEBAND_32BITS = 0x7FFFFFFF
 };
 
diff --git a/platform/msm_shared/include/board.h b/platform/msm_shared/include/board.h
index 59e19e3..40c0897 100644
--- a/platform/msm_shared/include/board.h
+++ b/platform/msm_shared/include/board.h
@@ -27,35 +27,10 @@
  *
  */
 
-#define LINUX_MACHTYPE_UNKNOWN      0
+#ifndef __BOARD_H
+#define __BOARD_H
 
-/* 8960 */
-#define LINUX_MACHTYPE_8960_SIM     3230
-#define LINUX_MACHTYPE_8960_RUMI3   3231
-#define LINUX_MACHTYPE_8960_CDP     3396
-#define LINUX_MACHTYPE_8960_MTP     3397
-#define LINUX_MACHTYPE_8960_FLUID   3398
-#define LINUX_MACHTYPE_8960_APQ     3399
-#define LINUX_MACHTYPE_8960_LIQUID  3535
-
-/* 8627 */
-#define LINUX_MACHTYPE_8627_CDP     3861
-#define LINUX_MACHTYPE_8627_MTP     3862
-
-/* 8930 */
-#define LINUX_MACHTYPE_8930_CDP     3727
-#define LINUX_MACHTYPE_8930_MTP     3728
-#define LINUX_MACHTYPE_8930_FLUID   3729
-
-/* 8064 */
-#define LINUX_MACHTYPE_8064_SIM     3572
-#define LINUX_MACHTYPE_8064_RUMI3   3679
-#define LINUX_MACHTYPE_8064_CDP     3948
-#define LINUX_MACHTYPE_8064_MTP     3949
-#define LINUX_MACHTYPE_8064_LIQUID  3951
-#define LINUX_MACHTYPE_8064_MPQ_CDP 3993
-#define LINUX_MACHTYPE_8064_HRD     3994
-#define LINUX_MACHTYPE_8064_DTV     3995
+#include <target/board.h>
 
 struct board_data {
 	uint32_t platform;
@@ -66,6 +41,10 @@
 };
 
 void board_init();
-unsigned board_platform_id();
-unsigned board_target_id();
-unsigned board_baseband();
+void target_detect(struct board_data *);
+void target_baseband_detect(struct board_data *);
+uint32_t board_platform_id();
+uint32_t board_target_id();
+uint32_t board_baseband();
+
+#endif
diff --git a/platform/msm_shared/smem.h b/platform/msm_shared/smem.h
index 269ae9f..1144d12 100644
--- a/platform/msm_shared/smem.h
+++ b/platform/msm_shared/smem.h
@@ -11,7 +11,7 @@
  *    notice, this list of conditions and the following disclaimer.
  *  * Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the 
+ *    the documentation and/or other materials provided with the
  *    distribution.
  *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
@@ -21,7 +21,7 @@
  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
@@ -204,6 +204,7 @@
 	HW_PLATFORM_SUBTYPE_CSFB = 1,
 	HW_PLATFORM_SUBTYPE_SVLTE1 = 2,
 	HW_PLATFORM_SUBTYPE_SVLTE2A = 3,
+	HW_PLATFORM_SUBTYPE_SGLTE = 6,
 	HW_PLATFORM_SUBTYPE_32BITS = 0x7FFFFFFF
 };