blob: 2ed7aa3f45aad24a45f23f9c7c4774d924472f27 [file] [log] [blame]
Kyösti Mälkki8e679f72022-11-14 10:05:06 +02001/* SPDX-License-Identifier: GPL-2.0-only */
2
3#include <device/smbus_host.h>
4#include <device/pci_ops.h>
5#include "i82801dx.h"
6
7void i82801dx_early_init(void)
8{
9 const pci_devfn_t dev = PCI_DEV(0, 0x1f, 0);
10
11 /* Enable ACPI I/O range decode and ACPI power management. */
12 pci_write_config32(dev, PMBASE, DEFAULT_PMBASE | 1);
13 pci_write_config8(dev, ACPI_CNTL, ACPI_EN);
14
15 pci_write_config32(dev, GPIO_BASE, GPIOBASE_ADDR | 1);
16 pci_write_config8(dev, GPIO_CNTL, 0x10);
17
18 if (ENV_RAMINIT)
19 enable_smbus();
20}
21
22void i82801dx_lpc_setup(void)
23{
24 const pci_devfn_t dev = PCI_DEV(0, 0x1f, 0);
25
26 /* Decode 0x3F8-0x3FF (COM1) for COMA port, 0x2F8-0x2FF (COM2) for COMB.
27 * LPT decode defaults to 0x378-0x37F and 0x778-0x77F.
28 * Floppy decode defaults to 0x3F0-0x3F5, 0x3F7.
29 * We also need to set the value for LPC I/F Enables Register.
30 */
31 pci_write_config8(dev, COM_DEC, 0x10);
32 pci_write_config16(dev, LPC_EN, 0x300F);
33}