acpi_gic: Add helper for platform gicc
[coreboot2.git] / src / mainboard / google / octopus / variants / meep / gpio.c
blob68f0a2da4d02810ba58785eed753bbef447d6ff4
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <baseboard/gpio.h>
4 #include <baseboard/variants.h>
5 #include <gpio.h>
6 #include <variant/sku.h>
7 #include <ec/google/chromeec/ec.h>
9 static const struct pad_config default_override_table[] = {
10 PAD_NC(GPIO_104, UP_20K),
12 /* GPIO_137 -- HP_INT_ODL and would be amend by SSFC. */
13 PAD_CFG_GPI_APIC_IOS(GPIO_137, NONE, DEEP, LEVEL, INVERT, HIZCRx1,
14 DISPUPD),
16 /* EN_PP3300_TOUCHSCREEN */
17 PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 1, DEEP, NONE, Tx0RxDCRx0, DISPUPD),
18 /* GPIO_105 -- TOUCHSCREEN_RST */
19 PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
20 /* GPIO_140 -- PEN_RESET */
21 PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_140, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
24 static const struct pad_config hdmi_sku_override_table[] = {
25 PAD_NC(GPIO_104, UP_20K),
27 /* HV_DDI1_DDC_SDA */
28 PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_126, NONE, DEEP, NF1, HIZCRx1,
29 DISPUPD),
30 /* HV_DDI1_DDC_SCL */
31 PAD_CFG_NF_IOSSTATE_IOSTERM(GPIO_127, NONE, DEEP, NF1, HIZCRx1,
32 DISPUPD),
34 /* GPIO_137 -- HP_INT_ODL and would be amend by SSFC. */
35 PAD_CFG_GPI_APIC_IOS(GPIO_137, NONE, DEEP, LEVEL, INVERT, HIZCRx1,
36 DISPUPD),
38 /* EN_PP3300_TOUCHSCREEN */
39 PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 1, DEEP, NONE, Tx0RxDCRx0, DISPUPD),
40 /* GPIO_105 -- TOUCHSCREEN_RST */
41 PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
42 /* GPIO_140 -- PEN_RESET */
43 PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_140, 0, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
46 const struct pad_config *variant_override_gpio_table(size_t *num)
48 uint32_t sku_id;
49 sku_id = google_chromeec_get_board_sku();
51 switch (sku_id) {
52 case SKU_33_DORP:
53 case SKU_34_DORP:
54 case SKU_35_DORP:
55 case SKU_36_DORP:
56 *num = ARRAY_SIZE(hdmi_sku_override_table);
57 return hdmi_sku_override_table;
58 default:
59 *num = ARRAY_SIZE(default_override_table);
60 return default_override_table;
64 /* GPIOs needed to be set in romstage. */
65 static const struct pad_config romstage_gpio_table[] = {
66 /* Enable touchscreen, hold in reset */
67 /* EN_PP3300_TOUCHSCREEN */
68 PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_146, 1, DEEP, NONE, Tx0RxDCRx0, DISPUPD),
69 /* GPIO_105 -- TOUCHSCREEN_RST */
70 PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_105, 1, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
71 /* GPIO_140 -- PEN_RESET */
72 PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_140, 1, DEEP, NONE, Tx1RxDCRx0, DISPUPD),
75 const struct pad_config *variant_romstage_gpio_table(size_t *num)
77 *num = ARRAY_SIZE(romstage_gpio_table);
78 return romstage_gpio_table;