From 82924522558426f7fb725da47085586fa981d887 Mon Sep 17 00:00:00 2001 From: sathya Date: Wed, 16 Nov 2011 15:30:12 -0800 Subject: [PATCH] MFLD Power off support: Merged changes from git://jfumg-gcrmirror.jf.intel.com/a/bsp/hardware/intel/linux-2.6.git commit 9281a8b9e1ce267b74e5b73fa6ac822f5c1a8aa4 Author: Pavan Date: Thu Sep 15 16:23:50 2011 +0100 mid_pmu: implement mfld_shutdown to send S5 pmu command BZ: 5512 mfld_shutdown function is implemented to issue S5 pmu command This will be invoked from mrst.c to enter into S5. S5 sequence is necessary to sync vRTC to RTC Change-Id: Ie31291a24fdd1437b9ab6711907ce90aff08a65b Signed-off-by: Pavan Orig-Change-Id: Ifb39bcc457c59aaa9865559e45b7429327edf05e Reviewed-on: http://android.intel.com:8080/19746 Reviewed-by: Martin, LoicX Reviewed-by: Mansoor, Illyas Reviewed-by: Mendi, EduardoX Tested-by: Martin, LoicX Reviewed-by: buildbot Tested-by: buildbot Change-Id: I83f74c2c8a172ae19b06bc79b2cd51f661d66008 Reviewed-on: http://android.intel.com:8080/24608 Reviewed-by: Gross, Mark Tested-by: Gross, Mark --- arch/x86/platform/mfld/pmu.c | 14 ++++++++++++++ arch/x86/platform/mfld/pmu.h | 1 + arch/x86/platform/mrst/mrst.c | 5 +++++ include/linux/intel_mid_pm.h | 1 + 4 files changed, 21 insertions(+) diff --git a/arch/x86/platform/mfld/pmu.c b/arch/x86/platform/mfld/pmu.c index bdaf4e3..21a7432 100755 --- a/arch/x86/platform/mfld/pmu.c +++ b/arch/x86/platform/mfld/pmu.c @@ -2410,6 +2410,20 @@ static int mid_suspend(suspend_state_t state) return ret; } +void mfld_shutdown(void) +{ + down(&scu_ready_sem); + /* wait till SCU is ready */ + if (_pmu2_wait_not_busy()) + dev_err(&pmu_dev->dev, "SCU BUSY. Unable to Enter S5\n"); + else + /*send S5 command to SCU*/ + writel(S5_VALUE, &pmu_reg->pm_cmd); + + /* no more pm command expected. So not doing sem up */ + +} + static void mid_end(void) { #ifdef CONFIG_HAS_WAKELOCK diff --git a/arch/x86/platform/mfld/pmu.h b/arch/x86/platform/mfld/pmu.h index fb7515e..7b14820 100644 --- a/arch/x86/platform/mfld/pmu.h +++ b/arch/x86/platform/mfld/pmu.h @@ -150,6 +150,7 @@ /* some random number for initvalue */ #define MID_PCI_INDEX_HASH_INITVALUE 0x27041975 +#define S5_VALUE 0x309D2601 #define S0I1_VALUE 0X30992601 #define LPMP3_VALUE 0X40492601 #define S0I3_VALUE 0X309B2601 diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c index 1c2ac27..aa10935 100644 --- a/arch/x86/platform/mrst/mrst.c +++ b/arch/x86/platform/mrst/mrst.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -88,6 +89,10 @@ static void mrst_power_off(void) { if (__mrst_cpu_chip == MRST_CPU_CHIP_LINCROFT) intel_scu_ipc_simple_command(IPCMSG_COLD_RESET, 1); + else { + mfld_shutdown(); + } + } static void mrst_reboot(void) diff --git a/include/linux/intel_mid_pm.h b/include/linux/intel_mid_pm.h index 6774e1f..4532b4b 100644 --- a/include/linux/intel_mid_pm.h +++ b/include/linux/intel_mid_pm.h @@ -144,6 +144,7 @@ extern void pmu_enable_forward_msi(void); extern unsigned long pmu_get_cstate(unsigned long eax); extern int pmu_nc_set_power_state (int islands, int state_type, int reg_type); +extern void mfld_shutdown(void); #else -- 2.7.4