2020-04-02 23:49:05 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
|
|
/* This file is part of the coreboot project. */
|
2008-10-29 05:46:52 +01:00
|
|
|
|
|
|
|
#include <device/device.h>
|
|
|
|
#include <device/pci.h>
|
2019-09-21 17:35:37 +02:00
|
|
|
#include <device/pci_def.h>
|
2019-03-01 12:43:02 +01:00
|
|
|
#include <device/pci_ops.h>
|
2008-10-29 05:46:52 +01:00
|
|
|
#include <device/pci_ids.h>
|
2010-02-22 07:09:43 +01:00
|
|
|
#include "i82801gx.h"
|
2008-10-29 05:46:52 +01:00
|
|
|
|
|
|
|
static void pci_init(struct device *dev)
|
|
|
|
{
|
|
|
|
u16 reg16;
|
2009-03-11 15:54:18 +01:00
|
|
|
u8 reg8;
|
2008-10-29 05:46:52 +01:00
|
|
|
|
2009-03-11 15:54:18 +01:00
|
|
|
/* Enable Bus Master */
|
|
|
|
reg16 = pci_read_config16(dev, PCI_COMMAND);
|
|
|
|
reg16 |= PCI_COMMAND_MASTER;
|
|
|
|
pci_write_config16(dev, PCI_COMMAND, reg16);
|
|
|
|
|
|
|
|
/* This device has no interrupt */
|
2010-02-22 07:09:43 +01:00
|
|
|
pci_write_config8(dev, INTR, 0xff);
|
2008-10-29 05:46:52 +01:00
|
|
|
|
2009-03-11 15:54:18 +01:00
|
|
|
/* disable parity error response and SERR */
|
2019-09-21 17:35:37 +02:00
|
|
|
reg16 = pci_read_config16(dev, PCI_BRIDGE_CONTROL);
|
|
|
|
reg16 &= ~PCI_BRIDGE_CTL_PARITY;
|
|
|
|
reg16 &= ~PCI_BRIDGE_CTL_SERR;
|
|
|
|
pci_write_config16(dev, PCI_BRIDGE_CONTROL, reg16);
|
2008-10-29 05:46:52 +01:00
|
|
|
|
2009-03-11 15:54:18 +01:00
|
|
|
/* Master Latency Count must be set to 0x04! */
|
2010-02-22 07:09:43 +01:00
|
|
|
reg8 = pci_read_config8(dev, SMLT);
|
2009-03-11 15:54:18 +01:00
|
|
|
reg8 &= 0x07;
|
|
|
|
reg8 |= (0x04 << 3);
|
2010-02-22 07:09:43 +01:00
|
|
|
pci_write_config8(dev, SMLT, reg8);
|
2009-03-11 15:54:18 +01:00
|
|
|
|
2008-10-29 05:46:52 +01:00
|
|
|
/* Clear errors in status registers */
|
2010-02-22 07:09:43 +01:00
|
|
|
reg16 = pci_read_config16(dev, PSTS);
|
2009-03-11 15:54:18 +01:00
|
|
|
//reg16 |= 0xf900;
|
2010-02-22 07:09:43 +01:00
|
|
|
pci_write_config16(dev, PSTS, reg16);
|
2008-10-29 05:46:52 +01:00
|
|
|
|
2010-02-22 07:09:43 +01:00
|
|
|
reg16 = pci_read_config16(dev, SECSTS);
|
2009-03-11 15:54:18 +01:00
|
|
|
// reg16 |= 0xf900;
|
2010-02-22 07:09:43 +01:00
|
|
|
pci_write_config16(dev, SECSTS, reg16);
|
2008-10-29 05:46:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct pci_operations pci_ops = {
|
2019-03-20 16:55:27 +01:00
|
|
|
.set_subsystem = pci_dev_set_subsystem,
|
2008-10-29 05:46:52 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct device_operations device_ops = {
|
|
|
|
.read_resources = pci_bus_read_resources,
|
|
|
|
.set_resources = pci_dev_set_resources,
|
2019-09-23 09:01:16 +02:00
|
|
|
.enable_resources = pci_bus_enable_resources,
|
2008-10-29 05:46:52 +01:00
|
|
|
.init = pci_init,
|
|
|
|
.scan_bus = pci_scan_bridge,
|
|
|
|
.ops_pci = &pci_ops,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Desktop */
|
2008-10-29 14:51:31 +01:00
|
|
|
/* 82801BA/CA/DB/EB/ER/FB/FR/FW/FRW/GB/GR/GDH/HB/IB/6300ESB/i3100 */
|
2008-10-29 05:46:52 +01:00
|
|
|
static const struct pci_driver i82801g_pci __pci_driver = {
|
|
|
|
.ops = &device_ops,
|
2008-10-29 14:51:31 +01:00
|
|
|
.vendor = PCI_VENDOR_ID_INTEL,
|
2008-10-31 19:41:09 +01:00
|
|
|
.device = 0x244e,
|
2008-10-29 05:46:52 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Mobile / Ultra Mobile */
|
2008-10-29 14:51:31 +01:00
|
|
|
/* 82801BAM/CAM/DBL/DBM/FBM/GBM/GHM/GU/HBM/HEM */
|
2008-10-29 05:46:52 +01:00
|
|
|
static const struct pci_driver i82801gmu_pci __pci_driver = {
|
|
|
|
.ops = &device_ops,
|
2008-10-29 14:51:31 +01:00
|
|
|
.vendor = PCI_VENDOR_ID_INTEL,
|
2008-10-31 19:41:09 +01:00
|
|
|
.device = 0x2448,
|
2008-10-29 05:46:52 +01:00
|
|
|
};
|