diff options
author | Li, Aubrey <aubrey.li@linux.intel.com> | 2014-06-30 02:09:38 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2014-07-25 17:11:58 -0400 |
commit | b00055cade45379fb6a51798b70ef520d7555c5f (patch) | |
tree | 2cfa8e89e2317a1c25c141d4b7177352e3a1946b | |
parent | 93e5eadd1f6e7f45c31aa327c42ac52e4df5ff6f (diff) |
x86/pmc_atom: Eisable a few S0ix wake up events for S0ix residency
Disable PMC S0IX_WAKE_EN events coming from LPC block(unused) and
also from GPIO_SUS ored dedicated IRQs (must be disabled as per PMC
programming rule), GPIOSCORE ored dedicated IRQs (must be disabled
as per PMC programming rule), GPIO_SUS shared IRQ (not necessary
since the IOAPIC_DS wake event will still work), GPIO_SCORE shared
IRQ (not necessary since the IOAPIC_DS wake event will still work).
Signed-off-by: Aubrey Li <aubrey.li@linux.intel.com>
Link: http://lkml.kernel.org/r/53B0FF22.5080403@linux.intel.com
Signed-off-by: Olivier Leveque <olivier.leveque@intel.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r-- | arch/x86/include/asm/pmc_atom.h | 21 | ||||
-rw-r--r-- | arch/x86/kernel/pmc_atom.c | 42 |
2 files changed, 63 insertions, 0 deletions
diff --git a/arch/x86/include/asm/pmc_atom.h b/arch/x86/include/asm/pmc_atom.h index 03a2769f2d7f..8e47e5d10e1d 100644 --- a/arch/x86/include/asm/pmc_atom.h +++ b/arch/x86/include/asm/pmc_atom.h | |||
@@ -19,6 +19,27 @@ | |||
19 | /* ValleyView Power Control Unit PCI Device ID */ | 19 | /* ValleyView Power Control Unit PCI Device ID */ |
20 | #define PCI_DEVICE_ID_VLV_PMC 0x0F1C | 20 | #define PCI_DEVICE_ID_VLV_PMC 0x0F1C |
21 | 21 | ||
22 | /* PMC Memory mapped IO registers */ | ||
23 | #define PMC_BASE_ADDR_OFFSET 0x44 | ||
24 | #define PMC_BASE_ADDR_MASK 0xFFFFFE00 | ||
25 | #define PMC_MMIO_REG_LEN 0x100 | ||
26 | #define PMC_REG_BIT_WIDTH 32 | ||
27 | |||
28 | /* S0ix wake event control */ | ||
29 | #define PMC_S0IX_WAKE_EN 0x3C | ||
30 | |||
31 | #define BIT_LPC_CLOCK_RUN BIT(4) | ||
32 | #define BIT_SHARED_IRQ_GPSC BIT(5) | ||
33 | #define BIT_ORED_DEDICATED_IRQ_GPSS BIT(18) | ||
34 | #define BIT_ORED_DEDICATED_IRQ_GPSC BIT(19) | ||
35 | #define BIT_SHARED_IRQ_GPSS BIT(20) | ||
36 | |||
37 | #define PMC_WAKE_EN_SETTING ~(BIT_LPC_CLOCK_RUN | \ | ||
38 | BIT_SHARED_IRQ_GPSC | \ | ||
39 | BIT_ORED_DEDICATED_IRQ_GPSS | \ | ||
40 | BIT_ORED_DEDICATED_IRQ_GPSC | \ | ||
41 | BIT_SHARED_IRQ_GPSS) | ||
42 | |||
22 | /* PMC I/O Registers */ | 43 | /* PMC I/O Registers */ |
23 | #define ACPI_BASE_ADDR_OFFSET 0x40 | 44 | #define ACPI_BASE_ADDR_OFFSET 0x40 |
24 | #define ACPI_BASE_ADDR_MASK 0xFFFFFE00 | 45 | #define ACPI_BASE_ADDR_MASK 0xFFFFFE00 |
diff --git a/arch/x86/kernel/pmc_atom.c b/arch/x86/kernel/pmc_atom.c index 9eb79f6fc512..d6cc0e9eee54 100644 --- a/arch/x86/kernel/pmc_atom.c +++ b/arch/x86/kernel/pmc_atom.c | |||
@@ -23,8 +23,24 @@ | |||
23 | 23 | ||
24 | #include <asm/pmc_atom.h> | 24 | #include <asm/pmc_atom.h> |
25 | 25 | ||
26 | struct pmc_dev { | ||
27 | u32 base_addr; | ||
28 | void __iomem *regmap; | ||
29 | }; | ||
30 | |||
31 | static struct pmc_dev pmc_device; | ||
26 | static u32 acpi_base_addr; | 32 | static u32 acpi_base_addr; |
27 | 33 | ||
34 | static inline u32 pmc_reg_read(struct pmc_dev *pmc, int reg_offset) | ||
35 | { | ||
36 | return readl(pmc->regmap + reg_offset); | ||
37 | } | ||
38 | |||
39 | static inline void pmc_reg_write(struct pmc_dev *pmc, int reg_offset, u32 val) | ||
40 | { | ||
41 | writel(val, pmc->regmap + reg_offset); | ||
42 | } | ||
43 | |||
28 | static void pmc_power_off(void) | 44 | static void pmc_power_off(void) |
29 | { | 45 | { |
30 | u16 pm1_cnt_port; | 46 | u16 pm1_cnt_port; |
@@ -42,8 +58,23 @@ static void pmc_power_off(void) | |||
42 | outl(pm1_cnt_value, pm1_cnt_port); | 58 | outl(pm1_cnt_value, pm1_cnt_port); |
43 | } | 59 | } |
44 | 60 | ||
61 | static void pmc_hw_reg_setup(struct pmc_dev *pmc) | ||
62 | { | ||
63 | /* | ||
64 | * Disable PMC S0IX_WAKE_EN events coming from: | ||
65 | * - LPC clock run | ||
66 | * - GPIO_SUS ored dedicated IRQs | ||
67 | * - GPIO_SCORE ored dedicated IRQs | ||
68 | * - GPIO_SUS shared IRQ | ||
69 | * - GPIO_SCORE shared IRQ | ||
70 | */ | ||
71 | pmc_reg_write(pmc, PMC_S0IX_WAKE_EN, (u32)PMC_WAKE_EN_SETTING); | ||
72 | } | ||
73 | |||
45 | static int pmc_setup_dev(struct pci_dev *pdev) | 74 | static int pmc_setup_dev(struct pci_dev *pdev) |
46 | { | 75 | { |
76 | struct pmc_dev *pmc = &pmc_device; | ||
77 | |||
47 | /* Obtain ACPI base address */ | 78 | /* Obtain ACPI base address */ |
48 | pci_read_config_dword(pdev, ACPI_BASE_ADDR_OFFSET, &acpi_base_addr); | 79 | pci_read_config_dword(pdev, ACPI_BASE_ADDR_OFFSET, &acpi_base_addr); |
49 | acpi_base_addr &= ACPI_BASE_ADDR_MASK; | 80 | acpi_base_addr &= ACPI_BASE_ADDR_MASK; |
@@ -52,6 +83,17 @@ static int pmc_setup_dev(struct pci_dev *pdev) | |||
52 | if (acpi_base_addr != 0 && pm_power_off == NULL) | 83 | if (acpi_base_addr != 0 && pm_power_off == NULL) |
53 | pm_power_off = pmc_power_off; | 84 | pm_power_off = pmc_power_off; |
54 | 85 | ||
86 | pci_read_config_dword(pdev, PMC_BASE_ADDR_OFFSET, &pmc->base_addr); | ||
87 | pmc->base_addr &= PMC_BASE_ADDR_MASK; | ||
88 | |||
89 | pmc->regmap = ioremap_nocache(pmc->base_addr, PMC_MMIO_REG_LEN); | ||
90 | if (!pmc->regmap) { | ||
91 | dev_err(&pdev->dev, "error: ioremap failed\n"); | ||
92 | return -ENOMEM; | ||
93 | } | ||
94 | |||
95 | /* PMC hardware registers setup */ | ||
96 | pmc_hw_reg_setup(pmc); | ||
55 | return 0; | 97 | return 0; |
56 | } | 98 | } |
57 | 99 | ||