Angel Pons | 182dbde | 2020-04-02 23:49:05 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Vladimir Serbinenko | 888d559 | 2013-11-13 17:53:38 +0100 | [diff] [blame] | 2 | |
| 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älkki | 13f6650 | 2019-03-03 08:01:05 +0200 | [diff] [blame] | 8 | #include <device/mmio.h> |
Vladimir Serbinenko | 888d559 | 2013-11-13 17:53:38 +0100 | [diff] [blame] | 9 | |
| 10 | static void thermal_init(struct device *dev) |
| 11 | { |
| 12 | struct resource *res; |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 13 | u8 *base; |
Vladimir Serbinenko | 888d559 | 2013-11-13 17:53:38 +0100 | [diff] [blame] | 14 | printk(BIOS_DEBUG, "Thermal init start.\n"); |
| 15 | |
| 16 | res = find_resource(dev, 0x10); |
| 17 | if (!res) |
| 18 | return; |
| 19 | |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 20 | 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 Serbinenko | 888d559 | 2013-11-13 17:53:38 +0100 | [diff] [blame] | 27 | |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 28 | write8(base + 1, 0xb8); |
Vladimir Serbinenko | 888d559 | 2013-11-13 17:53:38 +0100 | [diff] [blame] | 29 | |
| 30 | printk(BIOS_DEBUG, "Thermal init done.\n"); |
| 31 | } |
| 32 | |
Vladimir Serbinenko | 888d559 | 2013-11-13 17:53:38 +0100 | [diff] [blame] | 33 | static struct pci_operations pci_ops = { |
Subrata Banik | 4a0f071 | 2019-03-20 14:29:47 +0530 | [diff] [blame] | 34 | .set_subsystem = pci_dev_set_subsystem, |
Vladimir Serbinenko | 888d559 | 2013-11-13 17:53:38 +0100 | [diff] [blame] | 35 | }; |
| 36 | |
| 37 | static 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 Serbinenko | 888d559 | 2013-11-13 17:53:38 +0100 | [diff] [blame] | 42 | .ops_pci = &pci_ops, |
| 43 | }; |
| 44 | |
Vladimir Serbinenko | 888d559 | 2013-11-13 17:53:38 +0100 | [diff] [blame] | 45 | static const struct pci_driver pch_thermal __pci_driver = { |
| 46 | .ops = &thermal_ops, |
| 47 | .vendor = PCI_VENDOR_ID_INTEL, |
Felix Singer | ef6ecee | 2020-03-06 02:11:53 +0100 | [diff] [blame] | 48 | .device = PCI_DID_INTEL_IBEXPEAK_THERMAL, |
Vladimir Serbinenko | 888d559 | 2013-11-13 17:53:38 +0100 | [diff] [blame] | 49 | }; |