Skip to content

Commit bda7b07

Browse files
andy-shevIngo Molnar
authored andcommitted
x86/platform/intel-mid: Implement power off sequence
Tell SCU that we are about powering off the device. Signed-off-by: Andy Shevchenko <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 3976b03 commit bda7b07

File tree

4 files changed

+32
-1
lines changed

4 files changed

+32
-1
lines changed

arch/x86/include/asm/intel-mid.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
extern int intel_mid_pci_init(void);
1919
extern int intel_mid_pci_set_power_state(struct pci_dev *pdev, pci_power_t state);
2020

21+
extern void intel_mid_pwr_power_off(void);
22+
2123
#define INTEL_MID_PWR_LSS_OFFSET 4
2224
#define INTEL_MID_PWR_LSS_TYPE (1 << 7)
2325

arch/x86/include/asm/intel_scu_ipc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#include <linux/notifier.h>
55

6+
#define IPCMSG_COLD_OFF 0x80 /* Only for Tangier */
7+
68
#define IPCMSG_WARM_RESET 0xF0
79
#define IPCMSG_COLD_RESET 0xF1
810
#define IPCMSG_SOFT_RESET 0xF2

arch/x86/platform/intel-mid/intel-mid.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ EXPORT_SYMBOL_GPL(__intel_mid_cpu_chip);
7070

7171
static void intel_mid_power_off(void)
7272
{
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);
7378
};
7479

7580
static void intel_mid_reboot(void)

arch/x86/platform/intel-mid/pwr.c

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,15 @@
4848
#define PM_CMD_CM_IMMEDIATE (1 << 9)
4949
#define PM_CMD_CM_DELAY (2 << 9)
5050
#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)
5260

5361
/* List of commands */
5462
#define CMD_SET_CFG 0x01
@@ -264,6 +272,20 @@ int intel_mid_pci_set_power_state(struct pci_dev *pdev, pci_power_t state)
264272
}
265273
EXPORT_SYMBOL_GPL(intel_mid_pci_set_power_state);
266274

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+
267289
int intel_mid_pwr_get_lss_id(struct pci_dev *pdev)
268290
{
269291
int vndr;

0 commit comments

Comments
 (0)