From f6106718a80474d35ce17c35195844afb7ced0a9 Mon Sep 17 00:00:00 2001 From: Justin TerAvest Date: Tue, 20 Feb 2018 13:49:55 -0700 Subject: mb/google/kahlee: Use GPIO macros for baseboard This commit uses newly defined macros to make it easier to read which iomux function pads are being configured to use. TEST=Booted grunt, confirmed display backlight came on. BUG=b:72875858 Change-Id: I24e5091fc7ef696f8e9c932ce04664e6cc3ccb90 Signed-off-by: Justin TerAvest Reviewed-on: https://review.coreboot.org/23830 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth Reviewed-by: Aaron Durbin --- .../google/kahlee/variants/baseboard/gpio.c | 146 ++++++++++----------- 1 file changed, 71 insertions(+), 75 deletions(-) diff --git a/src/mainboard/google/kahlee/variants/baseboard/gpio.c b/src/mainboard/google/kahlee/variants/baseboard/gpio.c index fb7ae96d13..de70be40d3 100644 --- a/src/mainboard/google/kahlee/variants/baseboard/gpio.c +++ b/src/mainboard/google/kahlee/variants/baseboard/gpio.c @@ -13,7 +13,6 @@ * GNU General Public License for more details. */ -#include #include #include #include @@ -21,101 +20,98 @@ #include /* - * These settings were generated by a spreadsheet. If they need to be updated, - * update the spreadsheet shared with the Grunt development team. - * * As a rule of thumb, GPIO pins used by coreboot should be initialized at * bootblock while GPIO pins used only by the OS should be initialized at * ramstage. */ const static struct soc_amd_stoneyridge_gpio gpio_set_stage_reset[] = { /* GPIO_0 - EC_PCH_PWR_BTN_ODL */ - { GPIO_0, Function0, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_NF(GPIO_0, PWR_BTN_L, PULL_UP), /* GPIO_1 - SYS_RST_ODL */ - { GPIO_1, Function0, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_NF(GPIO_1, SYS_RESET_L, PULL_UP), /* GPIO_3 - MEM_VOLT_SEL */ - { GPIO_3, Function0, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_GPI(GPIO_3, PULL_UP), /* GPIO_4 - EN_PP3300_WLAN */ - { GPIO_4, Function0, OUTPUT_H }, + PAD_GPO(GPIO_4, HIGH), /* GPIO_5 - PCH_TRACKPAD_INT_3V3_ODL, SCI */ - { GPIO_5, Function0, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_GPI(GPIO_5, PULL_UP), /* GPIO_6 - APU_RST_L / EC_SMI_ODL, SMI */ - { GPIO_6, Function0, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_GPI(GPIO_6, PULL_UP), /* GPIO_7 - APU_PWROK_OD (currently not used) */ - { GPIO_7, Function0, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_GPI(GPIO_7, PULL_UP), /* GPIO_8 - DDR_ALERT_3V3_L (currently not used) */ - { GPIO_8, Function0, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_GPI(GPIO_8, PULL_UP), /* GPIO_9 - H1_PCH_INT_ODL, SCI */ - { GPIO_9, Function0, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_GPI(GPIO_9, PULL_UP), /* GPIO_11 - TOUCHSCREEN_INT_3V3_ODL, SCI */ - { GPIO_11, Function0, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_GPI(GPIO_11, PULL_UP), /* GPIO_14 - APU_HP_INT_ODL, SCI */ - { GPIO_14, Function1, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_GPI(GPIO_14, PULL_UP), /* GPIO_15 - EC_IN_RW_OD */ - { GPIO_15, Function1, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_GPI(GPIO_15, PULL_UP), /* GPIO_19 - APU_I2C_SCL3 (Touchscreen) */ - { GPIO_19, Function1, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_NF(GPIO_19, I2C3_SCL, PULL_UP), /* GPIO_20 - APU_I2C_SDA3 (Touchscreen) */ - { GPIO_20, Function1, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_NF(GPIO_20, I2C3_SDA, PULL_UP), /* GPIO_21 - APU_PEN_INT_ODL, SCI */ - { GPIO_21, Function1, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_GPI(GPIO_21, PULL_UP), /* GPIO_22 - EC_SCI_ODL, SCI */ - { GPIO_22, Function1, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_GPI(GPIO_22, PULL_UP), /* GPIO_23 - ACOK_OD */ /* GPIO_24 - USB_A1_OC_ODL */ - { GPIO_24, Function0, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_NF(GPIO_24, USB_OC3_L, PULL_UP), /* GPIO_25 - SD_CD */ - { GPIO_25, Function0, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_NF(GPIO_25, SD0_CD, PULL_UP), /* GPIO_26 - APU_PCIE_RST_L */ - { GPIO_26, Function0, INPUT }, + PAD_NF(GPIO_26, PCIE_RST_L, PULL_NONE), /* GPIO_40 - EMMC_BRIDGE_RST_L */ - { GPIO_40, Function0, OUTPUT_H }, + PAD_GPO(GPIO_40, HIGH), /* GPIO_42 - S5_MUX_CTRL */ - { GPIO_42, Function0, INPUT }, + PAD_NF(GPIO_42, S5_MUX_CTRL, PULL_NONE), /* GPIO_70 - WLAN_PE_RST_L */ - { GPIO_70, Function0, OUTPUT_H }, + PAD_GPO(GPIO_70, HIGH), /* GPIO_74 - LPC_CLK0_EC_R */ - { GPIO_74, Function0, FCH_GPIO_PULL_DOWN_ENABLE | INPUT }, + PAD_NF(GPIO_74, LPCCLK0, PULL_DOWN), /* GPIO_84 - HUB_RST (Active High) */ - { GPIO_84, Function1, OUTPUT_L }, + PAD_GPO(GPIO_84, LOW), /* GPIO_85 - TOUCHSCREEN_RST (Active High) */ - { GPIO_85, Function1, OUTPUT_L }, + PAD_GPO(GPIO_85, LOW), /* GPIO_87 - LPC_SERIRQ */ - { GPIO_87, Function0, INPUT }, + PAD_NF(GPIO_87, SERIRQ, PULL_NONE), /* GPIO_88 - LPC_CLKRUN_L */ - { GPIO_88, Function0, INPUT }, + PAD_NF(GPIO_88, LPC_CLKRUN_L, PULL_NONE), /* GPIO_92 - WLAN_PCIE_CLKREQ_3V3_ODL */ - { GPIO_92, Function0, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_NF(GPIO_92, CLK_REQ0_L, PULL_UP), /* GPIO_93 - EMMC_RST_L */ - { GPIO_93, Function1, OUTPUT_H }, + PAD_GPO(GPIO_93, HIGH), /* GPIO_95 - SD_CLK */ /* GPIO_96 - SD_CMD */ @@ -125,137 +121,137 @@ const static struct soc_amd_stoneyridge_gpio gpio_set_stage_reset[] = { /* GPIO_100 - SD_D3 */ /* GPIO_101 - SD_WP_L */ - { GPIO_101, Function0, FCH_GPIO_PULL_DOWN_ENABLE | INPUT }, + PAD_NF(GPIO_101, SD0_WP, PULL_DOWN), /* GPIO_116 - PCIE_EMMC_CLKREQ_L */ - { GPIO_116, Function0, INPUT }, + PAD_NF(GPIO_116, CLK_REQ2_L, PULL_NONE), /* GPIO_117 - PCH_SPI_CLK_R */ /* GPIO_118 - PCH_SPI_CS0_L */ - { GPIO_118, Function0, INPUT }, + PAD_NF(GPIO_118, SPI_CS1_L, PULL_NONE), /* GPIO_119 - SPK_PA_EN */ - { GPIO_119, Function2, OUTPUT_H }, + PAD_GPO(GPIO_119, HIGH), /* GPIO_120 - PCH_SPI_MISO */ /* GPIO_121 - PCH_SPI_MOSI */ /* GPIO_122 - APU_BIOS_FLASH_WP_L */ - { GPIO_122, Function1, INPUT }, + PAD_GPI(GPIO_122, PULL_NONE), /* GPIO_126 - DMIC_CLK2_EN */ - { GPIO_126, Function1, OUTPUT_H }, + PAD_GPO(GPIO_126, HIGH), /* GPIO_129 - APU_KBRST_L */ - { GPIO_129, Function0, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_NF(GPIO_129, KBRST_L, PULL_UP), /* GPIO_131 - CONFIG_STRAP3 */ - { GPIO_131, Function3, INPUT }, + PAD_GPI(GPIO_131, PULL_NONE), /* GPIO_132 - CONFIG_STRAP4 */ - { GPIO_132, Function2, INPUT }, + PAD_GPI(GPIO_132, PULL_NONE), /* GPIO_133 - APU_EDP_BKLTEN_L (backlight - Active LOW) */ - { GPIO_133, Function1, OUTPUT_L }, + PAD_GPO(GPIO_133, LOW), /* GPIO_136 - UART_PCH_RX_DEBUG_TX */ - { GPIO_136, Function0, INPUT }, + PAD_NF(GPIO_136, UART0_RXD, PULL_NONE), /* GPIO_137 - AUDIO_CLK_EN (Remove in EVT?) */ - { GPIO_137, Function1, OUTPUT_H }, + PAD_GPO(GPIO_137, HIGH), /* GPIO_138 - UART_PCH_TX_DEBUG_RX */ - { GPIO_138, Function0, INPUT }, + PAD_NF(GPIO_138, UART0_TXD, PULL_NONE), /* GPIO_139 - CONFIG_STRAP1 */ - { GPIO_139, Function1, INPUT }, + PAD_GPI(GPIO_139, PULL_NONE), /* GPIO_140 - I2S_BCLK_R (init to func0, used for I2S) */ - { GPIO_140, Function0, INPUT }, + PAD_NF(GPIO_140, UART1_CTS_L, PULL_NONE), /* GPIO_141 - I2S2_DATA_MIC2 (init to func0, used for I2S) */ - { GPIO_141, Function0, INPUT }, + PAD_NF(GPIO_141, UART1_RXD, PULL_NONE), /* GPIO_142 - CONFIG_STRAP2 */ - { GPIO_142, Function1, INPUT }, + PAD_GPI(GPIO_142, PULL_NONE), /* GPIO_143 - I2S2_DATA (init to func0, used for I2S) */ - { GPIO_143, Function0, INPUT }, + PAD_NF(GPIO_143, UART1_TXD, PULL_NONE), /* GPIO_144 - I2S_LR_R (init to func0, used for I2S) */ - { GPIO_144, Function0, INPUT }, + PAD_NF(GPIO_144, UART1_INTR, PULL_NONE), /* GPIO_145 - PCH_I2C_AUDIO_SCL */ - { GPIO_145, Function0, INPUT }, + PAD_NF(GPIO_145, I2C0_SCL, PULL_NONE), /* GPIO_146 - PCH_I2C_AUDIO_SDA */ - { GPIO_146, Function0, INPUT }, + PAD_NF(GPIO_146, I2C0_SDA, PULL_NONE), /* GPIO_147 - PCH_I2C_H1_TPM_SCL */ - { GPIO_147, Function0, INPUT }, + PAD_NF(GPIO_147, I2C1_SCL, PULL_NONE), /* GPIO_148 - PCH_I2C_H1_TPM_SDA */ - { GPIO_148, Function0, INPUT }, + PAD_NF(GPIO_148, I2C1_SDA, PULL_NONE), }; const static struct soc_amd_stoneyridge_gpio gpio_set_stage_ram[] = { /* GPIO_2 - WLAN_PCIE_WAKE_3V3_ODL */ - { GPIO_2, Function0, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_NF(GPIO_2, WAKE_L, PULL_UP), /* GPIO_10 - SLP_S0_L (currently not used) */ - { GPIO_10, Function0, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_NF(GPIO_10, S0A3_GPIO, PULL_UP), /* GPIO_12 - Unused (TP126) */ - { GPIO_12, Function2, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_GPI(GPIO_12, PULL_UP), /* GPIO_13 - APU_PEN_PDCT_ODL (currently not used) */ - { GPIO_13, Function1, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_GPI(GPIO_13, PULL_UP), /* GPIO_16 - USB_C0_OC_L */ - { GPIO_16, Function0, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_NF(GPIO_16, USB_OC0_L, PULL_UP), /* GPIO_17 - USB_C1_OC_L */ - { GPIO_17, Function0, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_NF(GPIO_17, USB_OC1_L, PULL_UP), /* GPIO_18 - USB_A0_OC_ODL */ - { GPIO_18, Function0, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_NF(GPIO_18, USB_OC2_L, PULL_UP), /* GPIO_67 - PEN_RESET */ - { GPIO_67, Function0, OUTPUT_L }, + PAD_GPO(GPIO_67, LOW), /* GPIO_75 - Unused (strap) (R139/R130) */ - { GPIO_75, Function1, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_GPI(GPIO_75, PULL_UP), /* GPIO_76 - EN_PP3300_TOUCHSCREEN */ - { GPIO_76, Function0, OUTPUT_H }, + PAD_GPO(GPIO_76, HIGH), /* GPIO_86 - Unused (TP109) */ - { GPIO_86, Function1, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_GPI(GPIO_86, PULL_UP), /* GPIO_90 - EN_PP3300_CAMERA */ - { GPIO_90, Function0, OUTPUT_H }, + PAD_GPO(GPIO_90, HIGH), /* GPIO_91 - EN_PP3300_TRACKPAD */ - { GPIO_91, Function1, OUTPUT_H }, + PAD_GPO(GPIO_91, HIGH), /* GPIO_102 - EN_SD_SOCKET_PWR */ - { GPIO_102, Function0, FCH_GPIO_PULL_DOWN_ENABLE | INPUT }, + PAD_NF(GPIO_102, SD0_PWR_CTRL, PULL_DOWN), /* GPIO_113 - APU_I2C_SCL2 (Pen & Trackpad) */ - { GPIO_113, Function1, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_NF(GPIO_113, I2C2_SCL, PULL_UP), /* GPIO_114 - APU_I2C_SDA2 (Pen & Trackpad) */ - { GPIO_114, Function1, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_NF(GPIO_114, I2C2_SDA, PULL_UP), /* GPIO_115 - Unused (TP127) */ - { GPIO_115, Function1, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_GPI(GPIO_115, PULL_UP), /* GPIO_130 - Unused (TP55) */ - { GPIO_130, Function1, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_GPI(GPIO_130, PULL_UP), /* GPIO_135 - Unused (TP128) */ - { GPIO_135, Function1, FCH_GPIO_PULL_UP_ENABLE | INPUT }, + PAD_GPI(GPIO_135, PULL_UP), }; const __attribute__((weak)) -- cgit v1.2.3