Ritul Guru | f123ffe | 2022-11-25 11:31:26 +0530 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
Elyes Haouas | 9aebc19 | 2023-01-30 20:02:03 +0100 | [diff] [blame^] | 3 | #include <gpio.h> |
Ritul Guru | f123ffe | 2022-11-25 11:31:26 +0530 | [diff] [blame] | 4 | #include "gpio.h" |
| 5 | |
Ritul Guru | f123ffe | 2022-11-25 11:31:26 +0530 | [diff] [blame] | 6 | /* |
| 7 | * As a rule of thumb, GPIO pins used by coreboot should be initialized at |
| 8 | * bootblock while GPIO pins used only by the OS should be initialized at |
| 9 | * ramstage. |
| 10 | */ |
| 11 | static const struct soc_amd_gpio gpio_set_stage_ram[] = { |
Fred Reitberger | 8a979d9 | 2022-12-01 07:43:11 -0500 | [diff] [blame] | 12 | /* PWR_BTN_L */ |
| 13 | PAD_NF(GPIO_0, PWR_BTN_L, PULL_NONE), |
| 14 | /* SYS_RESET_L */ |
| 15 | PAD_NF(GPIO_1, SYS_RESET_L, PULL_NONE), |
| 16 | /* WAKE_L */ |
| 17 | PAD_NF_SCI(GPIO_2, WAKE_L, PULL_NONE, EDGE_LOW), |
| 18 | /* PCIE_SD_WAKE_L */ |
| 19 | PAD_SCI(GPIO_3, PULL_NONE, EDGE_LOW), |
| 20 | /* UART_WAKE_L_M2_APU */ |
| 21 | PAD_SCI(GPIO_4, PULL_UP, EDGE_LOW), |
| 22 | /* Unused */ |
| 23 | PAD_NC(GPIO_5), |
| 24 | /* M2_SSD1_DEVSLP */ |
| 25 | PAD_GPO(GPIO_6, HIGH), |
| 26 | /* EC SCI */ |
| 27 | PAD_SCI(GPIO_7, PULL_UP, EDGE_LOW), |
| 28 | /* TPAD_INT_L */ |
| 29 | PAD_SCI(GPIO_8, PULL_UP, EDGE_LOW), |
| 30 | /* USB_HDR_P0/1/2/3_SMI_L */ |
| 31 | PAD_SCI(GPIO_9, PULL_UP, EDGE_LOW), |
| 32 | /* MPM_EVENT_L, input or OD output */ |
| 33 | PAD_GPI(GPIO_10, PULL_UP), |
| 34 | /* HP_MIC_DET_L */ |
| 35 | PAD_GPI(GPIO_11, PULL_UP), |
| 36 | /* ALIGN_FLAG_MU_L */ |
| 37 | PAD_GPO(GPIO_12, HIGH), |
| 38 | /* GPIO_13 - GPIO_15: Not available */ |
| 39 | /* USB_OC0_L */ |
| 40 | PAD_NF(GPIO_16, USB_OC0_L, PULL_NONE), |
| 41 | /* WAKE_ON_WAN_L */ |
| 42 | PAD_SCI(GPIO_17, PULL_UP, EDGE_LOW), |
| 43 | /* PCIE_WLAN_WAKE_L */ |
| 44 | PAD_SCI(GPIO_18, PULL_UP, EDGE_LOW), |
| 45 | /* I2C3_SCL */ |
| 46 | PAD_NF(GPIO_19, I2C3_SCL, PULL_NONE), |
| 47 | /* I2C3_SDA */ |
| 48 | PAD_NF(GPIO_20, I2C3_SDA, PULL_NONE), |
| 49 | /* KBRST_L */ |
| 50 | PAD_NF(GPIO_21, KBRST_L, PULL_NONE), |
| 51 | /* ESPI_ALERT_L */ |
| 52 | PAD_NF(GPIO_22, ESPI_ALERT_D1, PULL_NONE), |
| 53 | /* AC_PRES */ |
| 54 | PAD_NF(GPIO_23, AC_PRES, PULL_NONE), |
| 55 | /* PCIE_LOM_WAKE_L */ |
| 56 | PAD_SCI(GPIO_24, PULL_UP, EDGE_LOW), |
| 57 | /* GPIO_25: Not available */ |
| 58 | /* PCIE_RST0_L */ |
| 59 | PAD_NFO(GPIO_26, PCIE_RST0_L, HIGH), |
| 60 | /* PCIE_RST1_L */ |
| 61 | PAD_NFO(GPIO_27, PCIE_RST1_L, HIGH), |
| 62 | /* GPIO_28: Not available */ |
| 63 | /* TPM CS */ |
| 64 | PAD_NF(GPIO_29, SPI_TPM_CS_L, PULL_NONE), |
| 65 | /* ESPI_CS_L */ |
| 66 | PAD_NF(GPIO_30, ESPI_CS_L, PULL_NONE), |
| 67 | /* INT_CLKREQ_L */ |
| 68 | PAD_INT(GPIO_31, PULL_NONE, EDGE_LOW, STATUS_DELIVERY), |
| 69 | /* TPNL_INT_L */ |
| 70 | PAD_SCI(GPIO_32, PULL_UP, EDGE_LOW), |
| 71 | /* GPIO_33 - GPIO_37: Not available */ |
| 72 | /* CLK_REQ5_L */ |
| 73 | PAD_NF(GPIO_38, CLK_REQ5_L, PULL_NONE), |
| 74 | /* CLK_REQ6_L */ |
| 75 | PAD_NF(GPIO_39, CLK_REQ6_L, PULL_NONE), |
| 76 | /* Unused */ |
| 77 | PAD_NC(GPIO_40), |
| 78 | /* GPIO_41: Not available */ |
| 79 | /* SD_CARD_PRSNT_L */ |
| 80 | PAD_GPI(GPIO_42, PULL_UP), |
| 81 | /* GPIO_43 - GPIO_66: Not available */ |
| 82 | /* SPI_ROM_REQ */ |
| 83 | PAD_NF(GPIO_67, SPI_ROM_REQ, PULL_NONE), |
| 84 | /* ESPI_DATA2 */ |
| 85 | PAD_NF(GPIO_68, SPI1_DAT2, PULL_NONE), |
| 86 | /* ESPI_DATA3 */ |
| 87 | PAD_NF(GPIO_69, SPI1_DAT3, PULL_NONE), |
| 88 | /* SPI2_CLK */ |
| 89 | PAD_NF(GPIO_70, SPI2_CLK, PULL_NONE), |
| 90 | /* GPIO_71 - GPIO_73: Not available */ |
| 91 | /* NFC_SB_CTL/UART4_FC_L */ |
| 92 | PAD_GPO(GPIO_74, HIGH), |
| 93 | /* SPI2_CS1_L */ |
| 94 | PAD_NF(GPIO_75, SPI2_CS1_L, PULL_NONE), |
| 95 | /* SPI_ROM_GNT */ |
| 96 | PAD_NF(GPIO_76, SPI_ROM_GNT, PULL_NONE), |
| 97 | /* ESPI_SOC_CLK */ |
| 98 | PAD_NF(GPIO_77, SPI1_CLK, PULL_NONE), |
| 99 | /* M2_SSD0_RST_L */ |
| 100 | PAD_GPO(GPIO_78, HIGH), |
| 101 | /* M2_SSD1_RST_L */ |
| 102 | PAD_GPO(GPIO_79, HIGH), |
| 103 | /* ESPI_DATA1 */ |
| 104 | PAD_NF(GPIO_80, SPI1_DAT1, PULL_NONE), |
| 105 | /* ESPI_DATA0 */ |
| 106 | PAD_NF(GPIO_81, SPI1_DAT0, PULL_NONE), |
| 107 | /* GPIO_82 - GPIO_83: Not available */ |
| 108 | /* FANIN0 */ |
| 109 | PAD_NF(GPIO_84, FANIN0, PULL_NONE), |
| 110 | /* FANOUT0 */ |
| 111 | PAD_NF(GPIO_85, FANOUT0, PULL_NONE), |
| 112 | /* Not available on package */ |
| 113 | PAD_NC(GPIO_86), |
| 114 | /* GPIO_87 - GPIO_88: Not available */ |
| 115 | /* DP_HPD_DIG_L */ |
| 116 | PAD_GPI(GPIO_89, PULL_UP), |
| 117 | /* TPM IRQ */ |
| 118 | PAD_SCI(GPIO_90, PULL_UP, EDGE_LOW), |
| 119 | /* NFC IRQ */ |
| 120 | PAD_SCI(GPIO_91, PULL_UP, EDGE_LOW), |
| 121 | /* CLK_REQ0_L */ |
| 122 | PAD_NF(GPIO_92, CLK_REQ0_L, PULL_NONE), |
| 123 | /* GPIO_93 - GPIO_103: Not available */ |
| 124 | /* SPI2_DAT0 */ |
| 125 | PAD_NF(GPIO_104, SPI2_DAT0, PULL_NONE), |
| 126 | /* SPI2_DAT1 */ |
| 127 | PAD_NF(GPIO_105, SPI2_DAT1, PULL_NONE), |
| 128 | /* SPI2_DAT2 */ |
| 129 | PAD_NF(GPIO_106, SPI2_DAT2, PULL_NONE), |
| 130 | /* SPI2_DAT3 */ |
| 131 | PAD_NF(GPIO_107, SPI2_DAT3, PULL_NONE), |
| 132 | /* GPIO_108 - GPIO_112: Not available */ |
| 133 | /* I2C2_SCL */ |
| 134 | PAD_NF(GPIO_113, I2C2_SCL, PULL_NONE), |
| 135 | /* I2C2_SDA */ |
| 136 | PAD_NF(GPIO_114, I2C2_SDA, PULL_NONE), |
| 137 | /* CLK_REQ1_L */ |
| 138 | PAD_NF(GPIO_115, CLK_REQ1_L, PULL_NONE), |
| 139 | /* CLK_REQ2_L */ |
| 140 | PAD_NF(GPIO_116, CLK_REQ2_L, PULL_NONE), |
| 141 | /* GPIO_117 - GPIO_129: Not available */ |
Martin Roth | 20646cd | 2023-01-04 21:27:06 -0700 | [diff] [blame] | 142 | /* SATA_ACT_L - phoenix does not have SATA, so force inactive */ |
Fred Reitberger | 8a979d9 | 2022-12-01 07:43:11 -0500 | [diff] [blame] | 143 | PAD_GPO(GPIO_130, HIGH), |
| 144 | /* CLK_REQ3_L */ |
| 145 | PAD_NF(GPIO_131, CLK_REQ3_L, PULL_NONE), |
| 146 | /* CLK_REQ4_L */ |
| 147 | PAD_NF(GPIO_132, CLK_REQ4_L, PULL_NONE), |
| 148 | /* GPIO_133 - GPIO_134: Not available */ |
| 149 | /* UART2_CTS_L */ |
| 150 | PAD_NF(GPIO_135, UART2_CTS_L, PULL_NONE), |
| 151 | /* UART2_RXD */ |
| 152 | PAD_NF(GPIO_136, UART2_RXD, PULL_NONE), |
| 153 | /* UART2_RTS_L */ |
| 154 | PAD_NF(GPIO_137, UART2_RTS_L, PULL_NONE), |
| 155 | /* UART2_TXD */ |
| 156 | PAD_NF(GPIO_138, UART2_TXD, PULL_NONE), |
| 157 | /* I2S_CODEC_INT */ |
| 158 | PAD_INT(GPIO_139, PULL_NONE, EDGE_LOW, STATUS_DELIVERY), |
| 159 | /* UART0_CTS_L */ |
| 160 | PAD_NF(GPIO_140, UART0_CTS_L, PULL_NONE), |
| 161 | /* UART0_RXD */ |
| 162 | PAD_NF(GPIO_141, UART0_RXD, PULL_NONE), |
| 163 | /* UART0_RTS_L */ |
| 164 | PAD_NF(GPIO_142, UART0_RTS_L, PULL_NONE), |
| 165 | /* UART0_TXD */ |
| 166 | PAD_NF(GPIO_143, UART0_TXD, PULL_NONE), |
| 167 | /* CAM_FW_UPDATE_WP_L */ |
| 168 | PAD_GPO(GPIO_144, LOW), |
| 169 | /* I2C0 SCL */ |
| 170 | PAD_NF(GPIO_145, I2C0_SCL, PULL_NONE), |
| 171 | /* I2C0 SDA */ |
| 172 | PAD_NF(GPIO_146, I2C0_SDA, PULL_NONE), |
| 173 | /* I2C1 SCL */ |
| 174 | PAD_NF(GPIO_147, I2C1_SCL, PULL_NONE), |
| 175 | /* I2C1 SDA */ |
| 176 | PAD_NF(GPIO_148, I2C1_SDA, PULL_NONE), |
| 177 | /* GPIO_149 - GPIO_152: Not available */ |
| 178 | /* NFC_DWL_REQ */ |
| 179 | PAD_GPO(GPIO_153, LOW), |
| 180 | /* APU_NFC_WAKE_L */ |
| 181 | PAD_GPO(GPIO_154, HIGH), |
| 182 | /* UART4_RXD */ |
| 183 | PAD_NF(GPIO_155, UART4_RXD, PULL_NONE), |
| 184 | /* UART4_TXD */ |
| 185 | PAD_NF(GPIO_156, UART4_TXD, PULL_NONE), |
| 186 | /* ALERT_M2_WWAN_L */ |
| 187 | PAD_INT(GPIO_157, PULL_UP, EDGE_LOW, STATUS_DELIVERY), |
Ritul Guru | f123ffe | 2022-11-25 11:31:26 +0530 | [diff] [blame] | 188 | }; |
| 189 | |
| 190 | void mainboard_program_gpios(void) |
| 191 | { |
| 192 | gpio_configure_pads(gpio_set_stage_ram, ARRAY_SIZE(gpio_set_stage_ram)); |
| 193 | } |