blob: 2664c65ea76455144b9c92cd7d60d9b2fa3a1d4c [file] [log] [blame]
Vladimir Serbinenko888d5592013-11-13 17:53:38 +01001/*
2 * This file is part of the coreboot project.
3 *
Vladimir Serbinenko888d5592013-11-13 17:53:38 +01004 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; version 2 of
8 * the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
Vladimir Serbinenko888d5592013-11-13 17:53:38 +010014 */
15
16#include <console/console.h>
17#include <device/device.h>
18#include <device/pci.h>
19#include <device/pci_ids.h>
20#include "pch.h"
Kyösti Mälkki13f66502019-03-03 08:01:05 +020021#include <device/mmio.h>
Vladimir Serbinenko888d5592013-11-13 17:53:38 +010022
23static void thermal_init(struct device *dev)
24{
25 struct resource *res;
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -080026 u8 *base;
Vladimir Serbinenko888d5592013-11-13 17:53:38 +010027 printk(BIOS_DEBUG, "Thermal init start.\n");
28
29 res = find_resource(dev, 0x10);
30 if (!res)
31 return;
32
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -080033 base = res2mmio(res, 0, 0);
34 write32(base + 4, 0x3a2b);
35 write8(base + 0xe, 0x40);
36 write16(base + 0x56, 0xffff);
37 write16(base + 0x64, 0xffff);
38 write16(base + 0x66, 0xffff);
39 write16(base + 0x68, 0xfa);
Vladimir Serbinenko888d5592013-11-13 17:53:38 +010040
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -080041 write8(base + 1, 0xb8);
Vladimir Serbinenko888d5592013-11-13 17:53:38 +010042
43 printk(BIOS_DEBUG, "Thermal init done.\n");
44}
45
Vladimir Serbinenko888d5592013-11-13 17:53:38 +010046static struct pci_operations pci_ops = {
Subrata Banik4a0f0712019-03-20 14:29:47 +053047 .set_subsystem = pci_dev_set_subsystem,
Vladimir Serbinenko888d5592013-11-13 17:53:38 +010048};
49
50static struct device_operations thermal_ops = {
51 .read_resources = pci_dev_read_resources,
52 .set_resources = pci_dev_set_resources,
53 .enable_resources = pci_dev_enable_resources,
54 .init = thermal_init,
55 .scan_bus = 0,
56 .ops_pci = &pci_ops,
57};
58
Felix Singer838fbc72019-11-21 21:23:32 +010059static const unsigned short pci_device_ids[] = {
60 PCI_DID_INTEL_IBEXPEAK_THERMAL,
61 0
62};
Vladimir Serbinenko888d5592013-11-13 17:53:38 +010063
64static const struct pci_driver pch_thermal __pci_driver = {
65 .ops = &thermal_ops,
66 .vendor = PCI_VENDOR_ID_INTEL,
67 .devices = pci_device_ids,
68};