diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2016-09-07 08:39:55 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-09-08 02:03:58 -0400 |
commit | bda7b072de999280ef78aaea4335ec58afc4bdb2 (patch) | |
tree | 57b48f6f54d942066930831c725f05aa7d8a71b9 | |
parent | 3976b0380b315651137ce4321b1171ac0a1d26ed (diff) |
x86/platform/intel-mid: Implement power off sequence
Tell SCU that we are about powering off the device.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20160907123955.21228-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/x86/include/asm/intel-mid.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/intel_scu_ipc.h | 2 | ||||
-rw-r--r-- | arch/x86/platform/intel-mid/intel-mid.c | 5 | ||||
-rw-r--r-- | arch/x86/platform/intel-mid/pwr.c | 24 |
4 files changed, 32 insertions, 1 deletions
diff --git a/arch/x86/include/asm/intel-mid.h b/arch/x86/include/asm/intel-mid.h index 9d6b097aa73d..5b6753d1f7f4 100644 --- a/arch/x86/include/asm/intel-mid.h +++ b/arch/x86/include/asm/intel-mid.h | |||
@@ -18,6 +18,8 @@ | |||
18 | extern int intel_mid_pci_init(void); | 18 | extern int intel_mid_pci_init(void); |
19 | extern int intel_mid_pci_set_power_state(struct pci_dev *pdev, pci_power_t state); | 19 | extern int intel_mid_pci_set_power_state(struct pci_dev *pdev, pci_power_t state); |
20 | 20 | ||
21 | extern void intel_mid_pwr_power_off(void); | ||
22 | |||
21 | #define INTEL_MID_PWR_LSS_OFFSET 4 | 23 | #define INTEL_MID_PWR_LSS_OFFSET 4 |
22 | #define INTEL_MID_PWR_LSS_TYPE (1 << 7) | 24 | #define INTEL_MID_PWR_LSS_TYPE (1 << 7) |
23 | 25 | ||
diff --git a/arch/x86/include/asm/intel_scu_ipc.h b/arch/x86/include/asm/intel_scu_ipc.h index 925b605eb5c6..4fb1d0abef95 100644 --- a/arch/x86/include/asm/intel_scu_ipc.h +++ b/arch/x86/include/asm/intel_scu_ipc.h | |||
@@ -3,6 +3,8 @@ | |||
3 | 3 | ||
4 | #include <linux/notifier.h> | 4 | #include <linux/notifier.h> |
5 | 5 | ||
6 | #define IPCMSG_COLD_OFF 0x80 /* Only for Tangier */ | ||
7 | |||
6 | #define IPCMSG_WARM_RESET 0xF0 | 8 | #define IPCMSG_WARM_RESET 0xF0 |
7 | #define IPCMSG_COLD_RESET 0xF1 | 9 | #define IPCMSG_COLD_RESET 0xF1 |
8 | #define IPCMSG_SOFT_RESET 0xF2 | 10 | #define IPCMSG_SOFT_RESET 0xF2 |
diff --git a/arch/x86/platform/intel-mid/intel-mid.c b/arch/x86/platform/intel-mid/intel-mid.c index ce119d2ba0d0..7850128f0026 100644 --- a/arch/x86/platform/intel-mid/intel-mid.c +++ b/arch/x86/platform/intel-mid/intel-mid.c | |||
@@ -70,6 +70,11 @@ EXPORT_SYMBOL_GPL(__intel_mid_cpu_chip); | |||
70 | 70 | ||
71 | static void intel_mid_power_off(void) | 71 | static void intel_mid_power_off(void) |
72 | { | 72 | { |
73 | /* Shut down South Complex via PWRMU */ | ||
74 | intel_mid_pwr_power_off(); | ||
75 | |||
76 | /* Only for Tangier, the rest will ignore this command */ | ||
77 | intel_scu_ipc_simple_command(IPCMSG_COLD_OFF, 1); | ||
73 | }; | 78 | }; |
74 | 79 | ||
75 | static void intel_mid_reboot(void) | 80 | static void intel_mid_reboot(void) |
diff --git a/arch/x86/platform/intel-mid/pwr.c b/arch/x86/platform/intel-mid/pwr.c index 0548741b6894..2dfe998a5afd 100644 --- a/arch/x86/platform/intel-mid/pwr.c +++ b/arch/x86/platform/intel-mid/pwr.c | |||
@@ -48,7 +48,15 @@ | |||
48 | #define PM_CMD_CM_IMMEDIATE (1 << 9) | 48 | #define PM_CMD_CM_IMMEDIATE (1 << 9) |
49 | #define PM_CMD_CM_DELAY (2 << 9) | 49 | #define PM_CMD_CM_DELAY (2 << 9) |
50 | #define PM_CMD_CM_TRIGGER (3 << 9) | 50 | #define PM_CMD_CM_TRIGGER (3 << 9) |
51 | #define PM_CMD_D3cold (1 << 21) | 51 | |
52 | /* System states */ | ||
53 | #define PM_CMD_SYS_STATE_S5 (5 << 16) | ||
54 | |||
55 | /* Trigger variants */ | ||
56 | #define PM_CMD_CFG_TRIGGER_NC (3 << 19) | ||
57 | |||
58 | /* Message to wait for TRIGGER_NC case */ | ||
59 | #define TRIGGER_NC_MSG_2 (2 << 22) | ||
52 | 60 | ||
53 | /* List of commands */ | 61 | /* List of commands */ |
54 | #define CMD_SET_CFG 0x01 | 62 | #define CMD_SET_CFG 0x01 |
@@ -264,6 +272,20 @@ int intel_mid_pci_set_power_state(struct pci_dev *pdev, pci_power_t state) | |||
264 | } | 272 | } |
265 | EXPORT_SYMBOL_GPL(intel_mid_pci_set_power_state); | 273 | EXPORT_SYMBOL_GPL(intel_mid_pci_set_power_state); |
266 | 274 | ||
275 | void intel_mid_pwr_power_off(void) | ||
276 | { | ||
277 | struct mid_pwr *pwr = midpwr; | ||
278 | u32 cmd = PM_CMD_SYS_STATE_S5 | | ||
279 | PM_CMD_CMD(CMD_SET_CFG) | | ||
280 | PM_CMD_CM_TRIGGER | | ||
281 | PM_CMD_CFG_TRIGGER_NC | | ||
282 | TRIGGER_NC_MSG_2; | ||
283 | |||
284 | /* Send command to SCU */ | ||
285 | writel(cmd, pwr->regs + PM_CMD); | ||
286 | mid_pwr_wait(pwr); | ||
287 | } | ||
288 | |||
267 | int intel_mid_pwr_get_lss_id(struct pci_dev *pdev) | 289 | int intel_mid_pwr_get_lss_id(struct pci_dev *pdev) |
268 | { | 290 | { |
269 | int vndr; | 291 | int vndr; |