Eric Lai | 5088682 | 2020-11-26 12:10:39 +0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
| 2 | |
Eric Lai | b052c4b | 2020-11-27 13:50:02 +0800 | [diff] [blame] | 3 | #include <acpi/acpi.h> |
Eric Lai | 5e053af | 2020-11-26 12:58:10 +0800 | [diff] [blame] | 4 | #include <baseboard/variants.h> |
Eric Lai | 5088682 | 2020-11-26 12:10:39 +0800 | [diff] [blame] | 5 | #include <device/device.h> |
Eric Lai | 78b6a1b | 2020-11-27 14:11:59 +0800 | [diff] [blame] | 6 | #include <ec/ec.h> |
Sugnan Prabhu S | 061a93f | 2021-07-18 06:32:52 +0530 | [diff] [blame] | 7 | #include <soc/ramstage.h> |
Eric Lai | b052c4b | 2020-11-27 13:50:02 +0800 | [diff] [blame] | 8 | #include <vendorcode/google/chromeos/chromeos.h> |
Eric Lai | 5088682 | 2020-11-26 12:10:39 +0800 | [diff] [blame] | 9 | |
Sugnan Prabhu S | 061a93f | 2021-07-18 06:32:52 +0530 | [diff] [blame] | 10 | void mainboard_update_soc_chip_config(struct soc_intel_alderlake_config *config) |
| 11 | { |
| 12 | variant_update_soc_chip_config(config); |
| 13 | } |
| 14 | |
| 15 | __weak void variant_update_soc_chip_config(struct soc_intel_alderlake_config *config) |
| 16 | { |
| 17 | /* default implementation does nothing */ |
| 18 | } |
| 19 | |
Eric Lai | 5088682 | 2020-11-26 12:10:39 +0800 | [diff] [blame] | 20 | static void mainboard_init(void *chip_info) |
| 21 | { |
Tim Wawrzynczak | 5fed159 | 2021-06-08 14:44:56 -0600 | [diff] [blame] | 22 | const struct pad_config *base_pads; |
| 23 | const struct pad_config *override_pads; |
| 24 | size_t base_num, override_num; |
| 25 | |
| 26 | base_pads = variant_gpio_table(&base_num); |
| 27 | override_pads = variant_gpio_override_table(&override_num); |
| 28 | gpio_configure_pads_with_override(base_pads, base_num, override_pads, override_num); |
Sumeet Pawnikar | 582829d | 2021-07-23 15:50:17 +0530 | [diff] [blame] | 29 | |
| 30 | variant_devtree_update(); |
| 31 | } |
| 32 | |
| 33 | void __weak variant_devtree_update(void) |
| 34 | { |
| 35 | /* Override dev tree settings per board */ |
Eric Lai | 5088682 | 2020-11-26 12:10:39 +0800 | [diff] [blame] | 36 | } |
| 37 | |
Eric Lai | 78b6a1b | 2020-11-27 14:11:59 +0800 | [diff] [blame] | 38 | static void mainboard_dev_init(struct device *dev) |
| 39 | { |
| 40 | mainboard_ec_init(); |
| 41 | } |
| 42 | |
Eric Lai | 5088682 | 2020-11-26 12:10:39 +0800 | [diff] [blame] | 43 | static void mainboard_enable(struct device *dev) |
| 44 | { |
Eric Lai | 78b6a1b | 2020-11-27 14:11:59 +0800 | [diff] [blame] | 45 | dev->ops->init = mainboard_dev_init; |
Eric Lai | b052c4b | 2020-11-27 13:50:02 +0800 | [diff] [blame] | 46 | dev->ops->acpi_inject_dsdt = chromeos_dsdt_generator; |
Eric Lai | 5088682 | 2020-11-26 12:10:39 +0800 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | struct chip_operations mainboard_ops = { |
| 50 | .init = mainboard_init, |
| 51 | .enable_dev = mainboard_enable, |
| 52 | }; |