Subrata Banik | 3aea34a | 2024-06-25 00:17:56 +0530 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
| 2 | |
| 3 | #include <acpi/acpi.h> |
| 4 | #include <acpi/acpigen.h> |
| 5 | #include <baseboard/gpio.h> |
| 6 | #include <baseboard/variants.h> |
| 7 | #include <device/device.h> |
| 8 | #include <ec/ec.h> |
| 9 | #include <soc/ramstage.h> |
| 10 | #include <stdio.h> |
| 11 | #include <stdlib.h> |
| 12 | #include <vendorcode/google/chromeos/chromeos.h> |
| 13 | |
| 14 | void __weak fw_config_gpio_padbased_override(struct pad_config *padbased_table) |
| 15 | { |
| 16 | /* default implementation does nothing */ |
| 17 | } |
| 18 | |
| 19 | void mainboard_update_soc_chip_config(struct soc_intel_meteorlake_config *config) |
| 20 | { |
| 21 | variant_update_soc_chip_config(config); |
| 22 | } |
| 23 | |
| 24 | __weak void variant_update_soc_chip_config(struct soc_intel_meteorlake_config *config) |
| 25 | { |
| 26 | /* default implementation does nothing */ |
| 27 | } |
| 28 | |
| 29 | static void mainboard_init(void *chip_info) |
| 30 | { |
| 31 | struct pad_config *padbased_table; |
| 32 | const struct pad_config *base_pads; |
| 33 | size_t base_num; |
| 34 | |
| 35 | padbased_table = new_padbased_table(); |
| 36 | base_pads = variant_gpio_table(&base_num); |
| 37 | gpio_padbased_override(padbased_table, base_pads, base_num); |
| 38 | fw_config_gpio_padbased_override(padbased_table); |
| 39 | gpio_configure_pads_with_padbased(padbased_table); |
| 40 | free(padbased_table); |
| 41 | baseboard_devtree_update(); |
| 42 | } |
| 43 | |
| 44 | void __weak baseboard_devtree_update(void) |
| 45 | { |
| 46 | /* Override dev tree settings per baseboard */ |
| 47 | } |
| 48 | |
| 49 | void __weak variant_generate_s0ix_hook(enum s0ix_entry entry) |
| 50 | { |
| 51 | /* Add board-specific MS0X entries */ |
| 52 | /* |
| 53 | if (s0ix_entry == S0IX_ENTRY) { |
| 54 | implement variant operations here |
| 55 | } |
| 56 | if (s0ix_entry == S0IX_EXIT) { |
| 57 | implement variant operations here |
| 58 | } |
| 59 | */ |
| 60 | } |
| 61 | |
| 62 | static void mainboard_dev_init(struct device *dev) |
| 63 | { |
| 64 | mainboard_ec_init(); |
| 65 | } |
| 66 | |
| 67 | static void mainboard_enable(struct device *dev) |
| 68 | { |
| 69 | dev->ops->init = mainboard_dev_init; |
| 70 | } |
| 71 | |
| 72 | struct chip_operations mainboard_ops = { |
| 73 | .init = mainboard_init, |
| 74 | .enable_dev = mainboard_enable, |
| 75 | }; |