target: apq8084: Add support for baseband detection and device tree

Add baseband detection support. Update memory node in the
device tree with ddr partition info. Fix the rules.mk to remove unwanted
defines.

Change-Id: Ic9e5e0856fa9d521c9eff8d7bb1c721a75cce5d9
diff --git a/target/apq8084/init.c b/target/apq8084/init.c
index 1e03001..da3ca04 100644
--- a/target/apq8084/init.c
+++ b/target/apq8084/init.c
@@ -83,7 +83,7 @@
 		keys_post_event(KEY_VOLUMEUP, 1);
 }
 
-static target_mmc_mci_init()
+static void target_mmc_mci_init()
 {
 	uint32_t base_addr;
 	uint8_t slot;
@@ -142,7 +142,8 @@
 	 * Set drive strength & pull ctrl for
 	 * emmc
 	 */
-	set_sdc_power_ctrl();
+	/*Uncomment during bringup after the pull up values are finalized*/
+	//set_sdc_power_ctrl();
 
 	target_mmc_mci_init();
 
@@ -175,6 +176,34 @@
 /* Detect the modem type */
 void target_baseband_detect(struct board_data *board)
 {
+	uint32_t platform;
+	uint32_t platform_subtype;
+
+	platform = board->platform;
+	platform_subtype = board->platform_subtype;
+
+	/*
+	 * Look for platform subtype if present, else
+	 * check for platform type to decide on the
+	 * baseband type
+	 */
+	switch(platform_subtype) {
+	case HW_PLATFORM_SUBTYPE_UNKNOWN:
+		break;
+
+	default:
+		dprintf(CRITICAL, "Platform Subtype : %u is not supported\n",platform_subtype);
+		ASSERT(0);
+	};
+
+	switch(platform) {
+	case APQ8084:
+		board->baseband = BASEBAND_APQ;
+		break;
+	default:
+		dprintf(CRITICAL, "Platform type: %u is not supported\n",platform);
+		ASSERT(0);
+	}
 }
 
 unsigned target_baseband()
diff --git a/target/apq8084/meminfo.c b/target/apq8084/meminfo.c
index ed57e32..745657b 100644
--- a/target/apq8084/meminfo.c
+++ b/target/apq8084/meminfo.c
@@ -41,6 +41,39 @@
  */
 uint32_t target_dev_tree_mem(void *fdt, uint32_t memory_node_offset)
 {
+	struct smem_ram_ptable ram_ptable;
+	unsigned int i;
+	int ret = 0;
+
+	/* Make sure RAM partition table is initialized */
+	ASSERT(smem_ram_ptable_init(&ram_ptable));
+
+	/* Calculating the size of the mem_info_ptr */
+	for (i = 0 ; i < ram_ptable.len; i++)
+	{
+		if((ram_ptable.parts[i].category == SDRAM) &&
+			(ram_ptable.parts[i].type == SYS_MEMORY))
+		{
+
+			/* Pass along all other usable memory regions to Linux */
+			ret = dev_tree_add_mem_info(fdt,
+							memory_node_offset,
+							ram_ptable.parts[i].start,
+							ram_ptable.parts[i].size);
+
+			if (ret)
+			{
+				dprintf(CRITICAL, "Failed to add secondary banks memory addresses\n"
+);
+				goto target_dev_tree_mem_err;
+			}
+
+		}
+	}
+
+target_dev_tree_mem_err:
+
+	return ret;
 }
 
 void *target_get_scratch_address(void)
diff --git a/target/apq8084/rules.mk b/target/apq8084/rules.mk
index 777cf39..aa2abf1 100644
--- a/target/apq8084/rules.mk
+++ b/target/apq8084/rules.mk
@@ -7,14 +7,11 @@
 MEMBASE := 0x0F900000 # SDRAM
 MEMSIZE := 0x00100000 # 1MB
 
-BASE_ADDR        := 0x00000
+BASE_ADDR    := 0x0000000
 
-TAGS_ADDR        := BASE_ADDR+0x00000100
-KERNEL_ADDR      := BASE_ADDR+0x00008000
-RAMDISK_ADDR     := BASE_ADDR+0x01000000
-SCRATCH_ADDR     := 0xFF00000
+SCRATCH_ADDR := 0xFF00000
 
-DEFINES += DISPLAY_SPLASH_SCREEN=1
+DEFINES += DISPLAY_SPLASH_SCREEN=0
 DEFINES += DISPLAY_TYPE_MIPI=1
 DEFINES += DISPLAY_TYPE_DSI6G=1