blob: 915c181c2fee71fbaf739a3222b59b4227748602 [file] [log] [blame]
Angel Pons182dbde2020-04-02 23:49:05 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Aaron Durbin76c37002012-10-30 09:03:43 -05002
3#include <console/console.h>
4#include <device/device.h>
5#include <device/pci.h>
6#include <device/pci_ids.h>
Patrick Rudolphe56189c2018-04-18 10:11:59 +02007#include <device/pci_ops.h>
Kyösti Mälkkicbf95712020-01-05 08:05:45 +02008#include <option.h>
Aaron Durbin76c37002012-10-30 09:03:43 -05009#include <pc80/isa-dma.h>
10#include <pc80/i8259.h>
11#include <arch/io.h>
12#include <arch/ioapic.h>
Furquan Shaikh76cedd22020-05-02 10:24:23 -070013#include <acpi/acpi.h>
Kyösti Mälkki0c1dd9c2020-06-17 23:37:49 +030014#include <acpi/acpi_gnvs.h>
Aaron Durbin29ffa542012-12-21 21:21:48 -060015#include <cpu/x86/smm.h>
Duncan Laurie9c07c8f2013-03-22 11:08:39 -070016#include <cbmem.h>
17#include <string.h>
Kyösti Mälkki12b121c2019-08-18 16:33:39 +030018#include "chip.h"
Angel Pons2178b722020-05-31 00:55:35 +020019#include "iobp.h"
Duncan Laurie9c07c8f2013-03-22 11:08:39 -070020#include "nvs.h"
Aaron Durbin76c37002012-10-30 09:03:43 -050021#include "pch.h"
Furquan Shaikh76cedd22020-05-02 10:24:23 -070022#include <acpi/acpigen.h>
Tristan Corrickf3127d42018-10-31 02:25:54 +130023#include <southbridge/intel/common/acpi_pirq_gen.h>
Patrick Rudolph6b931122018-11-01 17:48:37 +010024#include <southbridge/intel/common/rtc.h>
Arthur Heymansa3121b02019-05-28 13:46:49 +020025#include <southbridge/intel/common/spi.h>
Aaron Durbin76c37002012-10-30 09:03:43 -050026
27#define NMI_OFF 0
28
Aaron Durbin76c37002012-10-30 09:03:43 -050029typedef struct southbridge_intel_lynxpoint_config config_t;
30
Paul Menzel373a20c2013-05-03 12:17:02 +020031/**
32 * Set miscellanous static southbridge features.
33 *
34 * @param dev PCI device with I/O APIC control registers
35 */
36static void pch_enable_ioapic(struct device *dev)
Aaron Durbin76c37002012-10-30 09:03:43 -050037{
Aaron Durbin76c37002012-10-30 09:03:43 -050038 u32 reg32;
Aaron Durbin76c37002012-10-30 09:03:43 -050039
Matt DeVilliera51e3792018-03-04 01:44:15 -060040 /* Assign unique bus/dev/fn for I/O APIC */
41 pci_write_config16(dev, LPC_IBDF,
42 PCH_IOAPIC_PCI_BUS << 8 | PCH_IOAPIC_PCI_SLOT << 3);
43
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -080044 set_ioapic_id(VIO_APIC_VADDR, 0x02);
Aaron Durbin76c37002012-10-30 09:03:43 -050045
46 /* affirm full set of redirection table entries ("write once") */
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -080047 reg32 = io_apic_read(VIO_APIC_VADDR, 0x01);
Duncan Lauriec5939992013-05-24 11:06:49 -070048 if (pch_is_lp()) {
49 /* PCH-LP has 39 redirection entries */
50 reg32 &= ~0x00ff0000;
51 reg32 |= 0x00270000;
52 }
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -080053 io_apic_write(VIO_APIC_VADDR, 0x01, reg32);
Aaron Durbin76c37002012-10-30 09:03:43 -050054
Paul Menzel373a20c2013-05-03 12:17:02 +020055 /*
56 * Select Boot Configuration register (0x03) and
57 * use Processor System Bus (0x01) to deliver interrupts.
58 */
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -080059 io_apic_write(VIO_APIC_VADDR, 0x03, 0x01);
Aaron Durbin76c37002012-10-30 09:03:43 -050060}
61
62static void pch_enable_serial_irqs(struct device *dev)
63{
64 /* Set packet length and toggle silent mode bit for one frame. */
65 pci_write_config8(dev, SERIRQ_CNTL,
66 (1 << 7) | (1 << 6) | ((21 - 17) << 2) | (0 << 0));
Julius Wernercd49cce2019-03-05 16:53:33 -080067#if !CONFIG(SERIRQ_CONTINUOUS_MODE)
Aaron Durbin76c37002012-10-30 09:03:43 -050068 pci_write_config8(dev, SERIRQ_CNTL,
69 (1 << 7) | (0 << 6) | ((21 - 17) << 2) | (0 << 0));
70#endif
71}
72
Angel Pons1464a052020-10-30 20:21:37 +010073static void enable_hpet(struct device *const dev)
74{
75 u32 reg32;
76 size_t i;
77
78 /* Assign unique bus/dev/fn for each HPET */
79 for (i = 0; i < 8; ++i)
80 pci_write_config16(dev, LPC_HnBDF(i),
81 PCH_HPET_PCI_BUS << 8 | PCH_HPET_PCI_SLOT << 3 | i);
82
83 /* Move HPET to default address 0xfed00000 and enable it */
84 reg32 = RCBA32(HPTC);
85 reg32 |= (1 << 7); // HPET Address Enable
86 reg32 &= ~(3 << 0);
87 RCBA32(HPTC) = reg32;
88 /* Read it back to stick. It's affected by posted write syndrome. */
89 RCBA32(HPTC);
90}
91
Aaron Durbin76c37002012-10-30 09:03:43 -050092/* PIRQ[n]_ROUT[3:0] - PIRQ Routing Control
93 * 0x00 - 0000 = Reserved
94 * 0x01 - 0001 = Reserved
95 * 0x02 - 0010 = Reserved
96 * 0x03 - 0011 = IRQ3
97 * 0x04 - 0100 = IRQ4
98 * 0x05 - 0101 = IRQ5
99 * 0x06 - 0110 = IRQ6
100 * 0x07 - 0111 = IRQ7
101 * 0x08 - 1000 = Reserved
102 * 0x09 - 1001 = IRQ9
103 * 0x0A - 1010 = IRQ10
104 * 0x0B - 1011 = IRQ11
105 * 0x0C - 1100 = IRQ12
106 * 0x0D - 1101 = Reserved
107 * 0x0E - 1110 = IRQ14
108 * 0x0F - 1111 = IRQ15
109 * PIRQ[n]_ROUT[7] - PIRQ Routing Control
110 * 0x80 - The PIRQ is not routed.
111 */
112
Elyes HAOUAS7a5f7712018-06-08 17:20:38 +0200113static void pch_pirq_init(struct device *dev)
Aaron Durbin76c37002012-10-30 09:03:43 -0500114{
Elyes HAOUAS7a5f7712018-06-08 17:20:38 +0200115 struct device *irq_dev;
Aaron Durbin76c37002012-10-30 09:03:43 -0500116
Angel Pons9f781272020-07-25 14:03:40 +0200117 const uint8_t pirq = 0x80;
Aaron Durbin76c37002012-10-30 09:03:43 -0500118
Angel Pons9f781272020-07-25 14:03:40 +0200119 pci_write_config8(dev, PIRQA_ROUT, pirq);
120 pci_write_config8(dev, PIRQB_ROUT, pirq);
121 pci_write_config8(dev, PIRQC_ROUT, pirq);
122 pci_write_config8(dev, PIRQD_ROUT, pirq);
123
124 pci_write_config8(dev, PIRQE_ROUT, pirq);
125 pci_write_config8(dev, PIRQF_ROUT, pirq);
126 pci_write_config8(dev, PIRQG_ROUT, pirq);
127 pci_write_config8(dev, PIRQH_ROUT, pirq);
Aaron Durbin76c37002012-10-30 09:03:43 -0500128
129 /* Eric Biederman once said we should let the OS do this.
130 * I am not so sure anymore he was right.
131 */
132
Elyes HAOUASba28e8d2016-08-31 19:22:16 +0200133 for (irq_dev = all_devices; irq_dev; irq_dev = irq_dev->next) {
Angel Pons2aaf7c02020-09-24 18:03:18 +0200134 u8 int_pin = 0, int_line = 0;
Aaron Durbin76c37002012-10-30 09:03:43 -0500135
136 if (!irq_dev->enabled || irq_dev->path.type != DEVICE_PATH_PCI)
137 continue;
138
139 int_pin = pci_read_config8(irq_dev, PCI_INTERRUPT_PIN);
140
141 switch (int_pin) {
Angel Pons9f781272020-07-25 14:03:40 +0200142 case 1: /* INTA# */
143 case 2: /* INTB# */
144 case 3: /* INTC# */
145 case 4: /* INTD# */
146 int_line = pirq;
147 break;
Aaron Durbin76c37002012-10-30 09:03:43 -0500148 }
149
150 if (!int_line)
151 continue;
152
153 pci_write_config8(irq_dev, PCI_INTERRUPT_LINE, int_line);
154 }
155}
156
Angel Ponscbcbb672020-10-23 00:11:26 +0200157static void pch_gpi_routing(struct device *dev, config_t *config)
Aaron Durbin76c37002012-10-30 09:03:43 -0500158{
Aaron Durbin76c37002012-10-30 09:03:43 -0500159 u32 reg32 = 0;
160
161 /* An array would be much nicer here, or some
162 * other method of doing this.
163 */
164 reg32 |= (config->gpi0_routing & 0x03) << 0;
165 reg32 |= (config->gpi1_routing & 0x03) << 2;
166 reg32 |= (config->gpi2_routing & 0x03) << 4;
167 reg32 |= (config->gpi3_routing & 0x03) << 6;
168 reg32 |= (config->gpi4_routing & 0x03) << 8;
169 reg32 |= (config->gpi5_routing & 0x03) << 10;
170 reg32 |= (config->gpi6_routing & 0x03) << 12;
171 reg32 |= (config->gpi7_routing & 0x03) << 14;
172 reg32 |= (config->gpi8_routing & 0x03) << 16;
173 reg32 |= (config->gpi9_routing & 0x03) << 18;
174 reg32 |= (config->gpi10_routing & 0x03) << 20;
175 reg32 |= (config->gpi11_routing & 0x03) << 22;
176 reg32 |= (config->gpi12_routing & 0x03) << 24;
177 reg32 |= (config->gpi13_routing & 0x03) << 26;
178 reg32 |= (config->gpi14_routing & 0x03) << 28;
179 reg32 |= (config->gpi15_routing & 0x03) << 30;
180
Kyösti Mälkkib85a87b2014-12-29 11:32:27 +0200181 pci_write_config32(dev, GPIO_ROUT, reg32);
Aaron Durbin76c37002012-10-30 09:03:43 -0500182}
183
Elyes HAOUAS7a5f7712018-06-08 17:20:38 +0200184static void pch_power_options(struct device *dev)
Aaron Durbin76c37002012-10-30 09:03:43 -0500185{
186 u8 reg8;
Duncan Laurie467f31d2013-03-08 17:00:37 -0800187 u16 reg16;
Aaron Durbin76c37002012-10-30 09:03:43 -0500188 u32 reg32;
189 const char *state;
Duncan Laurie467f31d2013-03-08 17:00:37 -0800190 u16 pmbase = get_pmbase();
Nico Huber9faae2b2018-11-14 00:00:35 +0100191 int pwr_on = CONFIG_MAINBOARD_POWER_FAILURE_STATE;
Aaron Durbin76c37002012-10-30 09:03:43 -0500192 int nmi_option;
193
194 /* Which state do we want to goto after g3 (power restored)?
195 * 0 == S0 Full On
196 * 1 == S5 Soft Off
197 *
198 * If the option is not existent (Laptops), use Kconfig setting.
199 */
200 get_option(&pwr_on, "power_on_after_fail");
201
202 reg16 = pci_read_config16(dev, GEN_PMCON_3);
203 reg16 &= 0xfffe;
204 switch (pwr_on) {
205 case MAINBOARD_POWER_OFF:
206 reg16 |= 1;
207 state = "off";
208 break;
209 case MAINBOARD_POWER_ON:
210 reg16 &= ~1;
211 state = "on";
212 break;
213 case MAINBOARD_POWER_KEEP:
214 reg16 &= ~1;
215 state = "state keep";
216 break;
217 default:
218 state = "undefined";
219 }
220
221 reg16 &= ~(3 << 4); /* SLP_S4# Assertion Stretch 4s */
222 reg16 |= (1 << 3); /* SLP_S4# Assertion Stretch Enable */
223
224 reg16 &= ~(1 << 10);
225 reg16 |= (1 << 11); /* SLP_S3# Min Assertion Width 50ms */
226
227 reg16 |= (1 << 12); /* Disable SLP stretch after SUS well */
228
229 pci_write_config16(dev, GEN_PMCON_3, reg16);
230 printk(BIOS_INFO, "Set power %s after power failure.\n", state);
231
232 /* Set up NMI on errors. */
233 reg8 = inb(0x61);
234 reg8 &= 0x0f; /* Higher Nibble must be 0 */
235 reg8 &= ~(1 << 3); /* IOCHK# NMI Enable */
236 // reg8 &= ~(1 << 2); /* PCI SERR# Enable */
237 reg8 |= (1 << 2); /* PCI SERR# Disable for now */
238 outb(reg8, 0x61);
239
240 reg8 = inb(0x70);
241 nmi_option = NMI_OFF;
242 get_option(&nmi_option, "nmi");
243 if (nmi_option) {
244 printk(BIOS_INFO, "NMI sources enabled.\n");
245 reg8 &= ~(1 << 7); /* Set NMI. */
246 } else {
247 printk(BIOS_INFO, "NMI sources disabled.\n");
Elyes HAOUAS9c5d4632018-04-26 22:21:21 +0200248 reg8 |= (1 << 7); /* Can't mask NMI from PCI-E and NMI_NOW */
Aaron Durbin76c37002012-10-30 09:03:43 -0500249 }
250 outb(reg8, 0x70);
251
252 /* Enable CPU_SLP# and Intel Speedstep, set SMI# rate down */
253 reg16 = pci_read_config16(dev, GEN_PMCON_1);
254 reg16 &= ~(3 << 0); // SMI# rate 1 minute
255 reg16 &= ~(1 << 10); // Disable BIOS_PCI_EXP_EN for native PME
Aaron Durbin76c37002012-10-30 09:03:43 -0500256 pci_write_config16(dev, GEN_PMCON_1, reg16);
257
Angel Ponscbcbb672020-10-23 00:11:26 +0200258 if (dev->chip_info) {
259 config_t *config = dev->chip_info;
Aaron Durbin76c37002012-10-30 09:03:43 -0500260
Angel Ponscbcbb672020-10-23 00:11:26 +0200261 /*
262 * Set the board's GPI routing on LynxPoint-H.
263 * This is done as part of GPIO configuration on LynxPoint-LP.
264 */
Angel Ponsa7174b72020-10-30 20:23:41 +0100265 if (!pch_is_lp())
Angel Ponscbcbb672020-10-23 00:11:26 +0200266 pch_gpi_routing(dev, config);
Aaron Durbin76c37002012-10-30 09:03:43 -0500267
Angel Ponscbcbb672020-10-23 00:11:26 +0200268 /* GPE setup based on device tree configuration */
269 enable_all_gpe(config->gpe0_en_1, config->gpe0_en_2,
270 config->gpe0_en_3, config->gpe0_en_4);
271
272 /* SMI setup based on device tree configuration */
273 enable_alt_smi(config->alt_gp_smi_en);
274 }
Aaron Durbin76c37002012-10-30 09:03:43 -0500275
276 /* Set up power management block and determine sleep mode */
277 reg32 = inl(pmbase + 0x04); // PM1_CNT
278 reg32 &= ~(7 << 10); // SLP_TYP
279 reg32 |= (1 << 0); // SCI_EN
280 outl(reg32, pmbase + 0x04);
281
282 /* Clear magic status bits to prevent unexpected wake */
283 reg32 = RCBA32(0x3310);
Angel Pons84fa2242020-10-24 11:53:47 +0200284 reg32 |= (1 << 4) | (1 << 5) | (1 << 0);
Aaron Durbin76c37002012-10-30 09:03:43 -0500285 RCBA32(0x3310) = reg32;
286
Ryan Salsamendi889ce9c2017-06-30 17:45:14 -0700287 reg16 = RCBA16(0x3f02);
288 reg16 &= ~0xf;
289 RCBA16(0x3f02) = reg16;
Aaron Durbin76c37002012-10-30 09:03:43 -0500290}
291
Duncan Lauriedeb90f42013-03-08 17:22:37 -0800292/* LynxPoint PCH Power Management init */
293static void lpt_pm_init(struct device *dev)
Aaron Durbin76c37002012-10-30 09:03:43 -0500294{
Duncan Lauriedeb90f42013-03-08 17:22:37 -0800295 printk(BIOS_DEBUG, "LynxPoint PM init\n");
Aaron Durbin76c37002012-10-30 09:03:43 -0500296}
Duncan Lauriedeb90f42013-03-08 17:22:37 -0800297
Duncan Lauriedeb90f42013-03-08 17:22:37 -0800298/* LynxPoint LP PCH Power Management init */
299static void lpt_lp_pm_init(struct device *dev)
300{
301 struct southbridge_intel_lynxpoint_config *config = dev->chip_info;
302 u32 data;
303
304 printk(BIOS_DEBUG, "LynxPoint LP PM init\n");
305
306 pci_write_config8(dev, 0xa9, 0x46);
307
Angel Pons90cdf702020-10-24 23:00:34 +0200308 RCBA32_AND_OR(0x232c, ~1, 0);
309
Angel Pons725657a2020-07-03 13:15:00 +0200310 RCBA32_AND_OR(0x1100, ~0xc000, 0xc000);
Angel Pons4fe46612020-10-24 22:22:04 +0200311 RCBA32_OR(0x1100, 0x00000100);
312 RCBA32_OR(0x1100, 0x0000003f);
Angel Pons90cdf702020-10-24 23:00:34 +0200313
Angel Pons725657a2020-07-03 13:15:00 +0200314 RCBA32_AND_OR(0x2320, ~0x60, 0x10);
Angel Pons90cdf702020-10-24 23:00:34 +0200315
Angel Pons4fe46612020-10-24 22:22:04 +0200316 RCBA32(0x3314) = 0x00012fff;
317 RCBA32(0x3318) = 0x0dcf0400;
318 RCBA32(0x3324) = 0x04000000;
319 RCBA32(0x3368) = 0x00041400;
320 RCBA32(0x3388) = 0x3f8ddbff;
321 RCBA32(0x33ac) = 0x00007001;
322 RCBA32(0x33b0) = 0x00181900;
323 RCBA32(0x33c0) = 0x00060A00;
324 RCBA32(0x33d0) = 0x06200840;
325 RCBA32(0x3a28) = 0x01010101;
326 RCBA32(0x3a2c) = 0x04040404;
327 RCBA32(0x2b1c) = 0x03808033;
328 RCBA32(0x2b34) = 0x80000009;
329 RCBA32(0x3348) = 0x022ddfff;
330 RCBA32(0x334c) = 0x00000001;
331 RCBA32(0x3358) = 0x0001c000;
332 RCBA32(0x3380) = 0x3f8ddbff;
333 RCBA32(0x3384) = 0x0001c7e1;
334 RCBA32(0x338c) = 0x0001c7e1;
335 RCBA32(0x3398) = 0x0001c000;
336 RCBA32(0x33a8) = 0x00181900;
337 RCBA32(0x33dc) = 0x00080000;
338 RCBA32(0x33e0) = 0x00000001;
339 RCBA32(0x3a20) = 0x00000404;
340 RCBA32(0x3a24) = 0x01010101;
341 RCBA32(0x3a30) = 0x01010101;
Angel Pons90cdf702020-10-24 23:00:34 +0200342
Angel Pons4fe46612020-10-24 22:22:04 +0200343 RCBA32_OR(0x0410, 0x00000003);
344 RCBA32_OR(0x2618, 0x08000000);
345 RCBA32_OR(0x2300, 0x00000002);
346 RCBA32_OR(0x2600, 0x00000008);
Angel Pons90cdf702020-10-24 23:00:34 +0200347
Angel Pons4fe46612020-10-24 22:22:04 +0200348 RCBA32(0x33b4) = 0x00007001;
349 RCBA32(0x3350) = 0x022ddfff;
350 RCBA32(0x3354) = 0x00000001;
Angel Pons90cdf702020-10-24 23:00:34 +0200351
352 /* Power Optimizer */
353 RCBA32_OR(0x33d4, 0x08000000);
354 RCBA32_OR(0x33c8, 0x00000080);
355
356 RCBA32(0x2b10) = 0x0000883c;
357 RCBA32(0x2b14) = 0x1e0a4616;
358 RCBA32(0x2b24) = 0x40000005;
359 RCBA32(0x2b20) = 0x0005db01;
Angel Pons4fe46612020-10-24 22:22:04 +0200360 RCBA32(0x3a80) = 0x05145005;
Duncan Lauriedeb90f42013-03-08 17:22:37 -0800361
Angel Ponsbf9bc502020-06-08 00:12:43 +0200362 pci_or_config32(dev, 0xac, 1 << 21);
Duncan Lauriedeb90f42013-03-08 17:22:37 -0800363
Elyes HAOUASa0aea562017-07-03 21:38:53 +0200364 pch_iobp_update(0xED00015C, ~(1 << 11), 0x00003700);
Angel Pons8963f7d2020-10-24 12:20:28 +0200365 pch_iobp_update(0xED000118, ~0, 0x00c00000);
366 pch_iobp_update(0xED000120, ~0, 0x00240000);
367 pch_iobp_update(0xCA000000, ~0, 0x00000009);
Duncan Lauriedeb90f42013-03-08 17:22:37 -0800368
369 /* Set RCBA CIR28 0x3A84 based on SATA port enables */
370 data = 0x00001005;
371 /* Port 3 and 2 disabled */
Angel Ponscbcbb672020-10-23 00:11:26 +0200372 if (config && (config->sata_port_map & ((1 << 3) | (1 << 2))) == 0)
Duncan Lauriedeb90f42013-03-08 17:22:37 -0800373 data |= (1 << 24) | (1 << 26);
374 /* Port 1 and 0 disabled */
Angel Ponscbcbb672020-10-23 00:11:26 +0200375 if (config && (config->sata_port_map & ((1 << 1) | (1 << 0))) == 0)
Duncan Lauriedeb90f42013-03-08 17:22:37 -0800376 data |= (1 << 20) | (1 << 18);
377 RCBA32(0x3a84) = data;
378
Duncan Laurie5cf34ce2013-04-26 10:41:33 -0700379 /* Set RCBA 0x2b1c[29]=1 if DSP disabled */
380 if (RCBA32(FD) & PCH_DISABLE_ADSPD)
381 RCBA32_OR(0x2b1c, (1 << 29));
382
Duncan Lauriedeb90f42013-03-08 17:22:37 -0800383 /* Lock */
384 RCBA32_OR(0x3a6c, 0x00000001);
385
386 /* Set RCBA 0x33D4 after other setup */
387 RCBA32_OR(0x33d4, 0x2fff2fb1);
388
389 /* Set RCBA 0x33C8[15]=1 as last step */
390 RCBA32_OR(0x33c8, (1 << 15));
391}
Aaron Durbin76c37002012-10-30 09:03:43 -0500392
Elyes HAOUAS7a5f7712018-06-08 17:20:38 +0200393static void enable_clock_gating(struct device *dev)
Aaron Durbin76c37002012-10-30 09:03:43 -0500394{
Duncan Laurie74c0d052012-12-17 11:31:40 -0800395 /* LynxPoint Mobile */
396 u32 reg32;
397 u16 reg16;
398
399 /* DMI */
Angel Pons8963f7d2020-10-24 12:20:28 +0200400 RCBA32_AND_OR(0x2234, ~0, 0xf);
Duncan Laurie74c0d052012-12-17 11:31:40 -0800401 reg16 = pci_read_config16(dev, GEN_PMCON_1);
402 reg16 |= (1 << 11) | (1 << 12) | (1 << 14);
403 reg16 |= (1 << 2); // PCI CLKRUN# Enable
404 pci_write_config16(dev, GEN_PMCON_1, reg16);
405 RCBA32_OR(0x900, (1 << 14));
406
407 reg32 = RCBA32(CG);
408 reg32 |= (1 << 22); // HDA Dynamic
Angel Pons8963f7d2020-10-24 12:20:28 +0200409 reg32 |= (1 << 31); // LPC Dynamic
Duncan Laurie74c0d052012-12-17 11:31:40 -0800410 reg32 |= (1 << 16); // PCIe Dynamic
411 reg32 |= (1 << 27); // HPET Dynamic
412 reg32 |= (1 << 28); // GPIO Dynamic
413 RCBA32(CG) = reg32;
414
415 RCBA32_OR(0x38c0, 0x7); // SPI Dynamic
Duncan Lauriedeb90f42013-03-08 17:22:37 -0800416}
417
Elyes HAOUAS7a5f7712018-06-08 17:20:38 +0200418static void enable_lp_clock_gating(struct device *dev)
Duncan Lauriedeb90f42013-03-08 17:22:37 -0800419{
420 /* LynxPoint LP */
421 u32 reg32;
422 u16 reg16;
423
424 /* DMI */
Angel Pons8963f7d2020-10-24 12:20:28 +0200425 RCBA32_AND_OR(0x2234, ~0, 0xf);
Duncan Lauriedeb90f42013-03-08 17:22:37 -0800426 reg16 = pci_read_config16(dev, GEN_PMCON_1);
427 reg16 &= ~((1 << 11) | (1 << 14));
428 reg16 |= (1 << 5) | (1 << 6) | (1 << 7) | (1 << 12) | (1 << 13);
429 reg16 |= (1 << 2); // PCI CLKRUN# Enable
430 pci_write_config16(dev, GEN_PMCON_1, reg16);
431
Angel Ponsbf9bc502020-06-08 00:12:43 +0200432 pci_or_config32(dev, 0x64, 1 << 6);
Duncan Lauriedeb90f42013-03-08 17:22:37 -0800433
Duncan Laurie4bc107b2013-06-24 13:14:44 -0700434 /*
435 * RCBA + 0x2614[27:25,14:13,10,8] = 101,11,1,1
436 * RCBA + 0x2614[23:16] = 0x20
437 * RCBA + 0x2614[30:28] = 0x0
Duncan Lauried8c7d732013-07-16 09:01:43 -0700438 * RCBA + 0x2614[26] = 1 (IF 0:2.0@0x08 >= 0x0b)
Duncan Laurie4bc107b2013-06-24 13:14:44 -0700439 */
Angel Pons90cdf702020-10-24 23:00:34 +0200440 RCBA32_AND_OR(0x2614, ~0x74000000, 0x0a206500);
Duncan Laurie4bc107b2013-06-24 13:14:44 -0700441
442 /* Check for LPT-LP B2 stepping and 0:31.0@0xFA > 4 */
Nico Huber744d6bd2019-01-12 14:58:20 +0100443 struct device *const gma = pcidev_on_root(2, 0);
444 if (gma && pci_read_config8(gma, 0x8) >= 0x0b)
Elyes HAOUASa0aea562017-07-03 21:38:53 +0200445 RCBA32_OR(0x2614, (1 << 26));
Duncan Laurie4bc107b2013-06-24 13:14:44 -0700446
Duncan Lauriedeb90f42013-03-08 17:22:37 -0800447 RCBA32_OR(0x900, 0x0000031f);
448
449 reg32 = RCBA32(CG);
Duncan Lauriea2d6a402013-03-22 11:24:45 -0700450 if (RCBA32(0x3454) & (1 << 4))
451 reg32 &= ~(1 << 29); // LPC Dynamic
452 else
453 reg32 |= (1 << 29); // LPC Dynamic
Angel Pons2aaf7c02020-09-24 18:03:18 +0200454 reg32 |= (1 << 31); // LP LPC
Duncan Laurie5cf34ce2013-04-26 10:41:33 -0700455 reg32 |= (1 << 30); // LP BLA
Duncan Lauriedeb90f42013-03-08 17:22:37 -0800456 reg32 |= (1 << 28); // GPIO Dynamic
457 reg32 |= (1 << 27); // HPET Dynamic
Duncan Laurie5cf34ce2013-04-26 10:41:33 -0700458 reg32 |= (1 << 26); // Generic Platform Event Clock
459 if (RCBA32(BUC) & PCH_DISABLE_GBE)
460 reg32 |= (1 << 23); // GbE Static
Duncan Lauriedeb90f42013-03-08 17:22:37 -0800461 reg32 |= (1 << 22); // HDA Dynamic
Duncan Laurie5cf34ce2013-04-26 10:41:33 -0700462 reg32 |= (1 << 16); // PCI Dynamic
Duncan Lauriedeb90f42013-03-08 17:22:37 -0800463 RCBA32(CG) = reg32;
464
465 RCBA32_OR(0x3434, 0x7); // LP LPC
466
467 RCBA32_AND_OR(0x333c, 0xffcfffff, 0x00c00000); // SATA
468
469 RCBA32_OR(0x38c0, 0x3c07); // SPI Dynamic
470
Angel Pons8963f7d2020-10-24 12:20:28 +0200471 pch_iobp_update(0xCF000000, ~0, 0x00007001);
472 pch_iobp_update(0xCE00C000, ~1, 0x00000000); // bit0=0 in BWG 1.4.0
Aaron Durbin76c37002012-10-30 09:03:43 -0500473}
474
Aaron Durbin29ffa542012-12-21 21:21:48 -0600475static void pch_set_acpi_mode(void)
Aaron Durbin76c37002012-10-30 09:03:43 -0500476{
Kyösti Mälkkiad882c32020-06-02 05:05:30 +0300477 if (!acpi_is_wakeup_s3())
Kyösti Mälkkib6585482020-06-01 15:11:14 +0300478 apm_control(APM_CNT_ACPI_DISABLE);
Aaron Durbin76c37002012-10-30 09:03:43 -0500479}
Aaron Durbin76c37002012-10-30 09:03:43 -0500480
481static void pch_disable_smm_only_flashing(struct device *dev)
482{
Aaron Durbin76c37002012-10-30 09:03:43 -0500483 printk(BIOS_SPEW, "Enabling BIOS updates outside of SMM... ");
Angel Ponsbf9bc502020-06-08 00:12:43 +0200484
485 pci_and_config8(dev, BIOS_CNTL, ~(1 << 5));
Aaron Durbin76c37002012-10-30 09:03:43 -0500486}
487
488static void pch_fixups(struct device *dev)
489{
Aaron Durbin76c37002012-10-30 09:03:43 -0500490 /* Indicate DRAM init done for MRC S3 to know it can resume */
Angel Ponsbf9bc502020-06-08 00:12:43 +0200491 pci_or_config8(dev, GEN_PMCON_2, 1 << 7);
Aaron Durbin76c37002012-10-30 09:03:43 -0500492
493 /*
494 * Enable DMI ASPM in the PCH
495 */
496 RCBA32_AND_OR(0x2304, ~(1 << 10), 0);
Angel Pons84fa2242020-10-24 11:53:47 +0200497 RCBA32_OR(0x21a4, (1 << 11) | (1 << 10));
Aaron Durbin76c37002012-10-30 09:03:43 -0500498 RCBA32_OR(0x21a8, 0x3);
499}
500
Aaron Durbin76c37002012-10-30 09:03:43 -0500501static void lpc_init(struct device *dev)
502{
Elyes HAOUASbfc255a2020-03-07 13:05:14 +0100503 printk(BIOS_DEBUG, "pch: %s\n", __func__);
Aaron Durbin76c37002012-10-30 09:03:43 -0500504
Aaron Durbin76c37002012-10-30 09:03:43 -0500505 /* IO APIC initialization. */
Paul Menzel373a20c2013-05-03 12:17:02 +0200506 pch_enable_ioapic(dev);
Aaron Durbin76c37002012-10-30 09:03:43 -0500507
508 pch_enable_serial_irqs(dev);
509
510 /* Setup the PIRQ. */
511 pch_pirq_init(dev);
512
513 /* Setup power options. */
514 pch_power_options(dev);
515
516 /* Initialize power management */
Duncan Lauriedeb90f42013-03-08 17:22:37 -0800517 if (pch_is_lp()) {
518 lpt_lp_pm_init(dev);
519 enable_lp_clock_gating(dev);
520 } else {
521 lpt_pm_init(dev);
522 enable_clock_gating(dev);
Aaron Durbin76c37002012-10-30 09:03:43 -0500523 }
524
Aaron Durbin76c37002012-10-30 09:03:43 -0500525 /* Initialize the real time clock. */
Patrick Rudolph6b931122018-11-01 17:48:37 +0100526 sb_rtc_init();
Aaron Durbin76c37002012-10-30 09:03:43 -0500527
528 /* Initialize ISA DMA. */
529 isa_dma_init();
530
531 /* Initialize the High Precision Event Timers, if present. */
Matt DeVilliera51e3792018-03-04 01:44:15 -0600532 enable_hpet(dev);
Aaron Durbin76c37002012-10-30 09:03:43 -0500533
Aaron Durbin76c37002012-10-30 09:03:43 -0500534 setup_i8259();
535
Aaron Durbin76c37002012-10-30 09:03:43 -0500536 /* Interrupt 9 should be level triggered (SCI) */
537 i8259_configure_irq_trigger(9, 1);
538
539 pch_disable_smm_only_flashing(dev);
540
Aaron Durbin29ffa542012-12-21 21:21:48 -0600541 pch_set_acpi_mode();
Aaron Durbin76c37002012-10-30 09:03:43 -0500542
543 pch_fixups(dev);
544}
545
Elyes HAOUAS7a5f7712018-06-08 17:20:38 +0200546static void pch_lpc_add_mmio_resources(struct device *dev)
Aaron Durbin6f561af2012-12-19 14:38:01 -0600547{
548 u32 reg;
549 struct resource *res;
550 const u32 default_decode_base = IO_APIC_ADDR;
551
552 /*
553 * Just report all resources from IO-APIC base to 4GiB. Don't mark
554 * them reserved as that may upset the OS if this range is marked
555 * as reserved in the e820.
556 */
557 res = new_resource(dev, OIC);
558 res->base = default_decode_base;
559 res->size = 0 - default_decode_base;
560 res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
561
562 /* RCBA */
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -0800563 if ((uintptr_t)DEFAULT_RCBA < default_decode_base) {
Aaron Durbin6f561af2012-12-19 14:38:01 -0600564 res = new_resource(dev, RCBA);
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -0800565 res->base = (resource_t)(uintptr_t)DEFAULT_RCBA;
Aaron Durbin6f561af2012-12-19 14:38:01 -0600566 res->size = 16 * 1024;
567 res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED |
Angel Pons2aaf7c02020-09-24 18:03:18 +0200568 IORESOURCE_FIXED | IORESOURCE_RESERVE;
Aaron Durbin6f561af2012-12-19 14:38:01 -0600569 }
570
571 /* Check LPC Memory Decode register. */
572 reg = pci_read_config32(dev, LGMR);
573 if (reg & 1) {
574 reg &= ~0xffff;
575 if (reg < default_decode_base) {
576 res = new_resource(dev, LGMR);
577 res->base = reg;
578 res->size = 16 * 1024;
579 res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED |
Angel Pons2aaf7c02020-09-24 18:03:18 +0200580 IORESOURCE_FIXED | IORESOURCE_RESERVE;
Aaron Durbin6f561af2012-12-19 14:38:01 -0600581 }
582 }
583}
584
585/* Default IO range claimed by the LPC device. The upper bound is exclusive. */
586#define LPC_DEFAULT_IO_RANGE_LOWER 0
587#define LPC_DEFAULT_IO_RANGE_UPPER 0x1000
588
Julius Werner7c712bb2019-05-01 16:51:20 -0700589static inline int pch_io_range_in_default(int base, int size)
Aaron Durbin6f561af2012-12-19 14:38:01 -0600590{
591 /* Does it start above the range? */
592 if (base >= LPC_DEFAULT_IO_RANGE_UPPER)
593 return 0;
594
595 /* Is it entirely contained? */
596 if (base >= LPC_DEFAULT_IO_RANGE_LOWER &&
597 (base + size) < LPC_DEFAULT_IO_RANGE_UPPER)
598 return 1;
599
600 /* This will return not in range for partial overlaps. */
601 return 0;
602}
603
604/*
605 * Note: this function assumes there is no overlap with the default LPC device's
606 * claimed range: LPC_DEFAULT_IO_RANGE_LOWER -> LPC_DEFAULT_IO_RANGE_UPPER.
607 */
Elyes HAOUAS7a5f7712018-06-08 17:20:38 +0200608static void pch_lpc_add_io_resource(struct device *dev, u16 base, u16 size,
609 int index)
Aaron Durbin6f561af2012-12-19 14:38:01 -0600610{
611 struct resource *res;
612
613 if (pch_io_range_in_default(base, size))
614 return;
615
616 res = new_resource(dev, index);
617 res->base = base;
618 res->size = size;
619 res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
620}
621
Elyes HAOUAS7a5f7712018-06-08 17:20:38 +0200622static void pch_lpc_add_gen_io_resources(struct device *dev, int reg_value,
623 int index)
Aaron Durbin6f561af2012-12-19 14:38:01 -0600624{
625 /*
626 * Check if the register is enabled. If so and the base exceeds the
Kyösti Mälkkib544c002019-01-06 10:41:41 +0200627 * device's default, claim range and add the resource.
Aaron Durbin6f561af2012-12-19 14:38:01 -0600628 */
629 if (reg_value & 1) {
630 u16 base = reg_value & 0xfffc;
631 u16 size = (0x3 | ((reg_value >> 16) & 0xfc)) + 1;
632 pch_lpc_add_io_resource(dev, base, size, index);
633 }
634}
635
Elyes HAOUAS7a5f7712018-06-08 17:20:38 +0200636static void pch_lpc_add_io_resources(struct device *dev)
Aaron Durbin76c37002012-10-30 09:03:43 -0500637{
638 struct resource *res;
Aaron Durbin76c37002012-10-30 09:03:43 -0500639
Aaron Durbin6f561af2012-12-19 14:38:01 -0600640 /* Add the default claimed IO range for the LPC device. */
641 res = new_resource(dev, 0);
642 res->base = LPC_DEFAULT_IO_RANGE_LOWER;
643 res->size = LPC_DEFAULT_IO_RANGE_UPPER - LPC_DEFAULT_IO_RANGE_LOWER;
644 res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
645
646 /* GPIOBASE */
Angel Pons2aaf7c02020-09-24 18:03:18 +0200647 pch_lpc_add_io_resource(dev, get_gpiobase(), DEFAULT_GPIOSIZE, GPIO_BASE);
Aaron Durbin6f561af2012-12-19 14:38:01 -0600648
649 /* PMBASE */
Duncan Laurie7922b462013-03-08 16:34:33 -0800650 pch_lpc_add_io_resource(dev, get_pmbase(), 256, PMBASE);
Aaron Durbin6f561af2012-12-19 14:38:01 -0600651
652 /* LPC Generic IO Decode range. */
Angel Ponscbcbb672020-10-23 00:11:26 +0200653 if (dev->chip_info) {
654 config_t *config = dev->chip_info;
655 pch_lpc_add_gen_io_resources(dev, config->gen1_dec, LPC_GEN1_DEC);
656 pch_lpc_add_gen_io_resources(dev, config->gen2_dec, LPC_GEN2_DEC);
657 pch_lpc_add_gen_io_resources(dev, config->gen3_dec, LPC_GEN3_DEC);
658 pch_lpc_add_gen_io_resources(dev, config->gen4_dec, LPC_GEN4_DEC);
659 }
Aaron Durbin6f561af2012-12-19 14:38:01 -0600660}
661
Elyes HAOUAS7a5f7712018-06-08 17:20:38 +0200662static void pch_lpc_read_resources(struct device *dev)
Aaron Durbin6f561af2012-12-19 14:38:01 -0600663{
Kyösti Mälkki0c1dd9c2020-06-17 23:37:49 +0300664 struct global_nvs *gnvs;
Duncan Laurie9c07c8f2013-03-22 11:08:39 -0700665
Aaron Durbin76c37002012-10-30 09:03:43 -0500666 /* Get the normal PCI resources of this device. */
667 pci_dev_read_resources(dev);
668
Aaron Durbin6f561af2012-12-19 14:38:01 -0600669 /* Add non-standard MMIO resources. */
670 pch_lpc_add_mmio_resources(dev);
Aaron Durbin76c37002012-10-30 09:03:43 -0500671
Aaron Durbin6f561af2012-12-19 14:38:01 -0600672 /* Add IO resources. */
673 pch_lpc_add_io_resources(dev);
Duncan Laurie9c07c8f2013-03-22 11:08:39 -0700674
675 /* Allocate ACPI NVS in CBMEM */
Kyösti Mälkki0c1dd9c2020-06-17 23:37:49 +0300676 gnvs = cbmem_add(CBMEM_ID_ACPI_GNVS, sizeof(struct global_nvs));
Kyösti Mälkkic3ed8862014-06-19 19:50:51 +0300677 if (!acpi_is_wakeup_s3() && gnvs)
Kyösti Mälkki0c1dd9c2020-06-17 23:37:49 +0300678 memset(gnvs, 0, sizeof(struct global_nvs));
Aaron Durbin76c37002012-10-30 09:03:43 -0500679}
680
Elyes HAOUAS7a5f7712018-06-08 17:20:38 +0200681static void pch_lpc_enable(struct device *dev)
Aaron Durbin76c37002012-10-30 09:03:43 -0500682{
683 /* Enable PCH Display Port */
684 RCBA16(DISPBDF) = 0x0010;
685 RCBA32_OR(FD2, PCH_ENABLE_DBDF);
686
687 pch_enable(dev);
688}
689
Kyösti Mälkki0c1dd9c2020-06-17 23:37:49 +0300690void southbridge_inject_dsdt(const struct device *dev)
Vladimir Serbinenkoc6e566a2014-08-31 17:43:51 +0200691{
Kyösti Mälkki0c1dd9c2020-06-17 23:37:49 +0300692 struct global_nvs *gnvs;
Vladimir Serbinenko7309c642014-10-05 11:07:33 +0200693
694 gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS);
695 if (!gnvs) {
Elyes HAOUAS035df002016-10-03 21:54:16 +0200696 gnvs = cbmem_add(CBMEM_ID_ACPI_GNVS, sizeof(*gnvs));
Vladimir Serbinenko7309c642014-10-05 11:07:33 +0200697 if (gnvs)
698 memset(gnvs, 0, sizeof(*gnvs));
699 }
Vladimir Serbinenkoc6e566a2014-08-31 17:43:51 +0200700
701 if (gnvs) {
Vladimir Serbinenkoc6e566a2014-08-31 17:43:51 +0200702 acpi_create_gnvs(gnvs);
Vladimir Serbinenko1b409fd2014-10-12 00:26:21 +0200703
704 gnvs->apic = 1;
705 gnvs->mpen = 1; /* Enable Multi Processing */
706 gnvs->pcnt = dev_count_cpu();
707
Julius Wernercd49cce2019-03-05 16:53:33 -0800708#if CONFIG(CHROMEOS)
Joel Kitching6fbd8742018-08-23 14:56:25 +0800709 chromeos_init_chromeos_acpi(&(gnvs->chromeos));
Vladimir Serbinenko1b409fd2014-10-12 00:26:21 +0200710#endif
711
712 /* Update the mem console pointer. */
713 gnvs->cbmc = (u32)cbmem_find(CBMEM_ID_CONSOLE);
714
Vladimir Serbinenkoc6e566a2014-08-31 17:43:51 +0200715 /* And tell SMI about it */
Kyösti Mälkkic3c55212020-06-17 10:34:26 +0300716 apm_control(APM_CNT_GNVS_UPDATE);
Vladimir Serbinenkoc6e566a2014-08-31 17:43:51 +0200717
Vladimir Serbinenko334fd8e2014-10-05 11:10:35 +0200718 /* Add it to DSDT. */
Vladimir Serbinenkobe0fd0a2014-11-04 21:10:59 +0100719 acpigen_write_scope("\\");
Angel Pons8cb83742020-10-17 18:28:29 +0200720 acpigen_write_name_dword("NVSA", (u32)gnvs);
Vladimir Serbinenkobe0fd0a2014-11-04 21:10:59 +0100721 acpigen_pop_len();
Vladimir Serbinenkoc6e566a2014-08-31 17:43:51 +0200722 }
Vladimir Serbinenkoc6e566a2014-08-31 17:43:51 +0200723}
724
Tristan Corrickf3127d42018-10-31 02:25:54 +1300725static const char *lpc_acpi_name(const struct device *dev)
726{
727 return "LPCB";
728}
729
Furquan Shaikh7536a392020-04-24 21:59:21 -0700730static void southbridge_fill_ssdt(const struct device *dev)
Tristan Corrickf3127d42018-10-31 02:25:54 +1300731{
732 intel_acpi_gen_def_acpi_pirq(dev);
733}
734
Furquan Shaikh0f007d82020-04-24 06:41:18 -0700735static unsigned long southbridge_write_acpi_tables(const struct device *device,
Alexander Couzens83fc32f2015-04-12 22:28:37 +0200736 unsigned long start,
737 struct acpi_rsdp *rsdp)
Vladimir Serbinenkoc6e566a2014-08-31 17:43:51 +0200738{
739 unsigned long current;
Vladimir Serbinenkoc6e566a2014-08-31 17:43:51 +0200740 acpi_header_t *ssdt;
741
742 current = start;
743
744 /* Align ACPI tables to 16byte */
Aaron Durbin07a1b282015-12-10 17:07:38 -0600745 current = acpi_align_current(current);
Vladimir Serbinenkoc6e566a2014-08-31 17:43:51 +0200746
747 /*
748 * We explicitly add these tables later on:
749 */
Angel Pons2d35cf82020-10-29 19:28:44 +0100750 current = acpi_write_hpet(device, current, rsdp);
Vladimir Serbinenkoc6e566a2014-08-31 17:43:51 +0200751
Aaron Durbin07a1b282015-12-10 17:07:38 -0600752 current = acpi_align_current(current);
Vladimir Serbinenkoc6e566a2014-08-31 17:43:51 +0200753
754 printk(BIOS_DEBUG, "ACPI: * SSDT2\n");
755 ssdt = (acpi_header_t *)current;
756 acpi_create_serialio_ssdt(ssdt);
757 current += ssdt->length;
758 acpi_add_table(rsdp, ssdt);
Aaron Durbin07a1b282015-12-10 17:07:38 -0600759 current = acpi_align_current(current);
Vladimir Serbinenkoc6e566a2014-08-31 17:43:51 +0200760
761 printk(BIOS_DEBUG, "current = %lx\n", current);
762 return current;
763}
764
Tristan Corrick32ceed82018-11-30 22:53:27 +1300765static void lpc_final(struct device *dev)
766{
Arthur Heymansa3121b02019-05-28 13:46:49 +0200767 spi_finalize_ops();
Tristan Corrick63626b12018-11-30 22:53:50 +1300768
Julius Wernercd49cce2019-03-05 16:53:33 -0800769 if (acpi_is_wakeup_s3() || CONFIG(INTEL_CHIPSET_LOCKDOWN))
Kyösti Mälkkib6585482020-06-01 15:11:14 +0300770 apm_control(APM_CNT_FINALIZE);
Tristan Corrick32ceed82018-11-30 22:53:27 +1300771}
Vladimir Serbinenkoc6e566a2014-08-31 17:43:51 +0200772
Aaron Durbin76c37002012-10-30 09:03:43 -0500773static struct device_operations device_ops = {
774 .read_resources = pch_lpc_read_resources,
775 .set_resources = pci_dev_set_resources,
Duncan Laurie8d783b82013-05-14 11:16:34 -0700776 .enable_resources = pci_dev_enable_resources,
Nico Huber68680dd2020-03-31 17:34:52 +0200777 .acpi_fill_ssdt = southbridge_fill_ssdt,
778 .acpi_inject_dsdt = southbridge_inject_dsdt,
Tristan Corrickf3127d42018-10-31 02:25:54 +1300779 .acpi_name = lpc_acpi_name,
Vladimir Serbinenkoc6e566a2014-08-31 17:43:51 +0200780 .write_acpi_tables = southbridge_write_acpi_tables,
Aaron Durbin76c37002012-10-30 09:03:43 -0500781 .init = lpc_init,
Tristan Corrick32ceed82018-11-30 22:53:27 +1300782 .final = lpc_final,
Aaron Durbin76c37002012-10-30 09:03:43 -0500783 .enable = pch_lpc_enable,
Nico Huber51b75ae2019-03-14 16:02:05 +0100784 .scan_bus = scan_static_bus,
Angel Pons1fc0edd2020-05-31 00:03:28 +0200785 .ops_pci = &pci_dev_ops_pci,
Aaron Durbin76c37002012-10-30 09:03:43 -0500786};
787
Aaron Durbinc1989c42012-12-11 17:13:17 -0600788/* IDs for LPC device of Intel 8 Series Chipset (Lynx Point) */
789static const unsigned short pci_device_ids[] = {
Felix Singer4ea08f92020-11-20 12:56:44 +0000790 PCI_DEVICE_ID_INTEL_LPT_MOBILE_SAMPLE,
791 PCI_DEVICE_ID_INTEL_LPT_DESKTOP_SAMPLE,
792 PCI_DEVICE_ID_INTEL_LPT_Z87,
793 PCI_DEVICE_ID_INTEL_LPT_Z85,
794 PCI_DEVICE_ID_INTEL_LPT_HM86,
795 PCI_DEVICE_ID_INTEL_LPT_H87,
796 PCI_DEVICE_ID_INTEL_LPT_HM87,
797 PCI_DEVICE_ID_INTEL_LPT_Q85,
798 PCI_DEVICE_ID_INTEL_LPT_Q87,
799 PCI_DEVICE_ID_INTEL_LPT_QM87,
800 PCI_DEVICE_ID_INTEL_LPT_B85,
801 PCI_DEVICE_ID_INTEL_LPT_C222,
802 PCI_DEVICE_ID_INTEL_LPT_C224,
803 PCI_DEVICE_ID_INTEL_LPT_C226,
804 PCI_DEVICE_ID_INTEL_LPT_H81,
805 PCI_DEVICE_ID_INTEL_LPT_LP_SAMPLE,
806 PCI_DEVICE_ID_INTEL_LPT_LP_PREMIUM,
807 PCI_DEVICE_ID_INTEL_LPT_LP_MAINSTREAM,
808 PCI_DEVICE_ID_INTEL_LPT_LP_VALUE,
809 0
810};
Aaron Durbin76c37002012-10-30 09:03:43 -0500811
812static const struct pci_driver pch_lpc __pci_driver = {
813 .ops = &device_ops,
814 .vendor = PCI_VENDOR_ID_INTEL,
815 .devices = pci_device_ids,
816};