mb/google/nissa: Create pujjogatwin variant
[coreboot2.git] / src / mainboard / google / poppy / mainboard.c
blob30b46fb771d2669901fa9c9c4c0c886634461747
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <acpi/acpi.h>
4 #include <baseboard/variants.h>
5 #include <device/device.h>
6 #include <ec/ec.h>
7 #include <soc/pci_devs.h>
8 #include <soc/nhlt.h>
10 #include <variant/gpio.h>
12 static void mainboard_init(struct device *dev)
14 mainboard_ec_init();
17 static unsigned long mainboard_write_acpi_tables(const struct device *device,
18 unsigned long current, acpi_rsdp_t *rsdp)
20 uintptr_t start_addr;
21 uintptr_t end_addr;
22 struct nhlt *nhlt;
23 const char *oem_id = NULL;
24 const char *oem_table_id = NULL;
25 uint32_t oem_revision = 0;
27 start_addr = current;
29 nhlt = nhlt_init();
31 if (nhlt == NULL)
32 return start_addr;
34 variant_nhlt_init(nhlt);
35 variant_nhlt_oem_overrides(&oem_id, &oem_table_id, &oem_revision);
37 end_addr = nhlt_soc_serialize_oem_overrides(nhlt, start_addr,
38 oem_id, oem_table_id, oem_revision);
40 if (end_addr != start_addr)
41 acpi_add_table(rsdp, (void *)start_addr);
43 return end_addr;
46 static void mainboard_enable(struct device *dev)
48 dev->ops->init = mainboard_init;
49 dev->ops->write_acpi_tables = mainboard_write_acpi_tables;
52 static void mainboard_chip_init(void *chip_info)
54 const struct pad_config *pads;
55 size_t num;
57 pads = variant_gpio_table(&num);
58 gpio_configure_pads(pads, num);
59 pads = variant_sku_gpio_table(&num);
60 gpio_configure_pads(pads, num);
63 void __weak variant_final(void)
65 /* nop */
68 static void mainboard_final(void *chip_info)
70 variant_final();
73 struct chip_operations mainboard_ops = {
74 .init = mainboard_chip_init,
75 .enable_dev = mainboard_enable,
76 .final = mainboard_final