mt8173: Implement subsystem power control logic in ARM TF

1. Add SiP calls for subsystem power on/off and check support
2. Add subsystem power control related initialization in
   bl31_plat_setup.c
3. Add subsystem power on/off and power ack waiting functions
4. Update PCM code for subsystem physical power control logic

Change-Id: Ia0ebb1964c8f9758159bcf17c1813d76ef52cf64
Signed-off-by: yt.lee <yt.lee@mediatek.com>
diff --git a/plat/mediatek/common/mtk_sip_svc.c b/plat/mediatek/common/mtk_sip_svc.c
index af28080..cb10af5 100644
--- a/plat/mediatek/common/mtk_sip_svc.c
+++ b/plat/mediatek/common/mtk_sip_svc.c
@@ -55,6 +55,18 @@
 		ret = mt_sip_set_authorized_sreg((uint32_t)x1, (uint32_t)x2);
 		SMC_RET1(handle, ret);
 
+	case MTK_SIP_PWR_ON_MTCMOS:
+		ret = mt_sip_pwr_on_mtcmos((uint32_t)x1);
+		SMC_RET1(handle, ret);
+
+	case MTK_SIP_PWR_OFF_MTCMOS:
+		ret = mt_sip_pwr_off_mtcmos((uint32_t)x1);
+		SMC_RET1(handle, ret);
+
+	case MTK_SIP_PWR_MTCMOS_SUPPORT:
+		ret = mt_sip_pwr_mtcmos_support();
+		SMC_RET1(handle, ret);
+
 	default:
 		ERROR("%s: unhandled SMC (0x%x)\n", __func__, smc_fid);
 		break;
diff --git a/plat/mediatek/common/mtk_sip_svc.h b/plat/mediatek/common/mtk_sip_svc.h
index eb1c2e6..94a6036 100644
--- a/plat/mediatek/common/mtk_sip_svc.h
+++ b/plat/mediatek/common/mtk_sip_svc.h
@@ -43,10 +43,13 @@
 #define MTK_SIP_SVC_VERSION_MINOR	0x1
 
 /* Number of Mediatek SiP Calls implemented */
-#define MTK_SIP_NUM_CALLS		1
+#define MTK_SIP_NUM_CALLS		4
 
 /* Mediatek SiP Service Calls function IDs */
 #define MTK_SIP_SET_AUTHORIZED_SECURE_REG	0x82000001
+#define MTK_SIP_PWR_ON_MTCMOS			0x82000402
+#define MTK_SIP_PWR_OFF_MTCMOS			0x82000403
+#define MTK_SIP_PWR_MTCMOS_SUPPORT		0x82000404
 
 /* Mediatek SiP Calls error code */
 enum {
@@ -62,5 +65,7 @@
  * Return MTK_SIP_E_SUCCESS on success, and MTK_SIP_E_INVALID_PARAM on failure.
  */
 uint64_t mt_sip_set_authorized_sreg(uint32_t sreg, uint32_t val);
-
+uint64_t mt_sip_pwr_on_mtcmos(uint32_t val);
+uint64_t mt_sip_pwr_off_mtcmos(uint32_t val);
+uint64_t mt_sip_pwr_mtcmos_support(void);
 #endif /* __PLAT_SIP_SVC_H__ */
diff --git a/plat/mediatek/mt8173/drivers/mtcmos/mtcmos.c b/plat/mediatek/mt8173/drivers/mtcmos/mtcmos.c
index f7a1b07..265685f 100644
--- a/plat/mediatek/mt8173/drivers/mtcmos/mtcmos.c
+++ b/plat/mediatek/mt8173/drivers/mtcmos/mtcmos.c
@@ -29,8 +29,11 @@
  */
 #include <mmio.h>
 #include <mt8173_def.h>
+#include <debug.h>
 #include <mtcmos.h>
 #include <spm.h>
+#include <spm_mcdi.h>
+#include <delay_timer.h>
 
 enum {
 	SRAM_ISOINT_B	= 1U << 6,
@@ -64,6 +67,63 @@
 	AUD_PWR_STA_MASK   = 0x1 << 24,
 };
 
+#define SPM_VDE_PWR_CON				0x0210
+#define SPM_MFG_PWR_CON				0x0214
+#define SPM_VEN_PWR_CON				0x0230
+#define SPM_ISP_PWR_CON				0x0238
+#define SPM_DIS_PWR_CON				0x023c
+#define SPM_VEN2_PWR_CON			0x0298
+#define SPM_AUDIO_PWR_CON			0x029c
+#define SPM_MFG_2D_PWR_CON			0x02c0
+#define SPM_MFG_ASYNC_PWR_CON			0x02c4
+#define SPM_USB_PWR_CON				0x02cc
+
+#define MTCMOS_CTRL_SUCCESS			0
+#define MTCMOS_CTRL_ERROR			-1
+
+#define MTCMOS_CTRL_EN				(0x1 << 18)
+
+#define VDE_PWR_ON				0
+#define VEN_PWR_ON				1
+#define ISP_PWR_ON				2
+#define DIS_PWR_ON				3
+#define VEN2_PWR_ON				4
+#define AUDIO_PWR_ON				5
+#define MFG_ASYNC_PWR_ON			6
+#define MFG_2D_PWR_ON				7
+#define MFG_PWR_ON				8
+#define USB_PWR_ON				9
+
+#define VDE_PWR_OFF				10
+#define VEN_PWR_OFF				11
+#define ISP_PWR_OFF				12
+#define DIS_PWR_OFF				13
+#define VEN2_PWR_OFF				14
+#define AUDIO_PWR_OFF				15
+#define MFG_ASYNC_PWR_OFF			16
+#define MFG_2D_PWR_OFF				17
+#define MFG_PWR_OFF				18
+#define USB_PWR_OFF				19
+
+#define VDE_PWR_CON_PWR_STA			7
+#define VEN_PWR_CON_PWR_STA			21
+#define ISP_PWR_CON_PWR_STA			5
+#define DIS_PWR_CON_PWR_STA			3
+#define VEN2_PWR_CON_PWR_STA			20
+#define AUDIO_PWR_CON_PWR_STA			24
+#define MFG_ASYNC_PWR_CON_PWR_STA		23
+#define MFG_2D_PWR_CON_PWR_STA			22
+#define MFG_PWR_CON_PWR_STA			4
+#define USB_PWR_CON_PWR_STA			25
+
+/*
+ * Timeout if the ack is not signled after 1 second.
+ * According to designer, one mtcmos operation should be done
+ * around 10us.
+ */
+#define MTCMOS_ACK_POLLING_MAX_COUNT			10000
+#define MTCMOS_ACK_POLLING_INTERVAL			10
+
 static void mtcmos_ctrl_little_off(unsigned int linear_id)
 {
 	uint32_t reg_pwr_con;
@@ -120,3 +180,117 @@
 	mtcmos_ctrl_little_off(2);
 	mtcmos_ctrl_little_off(3);
 }
+
+uint32_t wait_mtcmos_ack(uint32_t on, uint32_t mtcmos_sta, uint32_t spm_pwr_sta)
+{
+	int i = 0;
+	uint32_t cmp, pwr_sta, pwr_sta_2nd;
+
+	while (1) {
+		cmp = (mmio_read_32(SPM_PCM_PASR_DPD_3) >> mtcmos_sta) & 1;
+		pwr_sta = (mmio_read_32(SPM_PWR_STATUS) >> spm_pwr_sta) & 1;
+		pwr_sta_2nd =
+			(mmio_read_32(SPM_PWR_STATUS_2ND) >> spm_pwr_sta) & 1;
+		if ((cmp == on) && (pwr_sta == on) && (pwr_sta_2nd == on)) {
+			mmio_write_32(SPM_PCM_RESERVE2, 0);
+			return MTCMOS_CTRL_SUCCESS;
+		}
+		udelay(MTCMOS_ACK_POLLING_INTERVAL);
+		i++;
+		if (i > MTCMOS_ACK_POLLING_MAX_COUNT) {
+			INFO("MTCMOS control failed(%d), SPM_PWR_STA(%d),\n"
+				"SPM_PCM_RESERVE=0x%x,SPM_PCM_RESERVE2=0x%x,\n"
+				"SPM_PWR_STATUS=0x%x,SPM_PWR_STATUS_2ND=0x%x\n"
+				"SPM_PCM_PASR_DPD_3 = 0x%x\n",
+				on, spm_pwr_sta, mmio_read_32(SPM_PCM_RESERVE),
+				mmio_read_32(SPM_PCM_RESERVE2),
+				mmio_read_32(SPM_PWR_STATUS),
+				mmio_read_32(SPM_PWR_STATUS_2ND),
+				mmio_read_32(SPM_PCM_PASR_DPD_3));
+			mmio_write_32(SPM_PCM_RESERVE2, 0);
+			return MTCMOS_CTRL_ERROR;
+		}
+	}
+}
+
+uint32_t mtcmos_non_cpu_ctrl(uint32_t on, uint32_t mtcmos_num)
+{
+	uint32_t ret = MTCMOS_CTRL_SUCCESS;
+	uint32_t power_on;
+	uint32_t power_off;
+	uint32_t power_status;
+
+	spm_lock_get();
+	spm_mcdi_prepare_for_mtcmos();
+	mmio_setbits_32(SPM_PCM_RESERVE, MTCMOS_CTRL_EN);
+
+	switch (mtcmos_num) {
+	case SPM_VDE_PWR_CON:
+		power_on = VDE_PWR_ON;
+		power_off = VDE_PWR_OFF;
+		power_status = VDE_PWR_CON_PWR_STA;
+		break;
+	case SPM_MFG_PWR_CON:
+		power_on = MFG_PWR_ON;
+		power_off = MFG_PWR_OFF;
+		power_status = MFG_PWR_CON_PWR_STA;
+		break;
+	case SPM_VEN_PWR_CON:
+		power_on = VEN_PWR_ON;
+		power_off = VEN_PWR_OFF;
+		power_status = VEN_PWR_CON_PWR_STA;
+		break;
+	case SPM_ISP_PWR_CON:
+		power_on = ISP_PWR_ON;
+		power_off = ISP_PWR_OFF;
+		power_status = ISP_PWR_CON_PWR_STA;
+		break;
+	case SPM_DIS_PWR_CON:
+		power_on = DIS_PWR_ON;
+		power_off = DIS_PWR_OFF;
+		power_status = DIS_PWR_CON_PWR_STA;
+		break;
+	case SPM_VEN2_PWR_CON:
+		power_on = VEN2_PWR_ON;
+		power_off = VEN2_PWR_OFF;
+		power_status = VEN2_PWR_CON_PWR_STA;
+		break;
+	case SPM_AUDIO_PWR_CON:
+		power_on = AUDIO_PWR_ON;
+		power_off = AUDIO_PWR_OFF;
+		power_status = AUDIO_PWR_CON_PWR_STA;
+		break;
+	case SPM_MFG_2D_PWR_CON:
+		power_on = MFG_2D_PWR_ON;
+		power_off = MFG_2D_PWR_OFF;
+		power_status = MFG_2D_PWR_CON_PWR_STA;
+		break;
+	case SPM_MFG_ASYNC_PWR_CON:
+		power_on = MFG_ASYNC_PWR_ON;
+		power_off = MFG_ASYNC_PWR_OFF;
+		power_status = MFG_ASYNC_PWR_CON_PWR_STA;
+		break;
+	case SPM_USB_PWR_CON:
+		power_on = USB_PWR_ON;
+		power_off = USB_PWR_OFF;
+		power_status = USB_PWR_CON_PWR_STA;
+		break;
+	default:
+		ret = MTCMOS_CTRL_ERROR;
+		INFO("No mapping MTCMOS(%d), ret = %d\n", mtcmos_num, ret);
+		break;
+	}
+
+	if (ret == MTCMOS_CTRL_SUCCESS) {
+		mmio_setbits_32(SPM_PCM_RESERVE2, on ?
+			(1 << power_on) : (1 << power_off));
+		ret = wait_mtcmos_ack(on, power_on, power_status);
+		VERBOSE("0x%x(%d), PWR_STATUS(0x%x), ret(%d)\n",
+			power_on, on, mmio_read_32(SPM_PWR_STATUS), ret);
+	}
+
+	mmio_clrbits_32(SPM_PCM_RESERVE, MTCMOS_CTRL_EN);
+	spm_lock_release();
+
+	return ret;
+}
diff --git a/plat/mediatek/mt8173/drivers/mtcmos/mtcmos.h b/plat/mediatek/mt8173/drivers/mtcmos/mtcmos.h
index ddcda78..4641f46 100644
--- a/plat/mediatek/mt8173/drivers/mtcmos/mtcmos.h
+++ b/plat/mediatek/mt8173/drivers/mtcmos/mtcmos.h
@@ -37,5 +37,6 @@
  * during CPU_ON psci call.
  */
 void mtcmos_little_cpu_off(void);
+uint32_t mtcmos_non_cpu_ctrl(uint32_t on, uint32_t mtcmos_num);
 
 #endif /* __MTCMOS_H__ */
diff --git a/plat/mediatek/mt8173/drivers/spm/spm_mcdi.c b/plat/mediatek/mt8173/drivers/spm/spm_mcdi.c
index 654ed69..530e2ae 100644
--- a/plat/mediatek/mt8173/drivers/spm/spm_mcdi.c
+++ b/plat/mediatek/mt8173/drivers/spm/spm_mcdi.c
@@ -56,79 +56,79 @@
 #define PCM_MCDI_CA53_PWRSTA_SHIFT	9
 
 static const unsigned int mcdi_binary[] = {
-	0x1a10001f, 0x10006918, 0x81002001, 0xb100a081, 0xb1012081, 0xb101a081,
-	0xb1042081, 0xb104a081, 0xb1052081, 0xb105a081, 0xb1003081, 0xd8200984,
-	0x17c07c1f, 0xe2e00036, 0xe2e0003e, 0x1910001f, 0x1000660c, 0x81041001,
-	0x1a10001f, 0x10006610, 0x82042001, 0x81002004, 0xd82001e4, 0x17c07c1f,
-	0xe2e0003c, 0xe8208000, 0x10006244, 0x00000000, 0x1910001f, 0x10006244,
-	0x81041001, 0xd8000384, 0x17c07c1f, 0x1b80001f, 0x20000030, 0xe2e0007c,
-	0x1b80001f, 0x20000003, 0xe2e0005c, 0xe2e0004c, 0xe2e0004d, 0x1900001f,
-	0x10001250, 0x1a10001f, 0x10001250, 0x8a000008, 0xfffffffb, 0xe1000008,
-	0x1900001f, 0x10001258, 0x1a10001f, 0x10001258, 0x81012001, 0xd8000604,
-	0x17c07c1f, 0x1900001f, 0x10001220, 0x1a10001f, 0x10001220, 0x8a000008,
-	0xdfffffff, 0xe1000008, 0x1900001f, 0x10001228, 0x1a10001f, 0x10001228,
-	0x810ea001, 0xd80007c4, 0x17c07c1f, 0x1900001f, 0x1020002c, 0x1a10001f,
-	0x1020002c, 0x8a000008, 0xffffffef, 0xe1000008, 0xf0000000, 0x17c07c1f,
-	0x1900001f, 0x1020002c, 0x1a10001f, 0x1020002c, 0xaa000008, 0x00000010,
-	0xe1000008, 0x1910001f, 0x10006720, 0x820c1001, 0xd8200aa8, 0x17c07c1f,
-	0x1900001f, 0x10001250, 0x1a10001f, 0x10001250, 0xa2110408, 0xe1000008,
-	0x1900001f, 0x10001258, 0x1a10001f, 0x10001258, 0x81012001, 0xd8200c04,
-	0x17c07c1f, 0x1900001f, 0x10001220, 0x1a10001f, 0x10001220, 0xa21e8408,
-	0xe1000008, 0x1900001f, 0x10001228, 0x1a10001f, 0x10001228, 0x810ea001,
-	0xd8200da4, 0x17c07c1f, 0xe2e0004f, 0xe2e0006f, 0xe2e0002f, 0xe8208000,
-	0x10006244, 0x00000001, 0x1910001f, 0x10006244, 0x81041001, 0xd8200f44,
-	0x17c07c1f, 0xe2e0002e, 0xe2e0003e, 0xe2e0003a, 0xe2e00032, 0x1910001f,
-	0x1000660c, 0x81041001, 0x1a10001f, 0x10006610, 0x82042001, 0xa1002004,
-	0xd8001064, 0x17c07c1f, 0x1910001f, 0x10006b04, 0x01000404, 0x1a00001f,
-	0x10006b04, 0xe2000004, 0xf0000000, 0x17c07c1f, 0x1212841f, 0xe2e00036,
-	0xe2e0003e, 0x1380201f, 0xe2e0003c, 0xe2a00000, 0x1b80001f, 0x20000080,
+	0x1a10001f, 0x10006b04, 0x1890001f, 0x10006b6c, 0x1a40001f, 0x10006210,
+	0x81002001, 0xd8200184, 0x17c07c1f, 0xa0900402, 0xc24012a0, 0x17c07c1f,
+	0x81052001, 0xd8200244, 0x17c07c1f, 0x80b00402, 0xc2401760, 0x17c07c1f,
+	0x1a40001f, 0x10006230, 0x8100a001, 0xd8200344, 0x17c07c1f, 0xa0908402,
+	0xc24012a0, 0x17c07c1f, 0x8105a001, 0xd8200404, 0x17c07c1f, 0x80b08402,
+	0xc2401760, 0x17c07c1f, 0x1a40001f, 0x10006238, 0x81012001, 0xd8200504,
+	0x17c07c1f, 0xa0910402, 0xc24012a0, 0x17c07c1f, 0x81062001, 0xd82005c4,
+	0x17c07c1f, 0x80b10402, 0xc2401760, 0x17c07c1f, 0x1a40001f, 0x1000623c,
+	0x8101a001, 0xd82006c4, 0x17c07c1f, 0xa0918402, 0xc24012a0, 0x17c07c1f,
+	0x8106a001, 0xd8200784, 0x17c07c1f, 0x80b18402, 0xc2401760, 0x17c07c1f,
+	0x1a40001f, 0x10006298, 0x81022001, 0xd8200884, 0x17c07c1f, 0xa0920402,
+	0xc24012a0, 0x17c07c1f, 0x81072001, 0xd8200944, 0x17c07c1f, 0x80b20402,
+	0xc2401760, 0x17c07c1f, 0x1a40001f, 0x1000629c, 0x8102a001, 0xd8200a44,
+	0x17c07c1f, 0xa0928402, 0xc24012a0, 0x17c07c1f, 0x8107a001, 0xd8200b04,
+	0x17c07c1f, 0x80b28402, 0xc2401760, 0x17c07c1f, 0x1a40001f, 0x100062c4,
+	0x81032001, 0xd8200c04, 0x17c07c1f, 0xa0930402, 0xc24012a0, 0x17c07c1f,
+	0x81082001, 0xd8200cc4, 0x17c07c1f, 0x80b30402, 0xc2401760, 0x17c07c1f,
+	0x1a40001f, 0x100062c0, 0x8103a001, 0xd8200dc4, 0x17c07c1f, 0xa0938402,
+	0xc24012a0, 0x17c07c1f, 0x8108a001, 0xd8200e84, 0x17c07c1f, 0x80b38402,
+	0xc2401760, 0x17c07c1f, 0x1a40001f, 0x10006214, 0x81042001, 0xd8200f84,
+	0x17c07c1f, 0xa0940402, 0xc24012a0, 0x17c07c1f, 0x81092001, 0xd8201044,
+	0x17c07c1f, 0x80b40402, 0xc2401760, 0x17c07c1f, 0x1a40001f, 0x100062cc,
+	0x8104a001, 0xd8201144, 0x17c07c1f, 0xa0948402, 0xc24012a0, 0x17c07c1f,
+	0x8109a001, 0xd8201204, 0x17c07c1f, 0x80b48402, 0xc2401760, 0x17c07c1f,
+	0x1900001f, 0x10006b6c, 0xe1000002, 0xf0000000, 0x17c07c1f, 0xe2603f16,
+	0xe2603f1e, 0x1b80001f, 0x00000020, 0xe2603f0e, 0xe2603f0c, 0xe2603f0d,
+	0xe260000d, 0x1b80001f, 0x20000080, 0x1a90001f, 0x10001220, 0x69200009,
+	0x1000623c, 0xd8001564, 0x17c07c1f, 0x69200009, 0x10006214, 0xd8001644,
+	0x17c07c1f, 0xd00016e0, 0x17c07c1f, 0x1900001f, 0x10001220, 0x8a80000a,
+	0xfffffffc, 0xe100000a, 0xd00016e0, 0x17c07c1f, 0x1900001f, 0x10001220,
+	0x8a80000a, 0xff1fbfff, 0xe100000a, 0x1b80001f, 0x20000080, 0xf0000000,
+	0x17c07c1f, 0x1a90001f, 0x10001220, 0x69200009, 0x1000623c, 0xd80018e4,
+	0x17c07c1f, 0x69200009, 0x10006214, 0xd80019c4, 0x17c07c1f, 0xd0001a60,
+	0x17c07c1f, 0x1900001f, 0x10001220, 0xaa80000a, 0x00000003, 0xe100000a,
+	0xd0001a60, 0x17c07c1f, 0x1900001f, 0x10001220, 0xaa80000a, 0x00e04000,
+	0xe100000a, 0x1b80001f, 0x20000080, 0x69200009, 0x10006214, 0xd8001b84,
+	0x17c07c1f, 0xe2600f0d, 0xd0001ba0, 0x17c07c1f, 0xe2603f0d, 0x1b80001f,
+	0x20000080, 0xe2600f0f, 0xe2600f0e, 0xe2600f1e, 0xe2600f1a, 0xe2600f12,
+	0xf0000000, 0x17c07c1f, 0xe2e00036, 0xe2e0003e, 0x1b80001f, 0x00000020,
+	0xe2e0003c, 0xe8208000, 0x10006244, 0x00000000, 0x1b80001f, 0x20000080,
 	0xe2e0007c, 0x1b80001f, 0x20000003, 0xe2e0005c, 0xe2e0004c, 0xe2e0004d,
-	0xf0000000, 0x17c07c1f, 0xe2e0004f, 0xe2e0006f, 0xe2e0002f, 0xe2a00001,
-	0x1b80001f, 0x20000080, 0xe2e0002e, 0xe2e0003e, 0xe2e0003a, 0xe2e00032,
-	0xf0000000, 0x17c07c1f, 0x1212841f, 0xe2e00026, 0xe2e0002e, 0x1380201f,
-	0x1a00001f, 0x100062b4, 0x1910001f, 0x100062b4, 0x81322804, 0xe2000004,
-	0x81202804, 0xe2000004, 0x1b80001f, 0x20000034, 0x1910001f, 0x100062b4,
-	0x81142804, 0xd80017c4, 0x17c07c1f, 0xe2e0000e, 0xe2e0000c, 0xe2e0000d,
-	0xf0000000, 0x17c07c1f, 0xe2e0002d, 0x1a00001f, 0x100062b4, 0x1910001f,
-	0x100062b4, 0xa1002804, 0xe2000004, 0xa1122804, 0xe2000004, 0x1b80001f,
-	0x20000080, 0x1910001f, 0x100062b4, 0x81142804, 0xd8201a64, 0x17c07c1f,
-	0xe2e0002f, 0xe2e0002b, 0xe2e00023, 0x1380201f, 0xe2e00022, 0xf0000000,
+	0xf0000000, 0x17c07c1f, 0xe2e0004f, 0xe2e0006f, 0xe2e0002f, 0xe8208000,
+	0x10006244, 0x00000001, 0x1b80001f, 0x20000080, 0xe2e0002e, 0xe2e0003e,
+	0xe2e0003a, 0xe2e00032, 0x1b80001f, 0x00000020, 0x1910001f, 0x10006b6c,
+	0x09000004, 0x00100000, 0x1a10001f, 0x10006b6c, 0xe2000004, 0xf0000000,
+	0x17c07c1f, 0xe2e00036, 0xe2e0003e, 0x1b80001f, 0x00000020, 0xe2e0003c,
+	0xe2a00000, 0x1b80001f, 0x20000080, 0xe2e0007c, 0x1b80001f, 0x20000003,
+	0xe2e0005c, 0xe2e0004c, 0xe2e0004d, 0xf0000000, 0x17c07c1f, 0xe2e0004f,
+	0xe2e0006f, 0xe2e0002f, 0xe2a00001, 0x1b80001f, 0x20000080, 0xe2e0002e,
+	0xe2e0003e, 0xe2e0003a, 0xe2e00032, 0xf0000000, 0x17c07c1f, 0xe2e00026,
+	0xe2e0002e, 0x1b80001f, 0x00000020, 0x1a00001f, 0x100062b4, 0x1910001f,
+	0x100062b4, 0x81322804, 0xe2000004, 0x81202804, 0xe2000004, 0x1b80001f,
+	0x20000080, 0xe2e0000e, 0xe2e0000c, 0xe2e0000d, 0xf0000000, 0x17c07c1f,
+	0xe2e0002d, 0x1a00001f, 0x100062b4, 0x1910001f, 0x100062b4, 0xa1002804,
+	0xe2000004, 0xa1122804, 0xe2000004, 0x1b80001f, 0x20000080, 0xe2e0002f,
+	0xe2e0002b, 0xe2e00023, 0x1b80001f, 0x00000020, 0xe2e00022, 0xf0000000,
 	0x17c07c1f, 0x1900001f, 0x1020020c, 0x1a10001f, 0x1020020c, 0xaa000008,
-	0x00000001, 0xe1000008, 0x1910001f, 0x10006720, 0x820c9001, 0xd8201cc8,
+	0x00000001, 0xe1000008, 0x1910001f, 0x10006720, 0x820c9001, 0xd8202b08,
 	0x17c07c1f, 0x1900001f, 0x10001220, 0x1a10001f, 0x10001220, 0xa21f0408,
-	0xe1000008, 0x1900001f, 0x10001228, 0x1a10001f, 0x10001228, 0x810f2001,
-	0xd8201e24, 0x17c07c1f, 0xe2e0006d, 0xe2e0002d, 0x1a00001f, 0x100062b8,
-	0x1910001f, 0x100062b8, 0xa9000004, 0x00000001, 0xe2000004, 0x1910001f,
-	0x100062b8, 0x81041001, 0xd8202024, 0x17c07c1f, 0xe2e0002c, 0xe2e0003c,
-	0xe2e0003e, 0xe2e0003a, 0xe2e00032, 0x1910001f, 0x1000660c, 0x81079001,
-	0x1a10001f, 0x10006610, 0x8207a001, 0xa1002004, 0xd8002164, 0x17c07c1f,
-	0x1900001f, 0x10006404, 0x1a10001f, 0x10006404, 0xa2168408, 0xe1000008,
-	0xf0000000, 0x17c07c1f, 0x1a10001f, 0x10006918, 0x81022001, 0xb102a081,
-	0xb1062081, 0xb106a081, 0xb1003081, 0xd8202ba4, 0x17c07c1f, 0x1900001f,
-	0x10006404, 0x1a10001f, 0x10006404, 0x8a000008, 0x0000dfff, 0xe1000008,
-	0xe2e00036, 0xe2e0003e, 0x1910001f, 0x1000660c, 0x81079001, 0x1a10001f,
-	0x10006610, 0x8207a001, 0x81002004, 0xd82025c4, 0x17c07c1f, 0xe2e0002e,
-	0x1a00001f, 0x100062b8, 0x1910001f, 0x100062b8, 0x89000004, 0x0000fffe,
-	0xe2000004, 0x1910001f, 0x100062b8, 0x81041001, 0xd80027e4, 0x17c07c1f,
-	0xe2e0006e, 0xe2e0004e, 0xe2e0004c, 0xe2e0004d, 0x1900001f, 0x10001220,
-	0x1a10001f, 0x10001220, 0x8a000008, 0xbfffffff, 0xe1000008, 0x1900001f,
-	0x10001228, 0x1a10001f, 0x10001228, 0x810f2001, 0xd80029e4, 0x17c07c1f,
+	0xe1000008, 0x1b80001f, 0x20000080, 0xe2e0006d, 0xe2e0002d, 0x1a00001f,
+	0x100062b8, 0x1910001f, 0x100062b8, 0xa9000004, 0x00000001, 0xe2000004,
+	0x1b80001f, 0x20000080, 0xe2e0002c, 0xe2e0003c, 0xe2e0003e, 0xe2e0003a,
+	0xe2e00032, 0x1b80001f, 0x00000020, 0x1900001f, 0x10006404, 0x1a10001f,
+	0x10006404, 0xa2168408, 0xe1000008, 0xf0000000, 0x17c07c1f, 0x1a10001f,
+	0x10006918, 0x81022001, 0xb102a081, 0xb1062081, 0xb106a081, 0xb1003081,
+	0xd8203624, 0x17c07c1f, 0x1900001f, 0x10006404, 0x1a10001f, 0x10006404,
+	0x8a000008, 0x0000dfff, 0xe1000008, 0xe2e00036, 0xe2e0003e, 0x1b80001f,
+	0x00000020, 0xe2e0002e, 0x1a00001f, 0x100062b8, 0x1910001f, 0x100062b8,
+	0x89000004, 0x0000fffe, 0xe2000004, 0x1b80001f, 0x20000080, 0xe2e0006e,
+	0xe2e0004e, 0xe2e0004c, 0xe2e0004d, 0x1900001f, 0x10001220, 0x1a10001f,
+	0x10001220, 0x8a000008, 0xbfffffff, 0xe1000008, 0x1b80001f, 0x20000080,
 	0x1900001f, 0x1020020c, 0x1a10001f, 0x1020020c, 0x8a000008, 0xfffffffe,
-	0xe1000008, 0xf0000000, 0x17c07c1f, 0x18c0001f, 0x10006b6c, 0x1910001f,
-	0x10006b6c, 0xa1002804, 0xe0c00004, 0xf0000000, 0x17c07c1f, 0x17c07c1f,
-	0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
-	0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
-	0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
-	0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
-	0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
-	0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
-	0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
-	0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
-	0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
-	0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
-	0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
-	0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
-	0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
+	0xe1000008, 0xf0000000, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
 	0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
 	0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
 	0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f, 0x17c07c1f,
@@ -144,86 +144,93 @@
 	0x17c07c1f, 0x17c07c1f, 0x1840001f, 0x00000001, 0x11407c1f, 0xe8208000,
 	0x10006b6c, 0xa0000000, 0xe8208000, 0x10006310, 0x0b160008, 0x1900001f,
 	0x000f7bde, 0x1a00001f, 0x10200268, 0xe2000004, 0xe8208000, 0x10006600,
-	0x00000000, 0xc2802be0, 0x1280041f, 0xe8208000, 0x10006b04, 0x00000000,
-	0x1b00001f, 0x21000001, 0x1b80001f, 0xd0010000, 0xc2802be0, 0x1290841f,
-	0x69200006, 0xbeefbeef, 0xd82047c4, 0x17c07c1f, 0xc2802be0, 0x1291041f,
-	0x1910001f, 0x10006358, 0x810b1001, 0xd8004444, 0x17c07c1f, 0x1980001f,
-	0xdeaddead, 0x69200006, 0xabcdabcd, 0xd8204524, 0x17c07c1f, 0xc2802be0,
-	0x1291841f, 0x88900001, 0x10006814, 0x1910001f, 0x10006400, 0x81271002,
-	0x1880001f, 0x10006600, 0xe0800004, 0x1910001f, 0x10006358, 0x810b1001,
-	0xd80046e4, 0x17c07c1f, 0x1980001f, 0x12345678, 0x60a07c05, 0x89100002,
-	0x10006600, 0x80801001, 0xd8007742, 0x17c07c1f, 0xc2802be0, 0x1292041f,
-	0x1a10001f, 0x10006720, 0x82002001, 0x82201408, 0xd8204a68, 0x17c07c1f,
-	0x1a40001f, 0x10006200, 0x1a80001f, 0x1000625c, 0xc2401480, 0x17c07c1f,
-	0xa1400405, 0xc2802be0, 0x1292841f, 0x1a10001f, 0x10006720, 0x8200a001,
-	0x82209408, 0xd8204c48, 0x17c07c1f, 0x1a40001f, 0x10006218, 0x1a80001f,
-	0x10006264, 0xc2401480, 0x17c07c1f, 0xa1508405, 0xc2802be0, 0x1293041f,
-	0x1a10001f, 0x10006720, 0x82012001, 0x82211408, 0xd8204e28, 0x17c07c1f,
-	0x1a40001f, 0x1000621c, 0x1a80001f, 0x1000626c, 0xc2401480, 0x17c07c1f,
-	0xa1510405, 0x1a10001f, 0x10006720, 0x8201a001, 0x82219408, 0xd8204fc8,
-	0x17c07c1f, 0x1a40001f, 0x10006220, 0x1a80001f, 0x10006274, 0xc2401480,
+	0x00000000, 0x1b00001f, 0x21000001, 0x1b80001f, 0xd0010000, 0x69200006,
+	0xbeefbeef, 0xd8204664, 0x17c07c1f, 0x1910001f, 0x10006358, 0x810b1001,
+	0xd8004324, 0x17c07c1f, 0x1980001f, 0xdeaddead, 0x69200006, 0xabcdabcd,
+	0xd8204404, 0x17c07c1f, 0x88900001, 0x10006814, 0x1910001f, 0x10006400,
+	0x81271002, 0x1880001f, 0x10006600, 0xe0800004, 0x1910001f, 0x10006358,
+	0x810b1001, 0xd8004584, 0x17c07c1f, 0x1980001f, 0x12345678, 0x60a07c05,
+	0x89100002, 0x10006600, 0x80801001, 0xd8007d42, 0x17c07c1f, 0x1890001f,
+	0x10006b00, 0x82090801, 0xc8800008, 0x17c07c1f, 0x1a10001f, 0x10006720,
+	0x82002001, 0x82201408, 0xd8204968, 0x17c07c1f, 0x1a40001f, 0x10006200,
+	0x1a80001f, 0x1000625c, 0xc24023e0, 0x17c07c1f, 0xa1400405, 0x1a10001f,
+	0x10006720, 0x8200a001, 0x82209408, 0xd8204b08, 0x17c07c1f, 0x1a40001f,
+	0x10006218, 0x1a80001f, 0x10006264, 0xc24023e0, 0x17c07c1f, 0xa1508405,
+	0x1a10001f, 0x10006720, 0x82012001, 0x82211408, 0xd8204ca8, 0x17c07c1f,
+	0x1a40001f, 0x1000621c, 0x1a80001f, 0x1000626c, 0xc24023e0, 0x17c07c1f,
+	0xa1510405, 0x1a10001f, 0x10006720, 0x8201a001, 0x82219408, 0xd8204e48,
+	0x17c07c1f, 0x1a40001f, 0x10006220, 0x1a80001f, 0x10006274, 0xc24023e0,
 	0x17c07c1f, 0xa1518405, 0x1a10001f, 0x10006720, 0x82022001, 0x82221408,
-	0xd8205148, 0x17c07c1f, 0x1a40001f, 0x100062a0, 0x1280041f, 0xc2401900,
+	0xd8204fc8, 0x17c07c1f, 0x1a40001f, 0x100062a0, 0x1280041f, 0xc24027c0,
 	0x17c07c1f, 0xa1520405, 0x1a10001f, 0x10006720, 0x8202a001, 0x82229408,
-	0xd82052c8, 0x17c07c1f, 0x1a40001f, 0x100062a4, 0x1290841f, 0xc2401900,
+	0xd8205148, 0x17c07c1f, 0x1a40001f, 0x100062a4, 0x1290841f, 0xc24027c0,
 	0x17c07c1f, 0xa1528405, 0x1a10001f, 0x10006720, 0x82032001, 0x82231408,
-	0xd82053a8, 0x17c07c1f, 0xa1530405, 0x1a10001f, 0x10006720, 0x8203a001,
-	0x82239408, 0xd8205488, 0x17c07c1f, 0xa1538405, 0x1a10001f, 0x10006b00,
-	0x8108a001, 0xd8205864, 0x17c07c1f, 0x1a10001f, 0x10006610, 0x8104a001,
-	0xb1052081, 0xb105a081, 0xb1062081, 0xd8005744, 0x17c07c1f, 0x1a10001f,
-	0x10006610, 0x81042001, 0xd8205744, 0x17c07c1f, 0x1a40001f, 0x10006208,
-	0xc24009c0, 0x17c07c1f, 0x1910001f, 0x10006610, 0x81041001, 0xd8005864,
-	0x17c07c1f, 0x1a40001f, 0x10006208, 0xc2400000, 0x17c07c1f, 0x1a10001f,
-	0x10006b00, 0x81082001, 0xd8205ae4, 0x17c07c1f, 0x1a10001f, 0x10006610,
-	0x81082001, 0xb108a081, 0xd8005ae4, 0x17c07c1f, 0x1a10001f, 0x10006610,
-	0x8107a001, 0xd8205ae4, 0x17c07c1f, 0x1a40001f, 0x100062b0, 0xc2401be0,
-	0x17c07c1f, 0x1b80001f, 0x20000208, 0xd82076cc, 0x17c07c1f, 0x1910001f,
-	0x10006610, 0x81079001, 0xd8005c84, 0x17c07c1f, 0x1a40001f, 0x100062b0,
-	0xc2402380, 0x17c07c1f, 0x81001401, 0xd8206004, 0x17c07c1f, 0x1a10001f,
-	0x10006918, 0x81002001, 0xb1042081, 0xb1003081, 0xb10c3081, 0xd8206004,
-	0x17c07c1f, 0x1a40001f, 0x10006200, 0x1a80001f, 0x1000625c, 0xc2401280,
-	0x17c07c1f, 0x89400005, 0xfffffffe, 0xe8208000, 0x10006f00, 0x00000000,
-	0xe8208000, 0x10006b30, 0x00000000, 0xe8208000, 0x100063e0, 0x00000001,
-	0x81009401, 0xd8206364, 0x17c07c1f, 0x1a10001f, 0x10006918, 0x8100a001,
-	0xb104a081, 0xb1003081, 0xd8206364, 0x17c07c1f, 0x1a40001f, 0x10006218,
-	0x1a80001f, 0x10006264, 0xc2401280, 0x17c07c1f, 0x89400005, 0xfffffffd,
-	0xe8208000, 0x10006f04, 0x00000000, 0xe8208000, 0x10006b34, 0x00000000,
-	0xe8208000, 0x100063e0, 0x00000002, 0x81011401, 0xd82066c4, 0x17c07c1f,
-	0x1a10001f, 0x10006918, 0x81012001, 0xb1052081, 0xb1003081, 0xd82066c4,
-	0x17c07c1f, 0x1a40001f, 0x1000621c, 0x1a80001f, 0x1000626c, 0xc2401280,
-	0x17c07c1f, 0x89400005, 0xfffffffb, 0xe8208000, 0x10006f08, 0x00000000,
-	0xe8208000, 0x10006b38, 0x00000000, 0xe8208000, 0x100063e0, 0x00000004,
-	0x81019401, 0xd8206a24, 0x17c07c1f, 0x1a10001f, 0x10006918, 0x8101a001,
-	0xb105a081, 0xb1003081, 0xd8206a24, 0x17c07c1f, 0x1a40001f, 0x10006220,
-	0x1a80001f, 0x10006274, 0xc2401280, 0x17c07c1f, 0x89400005, 0xfffffff7,
-	0xe8208000, 0x10006f0c, 0x00000000, 0xe8208000, 0x10006b3c, 0x00000000,
-	0xe8208000, 0x100063e0, 0x00000008, 0x1910001f, 0x10006610, 0x81079001,
-	0xd8207144, 0x17c07c1f, 0x81021401, 0xd8206e04, 0x17c07c1f, 0x1a10001f,
-	0x10006918, 0x81022001, 0xb1062081, 0xb1003081, 0xd8206e04, 0x17c07c1f,
-	0x1a40001f, 0x100062a0, 0x1280041f, 0xc2401600, 0x17c07c1f, 0x89400005,
-	0xffffffef, 0xe8208000, 0x10006f10, 0x00000000, 0xe8208000, 0x10006b40,
-	0x00000000, 0xe8208000, 0x100063e0, 0x00000010, 0x81029401, 0xd8207144,
-	0x17c07c1f, 0x1a10001f, 0x10006918, 0x8102a001, 0xb106a081, 0xb1003081,
-	0xd8207144, 0x17c07c1f, 0x1a40001f, 0x100062a4, 0x1290841f, 0xc2401600,
-	0x17c07c1f, 0x89400005, 0xffffffdf, 0xe8208000, 0x10006f14, 0x00000000,
-	0xe8208000, 0x10006b44, 0x00000000, 0xe8208000, 0x100063e0, 0x00000020,
-	0x81031401, 0xd82073e4, 0x17c07c1f, 0x1a10001f, 0x10006918, 0x81032001,
-	0xb1072081, 0xb1003081, 0xd82073e4, 0x17c07c1f, 0x89400005, 0xffffffbf,
-	0xe8208000, 0x10006f18, 0x00000000, 0xe8208000, 0x10006b48, 0x00000000,
-	0xe8208000, 0x100063e0, 0x00000040, 0x81039401, 0xd8207684, 0x17c07c1f,
-	0x1a10001f, 0x10006918, 0x8103a001, 0xb107a081, 0xb1003081, 0xd8207684,
-	0x17c07c1f, 0x89400005, 0xffffff7f, 0xe8208000, 0x10006f1c, 0x00000000,
-	0xe8208000, 0x10006b4c, 0x00000000, 0xe8208000, 0x100063e0, 0x00000080,
-	0xc2802be0, 0x1293841f, 0xd00042c0, 0x17c07c1f, 0xc2802be0, 0x1294041f,
+	0xd8205228, 0x17c07c1f, 0xa1530405, 0x1a10001f, 0x10006720, 0x8203a001,
+	0x82239408, 0xd8205308, 0x17c07c1f, 0xa1538405, 0x1a10001f, 0x10006b00,
+	0x8108a001, 0xd8205ee4, 0x17c07c1f, 0x1a10001f, 0x10006610, 0x8104a001,
+	0xb1052081, 0xb105a081, 0xb1062081, 0xd8005904, 0x17c07c1f, 0x81042001,
+	0xd8205904, 0x17c07c1f, 0x1900001f, 0x1020002c, 0x1a10001f, 0x1020002c,
+	0xaa000008, 0x00000010, 0xe1000008, 0x1910001f, 0x10006720, 0x820c1001,
+	0xd82055e8, 0x17c07c1f, 0x1900001f, 0x10001250, 0x1a10001f, 0x10001250,
+	0xa2110408, 0xe1000008, 0x1b80001f, 0x20000080, 0x1900001f, 0x10001220,
+	0x1a10001f, 0x10001220, 0xa21e8408, 0xe1000008, 0x1b80001f, 0x20000080,
+	0x1a40001f, 0x10006208, 0xc2401f00, 0x17c07c1f, 0x1910001f, 0x10006610,
+	0x81041001, 0xd8005ee4, 0x17c07c1f, 0x1a10001f, 0x10006918, 0x81002001,
+	0xb100a081, 0xb1012081, 0xb101a081, 0xb1042081, 0xb104a081, 0xb1052081,
+	0xb105a081, 0xb1003081, 0xd8205ee4, 0x17c07c1f, 0x1a40001f, 0x10006208,
+	0xc2401cc0, 0x17c07c1f, 0x1900001f, 0x10001250, 0x1a10001f, 0x10001250,
+	0x8a000008, 0xfffffffb, 0xe1000008, 0x1b80001f, 0x20000080, 0x1900001f,
+	0x10001220, 0x1a10001f, 0x10001220, 0x8a000008, 0xdfffffff, 0xe1000008,
+	0x1b80001f, 0x20000080, 0x1900001f, 0x1020002c, 0x1a10001f, 0x1020002c,
+	0x8a000008, 0xffffffef, 0xe1000008, 0x1a10001f, 0x10006b00, 0x81082001,
+	0xd8206164, 0x17c07c1f, 0x1a10001f, 0x10006610, 0x81082001, 0xb108a081,
+	0xd8006164, 0x17c07c1f, 0x1a10001f, 0x10006610, 0x8107a001, 0xd8206164,
+	0x17c07c1f, 0x1a40001f, 0x100062b0, 0xc2402a20, 0x17c07c1f, 0x1b80001f,
+	0x20000208, 0xd8207d0c, 0x17c07c1f, 0x1910001f, 0x10006610, 0x81079001,
+	0xd8006304, 0x17c07c1f, 0x1a40001f, 0x100062b0, 0xc2402fe0, 0x17c07c1f,
+	0x81001401, 0xd8206684, 0x17c07c1f, 0x1a10001f, 0x10006918, 0x81002001,
+	0xb1042081, 0xb1003081, 0xb10c3081, 0xd8206684, 0x17c07c1f, 0x1a40001f,
+	0x10006200, 0x1a80001f, 0x1000625c, 0xc24021e0, 0x17c07c1f, 0x89400005,
+	0xfffffffe, 0xe8208000, 0x10006f00, 0x00000000, 0xe8208000, 0x10006b30,
+	0x00000000, 0xe8208000, 0x100063e0, 0x00000001, 0x81009401, 0xd82069e4,
+	0x17c07c1f, 0x1a10001f, 0x10006918, 0x8100a001, 0xb104a081, 0xb1003081,
+	0xd82069e4, 0x17c07c1f, 0x1a40001f, 0x10006218, 0x1a80001f, 0x10006264,
+	0xc24021e0, 0x17c07c1f, 0x89400005, 0xfffffffd, 0xe8208000, 0x10006f04,
+	0x00000000, 0xe8208000, 0x10006b34, 0x00000000, 0xe8208000, 0x100063e0,
+	0x00000002, 0x81011401, 0xd8206d44, 0x17c07c1f, 0x1a10001f, 0x10006918,
+	0x81012001, 0xb1052081, 0xb1003081, 0xd8206d44, 0x17c07c1f, 0x1a40001f,
+	0x1000621c, 0x1a80001f, 0x1000626c, 0xc24021e0, 0x17c07c1f, 0x89400005,
+	0xfffffffb, 0xe8208000, 0x10006f08, 0x00000000, 0xe8208000, 0x10006b38,
+	0x00000000, 0xe8208000, 0x100063e0, 0x00000004, 0x81019401, 0xd82070a4,
+	0x17c07c1f, 0x1a10001f, 0x10006918, 0x8101a001, 0xb105a081, 0xb1003081,
+	0xd82070a4, 0x17c07c1f, 0x1a40001f, 0x10006220, 0x1a80001f, 0x10006274,
+	0xc24021e0, 0x17c07c1f, 0x89400005, 0xfffffff7, 0xe8208000, 0x10006f0c,
+	0x00000000, 0xe8208000, 0x10006b3c, 0x00000000, 0xe8208000, 0x100063e0,
+	0x00000008, 0x1910001f, 0x10006610, 0x81079001, 0xd82077c4, 0x17c07c1f,
+	0x81021401, 0xd8207484, 0x17c07c1f, 0x1a10001f, 0x10006918, 0x81022001,
+	0xb1062081, 0xb1003081, 0xd8207484, 0x17c07c1f, 0x1a40001f, 0x100062a0,
+	0x1280041f, 0xc2402560, 0x17c07c1f, 0x89400005, 0xffffffef, 0xe8208000,
+	0x10006f10, 0x00000000, 0xe8208000, 0x10006b40, 0x00000000, 0xe8208000,
+	0x100063e0, 0x00000010, 0x81029401, 0xd82077c4, 0x17c07c1f, 0x1a10001f,
+	0x10006918, 0x8102a001, 0xb106a081, 0xb1003081, 0xd82077c4, 0x17c07c1f,
+	0x1a40001f, 0x100062a4, 0x1290841f, 0xc2402560, 0x17c07c1f, 0x89400005,
+	0xffffffdf, 0xe8208000, 0x10006f14, 0x00000000, 0xe8208000, 0x10006b44,
+	0x00000000, 0xe8208000, 0x100063e0, 0x00000020, 0x81031401, 0xd8207a64,
+	0x17c07c1f, 0x1a10001f, 0x10006918, 0x81032001, 0xb1072081, 0xb1003081,
+	0xd8207a64, 0x17c07c1f, 0x89400005, 0xffffffbf, 0xe8208000, 0x10006f18,
+	0x00000000, 0xe8208000, 0x10006b48, 0x00000000, 0xe8208000, 0x100063e0,
+	0x00000040, 0x81039401, 0xd8207d04, 0x17c07c1f, 0x1a10001f, 0x10006918,
+	0x8103a001, 0xb107a081, 0xb1003081, 0xd8207d04, 0x17c07c1f, 0x89400005,
+	0xffffff7f, 0xe8208000, 0x10006f1c, 0x00000000, 0xe8208000, 0x10006b4c,
+	0x00000000, 0xe8208000, 0x100063e0, 0x00000080, 0xd0004220, 0x17c07c1f,
 	0xe8208000, 0x10006600, 0x00000000, 0x1ac0001f, 0x55aa55aa, 0x1940001f,
-	0xaa55aa55, 0xc2802be0, 0x1294841f, 0x1b80001f, 0x00001000, 0xf0000000,
-	0x17c07c1f
+	0xaa55aa55, 0x1b80001f, 0x00001000, 0xf0000000, 0x17c07c1f
 };
 
 static const struct pcm_desc mcdi_pcm = {
-	.version = "pcm_mcdi_mt8173_20150901_v1",
+	.version = "pcm_mcdi_mt8173_20151110_V4",
 	.base = mcdi_binary,
-	.size = 967,
+	.size = 1013,
 	.sess = 2,
 	.replace = 0,
 };
@@ -459,6 +466,24 @@
 				PCM_MCDI_CA53_CPUTOP_PWRCTL);
 }
 
+void spm_mcdi_prepare_for_mtcmos(void)
+{
+	const struct pcm_desc *pcmdesc = spm_mcdi.pcmdesc;
+	struct pwr_ctrl *pwrctrl = spm_mcdi.pwrctrl;
+
+	if (is_mcdi_ready() == 0) {
+		if (is_hotplug_ready() == 1)
+			spm_clear_hotplug();
+		set_pwrctrl_pcm_flags(pwrctrl, 0);
+		spm_reset_and_init_pcm();
+		spm_kick_im_to_fetch(pcmdesc);
+		spm_set_power_control(pwrctrl);
+		spm_set_wakeup_event(pwrctrl);
+		spm_kick_pcm_to_run(pwrctrl);
+		set_mcdi_ready();
+	}
+}
+
 void spm_mcdi_prepare_for_off_state(unsigned long mpidr, unsigned int afflvl)
 {
 	const struct pcm_desc *pcmdesc = spm_mcdi.pcmdesc;
diff --git a/plat/mediatek/mt8173/drivers/spm/spm_mcdi.h b/plat/mediatek/mt8173/drivers/spm/spm_mcdi.h
index 4e9aa3e..4d1f990 100644
--- a/plat/mediatek/mt8173/drivers/spm/spm_mcdi.h
+++ b/plat/mediatek/mt8173/drivers/spm/spm_mcdi.h
@@ -31,6 +31,7 @@
 #define __SPM_MCDI_H__
 
 void spm_mcdi_wakeup_all_cores(void);
+void spm_mcdi_prepare_for_mtcmos(void);
 void spm_mcdi_prepare_for_off_state(unsigned long mpidr, unsigned int afflvl);
 void spm_mcdi_finish_for_on_state(unsigned long mpidr, unsigned int afflvl);
 
diff --git a/plat/mediatek/mt8173/plat_sip_calls.c b/plat/mediatek/mt8173/plat_sip_calls.c
index 92deb60..e12892f 100644
--- a/plat/mediatek/mt8173/plat_sip_calls.c
+++ b/plat/mediatek/mt8173/plat_sip_calls.c
@@ -29,6 +29,7 @@
  */
 #include <mmio.h>
 #include <mtk_sip_svc.h>
+#include <mtcmos.h>
 
 /* Authorized secure register list */
 enum {
@@ -55,3 +56,30 @@
 
 	return MTK_SIP_E_INVALID_PARAM;
 }
+
+uint64_t mt_sip_pwr_on_mtcmos(uint32_t val)
+{
+	uint32_t ret;
+
+	ret = mtcmos_non_cpu_ctrl(1, val);
+	if (ret)
+		return MTK_SIP_E_INVALID_PARAM;
+	else
+		return MTK_SIP_E_SUCCESS;
+}
+
+uint64_t mt_sip_pwr_off_mtcmos(uint32_t val)
+{
+	uint32_t ret;
+
+	ret = mtcmos_non_cpu_ctrl(0, val);
+	if (ret)
+		return MTK_SIP_E_INVALID_PARAM;
+	else
+		return MTK_SIP_E_SUCCESS;
+}
+
+uint64_t mt_sip_pwr_mtcmos_support(void)
+{
+	return MTK_SIP_E_SUCCESS;
+}