Werner Zeh | c42a613 | 2015-02-12 12:40:15 +0100 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2013 Google Inc. |
| 5 | * Copyright (C) 2014 Sage Electronic Engineering, LLC. |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; version 2 of the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
Werner Zeh | c42a613 | 2015-02-12 12:40:15 +0100 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #include <stdlib.h> |
Ben Gardner | fa6014a | 2015-12-08 21:20:25 -0600 | [diff] [blame^] | 18 | #include <soc/gpio.h> |
Werner Zeh | c42a613 | 2015-02-12 12:40:15 +0100 | [diff] [blame] | 19 | #include "irqroute.h" |
| 20 | |
| 21 | /* NCORE GPIOs */ |
| 22 | static const struct soc_gpio_map gpncore_gpio_map[] = { |
| 23 | GPIO_FUNC2, /* GPIO 0 */ |
| 24 | GPIO_FUNC2, /* GPIO 1 */ |
| 25 | GPIO_FUNC2, /* GPIO 2 */ |
| 26 | GPIO_FUNC2, /* GPIO 3 */ |
| 27 | GPIO_FUNC2, /* GPIO 4 */ |
| 28 | GPIO_FUNC2, /* GPIO 5 */ |
| 29 | GPIO_FUNC2, /* GPIO 6 */ |
| 30 | GPIO_FUNC2, /* GPIO 7 */ |
| 31 | GPIO_FUNC2, /* GPIO 8 */ |
| 32 | GPIO_FUNC2, /* GPIO 9 */ |
| 33 | GPIO_FUNC2, /* GPIO 10 */ |
| 34 | GPIO_FUNC2, /* GPIO 11 */ |
| 35 | GPIO_FUNC2, /* GPIO 12 */ |
| 36 | GPIO_FUNC2, /* GPIO 13 */ |
| 37 | GPIO_FUNC2, /* GPIO 14 */ |
| 38 | GPIO_FUNC2, /* GPIO 15 */ |
| 39 | GPIO_FUNC2, /* GPIO 16 */ |
| 40 | GPIO_FUNC2, /* GPIO 17 */ |
| 41 | GPIO_FUNC2, /* GPIO 18 */ |
| 42 | GPIO_FUNC2, /* GPIO 19 */ |
| 43 | GPIO_FUNC2, /* GPIO 20 */ |
| 44 | GPIO_FUNC2, /* GPIO 21 */ |
| 45 | GPIO_FUNC2, /* GPIO 22 */ |
| 46 | GPIO_FUNC2, /* GPIO 23 */ |
| 47 | GPIO_FUNC2, /* GPIO 24 */ |
| 48 | GPIO_FUNC2, /* GPIO 25 */ |
| 49 | GPIO_FUNC2, /* GPIO 26 */ |
| 50 | GPIO_END |
| 51 | }; |
| 52 | |
| 53 | /* SCORE GPIOs (GPIO_S0_SC_XX)*/ |
| 54 | static const struct soc_gpio_map gpscore_gpio_map[] = { |
| 55 | GPIO_FUNC1, /* GPIO_S0_SC[000] SATA_GP[0] .*/ |
| 56 | GPIO_FUNC2, /* GPIO_S0_SC[001] SATA_GP[1] SATA_DEVSLP[0] .*/ |
| 57 | GPIO_FUNC1, /* GPIO_S0_SC[002] SATA_LED# */ |
| 58 | GPIO_FUNC1, /* GPIO_S0_SC[003] PCIE_CLKREQ[0]# */ |
| 59 | GPIO_FUNC1, /* GPIO_S0_SC[004] PCIE_CLKREQ[1]# */ |
| 60 | GPIO_FUNC1, /* GPIO_S0_SC[005] PCIE_CLKREQ[2]# */ |
| 61 | GPIO_FUNC1, /* GPIO_S0_SC[006] PCIE_CLKREQ[3]# */ |
| 62 | GPIO_NC, /* GPIO_S0_SC[007] RESERVED SD3_WP */ |
| 63 | GPIO_FUNC2, /* GPIO_S0_SC[008] I2S0_CLK HDA_RST# */ |
| 64 | GPIO_FUNC2, /* GPIO_S0_SC[009] I2S0_FRM HDA_SYNC */ |
| 65 | GPIO_FUNC2, /* GPIO_S0_SC[010] I2S0_DATAOUT HDA_CLK */ |
| 66 | GPIO_FUNC2, /* GPIO_S0_SC[011] I2S0_DATAIN HDA_SDO */ |
| 67 | GPIO_FUNC2, /* GPIO_S0_SC[012] I2S1_CLK HDA_SDI[0] */ |
| 68 | GPIO_NC, /* GPIO_S0_SC[013] I2S1_FRM HDA_SDI[1] */ |
| 69 | GPIO_DEFAULT, /* GPIO_S0_SC[014] I2S1_DATAOUT RESERVED */ |
| 70 | GPIO_DEFAULT, /* GPIO_S0_SC[015] I2S1_DATAIN RESERVED */ |
| 71 | GPIO_NC, /* GPIO_S0_SC[016] MMC1_CLK MMC1_45_CLK */ |
| 72 | GPIO_NC, /* GPIO_S0_SC[017] MMC1_D[0] MMC1_45_D[0] */ |
| 73 | GPIO_NC, /* GPIO_S0_SC[018] MMC1_D[1] MMC1_45_D[1] */ |
| 74 | GPIO_NC, /* GPIO_S0_SC[019] MMC1_D[2] MMC1_45_D[2] */ |
| 75 | GPIO_NC, /* GPIO_S0_SC[020] MMC1_D[3] MMC1_45_D[3] */ |
| 76 | GPIO_NC, /* GPIO_S0_SC[021] MMC1_D[4] MMC1_45_D[4] */ |
| 77 | GPIO_NC, /* GPIO_S0_SC[022] MMC1_D[5] MMC1_45_D[5] */ |
| 78 | GPIO_NC, /* GPIO_S0_SC[023] MMC1_D[6] MMC1_45_D[6] */ |
| 79 | GPIO_NC, /* GPIO_S0_SC[024] MMC1_D[7] MMC1_45_D[7] */ |
| 80 | GPIO_NC, /* GPIO_S0_SC[025] MMC1_CMD MMC1_45_CMD */ |
| 81 | GPIO_NC, /* GPIO_S0_SC[026] MMC1_RST# SATA_DEVSLP[0] MMC1_45_RST# */ |
| 82 | GPIO_FUNC1, /* GPIO_S0_SC[027] SD2_CLK */ |
| 83 | GPIO_FUNC1, /* GPIO_S0_SC[028] SD2_D[0] */ |
| 84 | GPIO_FUNC1, /* GPIO_S0_SC[029] SD2_D[1] */ |
| 85 | GPIO_FUNC1, /* GPIO_S0_SC[030] SD2_D[2] */ |
| 86 | GPIO_FUNC1, /* GPIO_S0_SC[031] SD2_D[3]_CD# */ |
| 87 | GPIO_FUNC1, /* GPIO_S0_SC[032] SD2_CMD */ |
| 88 | GPIO_NC, /* GPIO_S0_SC[033] SD3_CLK */ |
| 89 | GPIO_NC, /* GPIO_S0_SC[034] SD3_D[0] */ |
| 90 | GPIO_NC, /* GPIO_S0_SC[035] SD3_D[1] */ |
| 91 | GPIO_NC, /* GPIO_S0_SC[036] SD3_D[2] */ |
| 92 | GPIO_NC, /* GPIO_S0_SC[037] SD3_D[3] */ |
| 93 | GPIO_NC, /* GPIO_S0_SC[038] SD3_CD# */ |
| 94 | GPIO_NC, /* GPIO_S0_SC[039] SD3_CMD */ |
| 95 | GPIO_NC, /* GPIO_S0_SC[040] SD3_1P8EN */ |
| 96 | GPIO_NC, /* GPIO_S0_SC[041] SD3_PWREN# */ |
| 97 | GPIO_FUNC1, /* GPIO_S0_SC[042] ILB_LPC_AD[0] */ |
| 98 | GPIO_FUNC1, /* GPIO_S0_SC[043] ILB_LPC_AD[1] */ |
| 99 | GPIO_FUNC1, /* GPIO_S0_SC[044] ILB_LPC_AD[2] */ |
| 100 | GPIO_FUNC1, /* GPIO_S0_SC[045] ILB_LPC_AD[3] */ |
| 101 | GPIO_FUNC1, /* GPIO_S0_SC[046] ILB_LPC_FRAME# */ |
| 102 | GPIO_FUNC1, /* GPIO_S0_SC[047] ILB_LPC_CLK[0] */ |
| 103 | GPIO_FUNC1, /* GPIO_S0_SC[048] ILB_LPC_CLK[1] */ |
| 104 | GPIO_FUNC1, /* GPIO_S0_SC[049] ILB_LPC_CLKRUN# */ |
| 105 | GPIO_FUNC1, /* GPIO_S0_SC[050] ILB_LPC_SERIRQ */ |
| 106 | GPIO_FUNC1, /* GPIO_S0_SC[051] PCU_SMB_DATA */ |
| 107 | GPIO_FUNC1, /* GPIO_S0_SC[052] PCU_SMB_CLK */ |
| 108 | GPIO_FUNC1, /* GPIO_S0_SC[053] PCU_SMB_ALERT# */ |
| 109 | GPIO_FUNC1, /* GPIO_S0_SC[054] ILB_8254_SPKR RESERVED */ |
| 110 | GPIO_OUT_HIGH, /* GPIO_S0_SC[055] RESERVED */ |
| 111 | GPIO_FUNC0, /* GPIO_S0_SC[056] RESERVED */ |
| 112 | GPIO_FUNC1, /* GPIO_S0_SC[057] PCU_UART_TXD */ |
| 113 | GPIO_OUT_LOW, /* GPIO_S0_SC[058] RESERVED */ |
| 114 | GPIO_OUT_LOW, /* GPIO_S0_SC[059] RESERVED */ |
| 115 | GPIO_OUT_LOW, /* GPIO_S0_SC[060] RESERVED */ |
| 116 | GPIO_FUNC1, /* GPIO_S0_SC[061] PCU_UART_RXD */ |
| 117 | GPIO_FUNC1, /* GPIO_S0_SC[062] LPE_I2S2_CLK SATA_DEVSLP[1] RESERVED */ |
| 118 | GPIO_FUNC1, /* GPIO_S0_SC[063] LPE_I2S2_FRM RESERVED */ |
| 119 | GPIO_FUNC1, /* GPIO_S0_SC[064] LPE_I2S2_DATAIN */ |
| 120 | GPIO_FUNC1, /* GPIO_S0_SC[065] LPE_I2S2_DATAOUT */ |
| 121 | GPIO_FUNC1, /* GPIO_S0_SC[066] SIO_SPI_CS# */ |
| 122 | GPIO_FUNC1, /* GPIO_S0_SC[067] SIO_SPI_MISO */ |
| 123 | GPIO_FUNC1, /* GPIO_S0_SC[068] SIO_SPI_MOSI */ |
| 124 | GPIO_FUNC1, /* GPIO_S0_SC[069] SIO_SPI_CLK */ |
| 125 | GPIO_FUNC1, /* GPIO_S0_SC[070] SIO_UART1_RXD RESERVED */ |
| 126 | GPIO_FUNC1, /* GPIO_S0_SC[071] SIO_UART1_TXD RESERVED */ |
| 127 | GPIO_FUNC1, /* GPIO_S0_SC[072] SIO_UART1_RTS# */ |
| 128 | GPIO_FUNC1, /* GPIO_S0_SC[073] SIO_UART1_CTS# */ |
| 129 | GPIO_FUNC1, /* GPIO_S0_SC[074] SIO_UART2_RXD */ |
| 130 | GPIO_FUNC1, /* GPIO_S0_SC[075] SIO_UART2_TXD */ |
| 131 | GPIO_FUNC1, /* GPIO_S0_SC[076] SIO_UART2_RTS# */ |
| 132 | GPIO_FUNC1, /* GPIO_S0_SC[077] SIO_UART2_CTS# */ |
| 133 | GPIO_FUNC1, /* GPIO_S0_SC[078] SIO_I2C0_DATA */ |
| 134 | GPIO_FUNC1, /* GPIO_S0_SC[079] SIO_I2C0_CLK */ |
| 135 | GPIO_FUNC1, /* GPIO_S0_SC[080] SIO_I2C1_DATA */ |
| 136 | GPIO_FUNC1, /* GPIO_S0_SC[081] SIO_I2C1_CLK RESERVED */ |
| 137 | GPIO_FUNC1, /* GPIO_S0_SC[082] SIO_I2C2_DATA */ |
| 138 | GPIO_FUNC1, /* GPIO_S0_SC[083] SIO_I2C2_CLK */ |
| 139 | GPIO_FUNC1, /* GPIO_S0_SC[084] SIO_I2C3_DATA */ |
| 140 | GPIO_FUNC1, /* GPIO_S0_SC[085] SIO_I2C3_CLK */ |
| 141 | GPIO_FUNC1, /* GPIO_S0_SC[086] SIO_I2C4_DATA */ |
| 142 | GPIO_FUNC1, /* GPIO_S0_SC[087] SIO_I2C4_CLK */ |
| 143 | GPIO_FUNC1, /* GPIO_S0_SC[088] SIO_I2C5_DATA */ |
| 144 | GPIO_FUNC1, /* GPIO_S0_SC[089] SIO_I2C5_CLK */ |
| 145 | GPIO_FUNC1, /* GPIO_S0_SC[090] SIO_I2C6_DATA ILB_NMI */ |
| 146 | GPIO_FUNC1, /* GPIO_S0_SC[091] SIO_I2C6_CLK SD3_WP */ |
| 147 | GPIO_FUNC1, /* RESERVED GPIO_S0_SC[092] */ |
| 148 | GPIO_FUNC1, /* RESERVED GPIO_S0_SC[093] */ |
| 149 | GPIO_FUNC1, /* GPIO_S0_SC[094] SIO_PWM[0] */ |
| 150 | GPIO_FUNC1, /* GPIO_S0_SC[095] SIO_PWM[1] */ |
| 151 | GPIO_FUNC1, /* GPIO_S0_SC[096] PMC_PLT_CLK[0] */ |
| 152 | GPIO_FUNC1, /* GPIO_S0_SC[097] PMC_PLT_CLK[1] */ |
| 153 | GPIO_FUNC1, /* GPIO_S0_SC[098] PMC_PLT_CLK[2] */ |
| 154 | GPIO_FUNC1, /* GPIO_S0_SC[099] PMC_PLT_CLK[3] */ |
| 155 | GPIO_FUNC1, /* GPIO_S0_SC[100] PMC_PLT_CLK[4] */ |
| 156 | GPIO_DEFAULT, /* GPIO_S0_SC[101] PMC_PLT_CLK[5] */ |
| 157 | GPIO_END |
| 158 | }; |
| 159 | |
| 160 | /* SSUS GPIOs (GPIO_S5) */ |
| 161 | static const struct soc_gpio_map gpssus_gpio_map[] = { |
| 162 | GPIO_INPUT_PD_10K, /* GPIO_S5[00] RESERVED */ |
| 163 | GPIO_INPUT_PD_10K, /* GPIO_S5[01] RESERVED RESERVED RESERVED PMC_WAKE_PCIE[1]# */ |
| 164 | GPIO_INPUT_PD_10K, /* GPIO_S5[02] RESERVED RESERVED RESERVED PMC_WAKE_PCIE[2]# */ |
| 165 | GPIO_INPUT_PD_10K, /* GPIO_S5[03] RESERVED RESERVED RESERVED PMC_WAKE_PCIE[3]# */ |
| 166 | GPIO_INPUT_PD_10K, /* GPIO_S5[04] RESERVED RESERVED RESERVED RESERVED */ |
| 167 | GPIO_INPUT_PD_10K, /* GPIO_S5[05] PMC_SUSCLK[1] RESERVED RESERVED RESERVED */ |
| 168 | GPIO_INPUT_PD_10K, /* GPIO_S5[06] PMC_SUSCLK[2] RESERVED RESERVED RESERVED */ |
| 169 | GPIO_INPUT_PD_10K, /* GPIO_S5[07] PMC_SUSCLK[3] RESERVED RESERVED RESERVED */ |
| 170 | GPIO_INPUT_PU_10K, /* GPIO_S5[08] RESERVED RESERVED RESERVED RESERVED */ |
| 171 | GPIO_INPUT_PU_10K, /* GPIO_S5[09] RESERVED RESERVED ESERVED RESERVED */ |
Werner Zeh | 5fc6f90 | 2015-09-02 15:13:04 +0200 | [diff] [blame] | 172 | GPIO_OUT_HIGH, /* GPIO_S5[10] RESERVED RESERVED RESERVED */ |
Werner Zeh | c42a613 | 2015-02-12 12:40:15 +0100 | [diff] [blame] | 173 | GPIO_DEFAULT, /* PMC_SUSPWRDNACK GPIO_S5[11] - - */ |
| 174 | GPIO_DEFAULT, /* PMC_SUSCLK[0] GPIO_S5[12] - - */ |
| 175 | GPIO_DEFAULT, /* RESERVED GPIO_S5[13] - - */ |
| 176 | GPIO_DEFAULT, /* RESERVED GPIO_S5[14] USB_ULPI_RST# - */ |
| 177 | GPIO_DEFAULT, /* PMC_WAKE_PCIE[0]# GPIO_S5[15] - - */ |
| 178 | GPIO_DEFAULT, /* PMC_PWRBTN# GPIO_S5[16] - - */ |
| 179 | GPIO_DEFAULT, /* RESERVED GPIO_S5[17] - - */ |
| 180 | GPIO_DEFAULT, /* PMC_SUS_STAT# GPIO_S5[18] - - */ |
| 181 | GPIO_DEFAULT, /* USB_OC[0]# GPIO_S5[19] - - */ |
| 182 | GPIO_DEFAULT, /* USB_OC[1]# GPIO_S5[20] - - */ |
| 183 | GPIO_DEFAULT, /* PCU_SPI_CS[1]# GPIO_S5[21] - */ |
| 184 | GPIO_DEFAULT, /* GPIO_S5[22] RESERVED RESERVED RESERVED RESERVED */ |
| 185 | GPIO_DEFAULT, /* GPIO_S5[23] RESERVED RESERVED RESERVED RESERVED */ |
| 186 | GPIO_DEFAULT, /* GPIO_S5[24] RESERVED RESERVED RESERVED RESERVED */ |
| 187 | GPIO_DEFAULT, /* GPIO_S5[25] RESERVED RESERVED RESERVED RESERVED */ |
| 188 | GPIO_DEFAULT, /* GPIO_S5[26] RESERVED RESERVED RESERVED RESERVED */ |
| 189 | GPIO_DEFAULT, /* GPIO_S5[27] RESERVED RESERVED ESERVED RESERVED */ |
| 190 | GPIO_DEFAULT, /* GPIO_S5[28] RESERVED RESERVED RESERVED RESERVED */ |
| 191 | GPIO_DEFAULT, /* GPIO_S5[29] RESERVED RESERVED RESERVED RESERVED */ |
| 192 | GPIO_DEFAULT, /* GPIO_S5[30] RESERVED RESERVED RESERVED RESERVED */ |
Werner Zeh | 5fc6f90 | 2015-09-02 15:13:04 +0200 | [diff] [blame] | 193 | GPIO_OUT_LOW, /* GPIO_S5[31] USB_ULPI_CLK RESERVED RESERVED */ |
Werner Zeh | c42a613 | 2015-02-12 12:40:15 +0100 | [diff] [blame] | 194 | GPIO_INPUT_PD_10K, /* GPIO_S5[32] USB_ULPI_DATA[0] RESERVED RESERVED */ |
| 195 | GPIO_INPUT_PD_10K, /* GPIO_S5[33] USB_ULPI_DATA[1] RESERVED RESERVED */ |
| 196 | GPIO_INPUT_PD_10K, /* GPIO_S5[34] USB_ULPI_DATA[2] RESERVED RESERVED */ |
| 197 | GPIO_INPUT_PD_10K, /* GPIO_S5[35] USB_ULPI_DATA[3] RESERVED RESERVED */ |
| 198 | GPIO_INPUT_PD_10K, /* GPIO_S5[36] USB_ULPI_DATA[4] RESERVED RESERVED */ |
| 199 | GPIO_INPUT_PD_10K, /* GPIO_S5[37] USB_ULPI_DATA[5] RESERVED RESERVED */ |
| 200 | GPIO_INPUT_PD_10K, /* GPIO_S5[38] USB_ULPI_DATA[6] RESERVED RESERVED */ |
| 201 | GPIO_INPUT_PD_10K, /* GPIO_S5[39] USB_ULPI_DATA[7] RESERVED RESERVED */ |
| 202 | GPIO_INPUT_PD_20K, /* GPIO_S5[40] USB_ULPI_DIR RESERVED RESERVED */ |
| 203 | GPIO_INPUT_PD_20K, /* GPIO_S5[41] USB_ULPI_NXT RESERVED RESERVED */ |
| 204 | GPIO_INPUT_PD_20K, /* GPIO_S5[42] USB_ULPI_STP RESERVED RESERVED */ |
| 205 | GPIO_INPUT_PD_20K, /* GPIO_S5[43] USB_ULPI_REFCLK RESERVED RESERVED */ |
| 206 | GPIO_END |
| 207 | }; |
| 208 | |
| 209 | static struct soc_gpio_config gpio_config = { |
| 210 | .ncore = gpncore_gpio_map, |
| 211 | .score = gpscore_gpio_map, |
| 212 | .ssus = gpssus_gpio_map, |
| 213 | .core_dirq = NULL, |
| 214 | .sus_dirq = NULL, |
| 215 | }; |
| 216 | |
| 217 | struct soc_gpio_config* mainboard_get_gpios(void) |
| 218 | { |
| 219 | return &gpio_config; |
| 220 | } |