Merge "target: msm8226: add support for command mode display."
diff --git a/platform/init.c b/platform/init.c
index be48ad6..a809501 100644
--- a/platform/init.c
+++ b/platform/init.c
@@ -92,6 +92,12 @@
{
}
-__WEAK void bs_set_timestamp(enum bs_entry bs_id)
+__WEAK addr_t get_bs_info_addr()
{
+ return NULL;
+}
+
+__WEAK uint32_t platform_get_sclk_count(void)
+{
+ return 0;
}
diff --git a/platform/mdm9x25/platform.c b/platform/mdm9x25/platform.c
index e499601..71478de 100644
--- a/platform/mdm9x25/platform.c
+++ b/platform/mdm9x25/platform.c
@@ -105,38 +105,20 @@
dprintf(INFO, "platform_init()\n");
}
-static uint32_t platform_get_sclk_count(void)
+uint32_t platform_get_sclk_count(void)
{
return readl(MPM2_MPM_SLEEP_TIMETICK_COUNT_VAL);
}
-static uint32_t kernel_load_start;
-void bs_set_timestamp(enum bs_entry bs_id)
+addr_t get_bs_info_addr()
{
- void *bs_imem;
uint32_t soc_ver = board_soc_version();
- if (bs_id >= BS_MAX) {
- dprintf(CRITICAL, "bad bs id: %u, max: %u\n", bs_id, BS_MAX);
- ASSERT(0);
- }
-
- if (bs_id == BS_KERNEL_LOAD_START) {
- kernel_load_start = platform_get_sclk_count();
- return;
- }
-
if (soc_ver < BOARD_SOC_VERSION2)
- bs_imem = (void *)BS_INFO_ADDR_V1;
+ return ((addr_t)BS_INFO_ADDR_V1);
else
- bs_imem = (void *)BS_INFO_ADDR_V2;
+ return ((addr_t)BS_INFO_ADDR_V2);
- if(bs_id == BS_KERNEL_LOAD_DONE)
- writel(platform_get_sclk_count() - kernel_load_start,
- bs_imem + (sizeof(uint32_t) * BS_KERNEL_LOAD_TIME));
- else
- writel(platform_get_sclk_count(),
- bs_imem + (sizeof(uint32_t) * bs_id));
}
void platform_uninit(void)
diff --git a/platform/msm8226/include/platform/iomap.h b/platform/msm8226/include/platform/iomap.h
index 4d1cac7..36756ba 100644
--- a/platform/msm8226/include/platform/iomap.h
+++ b/platform/msm8226/include/platform/iomap.h
@@ -45,6 +45,10 @@
#define DLOAD_MODE_ADDR (MSM_SHARED_IMEM_BASE + 0x0)
#define EMERGENCY_DLOAD_MODE_ADDR (MSM_SHARED_IMEM_BASE + 0xFE0)
+#define BS_INFO_OFFSET (0x6B0)
+#define BS_INFO_ADDR (MSM_SHARED_IMEM_BASE + BS_INFO_OFFSET)
+#define MPM2_MPM_SLEEP_TIMETICK_COUNT_VAL 0xFC4A3000
+
#define MSM_GIC_DIST_BASE APPS_SS_BASE
#define MSM_GIC_CPU_BASE (APPS_SS_BASE + 0x2000)
#define APPS_APCS_QTMR_AC_BASE (APPS_SS_BASE + 0x00020000)
diff --git a/platform/msm8226/platform.c b/platform/msm8226/platform.c
index a89e63b..3a25699 100644
--- a/platform/msm8226/platform.c
+++ b/platform/msm8226/platform.c
@@ -36,6 +36,7 @@
#include <arch/arm/mmu.h>
#include <smem.h>
#include <board.h>
+#include <boot_stats.h>
#define MB (1024*1024)
@@ -79,6 +80,16 @@
qtimer_uninit();
}
+uint32_t platform_get_sclk_count(void)
+{
+ return readl(MPM2_MPM_SLEEP_TIMETICK_COUNT_VAL);
+}
+
+addr_t get_bs_info_addr()
+{
+ return ((addr_t)BS_INFO_ADDR);
+}
+
/* Setup memory for this platform */
void platform_init_mmu_mappings(void)
{
diff --git a/platform/msm8974/platform.c b/platform/msm8974/platform.c
index 8dc88f7..be35f84 100644
--- a/platform/msm8974/platform.c
+++ b/platform/msm8974/platform.c
@@ -82,38 +82,20 @@
dprintf(INFO, "platform_init()\n");
}
-static uint32_t platform_get_sclk_count(void)
+uint32_t platform_get_sclk_count(void)
{
return readl(MPM2_MPM_SLEEP_TIMETICK_COUNT_VAL);
}
-static uint32_t kernel_load_start;
-void bs_set_timestamp(enum bs_entry bs_id)
+addr_t get_bs_info_addr()
{
- void *bs_imem;
uint32_t soc_ver = board_soc_version();
- if (bs_id >= BS_MAX) {
- dprintf(CRITICAL, "bad bs id: %u, max: %u\n", bs_id, BS_MAX);
- ASSERT(0);
- }
-
- if (bs_id == BS_KERNEL_LOAD_START) {
- kernel_load_start = platform_get_sclk_count();
- return;
- }
-
if (soc_ver < BOARD_SOC_VERSION2)
- bs_imem = (void *)BS_INFO_ADDR_V1;
+ return ((addr_t)BS_INFO_ADDR_V1);
else
- bs_imem = (void *)BS_INFO_ADDR_V2;
+ return ((addr_t)BS_INFO_ADDR_V2);
- if(bs_id == BS_KERNEL_LOAD_DONE)
- writel(platform_get_sclk_count() - kernel_load_start,
- bs_imem + (sizeof(uint32_t) * BS_KERNEL_LOAD_TIME));
- else
- writel(platform_get_sclk_count(),
- bs_imem + (sizeof(uint32_t) * bs_id));
}
void platform_uninit(void)
diff --git a/platform/msm_shared/boot_stats.c b/platform/msm_shared/boot_stats.c
new file mode 100644
index 0000000..551000e
--- /dev/null
+++ b/platform/msm_shared/boot_stats.c
@@ -0,0 +1,66 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * 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 distribution.
+ * * Neither the name of The Linux Foundation. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE 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 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 SUCH DAMAGE.
+ */
+
+#include <boot_stats.h>
+#include <debug.h>
+#include <reg.h>
+#include <platform/iomap.h>
+
+static uint32_t kernel_load_start;
+void bs_set_timestamp(enum bs_entry bs_id)
+{
+ addr_t bs_imem = get_bs_info_addr();
+ uint32_t clk_count = 0;
+
+ if(bs_imem) {
+ if (bs_id >= BS_MAX) {
+ dprintf(CRITICAL, "bad bs id: %u, max: %u\n", bs_id, BS_MAX);
+ ASSERT(0);
+ }
+
+ if (bs_id == BS_KERNEL_LOAD_START) {
+ kernel_load_start = platform_get_sclk_count();
+ return;
+ }
+
+ if(bs_id == BS_KERNEL_LOAD_DONE){
+ clk_count = platform_get_sclk_count();
+ if(clk_count){
+ writel(clk_count - kernel_load_start,
+ bs_imem + (sizeof(uint32_t) * BS_KERNEL_LOAD_TIME));
+ }
+ }
+ else{
+ clk_count = platform_get_sclk_count();
+ if(clk_count){
+ writel(clk_count,
+ bs_imem + (sizeof(uint32_t) * bs_id));
+ }
+ }
+ }
+}
diff --git a/include/boot_stats.h b/platform/msm_shared/include/boot_stats.h
similarity index 100%
rename from include/boot_stats.h
rename to platform/msm_shared/include/boot_stats.h
diff --git a/platform/msm_shared/rules.mk b/platform/msm_shared/rules.mk
index 8de7e2e..3c8009f 100644
--- a/platform/msm_shared/rules.mk
+++ b/platform/msm_shared/rules.mk
@@ -13,7 +13,8 @@
$(LOCAL_DIR)/hsusb.o \
$(LOCAL_DIR)/jtag_hook.o \
$(LOCAL_DIR)/jtag.o \
- $(LOCAL_DIR)/partition_parser.o
+ $(LOCAL_DIR)/partition_parser.o \
+ $(LOCAL_DIR)/boot_stats.o
ifeq ($(ENABLE_SDHCI_SUPPORT),1)
OBJS += \
diff --git a/platform/msm_shared/sdhci.c b/platform/msm_shared/sdhci.c
index 21e3097..417e0eb 100644
--- a/platform/msm_shared/sdhci.c
+++ b/platform/msm_shared/sdhci.c
@@ -493,7 +493,7 @@
}
sg_list[0].addr = (uint32_t)data;
- sg_list[0].len = len;
+ sg_list[0].len = (len < SDHCI_ADMA_DESC_LINE_SZ) ? len : (SDHCI_ADMA_DESC_LINE_SZ & 0xffff);
sg_list[0].tran_att = SDHCI_ADMA_TRANS_VALID | SDHCI_ADMA_TRANS_DATA
| SDHCI_ADMA_TRANS_END;
@@ -527,7 +527,13 @@
*/
for (i = 0; i < (sg_len - 1); i++) {
sg_list[i].addr = (uint32_t)data;
- sg_list[i].len = SDHCI_ADMA_DESC_LINE_SZ;
+ /*
+ * Length attribute is 16 bit value & max transfer size for one
+ * descriptor line is 65536 bytes, As per SD Spec3.0 'len = 0'
+ * implies 65536 bytes. Truncate the length to limit to 16 bit
+ * range.
+ */
+ sg_list[i].len = (SDHCI_ADMA_DESC_LINE_SZ & 0xffff);
sg_list[i].tran_att = SDHCI_ADMA_TRANS_VALID | SDHCI_ADMA_TRANS_DATA;
data += SDHCI_ADMA_DESC_LINE_SZ;
len -= SDHCI_ADMA_DESC_LINE_SZ;
@@ -537,7 +543,7 @@
* attributes
*/
sg_list[sg_len - 1].addr = (uint32_t)data;
- sg_list[sg_len - 1].len = len;
+ sg_list[sg_len - 1].len = (len < SDHCI_ADMA_DESC_LINE_SZ) ? len : (SDHCI_ADMA_DESC_LINE_SZ & 0xffff);
sg_list[sg_len - 1].tran_att = SDHCI_ADMA_TRANS_VALID | SDHCI_ADMA_TRANS_DATA |
SDHCI_ADMA_TRANS_END;
}
diff --git a/target/msm8974/init.c b/target/msm8974/init.c
index daa98b7..35e0add 100644
--- a/target/msm8974/init.c
+++ b/target/msm8974/init.c
@@ -216,6 +216,14 @@
ASSERT(0);
}
}
+
+ /*
+ * MMC initialization is complete, read the partition table info
+ */
+ if (partition_read_table()) {
+ dprintf(CRITICAL, "Error reading the partition table info\n");
+ ASSERT(0);
+ }
}
struct mmc_device *target_mmc_device()
@@ -307,14 +315,6 @@
#else
target_mmc_mci_init();
#endif
-
- /*
- * MMC initialization is complete, read the partition table info
- */
- if (partition_read_table()) {
- dprintf(CRITICAL, "Error reading the partition table info\n");
- ASSERT(0);
- }
}
unsigned board_machtype(void)
@@ -557,8 +557,13 @@
return 0;
}
-void target_usb_stop(void)
+void target_uninit(void)
{
+#if MMC_SDHCI_SUPPORT
+ mmc_put_card_to_sleep(dev);
+#else
+ mmc_put_card_to_sleep();
+#endif
#ifdef SSD_ENABLE
clock_ce_disable(SSD_CE_INSTANCE_1);
#endif