blob: a1e6b0b49e44fbdbe77cdabdd3e016c0024540a3 [file] [log] [blame]
Angel Pons182dbde2020-04-02 23:49:05 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Vladimir Serbinenko888d5592013-11-13 17:53:38 +01002
3#include <console/console.h>
4#include <device/device.h>
5#include <device/pci.h>
6#include <device/pci_ids.h>
7#include "pch.h"
Kyösti Mälkki13f66502019-03-03 08:01:05 +02008#include <device/mmio.h>
Vladimir Serbinenko888d5592013-11-13 17:53:38 +01009
10static void thermal_init(struct device *dev)
11{
12 struct resource *res;
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -080013 u8 *base;
Vladimir Serbinenko888d5592013-11-13 17:53:38 +010014 printk(BIOS_DEBUG, "Thermal init start.\n");
15
16 res = find_resource(dev, 0x10);
17 if (!res)
18 return;
19
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -080020 base = res2mmio(res, 0, 0);
21 write32(base + 4, 0x3a2b);
22 write8(base + 0xe, 0x40);
23 write16(base + 0x56, 0xffff);
24 write16(base + 0x64, 0xffff);
25 write16(base + 0x66, 0xffff);
26 write16(base + 0x68, 0xfa);
Vladimir Serbinenko888d5592013-11-13 17:53:38 +010027
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -080028 write8(base + 1, 0xb8);
Vladimir Serbinenko888d5592013-11-13 17:53:38 +010029
30 printk(BIOS_DEBUG, "Thermal init done.\n");
31}
32
Vladimir Serbinenko888d5592013-11-13 17:53:38 +010033static struct pci_operations pci_ops = {
Subrata Banik4a0f0712019-03-20 14:29:47 +053034 .set_subsystem = pci_dev_set_subsystem,
Vladimir Serbinenko888d5592013-11-13 17:53:38 +010035};
36
37static struct device_operations thermal_ops = {
38 .read_resources = pci_dev_read_resources,
39 .set_resources = pci_dev_set_resources,
40 .enable_resources = pci_dev_enable_resources,
41 .init = thermal_init,
Vladimir Serbinenko888d5592013-11-13 17:53:38 +010042 .ops_pci = &pci_ops,
43};
44
Vladimir Serbinenko888d5592013-11-13 17:53:38 +010045static const struct pci_driver pch_thermal __pci_driver = {
46 .ops = &thermal_ops,
47 .vendor = PCI_VENDOR_ID_INTEL,
Felix Singeref6ecee2020-03-06 02:11:53 +010048 .device = PCI_DID_INTEL_IBEXPEAK_THERMAL,
Vladimir Serbinenko888d5592013-11-13 17:53:38 +010049};