Merge "msm8994:  Fix QUSB2PHY issues for DB8094"
diff --git a/app/aboot/recovery.c b/app/aboot/recovery.c
index 2d70cef..3c42902 100644
--- a/app/aboot/recovery.c
+++ b/app/aboot/recovery.c
@@ -454,7 +454,7 @@
 			sizeof(msg->command), msg->command);
 	}
 
-	if (!strncmp(msg->command, "boot-recovery", strlen("boot-recovery"))) {
+	if (!strcmp(msg->command, "boot-recovery")) {
 		boot_into_recovery = 1;
 	}
 
diff --git a/dev/gcdb/display/include/panel_sharp_wqxga_dualdsi_video.h b/dev/gcdb/display/include/panel_sharp_wqxga_dualdsi_video.h
new file mode 100644
index 0000000..666d63d
--- /dev/null
+++ b/dev/gcdb/display/include/panel_sharp_wqxga_dualdsi_video.h
@@ -0,0 +1,147 @@
+/* Copyright (c) 2014, 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE 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.
+ */
+
+/*---------------------------------------------------------------------------
+ * This file is autogenerated file using gcdb parser. Please do not edit it.
+ * Update input XML file to add a new entry or update variable in this file
+ * VERSION = "1.0"
+ *---------------------------------------------------------------------------*/
+
+#ifndef _PANEL_SHARP_WQXGA_DUALDSI_VIDEO_H_
+#define _PANEL_SHARP_WQXGA_DUALDSI_VIDEO_H_
+/*---------------------------------------------------------------------------*/
+/* HEADER files                                                              */
+/*---------------------------------------------------------------------------*/
+#include "panel.h"
+
+/*---------------------------------------------------------------------------*/
+/* Panel configuration                                                       */
+/*---------------------------------------------------------------------------*/
+static struct panel_config sharp_wqxga_dualdsi_video_panel_data = {
+	"qcom,mdss_dsi_sharp_wqxga_dualdsi_video", "dsi:0:", "qcom,mdss-dsi-panel",
+	10, 0, "DISPLAY_1", 0, 0, 60, 0, 0, 1, 0, 0, 0, 0, 0, 25, 1, 0,
+	"qcom,mdss_dsi_sharp_wqxga_video_1"
+};
+
+/*---------------------------------------------------------------------------*/
+/* Panel resolution                                                          */
+/*---------------------------------------------------------------------------*/
+static struct panel_resolution sharp_wqxga_dualdsi_video_panel_res = {
+	1600, 2560, 76, 32, 16, 0, 4, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+/*---------------------------------------------------------------------------*/
+/* Panel color information                                                   */
+/*---------------------------------------------------------------------------*/
+static struct color_info sharp_wqxga_dualdsi_video_color = {
+	24, 0, 0xff, 0, 0, 0
+};
+
+/*---------------------------------------------------------------------------*/
+/* Panel on/off command information                                          */
+/*---------------------------------------------------------------------------*/
+static char sharp_wqxga_dualdsi_video_on_cmd0[] = {
+	0x11, 0X00, 0x05, 0x80
+};
+
+static char sharp_wqxga_dualdsi_video_on_cmd1[] = {
+	0x29, 0x00, 0x5, 0x80
+};
+
+static struct mipi_dsi_cmd sharp_wqxga_dualdsi_video_on_command[] = {
+	{0x4, sharp_wqxga_dualdsi_video_on_cmd0, 0xa0},
+	{0x4, sharp_wqxga_dualdsi_video_on_cmd1, 0x02}
+};
+
+#define SHARP_WQXGA_DUALDSI_VIDEO_ON_COMMAND 2
+
+
+static char sharp_wqxga_dualdsi_videooff_cmd0[] = {
+	0x28, 0x00, 0x05, 0x80
+};
+
+static char sharp_wqxga_dualdsi_videooff_cmd1[] = {
+	0x10, 0x00, 0x05, 0x80
+};
+
+
+static struct command_state sharp_wqxga_dualdsi_video_state = {
+	0, 1
+};
+
+/*---------------------------------------------------------------------------*/
+/* Command mode panel information                                            */
+/*---------------------------------------------------------------------------*/
+static struct commandpanel_info sharp_wqxga_dualdsi_video_command_panel = {
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+/*---------------------------------------------------------------------------*/
+/* Video mode panel information                                              */
+/*---------------------------------------------------------------------------*/
+static struct videopanel_info sharp_wqxga_dualdsi_video_video_panel = {
+	0, 0, 0, 0, 1, 1, 1, 0, 0x9
+};
+
+/*---------------------------------------------------------------------------*/
+/* Lane configuration                                                        */
+/*---------------------------------------------------------------------------*/
+static struct lane_configuration sharp_wqxga_dualdsi_video_lane_config = {
+	4, 0, 1, 1, 1, 1
+};
+
+/*---------------------------------------------------------------------------*/
+/* Panel timing                                                              */
+/*---------------------------------------------------------------------------*/
+static const uint32_t sharp_wqxga_dualdsi_video_timings[] = {
+	0x32, 0x36, 0x24, 0x00, 0x66, 0x68, 0x28, 0x38,  0x2a, 0x03, 0x04, 0x00
+};
+
+static struct panel_timing sharp_wqxga_dualdsi_video_timing_info = {
+	0x0, 0x04, 0x07, 0x0d
+};
+
+/*---------------------------------------------------------------------------*/
+/* Panel reset sequence                                                      */
+/*---------------------------------------------------------------------------*/
+static struct panel_reset_sequence sharp_wqxga_dualdsi_video_reset_seq = {
+	{1, 0, 1, }, {2, 5, 120, }, 2
+};
+
+/*---------------------------------------------------------------------------*/
+/* Backlight setting                                                         */
+/*---------------------------------------------------------------------------*/
+static struct backlight sharp_wqxga_dualdsi_video_backlight = {
+	1, 1, 4095, 100, 1, "PMIC_8941"
+};
+
+#define SHARP_WQXGA_DUALDSI_VIDEO_SIGNATURE 0x210000
+
+
+#endif /*_PANEL_SHARP_WQXGA_DUALDSI_VIDEO_H_*/
diff --git a/dev/pmic/pm8x41/include/pm8x41.h b/dev/pmic/pm8x41/include/pm8x41.h
index 5f87bcb..472e69f 100644
--- a/dev/pmic/pm8x41/include/pm8x41.h
+++ b/dev/pmic/pm8x41/include/pm8x41.h
@@ -79,6 +79,10 @@
 #define CBLPWR_N                64
 #define KPDPWR_N                128
 
+/*Target power off reasons*/
+#define KPDPWR_AND_RESIN        32
+#define STAGE3                  128
+
 struct pm8x41_gpio {
 	int direction;
 	int output_buffer;
@@ -203,6 +207,8 @@
 int pm8x41_ldo_control(struct pm8x41_ldo *ldo, uint8_t enable);
 uint8_t pm8x41_get_pmic_rev();
 uint8_t pm8x41_get_pon_reason();
+uint8_t pm8x41_get_pon_poff_reason1();
+uint8_t pm8x41_get_pon_poff_reason2();
 uint32_t pm8x41_get_pwrkey_is_pressed();
 void pm8x41_config_output_mpp(struct pm8x41_mpp *mpp);
 void pm8x41_enable_mpp(struct pm8x41_mpp *mpp, enum mpp_en_ctl enable);
diff --git a/dev/pmic/pm8x41/include/pm8x41_hw.h b/dev/pmic/pm8x41/include/pm8x41_hw.h
index 4a0d803..9d05219 100644
--- a/dev/pmic/pm8x41/include/pm8x41_hw.h
+++ b/dev/pmic/pm8x41/include/pm8x41_hw.h
@@ -65,6 +65,8 @@
 #define PON_PON_REASON1                       0x808
 #define PON_WARMBOOT_STATUS1                  0x80A
 #define PON_WARMBOOT_STATUS2                  0x80B
+#define PON_POFF_REASON1                      0x80C
+#define PON_POFF_REASON2                      0x80D
 #define PON_INT_RT_STS                        0x810
 #define PON_INT_SET_TYPE                      0x811
 #define PON_INT_POLARITY_HIGH                 0x812
diff --git a/dev/pmic/pm8x41/pm8x41.c b/dev/pmic/pm8x41/pm8x41.c
index 480e6e8..169994a 100644
--- a/dev/pmic/pm8x41/pm8x41.c
+++ b/dev/pmic/pm8x41/pm8x41.c
@@ -380,6 +380,16 @@
 	return REG_READ(PON_PON_REASON1);
 }
 
+uint8_t pm8x41_get_pon_poff_reason1()
+{
+	return REG_READ(PON_POFF_REASON1);
+}
+
+uint8_t pm8x41_get_pon_poff_reason2()
+{
+	return REG_READ(PON_POFF_REASON2);
+}
+
 void pm8x41_enable_mpp(struct pm8x41_mpp *mpp, enum mpp_en_ctl enable)
 {
 	ASSERT(mpp);
diff --git a/include/debug.h b/include/debug.h
index ae7119e..bcf73c5 100644
--- a/include/debug.h
+++ b/include/debug.h
@@ -74,12 +74,7 @@
 /*
 * Initialize the stack protector canary value.
 */
-static inline void __stack_chk_guard_setup()
-{
-	void *canary;
-	canary = get_canary();
-	__stack_chk_guard =  canary;
-}
+#define __stack_chk_guard_setup() do { __stack_chk_guard = get_canary(); } while(0)
 
 void __attribute__ ((noreturn))
 	__stack_chk_fail (void);
diff --git a/lib/libfdt/fdt_rw.c b/lib/libfdt/fdt_rw.c
index 9ed0d4d..a3f8fad 100644
--- a/lib/libfdt/fdt_rw.c
+++ b/lib/libfdt/fdt_rw.c
@@ -316,6 +316,36 @@
 	return 0;
 }
 
+int fdt_appendprop_str(void *fdt, int nodeoffset, const char *name,
+		   const void *val, int len)
+{
+	struct fdt_property *prop;
+	int err, oldlen, newlen;
+
+	FDT_RW_CHECK_HEADER(fdt);
+
+	prop = fdt_get_property_w(fdt, nodeoffset, name, &oldlen);
+	if (prop) {
+		newlen = len + oldlen;
+		err = _fdt_splice_struct(fdt, prop->data,
+					 FDT_TAGALIGN(oldlen),
+					 FDT_TAGALIGN(newlen));
+		if (err)
+			return err;
+		prop->len = cpu_to_fdt32(newlen);
+
+		/* Add space to separate the appended strings */
+		prop->data[oldlen-1] = 0x20;
+		memcpy(prop->data + oldlen, val, len);
+	} else {
+		err = _fdt_add_property(fdt, nodeoffset, name, len, &prop);
+		if (err)
+			return err;
+		memcpy(prop->data, val, len);
+	}
+	return 0;
+}
+
 int fdt_delprop(void *fdt, int nodeoffset, const char *name)
 {
 	struct fdt_property *prop;
diff --git a/lib/libfdt/libfdt.h b/lib/libfdt/libfdt.h
index 73f4975..667964c 100644
--- a/lib/libfdt/libfdt.h
+++ b/lib/libfdt/libfdt.h
@@ -1264,6 +1264,35 @@
  */
 int fdt_appendprop(void *fdt, int nodeoffset, const char *name,
 		   const void *val, int len);
+/**
+ * fdt_appendprop_str - append a string value to a property
+ * @fdt: pointer to the device tree blob
+ * @nodeoffset: offset of the node whose property to change
+ * @name: name of the property to append to
+ * @val: pointer to data to append to the property value
+ * @len: length of the data to append to the property value
+ *
+ * fdt_appendprop_str() appends the string value to the named property
+ * in the given node, creating the property if it does not already exist.
+ *
+ * This function may insert data into the blob along with a space between
+ * the the two strings and will therefore change the offsets of some existing nodes.
+ *
+ * returns:
+ *	0, on success
+ *	-FDT_ERR_NOSPACE, there is insufficient free space in the blob to
+ *		contain the new property value
+ *	-FDT_ERR_BADOFFSET, nodeoffset did not point to FDT_BEGIN_NODE tag
+ *	-FDT_ERR_BADLAYOUT,
+ *	-FDT_ERR_BADMAGIC,
+ *	-FDT_ERR_BADVERSION,
+ *	-FDT_ERR_BADSTATE,
+ *	-FDT_ERR_BADSTRUCTURE,
+ *	-FDT_ERR_BADLAYOUT,
+ *	-FDT_ERR_TRUNCATED, standard meanings
+ */
+int fdt_appendprop_str(void *fdt, int nodeoffset, const char *name,
+		   const void *val, int len);
 
 /**
  * fdt_appendprop_u32 - append a 32-bit integer value to a property
@@ -1374,7 +1403,7 @@
  *	-FDT_ERR_TRUNCATED, standard meanings
  */
 #define fdt_appendprop_string(fdt, nodeoffset, name, str) \
-	fdt_appendprop((fdt), (nodeoffset), (name), (str), strlen(str)+1)
+	fdt_appendprop_str((fdt), (nodeoffset), (name), (str), strlen(str)+1)
 
 /**
  * fdt_delprop - delete a property
diff --git a/platform/msm8994/include/platform/iomap.h b/platform/msm8994/include/platform/iomap.h
index aea3d8c..2040d4a 100644
--- a/platform/msm8994/include/platform/iomap.h
+++ b/platform/msm8994/include/platform/iomap.h
@@ -52,6 +52,7 @@
 #define APCS_KPSS_WDT_BASE          (KPSS_BASE + 0x00017000)
 #define KPSS_APCS_QTMR_AC_BASE      (KPSS_BASE + 0x00020000)
 #define KPSS_APCS_F0_QTMR_V1_BASE   (KPSS_BASE + 0x00021000)
+#define APCS_ALIAS0_IPC_INTERRUPT   (KPSS_BASE + 0x0000D008)
 #define QTMR_BASE                   KPSS_APCS_F0_QTMR_V1_BASE
 
 #define PERIPH_SS_BASE              0xF9800000
diff --git a/platform/msm8994/include/platform/irqs.h b/platform/msm8994/include/platform/irqs.h
index 25383cb..05bb473 100644
--- a/platform/msm8994/include/platform/irqs.h
+++ b/platform/msm8994/include/platform/irqs.h
@@ -55,6 +55,8 @@
 
 #define UFS_IRQ                                (GIC_SPI_START + 265)
 
+#define SMD_IRQ                                (GIC_SPI_START + 168)
+
 /* Retrofit universal macro names */
 #define INT_USB_HS                             USB1_HS_IRQ
 
diff --git a/platform/msm_shared/dev_tree.c b/platform/msm_shared/dev_tree.c
index b139cf2..5df5a70 100644
--- a/platform/msm_shared/dev_tree.c
+++ b/platform/msm_shared/dev_tree.c
@@ -823,7 +823,7 @@
 
 	offset = ret;
 	/* Adding the cmdline to the chosen node */
-	ret = fdt_setprop_string(fdt, offset, (const char*)"bootargs", (const void*)cmdline);
+	ret = fdt_appendprop_string(fdt, offset, (const char*)"bootargs", (const void*)cmdline);
 	if (ret)
 	{
 		dprintf(CRITICAL, "ERROR: Cannot update chosen node [bootargs]\n");
diff --git a/platform/msm_shared/include/mdp5.h b/platform/msm_shared/include/mdp5.h
index dc54c8a..8207651 100644
--- a/platform/msm_shared/include/mdp5.h
+++ b/platform/msm_shared/include/mdp5.h
@@ -110,6 +110,9 @@
 #define MDP_REG_SPLIT_DISPLAY_UPPER_PIPE_CTL    REG_MDP(0x3F8)
 #define MDP_REG_SPLIT_DISPLAY_LOWER_PIPE_CTL    REG_MDP(0x4F0)
 
+#define MDP_REG_PPB0_CNTL                       REG_MDP(0x1420)
+#define MDP_REG_PPB0_CONFIG                     REG_MDP(0x1424)
+
 #define MDP_INTF_0_BASE                         REG_MDP(0x12500)
 #define MDP_INTF_1_BASE                         REG_MDP(0x12700)
 #define MDP_INTF_2_BASE                         REG_MDP(0x12900)
diff --git a/platform/msm_shared/include/mipi_dsi.h b/platform/msm_shared/include/mipi_dsi.h
index cdc5395..000e2b1 100644
--- a/platform/msm_shared/include/mipi_dsi.h
+++ b/platform/msm_shared/include/mipi_dsi.h
@@ -85,6 +85,8 @@
 #define MIPI_DSI_MRPS       0x04	/* Maximum Return Packet Size */
 #define MIPI_DSI_REG_LEN    16	/* 4 x 4 bytes register */
 
+#define DSI_HW_REV_103_1		0x10030001	/* 8936/8939 */
+
 #define DTYPE_GEN_WRITE2 0x23	/* 4th Byte is 0x80 */
 #define DTYPE_GEN_LWRITE 0x29	/* 4th Byte is 0xc0 */
 #define DTYPE_DCS_WRITE1 0x15	/* 4th Byte is 0x80 */
diff --git a/platform/msm_shared/include/regulator.h b/platform/msm_shared/include/regulator.h
new file mode 100644
index 0000000..4e6c932
--- /dev/null
+++ b/platform/msm_shared/include/regulator.h
@@ -0,0 +1,52 @@
+/* Copyright (c) 2014, 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.
+ *
+ */
+
+#ifndef __REGULATOR_H
+#define __REGULATOR_H
+
+#define KEY_SOFTWARE_ENABLE                0x6E657773 // swen - software enable
+#define KEY_LDO_SOFTWARE_MODE              0X646D736C // lsmd - LDO software mode
+#define KEY_SMPS_SOFTWARE_MODE             0X646D7373 // ssmd - SMPS software mode
+#define KEY_PIN_CTRL_ENABLE                0x6E656370 //pcen - pin control enable
+#define KEY_PIN_CTRL_POWER_MODE            0x646d6370 // pcmd - pin control mode
+#define KEY_CURRENT                        0x616D //ma
+#define KEY_MICRO_VOLT                     0x7675 //uv
+#define KEY_FREQUENCY                      0x71657266 //freq
+#define KEY_FREQUENCY_REASON               0x6E736572 //resn
+#define KEY_FOLLOW_QUIET_MODE              0x6D71 //qm
+#define KEY_HEAD_ROOM                      0x7268 // hr
+#define KEY_PIN_CTRL_CLK_BUFFER_ENABLE_KEY 0x62636370 // pccb - clk buffer pin control
+#define KEY_BYPASS_ALLOWED_KEY             0x61707962 //bypa - bypass allowed
+#define KEY_CORNER_LEVEL_KEY               0x6E726F63 // corn - coner voltage
+#define KEY_ACTIVE_FLOOR                   0x636676
+
+void regulator_enable();
+void regulator_disable();
+
+#endif
diff --git a/platform/msm_shared/include/rpm-smd.h b/platform/msm_shared/include/rpm-smd.h
new file mode 100644
index 0000000..5ac8a1b
--- /dev/null
+++ b/platform/msm_shared/include/rpm-smd.h
@@ -0,0 +1,97 @@
+/* Copyright (c) 2014, 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.
+ *
+ */
+
+#ifndef __RPM_SMD_H
+#define __RPM_SMD_H
+
+#include <arch/defines.h>
+#include <stdint.h>
+#include <sys/types.h>
+
+typedef enum
+{
+	RPM_REQUEST_TYPE,
+	RPM_CMD_TYPE,
+	RPM_SUCCESS_REQ_ACK,
+	RPM_SUCCESS_CMD_ACK,
+	RPM_ERROR_ACK,
+}msg_type;
+
+enum
+{
+	RESOURCETYPE,
+	RESOURCEID,
+	KVP_KEY,
+	KVP_LENGTH,
+	KVP_VALUE,
+};
+
+typedef struct
+{
+	uint32_t type;
+	uint32_t len;
+} rpm_gen_hdr;
+
+typedef struct
+{
+	uint32_t key;
+	uint32_t len;
+	uint32_t val;
+} kvp_data;
+
+typedef struct
+{
+	uint32_t id;
+	uint32_t set;
+	uint32_t resourceType;
+	uint32_t resourceId;
+	uint32_t dataLength;
+}rpm_req_hdr;
+
+typedef struct
+{
+	rpm_gen_hdr hdr;
+	rpm_req_hdr req_hdr;
+	kvp_data *data;
+} rpm_req;
+
+typedef struct
+{
+	rpm_gen_hdr hdr;
+	kvp_data *data;
+} rpm_cmd;
+
+typedef rpm_cmd rpm_ack_msg;
+int rpm_send_data(uint32_t *data, uint32_t len, msg_type type);
+uint32_t rpm_recv_data(uint32_t *len);
+void rpm_clk_enable(uint32_t *data, uint32_t len);
+void rpm_clk_disable(uint32_t *data, uint32_t len);
+void rpm_smd_init();
+void rpm_smd_uninit();
+#endif
diff --git a/platform/msm_shared/include/sdhci.h b/platform/msm_shared/include/sdhci.h
index beebb09..7dc93a6 100644
--- a/platform/msm_shared/include/sdhci.h
+++ b/platform/msm_shared/include/sdhci.h
@@ -288,8 +288,8 @@
 #define SDHCI_READ_MODE                           BIT(4)
 #define SDHCI_SWITCH_CMD                          6
 #define SDHCI_CMD_TIMEOUT                         0xF
-#define SDHCI_MAX_CMD_RETRY                       10000
-#define SDHCI_MAX_TRANS_RETRY                     10000
+#define SDHCI_MAX_CMD_RETRY                       5000000
+#define SDHCI_MAX_TRANS_RETRY                     10000000
 
 #define SDHCI_PREP_CMD(c, f)                      ((((c) & 0xff) << 8) | ((f) & 0xff))
 
diff --git a/platform/msm_shared/include/smd.h b/platform/msm_shared/include/smd.h
new file mode 100644
index 0000000..0daaace
--- /dev/null
+++ b/platform/msm_shared/include/smd.h
@@ -0,0 +1,129 @@
+/* Copyright (c) 2014, 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.
+ *
+ */
+
+#ifndef __SMD_H
+#define __SMD_H
+
+#include <arch/defines.h>
+#include <stdint.h>
+#include <sys/types.h>
+#include <string.h>
+#include <kernel/event.h>
+
+#define SMD_CHANNEL_ALLOC_MAX 2048
+#define SMD_CHANNEL_NAME_SIZE_MAX 20
+
+/* Stream related states */
+#define SMD_SS_CLOSED            0x0 /* Closed: must be 0 */
+#define SMD_SS_OPENING           0x1 /* Stream is opening */
+#define SMD_SS_OPENED            0x2 /* Stream is opened */
+#define SMD_SS_FLUSHING          0x3 /* Stream is flushing */
+#define SMD_SS_CLOSING           0x4 /* Stream is closing */
+#define SMD_SS_RESET             0x5 /* Stream is resetting */
+#define SMD_SS_RESET_OPENING     0x6 /* Stream reset on local */
+
+typedef enum
+{
+	SMD_APPS_RPM=0x0F,
+} smd_channel_type;
+
+typedef struct
+{
+	uint32_t stream_state;
+	uint32_t DTR_DSR;
+	uint32_t CTS_RTS;
+	uint32_t CD;
+	uint32_t RI;
+	uint32_t data_written;
+	uint32_t data_read;
+	uint32_t state_updated;
+	uint32_t mask_recv_intr;
+	uint32_t read_index;
+	uint32_t write_index;
+} smd_shared_stream_info_type;
+
+//Every port has 2 FIFOs, one in each direction
+typedef struct
+{
+	char name[SMD_CHANNEL_NAME_SIZE_MAX];
+	uint32_t cid;
+	uint32_t ctype;
+	uint32_t ref_count;
+} smd_channel_alloc_entry_t;
+
+typedef enum
+{
+	SMD_STREAMING_BUFFER,
+} smd_protocol_type;
+
+typedef struct
+{
+	smd_protocol_type protocol;
+	uint32_t port_id;
+	smd_channel_type ch_type;
+} smd_port_to_info_type;
+
+typedef struct
+{
+	uint32_t pkt_size;
+	uint32_t app_field;
+	uint32_t app_ptr;
+	uint32_t kind;
+	uint32_t priority;
+} smd_pkt_hdr;
+
+typedef struct
+{
+	smd_shared_stream_info_type ch0;
+	smd_shared_stream_info_type ch1;
+} smd_port_ctrl_info;
+
+typedef struct
+{
+	smd_channel_alloc_entry_t alloc_entry;
+	uint8_t *send_buf;
+	uint8_t *recv_buf;
+	uint32_t fifo_size;
+	smd_port_ctrl_info *port_info;
+	uint32_t current_state;
+	event_t wevt;
+	event_t revt;
+} smd_channel_info_t;
+
+int smd_init(smd_channel_info_t *ch, uint32_t ch_type);
+void smd_uninit(smd_channel_info_t *ch);
+uint8_t* smd_read(smd_channel_info_t *ch, uint32_t *len, int ch_type);
+int smd_write(smd_channel_info_t *ch, void *data, uint32_t len, int type);
+int smd_get_channel_info(smd_channel_info_t *ch, uint32_t ch_type);
+void smd_get_channel_entry(smd_channel_info_t *ch, uint32_t ch_type);
+void smd_notify_rpm();
+enum handler_return smd_irq_handler(void* data);
+void smd_set_state(smd_channel_info_t *ch, uint32_t state, uint32_t flag);
+void smd_signal_read_complete(smd_channel_info_t *ch, uint32_t len);
+#endif
diff --git a/platform/msm_shared/mdp5.c b/platform/msm_shared/mdp5.c
index b860450..ff260d7 100644
--- a/platform/msm_shared/mdp5.c
+++ b/platform/msm_shared/mdp5.c
@@ -335,6 +335,11 @@
 		}
 	}
 
+	if (pinfo->lcdc.dst_split &&  (intf_base == MDP_INTF_1_BASE)) {
+		writel(BIT(16), MDP_REG_PPB0_CONFIG);
+		writel(BIT(5), MDP_REG_PPB0_CNTL);
+	}
+
 	mdss_mdp_intf_off = intf_base + mdss_mdp_intf_offset();
 
 	hsync_period = lcdc->h_pulse_width +
@@ -532,9 +537,15 @@
 	reg = 0x1f00 | mdss_mdp_ctl_out_sel(pinfo, 1);
 	writel(reg, MDP_CTL_0_BASE + CTL_TOP);
 
+	/*If dst_split is enabled only intf 2 needs to be enabled.
+	CTL_1 path should not be set since CTL_0 itself is going
+	to split after DSPP block*/
+
 	if (pinfo->mipi.dual_dsi) {
-		reg = 0x1f00 | mdss_mdp_ctl_out_sel(pinfo, 0);
-		writel(reg, MDP_CTL_1_BASE + CTL_TOP);
+		if (!pinfo->lcdc.dst_split) {
+			reg = 0x1f00 | mdss_mdp_ctl_out_sel(pinfo,0);
+			writel(reg, MDP_CTL_1_BASE + CTL_TOP);
+		}
 		intf_sel |= BIT(16); /* INTF 2 enable */
 	}
 
diff --git a/platform/msm_shared/mipi_dsi.c b/platform/msm_shared/mipi_dsi.c
index 0700fc5..1c2bb08 100644
--- a/platform/msm_shared/mipi_dsi.c
+++ b/platform/msm_shared/mipi_dsi.c
@@ -364,6 +364,7 @@
 	uint8_t DLNx_EN;
 	uint8_t lane_swap = 0;
 	uint32_t timing_ctl = 0;
+	uint32_t lane_swap_dsi1 = 0;
 
 #if (DISPLAY_TYPE_MDSS == 1)
 	switch (pinfo->num_of_lanes) {
@@ -400,7 +401,11 @@
 				| PACK_TYPE1 << 24 | VC1 << 22 | DT1 << 16 | WC1,
 				MIPI_DSI1_BASE + COMMAND_MODE_DMA_CTRL);
 
-		writel(lane_swap, MIPI_DSI1_BASE + LANE_SWAP_CTL);
+		if (readl(MIPI_DSI_BASE) == DSI_HW_REV_103_1) /*for 8939 hw dsi1 has Lane_map as 3210*/
+			lane_swap_dsi1 = 0x7;
+		else
+			lane_swap_dsi1 = lane_swap;
+		writel(lane_swap_dsi1, MIPI_DSI1_BASE + LANE_SWAP_CTL);
 		writel(timing_ctl, MIPI_DSI1_BASE + TIMING_CTL);
 	}
 
diff --git a/platform/msm_shared/mipi_dsi_phy.c b/platform/msm_shared/mipi_dsi_phy.c
index 4e9ed58..1170bb6 100644
--- a/platform/msm_shared/mipi_dsi_phy.c
+++ b/platform/msm_shared/mipi_dsi_phy.c
@@ -329,7 +329,8 @@
 	writel(0x5f, phy_base + 0x0170);
 
 	/* DSI_PHY_DSIPHY_GLBL_TEST_CTRL */
-	if (phy_base == DSI0_PHY_BASE)
+	if (phy_base == DSI0_PHY_BASE ||
+		(readl(MIPI_DSI0_BASE) == DSI_HW_REV_103_1))
 		writel(0x01, phy_base + 0x01d4);
 	else
 		writel(0x00, phy_base + 0x01d4);
diff --git a/platform/msm_shared/regulator.c b/platform/msm_shared/regulator.c
new file mode 100644
index 0000000..440049b
--- /dev/null
+++ b/platform/msm_shared/regulator.c
@@ -0,0 +1,123 @@
+/* Copyright (c) 2014, 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 <regulator.h>
+#include <rpm-smd.h>
+
+#define GENERIC_DISABLE 0
+#define GENERIC_ENABLE  1
+#define SW_MODE_LDO_IPEAK 1
+#define LDOA_RES_TYPE 0x616F646C //aodl
+#define SMPS_RES_TYPE 0x61706D73 //apms
+
+static uint32_t ldo2[][11]=
+{
+	{
+		LDOA_RES_TYPE, 2,
+		KEY_SOFTWARE_ENABLE, 4, GENERIC_DISABLE,
+		KEY_LDO_SOFTWARE_MODE, 4, SW_MODE_LDO_IPEAK,
+		KEY_MICRO_VOLT, 4, 0,
+	},
+
+	{
+		LDOA_RES_TYPE, 2,
+		KEY_SOFTWARE_ENABLE, 4, GENERIC_ENABLE,
+		KEY_LDO_SOFTWARE_MODE, 4, SW_MODE_LDO_IPEAK,
+		KEY_MICRO_VOLT, 4, 1250000,
+	},
+};
+
+static uint32_t ldo12[][11]=
+{
+	{
+		LDOA_RES_TYPE, 12,
+		KEY_SOFTWARE_ENABLE, 4, GENERIC_DISABLE,
+		KEY_LDO_SOFTWARE_MODE, 4, SW_MODE_LDO_IPEAK,
+		KEY_MICRO_VOLT, 4, 0,
+	},
+
+	{
+		LDOA_RES_TYPE, 12,
+		KEY_SOFTWARE_ENABLE, 4, GENERIC_ENABLE,
+		KEY_LDO_SOFTWARE_MODE, 4, SW_MODE_LDO_IPEAK,
+		KEY_MICRO_VOLT, 4, 1800000,
+	},
+};
+
+static uint32_t ldo14[][11]=
+{
+	{
+		LDOA_RES_TYPE, 14,
+		KEY_SOFTWARE_ENABLE, 4, GENERIC_DISABLE,
+		KEY_LDO_SOFTWARE_MODE, 4, SW_MODE_LDO_IPEAK,
+		KEY_MICRO_VOLT, 4, 0,
+	},
+
+	{
+		LDOA_RES_TYPE, 14,
+		KEY_SOFTWARE_ENABLE, 4, GENERIC_ENABLE,
+		KEY_LDO_SOFTWARE_MODE, 4, SW_MODE_LDO_IPEAK,
+		KEY_MICRO_VOLT, 4, 1800000,
+	},
+};
+
+static uint32_t ldo28[][11]=
+{
+	{
+		LDOA_RES_TYPE, 28,
+		KEY_SOFTWARE_ENABLE, 4, GENERIC_DISABLE,
+		KEY_LDO_SOFTWARE_MODE, 4, SW_MODE_LDO_IPEAK,
+		KEY_MICRO_VOLT, 4, 0,
+	},
+
+	{
+		LDOA_RES_TYPE, 28,
+		KEY_SOFTWARE_ENABLE, 4, GENERIC_ENABLE,
+		KEY_LDO_SOFTWARE_MODE, 4, SW_MODE_LDO_IPEAK,
+		KEY_MICRO_VOLT, 4, 1000000,
+	},
+
+};
+
+void regulator_enable()
+{
+	rpm_send_data(&ldo2[GENERIC_ENABLE][0], 36, RPM_REQUEST_TYPE);
+
+	rpm_send_data(&ldo12[GENERIC_ENABLE][0], 36, RPM_REQUEST_TYPE);
+
+	rpm_send_data(&ldo14[GENERIC_ENABLE][0], 36, RPM_REQUEST_TYPE);
+
+	rpm_send_data(&ldo28[GENERIC_ENABLE][0], 36, RPM_REQUEST_TYPE);
+}
+
+
+void regulator_disable()
+{
+
+}
diff --git a/platform/msm_shared/rpm-smd.c b/platform/msm_shared/rpm-smd.c
new file mode 100644
index 0000000..17b7ff5
--- /dev/null
+++ b/platform/msm_shared/rpm-smd.c
@@ -0,0 +1,185 @@
+/* Copyright (c) 2014, 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 <rpm-smd.h>
+#include <smd.h>
+#include <stdint.h>
+#include <sys/types.h>
+#include <arch/defines.h>
+#include <debug.h>
+#include <stdlib.h>
+
+#define RPM_REQ_MAGIC 0x00716572
+#define RPM_CMD_MAGIC 0x00646d63
+#define REQ_MSG_LENGTH 0x14
+#define CMD_MSG_LENGTH 0x08
+#define ACK_MSG_LENGTH 0x0C
+
+static uint32_t msg_id;
+smd_channel_info_t ch;
+
+void rpm_smd_init()
+{
+	smd_init(&ch, SMD_APPS_RPM);
+}
+
+void rpm_smd_uninit()
+{
+	smd_uninit(&ch);
+}
+
+static void fill_kvp_object(kvp_data **kdata, uint32_t *data, uint32_t len)
+{
+	uint32_t i =0;
+
+	*kdata = (kvp_data *) memalign(CACHE_LINE, ROUNDUP(len, CACHE_LINE));
+	ASSERT(*kdata);
+
+	memcpy(*kdata, data+2, len);
+}
+
+static void free_kvp_object(kvp_data **kdata)
+{
+	if(*kdata)
+		free(*kdata);
+}
+
+int rpm_send_data(uint32_t *data, uint32_t len, msg_type type)
+{
+	rpm_req req;
+	rpm_cmd cmd;
+	uint32_t len_to_smd = 0;
+	int ret = 0;
+	uint32_t ack_msg_len = 0;
+	uint32_t rlen = 0;
+	void *smd_data = NULL;
+
+	switch(type)
+	{
+		case RPM_REQUEST_TYPE:
+			req.hdr.type = RPM_REQ_MAGIC;
+			req.hdr.len = len + REQ_MSG_LENGTH;//20
+			req.req_hdr.id = ++msg_id;
+			req.req_hdr.set = 0;//assume active set. check sleep set.
+			req.req_hdr.resourceType = data[RESOURCETYPE];
+			req.req_hdr.resourceId = data[RESOURCEID];
+			req.req_hdr.dataLength = len;
+
+			fill_kvp_object(&req.data, data, len);
+			len_to_smd = req.req_hdr.dataLength + 0x28;
+
+			smd_data = (void*) malloc(len_to_smd);
+			ASSERT(smd_data);
+
+			memcpy(smd_data, &req.hdr, sizeof(rpm_gen_hdr));
+			memcpy(smd_data + sizeof(rpm_gen_hdr), &req.req_hdr, sizeof(rpm_req_hdr));
+			memcpy(smd_data + sizeof(rpm_gen_hdr)+ sizeof(rpm_req_hdr), req.data, len);
+
+			ret = smd_write(&ch, smd_data, len_to_smd, SMD_APPS_RPM);
+
+			/* TODO: Use events */
+			mdelay(1);
+
+			/* Read the response */
+			ack_msg_len = rpm_recv_data(&rlen);
+
+			smd_signal_read_complete(&ch, ack_msg_len);
+
+			free(smd_data);
+			free_kvp_object(&req.data);
+		break;
+		case RPM_CMD_TYPE:
+			cmd.hdr.type = RPM_CMD_MAGIC;
+			cmd.hdr.len = CMD_MSG_LENGTH;//0x8;
+			len_to_smd  = 0x12;
+
+			fill_kvp_object(&cmd.data, data, len);
+			ret = smd_write(&ch, (void *)&cmd, len_to_smd, SMD_APPS_RPM);
+
+			free_kvp_object(&cmd.data);
+		break;
+		default:
+		break;
+	}
+
+	return ret;
+}
+
+uint32_t rpm_recv_data(uint32_t* len)
+{
+	rpm_ack_msg *resp;
+	msg_type type;
+	uint32_t ret = 0;
+
+	resp = (rpm_ack_msg*)smd_read(&ch, len, SMD_APPS_RPM);
+
+	arch_invalidate_cache_range((addr_t)resp, sizeof(rpm_gen_hdr));
+
+	if(resp->hdr.type == RPM_CMD_MAGIC)
+	{
+		type = RPM_CMD_TYPE;
+	}
+	else if(resp->hdr.type == RPM_REQ_MAGIC)
+	{
+		type = RPM_REQUEST_TYPE;
+	}
+
+	if (type == RPM_CMD_TYPE && resp->hdr.len == ACK_MSG_LENGTH)
+	{
+		dprintf(SPEW, "Received SUCCESS CMD ACK\n");
+	}
+	else if (type == RPM_REQUEST_TYPE && resp->hdr.len == ACK_MSG_LENGTH)
+	{
+		dprintf(SPEW, "Received SUCCESS REQ ACK \n");
+	}
+	else
+	{
+		ret = 1;
+		dprintf(CRITICAL, "Received ERROR ACK \n");
+	}
+
+	if(!ret)
+	{
+		ret = sizeof(rpm_gen_hdr) + sizeof(kvp_data);
+	}
+
+	return ret;
+}
+
+void rpm_clk_enable(uint32_t *data, uint32_t len)
+{
+	/* Send the request to SMD */
+	rpm_send_data(data, len, RPM_REQUEST_TYPE);
+}
+
+void rpm_clk_disable(uint32_t *data, uint32_t len)
+{
+	dprintf(CRITICAL,"Clock disable\n");
+}
+
diff --git a/platform/msm_shared/rules.mk b/platform/msm_shared/rules.mk
index 5a113e0..fa49ff0 100755
--- a/platform/msm_shared/rules.mk
+++ b/platform/msm_shared/rules.mk
@@ -16,6 +16,13 @@
 	$(LOCAL_DIR)/hsusb.o \
 	$(LOCAL_DIR)/boot_stats.o
 
+ifeq ($(ENABLE_SMD_SUPPORT),1)
+OBJS += \
+	$(LOCAL_DIR)/rpm-smd.o \
+	$(LOCAL_DIR)/smd.o \
+	$(LOCAL_DIR)/regulator.o
+endif
+
 ifeq ($(ENABLE_SDHCI_SUPPORT),1)
 OBJS += \
 	$(LOCAL_DIR)/sdhci.o \
diff --git a/platform/msm_shared/sdhci.c b/platform/msm_shared/sdhci.c
index 651e207..e9f4e0d 100644
--- a/platform/msm_shared/sdhci.c
+++ b/platform/msm_shared/sdhci.c
@@ -458,7 +458,7 @@
 		}
 
 		retry++;
-		udelay(500);
+		udelay(1);
 		if (retry == SDHCI_MAX_CMD_RETRY) {
 			dprintf(CRITICAL, "Error: Command never completed\n");
 			ret = 1;
@@ -520,7 +520,7 @@
 			}
 
 			retry++;
-			udelay(1000);
+			udelay(1);
 			if (retry == max_trans_retry) {
 				dprintf(CRITICAL, "Error: Transfer never completed\n");
 				ret = 1;
diff --git a/platform/msm_shared/sdhci_msm.c b/platform/msm_shared/sdhci_msm.c
index 7d6443c..5a7795f 100644
--- a/platform/msm_shared/sdhci_msm.c
+++ b/platform/msm_shared/sdhci_msm.c
@@ -286,7 +286,7 @@
 	/* Write 1 to CLK_OUT_EN */
 	REG_WRITE32(host, (REG_READ32(host, SDCC_DLL_CONFIG_REG) | SDCC_DLL_CLK_OUT_EN), SDCC_DLL_CONFIG_REG);
 	/* Wait for DLL_LOCK in DLL_STATUS register, wait time 50us */
-	while(!((REG_READ32(host, SDCC_REG_DLL_STATUS)) & SDCC_DLL_LOCK_STAT));
+	while(!((REG_READ32(host, SDCC_REG_DLL_STATUS)) & SDCC_DLL_LOCK_STAT))
 	{
 		udelay(1);
 		timeout--;
diff --git a/platform/msm_shared/smd.c b/platform/msm_shared/smd.c
new file mode 100644
index 0000000..6377e7e
--- /dev/null
+++ b/platform/msm_shared/smd.c
@@ -0,0 +1,349 @@
+/* Copyright (c) 2014, 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 <smd.h>
+#include <smem.h>
+#include <debug.h>
+#include <platform/irqs.h>
+#include <platform/iomap.h>
+#include <platform/interrupts.h>
+#include <reg.h>
+#include <malloc.h>
+#include <bits.h>
+
+smd_channel_alloc_entry_t *smd_channel_alloc_entry;
+
+
+static void smd_write_state(smd_channel_info_t *ch, uint32_t state)
+{
+	if(state == SMD_SS_OPENED)
+	{
+		ch->port_info->ch0.DTR_DSR = 1;
+		ch->port_info->ch0.CTS_RTS = 1;
+		ch->port_info->ch0.CD = 1;
+	}
+	else
+	{
+		ch->port_info->ch0.DTR_DSR = 0;
+		ch->port_info->ch0.CTS_RTS = 0;
+		ch->port_info->ch0.CD = 0;
+	}
+
+	ch->port_info->ch0.stream_state = state;
+}
+
+static void smd_state_update(smd_channel_info_t *ch, uint32_t flag)
+{
+	ch->port_info->ch0.state_updated = flag;
+}
+
+void smd_get_channel_entry(smd_channel_info_t *ch, uint32_t ch_type)
+{
+	int i = 0;
+
+	for(i = 0; i< SMEM_NUM_SMD_STREAM_CHANNELS; i++)
+	{
+		if((smd_channel_alloc_entry[i].ctype & 0xFF) == ch_type)
+		{
+			memcpy(&ch->alloc_entry, &smd_channel_alloc_entry[i], sizeof(smd_channel_alloc_entry_t));
+			break;
+		}
+	}
+
+	/* Channel not found */
+	if(i == SMEM_NUM_SMD_STREAM_CHANNELS)
+	{
+		dprintf(CRITICAL, "smd channel type %x not found\n", ch_type);
+		ASSERT(0);
+	}
+}
+
+int smd_get_channel_info(smd_channel_info_t *ch, uint32_t ch_type)
+{
+	int ret = 0;
+	uint8_t *fifo_buf = NULL;
+	uint32_t fifo_buf_size = 0;
+	uint32_t size = 0;
+
+	smd_get_channel_entry(ch, ch_type);
+
+
+	ch->port_info = smem_get_alloc_entry(SMEM_SMD_BASE_ID + ch->alloc_entry.cid,
+										 &size);
+
+	fifo_buf = smem_get_alloc_entry(SMEM_SMD_FIFO_BASE_ID + ch->alloc_entry.cid,
+									&fifo_buf_size);
+
+	fifo_buf_size /= 2;
+	ch->send_buf = fifo_buf;
+	ch->recv_buf = fifo_buf + fifo_buf_size;
+	ch->fifo_size = fifo_buf_size;
+
+	return ret;
+}
+
+int smd_init(smd_channel_info_t *ch, uint32_t ch_type)
+{
+	unsigned ret = 0;
+
+	smd_channel_alloc_entry = (smd_channel_alloc_entry_t*)memalign(CACHE_LINE, SMD_CHANNEL_ALLOC_MAX);
+	ASSERT(smd_channel_alloc_entry);
+
+	ret = smem_read_alloc_entry(SMEM_CHANNEL_ALLOC_TBL,
+							(void*)smd_channel_alloc_entry,
+							SMD_CHANNEL_ALLOC_MAX);
+	if(ret)
+	{
+		dprintf(CRITICAL,"ERROR reading smem channel alloc tbl\n");
+		return -1;
+	}
+
+	smd_get_channel_info(ch, ch_type);
+
+	register_int_handler(SMD_IRQ, smd_irq_handler, ch);
+	unmask_interrupt(SMD_IRQ);
+
+	smd_set_state(ch, SMD_SS_OPENING, 1);
+
+	smd_notify_rpm();
+
+	return 0;
+}
+
+void smd_uninit(smd_channel_info_t *ch)
+{
+	smd_set_state(ch, SMD_SS_CLOSING, 1);
+
+	smd_notify_rpm();
+}
+
+bool is_channel_open(smd_channel_info_t *ch)
+{
+	if(ch->port_info->ch0.stream_state == SMD_SS_OPENED &&
+	  (ch->port_info->ch1.stream_state == SMD_SS_OPENED ||
+	   ch->port_info->ch1.stream_state == SMD_SS_FLUSHING))
+		return true;
+	else
+		return false;
+}
+
+uint8_t* smd_read(smd_channel_info_t *ch, uint32_t *len, int ch_type)
+{
+	smd_pkt_hdr smd_hdr;
+	uint32_t size = 0;
+
+	/* Read the indices from smem */
+	ch->port_info = smem_get_alloc_entry(SMEM_SMD_BASE_ID + ch->alloc_entry.cid,
+										 &size);
+	if(!ch->port_info->ch1.DTR_DSR)
+	{
+		dprintf(CRITICAL,"%s: DTR is off\n", __func__);
+		return -1;
+	}
+
+	/* Clear the data_written flag */
+	ch->port_info->ch1.data_written = 0;
+
+	arch_invalidate_cache_range((addr_t)(ch->recv_buf + ch->port_info->ch1.read_index), sizeof(smd_hdr));
+
+	/* Copy the smd buffer to local buf */
+	memcpy(&smd_hdr, (void*)(ch->recv_buf + ch->port_info->ch1.read_index), sizeof(smd_hdr));
+
+	*len = smd_hdr.pkt_size;
+
+	return (uint8_t*)(ch->recv_buf + ch->port_info->ch1.read_index + sizeof(smd_hdr));
+}
+
+void smd_signal_read_complete(smd_channel_info_t *ch, uint32_t len)
+{
+	ch->port_info->ch1.read_index += sizeof(smd_pkt_hdr) + len;
+
+	/* Set the data_read flag */
+	ch->port_info->ch1.data_read = 1;
+	ch->port_info->ch0.mask_recv_intr = 1;
+	ch->port_info->ch0.state_updated = 1;
+
+	dsb();
+
+	smd_notify_rpm();
+}
+
+int smd_write(smd_channel_info_t *ch, void *data, uint32_t len, int ch_type)
+{
+	smd_pkt_hdr smd_hdr;
+	uint32_t size = 0;
+
+	memset(&smd_hdr, 0, sizeof(smd_pkt_hdr));
+
+	if(len + sizeof(smd_hdr) > ch->fifo_size)
+	{
+		dprintf(CRITICAL,"%s: len is greater than fifo sz\n", __func__);
+		return -1;
+	}
+
+	/* Read the indices from smem */
+	ch->port_info = smem_get_alloc_entry(SMEM_SMD_BASE_ID + ch->alloc_entry.cid,
+                                                        &size);
+
+	if(!is_channel_open(ch))
+	{
+		dprintf(CRITICAL,"%s: channel is not in OPEN state \n", __func__);
+		return -1;
+	}
+
+	if(!ch->port_info->ch0.DTR_DSR)
+	{
+		dprintf(CRITICAL,"%s: DTR is off\n", __func__);
+		return -1;
+	}
+
+	/* Clear the data_read flag */
+	ch->port_info->ch1.data_read = 0;
+
+	/*copy the local buf to smd buf */
+	smd_hdr.pkt_size = len;
+
+	memcpy(ch->send_buf + ch->port_info->ch0.write_index, &smd_hdr, sizeof(smd_hdr));
+
+	memcpy(ch->send_buf + ch->port_info->ch0.write_index + sizeof(smd_hdr), data, len);
+
+	arch_invalidate_cache_range((addr_t)ch->send_buf+ch->port_info->ch0.write_index, sizeof(smd_hdr) + len);
+
+	/* Update write index */
+	ch->port_info->ch0.write_index += sizeof(smd_hdr) + len;
+
+	dsb();
+
+	/* Set the necessary flags */
+
+	ch->port_info->ch0.data_written = 1;
+	ch->port_info->ch0.mask_recv_intr = 0;
+	ch->port_info->ch0.state_updated = 1;
+
+	dsb();
+
+	smd_notify_rpm();
+
+	return 0;
+}
+
+void smd_notify_rpm()
+{
+	/* Set BIT 0 to notify RPM via IPC interrupt*/
+	writel(BIT(0), APCS_ALIAS0_IPC_INTERRUPT);
+}
+
+void smd_set_state(smd_channel_info_t *ch, uint32_t state, uint32_t flag)
+{
+	uint32_t current_state;
+	uint32_t size = 0;
+
+	if(!ch->port_info)
+	{
+		ch->port_info = smem_get_alloc_entry(SMEM_SMD_BASE_ID + ch->alloc_entry.cid,
+							&size);
+		ASSERT(ch->port_info);
+	}
+
+	current_state = ch->port_info->ch0.stream_state;
+
+	switch(state)
+	{
+		case SMD_SS_CLOSED:
+		if(current_state == SMD_SS_OPENED)
+		{
+			smd_write_state(ch, SMD_SS_CLOSING);
+		}
+		else
+		{
+			smd_write_state(ch, SMD_SS_CLOSED);
+		}
+		break;
+		case SMD_SS_OPENING:
+		if(current_state == SMD_SS_CLOSING || current_state == SMD_SS_CLOSED)
+		{
+			smd_write_state(ch, SMD_SS_OPENING);
+			ch->port_info->ch1.read_index = 0;
+			ch->port_info->ch0.write_index = 0;
+			ch->port_info->ch0.mask_recv_intr = 0;
+		}
+		break;
+		case SMD_SS_OPENED:
+		if(current_state == SMD_SS_OPENING)
+		{
+			smd_write_state(ch, SMD_SS_OPENED);
+		}
+		break;
+		case SMD_SS_CLOSING:
+		if(current_state == SMD_SS_OPENED)
+		{
+			smd_write_state(ch, SMD_SS_CLOSING);
+		}
+		break;
+		case SMD_SS_FLUSHING:
+		case SMD_SS_RESET:
+		case SMD_SS_RESET_OPENING:
+		default:
+		break;
+	}
+
+	ch->current_state = state;
+
+	smd_state_update(ch, flag);
+}
+
+
+enum handler_return smd_irq_handler(void* data)
+{
+	smd_channel_info_t *ch = (smd_channel_info_t*)data;
+
+	if(ch->current_state == SMD_SS_CLOSED)
+	{
+		free(smd_channel_alloc_entry);
+		return INT_NO_RESCHEDULE;
+	}
+
+	if(ch->port_info->ch1.state_updated)
+		ch->port_info->ch1.state_updated = 0;
+
+	/* Should we have to use a do while and change states until we complete */
+	if(ch->current_state != ch->port_info->ch1.stream_state)
+	{
+		smd_set_state(ch, ch->port_info->ch1.stream_state, 0);
+	}
+
+	if(ch->current_state == SMD_SS_CLOSING)
+	{
+		smd_set_state(ch, SMD_SS_CLOSED, 1);
+		smd_notify_rpm();
+		dprintf(CRITICAL,"Channel alloc freed\n");
+	}
+
+	return INT_NO_RESCHEDULE;
+}
diff --git a/platform/msm_shared/smem.c b/platform/msm_shared/smem.c
index 4bf9fda..948a256 100644
--- a/platform/msm_shared/smem.c
+++ b/platform/msm_shared/smem.c
@@ -97,6 +97,45 @@
 	return 0;
 }
 
+/* Return a pointer to smem_item with size */
+void* smem_get_alloc_entry(smem_mem_type_t type, uint32_t* size)
+{
+	struct smem_alloc_info *ainfo = NULL;
+	uint32_t smem_addr = 0;
+	uint32_t base_ext = 0;
+	uint32_t offset = 0;
+	void *ret = 0;
+
+#if DYNAMIC_SMEM
+	smem_addr = smem_get_base_addr();
+#else
+	smem_addr = platform_get_smem_base_addr();
+#endif
+	smem = (struct smem *)smem_addr;
+
+	if (type < SMEM_FIRST_VALID_TYPE || type > SMEM_LAST_VALID_TYPE)
+		return 1;
+
+	ainfo = &smem->alloc_info[type];
+	if (readl(&ainfo->allocated) == 0)
+		return 1;
+
+	*size = readl(&ainfo->size);
+	base_ext = readl(&ainfo->base_ext);
+	offset = readl(&ainfo->offset);
+
+	if(base_ext)
+	{
+		ret = base_ext + offset;
+	}
+	else
+	{
+		ret = (void*) smem_addr + offset;
+	}
+
+	return ret;
+}
+
 unsigned
 smem_read_alloc_entry_offset(smem_mem_type_t type, void *buf, int len,
 			     int offset)
diff --git a/platform/msm_shared/smem.h b/platform/msm_shared/smem.h
index c637024..1d68c66 100644
--- a/platform/msm_shared/smem.h
+++ b/platform/msm_shared/smem.h
@@ -47,6 +47,8 @@
 
 #define SMEM_TARGET_INFO_IDENTIFIER     0x49494953
 
+#define SMEM_NUM_SMD_STREAM_CHANNELS        64
+
 enum smem_ram_ptable_version
 {
 	SMEM_RAM_PTABLE_VERSION_0,
@@ -71,7 +73,7 @@
 	unsigned allocated;
 	unsigned offset;
 	unsigned size;
-	unsigned reserved;
+	unsigned base_ext;
 };
 
 struct smem_board_info_v2 {
@@ -415,13 +417,16 @@
 
 typedef enum {
 	SMEM_SPINLOCK_ARRAY = 7,
-
 	SMEM_AARM_PARTITION_TABLE = 9,
+	SMEM_CHANNEL_ALLOC_TBL = 13,
+	SMEM_SMD_BASE_ID = 14,
 
 	SMEM_APPS_BOOT_MODE = 106,
 
 	SMEM_BOARD_INFO_LOCATION = 137,
 
+	SMEM_SMD_FIFO_BASE_ID = 338,
+
 	SMEM_USABLE_RAM_PARTITION_TABLE = 402,
 
 	SMEM_POWER_ON_STATUS_INFO = 403,
@@ -571,4 +576,5 @@
 void smem_get_ram_ptable_entry(ram_partition*, uint32_t entry);
 uint32_t smem_get_ram_ptable_version(void);
 uint32_t smem_get_ram_ptable_len(void);
+void* smem_get_alloc_entry(smem_mem_type_t type, uint32_t* size);
 #endif				/* __PLATFORM_MSM_SHARED_SMEM_H */
diff --git a/project/msm8994.mk b/project/msm8994.mk
index 10c7e0c..5f994d2 100644
--- a/project/msm8994.mk
+++ b/project/msm8994.mk
@@ -13,6 +13,7 @@
 ENABLE_BOOT_CONFIG_SUPPORT := 1
 ENABLE_USB30_SUPPORT := 1
 USE_DYNAMIC_SMEM := 1
+ENABLE_SMD_SUPPORT := 1
 
 #DEFINES += WITH_DEBUG_DCC=1
 DEFINES += WITH_DEBUG_UART=1
@@ -49,3 +50,7 @@
 ifeq ($(USE_DYNAMIC_SMEM),1)
 DEFINES += DYNAMIC_SMEM=1
 endif
+
+ifeq ($(ENABLE_SMD_SUPPORT),1)
+DEFINES += SMD_SUPPORT=1
+endif
diff --git a/target/msm8916/oem_panel.c b/target/msm8916/oem_panel.c
index 036081e..7462e31 100644
--- a/target/msm8916/oem_panel.c
+++ b/target/msm8916/oem_panel.c
@@ -48,6 +48,7 @@
 #include "include/panel_otm8019a_fwvga_video.h"
 #include "include/panel_otm1283a_720p_video.h"
 #include "include/panel_nt35596_1080p_skuk_video.h"
+#include "include/panel_sharp_wqxga_dualdsi_video.h"
 
 #define DISPLAY_MAX_PANEL_DETECTION 2
 #define OTM8019A_FWVGA_VIDEO_PANEL_ON_DELAY 50
@@ -65,6 +66,7 @@
 OTM8019A_FWVGA_VIDEO_PANEL,
 OTM1283A_720P_VIDEO_PANEL,
 NT35596_1080P_VIDEO_PANEL,
+SHARP_WQXGA_DUALDSI_VIDEO_PANEL,
 UNKNOWN_PANEL
 };
 
@@ -80,6 +82,7 @@
 	{"otm8019a_fwvga_video", OTM8019A_FWVGA_VIDEO_PANEL},
 	{"otm1283a_720p_video", OTM1283A_720P_VIDEO_PANEL},
 	{"nt35596_1080p_video", NT35596_1080P_VIDEO_PANEL},
+	{"sharp_wqxga_dualdsi_video",SHARP_WQXGA_DUALDSI_VIDEO_PANEL},
 };
 
 static uint32_t panel_id;
@@ -261,6 +264,27 @@
 		memcpy(phy_db->timing,
 				nt35596_1080p_skuk_video_timings, TIMING_SIZE);
 		break;
+	case SHARP_WQXGA_DUALDSI_VIDEO_PANEL:
+		panelstruct->paneldata    = &sharp_wqxga_dualdsi_video_panel_data;
+		panelstruct->panelres     = &sharp_wqxga_dualdsi_video_panel_res;
+		panelstruct->color        = &sharp_wqxga_dualdsi_video_color;
+		panelstruct->videopanel   = &sharp_wqxga_dualdsi_video_video_panel;
+		panelstruct->commandpanel = &sharp_wqxga_dualdsi_video_command_panel;
+		panelstruct->state        = &sharp_wqxga_dualdsi_video_state;
+		panelstruct->laneconfig   = &sharp_wqxga_dualdsi_video_lane_config;
+		panelstruct->paneltiminginfo
+			= &sharp_wqxga_dualdsi_video_timing_info;
+		panelstruct->panelresetseq
+					 = &sharp_wqxga_dualdsi_video_reset_seq;
+		panelstruct->backlightinfo = &sharp_wqxga_dualdsi_video_backlight;
+		pinfo->mipi.panel_cmds
+			= sharp_wqxga_dualdsi_video_on_command;
+		pinfo->mipi.num_of_panel_cmds
+			= SHARP_WQXGA_DUALDSI_VIDEO_ON_COMMAND;
+		memcpy(phy_db->timing,
+			sharp_wqxga_dualdsi_video_timings, TIMING_SIZE);
+		pinfo->mipi.signature 	= SHARP_WQXGA_DUALDSI_VIDEO_SIGNATURE;
+		break;
 	case UNKNOWN_PANEL:
 	default:
 		memset(panelstruct, 0, sizeof(struct panel_struct));
diff --git a/target/msm8994/init.c b/target/msm8994/init.c
index 4f65756..635dbfa 100644
--- a/target/msm8994/init.c
+++ b/target/msm8994/init.c
@@ -55,6 +55,7 @@
 #include <boot_device.h>
 #include <qmp_phy.h>
 #include <qusb2_phy.h>
+#include <rpm-smd.h>
 
 #define CE_INSTANCE             2
 #define CE_EE                   1
@@ -145,6 +146,8 @@
 
 	if (crypto_initialized())
 		crypto_eng_cleanup();
+
+	rpm_smd_uninit();
 }
 
 /* Do target specific usb initialization */
@@ -275,6 +278,8 @@
 		dprintf(CRITICAL, "Error reading the partition table info\n");
 		ASSERT(0);
 	}
+
+	rpm_smd_init();
 }
 
 unsigned board_machtype(void)