Angel Pons | 60ec365 | 2020-04-03 01:22:13 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Maulik V Vaghela | dfc9917 | 2018-08-07 12:06:23 +0530 | [diff] [blame] | 2 | |
Furquan Shaikh | 76cedd2 | 2020-05-02 10:24:23 -0700 | [diff] [blame] | 3 | #include <acpi/acpi.h> |
Maulik V Vaghela | dfc9917 | 2018-08-07 12:06:23 +0530 | [diff] [blame] | 4 | #include <baseboard/variants.h> |
| 5 | #include <device/device.h> |
| 6 | #include <nhlt.h> |
Elyes Haouas | 97ee153 | 2024-06-04 10:27:13 +0200 | [diff] [blame^] | 7 | #include <gpio.h> |
Maulik V Vaghela | dfc9917 | 2018-08-07 12:06:23 +0530 | [diff] [blame] | 8 | #include <soc/nhlt.h> |
Maulik V Vaghela | dfc9917 | 2018-08-07 12:06:23 +0530 | [diff] [blame] | 9 | |
| 10 | static void mainboard_init(void *chip_info) |
| 11 | { |
| 12 | const struct pad_config *pads; |
| 13 | size_t num; |
| 14 | |
| 15 | pads = variant_gpio_table(&num); |
| 16 | gpio_configure_pads(pads, num); |
| 17 | } |
| 18 | |
Furquan Shaikh | 0f007d8 | 2020-04-24 06:41:18 -0700 | [diff] [blame] | 19 | static unsigned long mainboard_write_acpi_tables(const struct device *device, |
Maulik V Vaghela | dfc9917 | 2018-08-07 12:06:23 +0530 | [diff] [blame] | 20 | unsigned long current, |
| 21 | acpi_rsdp_t *rsdp) |
| 22 | { |
| 23 | uintptr_t start_addr; |
| 24 | uintptr_t end_addr; |
| 25 | struct nhlt *nhlt; |
| 26 | |
| 27 | start_addr = current; |
| 28 | |
| 29 | nhlt = nhlt_init(); |
| 30 | |
| 31 | if (nhlt == NULL) |
| 32 | return start_addr; |
| 33 | |
| 34 | variant_nhlt_init(nhlt); |
| 35 | |
| 36 | end_addr = nhlt_soc_serialize(nhlt, start_addr); |
| 37 | |
| 38 | if (end_addr != start_addr) |
| 39 | acpi_add_table(rsdp, (void *)start_addr); |
| 40 | |
| 41 | return end_addr; |
| 42 | } |
| 43 | |
| 44 | static void mainboard_enable(struct device *dev) |
| 45 | { |
| 46 | dev->ops->write_acpi_tables = mainboard_write_acpi_tables; |
Maulik V Vaghela | dfc9917 | 2018-08-07 12:06:23 +0530 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | struct chip_operations mainboard_ops = { |
| 50 | .init = mainboard_init, |
| 51 | .enable_dev = mainboard_enable, |
| 52 | }; |