Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2008-2009 coresystems GmbH |
| 5 | * Copyright (C) 2012 The Chromium OS Authors. All rights reserved. |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; version 2 of the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | */ |
| 20 | |
| 21 | #ifndef SOUTHBRIDGE_INTEL_LYNXPOINT_PCH_H |
| 22 | #define SOUTHBRIDGE_INTEL_LYNXPOINT_PCH_H |
| 23 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 24 | /* |
| 25 | * Lynx Point PCH PCI Devices: |
| 26 | * |
| 27 | * Bus 0:Device 31:Function 0 LPC Controller1 |
| 28 | * Bus 0:Device 31:Function 2 SATA Controller #1 |
| 29 | * Bus 0:Device 31:Function 3 SMBus Controller |
| 30 | * Bus 0:Device 31:Function 5 SATA Controller #22 |
| 31 | * Bus 0:Device 31:Function 6 Thermal Subsystem |
| 32 | * Bus 0:Device 29:Function 03 USB EHCI Controller #1 |
| 33 | * Bus 0:Device 26:Function 03 USB EHCI Controller #2 |
| 34 | * Bus 0:Device 28:Function 0 PCI Express* Port 1 |
| 35 | * Bus 0:Device 28:Function 1 PCI Express Port 2 |
| 36 | * Bus 0:Device 28:Function 2 PCI Express Port 3 |
| 37 | * Bus 0:Device 28:Function 3 PCI Express Port 4 |
| 38 | * Bus 0:Device 28:Function 4 PCI Express Port 5 |
| 39 | * Bus 0:Device 28:Function 5 PCI Express Port 6 |
| 40 | * Bus 0:Device 28:Function 6 PCI Express Port 7 |
| 41 | * Bus 0:Device 28:Function 7 PCI Express Port 8 |
Duncan Laurie | 5cc51c0 | 2013-03-07 14:06:43 -0800 | [diff] [blame] | 42 | * Bus 0:Device 27:Function 0 Intel High Definition Audio Controller |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 43 | * Bus 0:Device 25:Function 0 Gigabit Ethernet Controller |
Duncan Laurie | 5cc51c0 | 2013-03-07 14:06:43 -0800 | [diff] [blame] | 44 | * Bus 0:Device 22:Function 0 Intel Management Engine Interface #1 |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 45 | * Bus 0:Device 22:Function 1 Intel Management Engine Interface #2 |
| 46 | * Bus 0:Device 22:Function 2 IDE-R |
| 47 | * Bus 0:Device 22:Function 3 KT |
| 48 | * Bus 0:Device 20:Function 0 xHCI Controller |
| 49 | */ |
| 50 | |
| 51 | /* PCH types */ |
Duncan Laurie | 5cc51c0 | 2013-03-07 14:06:43 -0800 | [diff] [blame] | 52 | #define PCH_TYPE_LPT 0x8c |
| 53 | #define PCH_TYPE_LPT_LP 0x9c |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 54 | |
| 55 | /* PCH stepping values for LPC device */ |
| 56 | |
| 57 | /* |
| 58 | * It does not matter where we put the SMBus I/O base, as long as we |
| 59 | * keep it consistent and don't interfere with other devices. Stage2 |
| 60 | * will relocate this anyways. |
| 61 | * Our solution is to have SMB initialization move the I/O to SMBUS_IO_BASE |
| 62 | * again. But handling static BARs is a generic problem that should be |
| 63 | * solved in the device allocator. |
| 64 | */ |
| 65 | #define SMBUS_IO_BASE 0x0400 |
| 66 | #define SMBUS_SLAVE_ADDR 0x24 |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 67 | |
Duncan Laurie | 045f153 | 2012-12-17 11:29:10 -0800 | [diff] [blame] | 68 | #if CONFIG_INTEL_LYNXPOINT_LP |
Duncan Laurie | 7922b46 | 2013-03-08 16:34:33 -0800 | [diff] [blame] | 69 | #define DEFAULT_PMBASE 0x1000 |
| 70 | #define DEFAULT_GPIOBASE 0x1400 |
Duncan Laurie | 045f153 | 2012-12-17 11:29:10 -0800 | [diff] [blame] | 71 | #define DEFAULT_GPIOSIZE 0x400 |
| 72 | #else |
Duncan Laurie | 7922b46 | 2013-03-08 16:34:33 -0800 | [diff] [blame] | 73 | #define DEFAULT_PMBASE 0x500 |
Duncan Laurie | 045f153 | 2012-12-17 11:29:10 -0800 | [diff] [blame] | 74 | #define DEFAULT_GPIOBASE 0x480 |
| 75 | #define DEFAULT_GPIOSIZE 0x80 |
| 76 | #endif |
| 77 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 78 | #define HPET_ADDR 0xfed00000 |
| 79 | #define DEFAULT_RCBA 0xfed1c000 |
| 80 | |
| 81 | #ifndef __ACPI__ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 82 | |
| 83 | #if defined (__SMM__) && !defined(__ASSEMBLER__) |
| 84 | void intel_pch_finalize_smm(void); |
| 85 | #endif |
| 86 | |
Aaron Durbin | 239c2e8 | 2012-12-19 11:31:17 -0600 | [diff] [blame] | 87 | |
| 88 | /* State Machine configuration. */ |
| 89 | #define RCBA_REG_SIZE_MASK 0x8000 |
| 90 | #define RCBA_REG_SIZE_16 0x8000 |
| 91 | #define RCBA_REG_SIZE_32 0x0000 |
| 92 | #define RCBA_COMMAND_MASK 0x000f |
| 93 | #define RCBA_COMMAND_SET 0x0001 |
| 94 | #define RCBA_COMMAND_READ 0x0002 |
| 95 | #define RCBA_COMMAND_RMW 0x0003 |
| 96 | #define RCBA_COMMAND_END 0x0007 |
| 97 | |
| 98 | #define RCBA_ENCODE_COMMAND(command_, reg_, mask_, or_value_) \ |
| 99 | { .command = command_, \ |
| 100 | .reg = reg_, \ |
| 101 | .mask = mask_, \ |
| 102 | .or_value = or_value_ \ |
| 103 | } |
| 104 | #define RCBA_SET_REG_32(reg_, value_) \ |
| 105 | RCBA_ENCODE_COMMAND(RCBA_REG_SIZE_32|RCBA_COMMAND_SET, reg_, 0, value_) |
| 106 | #define RCBA_READ_REG_32(reg_) \ |
| 107 | RCBA_ENCODE_COMMAND(RCBA_REG_SIZE_32|RCBA_COMMAND_READ, reg_, 0, 0) |
| 108 | #define RCBA_RMW_REG_32(reg_, mask_, or_) \ |
| 109 | RCBA_ENCODE_COMMAND(RCBA_REG_SIZE_32|RCBA_COMMAND_RMW, reg_, mask_, or_) |
| 110 | #define RCBA_SET_REG_16(reg_, value_) \ |
| 111 | RCBA_ENCODE_COMMAND(RCBA_REG_SIZE_16|RCBA_COMMAND_SET, reg_, 0, value_) |
| 112 | #define RCBA_READ_REG_16(reg_) \ |
| 113 | RCBA_ENCODE_COMMAND(RCBA_REG_SIZE_16|RCBA_COMMAND_READ, reg_, 0, 0) |
| 114 | #define RCBA_RMW_REG_16(reg_, mask_, or_) \ |
| 115 | RCBA_ENCODE_COMMAND(RCBA_REG_SIZE_16|RCBA_COMMAND_RMW, reg_, mask_, or_) |
| 116 | #define RCBA_END_CONFIG \ |
| 117 | RCBA_ENCODE_COMMAND(RCBA_COMMAND_END, 0, 0, 0) |
| 118 | |
| 119 | struct rcba_config_instruction |
| 120 | { |
| 121 | u16 command; |
| 122 | u16 reg; |
| 123 | u32 mask; |
| 124 | u32 or_value; |
| 125 | }; |
| 126 | |
Stefan Reinauer | 3f5f6d8 | 2013-05-07 20:35:29 +0200 | [diff] [blame] | 127 | #if !defined(__ASSEMBLER__) |
Duncan Laurie | 8584b22 | 2013-02-15 13:52:28 -0800 | [diff] [blame] | 128 | void pch_config_rcba(const struct rcba_config_instruction *rcba_config); |
Duncan Laurie | 5cc51c0 | 2013-03-07 14:06:43 -0800 | [diff] [blame] | 129 | int pch_silicon_revision(void); |
| 130 | int pch_silicon_type(void); |
| 131 | int pch_is_lp(void); |
Duncan Laurie | 1ad5564 | 2013-03-07 14:08:04 -0800 | [diff] [blame] | 132 | u16 get_pmbase(void); |
| 133 | u16 get_gpiobase(void); |
Duncan Laurie | 55cdf55 | 2013-03-08 16:01:44 -0800 | [diff] [blame] | 134 | |
| 135 | /* Power Management register handling in pmutil.c */ |
| 136 | /* PM1_CNT */ |
| 137 | void enable_pm1_control(u32 mask); |
| 138 | void disable_pm1_control(u32 mask); |
| 139 | /* PM1 */ |
| 140 | u16 clear_pm1_status(void); |
Aaron Durbin | d6d6db3 | 2013-03-27 21:13:02 -0500 | [diff] [blame] | 141 | void enable_pm1(u16 events); |
Duncan Laurie | 55cdf55 | 2013-03-08 16:01:44 -0800 | [diff] [blame] | 142 | u32 clear_smi_status(void); |
| 143 | /* SMI */ |
| 144 | void enable_smi(u32 mask); |
| 145 | void disable_smi(u32 mask); |
| 146 | /* ALT_GP_SMI */ |
| 147 | u32 clear_alt_smi_status(void); |
| 148 | void enable_alt_smi(u32 mask); |
| 149 | /* TCO */ |
| 150 | u32 clear_tco_status(void); |
| 151 | void enable_tco_sci(void); |
| 152 | /* GPE0 */ |
| 153 | u32 clear_gpe_status(void); |
| 154 | void clear_gpe_enable(void); |
| 155 | void enable_all_gpe(u32 set1, u32 set2, u32 set3, u32 set4); |
| 156 | void disable_all_gpe(void); |
| 157 | void enable_gpe(u32 mask); |
| 158 | void disable_gpe(u32 mask); |
| 159 | |
Duncan Laurie | 8584b22 | 2013-02-15 13:52:28 -0800 | [diff] [blame] | 160 | #if !defined(__PRE_RAM__) && !defined(__SMM__) |
| 161 | #include <device/device.h> |
| 162 | #include <arch/acpi.h> |
| 163 | #include "chip.h" |
Duncan Laurie | 8584b22 | 2013-02-15 13:52:28 -0800 | [diff] [blame] | 164 | void pch_enable(device_t dev); |
| 165 | void pch_iobp_update(u32 address, u32 andvalue, u32 orvalue); |
| 166 | #if CONFIG_ELOG |
| 167 | void pch_log_state(void); |
| 168 | #endif |
| 169 | void acpi_create_intel_hpet(acpi_hpet_t * hpet); |
Duncan Laurie | d7cb8d0 | 2013-05-15 15:03:57 -0700 | [diff] [blame] | 170 | void acpi_create_serialio_ssdt(acpi_header_t *ssdt); |
Duncan Laurie | 8584b22 | 2013-02-15 13:52:28 -0800 | [diff] [blame] | 171 | |
| 172 | /* These helpers are for performing SMM relocation. */ |
Duncan Laurie | 8584b22 | 2013-02-15 13:52:28 -0800 | [diff] [blame] | 173 | void southbridge_trigger_smi(void); |
| 174 | void southbridge_clear_smi_status(void); |
Aaron Durbin | af3158c | 2013-03-27 20:57:28 -0500 | [diff] [blame] | 175 | /* The initialization of the southbridge is split into 2 compoments. One is |
| 176 | * for clearing the state in the SMM registers. The other is for enabling |
| 177 | * SMIs. They are split so that other work between the 2 actions. */ |
| 178 | void southbridge_smm_clear_state(void); |
| 179 | void southbridge_smm_enable_smi(void); |
Duncan Laurie | 8584b22 | 2013-02-15 13:52:28 -0800 | [diff] [blame] | 180 | #else |
| 181 | void enable_smbus(void); |
| 182 | void enable_usb_bar(void); |
| 183 | int smbus_read_byte(unsigned device, unsigned address); |
| 184 | int early_spi_read(u32 offset, u32 size, u8 *buffer); |
Aaron Durbin | 239c2e8 | 2012-12-19 11:31:17 -0600 | [diff] [blame] | 185 | int early_pch_init(const void *gpio_map, |
| 186 | const struct rcba_config_instruction *rcba_config); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 187 | #endif |
Duncan Laurie | 045f153 | 2012-12-17 11:29:10 -0800 | [diff] [blame] | 188 | /* |
| 189 | * get GPIO pin value |
| 190 | */ |
| 191 | int get_gpio(int gpio_num); |
| 192 | /* |
| 193 | * get a number comprised of multiple GPIO values. gpio_num_array points to |
| 194 | * the array of gpio pin numbers to scan, terminated by -1. |
| 195 | */ |
| 196 | unsigned get_gpios(const int *gpio_num_array); |
Duncan Laurie | 15de7cb | 2013-04-23 13:44:37 -0700 | [diff] [blame] | 197 | /* |
| 198 | * set GPIO pin value |
| 199 | */ |
| 200 | void set_gpio(int gpio_num, int value); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 201 | #endif |
| 202 | |
| 203 | #define MAINBOARD_POWER_OFF 0 |
| 204 | #define MAINBOARD_POWER_ON 1 |
| 205 | #define MAINBOARD_POWER_KEEP 2 |
| 206 | |
| 207 | #ifndef CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL |
| 208 | #define CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL MAINBOARD_POWER_ON |
| 209 | #endif |
| 210 | |
| 211 | /* PCI Configuration Space (D30:F0): PCI2PCI */ |
| 212 | #define PSTS 0x06 |
| 213 | #define SMLT 0x1b |
| 214 | #define SECSTS 0x1e |
| 215 | #define INTR 0x3c |
| 216 | #define BCTRL 0x3e |
| 217 | #define SBR (1 << 6) |
| 218 | #define SEE (1 << 1) |
| 219 | #define PERE (1 << 0) |
| 220 | |
Duncan Laurie | 98c4062 | 2013-05-21 16:37:40 -0700 | [diff] [blame^] | 221 | /* Power Management Control and Status */ |
| 222 | #define PCH_PCS 0x84 |
| 223 | #define PCH_PCS_PS_D3HOT 3 |
| 224 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 225 | #define PCH_EHCI1_DEV PCI_DEV(0, 0x1d, 0) |
| 226 | #define PCH_EHCI2_DEV PCI_DEV(0, 0x1a, 0) |
| 227 | #define PCH_ME_DEV PCI_DEV(0, 0x16, 0) |
| 228 | #define PCH_PCIE_DEV_SLOT 28 |
| 229 | |
| 230 | /* PCI Configuration Space (D31:F0): LPC */ |
| 231 | #define PCH_LPC_DEV PCI_DEV(0, 0x1f, 0) |
| 232 | #define SERIRQ_CNTL 0x64 |
| 233 | |
| 234 | #define GEN_PMCON_1 0xa0 |
| 235 | #define GEN_PMCON_2 0xa2 |
| 236 | #define GEN_PMCON_3 0xa4 |
Aaron Durbin | b9ea8b3 | 2012-11-02 09:10:30 -0500 | [diff] [blame] | 237 | #define PMIR 0xac |
| 238 | #define PMIR_CF9LOCK (1 << 31) |
| 239 | #define PMIR_CF9GR (1 << 20) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 240 | |
| 241 | /* GEN_PMCON_3 bits */ |
| 242 | #define RTC_BATTERY_DEAD (1 << 2) |
| 243 | #define RTC_POWER_FAILED (1 << 1) |
| 244 | #define SLEEP_AFTER_POWER_FAIL (1 << 0) |
| 245 | |
| 246 | #define PMBASE 0x40 |
| 247 | #define ACPI_CNTL 0x44 |
Paul Menzel | 373a20c | 2013-05-03 12:17:02 +0200 | [diff] [blame] | 248 | #define ACPI_EN (1 << 7) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 249 | #define BIOS_CNTL 0xDC |
| 250 | #define GPIO_BASE 0x48 /* LPC GPIO Base Address Register */ |
| 251 | #define GPIO_CNTL 0x4C /* LPC GPIO Control Register */ |
| 252 | #define GPIO_ROUT 0xb8 |
| 253 | |
| 254 | #define PIRQA_ROUT 0x60 |
| 255 | #define PIRQB_ROUT 0x61 |
| 256 | #define PIRQC_ROUT 0x62 |
| 257 | #define PIRQD_ROUT 0x63 |
| 258 | #define PIRQE_ROUT 0x68 |
| 259 | #define PIRQF_ROUT 0x69 |
| 260 | #define PIRQG_ROUT 0x6A |
| 261 | #define PIRQH_ROUT 0x6B |
| 262 | |
| 263 | #define LPC_IO_DEC 0x80 /* IO Decode Ranges Register */ |
| 264 | #define LPC_EN 0x82 /* LPC IF Enables Register */ |
| 265 | #define CNF2_LPC_EN (1 << 13) /* 0x4e/0x4f */ |
| 266 | #define CNF1_LPC_EN (1 << 12) /* 0x2e/0x2f */ |
| 267 | #define MC_LPC_EN (1 << 11) /* 0x62/0x66 */ |
| 268 | #define KBC_LPC_EN (1 << 10) /* 0x60/0x64 */ |
| 269 | #define GAMEH_LPC_EN (1 << 9) /* 0x208/0x20f */ |
| 270 | #define GAMEL_LPC_EN (1 << 8) /* 0x200/0x207 */ |
| 271 | #define FDD_LPC_EN (1 << 3) /* LPC_IO_DEC[12] */ |
| 272 | #define LPT_LPC_EN (1 << 2) /* LPC_IO_DEC[9:8] */ |
| 273 | #define COMB_LPC_EN (1 << 1) /* LPC_IO_DEC[6:4] */ |
| 274 | #define COMA_LPC_EN (1 << 0) /* LPC_IO_DEC[2:0] */ |
| 275 | #define LPC_GEN1_DEC 0x84 /* LPC IF Generic Decode Range 1 */ |
| 276 | #define LPC_GEN2_DEC 0x88 /* LPC IF Generic Decode Range 2 */ |
| 277 | #define LPC_GEN3_DEC 0x8c /* LPC IF Generic Decode Range 3 */ |
| 278 | #define LPC_GEN4_DEC 0x90 /* LPC IF Generic Decode Range 4 */ |
Aaron Durbin | 6f561af | 2012-12-19 14:38:01 -0600 | [diff] [blame] | 279 | #define LGMR 0x98 /* LPC Generic Memory Range */ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 280 | |
| 281 | /* PCI Configuration Space (D31:F1): IDE */ |
| 282 | #define PCH_IDE_DEV PCI_DEV(0, 0x1f, 1) |
| 283 | #define PCH_SATA_DEV PCI_DEV(0, 0x1f, 2) |
| 284 | #define PCH_SATA2_DEV PCI_DEV(0, 0x1f, 5) |
| 285 | #define INTR_LN 0x3c |
| 286 | #define IDE_TIM_PRI 0x40 /* IDE timings, primary */ |
| 287 | #define IDE_DECODE_ENABLE (1 << 15) |
| 288 | #define IDE_SITRE (1 << 14) |
| 289 | #define IDE_ISP_5_CLOCKS (0 << 12) |
| 290 | #define IDE_ISP_4_CLOCKS (1 << 12) |
| 291 | #define IDE_ISP_3_CLOCKS (2 << 12) |
| 292 | #define IDE_RCT_4_CLOCKS (0 << 8) |
| 293 | #define IDE_RCT_3_CLOCKS (1 << 8) |
| 294 | #define IDE_RCT_2_CLOCKS (2 << 8) |
| 295 | #define IDE_RCT_1_CLOCKS (3 << 8) |
| 296 | #define IDE_DTE1 (1 << 7) |
| 297 | #define IDE_PPE1 (1 << 6) |
| 298 | #define IDE_IE1 (1 << 5) |
| 299 | #define IDE_TIME1 (1 << 4) |
| 300 | #define IDE_DTE0 (1 << 3) |
| 301 | #define IDE_PPE0 (1 << 2) |
| 302 | #define IDE_IE0 (1 << 1) |
| 303 | #define IDE_TIME0 (1 << 0) |
| 304 | #define IDE_TIM_SEC 0x42 /* IDE timings, secondary */ |
| 305 | |
| 306 | #define IDE_SDMA_CNT 0x48 /* Synchronous DMA control */ |
| 307 | #define IDE_SSDE1 (1 << 3) |
| 308 | #define IDE_SSDE0 (1 << 2) |
| 309 | #define IDE_PSDE1 (1 << 1) |
| 310 | #define IDE_PSDE0 (1 << 0) |
| 311 | |
| 312 | #define IDE_SDMA_TIM 0x4a |
| 313 | |
| 314 | #define IDE_CONFIG 0x54 /* IDE I/O Configuration Register */ |
| 315 | #define SIG_MODE_SEC_NORMAL (0 << 18) |
| 316 | #define SIG_MODE_SEC_TRISTATE (1 << 18) |
| 317 | #define SIG_MODE_SEC_DRIVELOW (2 << 18) |
| 318 | #define SIG_MODE_PRI_NORMAL (0 << 16) |
| 319 | #define SIG_MODE_PRI_TRISTATE (1 << 16) |
| 320 | #define SIG_MODE_PRI_DRIVELOW (2 << 16) |
| 321 | #define FAST_SCB1 (1 << 15) |
| 322 | #define FAST_SCB0 (1 << 14) |
| 323 | #define FAST_PCB1 (1 << 13) |
| 324 | #define FAST_PCB0 (1 << 12) |
| 325 | #define SCB1 (1 << 3) |
| 326 | #define SCB0 (1 << 2) |
| 327 | #define PCB1 (1 << 1) |
| 328 | #define PCB0 (1 << 0) |
| 329 | |
| 330 | #define SATA_SIRI 0xa0 /* SATA Indexed Register Index */ |
| 331 | #define SATA_SIRD 0xa4 /* SATA Indexed Register Data */ |
| 332 | #define SATA_SP 0xd0 /* Scratchpad */ |
| 333 | |
| 334 | /* SATA IOBP Registers */ |
| 335 | #define SATA_IOBP_SP0G3IR 0xea000151 |
| 336 | #define SATA_IOBP_SP1G3IR 0xea000051 |
| 337 | |
Duncan Laurie | 71346c0 | 2013-01-10 13:20:40 -0800 | [diff] [blame] | 338 | /* Serial IO IOBP Registers */ |
| 339 | #define SIO_IOBP_PORTCTRL0 0xcb000000 /* SDIO D23:F0 */ |
| 340 | #define SIO_IOBP_PORTCTRL0_ACPI_IRQ_EN (1 << 5) |
| 341 | #define SIO_IOBP_PORTCTRL0_PCI_CONF_DIS (1 << 4) |
| 342 | #define SIO_IOBP_PORTCTRL1 0xcb000014 /* SDIO D23:F0 */ |
| 343 | #define SIO_IOBP_PORTCTRL1_SNOOP_SELECT(x) (((x) & 3) << 13) |
| 344 | #define SIO_IOBP_GPIODF 0xcb000154 |
| 345 | #define SIO_IOBP_GPIODF_SDIO_IDLE_DET_EN (1 << 4) |
| 346 | #define SIO_IOBP_GPIODF_DMA_IDLE_DET_EN (1 << 3) |
| 347 | #define SIO_IOBP_GPIODF_UART_IDLE_DET_EN (1 << 2) |
| 348 | #define SIO_IOBP_GPIODF_I2C_IDLE_DET_EN (1 << 1) |
| 349 | #define SIO_IOBP_GPIODF_SPI_IDLE_DET_EN (1 << 0) |
| 350 | #define SIO_IOBP_PORTCTRL2 0xcb000240 /* DMA D21:F0 */ |
| 351 | #define SIO_IOBP_PORTCTRL3 0xcb000248 /* I2C0 D21:F1 */ |
| 352 | #define SIO_IOBP_PORTCTRL4 0xcb000250 /* I2C1 D21:F2 */ |
| 353 | #define SIO_IOBP_PORTCTRL5 0xcb000258 /* SPI0 D21:F3 */ |
| 354 | #define SIO_IOBP_PORTCTRL6 0xcb000260 /* SPI1 D21:F4 */ |
| 355 | #define SIO_IOBP_PORTCTRL7 0xcb000268 /* UART0 D21:F5 */ |
| 356 | #define SIO_IOBP_PORTCTRL8 0xcb000270 /* UART1 D21:F6 */ |
Duncan Laurie | b39ba2e | 2013-03-22 11:21:14 -0700 | [diff] [blame] | 357 | #define SIO_IOBP_PORTCTRLX(x) (0xcb000240 + ((x) * 8)) |
Duncan Laurie | 71346c0 | 2013-01-10 13:20:40 -0800 | [diff] [blame] | 358 | /* PORTCTRL 2-8 have the same layout */ |
| 359 | #define SIO_IOBP_PORTCTRL_ACPI_IRQ_EN (1 << 21) |
| 360 | #define SIO_IOBP_PORTCTRL_PCI_CONF_DIS (1 << 20) |
| 361 | #define SIO_IOBP_PORTCTRL_SNOOP_SELECT(x) (((x) & 3) << 18) |
| 362 | #define SIO_IOBP_PORTCTRL_INT_PIN(x) (((x) & 0xf) << 2) |
Duncan Laurie | b39ba2e | 2013-03-22 11:21:14 -0700 | [diff] [blame] | 363 | #define SIO_IOBP_PORTCTRL_PM_CAP_PRSNT (1 << 1) |
Duncan Laurie | 71346c0 | 2013-01-10 13:20:40 -0800 | [diff] [blame] | 364 | #define SIO_IOBP_FUNCDIS0 0xce00aa07 /* DMA D21:F0 */ |
| 365 | #define SIO_IOBP_FUNCDIS1 0xce00aa47 /* I2C0 D21:F1 */ |
| 366 | #define SIO_IOBP_FUNCDIS2 0xce00aa87 /* I2C1 D21:F2 */ |
| 367 | #define SIO_IOBP_FUNCDIS3 0xce00aac7 /* SPI0 D21:F3 */ |
| 368 | #define SIO_IOBP_FUNCDIS4 0xce00ab07 /* SPI1 D21:F4 */ |
| 369 | #define SIO_IOBP_FUNCDIS5 0xce00ab47 /* UART0 D21:F5 */ |
| 370 | #define SIO_IOBP_FUNCDIS6 0xce00ab87 /* UART1 D21:F6 */ |
| 371 | #define SIO_IOBP_FUNCDIS7 0xce00ae07 /* SDIO D23:F0 */ |
| 372 | #define SIO_IOBP_FUNCDIS_DIS (1 << 8) |
| 373 | |
Duncan Laurie | b39ba2e | 2013-03-22 11:21:14 -0700 | [diff] [blame] | 374 | /* Serial IO Devices */ |
| 375 | #define SIO_ID_SDMA 0 /* D21:F0 */ |
| 376 | #define SIO_ID_I2C0 1 /* D21:F1 */ |
| 377 | #define SIO_ID_I2C1 2 /* D21:F2 */ |
| 378 | #define SIO_ID_SPI0 3 /* D21:F3 */ |
| 379 | #define SIO_ID_SPI1 4 /* D21:F4 */ |
| 380 | #define SIO_ID_UART0 5 /* D21:F5 */ |
| 381 | #define SIO_ID_UART1 6 /* D21:F6 */ |
| 382 | #define SIO_ID_SDIO 7 /* D23:F0 */ |
| 383 | |
Duncan Laurie | 98c4062 | 2013-05-21 16:37:40 -0700 | [diff] [blame^] | 384 | #define SIO_REG_PPR_CLOCK 0x800 |
| 385 | #define SIO_REG_PPR_CLOCK_EN (1 << 0) |
Duncan Laurie | b39ba2e | 2013-03-22 11:21:14 -0700 | [diff] [blame] | 386 | #define SIO_REG_PPR_RST 0x804 |
| 387 | #define SIO_REG_PPR_RST_ASSERT 0x3 |
| 388 | #define SIO_REG_PPR_GEN 0x808 |
| 389 | #define SIO_REG_PPR_GEN_LTR_MODE_MASK (1 << 2) |
| 390 | #define SIO_REG_PPR_GEN_VOLTAGE_MASK (1 << 3) |
| 391 | #define SIO_REG_PPR_GEN_VOLTAGE(x) ((x & 1) << 3) |
| 392 | #define SIO_REG_AUTO_LTR 0x814 |
| 393 | |
| 394 | #define SIO_REG_SDIO_PPR_GEN 0x1008 |
| 395 | #define SIO_REG_SDIO_PPR_SW_LTR 0x1010 |
| 396 | #define SIO_REG_SDIO_PPR_CMD12 0x3c |
| 397 | #define SIO_REG_SDIO_PPR_CMD12_B30 (1 << 30) |
| 398 | |
| 399 | #define SIO_PIN_INTA 1 /* IRQ5 in ACPI mode */ |
| 400 | #define SIO_PIN_INTB 2 /* IRQ6 in ACPI mode */ |
| 401 | #define SIO_PIN_INTC 3 /* IRQ7 in ACPI mode */ |
| 402 | #define SIO_PIN_INTD 4 /* IRQ13 in ACPI mode */ |
| 403 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 404 | /* PCI Configuration Space (D31:F3): SMBus */ |
| 405 | #define PCH_SMBUS_DEV PCI_DEV(0, 0x1f, 3) |
| 406 | #define SMB_BASE 0x20 |
| 407 | #define HOSTC 0x40 |
| 408 | #define SMB_RCV_SLVA 0x09 |
| 409 | |
| 410 | /* HOSTC bits */ |
| 411 | #define I2C_EN (1 << 2) |
| 412 | #define SMB_SMI_EN (1 << 1) |
| 413 | #define HST_EN (1 << 0) |
| 414 | |
| 415 | /* SMBus I/O bits. */ |
| 416 | #define SMBHSTSTAT 0x0 |
| 417 | #define SMBHSTCTL 0x2 |
| 418 | #define SMBHSTCMD 0x3 |
| 419 | #define SMBXMITADD 0x4 |
| 420 | #define SMBHSTDAT0 0x5 |
| 421 | #define SMBHSTDAT1 0x6 |
| 422 | #define SMBBLKDAT 0x7 |
| 423 | #define SMBTRNSADD 0x9 |
| 424 | #define SMBSLVDATA 0xa |
| 425 | #define SMLINK_PIN_CTL 0xe |
| 426 | #define SMBUS_PIN_CTL 0xf |
| 427 | |
| 428 | #define SMBUS_TIMEOUT (10 * 1000 * 100) |
| 429 | |
| 430 | |
| 431 | /* Southbridge IO BARs */ |
| 432 | |
| 433 | #define GPIOBASE 0x48 |
| 434 | |
| 435 | #define PMBASE 0x40 |
| 436 | |
| 437 | /* Root Complex Register Block */ |
| 438 | #define RCBA 0xf0 |
| 439 | |
| 440 | #define RCBA8(x) *((volatile u8 *)(DEFAULT_RCBA + x)) |
| 441 | #define RCBA16(x) *((volatile u16 *)(DEFAULT_RCBA + x)) |
| 442 | #define RCBA32(x) *((volatile u32 *)(DEFAULT_RCBA + x)) |
| 443 | |
| 444 | #define RCBA_AND_OR(bits, x, and, or) \ |
| 445 | RCBA##bits(x) = ((RCBA##bits(x) & (and)) | (or)) |
| 446 | #define RCBA8_AND_OR(x, and, or) RCBA_AND_OR(8, x, and, or) |
| 447 | #define RCBA16_AND_OR(x, and, or) RCBA_AND_OR(16, x, and, or) |
| 448 | #define RCBA32_AND_OR(x, and, or) RCBA_AND_OR(32, x, and, or) |
| 449 | #define RCBA32_OR(x, or) RCBA_AND_OR(32, x, ~0UL, or) |
| 450 | |
| 451 | #define VCH 0x0000 /* 32bit */ |
| 452 | #define VCAP1 0x0004 /* 32bit */ |
| 453 | #define VCAP2 0x0008 /* 32bit */ |
| 454 | #define PVC 0x000c /* 16bit */ |
| 455 | #define PVS 0x000e /* 16bit */ |
| 456 | |
| 457 | #define V0CAP 0x0010 /* 32bit */ |
| 458 | #define V0CTL 0x0014 /* 32bit */ |
| 459 | #define V0STS 0x001a /* 16bit */ |
| 460 | |
| 461 | #define V1CAP 0x001c /* 32bit */ |
| 462 | #define V1CTL 0x0020 /* 32bit */ |
| 463 | #define V1STS 0x0026 /* 16bit */ |
| 464 | |
| 465 | #define RCTCL 0x0100 /* 32bit */ |
| 466 | #define ESD 0x0104 /* 32bit */ |
| 467 | #define ULD 0x0110 /* 32bit */ |
| 468 | #define ULBA 0x0118 /* 64bit */ |
| 469 | |
| 470 | #define RP1D 0x0120 /* 32bit */ |
| 471 | #define RP1BA 0x0128 /* 64bit */ |
| 472 | #define RP2D 0x0130 /* 32bit */ |
| 473 | #define RP2BA 0x0138 /* 64bit */ |
| 474 | #define RP3D 0x0140 /* 32bit */ |
| 475 | #define RP3BA 0x0148 /* 64bit */ |
| 476 | #define RP4D 0x0150 /* 32bit */ |
| 477 | #define RP4BA 0x0158 /* 64bit */ |
| 478 | #define HDD 0x0160 /* 32bit */ |
| 479 | #define HDBA 0x0168 /* 64bit */ |
| 480 | #define RP5D 0x0170 /* 32bit */ |
| 481 | #define RP5BA 0x0178 /* 64bit */ |
| 482 | #define RP6D 0x0180 /* 32bit */ |
| 483 | #define RP6BA 0x0188 /* 64bit */ |
| 484 | |
| 485 | #define RPFN 0x0404 /* 32bit */ |
| 486 | |
| 487 | /* Root Port configuratinon space hide */ |
| 488 | #define RPFN_HIDE(port) (1 << (((port) * 4) + 3)) |
| 489 | /* Get the function number assigned to a Root Port */ |
| 490 | #define RPFN_FNGET(reg,port) (((reg) >> ((port) * 4)) & 7) |
| 491 | /* Set the function number for a Root Port */ |
| 492 | #define RPFN_FNSET(port,func) (((func) & 7) << ((port) * 4)) |
| 493 | /* Root Port function number mask */ |
| 494 | #define RPFN_FNMASK(port) (7 << ((port) * 4)) |
| 495 | |
| 496 | #define TRSR 0x1e00 /* 8bit */ |
| 497 | #define TRCR 0x1e10 /* 64bit */ |
| 498 | #define TWDR 0x1e18 /* 64bit */ |
| 499 | |
| 500 | #define IOTR0 0x1e80 /* 64bit */ |
| 501 | #define IOTR1 0x1e88 /* 64bit */ |
| 502 | #define IOTR2 0x1e90 /* 64bit */ |
| 503 | #define IOTR3 0x1e98 /* 64bit */ |
| 504 | |
| 505 | #define TCTL 0x3000 /* 8bit */ |
| 506 | |
| 507 | #define NOINT 0 |
| 508 | #define INTA 1 |
| 509 | #define INTB 2 |
| 510 | #define INTC 3 |
| 511 | #define INTD 4 |
| 512 | |
| 513 | #define DIR_IDR 12 /* Interrupt D Pin Offset */ |
| 514 | #define DIR_ICR 8 /* Interrupt C Pin Offset */ |
| 515 | #define DIR_IBR 4 /* Interrupt B Pin Offset */ |
| 516 | #define DIR_IAR 0 /* Interrupt A Pin Offset */ |
| 517 | |
| 518 | #define PIRQA 0 |
| 519 | #define PIRQB 1 |
| 520 | #define PIRQC 2 |
| 521 | #define PIRQD 3 |
| 522 | #define PIRQE 4 |
| 523 | #define PIRQF 5 |
| 524 | #define PIRQG 6 |
| 525 | #define PIRQH 7 |
| 526 | |
| 527 | /* IO Buffer Programming */ |
| 528 | #define IOBPIRI 0x2330 |
| 529 | #define IOBPD 0x2334 |
| 530 | #define IOBPS 0x2338 |
Duncan Laurie | 7302d1e | 2013-01-10 13:19:23 -0800 | [diff] [blame] | 531 | #define IOBPS_READY 0x0001 |
| 532 | #define IOBPS_TX_MASK 0x0006 |
| 533 | #define IOBPS_MASK 0xff00 |
| 534 | #define IOBPS_READ 0x0600 |
| 535 | #define IOBPS_WRITE 0x0700 |
| 536 | #define IOBPU 0x233a |
| 537 | #define IOBPU_MAGIC 0xf000 |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 538 | |
| 539 | #define D31IP 0x3100 /* 32bit */ |
| 540 | #define D31IP_TTIP 24 /* Thermal Throttle Pin */ |
| 541 | #define D31IP_SIP2 20 /* SATA Pin 2 */ |
| 542 | #define D31IP_SMIP 12 /* SMBUS Pin */ |
| 543 | #define D31IP_SIP 8 /* SATA Pin */ |
| 544 | #define D30IP 0x3104 /* 32bit */ |
| 545 | #define D30IP_PIP 0 /* PCI Bridge Pin */ |
| 546 | #define D29IP 0x3108 /* 32bit */ |
| 547 | #define D29IP_E1P 0 /* EHCI #1 Pin */ |
| 548 | #define D28IP 0x310c /* 32bit */ |
| 549 | #define D28IP_P8IP 28 /* PCI Express Port 8 */ |
| 550 | #define D28IP_P7IP 24 /* PCI Express Port 7 */ |
| 551 | #define D28IP_P6IP 20 /* PCI Express Port 6 */ |
| 552 | #define D28IP_P5IP 16 /* PCI Express Port 5 */ |
| 553 | #define D28IP_P4IP 12 /* PCI Express Port 4 */ |
| 554 | #define D28IP_P3IP 8 /* PCI Express Port 3 */ |
| 555 | #define D28IP_P2IP 4 /* PCI Express Port 2 */ |
| 556 | #define D28IP_P1IP 0 /* PCI Express Port 1 */ |
| 557 | #define D27IP 0x3110 /* 32bit */ |
| 558 | #define D27IP_ZIP 0 /* HD Audio Pin */ |
| 559 | #define D26IP 0x3114 /* 32bit */ |
| 560 | #define D26IP_E2P 0 /* EHCI #2 Pin */ |
| 561 | #define D25IP 0x3118 /* 32bit */ |
| 562 | #define D25IP_LIP 0 /* GbE LAN Pin */ |
| 563 | #define D22IP 0x3124 /* 32bit */ |
| 564 | #define D22IP_KTIP 12 /* KT Pin */ |
| 565 | #define D22IP_IDERIP 8 /* IDE-R Pin */ |
| 566 | #define D22IP_MEI2IP 4 /* MEI #2 Pin */ |
| 567 | #define D22IP_MEI1IP 0 /* MEI #1 Pin */ |
Duncan Laurie | 26e7dd7 | 2012-12-19 09:12:31 -0800 | [diff] [blame] | 568 | #define D20IP 0x3128 /* 32bit */ |
| 569 | #define D20IP_XHCI 0 /* XHCI Pin */ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 570 | #define D31IR 0x3140 /* 16bit */ |
| 571 | #define D30IR 0x3142 /* 16bit */ |
| 572 | #define D29IR 0x3144 /* 16bit */ |
| 573 | #define D28IR 0x3146 /* 16bit */ |
| 574 | #define D27IR 0x3148 /* 16bit */ |
| 575 | #define D26IR 0x314c /* 16bit */ |
| 576 | #define D25IR 0x3150 /* 16bit */ |
Duncan Laurie | 26e7dd7 | 2012-12-19 09:12:31 -0800 | [diff] [blame] | 577 | #define D23IR 0x3158 /* 16bit */ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 578 | #define D22IR 0x315c /* 16bit */ |
Duncan Laurie | 26e7dd7 | 2012-12-19 09:12:31 -0800 | [diff] [blame] | 579 | #define D20IR 0x3160 /* 16bit */ |
| 580 | #define D21IR 0x3164 /* 16bit */ |
| 581 | #define D19IR 0x3168 /* 16bit */ |
Duncan Laurie | b39ba2e | 2013-03-22 11:21:14 -0700 | [diff] [blame] | 582 | #define ACPIIRQEN 0x31e0 /* 32bit */ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 583 | #define OIC 0x31fe /* 16bit */ |
Duncan Laurie | e1e87e0 | 2013-04-26 10:35:19 -0700 | [diff] [blame] | 584 | #define PMSYNC_CONFIG 0x33c4 /* 32bit */ |
| 585 | #define PMSYNC_CONFIG2 0x33cc /* 32bit */ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 586 | #define SOFT_RESET_CTRL 0x38f4 |
| 587 | #define SOFT_RESET_DATA 0x38f8 |
| 588 | |
Aaron Durbin | 239c2e8 | 2012-12-19 11:31:17 -0600 | [diff] [blame] | 589 | #define DIR_ROUTE(a,b,c,d) \ |
| 590 | (((d) << DIR_IDR) | ((c) << DIR_ICR) | \ |
| 591 | ((b) << DIR_IBR) | ((a) << DIR_IAR)) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 592 | |
| 593 | #define RC 0x3400 /* 32bit */ |
| 594 | #define HPTC 0x3404 /* 32bit */ |
| 595 | #define GCS 0x3410 /* 32bit */ |
| 596 | #define BUC 0x3414 /* 32bit */ |
| 597 | #define PCH_DISABLE_GBE (1 << 5) |
| 598 | #define FD 0x3418 /* 32bit */ |
| 599 | #define DISPBDF 0x3424 /* 16bit */ |
| 600 | #define FD2 0x3428 /* 32bit */ |
| 601 | #define CG 0x341c /* 32bit */ |
| 602 | |
| 603 | /* Function Disable 1 RCBA 0x3418 */ |
Duncan Laurie | 26e7dd7 | 2012-12-19 09:12:31 -0800 | [diff] [blame] | 604 | #define PCH_DISABLE_ALWAYS (1 << 0) |
| 605 | #define PCH_DISABLE_ADSPD (1 << 1) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 606 | #define PCH_DISABLE_SATA1 (1 << 2) |
| 607 | #define PCH_DISABLE_SMBUS (1 << 3) |
| 608 | #define PCH_DISABLE_HD_AUDIO (1 << 4) |
| 609 | #define PCH_DISABLE_EHCI2 (1 << 13) |
| 610 | #define PCH_DISABLE_LPC (1 << 14) |
| 611 | #define PCH_DISABLE_EHCI1 (1 << 15) |
| 612 | #define PCH_DISABLE_PCIE(x) (1 << (16 + x)) |
| 613 | #define PCH_DISABLE_THERMAL (1 << 24) |
| 614 | #define PCH_DISABLE_SATA2 (1 << 25) |
Duncan Laurie | 26e7dd7 | 2012-12-19 09:12:31 -0800 | [diff] [blame] | 615 | #define PCH_DISABLE_XHCI (1 << 27) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 616 | |
| 617 | /* Function Disable 2 RCBA 0x3428 */ |
| 618 | #define PCH_DISABLE_KT (1 << 4) |
| 619 | #define PCH_DISABLE_IDER (1 << 3) |
| 620 | #define PCH_DISABLE_MEI2 (1 << 2) |
| 621 | #define PCH_DISABLE_MEI1 (1 << 1) |
| 622 | #define PCH_ENABLE_DBDF (1 << 0) |
| 623 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 624 | /* ICH7 PMBASE */ |
| 625 | #define PM1_STS 0x00 |
| 626 | #define WAK_STS (1 << 15) |
| 627 | #define PCIEXPWAK_STS (1 << 14) |
| 628 | #define PRBTNOR_STS (1 << 11) |
| 629 | #define RTC_STS (1 << 10) |
| 630 | #define PWRBTN_STS (1 << 8) |
| 631 | #define GBL_STS (1 << 5) |
| 632 | #define BM_STS (1 << 4) |
| 633 | #define TMROF_STS (1 << 0) |
| 634 | #define PM1_EN 0x02 |
| 635 | #define PCIEXPWAK_DIS (1 << 14) |
| 636 | #define RTC_EN (1 << 10) |
| 637 | #define PWRBTN_EN (1 << 8) |
| 638 | #define GBL_EN (1 << 5) |
| 639 | #define TMROF_EN (1 << 0) |
| 640 | #define PM1_CNT 0x04 |
| 641 | #define SLP_EN (1 << 13) |
| 642 | #define SLP_TYP (7 << 10) |
| 643 | #define SLP_TYP_S0 0 |
| 644 | #define SLP_TYP_S1 1 |
| 645 | #define SLP_TYP_S3 5 |
| 646 | #define SLP_TYP_S4 6 |
| 647 | #define SLP_TYP_S5 7 |
| 648 | #define GBL_RLS (1 << 2) |
| 649 | #define BM_RLD (1 << 1) |
| 650 | #define SCI_EN (1 << 0) |
| 651 | #define PM1_TMR 0x08 |
| 652 | #define PROC_CNT 0x10 |
| 653 | #define LV2 0x14 |
| 654 | #define LV3 0x15 |
| 655 | #define LV4 0x16 |
| 656 | #define PM2_CNT 0x50 // mobile only |
| 657 | #define GPE0_STS 0x20 |
| 658 | #define PME_B0_STS (1 << 13) |
| 659 | #define PME_STS (1 << 11) |
| 660 | #define BATLOW_STS (1 << 10) |
| 661 | #define PCI_EXP_STS (1 << 9) |
| 662 | #define RI_STS (1 << 8) |
| 663 | #define SMB_WAK_STS (1 << 7) |
| 664 | #define TCOSCI_STS (1 << 6) |
| 665 | #define SWGPE_STS (1 << 2) |
| 666 | #define HOT_PLUG_STS (1 << 1) |
Duncan Laurie | 55cdf55 | 2013-03-08 16:01:44 -0800 | [diff] [blame] | 667 | #define GPE0_STS_2 0x24 |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 668 | #define GPE0_EN 0x28 |
| 669 | #define PME_B0_EN (1 << 13) |
| 670 | #define PME_EN (1 << 11) |
| 671 | #define TCOSCI_EN (1 << 6) |
Duncan Laurie | 55cdf55 | 2013-03-08 16:01:44 -0800 | [diff] [blame] | 672 | #define GPE0_EN_2 0x2c |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 673 | #define SMI_EN 0x30 |
| 674 | #define INTEL_USB2_EN (1 << 18) // Intel-Specific USB2 SMI logic |
| 675 | #define LEGACY_USB2_EN (1 << 17) // Legacy USB2 SMI logic |
| 676 | #define PERIODIC_EN (1 << 14) // SMI on PERIODIC_STS in SMI_STS |
| 677 | #define TCO_EN (1 << 13) // Enable TCO Logic (BIOSWE et al) |
| 678 | #define MCSMI_EN (1 << 11) // Trap microcontroller range access |
| 679 | #define BIOS_RLS (1 << 7) // asserts SCI on bit set |
| 680 | #define SWSMI_TMR_EN (1 << 6) // start software smi timer on bit set |
| 681 | #define APMC_EN (1 << 5) // Writes to APM_CNT cause SMI# |
| 682 | #define SLP_SMI_EN (1 << 4) // Write to SLP_EN in PM1_CNT asserts SMI# |
| 683 | #define LEGACY_USB_EN (1 << 3) // Legacy USB circuit SMI logic |
| 684 | #define BIOS_EN (1 << 2) // Assert SMI# on setting GBL_RLS bit |
| 685 | #define EOS (1 << 1) // End of SMI (deassert SMI#) |
| 686 | #define GBL_SMI_EN (1 << 0) // SMI# generation at all? |
| 687 | #define SMI_STS 0x34 |
| 688 | #define ALT_GP_SMI_EN 0x38 |
| 689 | #define ALT_GP_SMI_STS 0x3a |
| 690 | #define GPE_CNTL 0x42 |
| 691 | #define DEVACT_STS 0x44 |
| 692 | #define SS_CNT 0x50 |
| 693 | #define C3_RES 0x54 |
| 694 | #define TCO1_STS 0x64 |
| 695 | #define DMISCI_STS (1 << 9) |
| 696 | #define TCO2_STS 0x66 |
Duncan Laurie | 55cdf55 | 2013-03-08 16:01:44 -0800 | [diff] [blame] | 697 | #define ALT_GP_SMI_EN2 0x5c |
| 698 | #define ALT_GP_SMI_STS2 0x5e |
| 699 | |
| 700 | /* Lynxpoint LP */ |
| 701 | #define LP_GPE0_STS_1 0x80 /* GPIO 0-31 */ |
| 702 | #define LP_GPE0_STS_2 0x84 /* GPIO 32-63 */ |
| 703 | #define LP_GPE0_STS_3 0x88 /* GPIO 64-94 */ |
| 704 | #define LP_GPE0_STS_4 0x8c /* Standard GPE */ |
| 705 | #define LP_GPE0_EN_1 0x90 |
| 706 | #define LP_GPE0_EN_2 0x94 |
| 707 | #define LP_GPE0_EN_3 0x98 |
| 708 | #define LP_GPE0_EN_4 0x9c |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 709 | |
| 710 | /* |
| 711 | * SPI Opcode Menu setup for SPIBAR lockdown |
| 712 | * should support most common flash chips. |
| 713 | */ |
| 714 | |
| 715 | #define SPIBAR_OFFSET 0x3800 |
| 716 | #define SPIBAR8(x) RCBA8(x + SPIBAR_OFFSET) |
| 717 | #define SPIBAR16(x) RCBA16(x + SPIBAR_OFFSET) |
| 718 | #define SPIBAR32(x) RCBA32(x + SPIBAR_OFFSET) |
| 719 | |
| 720 | /* Reigsters within the SPIBAR */ |
| 721 | #define SSFC 0x91 |
| 722 | #define FDOC 0xb0 |
| 723 | #define FDOD 0xb4 |
| 724 | |
| 725 | #define SPI_OPMENU_0 0x01 /* WRSR: Write Status Register */ |
| 726 | #define SPI_OPTYPE_0 0x01 /* Write, no address */ |
| 727 | |
| 728 | #define SPI_OPMENU_1 0x02 /* BYPR: Byte Program */ |
| 729 | #define SPI_OPTYPE_1 0x03 /* Write, address required */ |
| 730 | |
| 731 | #define SPI_OPMENU_2 0x03 /* READ: Read Data */ |
| 732 | #define SPI_OPTYPE_2 0x02 /* Read, address required */ |
| 733 | |
| 734 | #define SPI_OPMENU_3 0x05 /* RDSR: Read Status Register */ |
| 735 | #define SPI_OPTYPE_3 0x00 /* Read, no address */ |
| 736 | |
| 737 | #define SPI_OPMENU_4 0x20 /* SE20: Sector Erase 0x20 */ |
| 738 | #define SPI_OPTYPE_4 0x03 /* Write, address required */ |
| 739 | |
| 740 | #define SPI_OPMENU_5 0x9f /* RDID: Read ID */ |
| 741 | #define SPI_OPTYPE_5 0x00 /* Read, no address */ |
| 742 | |
| 743 | #define SPI_OPMENU_6 0xd8 /* BED8: Block Erase 0xd8 */ |
| 744 | #define SPI_OPTYPE_6 0x03 /* Write, address required */ |
| 745 | |
| 746 | #define SPI_OPMENU_7 0x0b /* FAST: Fast Read */ |
| 747 | #define SPI_OPTYPE_7 0x02 /* Read, address required */ |
| 748 | |
| 749 | #define SPI_OPMENU_UPPER ((SPI_OPMENU_7 << 24) | (SPI_OPMENU_6 << 16) | \ |
| 750 | (SPI_OPMENU_5 << 8) | SPI_OPMENU_4) |
| 751 | #define SPI_OPMENU_LOWER ((SPI_OPMENU_3 << 24) | (SPI_OPMENU_2 << 16) | \ |
| 752 | (SPI_OPMENU_1 << 8) | SPI_OPMENU_0) |
| 753 | |
| 754 | #define SPI_OPTYPE ((SPI_OPTYPE_7 << 14) | (SPI_OPTYPE_6 << 12) | \ |
| 755 | (SPI_OPTYPE_5 << 10) | (SPI_OPTYPE_4 << 8) | \ |
| 756 | (SPI_OPTYPE_3 << 6) | (SPI_OPTYPE_2 << 4) | \ |
| 757 | (SPI_OPTYPE_1 << 2) | (SPI_OPTYPE_0)) |
| 758 | |
| 759 | #define SPI_OPPREFIX ((0x50 << 8) | 0x06) /* EWSR and WREN */ |
| 760 | |
| 761 | #define SPIBAR_HSFS 0x3804 /* SPI hardware sequence status */ |
| 762 | #define SPIBAR_HSFS_SCIP (1 << 5) /* SPI Cycle In Progress */ |
| 763 | #define SPIBAR_HSFS_AEL (1 << 2) /* SPI Access Error Log */ |
| 764 | #define SPIBAR_HSFS_FCERR (1 << 1) /* SPI Flash Cycle Error */ |
| 765 | #define SPIBAR_HSFS_FDONE (1 << 0) /* SPI Flash Cycle Done */ |
| 766 | #define SPIBAR_HSFC 0x3806 /* SPI hardware sequence control */ |
| 767 | #define SPIBAR_HSFC_BYTE_COUNT(c) (((c - 1) & 0x3f) << 8) |
| 768 | #define SPIBAR_HSFC_CYCLE_READ (0 << 1) /* Read cycle */ |
| 769 | #define SPIBAR_HSFC_CYCLE_WRITE (2 << 1) /* Write cycle */ |
| 770 | #define SPIBAR_HSFC_CYCLE_ERASE (3 << 1) /* Erase cycle */ |
| 771 | #define SPIBAR_HSFC_GO (1 << 0) /* GO: start SPI transaction */ |
| 772 | #define SPIBAR_FADDR 0x3808 /* SPI flash address */ |
| 773 | #define SPIBAR_FDATA(n) (0x3810 + (4 * n)) /* SPI flash data */ |
| 774 | |
| 775 | #endif /* __ACPI__ */ |
| 776 | #endif /* SOUTHBRIDGE_INTEL_LYNXPOINT_PCH_H */ |