Merge "dev: wled: Fix write to power down delay bits"
diff --git a/AndroidBoot.mk b/AndroidBoot.mk
index b27a1a0..06647a9 100644
--- a/AndroidBoot.mk
+++ b/AndroidBoot.mk
@@ -25,6 +25,7 @@
ifneq ($(TARGET_BUILD_VARIANT),user)
DEVICE_STATUS := DEFAULT_UNLOCK=true
+ USER_BUILD_VARIANT=true
endif
ifeq ($(TARGET_BOARD_PLATFORM),msm8660)
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 1ebf2a6..b51d450 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -625,7 +625,7 @@
#if VERIFIED_BOOT
/* Write protect the device info */
- if (mmc_write_protect("devinfo", 1))
+ if (target_build_variant_user() && mmc_write_protect("devinfo", 1))
{
dprintf(INFO, "Failed to write protect dev info\n");
ASSERT(0);
@@ -2534,6 +2534,7 @@
struct fbimage *logo = NULL;
uint32_t blocksize;
uint32_t readsize;
+ uint32_t logosize;
uint32_t ptn_size;
index = partition_get_index("splash");
@@ -2550,12 +2551,12 @@
ptn_size = partition_get_size(index);
blocksize = mmc_get_device_blocksize();
- readsize = ROUNDUP(sizeof(logo->header), blocksize);
+ logosize = ROUNDUP(sizeof(logo->header), blocksize);
- logo = (struct fbimage *)memalign(CACHE_LINE, ROUNDUP(readsize, CACHE_LINE));
+ logo = (struct fbimage *)memalign(CACHE_LINE, ROUNDUP(logosize, CACHE_LINE));
ASSERT(logo);
- if (mmc_read(ptn, (uint32_t *) logo, readsize)) {
+ if (mmc_read(ptn, (uint32_t *) logo, logosize)) {
dprintf(CRITICAL, "ERROR: Cannot read splash image header\n");
goto err;
}
@@ -2580,7 +2581,7 @@
goto err;
}
- if (mmc_read(ptn + sizeof(logo->header),(uint32_t *)base, readsize)) {
+ if (mmc_read(ptn + logosize,(uint32_t *)base, readsize)) {
fbcon_clear();
dprintf(CRITICAL, "ERROR: Cannot read splash image from partition\n");
goto err;
diff --git a/arch/arm/cache-ops.S b/arch/arm/cache-ops.S
index 22d9a2b..cfcbaa4 100644
--- a/arch/arm/cache-ops.S
+++ b/arch/arm/cache-ops.S
@@ -328,6 +328,7 @@
/* void arch_flush_invalidate_cache_range(addr_t start, size_t len); */
FUNCTION(arch_clean_invalidate_cache_range)
+ dsb
add r2, r0, r1 // Calculate the end address
bic r0,#(CACHE_LINE-1) // Align start with cache line
0:
diff --git a/dev/fbcon/fbcon.c b/dev/fbcon/fbcon.c
index e95036e..ce79a3e 100644
--- a/dev/fbcon/fbcon.c
+++ b/dev/fbcon/fbcon.c
@@ -2,7 +2,7 @@
* Copyright (c) 2008, Google Inc.
* All rights reserved.
*
- * Copyright (c) 2009-2014, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2009-2015, 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
@@ -35,6 +35,7 @@
#include <splash.h>
#include <platform.h>
#include <string.h>
+#include <arch/ops.h>
#include "font5x12.h"
@@ -300,6 +301,8 @@
memcpy (config->base + ((image_base + (i * (config->width))) * bytes_per_bpp),
logo_base + (i * pitch * bytes_per_bpp), width * bytes_per_bpp);
}
+ /* Flush the contents to memory before giving the data to dma */
+ arch_clean_invalidate_cache_range((addr_t) config->base, (total_x * total_y * bytes_per_bpp));
}
fbcon_flush();
@@ -323,6 +326,8 @@
(header->height * bytes_per_bpp));
}
}
+ /* Flush the contents to memory before giving the data to dma */
+ arch_clean_invalidate_cache_range((addr_t) config->base, (total_x * total_y * bytes_per_bpp));
fbcon_flush();
#endif
}
diff --git a/dev/gcdb/display/gcdb_display.c b/dev/gcdb/display/gcdb_display.c
index 8e521b1..4a49b1b 100755
--- a/dev/gcdb/display/gcdb_display.c
+++ b/dev/gcdb/display/gcdb_display.c
@@ -210,6 +210,8 @@
goto splash_err;
}
+ mmc_set_lun(partition_get_lun(index));
+
blocksize = mmc_get_device_blocksize();
if (blocksize == 0) {
dprintf(CRITICAL, "ERROR:splash Partition invalid blocksize\n");
@@ -269,6 +271,8 @@
goto store_err;
}
+ mmc_set_lun(partition_get_lun(index));
+
ret = mmc_write(ptn, sizeof(uint32_t), &pinfo->dfps);
if (ret)
dprintf(CRITICAL, "mmc write failed!\n");
diff --git a/dev/gcdb/display/include/panel_hx8394d_qhd_video.h b/dev/gcdb/display/include/panel_hx8394d_qhd_video.h
index 82d3b41..c04fccb 100644
--- a/dev/gcdb/display/include/panel_hx8394d_qhd_video.h
+++ b/dev/gcdb/display/include/panel_hx8394d_qhd_video.h
@@ -207,6 +207,21 @@
};
#define HX8394D_QHD_VIDEO_ON_COMMAND 16
+static char hx8394d_qhd_video_off_cmd0[] = {
+ 0x28, 0x00, 0x05, 0x80
+};
+
+static char hx8394d_qhd_video_off_cmd1[] = {
+ 0x10, 0x00, 0x05, 0x80
+};
+
+static struct mipi_dsi_cmd hx8394d_qhd_video_off_command[] = {
+ {0x4, hx8394d_qhd_video_off_cmd0, 0x32},
+ {0x4, hx8394d_qhd_video_off_cmd1, 0x78}
+};
+
+#define HX8394D_QHD_VIDEO_OFF_COMMAND 2
+
static struct command_state hx8394d_qhd_video_state = {
0, 1
};
diff --git a/dev/pmic/pm8x41/include/pm8x41.h b/dev/pmic/pm8x41/include/pm8x41.h
index 717f09b..6e89f57 100644
--- a/dev/pmic/pm8x41/include/pm8x41.h
+++ b/dev/pmic/pm8x41/include/pm8x41.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2015, 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
@@ -219,6 +219,7 @@
uint32_t pm8x41_v2_resin_status();
uint32_t pm8x41_resin_status();
void pm8x41_reset_configure(uint8_t);
+void pm8994_reset_configure(uint8_t);
void pm8x41_v2_reset_configure(uint8_t);
int pm8x41_ldo_set_voltage(struct pm8x41_ldo *ldo, uint32_t voltage);
int pm8x41_ldo_control(struct pm8x41_ldo *ldo, uint8_t enable);
diff --git a/dev/pmic/pm8x41/pm8x41.c b/dev/pmic/pm8x41/pm8x41.c
index 5886161..1784534 100644
--- a/dev/pmic/pm8x41/pm8x41.c
+++ b/dev/pmic/pm8x41/pm8x41.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2015, 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
@@ -77,6 +77,24 @@
return val;
}
+/* SPMI helper function which takes slave id as the i/p */
+void pm8xxx_reg_write(uint8_t slave_id, uint32_t addr, uint8_t val)
+{
+ struct pmic_arb_cmd cmd;
+ struct pmic_arb_param param;
+
+ cmd.address = PERIPH_ID(addr);
+ cmd.offset = REG_OFFSET(addr);
+ cmd.slave_id = slave_id;
+
+ cmd.priority = 0;
+
+ param.buffer = &val;
+ param.size = 1;
+
+ pmic_arb_write_cmd(&cmd, ¶m);
+}
+
void pm8x41_reg_write(uint32_t addr, uint8_t val)
{
struct pmic_arb_cmd cmd;
@@ -333,6 +351,24 @@
return 0;
}
+void pm8994_reset_configure(uint8_t reset_type)
+{
+ /* Slave ID 14 is global slave ID for all the pmics */
+ uint8_t slave_id = 14;
+
+ /* disable PS_HOLD_RESET */
+ pm8xxx_reg_write(slave_id, PON_PS_HOLD_RESET_CTL2, 0x0);
+
+ /* Delay needed for disable to kick in. */
+ udelay(300);
+
+ /* configure reset type */
+ pm8xxx_reg_write(slave_id, PON_PS_HOLD_RESET_CTL, reset_type);
+
+ /* enable PS_HOLD_RESET */
+ pm8xxx_reg_write(slave_id, PON_PS_HOLD_RESET_CTL2, BIT(S2_RESET_EN_BIT));
+}
+
void pm8x41_v2_reset_configure(uint8_t reset_type)
{
uint8_t val;
diff --git a/include/string.h b/include/string.h
index 661e746..593ecf2 100644
--- a/include/string.h
+++ b/include/string.h
@@ -33,6 +33,8 @@
void *memchr (void const *, int, size_t) __PURE;
int memcmp (void const *, const void *, size_t) __PURE;
void *memcpy (void *, void const *, size_t);
+/* secure memcpy, does not copy beyong size of dest buffer*/
+size_t memscpy (void *, size_t, void const *, size_t);
void *memmove(void *, void const *, size_t);
void *memset (void *, int, size_t);
diff --git a/include/target.h b/include/target.h
index 4a2891c..772afdf 100644
--- a/include/target.h
+++ b/include/target.h
@@ -85,4 +85,5 @@
void ulpi_write(unsigned val, unsigned reg);
void target_crypto_init_params(void);
int target_cont_splash_screen(void);
+bool target_build_variant_user();
#endif
diff --git a/lib/libc/string/memscpy.c b/lib/libc/string/memscpy.c
new file mode 100644
index 0000000..3dd4d6b
--- /dev/null
+++ b/lib/libc/string/memscpy.c
@@ -0,0 +1,37 @@
+/* Copyright (c) 2015, 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 Fundation, Inc. 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 <string.h>
+
+size_t memscpy(void *dest, size_t dst_size, const void *src, size_t src_size)
+{
+ size_t copy_size = dst_size < src_size ? dst_size : src_size;
+ memcpy(dest, src, copy_size);
+ return copy_size;
+}
diff --git a/lib/libc/string/rules.mk b/lib/libc/string/rules.mk
index fc1ceb2..97a5db8 100644
--- a/lib/libc/string/rules.mk
+++ b/lib/libc/string/rules.mk
@@ -8,6 +8,7 @@
memcpy \
memmove \
memset \
+ memscpy \
strcat \
strchr \
strcmp \
diff --git a/platform/msm8916/platform.c b/platform/msm8916/platform.c
index 66c703f..4b646fe 100644
--- a/platform/msm8916/platform.c
+++ b/platform/msm8916/platform.c
@@ -44,7 +44,7 @@
#define A53_SS_SIZE ((A53_SS_END - A53_SS_BASE)/MB)
/* LK memory - cacheable, write through */
-#define LK_MEMORY (MMU_MEMORY_TYPE_NORMAL_WRITE_THROUGH | \
+#define LK_MEMORY (MMU_MEMORY_TYPE_NORMAL_WRITE_BACK_ALLOCATE | \
MMU_MEMORY_AP_READ_WRITE)
/* Peripherals - non-shared device */
@@ -55,6 +55,9 @@
#define COMMON_MEMORY (MMU_MEMORY_TYPE_NORMAL_WRITE_THROUGH | \
MMU_MEMORY_AP_READ_WRITE | MMU_MEMORY_XN)
+#define SCRATCH_MEMORY (MMU_MEMORY_TYPE_NORMAL_WRITE_BACK_ALLOCATE | \
+ MMU_MEMORY_AP_READ_WRITE | MMU_MEMORY_XN)
+
static mmu_section_t mmu_section_table[] = {
/* Physical addr, Virtual addr, Size (in MB), Flags */
{ MEMBASE, MEMBASE, (MEMSIZE / MB), LK_MEMORY},
@@ -63,7 +66,7 @@
{ SYSTEM_IMEM_BASE, SYSTEM_IMEM_BASE, 1, COMMON_MEMORY},
{ MSM_SHARED_BASE, MSM_SHARED_BASE, 1, COMMON_MEMORY},
{ BASE_ADDR, BASE_ADDR, 90, COMMON_MEMORY},
- { SCRATCH_ADDR, SCRATCH_ADDR, 256, COMMON_MEMORY},
+ { SCRATCH_ADDR, SCRATCH_ADDR, 256, SCRATCH_MEMORY},
{ BASE_ADDR_1, BASE_ADDR_1, 1024, COMMON_MEMORY},
};
diff --git a/platform/msm_shared/crypto5_eng.c b/platform/msm_shared/crypto5_eng.c
index 0f592f9..8caad79 100644
--- a/platform/msm_shared/crypto5_eng.c
+++ b/platform/msm_shared/crypto5_eng.c
@@ -139,6 +139,8 @@
#else
ret = (uint32_t)bam_add_cmd_element(&cmd_list_ptr, reg_addr, val, CE_WRITE_TYPE);
+ arch_clean_invalidate_cache_range((addr_t)&cmd_list_ptr, sizeof(struct cmd_element));
+
/* Enqueue the desc for the above command */
ret = bam_add_one_desc(bam_core,
CRYPTO_WRITE_PIPE_INDEX,
diff --git a/platform/msm_shared/hsusb.c b/platform/msm_shared/hsusb.c
index 839f301..0967cd1 100644
--- a/platform/msm_shared/hsusb.c
+++ b/platform/msm_shared/hsusb.c
@@ -2,7 +2,7 @@
* Copyright (c) 2008, Google Inc.
* All rights reserved.
*
- * Copyright (c) 2009-2014, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2009-2015, 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
@@ -183,6 +183,11 @@
ept->next = ept_list;
ept_list = ept;
+ arch_clean_invalidate_cache_range((addr_t) ept,
+ sizeof(struct udc_endpoint));
+ arch_clean_invalidate_cache_range((addr_t) ept->head,
+ sizeof(struct ept_queue_head));
+
DBG("ept%d %s @%p/%p max=%d bit=%x\n",
num, in ? "in" : "out", ept, ept->head, max_pkt, ept->bit);
@@ -525,6 +530,7 @@
DBG("setup_tx %p %d\n", buf, len);
memcpy(ep0req->buf, buf, len);
ep0req->buf = (void *)PA((addr_t)ep0req->buf);
+ arch_clean_invalidate_cache_range((addr_t)ep0req->buf, len);
ep0req->complete = ep0in_complete;
ep0req->length = len;
udc_request_queue(ep0in, ep0req);
@@ -541,6 +547,7 @@
arch_clean_invalidate_cache_range((addr_t) ept->head->setup_data,
sizeof(struct ept_queue_head));
memcpy(&s, ept->head->setup_data, sizeof(s));
+ arch_clean_invalidate_cache_range((addr_t)&s, sizeof(s));
writel(ept->bit, USB_ENDPTSETUPSTAT);
DBG("handle_setup type=0x%02x req=0x%02x val=%d idx=%d len=%d (%s)\n",
diff --git a/platform/msm_shared/mipi_dsi.c b/platform/msm_shared/mipi_dsi.c
index b18a508..f8ff3bb 100644
--- a/platform/msm_shared/mipi_dsi.c
+++ b/platform/msm_shared/mipi_dsi.c
@@ -41,6 +41,7 @@
#include <platform/timer.h>
#include <err.h>
#include <msm_panel.h>
+#include <arch/ops.h>
extern void mdp_disable(void);
extern int mipi_dsi_cmd_config(struct fbcon_config mipi_fb_cfg,
@@ -218,6 +219,7 @@
size = 4 - size;
size += cm->size;
memcpy((uint8_t *)off, (cm->payload), size);
+ arch_clean_invalidate_cache_range((addr_t)(off), size);
writel(off, ctl_base + DMA_CMD_OFFSET);
writel(size, ctl_base + DMA_CMD_LENGTH);
if (dual_dsi) {
@@ -824,6 +826,7 @@
goto mipi_cmds_error;
memcpy((void *)off, (cm->payload), cm->size);
+ arch_clean_invalidate_cache_range((addr_t)(off), size);
writel(off, DSI_DMA_CMD_OFFSET);
writel(cm->size, DSI_DMA_CMD_LENGTH); // reg 0x48 for this build
dsb();
diff --git a/platform/msm_shared/ucs.c b/platform/msm_shared/ucs.c
index f820734..3e7563a 100644
--- a/platform/msm_shared/ucs.c
+++ b/platform/msm_shared/ucs.c
@@ -394,6 +394,7 @@
/* Flush cdb to memory. */
dsb();
arch_invalidate_cache_range((addr_t) cdb_param, SCSI_CDB_PARAM_LEN);
+ arch_invalidate_cache_range((addr_t) param, sizeof(struct unmap_param_list));
memset((void*)&req_upiu, 0 , sizeof(struct scsi_req_build_type));
diff --git a/target/init.c b/target/init.c
index 9c850e5..97809cc 100644
--- a/target/init.c
+++ b/target/init.c
@@ -216,3 +216,13 @@
{
return DDR_CONFIG_VAL;
}
+
+/* Return Build variant */
+__WEAK bool target_build_variant_user()
+{
+#if USER_BUILD_VARIANT
+ return true;
+#else
+ return false;
+#endif
+}
diff --git a/target/mdm9640/init.c b/target/mdm9640/init.c
index 442d117..91c61ef 100644
--- a/target/mdm9640/init.c
+++ b/target/mdm9640/init.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2015, 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
@@ -83,7 +83,7 @@
#define LAST_NAND_PTN_LEN_PATTERN 0xFFFFFFFF
-#define EXT4_CMDLINE " rootfstype=ext4 root=/dev/mmcblk0p"
+#define EXT4_CMDLINE " rootwait rootfstype=ext4 root=/dev/mmcblk0p"
#define UBI_CMDLINE " rootfstype=ubifs rootflags=bulk_read ubi.fm_autoconvert=1"
struct qpic_nand_init_config config;
diff --git a/target/msm8909/oem_panel.c b/target/msm8909/oem_panel.c
index 50aad97..f7b5717 100644
--- a/target/msm8909/oem_panel.c
+++ b/target/msm8909/oem_panel.c
@@ -205,10 +205,14 @@
panelstruct->panelresetseq
= &truly_wvga_cmd_reset_seq;
panelstruct->backlightinfo = &truly_wvga_cmd_backlight;
- pinfo->mipi.panel_cmds
+ pinfo->mipi.panel_on_cmds
= truly_wvga_cmd_on_command;
- pinfo->mipi.num_of_panel_cmds
+ pinfo->mipi.num_of_panel_on_cmds
= TRULY_WVGA_CMD_ON_COMMAND;
+ pinfo->mipi.panel_off_cmds
+ = truly_wvga_cmd_off_command;
+ pinfo->mipi.num_of_panel_off_cmds
+ = TRULY_WVGA_CMD_OFF_COMMAND;
memcpy(phy_db->timing,
truly_wvga_cmd_timings, TIMING_SIZE);
break;
@@ -275,10 +279,14 @@
panelstruct->panelresetseq
= &hx8394d_qhd_video_panel_reset_seq;
panelstruct->backlightinfo = &hx8394d_qhd_video_backlight;
- pinfo->mipi.panel_cmds
+ pinfo->mipi.panel_on_cmds
= hx8394d_qhd_video_on_command;
- pinfo->mipi.num_of_panel_cmds
+ pinfo->mipi.num_of_panel_on_cmds
= HX8394D_QHD_VIDEO_ON_COMMAND;
+ pinfo->mipi.panel_off_cmds
+ = hx8394d_qhd_video_off_command;
+ pinfo->mipi.num_of_panel_off_cmds
+ = HX8394D_QHD_VIDEO_OFF_COMMAND;
memcpy(phy_db->timing,
hx8394d_qhd_video_timings, TIMING_SIZE);
pinfo->mipi.signature = HX8394D_QHD_VIDEO_SIGNATURE;
diff --git a/target/msm8916/init.c b/target/msm8916/init.c
index f1aff17..fbc45e4 100644
--- a/target/msm8916/init.c
+++ b/target/msm8916/init.c
@@ -481,7 +481,7 @@
if (is_cold_boot &&
(!(pon_reason & HARD_RST)) &&
(!(pon_reason & KPDPWR_N)) &&
- ((pon_reason & USB_CHG) || (pon_reason & DC_CHG)))
+ ((pon_reason & USB_CHG) || (pon_reason & DC_CHG) || (pon_reason & CBLPWR_N)))
return 1;
else
return 0;
diff --git a/target/msm8994/init.c b/target/msm8994/init.c
index 4e2e160..5df2874 100644
--- a/target/msm8994/init.c
+++ b/target/msm8994/init.c
@@ -455,7 +455,7 @@
else
reset_type = PON_PSHOLD_HARD_RESET;
- pm8x41_reset_configure(reset_type);
+ pm8994_reset_configure(reset_type);
/* Drop PS_HOLD for MSM */
writel(0x00, MPM2_MPM_PS_HOLD);
@@ -556,7 +556,7 @@
dprintf(CRITICAL, "Going down for shutdown.\n");
/* Configure PMIC for shutdown. */
- pm8x41_reset_configure(PON_PSHOLD_SHUTDOWN);
+ pm8994_reset_configure(PON_PSHOLD_SHUTDOWN);
/* Drop PS_HOLD for MSM */
writel(0x00, MPM2_MPM_PS_HOLD);