Angel Pons | 2712398 | 2020-04-05 13:22:30 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Nick Vaccaro | 2dd7b6b | 2018-08-09 16:18:02 -0700 | [diff] [blame] | 2 | |
| 3 | #include <baseboard/variants.h> |
| 4 | #include <chip.h> |
| 5 | #include <device/device.h> |
| 6 | #include <device/pci_ids.h> |
| 7 | #include <device/pci_ops.h> |
| 8 | |
| 9 | /* PL2 limit in watts for AML and KBL */ |
| 10 | #define PL2_AML 18 |
| 11 | #define PL2_KBL 15 |
| 12 | |
| 13 | static uint32_t get_pl2(void) |
| 14 | { |
Kyösti Mälkki | 71756c21 | 2019-07-12 13:10:19 +0300 | [diff] [blame] | 15 | struct device *igd_dev = pcidev_path_on_root(SA_DEVFN_IGD); |
Nick Vaccaro | 2dd7b6b | 2018-08-09 16:18:02 -0700 | [diff] [blame] | 16 | uint16_t id; |
Kyösti Mälkki | 71756c21 | 2019-07-12 13:10:19 +0300 | [diff] [blame] | 17 | |
| 18 | id = pci_read_config16(igd_dev, PCI_DEVICE_ID); |
Nick Vaccaro | 2dd7b6b | 2018-08-09 16:18:02 -0700 | [diff] [blame] | 19 | /* Assume we only have KLB-Y and AML-Y SKUs */ |
| 20 | if (id == PCI_DEVICE_ID_INTEL_KBL_GT2_SULXM) |
| 21 | return PL2_KBL; |
| 22 | |
| 23 | return PL2_AML; |
| 24 | } |
| 25 | |
| 26 | /* Override dev tree settings per board */ |
| 27 | void variant_devtree_update(void) |
| 28 | { |
Kyösti Mälkki | d5f645c | 2019-09-28 00:20:27 +0300 | [diff] [blame] | 29 | config_t *cfg = config_of_soc(); |
Nick Vaccaro | 2dd7b6b | 2018-08-09 16:18:02 -0700 | [diff] [blame] | 30 | |
| 31 | /* Update PL2 based on CPU */ |
| 32 | cfg->tdp_pl2_override = get_pl2(); |
| 33 | } |