Angel Pons | ba38f37 | 2020-04-05 15:46:45 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 2 | |
Kyösti Mälkki | 5daa1d3 | 2020-06-14 12:01:58 +0300 | [diff] [blame] | 3 | #include <acpi/acpi_gnvs.h> |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 4 | #include <device/device.h> |
5 | #include <device/pci.h> | ||||
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 6 | #include <soc/iosf.h> |
Kyösti Mälkki | 4abc731 | 2021-01-12 17:46:30 +0200 | [diff] [blame] | 7 | #include <soc/device_nvs.h> |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 8 | #include <soc/ramstage.h> |
9 | |||||
Elyes HAOUAS | b13fac3 | 2018-05-24 22:29:44 +0200 | [diff] [blame] | 10 | void scc_enable_acpi_mode(struct device *dev, int iosf_reg, int nvs_index) |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 11 | { |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 12 | struct resource *bar; |
Kyösti Mälkki | 4abc731 | 2021-01-12 17:46:30 +0200 | [diff] [blame] | 13 | struct device_nvs *dev_nvs = acpi_get_device_nvs(); |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 14 | |
15 | /* Save BAR0 and BAR1 to ACPI NVS */ | ||||
Angel Pons | c1bfbe0 | 2021-11-03 13:18:53 +0100 | [diff] [blame^] | 16 | bar = probe_resource(dev, PCI_BASE_ADDRESS_0); |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 17 | if (bar) |
Kyösti Mälkki | 4abc731 | 2021-01-12 17:46:30 +0200 | [diff] [blame] | 18 | dev_nvs->scc_bar0[nvs_index] = bar->base; |
Angel Pons | c1bfbe0 | 2021-11-03 13:18:53 +0100 | [diff] [blame^] | 19 | bar = probe_resource(dev, PCI_BASE_ADDRESS_2); |
Hannah Williams | ad8669ef | 2017-03-21 22:34:01 -0700 | [diff] [blame] | 20 | if (bar) |
Kyösti Mälkki | 4abc731 | 2021-01-12 17:46:30 +0200 | [diff] [blame] | 21 | dev_nvs->scc_bar1[nvs_index] = bar->base; |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 22 | |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 23 | /* Device is enabled in ACPI mode */ |
Kyösti Mälkki | 4abc731 | 2021-01-12 17:46:30 +0200 | [diff] [blame] | 24 | dev_nvs->scc_en[nvs_index] = 1; |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 25 | } |