Angel Pons | 60ec365 | 2020-04-03 01:22:13 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Wonkyu Kim | 7e30358 | 2020-03-06 14:36:23 -0800 | [diff] [blame] | 2 | |
| 3 | #include <baseboard/gpio.h> |
| 4 | #include <baseboard/variants.h> |
| 5 | #include <commonlib/helpers.h> |
Kyösti Mälkki | 91c077f | 2021-11-03 18:34:14 +0200 | [diff] [blame^] | 6 | #include <vendorcode/google/chromeos/chromeos.h> |
Wonkyu Kim | 7e30358 | 2020-03-06 14:36:23 -0800 | [diff] [blame] | 7 | |
| 8 | /* Pad configuration in ramstage*/ |
| 9 | static const struct pad_config gpio_table[] = { |
| 10 | /* PCH M.2 SSD */ |
Wonkyu Kim | c04757b | 2020-03-12 13:18:19 -0700 | [diff] [blame] | 11 | PAD_CFG_GPO(GPP_B16, 1, DEEP), |
| 12 | PAD_CFG_GPO(GPP_H0, 1, DEEP), |
Wonkyu Kim | 7e30358 | 2020-03-06 14:36:23 -0800 | [diff] [blame] | 13 | |
| 14 | /* Camera */ |
Wonkyu Kim | c04757b | 2020-03-12 13:18:19 -0700 | [diff] [blame] | 15 | PAD_CFG_NF(GPP_H6, NONE, DEEP, NF1), /* I2C3_SDA */ |
| 16 | PAD_CFG_NF(GPP_H7, NONE, DEEP, NF1), /* I2C3_SCL */ |
| 17 | PAD_CFG_NF(GPP_B9, NONE, DEEP, NF1), /* I2C5_SDA */ |
| 18 | PAD_CFG_NF(GPP_B10, NONE, DEEP, NF1), /* I2C5_SCL */ |
| 19 | PAD_CFG_GPO(GPP_B23, 0, DEEP), |
| 20 | PAD_CFG_GPO(GPP_C15, 0, DEEP), |
| 21 | PAD_CFG_GPO(GPP_E22, 0, DEEP), |
| 22 | PAD_CFG_GPO(GPP_H12, 0, DEEP), |
Wonkyu Kim | 7e30358 | 2020-03-06 14:36:23 -0800 | [diff] [blame] | 23 | |
| 24 | /* Image clock: IMGCLKOUT_0, IMGCLKOUT_1 */ |
Wonkyu Kim | c04757b | 2020-03-12 13:18:19 -0700 | [diff] [blame] | 25 | PAD_CFG_NF(GPP_D4, NONE, DEEP, NF1), |
| 26 | PAD_CFG_NF(GPP_H20, NONE, DEEP, NF1), |
Wonkyu Kim | 7e30358 | 2020-03-06 14:36:23 -0800 | [diff] [blame] | 27 | |
| 28 | /* ISH UART0 RX/TX */ |
Wonkyu Kim | c04757b | 2020-03-12 13:18:19 -0700 | [diff] [blame] | 29 | PAD_CFG_NF(GPP_D13, NONE, DEEP, NF1), |
| 30 | PAD_CFG_NF(GPP_D14, NONE, DEEP, NF1), |
Wonkyu Kim | 7e30358 | 2020-03-06 14:36:23 -0800 | [diff] [blame] | 31 | |
| 32 | /* ISH I2C0 */ |
Wonkyu Kim | c04757b | 2020-03-12 13:18:19 -0700 | [diff] [blame] | 33 | PAD_CFG_NF(GPP_B5, NONE, DEEP, NF1), |
| 34 | PAD_CFG_NF(GPP_B6, NONE, DEEP, NF1), |
Wonkyu Kim | 7e30358 | 2020-03-06 14:36:23 -0800 | [diff] [blame] | 35 | |
| 36 | /* ISH GPI 0-6 */ |
Wonkyu Kim | c04757b | 2020-03-12 13:18:19 -0700 | [diff] [blame] | 37 | PAD_CFG_NF(GPP_D0, NONE, DEEP, NF1), |
| 38 | PAD_CFG_NF(GPP_D1, NONE, DEEP, NF1), |
| 39 | PAD_CFG_NF(GPP_D2, NONE, DEEP, NF1), |
| 40 | PAD_CFG_NF(GPP_D3, NONE, DEEP, NF1), |
| 41 | PAD_CFG_NF(GPP_D17, NONE, DEEP, NF1), |
| 42 | PAD_CFG_NF(GPP_D18, NONE, DEEP, NF1), |
| 43 | PAD_CFG_NF(GPP_E15, NONE, DEEP, NF1), |
| 44 | PAD_CFG_NF(GPP_E16, NONE, DEEP, NF1), |
Wonkyu Kim | 7e30358 | 2020-03-06 14:36:23 -0800 | [diff] [blame] | 45 | |
Wonkyu Kim | c04757b | 2020-03-12 13:18:19 -0700 | [diff] [blame] | 46 | /* Audio */ |
Wonkyu Kim | 7e30358 | 2020-03-06 14:36:23 -0800 | [diff] [blame] | 47 | PAD_CFG_NF(GPP_C16, NONE, DEEP, NF1), /* I2C0_SDA */ |
| 48 | PAD_CFG_NF(GPP_C17, NONE, DEEP, NF1), /* I2C0_SCL */ |
Wonkyu Kim | c04757b | 2020-03-12 13:18:19 -0700 | [diff] [blame] | 49 | PAD_CFG_GPO(GPP_C5, 1, DEEP), |
| 50 | PAD_CFG_GPI_APIC(GPP_C12, NONE, DEEP, EDGE_BOTH, INVERT), /* AUDIO JACK IRQ */ |
Wonkyu Kim | 7e30358 | 2020-03-06 14:36:23 -0800 | [diff] [blame] | 51 | |
Srinidhi N Kaushik | 6975e07 | 2020-03-12 01:22:01 -0700 | [diff] [blame] | 52 | PAD_CFG_NF(GPP_D19, NONE, DEEP, NF1), /* I2S_MCLK1 */ |
| 53 | PAD_CFG_NF(GPP_F8, NONE, DEEP, NF1), /* I2S_MCLK2 */ |
| 54 | |
John Zhao | 9088328 | 2020-08-02 11:29:59 -0700 | [diff] [blame] | 55 | /* EC_SYNC_IRQ */ |
| 56 | PAD_CFG_GPI_APIC(GPP_A15, NONE, PLTRST, LEVEL, INVERT), /* MECC_HPD2 */ |
Shaunak Saha | e7ef6c3 | 2020-05-27 23:23:32 -0700 | [diff] [blame] | 57 | |
| 58 | PAD_CFG_GPO(GPP_H1, 1, DEEP), /* AUDIO_PWREN */ |
Wonkyu Kim | 7e30358 | 2020-03-06 14:36:23 -0800 | [diff] [blame] | 59 | }; |
| 60 | |
| 61 | /* Early pad configuration in bootblock */ |
| 62 | static const struct pad_config early_gpio_table[] = { |
Michael Niewöhner | 1d05a3b | 2020-12-21 03:46:58 +0100 | [diff] [blame] | 63 | /* UART */ |
| 64 | PAD_CFG_NF(GPP_C20, NONE, DEEP, NF1), /* UART2 RX */ |
| 65 | PAD_CFG_NF(GPP_C21, NONE, DEEP, NF1), /* UART2 TX */ |
| 66 | |
Wonkyu Kim | c04757b | 2020-03-12 13:18:19 -0700 | [diff] [blame] | 67 | /* Audio */ |
Wonkyu Kim | 7e30358 | 2020-03-06 14:36:23 -0800 | [diff] [blame] | 68 | PAD_CFG_NF(GPP_R0, NONE, DEEP, NF2), /* I2S0_HP_SCLK */ |
| 69 | PAD_CFG_NF(GPP_R1, NONE, DEEP, NF2), /* I2S0_HP_SFRM */ |
Srinidhi N Kaushik | 6975e07 | 2020-03-12 01:22:01 -0700 | [diff] [blame] | 70 | PAD_CFG_NF(GPP_R2, NONE, DEEP, NF2), /* I2S0_HP_TX */ |
Wonkyu Kim | 7e30358 | 2020-03-06 14:36:23 -0800 | [diff] [blame] | 71 | PAD_CFG_NF(GPP_R3, NONE, DEEP, NF2), /* I2S0_HP_RX */ |
Srinidhi N Kaushik | 6975e07 | 2020-03-12 01:22:01 -0700 | [diff] [blame] | 72 | PAD_CFG_NF(GPP_R4, DN_20K, DEEP, NF1), /* HDA_RST_L */ |
Wonkyu Kim | 7e30358 | 2020-03-06 14:36:23 -0800 | [diff] [blame] | 73 | |
Srinidhi N Kaushik | 6975e07 | 2020-03-12 01:22:01 -0700 | [diff] [blame] | 74 | PAD_CFG_NF(GPP_A7, NONE, DEEP, NF1), /* I2S2_SPKR_SCLK */ |
| 75 | PAD_CFG_NF(GPP_A8, NONE, DEEP, NF1), /* I2S2_SPKR_SFRM */ |
| 76 | PAD_CFG_NF(GPP_A9, NONE, DEEP, NF1), /* I2S2_SPKR_TX */ |
| 77 | PAD_CFG_NF(GPP_A10, NONE, DEEP, NF1), /* I2S2_SPKR_RX */ |
Wonkyu Kim | 7e30358 | 2020-03-06 14:36:23 -0800 | [diff] [blame] | 78 | |
| 79 | PAD_CFG_NF(GPP_S0, NONE, DEEP, NF1), /* SNDW0_HP_CLK */ |
| 80 | PAD_CFG_NF(GPP_S1, NONE, DEEP, NF1), /* SNDW0_HP_DATA */ |
Wonkyu Kim | 7e30358 | 2020-03-06 14:36:23 -0800 | [diff] [blame] | 81 | |
Srinidhi N Kaushik | 6975e07 | 2020-03-12 01:22:01 -0700 | [diff] [blame] | 82 | PAD_CFG_NF(GPP_S2, NONE, DEEP, NF2), /* DMIC0_CLK_B */ |
| 83 | PAD_CFG_NF(GPP_S6, NONE, DEEP, NF2), /* DMIC0_CLK_A */ |
Wonkyu Kim | 7e30358 | 2020-03-06 14:36:23 -0800 | [diff] [blame] | 84 | PAD_CFG_NF(GPP_S7, NONE, DEEP, NF2), /* DMIC0_DATA */ |
Srinidhi N Kaushik | 6975e07 | 2020-03-12 01:22:01 -0700 | [diff] [blame] | 85 | PAD_CFG_NF(GPP_S3, NONE, DEEP, NF2), /* DMIC1_CLK_B */ |
| 86 | PAD_CFG_NF(GPP_S4, NONE, DEEP, NF2), /* DMIC1_CLK_A */ |
| 87 | PAD_CFG_NF(GPP_S5, NONE, DEEP, NF2), /* DMIC1_DATA */ |
Wonkyu Kim | 7e30358 | 2020-03-06 14:36:23 -0800 | [diff] [blame] | 88 | |
Wonkyu Kim | 6681511 | 2020-03-09 14:48:51 -0700 | [diff] [blame] | 89 | /* DP */ |
Wonkyu Kim | c04757b | 2020-03-12 13:18:19 -0700 | [diff] [blame] | 90 | PAD_CFG_NF(GPP_L_BKLTEN, NONE, DEEP, NF1), /* L_BKLTEN */ |
| 91 | PAD_CFG_NF(GPP_L_BKLTCTL, NONE, DEEP, NF1), /* L_BKLTCTL */ |
| 92 | PAD_CFG_NF(GPP_L_VDDEN, NONE, DEEP, NF1), /* L_VDDEN */ |
| 93 | PAD_CFG_NF(GPP_E14, NONE, DEEP, NF1), /* HPD_A */ |
| 94 | PAD_CFG_NF(GPP_A18, NONE, DEEP, NF1), /* HPD_B */ |
| 95 | PAD_CFG_NF(GPP_A19, NONE, DEEP, NF1), /* HPD_1 */ |
| 96 | PAD_CFG_NF(GPP_E18, NONE, DEEP, NF1), /* DDP_1_CTRCLK */ |
| 97 | PAD_CFG_NF(GPP_E19, NONE, DEEP, NF1), /* DDP_1_CTRDATA */ |
Shaunak Saha | b449b9c | 2020-08-23 21:35:21 -0700 | [diff] [blame] | 98 | |
| 99 | /* TPM */ |
| 100 | /* B19 : GSPI1_CS0B */ |
| 101 | PAD_CFG_NF(GPP_B19, NONE, DEEP, NF1), |
| 102 | /* B20 : GSPI1_CLK */ |
| 103 | PAD_CFG_NF(GPP_B20, NONE, DEEP, NF1), |
| 104 | /* B21 : GSPI1_MISO */ |
| 105 | PAD_CFG_NF(GPP_B21, NONE, DEEP, NF1), |
| 106 | /* B22 : GSPI1_MOSI */ |
| 107 | PAD_CFG_NF(GPP_B22, NONE, DEEP, NF1), |
Bora Guvendik | 7377cda | 2020-08-28 10:50:47 -0700 | [diff] [blame] | 108 | |
| 109 | /* WWAN */ |
| 110 | PAD_CFG_GPO(GPP_D11, 1, DEEP), /* WWAN_PWREN */ |
| 111 | PAD_CFG_NF(GPP_D7, NONE, DEEP, NF1), /* CLK SRC 2 */ |
| 112 | PAD_CFG_GPI_SCI(GPP_C9, NONE, DEEP, LEVEL, INVERT), /* WWAN_WAKE_N */ |
| 113 | PAD_CFG_GPO(GPP_C11, 1, DEEP), /* FULL_CARD_POWER_OFF_N */ |
| 114 | PAD_CFG_GPO(GPP_C10, 1, DEEP), /* WWAN_RST_N */ |
| 115 | PAD_CFG_GPO(GPP_B17, 1, DEEP), /* WWAN_PERST_N */ |
| 116 | PAD_CFG_GPO(GPP_D15, 1, DEEP), /* WWAN_DISABLE_N */ |
Wonkyu Kim | 7e30358 | 2020-03-06 14:36:23 -0800 | [diff] [blame] | 117 | }; |
| 118 | |
| 119 | const struct pad_config *variant_gpio_table(size_t *num) |
| 120 | { |
| 121 | *num = ARRAY_SIZE(gpio_table); |
| 122 | return gpio_table; |
| 123 | } |
| 124 | |
| 125 | const struct pad_config *variant_early_gpio_table(size_t *num) |
| 126 | { |
| 127 | *num = ARRAY_SIZE(early_gpio_table); |
| 128 | return early_gpio_table; |
| 129 | } |
| 130 | |
| 131 | static const struct cros_gpio cros_gpios[] = { |
Shaunak Saha | 56e3df4 | 2020-03-24 00:24:59 -0700 | [diff] [blame] | 132 | CROS_GPIO_REC_AL(CROS_GPIO_VIRTUAL, CROS_GPIO_DEVICE_NAME), |
Wonkyu Kim | 7e30358 | 2020-03-06 14:36:23 -0800 | [diff] [blame] | 133 | }; |
| 134 | |
| 135 | const struct cros_gpio *variant_cros_gpios(size_t *num) |
| 136 | { |
| 137 | *num = ARRAY_SIZE(cros_gpios); |
| 138 | return cros_gpios; |
| 139 | } |