blob: fbb6bf1868ad642d0e872351b5bfce1b676ffe5d [file] [log] [blame]
Angel Pons182dbde2020-04-02 23:49:05 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Stefan Reinauerdebb11f2008-10-29 04:46:52 +00002
3#ifndef SOUTHBRIDGE_INTEL_I82801GX_I82801GX_H
4#define SOUTHBRIDGE_INTEL_I82801GX_I82801GX_H
Aaron Durbine9919452016-07-13 23:24:55 -05005
Stefan Reinaueraca6ec62009-10-26 17:12:21 +00006/*
7 * It does not matter where we put the SMBus I/O base, as long as we
8 * keep it consistent and don't interfere with other devices. Stage2
9 * will relocate this anyways.
10 * Our solution is to have SMB initialization move the I/O to SMBUS_IO_BASE
11 * again. But handling static BARs is a generic problem that should be
12 * solved in the device allocator.
13 */
14#define SMBUS_IO_BASE 0x0400
15/* TODO Make sure these don't get changed by stage2 */
16#define DEFAULT_GPIOBASE 0x0480
17#define DEFAULT_PMBASE 0x0500
Stefan Reinauer7a3d0952010-01-17 13:49:07 +000018
Arthur Heymans2e464cf2018-06-13 00:07:09 +020019#include <southbridge/intel/common/rcba.h>
Stefan Reinaueraca6ec62009-10-26 17:12:21 +000020
21#ifndef __ACPI__
22#define DEBUG_PERIODIC_SMIS 0
Stefan Reinauerdebb11f2008-10-29 04:46:52 +000023
Kyösti Mälkki12b121c2019-08-18 16:33:39 +030024#include <device/device.h>
Elyes HAOUAS99667032018-05-13 12:47:28 +020025void i82801gx_enable(struct device *dev);
Kyösti Mälkki12b121c2019-08-18 16:33:39 +030026
Arthur Heymansfecf7772019-11-09 14:19:04 +010027void i82801gx_lpc_setup(void);
Arthur Heymansb2363522019-11-11 18:40:50 +010028void i82801gx_setup_bars(void);
Arthur Heymans399b6c12019-11-11 19:12:57 +010029void i82801gx_early_init(void);
Kyösti Mälkki12b121c2019-08-18 16:33:39 +030030
Arthur Heymans2437fe92019-10-04 13:59:29 +020031void ich7_setup_cir(void);
Uwe Hermann4028ce72010-12-07 19:16:07 +000032
Stefan Reinauerde3206a2010-02-22 06:09:43 +000033#define MAINBOARD_POWER_OFF 0
34#define MAINBOARD_POWER_ON 1
35#define MAINBOARD_POWER_KEEP 2
36
Stefan Reinauerde3206a2010-02-22 06:09:43 +000037/* PCI Configuration Space (D30:F0): PCI2PCI */
38#define PSTS 0x06
39#define SMLT 0x1b
40#define SECSTS 0x1e
41#define INTR 0x3c
Stefan Reinauerde3206a2010-02-22 06:09:43 +000042
Arthur Heymans6267f5d2018-12-15 23:46:48 +010043#define ICH_PCIE_DEV_SLOT 28
44
Stefan Reinauer573f7d42009-07-21 21:50:34 +000045/* PCI Configuration Space (D31:F0): LPC */
Stefan Reinauerdebb11f2008-10-29 04:46:52 +000046
Stefan Reinauerdebb11f2008-10-29 04:46:52 +000047#define SERIRQ_CNTL 0x64
Uwe Hermann65ebc792008-11-06 22:24:05 +000048
Stefan Reinauerdebb11f2008-10-29 04:46:52 +000049#define GEN_PMCON_1 0xa0
50#define GEN_PMCON_2 0xa2
51#define GEN_PMCON_3 0xa4
52
Kyösti Mälkkib85a87b2014-12-29 11:32:27 +020053#define GPIO_ROUT 0xb8
54#define GPI_DISABLE 0x00
55#define GPI_IS_SMI 0x01
56#define GPI_IS_SCI 0x02
57#define GPI_IS_NMI 0x03
58
Arthur Heymanse6e5ecb2018-12-20 01:44:50 +010059#define FDVCT 0xe4
60#define PCIE_4_PORTS_MAX (1 << 7)
Arthur Heymans5eb81be2019-01-10 23:13:11 +010061#define AHCI_UNSUPPORTED (1 << 3)
Arthur Heymanse6e5ecb2018-12-20 01:44:50 +010062
Uwe Hermann65ebc792008-11-06 22:24:05 +000063/* GEN_PMCON_3 bits */
64#define RTC_BATTERY_DEAD (1 << 2)
65#define RTC_POWER_FAILED (1 << 1)
66#define SLEEP_AFTER_POWER_FAIL (1 << 0)
67
Stefan Reinauerdebb11f2008-10-29 04:46:52 +000068#define ACPI_CNTL 0x44
Kyösti Mälkki1cca3402013-02-26 19:21:39 +020069#define ACPI_EN (1 << 7)
Uwe Hermann65ebc792008-11-06 22:24:05 +000070#define BIOS_CNTL 0xDC
Stefan Reinauerdebb11f2008-10-29 04:46:52 +000071#define GPIO_BASE 0x48 /* LPC GPIO Base Address Register */
72#define GPIO_CNTL 0x4C /* LPC GPIO Control Register */
Elyes HAOUAS32b9a992019-01-21 14:54:31 +010073#define GPIO_EN (1 << 4)
Stefan Reinauerdebb11f2008-10-29 04:46:52 +000074
75#define PIRQA_ROUT 0x60
76#define PIRQB_ROUT 0x61
77#define PIRQC_ROUT 0x62
78#define PIRQD_ROUT 0x63
79#define PIRQE_ROUT 0x68
80#define PIRQF_ROUT 0x69
81#define PIRQG_ROUT 0x6A
82#define PIRQH_ROUT 0x6B
83
Stefan Reinauerdebb11f2008-10-29 04:46:52 +000084#define LPC_IO_DEC 0x80 /* IO Decode Ranges Register */
85#define LPC_EN 0x82 /* LPC IF Enables Register */
Damien Zammitf88b9322015-05-03 18:43:04 +100086#define CNF2_LPC_EN (1 << 13) /* 0x4e/0x4f */
87#define CNF1_LPC_EN (1 << 12) /* 0x2e/0x2f */
88#define MC_LPC_EN (1 << 11) /* 0x62/0x66 */
89#define KBC_LPC_EN (1 << 10) /* 0x60/0x64 */
90#define GAMEH_LPC_EN (1 << 9) /* 0x208/0x20f */
91#define GAMEL_LPC_EN (1 << 8) /* 0x200/0x207 */
92#define FDD_LPC_EN (1 << 3) /* LPC_IO_DEC[12] */
93#define LPT_LPC_EN (1 << 2) /* LPC_IO_DEC[9:8] */
94#define COMB_LPC_EN (1 << 1) /* LPC_IO_DEC[6:4] */
95#define COMA_LPC_EN (1 << 0) /* LPC_IO_DEC[2:0] */
Stefan Reinauerdebb11f2008-10-29 04:46:52 +000096
Arthur Heymansb451df22017-08-15 20:59:09 +020097#define GEN1_DEC 0x84
98#define GEN2_DEC 0x88
99#define GEN3_DEC 0x8c
100#define GEN4_DEC 0x90
101
Uwe Hermann65ebc792008-11-06 22:24:05 +0000102/* PCI Configuration Space (D31:F1): IDE */
Stefan Reinauerdebb11f2008-10-29 04:46:52 +0000103#define INTR_LN 0x3c
104#define IDE_TIM_PRI 0x40 /* IDE timings, primary */
105#define IDE_DECODE_ENABLE (1 << 15)
106#define IDE_SITRE (1 << 14)
Stefan Reinauer573f7d42009-07-21 21:50:34 +0000107#define IDE_ISP_5_CLOCKS (0 << 12)
108#define IDE_ISP_4_CLOCKS (1 << 12)
109#define IDE_ISP_3_CLOCKS (2 << 12)
110#define IDE_RCT_4_CLOCKS (0 << 8)
111#define IDE_RCT_3_CLOCKS (1 << 8)
112#define IDE_RCT_2_CLOCKS (2 << 8)
113#define IDE_RCT_1_CLOCKS (3 << 8)
114#define IDE_DTE1 (1 << 7)
115#define IDE_PPE1 (1 << 6)
116#define IDE_IE1 (1 << 5)
117#define IDE_TIME1 (1 << 4)
118#define IDE_DTE0 (1 << 3)
119#define IDE_PPE0 (1 << 2)
120#define IDE_IE0 (1 << 1)
121#define IDE_TIME0 (1 << 0)
Stefan Reinauerdebb11f2008-10-29 04:46:52 +0000122#define IDE_TIM_SEC 0x42 /* IDE timings, secondary */
Stefan Reinauer573f7d42009-07-21 21:50:34 +0000123
124#define IDE_SDMA_CNT 0x48 /* Synchronous DMA control */
125#define IDE_SSDE1 (1 << 3)
126#define IDE_SSDE0 (1 << 2)
127#define IDE_PSDE1 (1 << 1)
128#define IDE_PSDE0 (1 << 0)
129
130#define IDE_SDMA_TIM 0x4a
131
Stefan Reinauerdebb11f2008-10-29 04:46:52 +0000132#define IDE_CONFIG 0x54 /* IDE I/O Configuration Register */
Stefan Reinaueraca6ec62009-10-26 17:12:21 +0000133#define SIG_MODE_SEC_NORMAL (0 << 18)
134#define SIG_MODE_SEC_TRISTATE (1 << 18)
135#define SIG_MODE_SEC_DRIVELOW (2 << 18)
136#define SIG_MODE_PRI_NORMAL (0 << 16)
137#define SIG_MODE_PRI_TRISTATE (1 << 16)
138#define SIG_MODE_PRI_DRIVELOW (2 << 16)
139#define FAST_SCB1 (1 << 15)
140#define FAST_SCB0 (1 << 14)
Stefan Reinauerdebb11f2008-10-29 04:46:52 +0000141#define FAST_PCB1 (1 << 13)
142#define FAST_PCB0 (1 << 12)
Stefan Reinaueraca6ec62009-10-26 17:12:21 +0000143#define SCB1 (1 << 3)
144#define SCB0 (1 << 2)
Stefan Reinauerdebb11f2008-10-29 04:46:52 +0000145#define PCB1 (1 << 1)
146#define PCB0 (1 << 0)
147
Uwe Hermann65ebc792008-11-06 22:24:05 +0000148/* PCI Configuration Space (D31:F3): SMBus */
Stefan Reinauerdebb11f2008-10-29 04:46:52 +0000149#define SMB_BASE 0x20
150#define HOSTC 0x40
151
152/* HOSTC bits */
153#define I2C_EN (1 << 2)
154#define SMB_SMI_EN (1 << 1)
155#define HST_EN (1 << 0)
156
Stefan Reinauer573f7d42009-07-21 21:50:34 +0000157/* Southbridge IO BARs */
158
Stefan Reinauer573f7d42009-07-21 21:50:34 +0000159#define GPIOBASE 0x48
Stefan Reinauer573f7d42009-07-21 21:50:34 +0000160
161#define PMBASE 0x40
Stefan Reinauer573f7d42009-07-21 21:50:34 +0000162
Stefan Reinauer573f7d42009-07-21 21:50:34 +0000163#define VCH 0x0000 /* 32bit */
164#define VCAP1 0x0004 /* 32bit */
165#define VCAP2 0x0008 /* 32bit */
166#define PVC 0x000c /* 16bit */
167#define PVS 0x000e /* 16bit */
168
169#define V0CAP 0x0010 /* 32bit */
170#define V0CTL 0x0014 /* 32bit */
171#define V0STS 0x001a /* 16bit */
172
173#define V1CAP 0x001c /* 32bit */
174#define V1CTL 0x0020 /* 32bit */
175#define V1STS 0x0026 /* 16bit */
176
177#define RCTCL 0x0100 /* 32bit */
178#define ESD 0x0104 /* 32bit */
179#define ULD 0x0110 /* 32bit */
180#define ULBA 0x0118 /* 64bit */
181
182#define RP1D 0x0120 /* 32bit */
183#define RP1BA 0x0128 /* 64bit */
184#define RP2D 0x0130 /* 32bit */
185#define RP2BA 0x0138 /* 64bit */
186#define RP3D 0x0140 /* 32bit */
187#define RP3BA 0x0148 /* 64bit */
188#define RP4D 0x0150 /* 32bit */
189#define RP4BA 0x0158 /* 64bit */
190#define HDD 0x0160 /* 32bit */
191#define HDBA 0x0168 /* 64bit */
192#define RP5D 0x0170 /* 32bit */
193#define RP5BA 0x0178 /* 64bit */
194#define RP6D 0x0180 /* 32bit */
195#define RP6BA 0x0188 /* 64bit */
196
197#define ILCL 0x01a0 /* 32bit */
198#define LCAP 0x01a4 /* 32bit */
199#define LCTL 0x01a8 /* 16bit */
200#define LSTS 0x01aa /* 16bit */
201
202#define RPC 0x0224 /* 32bit */
203#define RPFN 0x0238 /* 32bit */
204
Arthur Heymans6267f5d2018-12-15 23:46:48 +0100205/* Get the function number assigned to a Root Port */
206#define RPFN_FNGET(reg, port) (((reg) >> ((port) * 4)) & 7)
207/* Set the function number for a Root Port */
208#define RPFN_FNSET(port, func) (((func) & 7) << ((port) * 4))
209/* Root Port function number mask */
210#define RPFN_FNMASK(port) (7 << ((port) * 4))
211
Stefan Reinauer573f7d42009-07-21 21:50:34 +0000212#define TRSR 0x1e00 /* 8bit */
213#define TRCR 0x1e10 /* 64bit */
214#define TWDR 0x1e18 /* 64bit */
215
216#define IOTR0 0x1e80 /* 64bit */
217#define IOTR1 0x1e88 /* 64bit */
218#define IOTR2 0x1e90 /* 64bit */
219#define IOTR3 0x1e98 /* 64bit */
220
221#define TCTL 0x3000 /* 8bit */
222
223#define D31IP 0x3100 /* 32bit */
224#define D30IP 0x3104 /* 32bit */
225#define D29IP 0x3108 /* 32bit */
226#define D28IP 0x310c /* 32bit */
227#define D27IP 0x3110 /* 32bit */
228#define D31IR 0x3140 /* 16bit */
229#define D30IR 0x3142 /* 16bit */
230#define D29IR 0x3144 /* 16bit */
231#define D28IR 0x3146 /* 16bit */
232#define D27IR 0x3148 /* 16bit */
233#define OIC 0x31ff /* 8bit */
234
235#define RC 0x3400 /* 32bit */
236#define HPTC 0x3404 /* 32bit */
237#define GCS 0x3410 /* 32bit */
238#define BUC 0x3414 /* 32bit */
239#define FD 0x3418 /* 32bit */
240#define CG 0x341c /* 32bit */
241
242/* Function Disable (FD) register values.
243 * Setting a bit disables the corresponding
244 * feature.
245 * Not all features might be disabled on
246 * all chipsets. Esp. ICH-7U is picky.
247 */
Arthur Heymans6267f5d2018-12-15 23:46:48 +0100248#define ICH_DISABLE_PCIE(x) (1 << (16 + (x)))
Stefan Reinauer573f7d42009-07-21 21:50:34 +0000249#define FD_EHCI (1 << 15)
250#define FD_LPCB (1 << 14)
251
252/* UHCI must be disabled from 4 downwards.
253 * If UHCI controllers get disabled, EHCI
254 * must know about it, too! */
Arthur Heymans6267f5d2018-12-15 23:46:48 +0100255#define ICH_DISABLE_UHCI(x) (1 << (8 + (x)))
Stefan Reinauer573f7d42009-07-21 21:50:34 +0000256
257#define FD_INTLAN (1 << 7)
258#define FD_ACMOD (1 << 6)
259#define FD_ACAUD (1 << 5)
260#define FD_HDAUD (1 << 4)
261#define FD_SMBUS (1 << 3)
262#define FD_SATA (1 << 2)
263#define FD_PATA (1 << 1)
264
Stefan Reinaueraca6ec62009-10-26 17:12:21 +0000265/* ICH7 PMBASE */
266#define PM1_STS 0x00
Stefan Reinauer7a3d0952010-01-17 13:49:07 +0000267#define WAK_STS (1 << 15)
268#define PCIEXPWAK_STS (1 << 14)
269#define PRBTNOR_STS (1 << 11)
270#define RTC_STS (1 << 10)
271#define PWRBTN_STS (1 << 8)
272#define GBL_STS (1 << 5)
273#define BM_STS (1 << 4)
274#define TMROF_STS (1 << 0)
Stefan Reinaueraca6ec62009-10-26 17:12:21 +0000275#define PM1_EN 0x02
Stefan Reinauer7a3d0952010-01-17 13:49:07 +0000276#define PCIEXPWAK_DIS (1 << 14)
277#define RTC_EN (1 << 10)
278#define PWRBTN_EN (1 << 8)
279#define GBL_EN (1 << 5)
280#define TMROF_EN (1 << 0)
Stefan Reinaueraca6ec62009-10-26 17:12:21 +0000281#define PM1_CNT 0x04
Stefan Reinaueraca6ec62009-10-26 17:12:21 +0000282#define GBL_RLS (1 << 2)
283#define BM_RLD (1 << 1)
284#define SCI_EN (1 << 0)
285#define PM1_TMR 0x08
286#define PROC_CNT 0x10
287#define LV2 0x14
288#define LV3 0x15
289#define LV4 0x16
290#define PM2_CNT 0x20 // mobile only
291#define GPE0_STS 0x28
Stefan Reinauer7a3d0952010-01-17 13:49:07 +0000292#define USB4_STS (1 << 14)
293#define PME_B0_STS (1 << 13)
294#define USB3_STS (1 << 12)
295#define PME_STS (1 << 11)
296#define BATLOW_STS (1 << 10)
297#define PCI_EXP_STS (1 << 9)
298#define RI_STS (1 << 8)
299#define SMB_WAK_STS (1 << 7)
300#define TCOSCI_STS (1 << 6)
301#define AC97_STS (1 << 5)
302#define USB2_STS (1 << 4)
303#define USB1_STS (1 << 3)
304#define SWGPE_STS (1 << 2)
305#define HOT_PLUG_STS (1 << 1)
306#define THRM_STS (1 << 0)
Stefan Reinaueraca6ec62009-10-26 17:12:21 +0000307#define GPE0_EN 0x2c
308#define PME_B0_EN (1 << 13)
Stefan Reinauer7a3d0952010-01-17 13:49:07 +0000309#define PME_EN (1 << 11)
Stefan Reinaueraca6ec62009-10-26 17:12:21 +0000310#define SMI_EN 0x30
311#define EL_SMI_EN (1 << 25) // Intel Quick Resume Technology
312#define INTEL_USB2_EN (1 << 18) // Intel-Specific USB2 SMI logic
313#define LEGACY_USB2_EN (1 << 17) // Legacy USB2 SMI logic
314#define PERIODIC_EN (1 << 14) // SMI on PERIODIC_STS in SMI_STS
315#define TCO_EN (1 << 13) // Enable TCO Logic (BIOSWE et al)
316#define MCSMI_EN (1 << 11) // Trap microcontroller range access
317#define BIOS_RLS (1 << 7) // asserts SCI on bit set
318#define SWSMI_TMR_EN (1 << 6) // start software smi timer on bit set
319#define APMC_EN (1 << 5) // Writes to APM_CNT cause SMI#
320#define SLP_SMI_EN (1 << 4) // Write to SLP_EN in PM1_CNT asserts SMI#
321#define LEGACY_USB_EN (1 << 3) // Legacy USB circuit SMI logic
322#define BIOS_EN (1 << 2) // Assert SMI# on setting GBL_RLS bit
323#define EOS (1 << 1) // End of SMI (deassert SMI#)
324#define GBL_SMI_EN (1 << 0) // SMI# generation at all?
325#define SMI_STS 0x34
326#define ALT_GP_SMI_EN 0x38
327#define ALT_GP_SMI_STS 0x3a
328#define GPE_CNTL 0x42
329#define DEVACT_STS 0x44
330#define SS_CNT 0x50
331#define C3_RES 0x54
Arthur Heymans36646472018-01-22 14:42:18 +0100332#define TCO1_CNT 0x68
333
Stefan Reinaueraca6ec62009-10-26 17:12:21 +0000334#endif /* __ACPI__ */
Stefan Reinauerdebb11f2008-10-29 04:46:52 +0000335#endif /* SOUTHBRIDGE_INTEL_I82801GX_I82801GX_H */