1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <console/console.h>
4 #include <device/pci_ops.h>
5 #include <device/device.h>
6 #include <device/pci.h>
10 #ifdef __SIMPLE_DEVICE__
11 static pci_devfn_t
pch_get_lpc_device(void)
13 return PCI_DEV(0, 0x1f, 0);
16 static struct device
*pch_get_lpc_device(void)
18 return pcidev_on_root(0x1f, 0);
22 int pch_silicon_revision(void)
24 static int pch_revision_id
= -1;
26 if (pch_revision_id
< 0)
27 pch_revision_id
= pci_read_config8(pch_get_lpc_device(),
29 return pch_revision_id
;
32 int pch_silicon_id(void)
34 static int pch_id
= -1;
37 pch_id
= pci_read_config16(pch_get_lpc_device(), PCI_DEVICE_ID
);
42 enum pch_platform_type
get_pch_platform_type(void)
44 const u16 did
= pci_read_config16(pch_get_lpc_device(), PCI_DEVICE_ID
);
46 /* Check if this is a LPT-LP or WPT-LP device ID */
47 if ((did
& 0xff00) == 0x9c00)
50 /* Non-LP laptop SKUs have an odd device ID (least significant bit is one) */
52 return PCH_TYPE_MOBILE
;
54 /* Desktop and Server SKUs have an even device ID */
55 return PCH_TYPE_DESKTOP
;
63 pmbase
= pci_read_config16(pch_get_lpc_device(),
68 u16
get_gpiobase(void)
73 gpiobase
= pci_read_config16(pch_get_lpc_device(),
78 #ifndef __SIMPLE_DEVICE__
80 /* Put device in D3Hot Power State */
81 static void pch_enable_d3hot(struct device
*dev
)
83 pci_or_config32(dev
, PCH_PCS
, PCH_PCS_PS_D3HOT
);
86 /* Set bit in function disable register to hide this device */
87 void pch_disable_devfn(struct device
*dev
)
89 switch (dev
->path
.pci
.devfn
) {
90 case PCI_DEVFN(19, 0): /* Audio DSP */
91 RCBA32_OR(FD
, PCH_DISABLE_ADSPD
);
93 case PCI_DEVFN(20, 0): /* XHCI */
94 RCBA32_OR(FD
, PCH_DISABLE_XHCI
);
96 case PCI_DEVFN(21, 0): /* DMA */
97 pch_enable_d3hot(dev
);
98 pch_iobp_update(SIO_IOBP_FUNCDIS0
, ~0, SIO_IOBP_FUNCDIS_DIS
);
100 case PCI_DEVFN(21, 1): /* I2C0 */
101 pch_enable_d3hot(dev
);
102 pch_iobp_update(SIO_IOBP_FUNCDIS1
, ~0, SIO_IOBP_FUNCDIS_DIS
);
104 case PCI_DEVFN(21, 2): /* I2C1 */
105 pch_enable_d3hot(dev
);
106 pch_iobp_update(SIO_IOBP_FUNCDIS2
, ~0, SIO_IOBP_FUNCDIS_DIS
);
108 case PCI_DEVFN(21, 3): /* SPI0 */
109 pch_enable_d3hot(dev
);
110 pch_iobp_update(SIO_IOBP_FUNCDIS3
, ~0, SIO_IOBP_FUNCDIS_DIS
);
112 case PCI_DEVFN(21, 4): /* SPI1 */
113 pch_enable_d3hot(dev
);
114 pch_iobp_update(SIO_IOBP_FUNCDIS4
, ~0, SIO_IOBP_FUNCDIS_DIS
);
116 case PCI_DEVFN(21, 5): /* UART0 */
117 pch_enable_d3hot(dev
);
118 pch_iobp_update(SIO_IOBP_FUNCDIS5
, ~0, SIO_IOBP_FUNCDIS_DIS
);
120 case PCI_DEVFN(21, 6): /* UART1 */
121 pch_enable_d3hot(dev
);
122 pch_iobp_update(SIO_IOBP_FUNCDIS6
, ~0, SIO_IOBP_FUNCDIS_DIS
);
124 case PCI_DEVFN(22, 0): /* MEI #1 */
125 RCBA32_OR(FD2
, PCH_DISABLE_MEI1
);
127 case PCI_DEVFN(22, 1): /* MEI #2 */
128 RCBA32_OR(FD2
, PCH_DISABLE_MEI2
);
130 case PCI_DEVFN(22, 2): /* IDE-R */
131 RCBA32_OR(FD2
, PCH_DISABLE_IDER
);
133 case PCI_DEVFN(22, 3): /* KT */
134 RCBA32_OR(FD2
, PCH_DISABLE_KT
);
136 case PCI_DEVFN(23, 0): /* SDIO */
137 pch_enable_d3hot(dev
);
138 pch_iobp_update(SIO_IOBP_FUNCDIS7
, ~0, SIO_IOBP_FUNCDIS_DIS
);
140 case PCI_DEVFN(25, 0): /* Gigabit Ethernet */
141 RCBA32_OR(BUC
, PCH_DISABLE_GBE
);
143 case PCI_DEVFN(26, 0): /* EHCI #2 */
144 RCBA32_OR(FD
, PCH_DISABLE_EHCI2
);
146 case PCI_DEVFN(27, 0): /* HD Audio Controller */
147 RCBA32_OR(FD
, PCH_DISABLE_HD_AUDIO
);
149 case PCI_DEVFN(28, 0): /* PCI Express Root Port 1 */
150 case PCI_DEVFN(28, 1): /* PCI Express Root Port 2 */
151 case PCI_DEVFN(28, 2): /* PCI Express Root Port 3 */
152 case PCI_DEVFN(28, 3): /* PCI Express Root Port 4 */
153 case PCI_DEVFN(28, 4): /* PCI Express Root Port 5 */
154 case PCI_DEVFN(28, 5): /* PCI Express Root Port 6 */
155 case PCI_DEVFN(28, 6): /* PCI Express Root Port 7 */
156 case PCI_DEVFN(28, 7): /* PCI Express Root Port 8 */
157 RCBA32_OR(FD
, PCH_DISABLE_PCIE(PCI_FUNC(dev
->path
.pci
.devfn
)));
159 case PCI_DEVFN(29, 0): /* EHCI #1 */
160 RCBA32_OR(FD
, PCH_DISABLE_EHCI1
);
162 case PCI_DEVFN(31, 0): /* LPC */
163 RCBA32_OR(FD
, PCH_DISABLE_LPC
);
165 case PCI_DEVFN(31, 2): /* SATA #1 */
166 RCBA32_OR(FD
, PCH_DISABLE_SATA1
);
168 case PCI_DEVFN(31, 3): /* SMBUS */
169 RCBA32_OR(FD
, PCH_DISABLE_SMBUS
);
171 case PCI_DEVFN(31, 5): /* SATA #2 */
172 RCBA32_OR(FD
, PCH_DISABLE_SATA2
);
174 case PCI_DEVFN(31, 6): /* Thermal Subsystem */
175 RCBA32_OR(FD
, PCH_DISABLE_THERMAL
);
180 void pch_enable(struct device
*dev
)
182 /* PCH PCIe Root Ports are handled in PCIe driver. */
183 if (PCI_SLOT(dev
->path
.pci
.devfn
) == PCH_PCIE_DEV_SLOT
)
187 printk(BIOS_DEBUG
, "%s: Disabling device\n", dev_path(dev
));
189 /* Ensure memory, io, and bus master are all disabled */
190 pci_and_config16(dev
, PCI_COMMAND
,
191 ~(PCI_COMMAND_MASTER
| PCI_COMMAND_MEMORY
| PCI_COMMAND_IO
));
193 /* Disable this device if possible */
194 pch_disable_devfn(dev
);
197 pci_or_config16(dev
, PCI_COMMAND
, PCI_COMMAND_SERR
);
201 struct chip_operations southbridge_intel_lynxpoint_ops
= {
202 CHIP_NAME("Intel Series 8 (Lynx Point) Southbridge")
203 .enable_dev
= pch_enable
,
206 #endif /* __SIMPLE_DEVICE__ */