diff options
author | Steven Jian <steven.jian@intel.com> | 2015-04-01 01:25:42 +0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-05-27 03:58:16 +0000 |
commit | 937cc8a64e5971def21303e7a19a4ad9553e0ace (patch) | |
tree | 321543152e0c4d61e686ca7b92edd0d027bb168b | |
parent | e216906c9327655d71b8758b7f11c2f744e55018 (diff) | |
download | chrome-ec-937cc8a64e5971def21303e7a19a4ad9553e0ace.tar.gz |
mec1322: Simplify GPIO lists
Our existing GPIO macros use port# / gpio#, but the concept of different
GPIO ports does not exist on the mec1322. Therefore, add new GPIO macros
for chips which do not have distinct GPIO ports.
BUG=None
BRANCH=None
TEST=make buildall -j
Change-Id: Ibda97c6563ad447d16dab39ecadab43ccb25174b
Signed-off-by: Steven Jian <steven.jian@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/262841
Reviewed-by: Anton Staaf <robotboy@chromium.org>
62 files changed, 2263 insertions, 2237 deletions
diff --git a/board/auron/gpio.inc b/board/auron/gpio.inc index 0ce95b1f43..0cbd553a5a 100644 --- a/board/auron/gpio.inc +++ b/board/auron/gpio.inc @@ -6,96 +6,96 @@ */ /* Inputs with interrupt handlers are first for efficiency */ -GPIO_INT(POWER_BUTTON_L, A, 2, GPIO_INT_BOTH_DSLEEP, power_button_interrupt) /* Power button */ -GPIO_INT(LID_OPEN, A, 3, GPIO_INT_BOTH_DSLEEP, lid_interrupt) /* Lid switch */ -GPIO_INT(AC_PRESENT, H, 3, GPIO_INT_BOTH_DSLEEP, extpower_interrupt) /* AC power present */ -GPIO_INT(PCH_BKLTEN, M, 3, GPIO_INT_BOTH, backlight_interrupt) /* Backlight enable signal from PCH */ -GPIO_INT(PCH_SLP_S0_L, G, 6, GPIO_INT_BOTH, power_signal_interrupt) /* SLP_S0# signal from PCH */ -GPIO_INT(PCH_SLP_S3_L, G, 7, GPIO_INT_BOTH_DSLEEP, power_signal_interrupt) /* SLP_S3# signal from PCH */ -GPIO_INT(PCH_SLP_S5_L, H, 1, GPIO_INT_BOTH_DSLEEP, power_signal_interrupt) /* SLP_S5# signal from PCH */ -GPIO_INT(PCH_SLP_SUS_L, G, 3, GPIO_INT_BOTH, power_signal_interrupt) /* SLP_SUS# signal from PCH */ -GPIO_INT(PP1050_PGOOD, H, 4, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 1.05V */ -GPIO_INT(PP1350_PGOOD, H, 6, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 1.35V (DRAM) */ -GPIO_INT(PP5000_PGOOD, N, 0, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 5V */ -GPIO_INT(VCORE_PGOOD, C, 6, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on core VR */ -GPIO_INT(PCH_EDP_VDD_EN, J, 1, GPIO_INT_BOTH, power_interrupt) /* PCH wants EDP enabled */ -GPIO_INT(RECOVERY_L, A, 5, GPIO_PULL_UP | GPIO_INT_BOTH, switch_interrupt) /* Recovery signal from servo */ -GPIO_INT(WP_L, A, 4, GPIO_INT_BOTH, switch_interrupt) /* Write protect input */ -GPIO_INT(JTAG_TCK, C, 0, GPIO_DEFAULT, jtag_interrupt) /* JTAG clock input */ -GPIO_INT(UART0_RX, A, 0, GPIO_PULL_UP | GPIO_INT_BOTH_DSLEEP, uart_deepsleep_interrupt) /* UART0 RX input */ +GPIO_INT(POWER_BUTTON_L, PIN(A, 2), GPIO_INT_BOTH_DSLEEP, power_button_interrupt) /* Power button */ +GPIO_INT(LID_OPEN, PIN(A, 3), GPIO_INT_BOTH_DSLEEP, lid_interrupt) /* Lid switch */ +GPIO_INT(AC_PRESENT, PIN(H, 3), GPIO_INT_BOTH_DSLEEP, extpower_interrupt) /* AC power present */ +GPIO_INT(PCH_BKLTEN, PIN(M, 3), GPIO_INT_BOTH, backlight_interrupt) /* Backlight enable signal from PCH */ +GPIO_INT(PCH_SLP_S0_L, PIN(G, 6), GPIO_INT_BOTH, power_signal_interrupt) /* SLP_S0# signal from PCH */ +GPIO_INT(PCH_SLP_S3_L, PIN(G, 7), GPIO_INT_BOTH_DSLEEP, power_signal_interrupt) /* SLP_S3# signal from PCH */ +GPIO_INT(PCH_SLP_S5_L, PIN(H, 1), GPIO_INT_BOTH_DSLEEP, power_signal_interrupt) /* SLP_S5# signal from PCH */ +GPIO_INT(PCH_SLP_SUS_L, PIN(G, 3), GPIO_INT_BOTH, power_signal_interrupt) /* SLP_SUS# signal from PCH */ +GPIO_INT(PP1050_PGOOD, PIN(H, 4), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 1.05V */ +GPIO_INT(PP1350_PGOOD, PIN(H, 6), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 1.35V (DRAM) */ +GPIO_INT(PP5000_PGOOD, PIN(N, 0), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 5V */ +GPIO_INT(VCORE_PGOOD, PIN(C, 6), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on core VR */ +GPIO_INT(PCH_EDP_VDD_EN, PIN(J, 1), GPIO_INT_BOTH, power_interrupt) /* PCH wants EDP enabled */ +GPIO_INT(RECOVERY_L, PIN(A, 5), GPIO_PULL_UP | GPIO_INT_BOTH, switch_interrupt) /* Recovery signal from servo */ +GPIO_INT(WP_L, PIN(A, 4), GPIO_INT_BOTH, switch_interrupt) /* Write protect input */ +GPIO_INT(JTAG_TCK, PIN(C, 0), GPIO_DEFAULT, jtag_interrupt) /* JTAG clock input */ +GPIO_INT(UART0_RX, PIN(A, 0), GPIO_PULL_UP | GPIO_INT_BOTH_DSLEEP, uart_deepsleep_interrupt) /* UART0 RX input */ /* Other inputs */ -GPIO(FAN_ALERT_L, B, 0, GPIO_INPUT) /* From thermal sensor */ -GPIO(PCH_SUSWARN_L, G, 2, GPIO_INT_BOTH) /* SUSWARN# signal from PCH */ -GPIO(USB1_OC_L, E, 7, GPIO_INPUT) /* USB port overcurrent warning */ -GPIO(USB2_OC_L, E, 0, GPIO_INPUT) /* USB port overcurrent warning */ -GPIO(BOARD_VERSION1, Q, 5, GPIO_INPUT) /* Board version stuffing resistor 1 */ -GPIO(BOARD_VERSION2, Q, 6, GPIO_INPUT) /* Board version stuffing resistor 2 */ -GPIO(BOARD_VERSION3, Q, 7, GPIO_INPUT) /* Board version stuffing resistor 3 */ -GPIO(CPU_PGOOD, C, 4, GPIO_INPUT) /* Power good to the CPU */ -GPIO(BAT_PRESENT_L, B, 4, GPIO_INPUT) /* Battery present. Repurposed BAT_TEMP */ +GPIO(FAN_ALERT_L, PIN(B, 0), GPIO_INPUT) /* From thermal sensor */ +GPIO(PCH_SUSWARN_L, PIN(G, 2), GPIO_INT_BOTH) /* SUSWARN# signal from PCH */ +GPIO(USB1_OC_L, PIN(E, 7), GPIO_INPUT) /* USB port overcurrent warning */ +GPIO(USB2_OC_L, PIN(E, 0), GPIO_INPUT) /* USB port overcurrent warning */ +GPIO(BOARD_VERSION1, PIN(Q, 5), GPIO_INPUT) /* Board version stuffing resistor 1 */ +GPIO(BOARD_VERSION2, PIN(Q, 6), GPIO_INPUT) /* Board version stuffing resistor 2 */ +GPIO(BOARD_VERSION3, PIN(Q, 7), GPIO_INPUT) /* Board version stuffing resistor 3 */ +GPIO(CPU_PGOOD, PIN(C, 4), GPIO_INPUT) /* Power good to the CPU */ +GPIO(BAT_PRESENT_L, PIN(B, 4), GPIO_INPUT) /* Battery present. Repurposed BAT_TEMP */ /* Outputs; all unasserted by default except for reset signals */ -GPIO(CPU_PROCHOT, B, 1, GPIO_OUT_LOW) /* Force CPU to think it's overheated */ -GPIO(PP1350_EN, H, 5, GPIO_OUT_LOW) /* Enable 1.35V supply */ -GPIO(PP3300_DX_EN, J, 2, GPIO_OUT_LOW) /* Enable power to lots of peripherals */ -GPIO(PP3300_LTE_EN, D, 2, GPIO_OUT_LOW) /* Enable LTE radio */ -GPIO(PP3300_WLAN_EN, J, 0, GPIO_OUT_LOW) /* Enable WiFi power */ -GPIO(SUSP_VR_EN, C, 7, GPIO_OUT_LOW) /* Enable 1.05V regulator */ -GPIO(VCORE_EN, C, 5, GPIO_OUT_LOW) /* Stuffing option - not connected */ -GPIO(PP5000_EN, H, 7, GPIO_OUT_LOW) /* Enable 5V supply */ -GPIO(PP5000_FAN_EN, J, 3, GPIO_OUT_LOW) /* Enable fan power rail */ -GPIO(SYS_PWROK, H, 2, GPIO_OUT_LOW) /* EC thinks everything is up and ready */ -GPIO(WLAN_OFF_L, J, 4, GPIO_OUT_LOW) /* Disable WiFi radio */ -GPIO(CHARGE_L, E, 6, GPIO_OUT_LOW) /* Allow battery to charge when on AC */ +GPIO(CPU_PROCHOT, PIN(B, 1), GPIO_OUT_LOW) /* Force CPU to think it's overheated */ +GPIO(PP1350_EN, PIN(H, 5), GPIO_OUT_LOW) /* Enable 1.35V supply */ +GPIO(PP3300_DX_EN, PIN(J, 2), GPIO_OUT_LOW) /* Enable power to lots of peripherals */ +GPIO(PP3300_LTE_EN, PIN(D, 2), GPIO_OUT_LOW) /* Enable LTE radio */ +GPIO(PP3300_WLAN_EN, PIN(J, 0), GPIO_OUT_LOW) /* Enable WiFi power */ +GPIO(SUSP_VR_EN, PIN(C, 7), GPIO_OUT_LOW) /* Enable 1.05V regulator */ +GPIO(VCORE_EN, PIN(C, 5), GPIO_OUT_LOW) /* Stuffing option - not connected */ +GPIO(PP5000_EN, PIN(H, 7), GPIO_OUT_LOW) /* Enable 5V supply */ +GPIO(PP5000_FAN_EN, PIN(J, 3), GPIO_OUT_LOW) /* Enable fan power rail */ +GPIO(SYS_PWROK, PIN(H, 2), GPIO_OUT_LOW) /* EC thinks everything is up and ready */ +GPIO(WLAN_OFF_L, PIN(J, 4), GPIO_OUT_LOW) /* Disable WiFi radio */ +GPIO(CHARGE_L, PIN(E, 6), GPIO_OUT_LOW) /* Allow battery to charge when on AC */ -GPIO(ENABLE_BACKLIGHT, M, 7, GPIO_OUT_LOW) /* Enable backlight power */ -GPIO(ENABLE_TOUCHPAD, N, 1, GPIO_OUT_LOW) /* Enable touchpad power */ -GPIO(ENTERING_RW, D, 3, GPIO_OUT_LOW) /* Indicate when EC is entering RW code */ -GPIO(PCH_DPWROK, G, 0, GPIO_OUT_LOW) /* Indicate when VccDSW is good */ +GPIO(ENABLE_BACKLIGHT, PIN(M, 7), GPIO_OUT_LOW) /* Enable backlight power */ +GPIO(ENABLE_TOUCHPAD, PIN(N, 1), GPIO_OUT_LOW) /* Enable touchpad power */ +GPIO(ENTERING_RW, PIN(D, 3), GPIO_OUT_LOW) /* Indicate when EC is entering RW code */ +GPIO(PCH_DPWROK, PIN(G, 0), GPIO_OUT_LOW) /* Indicate when VccDSW is good */ /* * HDA_SDO is technically an output, but we need to leave it as an * input until we drive it high. So can't use open-drain (HI_Z). */ -GPIO(PCH_HDA_SDO, G, 1, GPIO_INPUT) /* HDA_SDO signal to PCH; when high, ME ignores security descriptor */ -GPIO(PCH_WAKE_L, F, 0, GPIO_OUT_HIGH) /* Wake signal from EC to PCH */ -GPIO(PCH_NMI_L, F, 2, GPIO_OUT_HIGH) /* Non-maskable interrupt pin to PCH */ -GPIO(PCH_PWRBTN_L, H, 0, GPIO_OUT_HIGH) /* Power button output to PCH */ -GPIO(PCH_PWROK, F, 5, GPIO_OUT_LOW) /* PWROK / APWROK signals to PCH */ +GPIO(PCH_HDA_SDO, PIN(G, 1), GPIO_INPUT) /* HDA_SDO signal to PCH; when high, ME ignores security descriptor */ +GPIO(PCH_WAKE_L, PIN(F, 0), GPIO_OUT_HIGH) /* Wake signal from EC to PCH */ +GPIO(PCH_NMI_L, PIN(F, 2), GPIO_OUT_HIGH) /* Non-maskable interrupt pin to PCH */ +GPIO(PCH_PWRBTN_L, PIN(H, 0), GPIO_OUT_HIGH) /* Power button output to PCH */ +GPIO(PCH_PWROK, PIN(F, 5), GPIO_OUT_LOW) /* PWROK / APWROK signals to PCH */ /* * PL6 is one of 4 pins on the EC which can't be used in open-drain * mode. To work around this PCH_RCIN_L is set to an input. It will * only be set to an output when it needs to be driven to 0. */ -GPIO(PCH_RCIN_L, L, 6, GPIO_INPUT) /* RCIN# line to PCH (for 8042 emulation) */ -GPIO(PCH_RSMRST_L, F, 1, GPIO_OUT_LOW) /* Reset PCH resume power plane logic */ -GPIO(PCH_SMI_L, F, 4, GPIO_ODR_HIGH) /* System management interrupt to PCH */ -GPIO(TOUCHSCREEN_RESET_L, N, 7, GPIO_OUT_LOW) /* Reset touch screen */ -GPIO(EC_EDP_VDD_EN, J, 5, GPIO_OUT_LOW) /* Enable EDP (passthru from PCH) */ +GPIO(PCH_RCIN_L, PIN(L, 6), GPIO_INPUT) /* RCIN# line to PCH (for 8042 emulation) */ +GPIO(PCH_RSMRST_L, PIN(F, 1), GPIO_OUT_LOW) /* Reset PCH resume power plane logic */ +GPIO(PCH_SMI_L, PIN(F, 4), GPIO_ODR_HIGH) /* System management interrupt to PCH */ +GPIO(TOUCHSCREEN_RESET_L, PIN(N, 7), GPIO_OUT_LOW) /* Reset touch screen */ +GPIO(EC_EDP_VDD_EN, PIN(J, 5), GPIO_OUT_LOW) /* Enable EDP (passthru from PCH) */ -GPIO(LPC_CLKRUN_L, M, 2, GPIO_ODR_HIGH) /* Dunno. Probably important, though. */ -GPIO(USB1_ENABLE, E, 4, GPIO_OUT_LOW) /* USB port 1 output power enable */ -GPIO(USB2_ENABLE, D, 5, GPIO_OUT_LOW) /* USB port 2 output power enable */ +GPIO(LPC_CLKRUN_L, PIN(M, 2), GPIO_ODR_HIGH) /* Dunno. Probably important, though. */ +GPIO(USB1_ENABLE, PIN(E, 4), GPIO_OUT_LOW) /* USB port 1 output power enable */ +GPIO(USB2_ENABLE, PIN(D, 5), GPIO_OUT_LOW) /* USB port 2 output power enable */ -GPIO(PCH_SUSACK_L, F, 3, GPIO_OUT_HIGH) /* Acknowledge PCH SUSWARN# signal */ -GPIO(PCH_RTCRST_L, F, 6, GPIO_ODR_HIGH) /* Not supposed to be here */ -GPIO(PCH_SRTCRST_L, F, 7, GPIO_ODR_HIGH) /* Not supposed to be here */ +GPIO(PCH_SUSACK_L, PIN(F, 3), GPIO_OUT_HIGH) /* Acknowledge PCH SUSWARN# signal */ +GPIO(PCH_RTCRST_L, PIN(F, 6), GPIO_ODR_HIGH) /* Not supposed to be here */ +GPIO(PCH_SRTCRST_L, PIN(F, 7), GPIO_ODR_HIGH) /* Not supposed to be here */ -GPIO(BAT_LED0_L, D, 0, GPIO_ODR_HIGH) /* Battery charging LED - blue */ -GPIO(BAT_LED1_L, N, 4, GPIO_ODR_HIGH) /* Battery charging LED - orange */ -GPIO(PWR_LED0_L, D, 1, GPIO_ODR_HIGH) /* Power LED - blue */ -GPIO(PWR_LED1_L, N, 6, GPIO_ODR_HIGH) /* Power LED - orange */ +GPIO(BAT_LED0_L, PIN(D, 0), GPIO_ODR_HIGH) /* Battery charging LED - blue */ +GPIO(BAT_LED1_L, PIN(N, 4), GPIO_ODR_HIGH) /* Battery charging LED - orange */ +GPIO(PWR_LED0_L, PIN(D, 1), GPIO_ODR_HIGH) /* Power LED - blue */ +GPIO(PWR_LED1_L, PIN(N, 6), GPIO_ODR_HIGH) /* Power LED - orange */ -ALTERNATE(A, 0x03, 1, MODULE_UART, GPIO_PULL_UP) /* UART0 */ -ALTERNATE(B, 0x04, 3, MODULE_I2C, 0) /* I2C0 SCL */ -ALTERNATE(B, 0x08, 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C0 SDA */ -ALTERNATE(B, 0x40, 3, MODULE_I2C, 0) /* I2C5 SCL */ -ALTERNATE(B, 0x80, 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C5 SDA */ -ALTERNATE(G, 0x30, 1, MODULE_UART, 0) /* UART2 */ -ALTERNATE(J, 0x40, 1, MODULE_PECI, 0) /* PECI Tx */ -ALTERNATE(J, 0x80, 0, MODULE_PECI, GPIO_ANALOG) /* PECI Rx */ -ALTERNATE(L, 0x3f, 15, MODULE_LPC, 0) /* LPC */ -ALTERNATE(M, 0x33, 15, MODULE_LPC, 0) /* LPC */ -ALTERNATE(N, 0x0c, 1, MODULE_PWM_FAN, 0) /* FAN0PWM2 */ +ALTERNATE(PIN_MASK(A, 0x03), 1, MODULE_UART, GPIO_PULL_UP) /* UART0 */ +ALTERNATE(PIN_MASK(B, 0x04), 3, MODULE_I2C, 0) /* I2C0 SCL */ +ALTERNATE(PIN_MASK(B, 0x08), 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C0 SDA */ +ALTERNATE(PIN_MASK(B, 0x40), 3, MODULE_I2C, 0) /* I2C5 SCL */ +ALTERNATE(PIN_MASK(B, 0x80), 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C5 SDA */ +ALTERNATE(PIN_MASK(G, 0x30), 1, MODULE_UART, 0) /* UART2 */ +ALTERNATE(PIN_MASK(J, 0x40), 1, MODULE_PECI, 0) /* PECI Tx */ +ALTERNATE(PIN_MASK(J, 0x80), 0, MODULE_PECI, GPIO_ANALOG) /* PECI Rx */ +ALTERNATE(PIN_MASK(L, 0x3f), 15, MODULE_LPC, 0) /* LPC */ +ALTERNATE(PIN_MASK(M, 0x33), 15, MODULE_LPC, 0) /* LPC */ +ALTERNATE(PIN_MASK(N, 0x0c), 1, MODULE_PWM_FAN, 0) /* FAN0PWM2 */ diff --git a/board/bds/gpio.inc b/board/bds/gpio.inc index b1b13057aa..7de4fb6ca7 100644 --- a/board/bds/gpio.inc +++ b/board/bds/gpio.inc @@ -6,8 +6,8 @@ */ /* Recovery signal from DOWN button */ -GPIO(RECOVERY_L, D, 1, GPIO_PULL_UP) -GPIO(DEBUG_LED, A, 7, GPIO_OUT_LOW) +GPIO(RECOVERY_L, PIN(D, 1), GPIO_PULL_UP) +GPIO(DEBUG_LED, PIN(A, 7), GPIO_OUT_LOW) /* * Signals which aren't implemented on BDS but we'll emulate anyway, to @@ -16,7 +16,7 @@ GPIO(DEBUG_LED, A, 7, GPIO_OUT_LOW) UNIMPLEMENTED(WP) /* Write protect input */ UNIMPLEMENTED(ENTERING_RW) /* EC entering RW code */ -ALTERNATE(A, 0x03, 1, MODULE_UART, 0) /* UART0 */ -ALTERNATE(G, 0x40, 3, MODULE_I2C, 0) /* I2C5 SCL */ -ALTERNATE(G, 0x80, 3, GPIO_OPEN_DRAIN, 0) /* I2C5 SDA */ -ALTERNATE(B, 0x03, 1, MODULE_UART, 0) /* UART1 */ +ALTERNATE(PIN_MASK(A, 0x03), 1, MODULE_UART, 0) /* UART0 */ +ALTERNATE(PIN_MASK(G, 0x40), 3, MODULE_I2C, 0) /* I2C5 SCL */ +ALTERNATE(PIN_MASK(G, 0x80), 3, GPIO_OPEN_DRAIN, 0) /* I2C5 SDA */ +ALTERNATE(PIN_MASK(B, 0x03), 1, MODULE_UART, 0) /* UART1 */ diff --git a/board/big/gpio.inc b/board/big/gpio.inc index 54e541f55b..31ed5e30b6 100644 --- a/board/big/gpio.inc +++ b/board/big/gpio.inc @@ -6,57 +6,57 @@ */ /* Inputs with interrupt handlers are first for efficiency */ -GPIO_INT(POWER_BUTTON_L, B, 5, GPIO_INT_BOTH, power_button_interrupt) -GPIO_INT(SOC1V8_XPSHOLD, A, 3, GPIO_INT_BOTH, power_signal_interrupt) -GPIO_INT(LID_OPEN, C, 13, GPIO_INT_BOTH, lid_interrupt) -GPIO_INT(SUSPEND_L, C, 7, GPIO_KB_INPUT, power_signal_interrupt) -GPIO_INT(SPI1_NSS, A, 4, GPIO_INT_BOTH | GPIO_PULL_UP, spi_event) -GPIO_INT(AC_PRESENT, A, 0, GPIO_INT_BOTH, extpower_interrupt) +GPIO_INT(POWER_BUTTON_L, PIN(B, 5), GPIO_INT_BOTH, power_button_interrupt) +GPIO_INT(SOC1V8_XPSHOLD, PIN(A, 3), GPIO_INT_BOTH, power_signal_interrupt) +GPIO_INT(LID_OPEN, PIN(C, 13), GPIO_INT_BOTH, lid_interrupt) +GPIO_INT(SUSPEND_L, PIN(C, 7), GPIO_KB_INPUT, power_signal_interrupt) +GPIO_INT(SPI1_NSS, PIN(A, 4), GPIO_INT_BOTH | GPIO_PULL_UP, spi_event) +GPIO_INT(AC_PRESENT, PIN(A, 0), GPIO_INT_BOTH, extpower_interrupt) /* Keyboard inputs */ -GPIO_INT(KB_IN00, C, 8, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN01, C, 9, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN02, C, 10, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN03, C, 11, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN04, C, 12, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN05, C, 14, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN06, C, 15, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN07, D, 2, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN00, PIN(C, 8), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN01, PIN(C, 9), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN02, PIN(C, 10), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN03, PIN(C, 11), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN04, PIN(C, 12), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN05, PIN(C, 14), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN06, PIN(C, 15), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN07, PIN(D, 2), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) /* Other inputs */ -GPIO(WP_L, B, 4, GPIO_INPUT) +GPIO(WP_L, PIN(B, 4), GPIO_INPUT) /* Outputs */ -GPIO(AP_RESET_L, B, 3, GPIO_ODR_HIGH) -GPIO(CHARGER_EN, B, 2, GPIO_OUT_LOW) -GPIO(EC_INT, B, 9, GPIO_ODR_HIGH) -GPIO(ENTERING_RW, H, 0, GPIO_OUT_LOW) -GPIO(I2C1_SCL, B, 6, GPIO_ODR_HIGH) -GPIO(I2C1_SDA, B, 7, GPIO_ODR_HIGH) -GPIO(LED_POWER_L, A, 2, GPIO_OUT_HIGH) /* PWR_LED1 */ -GPIO(PMIC_PWRON_L, A, 12, GPIO_OUT_HIGH) -GPIO(PMIC_RESET, A, 15, GPIO_OUT_LOW) -GPIO(KB_OUT00, B, 0, GPIO_KB_OUTPUT) -GPIO(KB_OUT01, B, 8, GPIO_KB_OUTPUT) -GPIO(KB_OUT02, B, 12, GPIO_KB_OUTPUT) -GPIO(KB_OUT03, B, 13, GPIO_KB_OUTPUT) -GPIO(KB_OUT04, B, 14, GPIO_KB_OUTPUT) -GPIO(KB_OUT05, B, 15, GPIO_KB_OUTPUT) -GPIO(KB_OUT06, C, 0, GPIO_KB_OUTPUT) -GPIO(KB_OUT07, C, 1, GPIO_KB_OUTPUT) -GPIO(KB_OUT08, C, 2, GPIO_KB_OUTPUT) -GPIO(KB_OUT09, B, 1, GPIO_KB_OUTPUT) -GPIO(KB_OUT10, C, 5, GPIO_KB_OUTPUT) -GPIO(KB_OUT11, C, 4, GPIO_KB_OUTPUT) -GPIO(KB_OUT12, A, 13, GPIO_KB_OUTPUT) -GPIO(PWR_LED0, B, 10, GPIO_OUT_LOW) -GPIO(BAT_LED0, B, 11, GPIO_OUT_LOW) -GPIO(BAT_LED1, A, 8, GPIO_OUT_LOW) -GPIO(CHARGING, A, 11, GPIO_OUT_LOW) -GPIO(EC_BL_OVERRIDE, H, 1, GPIO_ODR_HIGH) -GPIO(PMIC_THERM_L, A, 1, GPIO_ODR_HIGH) -GPIO(PMIC_WARM_RESET_L, C, 3, GPIO_ODR_HIGH) +GPIO(AP_RESET_L, PIN(B, 3), GPIO_ODR_HIGH) +GPIO(CHARGER_EN, PIN(B, 2), GPIO_OUT_LOW) +GPIO(EC_INT, PIN(B, 9), GPIO_ODR_HIGH) +GPIO(ENTERING_RW, PIN(H, 0), GPIO_OUT_LOW) +GPIO(I2C1_SCL, PIN(B, 6), GPIO_ODR_HIGH) +GPIO(I2C1_SDA, PIN(B, 7), GPIO_ODR_HIGH) +GPIO(LED_POWER_L, PIN(A, 2), GPIO_OUT_HIGH) /* PWR_LED1 */ +GPIO(PMIC_PWRON_L, PIN(A, 12), GPIO_OUT_HIGH) +GPIO(PMIC_RESET, PIN(A, 15), GPIO_OUT_LOW) +GPIO(KB_OUT00, PIN(B, 0), GPIO_KB_OUTPUT) +GPIO(KB_OUT01, PIN(B, 8), GPIO_KB_OUTPUT) +GPIO(KB_OUT02, PIN(B, 12), GPIO_KB_OUTPUT) +GPIO(KB_OUT03, PIN(B, 13), GPIO_KB_OUTPUT) +GPIO(KB_OUT04, PIN(B, 14), GPIO_KB_OUTPUT) +GPIO(KB_OUT05, PIN(B, 15), GPIO_KB_OUTPUT) +GPIO(KB_OUT06, PIN(C, 0), GPIO_KB_OUTPUT) +GPIO(KB_OUT07, PIN(C, 1), GPIO_KB_OUTPUT) +GPIO(KB_OUT08, PIN(C, 2), GPIO_KB_OUTPUT) +GPIO(KB_OUT09, PIN(B, 1), GPIO_KB_OUTPUT) +GPIO(KB_OUT10, PIN(C, 5), GPIO_KB_OUTPUT) +GPIO(KB_OUT11, PIN(C, 4), GPIO_KB_OUTPUT) +GPIO(KB_OUT12, PIN(A, 13), GPIO_KB_OUTPUT) +GPIO(PWR_LED0, PIN(B, 10), GPIO_OUT_LOW) +GPIO(BAT_LED0, PIN(B, 11), GPIO_OUT_LOW) +GPIO(BAT_LED1, PIN(A, 8), GPIO_OUT_LOW) +GPIO(CHARGING, PIN(A, 11), GPIO_OUT_LOW) +GPIO(EC_BL_OVERRIDE, PIN(H, 1), GPIO_ODR_HIGH) +GPIO(PMIC_THERM_L, PIN(A, 1), GPIO_ODR_HIGH) +GPIO(PMIC_WARM_RESET_L, PIN(C, 3), GPIO_ODR_HIGH) -ALTERNATE(A, 0x00f0, GPIO_ALT_SPI, MODULE_SPI, GPIO_DEFAULT) -ALTERNATE(A, 0x0600, GPIO_ALT_USART, MODULE_UART, GPIO_DEFAULT) -ALTERNATE(B, 0x00c0, GPIO_ALT_I2C, MODULE_I2C, GPIO_DEFAULT) +ALTERNATE(PIN_MASK(A, 0x00f0), GPIO_ALT_SPI, MODULE_SPI, GPIO_DEFAULT) +ALTERNATE(PIN_MASK(A, 0x0600), GPIO_ALT_USART, MODULE_UART, GPIO_DEFAULT) +ALTERNATE(PIN_MASK(B, 0x00c0), GPIO_ALT_I2C, MODULE_I2C, GPIO_DEFAULT) diff --git a/board/cr50/gpio.inc b/board/cr50/gpio.inc index 8858d04bad..624221cc6b 100644 --- a/board/cr50/gpio.inc +++ b/board/cr50/gpio.inc @@ -7,25 +7,25 @@ /* Inputs with interrupt handlers are first for efficiency */ /* User Push buttons */ -GPIO_INT(SW_N, 0, 0, GPIO_INT_RISING, button_event) -GPIO_INT(SW_S, 0, 1, GPIO_INT_RISING, button_event) -GPIO_INT(SW_W, 0, 2, GPIO_INT_RISING, button_event) -GPIO_INT(SW_E, 0, 3, GPIO_INT_RISING, button_event) +GPIO_INT(SW_N, PIN(0, 0), GPIO_INT_RISING, button_event) +GPIO_INT(SW_S, PIN(0, 1), GPIO_INT_RISING, button_event) +GPIO_INT(SW_W, PIN(0, 2), GPIO_INT_RISING, button_event) +GPIO_INT(SW_E, PIN(0, 3), GPIO_INT_RISING, button_event) /* We can't trigger on both rising and falling edge, so attach each button * to two input GPIOs. */ -GPIO_INT(SW_N_, 1, 0, GPIO_INT_FALLING, button_event) -GPIO_INT(SW_S_, 1, 1, GPIO_INT_FALLING, button_event) -GPIO_INT(SW_W_, 1, 2, GPIO_INT_FALLING, button_event) -GPIO_INT(SW_E_, 1, 3, GPIO_INT_FALLING, button_event) +GPIO_INT(SW_N_, PIN(1, 0), GPIO_INT_FALLING, button_event) +GPIO_INT(SW_S_, PIN(1, 1), GPIO_INT_FALLING, button_event) +GPIO_INT(SW_W_, PIN(1, 2), GPIO_INT_FALLING, button_event) +GPIO_INT(SW_E_, PIN(1, 3), GPIO_INT_FALLING, button_event) /* User GPIO LEDs */ -GPIO(LED_2, 0, 4, GPIO_OUT_LOW) -GPIO(LED_3, 0, 5, GPIO_OUT_LOW) -GPIO(LED_4, 0, 6, GPIO_OUT_LOW) -GPIO(LED_5, 0, 7, GPIO_OUT_LOW) -GPIO(LED_6, 0, 8, GPIO_OUT_LOW) -GPIO(LED_7, 0, 9, GPIO_OUT_LOW) +GPIO(LED_2, PIN(0, 4), GPIO_OUT_LOW) +GPIO(LED_3, PIN(0, 5), GPIO_OUT_LOW) +GPIO(LED_4, PIN(0, 6), GPIO_OUT_LOW) +GPIO(LED_5, PIN(0, 7), GPIO_OUT_LOW) +GPIO(LED_6, PIN(0, 8), GPIO_OUT_LOW) +GPIO(LED_7, PIN(0, 9), GPIO_OUT_LOW) /* Unimplemented signals which we need to emulate for now */ UNIMPLEMENTED(ENTERING_RW) @@ -41,31 +41,32 @@ UNIMPLEMENTED(ENTERING_RW) */ /* The serial port is one of the SoC peripheral functions */ -ALTERNATE(FUNC(UART0_TX), DIO(A0), 0, MODULE_GPIO, DIO_OUTPUT) -ALTERNATE(FUNC(UART0_RX), DIO(A1), 0, MODULE_GPIO, DIO_INPUT) +ALTERNATE(PIN_MASK(FUNC(UART0_TX), DIO(A0)), 0, MODULE_GPIO, DIO_OUTPUT) +ALTERNATE(PIN_MASK(FUNC(UART0_RX), DIO(A1)), 0, MODULE_GPIO, DIO_INPUT) /* Inputs */ -ALTERNATE(SW_N, DIO(M0), 0, MODULE_GPIO, 0) -ALTERNATE(SW_S, DIO(M1), 0, MODULE_GPIO, 0) -ALTERNATE(SW_W, DIO(M2), 0, MODULE_GPIO, 0) -ALTERNATE(SW_E, DIO(M3), 0, MODULE_GPIO, 0) +ALTERNATE(PIN_MASK(SW_N, DIO(M0)), 0, MODULE_GPIO, 0) +ALTERNATE(PIN_MASK(SW_S, DIO(M1)), 0, MODULE_GPIO, 0) +ALTERNATE(PIN_MASK(SW_W, DIO(M2)), 0, MODULE_GPIO, 0) +ALTERNATE(PIN_MASK(SW_E, DIO(M3)), 0, MODULE_GPIO, 0) /* Aliased Inputs, connected to the same pins */ -ALTERNATE(SW_N_, DIO(M0), 0, MODULE_GPIO, 0) -ALTERNATE(SW_S_, DIO(M1), 0, MODULE_GPIO, 0) -ALTERNATE(SW_W_, DIO(M2), 0, MODULE_GPIO, 0) -ALTERNATE(SW_E_, DIO(M3), 0, MODULE_GPIO, 0) +ALTERNATE(PIN_MASK(SW_N_, DIO(M0)), 0, MODULE_GPIO, 0) +ALTERNATE(PIN_MASK(SW_S_, DIO(M1)), 0, MODULE_GPIO, 0) +ALTERNATE(PIN_MASK(SW_W_, DIO(M2)), 0, MODULE_GPIO, 0) +ALTERNATE(PIN_MASK(SW_E_, DIO(M3)), 0, MODULE_GPIO, 0) /* Outputs - also mark as inputs so we can read back from the driven pin */ -ALTERNATE(LED_2, DIO(A9), 0, MODULE_GPIO, DIO_INPUT) -ALTERNATE(LED_3, DIO(A10), 0, MODULE_GPIO, DIO_INPUT) -ALTERNATE(LED_4, DIO(A11), 0, MODULE_GPIO, DIO_INPUT) -ALTERNATE(LED_5, DIO(A12), 0, MODULE_GPIO, DIO_INPUT) -ALTERNATE(LED_6, DIO(A13), 0, MODULE_GPIO, DIO_INPUT) -ALTERNATE(LED_7, DIO(A14), 0, MODULE_GPIO, DIO_INPUT) +ALTERNATE(PIN_MASK(LED_2, DIO(A9)), 0, MODULE_GPIO, DIO_INPUT) +ALTERNATE(PIN_MASK(LED_3, DIO(A10)), 0, MODULE_GPIO, DIO_INPUT) +ALTERNATE(PIN_MASK(LED_4, DIO(A11)), 0, MODULE_GPIO, DIO_INPUT) +ALTERNATE(PIN_MASK(LED_5, DIO(A12)), 0, MODULE_GPIO, DIO_INPUT) +ALTERNATE(PIN_MASK(LED_6, DIO(A13)), 0, MODULE_GPIO, DIO_INPUT) +ALTERNATE(PIN_MASK(LED_7, DIO(A14)), 0, MODULE_GPIO, DIO_INPUT) /* SPS IOs */ -ALTERNATE(FUNC(SPS0_SPICLK), DIO(A2), 0, MODULE_GPIO, DIO_INPUT) -ALTERNATE(FUNC(SPS0_SPIMOSI), DIO(A3), 0, MODULE_GPIO, DIO_INPUT) -ALTERNATE(FUNC(SPS0_SPICSB), DIO(A4), 0, MODULE_GPIO, DIO_INPUT) -ALTERNATE(FUNC(SPS0_SPIMISO), DIO(A5), 0, MODULE_GPIO, DIO_OUTPUT) +ALTERNATE(PIN_MASK(FUNC(SPS0_SPICLK), DIO(A2)), 0, MODULE_GPIO, DIO_INPUT) +ALTERNATE(PIN_MASK(FUNC(SPS0_SPIMOSI), DIO(A3)), 0, MODULE_GPIO, DIO_INPUT) +ALTERNATE(PIN_MASK(FUNC(SPS0_SPICSB), DIO(A4)), 0, MODULE_GPIO, DIO_INPUT) +ALTERNATE(PIN_MASK(FUNC(SPS0_SPIMISO), DIO(A5)), 0, MODULE_GPIO, DIO_OUTPUT) + diff --git a/board/cyan/gpio.inc b/board/cyan/gpio.inc index 0a8b5af85d..ab3410b33c 100644 --- a/board/cyan/gpio.inc +++ b/board/cyan/gpio.inc @@ -5,122 +5,122 @@ * found in the LICENSE file. */ -GPIO_INT(LID_OPEN, PORT(2), 7, GPIO_INT_BOTH_DSLEEP, lid_interrupt) /* Lid switch */ -GPIO_INT(AC_PRESENT, PORT(3), 0, GPIO_INT_BOTH_DSLEEP, extpower_interrupt) /* BC_ACOK / EC_ACIN - to know if battery or AC connected */ -GPIO_INT(WP_L, PORT(3), 3, GPIO_INT_BOTH, switch_interrupt) /* Write protect input */ -GPIO_INT(POWER_BUTTON_L, PORT(3), 5, GPIO_INT_BOTH_DSLEEP, power_button_interrupt) /* Power button */ -GPIO_INT(RSMRST_L_PGOOD, PORT(6), 3, GPIO_INT_BOTH, power_signal_interrupt) /* RSMRST_N_PWRGD from power logic */ -GPIO_INT(ALL_SYS_PGOOD, PORT(13), 0, GPIO_INT_BOTH_DSLEEP, power_signal_interrupt) /* ALL_SYS_PWRGD from power logic */ -GPIO_INT(PCH_SLP_S4_L, PORT(20), 0, GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, power_signal_interrupt) /* SLP_S4# signal from PCH */ -GPIO_INT(PCH_SLP_S3_L, PORT(20), 6, GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, power_signal_interrupt) /* SLP_S3# signal from PCH */ - -GPIO(NC_012, PORT(1), 2, GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(USB_ILIM_SEL, PORT(1), 3, GPIO_OUT_HIGH) /* USB current control */ -GPIO(I2C0_0_SCL, PORT(1), 5, GPIO_ODR_HIGH) -GPIO(I2C0_0_SDA, PORT(1), 6, GPIO_ODR_HIGH) -GPIO(BOARD_ID2, PORT(1), 7, GPIO_INPUT) /* Board ID */ - -GPIO(I2C2_SCL, PORT(2), 0, GPIO_ODR_HIGH) -GPIO(I2C2_SDA, PORT(2), 1, GPIO_ODR_HIGH) -GPIO(I2C1_SCL, PORT(2), 2, GPIO_ODR_HIGH) -GPIO(I2C1_SDA, PORT(2), 3, GPIO_ODR_HIGH) -GPIO(I2C3_SCL, PORT(2), 4, GPIO_ODR_HIGH) -GPIO(I2C3_SDA, PORT(2), 5, GPIO_ODR_HIGH) -GPIO(PCH_SCI_L, PORT(2), 6, GPIO_ODR_HIGH) /* SCI output */ - -GPIO(NC_31, PORT(3), 1, GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(NC_34, PORT(3), 4, GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(USB2_PWR_EN, PORT(3), 6, GPIO_OUT_LOW) /* Enable power for USB2 Port */ - -GPIO(ENTERING_RW, PORT(4), 1, GPIO_OUT_LOW) /* Indicate when EC is entering RW code */ -GPIO(PCH_SMI_L, PORT(4), 4, GPIO_ODR_HIGH) /* SMI output */ -GPIO(USB_OC1_L, PORT(4), 5, GPIO_INT_FALLING) /* DB2 BC1.2 over current signal to EC */ -GPIO(NC_46, PORT(4), 6, GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(NC_47, PORT(4), 7, GPIO_INPUT | GPIO_PULL_UP) /* NC */ - -GPIO(TOUCHPANEL_PWREN, PORT(5), 0, GPIO_OUT_HIGH) /* Enable power for Touch Panel */ -GPIO(PCH_SUS_STAT_L, PORT(5), 1, GPIO_INT_FALLING) /* Signal to inform EC that SOC is entering low power state */ -GPIO(TP_INT_DISABLE, PORT(5), 2, GPIO_OUT_LOW) /* Disable Track Pad interrupt */ -GPIO(TRACKPAD_PWREN, PORT(5), 3, GPIO_OUT_HIGH) /* Enable power for Track Pad */ -GPIO(USB_OC0_L, PORT(5), 5, GPIO_INT_FALLING) /* Over current signal of the BC1.2 charger to EC */ -GPIO(NC_56, PORT(5), 6, GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(NC_57, PORT(5), 7, GPIO_INPUT | GPIO_PULL_UP) /* NC */ - -GPIO(CHGR_PMON, PORT(6), 0, GPIO_ANALOG) -GPIO(WIFI_PWREN, PORT(6), 1, GPIO_OUT_HIGH) /* Enable power for WiFi */ -GPIO(BATT_EN_L, PORT(6), 2, GPIO_INPUT) /* Will be NC */ -GPIO(NC_64, PORT(6), 4, GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(PCH_SYS_PWROK, PORT(6), 5, GPIO_OUT_LOW) /* EC thinks everything is up and ready (DELAY_ALL_SYS_PWRGD) */ -GPIO(PCH_WAKE_L, PORT(6), 6, GPIO_ODR_HIGH) /* PCH wake pin */ -GPIO(USB3_PWR_EN, PORT(6), 7, GPIO_OUT_LOW) /* Enable power for USB3 Port */ - -GPIO(USB_CTL1, PORT(10), 5, GPIO_OUT_HIGH) /* USB charging mode control */ - -GPIO(PCH_RCIN_L, PORT(11), 0, GPIO_ODR_HIGH) /* Reset line to PCH (for 8042 emulation) */ -GPIO(NC_115, PORT(11), 5, GPIO_INPUT | GPIO_PULL_UP) /* NC */ - -GPIO(NC_122, PORT(12), 2, GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(EC_STRAP_GPIO1, PORT(12), 3, GPIO_OUT_LOW) -GPIO(NC_124, PORT(12), 4, GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(GYRO_INT2, PORT(12), 7, GPIO_INT_FALLING) /* Gyro sensor interrupt 2 to EC */ - -GPIO(NC_132, PORT(13), 2, GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(BAT_LED0_L, PORT(13), 3, GPIO_ODR_HIGH) /* Battery charging LED - blue */ -GPIO(BOARD_ID1, PORT(13), 4, GPIO_INPUT) /* Board ID */ -GPIO(WWAN_PWREN, PORT(13), 5, GPIO_OUT_HIGH) /* Enable power for WWAN - PROBE_DETECT_L */ -GPIO(BAT_LED1_L, PORT(13), 6, GPIO_ODR_HIGH) /* Battery charging LED - orange */ - -GPIO(NC_140, PORT(14), 0, GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(PWR_LED0_L, PORT(14), 1, GPIO_ODR_HIGH) /* Power LED - blue */ -GPIO(PCH_RSMRST_L, PORT(14), 3, GPIO_OUT_LOW) /* RSMRST_N to PCH */ -GPIO(PWR_LED1_L, PORT(14), 5, GPIO_ODR_HIGH) /* Power LED - orange */ -GPIO(PVT_CS0, PORT(14), 6, GPIO_ODR_HIGH) /* SPI PVT Chip select */ -GPIO(EC_KBD_ALERT, PORT(14), 7, GPIO_OUT_HIGH) - -GPIO(WLAN_OFF_L, PORT(15), 0, GPIO_ODR_HIGH) /* Wireless LAN */ -GPIO(CPU_PROCHOT, PORT(15), 1, GPIO_OUT_LOW) -GPIO(KBD_IRQ_L, PORT(15), 2, GPIO_ODR_HIGH) /* Negative edge triggered irq. */ -GPIO(BOARD_ID0, PORT(15), 4, GPIO_INPUT) /* Board ID */ -GPIO(CORE_PWROK, PORT(15), 5, GPIO_ODR_HIGH) /* CORE_PWR_OK_R */ -GPIO(LID_OPEN2, PORT(15), 6, GPIO_INT_BOTH_DSLEEP) /* LID_OPEN_OUT2_R */ -GPIO(PCH_SUSPWRDNACK, PORT(15), 7, GPIO_INT_FALLING) /* PMC SUSPWRDNACK signal from SOC to EC */ - -GPIO(PCH_PWRBTN_L, PORT(16), 0, GPIO_OUT_HIGH) /* Power button output to PCH */ -GPIO(GYRO_INT1, PORT(16), 1, GPIO_INT_FALLING) /* Gyro sensor interrupt 1 to EC */ -GPIO(NC_163, PORT(16), 3, GPIO_INPUT | GPIO_PULL_UP) /* NC */ - -GPIO(STARTUP_LATCH_SET, PORT(20), 1, GPIO_OUT_HIGH) -GPIO(EC_BL_DISABLE_L, PORT(20), 2, GPIO_OUT_HIGH) /* EDP backligh disable signal from EC */ -GPIO(SMC_SHUTDOWN, PORT(20), 3, GPIO_OUT_LOW) /* Shutdown signal from EC to power sequencing PLD */ -GPIO(NC_204, PORT(20), 4, GPIO_INPUT | GPIO_PULL_UP) /* NC */ - -GPIO(SUSPWRDNACK_SOC_EC,PORT(21), 0, GPIO_OUT_LOW) /* SUSPWRDNACK signal from EC to MOIC device */ -GPIO(PCH_SLP_SX_L, PORT(21), 1, GPIO_INT_BOTH_DSLEEP) /* Sleep SOIX signal from SOC to EC */ +GPIO_INT(LID_OPEN, PIN(27), GPIO_INT_BOTH_DSLEEP, lid_interrupt) /* Lid switch */ +GPIO_INT(AC_PRESENT, PIN(30), GPIO_INT_BOTH_DSLEEP, extpower_interrupt) /* BC_ACOK / EC_ACIN - to know if battery or AC connected */ +GPIO_INT(WP_L, PIN(33), GPIO_INT_BOTH, switch_interrupt) /* Write protect input */ +GPIO_INT(POWER_BUTTON_L, PIN(35), GPIO_INT_BOTH_DSLEEP, power_button_interrupt) /* Power button */ +GPIO_INT(RSMRST_L_PGOOD, PIN(63), GPIO_INT_BOTH, power_signal_interrupt) /* RSMRST_N_PWRGD from power logic */ +GPIO_INT(ALL_SYS_PGOOD, PIN(130), GPIO_INT_BOTH_DSLEEP, power_signal_interrupt) /* ALL_SYS_PWRGD from power logic */ +GPIO_INT(PCH_SLP_S4_L, PIN(200), GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, power_signal_interrupt) /* SLP_S4# signal from PCH */ +GPIO_INT(PCH_SLP_S3_L, PIN(206), GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, power_signal_interrupt) /* SLP_S3# signal from PCH */ + +GPIO(NC_012, PIN(12), GPIO_INPUT | GPIO_PULL_UP) /* NC */ +GPIO(USB_ILIM_SEL, PIN(13), GPIO_OUT_HIGH) /* USB current control */ +GPIO(I2C0_0_SCL, PIN(15), GPIO_ODR_HIGH) +GPIO(I2C0_0_SDA, PIN(16), GPIO_ODR_HIGH) +GPIO(BOARD_ID2, PIN(17), GPIO_INPUT) /* Board ID */ + +GPIO(I2C2_SCL, PIN(20), GPIO_ODR_HIGH) +GPIO(I2C2_SDA, PIN(21), GPIO_ODR_HIGH) +GPIO(I2C1_SCL, PIN(22), GPIO_ODR_HIGH) +GPIO(I2C1_SDA, PIN(23), GPIO_ODR_HIGH) +GPIO(I2C3_SCL, PIN(24), GPIO_ODR_HIGH) +GPIO(I2C3_SDA, PIN(25), GPIO_ODR_HIGH) +GPIO(PCH_SCI_L, PIN(26), GPIO_ODR_HIGH) /* SCI output */ + +GPIO(NC_31, PIN(31), GPIO_INPUT | GPIO_PULL_UP) /* NC */ +GPIO(NC_34, PIN(34), GPIO_INPUT | GPIO_PULL_UP) /* NC */ +GPIO(USB2_PWR_EN, PIN(36), GPIO_OUT_LOW) /* Enable power for USB2 Port */ + +GPIO(ENTERING_RW, PIN(41), GPIO_OUT_LOW) /* Indicate when EC is entering RW code */ +GPIO(PCH_SMI_L, PIN(44), GPIO_ODR_HIGH) /* SMI output */ +GPIO(USB_OC1_L, PIN(45), GPIO_INT_FALLING) /* DB2 BC1.2 over current signal to EC */ +GPIO(NC_46, PIN(46), GPIO_INPUT | GPIO_PULL_UP) /* NC */ +GPIO(NC_47, PIN(47), GPIO_INPUT | GPIO_PULL_UP) /* NC */ + +GPIO(TOUCHPANEL_PWREN, PIN(50), GPIO_OUT_HIGH) /* Enable power for Touch Panel */ +GPIO(PCH_SUS_STAT_L, PIN(51), GPIO_INT_FALLING) /* Signal to inform EC that SOC is entering low power state */ +GPIO(TP_INT_DISABLE, PIN(52), GPIO_OUT_LOW) /* Disable Track Pad interrupt */ +GPIO(TRACKPAD_PWREN, PIN(53), GPIO_OUT_HIGH) /* Enable power for Track Pad */ +GPIO(USB_OC0_L, PIN(55), GPIO_INT_FALLING) /* Over current signal of the BC1.2 charger to EC */ +GPIO(NC_56, PIN(56), GPIO_INPUT | GPIO_PULL_UP) /* NC */ +GPIO(NC_57, PIN(57), GPIO_INPUT | GPIO_PULL_UP) /* NC */ + +GPIO(CHGR_PMON, PIN(60), GPIO_ANALOG) +GPIO(WIFI_PWREN, PIN(61), GPIO_OUT_HIGH) /* Enable power for WiFi */ +GPIO(BATT_EN_L, PIN(62), GPIO_INPUT) /* Will be NC */ +GPIO(NC_64, PIN(64), GPIO_INPUT | GPIO_PULL_UP) /* NC */ +GPIO(PCH_SYS_PWROK, PIN(65), GPIO_OUT_LOW) /* EC thinks everything is up and ready (DELAY_ALL_SYS_PWRGD) */ +GPIO(PCH_WAKE_L, PIN(66), GPIO_ODR_HIGH) /* PCH wake pin */ +GPIO(USB3_PWR_EN, PIN(67), GPIO_OUT_LOW) /* Enable power for USB3 Port */ + +GPIO(USB_CTL1, PIN(105), GPIO_OUT_HIGH) /* USB charging mode control */ + +GPIO(PCH_RCIN_L, PIN(110), GPIO_ODR_HIGH) /* Reset line to PCH (for 8042 emulation) */ +GPIO(NC_115, PIN(115), GPIO_INPUT | GPIO_PULL_UP) /* NC */ + +GPIO(NC_122, PIN(122), GPIO_INPUT | GPIO_PULL_UP) /* NC */ +GPIO(EC_STRAP_GPIO1, PIN(123), GPIO_OUT_LOW) +GPIO(NC_124, PIN(124), GPIO_INPUT | GPIO_PULL_UP) /* NC */ +GPIO(GYRO_INT2, PIN(127), GPIO_INT_FALLING) /* Gyro sensor interrupt 2 to EC */ + +GPIO(NC_132, PIN(132), GPIO_INPUT | GPIO_PULL_UP) /* NC */ +GPIO(BAT_LED0_L, PIN(133), GPIO_ODR_HIGH) /* Battery charging LED - blue */ +GPIO(BOARD_ID1, PIN(134), GPIO_INPUT) /* Board ID */ +GPIO(WWAN_PWREN, PIN(135), GPIO_OUT_HIGH) /* Enable power for WWAN - PROBE_DETECT_L */ +GPIO(BAT_LED1_L, PIN(136), GPIO_ODR_HIGH) /* Battery charging LED - orange */ + +GPIO(NC_140, PIN(140), GPIO_INPUT | GPIO_PULL_UP) /* NC */ +GPIO(PWR_LED0_L, PIN(141), GPIO_ODR_HIGH) /* Power LED - blue */ +GPIO(PCH_RSMRST_L, PIN(143), GPIO_OUT_LOW) /* RSMRST_N to PCH */ +GPIO(PWR_LED1_L, PIN(145), GPIO_ODR_HIGH) /* Power LED - orange */ +GPIO(PVT_CS0, PIN(146), GPIO_ODR_HIGH) /* SPI PVT Chip select */ +GPIO(EC_KBD_ALERT, PIN(147), GPIO_OUT_HIGH) + +GPIO(WLAN_OFF_L, PIN(150), GPIO_ODR_HIGH) /* Wireless LAN */ +GPIO(CPU_PROCHOT, PIN(151), GPIO_OUT_LOW) +GPIO(KBD_IRQ_L, PIN(152), GPIO_ODR_HIGH) /* Negative edge triggered irq. */ +GPIO(BOARD_ID0, PIN(154), GPIO_INPUT) /* Board ID */ +GPIO(CORE_PWROK, PIN(155), GPIO_ODR_HIGH) /* CORE_PWR_OK_R */ +GPIO(LID_OPEN2, PIN(156), GPIO_INT_BOTH_DSLEEP) /* LID_OPEN_OUT2_R */ +GPIO(PCH_SUSPWRDNACK, PIN(157), GPIO_INT_FALLING) /* PMC SUSPWRDNACK signal from SOC to EC */ + +GPIO(PCH_PWRBTN_L, PIN(160), GPIO_OUT_HIGH) /* Power button output to PCH */ +GPIO(GYRO_INT1, PIN(161), GPIO_INT_FALLING) /* Gyro sensor interrupt 1 to EC */ +GPIO(NC_163, PIN(163), GPIO_INPUT | GPIO_PULL_UP) /* NC */ + +GPIO(STARTUP_LATCH_SET, PIN(201), GPIO_OUT_HIGH) +GPIO(EC_BL_DISABLE_L, PIN(202), GPIO_OUT_HIGH) /* EDP backligh disable signal from EC */ +GPIO(SMC_SHUTDOWN, PIN(203), GPIO_OUT_LOW) /* Shutdown signal from EC to power sequencing PLD */ +GPIO(NC_204, PIN(204), GPIO_INPUT | GPIO_PULL_UP) /* NC */ + +GPIO(SUSPWRDNACK_SOC_EC,PIN(210), GPIO_OUT_LOW) /* SUSPWRDNACK signal from EC to MOIC device */ +GPIO(PCH_SLP_SX_L, PIN(211), GPIO_INT_BOTH_DSLEEP) /* Sleep SOIX signal from SOC to EC */ /* Alternate functions GPIO definition */ -ALTERNATE(PORT(16), 0x24, 1, MODULE_UART, 0) /* UART0 */ +ALTERNATE(PIN_MASK(16, 0x24), 1, MODULE_UART, 0) /* UART0 */ -ALTERNATE(PORT(1), 0x60, 2, MODULE_I2C, GPIO_PULL_UP) /* I2C0: Battery Charger */ -ALTERNATE(PORT(2), 0x3f, 2, MODULE_I2C, GPIO_PULL_UP) /* I2C1: Motion Sensor / I2C2: SOC / I2C3: Temp Sensor */ +ALTERNATE(PIN_MASK(1, 0x60), 2, MODULE_I2C, GPIO_PULL_UP) /* I2C0: Battery Charger */ +ALTERNATE(PIN_MASK(2, 0x3f), 2, MODULE_I2C, GPIO_PULL_UP) /* I2C1: Motion Sensor / I2C2: SOC / I2C3: Temp Sensor */ -ALTERNATE(PORT(0), 0xfc, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) -ALTERNATE(PORT(1), 0x03, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) -ALTERNATE(PORT(10) , 0xd8, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) +ALTERNATE(PIN_MASK(0, 0xfc), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) +ALTERNATE(PIN_MASK(1, 0x03), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) +ALTERNATE(PIN_MASK(10, 0xd8), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) #ifdef CONFIG_KEYBOARD_COL2_INVERTED - GPIO(KBD_KSO2, PORT(0),1, GPIO_KB_OUTPUT_COL2) /* Negative edge triggered irq. */ + GPIO(KBD_KSO2, PIN(1), GPIO_KB_OUTPUT_COL2) /* Negative edge triggered irq. */ #else - ALTERNATE(PORT(0), 0x02, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT_COL2) + ALTERNATE(PIN_MASK(0, 0x02), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT_COL2) #endif -ALTERNATE(PORT(3), 0x04, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) -ALTERNATE(PORT(4), 0x0d, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) -ALTERNATE(PORT(12), 0x60, 2, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) -ALTERNATE(PORT(14), 0x14, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) - -ALTERNATE(PORT(1), 0x10, 1, MODULE_LPC, 0) /* 14: CLKRUN# */ -ALTERNATE(PORT(11), 0x9e, 1, MODULE_LPC, 0) /* 111~114: LAD[0:3], 117: PCI_CLK */ -ALTERNATE(PORT(11), 0x40, 1, MODULE_LPC, GPIO_INT_BOTH) /* 116: LRESET# */ -ALTERNATE(PORT(12), 0x01, 1, MODULE_LPC, 0) /* 120: LFRAME# */ - -ALTERNATE(PORT(5), 0x10, 1, MODULE_SPI, 0) /* 54: MOSI */ -ALTERNATE(PORT(16), 0x10, 1, MODULE_SPI, 0) /* 164: MISO */ -ALTERNATE(PORT(15), 0x08, 1, MODULE_SPI, 0) /* 153: CLK */ +ALTERNATE(PIN_MASK(3, 0x04), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) +ALTERNATE(PIN_MASK(4, 0x0d), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) +ALTERNATE(PIN_MASK(12, 0x60), 2, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) +ALTERNATE(PIN_MASK(14, 0x14), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) + +ALTERNATE(PIN_MASK(1, 0x10), 1, MODULE_LPC, 0) /* 14: CLKRUN# */ +ALTERNATE(PIN_MASK(11, 0x9e), 1, MODULE_LPC, 0) /* 111~114: LAD[0:3], 117: PCI_CLK */ +ALTERNATE(PIN_MASK(11, 0x40), 1, MODULE_LPC, GPIO_INT_BOTH) /* 116: LRESET# */ +ALTERNATE(PIN_MASK(12, 0x01), 1, MODULE_LPC, 0) /* 120: LFRAME# */ + +ALTERNATE(PIN_MASK(5, 0x10), 1, MODULE_SPI, 0) /* 54: MOSI */ +ALTERNATE(PIN_MASK(16, 0x10), 1, MODULE_SPI, 0) /* 164: MISO */ +ALTERNATE(PIN_MASK(15, 0x08), 1, MODULE_SPI, 0) /* 153: CLK */ diff --git a/board/cyan/lfw/gpio.inc b/board/cyan/lfw/gpio.inc index d1bb19cfcb..122aff0cdf 100644 --- a/board/cyan/lfw/gpio.inc +++ b/board/cyan/lfw/gpio.inc @@ -7,10 +7,10 @@ * Minimal set of GPIOs needed for LFW loader */ -GPIO(PVT_CS0, PORT(14), 6, GPIO_ODR_HIGH) /* SPI PVT Chip select */ +GPIO(PVT_CS0, PIN(146), GPIO_ODR_HIGH) /* SPI PVT Chip select */ /* Alternate functions GPIO definition */ -ALTERNATE(PORT(16), 0x24, 1, MODULE_UART, 0) /* UART0 */ -ALTERNATE(PORT(5), 0x10, 1, MODULE_SPI, 0) -ALTERNATE(PORT(16), 0x10, 1, MODULE_SPI, 0) -ALTERNATE(PORT(15), 0x08, 1, MODULE_SPI, 0) /* 153: CLK */ +ALTERNATE(PIN_MASK(16, 0x24), 1, MODULE_UART, 0) /* UART0 */ +ALTERNATE(PIN_MASK(5, 0x10), 1, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(16, 0x10), 1, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(15, 0x08), 1, MODULE_SPI, 0) /* 153: CLK */ diff --git a/board/dingdong/gpio.inc b/board/dingdong/gpio.inc index 9dc31bea66..c6ba602448 100644 --- a/board/dingdong/gpio.inc +++ b/board/dingdong/gpio.inc @@ -5,26 +5,26 @@ * found in the LICENSE file. */ -GPIO_INT(DP_HPD, A, 0, GPIO_INT_BOTH, hpd_event) +GPIO_INT(DP_HPD, PIN(A, 0), GPIO_INT_BOTH, hpd_event) -GPIO(USB_C_CC1_PD, A, 1, GPIO_ANALOG) -GPIO(STM_READY, A, 2, GPIO_OUT_LOW) /* factory test only */ -GPIO(PD_DAC_REF, A, 4, GPIO_ANALOG) -GPIO(DP_AUX_N, A, 5, GPIO_INPUT) -GPIO(DP_AUX_P, A, 6, GPIO_INPUT) +GPIO(USB_C_CC1_PD, PIN(A, 1), GPIO_ANALOG) +GPIO(STM_READY, PIN(A, 2), GPIO_OUT_LOW) /* factory test only */ +GPIO(PD_DAC_REF, PIN(A, 4), GPIO_ANALOG) +GPIO(DP_AUX_N, PIN(A, 5), GPIO_INPUT) +GPIO(DP_AUX_P, PIN(A, 6), GPIO_INPUT) -GPIO(PD_SBU_ENABLE, A, 8, GPIO_OUT_LOW) -GPIO(USB_DM, A, 11, GPIO_ANALOG) -GPIO(USB_DP, A, 12, GPIO_ANALOG) -GPIO(PD_CC1_TX_EN, A, 15, GPIO_OUT_LOW) +GPIO(PD_SBU_ENABLE, PIN(A, 8), GPIO_OUT_LOW) +GPIO(USB_DM, PIN(A, 11), GPIO_ANALOG) +GPIO(USB_DP, PIN(A, 12), GPIO_ANALOG) +GPIO(PD_CC1_TX_EN, PIN(A, 15), GPIO_OUT_LOW) -GPIO(PD_DPSINK_PRESENT, B, 0, GPIO_INPUT) -GPIO(PD_CC1_TX_DATA, B, 4, GPIO_OUT_LOW) +GPIO(PD_DPSINK_PRESENT, PIN(B, 0), GPIO_INPUT) +GPIO(PD_CC1_TX_DATA, PIN(B, 4), GPIO_OUT_LOW) /* Unimplemented signals which we need to emulate for now */ UNIMPLEMENTED(ENTERING_RW) UNIMPLEMENTED(WP_L) -ALTERNATE(B, 0x0008, 0, MODULE_USB_PD, 0) /* SPI1: SCK(PB3) */ -ALTERNATE(B, 0x0200, 2, MODULE_USB_PD, 0) /* TIM17_CH1: PB9 */ -ALTERNATE(A, 0x0600, 1, MODULE_UART, GPIO_PULL_UP) /* USART1: PA9/PA10 */ +ALTERNATE(PIN_MASK(B, 0x0008), 0, MODULE_USB_PD, 0) /* SPI1: SCK(PB3) */ +ALTERNATE(PIN_MASK(B, 0x0200), 2, MODULE_USB_PD, 0) /* TIM17_CH1: PB9 */ +ALTERNATE(PIN_MASK(A, 0x0600), 1, MODULE_UART, GPIO_PULL_UP) /* USART1: PA9/PA10 */ diff --git a/board/discovery-stm32f072/gpio.inc b/board/discovery-stm32f072/gpio.inc index 63735399f6..6f9e5a2dc5 100644 --- a/board/discovery-stm32f072/gpio.inc +++ b/board/discovery-stm32f072/gpio.inc @@ -6,26 +6,26 @@ */ /* Inputs with interrupt handlers are first for efficiency */ -GPIO_INT(USER_BUTTON, A, 0, GPIO_INT_FALLING, button_event) +GPIO_INT(USER_BUTTON, PIN(A, 0), GPIO_INT_FALLING, button_event) /* Outputs */ -GPIO(LED_U, C, 6, GPIO_OUT_LOW) -GPIO(LED_D, C, 7, GPIO_OUT_LOW) -GPIO(LED_L, C, 8, GPIO_OUT_LOW) -GPIO(LED_R, C, 9, GPIO_OUT_LOW) +GPIO(LED_U, PIN(C, 6), GPIO_OUT_LOW) +GPIO(LED_D, PIN(C, 7), GPIO_OUT_LOW) +GPIO(LED_L, PIN(C, 8), GPIO_OUT_LOW) +GPIO(LED_R, PIN(C, 9), GPIO_OUT_LOW) /* Flash SPI interface */ -GPIO(SPI_WP, C, 3, GPIO_OUT_HIGH) -GPIO(SPI_HOLD, C, 4, GPIO_OUT_HIGH) -GPIO(SPI_CS, B, 12, GPIO_OUT_HIGH) +GPIO(SPI_WP, PIN(C, 3), GPIO_OUT_HIGH) +GPIO(SPI_HOLD, PIN(C, 4), GPIO_OUT_HIGH) +GPIO(SPI_CS, PIN(B, 12), GPIO_OUT_HIGH) -ALTERNATE(B, 0xE000, 0, MODULE_SPI_MASTER, 0) +ALTERNATE(PIN_MASK(B, 0xE000), 0, MODULE_SPI_MASTER, 0) /* Unimplemented signals which we need to emulate for now */ UNIMPLEMENTED(ENTERING_RW) UNIMPLEMENTED(WP_L) -ALTERNATE(A, 0x0600, 1, MODULE_USART, 0) /* USART1: PA09/PA10 */ -ALTERNATE(A, 0xC000, 1, MODULE_UART, 0) /* USART2: PA14/PA15 */ -ALTERNATE(B, 0x0C00, 1, MODULE_USART, 0) /* USART3: PB10/PB11 */ -ALTERNATE(C, 0x0C00, 1, MODULE_USART, 0) /* USART4: PC10/PC11 */ +ALTERNATE(PIN_MASK(A, 0x0600), 1, MODULE_USART, 0) /* USART1: PA09/PA10 */ +ALTERNATE(PIN_MASK(A, 0xC000), 1, MODULE_UART, 0) /* USART2: PA14/PA15 */ +ALTERNATE(PIN_MASK(B, 0x0C00), 1, MODULE_USART, 0) /* USART3: PB10/PB11 */ +ALTERNATE(PIN_MASK(C, 0x0C00), 1, MODULE_USART, 0) /* USART4: PC10/PC11 */ diff --git a/board/discovery/gpio.inc b/board/discovery/gpio.inc index bce256bef8..7f762017e3 100644 --- a/board/discovery/gpio.inc +++ b/board/discovery/gpio.inc @@ -6,14 +6,14 @@ */ /* Inputs with interrupt handlers are first for efficiency */ -GPIO_INT(USER_BUTTON, A, 0, GPIO_INT_BOTH, button_event) +GPIO_INT(USER_BUTTON, PIN(A, 0), GPIO_INT_BOTH, button_event) /* Outputs */ -GPIO(LED_BLUE, B, 6, GPIO_OUT_LOW) -GPIO(LED_GREEN, B, 7, GPIO_OUT_LOW) +GPIO(LED_BLUE, PIN(B, 6), GPIO_OUT_LOW) +GPIO(LED_GREEN, PIN(B, 7), GPIO_OUT_LOW) /* Unimplemented signals which we need to emulate for now */ UNIMPLEMENTED(ENTERING_RW) UNIMPLEMENTED(WP_L) -ALTERNATE(A, 0x0600, GPIO_ALT_USART, MODULE_UART, 0) +ALTERNATE(PIN_MASK(A, 0x0600), GPIO_ALT_USART, MODULE_UART, 0) diff --git a/board/falco/gpio.inc b/board/falco/gpio.inc index ffb69242fb..9b2fe7abe0 100644 --- a/board/falco/gpio.inc +++ b/board/falco/gpio.inc @@ -6,97 +6,97 @@ */ /* Inputs with interrupt handlers are first for efficiency */ -GPIO_INT(POWER_BUTTON_L, A, 2, GPIO_INT_BOTH_DSLEEP, power_button_interrupt) /* Power button */ -GPIO_INT(LID_OPEN, A, 3, GPIO_INT_BOTH_DSLEEP, lid_interrupt) /* Lid switch */ -GPIO_INT(AC_PRESENT, H, 3, GPIO_INT_BOTH_DSLEEP, extpower_interrupt) /* AC power present */ -GPIO_INT(PCH_BKLTEN, M, 3, GPIO_INT_BOTH, backlight_interrupt) /* Backlight enable signal from PCH */ -GPIO_INT(PCH_SLP_S0_L, G, 6, GPIO_INT_BOTH, power_signal_interrupt) /* SLP_S0# signal from PCH */ -GPIO_INT(PCH_SLP_S3_L, G, 7, GPIO_INT_BOTH_DSLEEP, power_signal_interrupt) /* SLP_S3# signal from PCH */ -GPIO_INT(PCH_SLP_S5_L, H, 1, GPIO_INT_BOTH_DSLEEP, power_signal_interrupt) /* SLP_S5# signal from PCH */ -GPIO_INT(PCH_SLP_SUS_L, G, 3, GPIO_INT_BOTH, power_signal_interrupt) /* SLP_SUS# signal from PCH */ -GPIO_INT(PP1050_PGOOD, H, 4, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 1.05V */ -GPIO_INT(PP1350_PGOOD, H, 6, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 1.35V (DRAM) */ -GPIO_INT(PP5000_PGOOD, N, 0, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 5V */ -GPIO_INT(VCORE_PGOOD, C, 6, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on core VR */ -GPIO_INT(PCH_EDP_VDD_EN, J, 1, GPIO_INT_BOTH, lcdvcc_interrupt) /* PCH wants EDP enabled */ -GPIO_INT(RECOVERY_L, A, 5, GPIO_PULL_UP | GPIO_INT_BOTH, switch_interrupt) /* Recovery signal from servo */ -GPIO_INT(WP_L, A, 4, GPIO_INT_BOTH, switch_interrupt) /* Write protect input */ -GPIO_INT(JTAG_TCK, C, 0, GPIO_DEFAULT, jtag_interrupt) /* JTAG clock input */ -GPIO_INT(UART0_RX, A, 0, GPIO_PULL_UP | GPIO_INT_BOTH_DSLEEP, uart_deepsleep_interrupt) /* UART0 RX input */ +GPIO_INT(POWER_BUTTON_L, PIN(A, 2), GPIO_INT_BOTH_DSLEEP, power_button_interrupt) /* Power button */ +GPIO_INT(LID_OPEN, PIN(A, 3), GPIO_INT_BOTH_DSLEEP, lid_interrupt) /* Lid switch */ +GPIO_INT(AC_PRESENT, PIN(H, 3), GPIO_INT_BOTH_DSLEEP, extpower_interrupt) /* AC power present */ +GPIO_INT(PCH_BKLTEN, PIN(M, 3), GPIO_INT_BOTH, backlight_interrupt) /* Backlight enable signal from PCH */ +GPIO_INT(PCH_SLP_S0_L, PIN(G, 6), GPIO_INT_BOTH, power_signal_interrupt) /* SLP_S0# signal from PCH */ +GPIO_INT(PCH_SLP_S3_L, PIN(G, 7), GPIO_INT_BOTH_DSLEEP, power_signal_interrupt) /* SLP_S3# signal from PCH */ +GPIO_INT(PCH_SLP_S5_L, PIN(H, 1), GPIO_INT_BOTH_DSLEEP, power_signal_interrupt) /* SLP_S5# signal from PCH */ +GPIO_INT(PCH_SLP_SUS_L, PIN(G, 3), GPIO_INT_BOTH, power_signal_interrupt) /* SLP_SUS# signal from PCH */ +GPIO_INT(PP1050_PGOOD, PIN(H, 4), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 1.05V */ +GPIO_INT(PP1350_PGOOD, PIN(H, 6), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 1.35V (DRAM) */ +GPIO_INT(PP5000_PGOOD, PIN(N, 0), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 5V */ +GPIO_INT(VCORE_PGOOD, PIN(C, 6), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on core VR */ +GPIO_INT(PCH_EDP_VDD_EN, PIN(J, 1), GPIO_INT_BOTH, lcdvcc_interrupt) /* PCH wants EDP enabled */ +GPIO_INT(RECOVERY_L, PIN(A, 5), GPIO_PULL_UP | GPIO_INT_BOTH, switch_interrupt) /* Recovery signal from servo */ +GPIO_INT(WP_L, PIN(A, 4), GPIO_INT_BOTH, switch_interrupt) /* Write protect input */ +GPIO_INT(JTAG_TCK, PIN(C, 0), GPIO_DEFAULT, jtag_interrupt) /* JTAG clock input */ +GPIO_INT(UART0_RX, PIN(A, 0), GPIO_PULL_UP | GPIO_INT_BOTH_DSLEEP, uart_deepsleep_interrupt) /* UART0 RX input */ /* Other inputs */ -GPIO(FAN_ALERT_L, B, 0, GPIO_INPUT) /* From thermal sensor */ -GPIO(PCH_SUSWARN_L, G, 2, GPIO_INT_BOTH) /* SUSWARN# signal from PCH */ -GPIO(USB1_OC_L, E, 7, GPIO_INPUT) /* USB port overcurrent warning */ -GPIO(USB2_OC_L, E, 0, GPIO_INPUT) /* USB port overcurrent warning */ -GPIO(BOARD_VERSION1, Q, 5, GPIO_INPUT) /* Board version stuffing resistor 1 */ -GPIO(BOARD_VERSION2, Q, 6, GPIO_INPUT) /* Board version stuffing resistor 2 */ -GPIO(BOARD_VERSION3, Q, 7, GPIO_INPUT) /* Board version stuffing resistor 3 */ -GPIO(CPU_PGOOD, C, 4, GPIO_INPUT) /* Power good to the CPU */ +GPIO(FAN_ALERT_L, PIN(B, 0), GPIO_INPUT) /* From thermal sensor */ +GPIO(PCH_SUSWARN_L, PIN(G, 2), GPIO_INT_BOTH) /* SUSWARN# signal from PCH */ +GPIO(USB1_OC_L, PIN(E, 7), GPIO_INPUT) /* USB port overcurrent warning */ +GPIO(USB2_OC_L, PIN(E, 0), GPIO_INPUT) /* USB port overcurrent warning */ +GPIO(BOARD_VERSION1, PIN(Q, 5), GPIO_INPUT) /* Board version stuffing resistor 1 */ +GPIO(BOARD_VERSION2, PIN(Q, 6), GPIO_INPUT) /* Board version stuffing resistor 2 */ +GPIO(BOARD_VERSION3, PIN(Q, 7), GPIO_INPUT) /* Board version stuffing resistor 3 */ +GPIO(CPU_PGOOD, PIN(C, 4), GPIO_INPUT) /* Power good to the CPU */ /* Outputs; all unasserted by default except for reset signals */ -GPIO(CPU_PROCHOT, B, 1, GPIO_OUT_LOW) /* Force CPU to think it's overheated */ -GPIO(PP1350_EN, H, 5, GPIO_OUT_LOW) /* Enable 1.35V supply */ -GPIO(PP3300_DSW_GATED_EN, J, 3, GPIO_OUT_LOW) /* Enable DSW rails */ -GPIO(PP3300_DX_EN, J, 2, GPIO_OUT_LOW) /* Enable power to lots of peripherals */ -GPIO(PP3300_LTE_EN, D, 2, GPIO_OUT_LOW) /* Enable LTE radio */ -GPIO(PP3300_WLAN_EN, J, 0, GPIO_OUT_LOW) /* Enable WiFi power */ -GPIO(SUSP_VR_EN, C, 7, GPIO_OUT_LOW) /* Enable 1.05V regulator */ -GPIO(VCORE_EN, C, 5, GPIO_OUT_LOW) /* Stuffing option - not connected */ -GPIO(PP5000_EN, H, 7, GPIO_OUT_LOW) /* Enable 5V supply */ -GPIO(SYS_PWROK, H, 2, GPIO_OUT_LOW) /* EC thinks everything is up and ready */ -GPIO(WLAN_OFF_L, J, 4, GPIO_OUT_LOW) /* Disable WiFi radio */ -GPIO(CHARGE_L, E, 6, GPIO_OUT_LOW) /* Allow battery to charge when on AC */ +GPIO(CPU_PROCHOT, PIN(B, 1), GPIO_OUT_LOW) /* Force CPU to think it's overheated */ +GPIO(PP1350_EN, PIN(H, 5), GPIO_OUT_LOW) /* Enable 1.35V supply */ +GPIO(PP3300_DSW_GATED_EN, PIN(J, 3), GPIO_OUT_LOW) /* Enable DSW rails */ +GPIO(PP3300_DX_EN, PIN(J, 2), GPIO_OUT_LOW) /* Enable power to lots of peripherals */ +GPIO(PP3300_LTE_EN, PIN(D, 2), GPIO_OUT_LOW) /* Enable LTE radio */ +GPIO(PP3300_WLAN_EN, PIN(J, 0), GPIO_OUT_LOW) /* Enable WiFi power */ +GPIO(SUSP_VR_EN, PIN(C, 7), GPIO_OUT_LOW) /* Enable 1.05V regulator */ +GPIO(VCORE_EN, PIN(C, 5), GPIO_OUT_LOW) /* Stuffing option - not connected */ +GPIO(PP5000_EN, PIN(H, 7), GPIO_OUT_LOW) /* Enable 5V supply */ +GPIO(SYS_PWROK, PIN(H, 2), GPIO_OUT_LOW) /* EC thinks everything is up and ready */ +GPIO(WLAN_OFF_L, PIN(J, 4), GPIO_OUT_LOW) /* Disable WiFi radio */ +GPIO(CHARGE_L, PIN(E, 6), GPIO_OUT_LOW) /* Allow battery to charge when on AC */ -GPIO(ENABLE_BACKLIGHT, M, 7, GPIO_OUT_LOW) /* Enable backlight power */ -GPIO(ENABLE_TOUCHPAD, N, 1, GPIO_OUT_LOW) /* Enable touchpad power */ -GPIO(ENTERING_RW, D, 3, GPIO_OUT_LOW) /* Indicate when EC is entering RW code */ -GPIO(PCH_DPWROK, G, 0, GPIO_OUT_LOW) /* Indicate when VccDSW is good */ +GPIO(ENABLE_BACKLIGHT, PIN(M, 7), GPIO_OUT_LOW) /* Enable backlight power */ +GPIO(ENABLE_TOUCHPAD, PIN(N, 1), GPIO_OUT_LOW) /* Enable touchpad power */ +GPIO(ENTERING_RW, PIN(D, 3), GPIO_OUT_LOW) /* Indicate when EC is entering RW code */ +GPIO(PCH_DPWROK, PIN(G, 0), GPIO_OUT_LOW) /* Indicate when VccDSW is good */ /* * HDA_SDO is technically an output, but we need to leave it as an * input until we drive it high. So can't use open-drain (HI_Z). */ -GPIO(PCH_HDA_SDO, G, 1, GPIO_INPUT) /* HDA_SDO signal to PCH; when high, ME ignores security descriptor */ -GPIO(PCH_WAKE_L, F, 0, GPIO_OUT_HIGH) /* Wake signal from EC to PCH */ -GPIO(PCH_NMI_L, F, 2, GPIO_OUT_HIGH) /* Non-maskable interrupt pin to PCH */ -GPIO(PCH_PWRBTN_L, H, 0, GPIO_OUT_HIGH) /* Power button output to PCH */ -GPIO(PCH_PWROK, F, 5, GPIO_OUT_LOW) /* PWROK / APWROK signals to PCH */ +GPIO(PCH_HDA_SDO, PIN(G, 1), GPIO_INPUT) /* HDA_SDO signal to PCH; when high, ME ignores security descriptor */ +GPIO(PCH_WAKE_L, PIN(F, 0), GPIO_OUT_HIGH) /* Wake signal from EC to PCH */ +GPIO(PCH_NMI_L, PIN(F, 2), GPIO_OUT_HIGH) /* Non-maskable interrupt pin to PCH */ +GPIO(PCH_PWRBTN_L, PIN(H, 0), GPIO_OUT_HIGH) /* Power button output to PCH */ +GPIO(PCH_PWROK, PIN(F, 5), GPIO_OUT_LOW) /* PWROK / APWROK signals to PCH */ /* * PL6 is one of 4 pins on the EC which can't be used in open-drain * mode. To work around this PCH_RCIN_L is set to an input. It will * only be set to an output when it needs to be driven to 0. */ -GPIO(PCH_RCIN_L, L, 6, GPIO_INPUT) /* RCIN# line to PCH (for 8042 emulation) */ -GPIO(PCH_RSMRST_L, F, 1, GPIO_OUT_LOW) /* Reset PCH resume power plane logic */ -GPIO(PCH_SMI_L, F, 4, GPIO_ODR_HIGH) /* System management interrupt to PCH */ -GPIO(TOUCHSCREEN_RESET_L, N, 7, GPIO_OUT_LOW) /* Reset touch screen */ -GPIO(EC_EDP_VDD_EN, J, 5, GPIO_OUT_LOW) /* Enable EDP (passthru from PCH) */ +GPIO(PCH_RCIN_L, PIN(L, 6), GPIO_INPUT) /* RCIN# line to PCH (for 8042 emulation) */ +GPIO(PCH_RSMRST_L, PIN(F, 1), GPIO_OUT_LOW) /* Reset PCH resume power plane logic */ +GPIO(PCH_SMI_L, PIN(F, 4), GPIO_ODR_HIGH) /* System management interrupt to PCH */ +GPIO(TOUCHSCREEN_RESET_L, PIN(N, 7), GPIO_OUT_LOW) /* Reset touch screen */ +GPIO(EC_EDP_VDD_EN, PIN(J, 5), GPIO_OUT_LOW) /* Enable EDP (passthru from PCH) */ -GPIO(LPC_CLKRUN_L, M, 2, GPIO_ODR_HIGH) /* Dunno. Probably important, though. */ -GPIO(USB1_ENABLE, E, 4, GPIO_OUT_LOW) /* USB port 1 output power enable */ -GPIO(USB2_ENABLE, D, 5, GPIO_OUT_LOW) /* USB port 2 output power enable */ +GPIO(LPC_CLKRUN_L, PIN(M, 2), GPIO_ODR_HIGH) /* Dunno. Probably important, though. */ +GPIO(USB1_ENABLE, PIN(E, 4), GPIO_OUT_LOW) /* USB port 1 output power enable */ +GPIO(USB2_ENABLE, PIN(D, 5), GPIO_OUT_LOW) /* USB port 2 output power enable */ -GPIO(PCH_SUSACK_L, F, 3, GPIO_OUT_HIGH) /* Acknowledge PCH SUSWARN# signal */ -GPIO(PCH_RTCRST_L, F, 6, GPIO_ODR_HIGH) /* Not supposed to be here */ -GPIO(PCH_SRTCRST_L, F, 7, GPIO_ODR_HIGH) /* Not supposed to be here */ +GPIO(PCH_SUSACK_L, PIN(F, 3), GPIO_OUT_HIGH) /* Acknowledge PCH SUSWARN# signal */ +GPIO(PCH_RTCRST_L, PIN(F, 6), GPIO_ODR_HIGH) /* Not supposed to be here */ +GPIO(PCH_SRTCRST_L, PIN(F, 7), GPIO_ODR_HIGH) /* Not supposed to be here */ -GPIO(PWR_LED_L, N, 6, GPIO_OUT_HIGH) /* Power LED */ -GPIO(KB_LED_EN, D, 4, GPIO_OUT_LOW) /* Keyboard LED */ -GPIO(BAT_LED0, D, 0, GPIO_OUT_LOW) /* Battery charger status */ -GPIO(BAT_LED1, D, 1, GPIO_OUT_LOW) /* Battery charger status */ +GPIO(PWR_LED_L, PIN(N, 6), GPIO_OUT_HIGH) /* Power LED */ +GPIO(KB_LED_EN, PIN(D, 4), GPIO_OUT_LOW) /* Keyboard LED */ +GPIO(BAT_LED0, PIN(D, 0), GPIO_OUT_LOW) /* Battery charger status */ +GPIO(BAT_LED1, PIN(D, 1), GPIO_OUT_LOW) /* Battery charger status */ -ALTERNATE(A, 0x03, 1, MODULE_UART, GPIO_PULL_UP) /* UART0 */ -ALTERNATE(A, 0x40, 3, MODULE_I2C, 0) /* I2C1 SCL */ -ALTERNATE(A, 0x80, 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C1 SDA */ -ALTERNATE(B, 0x04, 3, MODULE_I2C, 0) /* I2C0 SCL */ -ALTERNATE(B, 0x08, 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C0 SDA */ -ALTERNATE(B, 0x40, 3, MODULE_I2C, 0) /* I2C5 SCL */ -ALTERNATE(B, 0x80, 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C5 SDA */ -ALTERNATE(G, 0x30, 1, MODULE_UART, 0) /* UART2 */ -ALTERNATE(J, 0x40, 1, MODULE_PECI, 0) /* PECI Tx */ -ALTERNATE(J, 0x80, 0, MODULE_PECI, GPIO_ANALOG) /* PECI Rx */ -ALTERNATE(L, 0x3f, 15, MODULE_LPC, 0) /* LPC */ -ALTERNATE(M, 0x33, 15, MODULE_LPC, 0) /* LPC */ -ALTERNATE(N, 0x0c, 1, MODULE_PWM_FAN, 0) /* FAN0PWM2 */ +ALTERNATE(PIN_MASK(A, 0x03), 1, MODULE_UART, GPIO_PULL_UP) /* UART0 */ +ALTERNATE(PIN_MASK(A, 0x40), 3, MODULE_I2C, 0) /* I2C1 SCL */ +ALTERNATE(PIN_MASK(A, 0x80), 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C1 SDA */ +ALTERNATE(PIN_MASK(B, 0x04), 3, MODULE_I2C, 0) /* I2C0 SCL */ +ALTERNATE(PIN_MASK(B, 0x08), 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C0 SDA */ +ALTERNATE(PIN_MASK(B, 0x40), 3, MODULE_I2C, 0) /* I2C5 SCL */ +ALTERNATE(PIN_MASK(B, 0x80), 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C5 SDA */ +ALTERNATE(PIN_MASK(G, 0x30), 1, MODULE_UART, 0) /* UART2 */ +ALTERNATE(PIN_MASK(J, 0x40), 1, MODULE_PECI, 0) /* PECI Tx */ +ALTERNATE(PIN_MASK(J, 0x80), 0, MODULE_PECI, GPIO_ANALOG) /* PECI Rx */ +ALTERNATE(PIN_MASK(L, 0x3f), 15, MODULE_LPC, 0) /* LPC */ +ALTERNATE(PIN_MASK(M, 0x33), 15, MODULE_LPC, 0) /* LPC */ +ALTERNATE(PIN_MASK(N, 0x0c), 1, MODULE_PWM_FAN, 0) /* FAN0PWM2 */ diff --git a/board/firefly/gpio.inc b/board/firefly/gpio.inc index f408933962..1fba1be06a 100644 --- a/board/firefly/gpio.inc +++ b/board/firefly/gpio.inc @@ -6,61 +6,61 @@ */ /* Inputs with interrupt handlers are first for efficiency */ -GPIO_INT(VBUS_WAKE, C, 13, GPIO_INT_BOTH, vbus_event) +GPIO_INT(VBUS_WAKE, PIN(C, 13), GPIO_INT_BOTH, vbus_event) /* Buttons */ -GPIO_INT(SW_PP20000, B, 10, GPIO_INT_FALLING, button_event) -GPIO_INT(SW_PP12000, B, 11, GPIO_INT_FALLING, button_event) -GPIO_INT(SW_PP5000, B, 12, GPIO_INT_FALLING, button_event) +GPIO_INT(SW_PP20000, PIN(B, 10), GPIO_INT_FALLING, button_event) +GPIO_INT(SW_PP12000, PIN(B, 11), GPIO_INT_FALLING, button_event) +GPIO_INT(SW_PP5000, PIN(B, 12), GPIO_INT_FALLING, button_event) /* PD RX/TX */ -GPIO(USB_CC1_PD, A, 0, GPIO_ANALOG) -GPIO(PD_REF1, A, 1, GPIO_ANALOG) -GPIO(USB_CC2_PD, A, 2, GPIO_ANALOG) -GPIO(PD_REF2, A, 3, GPIO_ANALOG) -GPIO(PD_CC1_TX_EN, A, 4, GPIO_ODR_HIGH) -GPIO(PD_CC2_TX_EN, A, 15, GPIO_ODR_HIGH) -GPIO(PD_CLK_OUT, B, 9, GPIO_OUT_LOW) -GPIO(PD_CC1_TX_DATA, A, 6, GPIO_INPUT) -GPIO(PD_CC2_TX_DATA, B, 4, GPIO_INPUT) -GPIO(PD_CLK_IN, B, 3, GPIO_INPUT) +GPIO(USB_CC1_PD, PIN(A, 0), GPIO_ANALOG) +GPIO(PD_REF1, PIN(A, 1), GPIO_ANALOG) +GPIO(USB_CC2_PD, PIN(A, 2), GPIO_ANALOG) +GPIO(PD_REF2, PIN(A, 3), GPIO_ANALOG) +GPIO(PD_CC1_TX_EN, PIN(A, 4), GPIO_ODR_HIGH) +GPIO(PD_CC2_TX_EN, PIN(A, 15), GPIO_ODR_HIGH) +GPIO(PD_CLK_OUT, PIN(B, 9), GPIO_OUT_LOW) +GPIO(PD_CC1_TX_DATA, PIN(A, 6), GPIO_INPUT) +GPIO(PD_CC2_TX_DATA, PIN(B, 4), GPIO_INPUT) +GPIO(PD_CLK_IN, PIN(B, 3), GPIO_INPUT) /* CCx device pull-downs */ -GPIO(PD_CC1_DEVICE, B, 13, GPIO_ODR_LOW) -GPIO(PD_CC2_DEVICE, B, 14, GPIO_ODR_LOW) +GPIO(PD_CC1_DEVICE, PIN(B, 13), GPIO_ODR_LOW) +GPIO(PD_CC2_DEVICE, PIN(B, 14), GPIO_ODR_LOW) /* ADC */ -GPIO(VBUS_SENSE, A, 5, GPIO_ANALOG) +GPIO(VBUS_SENSE, PIN(A, 5), GPIO_ANALOG) /* LEDs control */ -GPIO(LED_PP20000, B, 0, GPIO_OUT_LOW) -GPIO(LED_PP12000, B, 1, GPIO_OUT_LOW) -GPIO(LED_PP5000, B, 2, GPIO_OUT_LOW) +GPIO(LED_PP20000, PIN(B, 0), GPIO_OUT_LOW) +GPIO(LED_PP12000, PIN(B, 1), GPIO_OUT_LOW) +GPIO(LED_PP5000, PIN(B, 2), GPIO_OUT_LOW) /* Slave I2C port */ -GPIO(I2C_INT_L, B, 8, GPIO_ODR_HIGH) +GPIO(I2C_INT_L, PIN(B, 8), GPIO_ODR_HIGH) /* * I2C pins should be configured as inputs until I2C module is * initialized. This will avoid driving the lines unintentionally. */ -GPIO(I2C_SCL, B, 6, GPIO_INPUT) -GPIO(I2C_SDA, B, 7, GPIO_INPUT) +GPIO(I2C_SCL, PIN(B, 6), GPIO_INPUT) +GPIO(I2C_SDA, PIN(B, 7), GPIO_INPUT) /* Test points */ -GPIO(TP_A8, A, 8, GPIO_ODR_HIGH) -GPIO(TP_A13, A, 13, GPIO_ODR_HIGH) -GPIO(TP_A14, A, 14, GPIO_ODR_HIGH) -GPIO(TP_B15, B, 15, GPIO_ODR_HIGH) -GPIO(TP_C14, C, 14, GPIO_ODR_HIGH) -GPIO(TP_C15, C, 15, GPIO_ODR_HIGH) -GPIO(TP_F0, F, 0, GPIO_ODR_HIGH) -GPIO(TP_F1, F, 1, GPIO_ODR_HIGH) +GPIO(TP_A8, PIN(A, 8), GPIO_ODR_HIGH) +GPIO(TP_A13, PIN(A, 13), GPIO_ODR_HIGH) +GPIO(TP_A14, PIN(A, 14), GPIO_ODR_HIGH) +GPIO(TP_B15, PIN(B, 15), GPIO_ODR_HIGH) +GPIO(TP_C14, PIN(C, 14), GPIO_ODR_HIGH) +GPIO(TP_C15, PIN(C, 15), GPIO_ODR_HIGH) +GPIO(TP_F0, PIN(F, 0), GPIO_ODR_HIGH) +GPIO(TP_F1, PIN(F, 1), GPIO_ODR_HIGH) /* Unimplemented signals which we need to emulate for now */ UNIMPLEMENTED(ENTERING_RW) UNIMPLEMENTED(WP_L) -ALTERNATE(B, 0x0008, 0, MODULE_USB_PD, 0) /* SPI1: SCK(PB3) */ -ALTERNATE(B, 0x0200, 2, MODULE_USB_PD, 0) /* TIM17_CH1: PB9) */ -ALTERNATE(A, 0x0600, 1, MODULE_UART, GPIO_PULL_UP) /* USART1: PA9/PA10 */ -ALTERNATE(B, 0x00c0, 1, MODULE_I2C, 0) /* I2C SLAVE:PB6/7 */ +ALTERNATE(PIN_MASK(B, 0x0008), 0, MODULE_USB_PD, 0) /* SPI1: SCK(PB3) */ +ALTERNATE(PIN_MASK(B, 0x0200), 2, MODULE_USB_PD, 0) /* TIM17_CH1: PB9) */ +ALTERNATE(PIN_MASK(A, 0x0600), 1, MODULE_UART, GPIO_PULL_UP) /* USART1: PA9/PA10 */ +ALTERNATE(PIN_MASK(B, 0x00c0), 1, MODULE_I2C, 0) /* I2C SLAVE:PB6/7 */ diff --git a/board/fruitpie/gpio.inc b/board/fruitpie/gpio.inc index bdbefc70ae..f51de23f87 100644 --- a/board/fruitpie/gpio.inc +++ b/board/fruitpie/gpio.inc @@ -5,69 +5,69 @@ * found in the LICENSE file. */ -GPIO_INT(VBUS_WAKE, B, 5, GPIO_INT_BOTH, vbus_event) -GPIO_INT(MASTER_I2C_INT_L, C, 13, GPIO_INT_FALLING, tsu_event) -GPIO_INT(ALERT_L, A, 2, GPIO_INT_FALLING, rohm_event) +GPIO_INT(VBUS_WAKE, PIN(B, 5), GPIO_INT_BOTH, vbus_event) +GPIO_INT(MASTER_I2C_INT_L, PIN(C, 13), GPIO_INT_FALLING, tsu_event) +GPIO_INT(ALERT_L, PIN(A, 2), GPIO_INT_FALLING, rohm_event) /* PD RX/TX */ -GPIO(USB_CC1_PD, A, 0, GPIO_ANALOG) -GPIO(PD_REF1, A, 1, GPIO_ANALOG) -GPIO(PD_REF2, A, 3, GPIO_ANALOG) -GPIO(USB_CC2_PD, A, 4, GPIO_ANALOG) -GPIO(PD_CLK_OUT, B, 9, GPIO_OUT_LOW) -GPIO(PD_TX_EN, B, 12, GPIO_OUT_LOW) -GPIO(PD_TX_DATA, B, 14, GPIO_OUT_LOW) +GPIO(USB_CC1_PD, PIN(A, 0), GPIO_ANALOG) +GPIO(PD_REF1, PIN(A, 1), GPIO_ANALOG) +GPIO(PD_REF2, PIN(A, 3), GPIO_ANALOG) +GPIO(USB_CC2_PD, PIN(A, 4), GPIO_ANALOG) +GPIO(PD_CLK_OUT, PIN(B, 9), GPIO_OUT_LOW) +GPIO(PD_TX_EN, PIN(B, 12), GPIO_OUT_LOW) +GPIO(PD_TX_DATA, PIN(B, 14), GPIO_OUT_LOW) #if 0 -GPIO(PD_CLK_IN, B, 13, GPIO_OUT_LOW) +GPIO(PD_CLK_IN, PIN(B, 13), GPIO_OUT_LOW) #endif /* Power and muxes control */ -GPIO(PP5000_EN, A, 5, GPIO_OUT_HIGH) -GPIO(CC_HOST, A, 6, GPIO_OUT_LOW) -GPIO(CHARGE_EN_L, A, 8, GPIO_OUT_LOW) -GPIO(USB_C_5V_EN, A, 10, GPIO_OUT_LOW) -GPIO(VCONN1_EN, B, 15, GPIO_OUT_LOW) -GPIO(VCONN2_EN, C, 14, GPIO_OUT_LOW) -GPIO(SS1_EN_L, A, 9, GPIO_OUT_HIGH) -GPIO(SS2_EN_L, B, 4, GPIO_OUT_HIGH) -GPIO(SS2_USB_MODE_L, B, 3, GPIO_OUT_HIGH) -GPIO(SS1_USB_MODE_L, B, 8, GPIO_OUT_HIGH) -GPIO(DP_MODE, C, 15, GPIO_OUT_LOW) -GPIO(DP_POLARITY_L, A, 7, GPIO_OUT_HIGH) +GPIO(PP5000_EN, PIN(A, 5), GPIO_OUT_HIGH) +GPIO(CC_HOST, PIN(A, 6), GPIO_OUT_LOW) +GPIO(CHARGE_EN_L, PIN(A, 8), GPIO_OUT_LOW) +GPIO(USB_C_5V_EN, PIN(A, 10), GPIO_OUT_LOW) +GPIO(VCONN1_EN, PIN(B, 15), GPIO_OUT_LOW) +GPIO(VCONN2_EN, PIN(C, 14), GPIO_OUT_LOW) +GPIO(SS1_EN_L, PIN(A, 9), GPIO_OUT_HIGH) +GPIO(SS2_EN_L, PIN(B, 4), GPIO_OUT_HIGH) +GPIO(SS2_USB_MODE_L, PIN(B, 3), GPIO_OUT_HIGH) +GPIO(SS1_USB_MODE_L, PIN(B, 8), GPIO_OUT_HIGH) +GPIO(DP_MODE, PIN(C, 15), GPIO_OUT_LOW) +GPIO(DP_POLARITY_L, PIN(A, 7), GPIO_OUT_HIGH) /* Not used : no host on that bus */ -GPIO(SLAVE_I2C_INT_L, B, 2, GPIO_ODR_HIGH) +GPIO(SLAVE_I2C_INT_L, PIN(B, 2), GPIO_ODR_HIGH) /* Alternate functions */ #if 0 -GPIO(USB_DM, A, 11, GPIO_ANALOG) -GPIO(USB_DP, A, 12, GPIO_ANALOG) -GPIO(UART_TX, A, 14, GPIO_OUT_LOW) -GPIO(UART_RX, A, 15, GPIO_OUT_LOW) +GPIO(USB_DM, PIN(A, 11), GPIO_ANALOG) +GPIO(USB_DP, PIN(A, 12), GPIO_ANALOG) +GPIO(UART_TX, PIN(A, 14), GPIO_OUT_LOW) +GPIO(UART_RX, PIN(A, 15), GPIO_OUT_LOW) #endif /* * I2C pins should be configured as inputs until I2C module is * initialized. This will avoid driving the lines unintentionally. */ -GPIO(SLAVE_I2C_SCL, B, 6, GPIO_INPUT) -GPIO(SLAVE_I2C_SDA, B, 7, GPIO_INPUT) -GPIO(MASTER_I2C_SCL, B, 10, GPIO_INPUT) -GPIO(MASTER_I2C_SDA, B, 11, GPIO_INPUT) +GPIO(SLAVE_I2C_SCL, PIN(B, 6), GPIO_INPUT) +GPIO(SLAVE_I2C_SDA, PIN(B, 7), GPIO_INPUT) +GPIO(MASTER_I2C_SCL, PIN(B, 10), GPIO_INPUT) +GPIO(MASTER_I2C_SDA, PIN(B, 11), GPIO_INPUT) /* Rohm BD92104 connections */ -GPIO(USBPD_RST, B, 0, GPIO_OUT_LOW) -GPIO(USBPD_FORCE_OTG, B, 1, GPIO_OUT_LOW) -GPIO(USBPD_VIN_EN_L, F, 0, GPIO_OUT_HIGH) +GPIO(USBPD_RST, PIN(B, 0), GPIO_OUT_LOW) +GPIO(USBPD_FORCE_OTG, PIN(B, 1), GPIO_OUT_LOW) +GPIO(USBPD_VIN_EN_L, PIN(F, 0), GPIO_OUT_HIGH) /* Test points */ -GPIO(TP9, A, 13, GPIO_ODR_HIGH) -GPIO(TP11, F, 1, GPIO_ODR_HIGH) +GPIO(TP9, PIN(A, 13), GPIO_ODR_HIGH) +GPIO(TP11, PIN(F, 1), GPIO_ODR_HIGH) /* Unimplemented signals which we need to emulate for now */ UNIMPLEMENTED(ENTERING_RW) UNIMPLEMENTED(WP_L) -ALTERNATE(B, 0x2000, 0, MODULE_USB_PD, 0) /* SPI2: SCK(PB13) */ -ALTERNATE(B, 0x0200, 2, MODULE_USB_PD, 0) /* TIM17_CH1: PB9) */ -ALTERNATE(A, 0xC000, 1, MODULE_UART, 0) /* USART2: PA14/PA15 */ -ALTERNATE(B, 0x0cc0, 1, MODULE_I2C, 0) /* I2C SLAVE:PB6/7 MASTER:PB10/11 */ +ALTERNATE(PIN_MASK(B, 0x2000), 0, MODULE_USB_PD, 0) /* SPI2: SCK(PB13) */ +ALTERNATE(PIN_MASK(B, 0x0200), 2, MODULE_USB_PD, 0) /* TIM17_CH1: PB9) */ +ALTERNATE(PIN_MASK(A, 0xC000), 1, MODULE_UART, 0) /* USART2: PA14/PA15 */ +ALTERNATE(PIN_MASK(B, 0x0cc0), 1, MODULE_I2C, 0) /* I2C SLAVE:PB6/7 MASTER:PB10/11 */ diff --git a/board/glados/gpio.inc b/board/glados/gpio.inc index 9801b60a27..c5f461e974 100644 --- a/board/glados/gpio.inc +++ b/board/glados/gpio.inc @@ -5,153 +5,153 @@ * found in the LICENSE file. */ -GPIO_INT(LID_OPEN, PORT(2), 7, GPIO_INT_BOTH_DSLEEP, lid_interrupt) -GPIO_INT(AC_PRESENT, PORT(3), 0, GPIO_INT_BOTH_DSLEEP, extpower_interrupt) -GPIO_INT(WP_L, PORT(3), 3, GPIO_INT_BOTH, switch_interrupt) +GPIO_INT(LID_OPEN, PIN(27), GPIO_INT_BOTH_DSLEEP, lid_interrupt) +GPIO_INT(AC_PRESENT, PIN(30), GPIO_INT_BOTH_DSLEEP, extpower_interrupt) +GPIO_INT(WP_L, PIN(33), GPIO_INT_BOTH, switch_interrupt) /* Buffered power button input from PMIC / ROP_EC_PWR_BTN_L_R */ -GPIO_INT(POWER_BUTTON_L, PORT(3), 5, GPIO_INT_BOTH_DSLEEP, power_button_interrupt) +GPIO_INT(POWER_BUTTON_L, PIN(35), GPIO_INT_BOTH_DSLEEP, power_button_interrupt) /* RSMRST from PMIC */ -GPIO_INT(RSMRST_L_PGOOD, PORT(6), 3, GPIO_INT_BOTH, power_signal_interrupt) -GPIO_INT(PCH_SLP_S4_L, PORT(20), 0, GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, power_signal_interrupt) -GPIO_INT(PCH_SLP_S3_L, PORT(20), 6, GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, power_signal_interrupt) -GPIO_INT(PCH_SLP_S0_L, PORT(21), 1, GPIO_INT_BOTH | GPIO_PULL_UP, power_signal_interrupt) -GPIO_INT(PCH_SLP_SUS_L, PORT(1), 2, GPIO_INT_BOTH | GPIO_PULL_UP, power_signal_interrupt) -GPIO_INT(VOLUME_UP_L, PORT(3), 1, GPIO_INT_FALLING | GPIO_PULL_UP, button_interrupt) -GPIO_INT(VOLUME_DOWN_L, PORT(4), 7, GPIO_INT_FALLING | GPIO_PULL_UP, button_interrupt) -GPIO_INT(PMIC_INT_L, PORT(5), 0, GPIO_INT_FALLING, power_signal_interrupt) -GPIO_INT(PD_MCU_INT, PORT(12), 2, GPIO_INT_RISING | GPIO_INT_DSLEEP, pd_mcu_interrupt) -GPIO_INT(USB_C0_VBUS_WAKE, PORT(15), 2, GPIO_INT_BOTH, vbus1_evt) -GPIO_INT(USB_C1_VBUS_WAKE, PORT(12), 3, GPIO_INT_BOTH, vbus0_evt) -GPIO_INT(USB_C0_BC12_INT_L, PORT(12), 4, GPIO_INT_FALLING, usb0_evt) -GPIO_INT(USB_C1_BC12_INT_L, PORT(14), 5, GPIO_INT_FALLING, usb1_evt) +GPIO_INT(RSMRST_L_PGOOD, PIN(63), GPIO_INT_BOTH, power_signal_interrupt) +GPIO_INT(PCH_SLP_S4_L, PIN(200), GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, power_signal_interrupt) +GPIO_INT(PCH_SLP_S3_L, PIN(206), GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, power_signal_interrupt) +GPIO_INT(PCH_SLP_S0_L, PIN(211), GPIO_INT_BOTH | GPIO_PULL_UP, power_signal_interrupt) +GPIO_INT(PCH_SLP_SUS_L, PIN(12), GPIO_INT_BOTH | GPIO_PULL_UP, power_signal_interrupt) +GPIO_INT(VOLUME_UP_L, PIN(31), GPIO_INT_FALLING | GPIO_PULL_UP, button_interrupt) +GPIO_INT(VOLUME_DOWN_L, PIN(47), GPIO_INT_FALLING | GPIO_PULL_UP, button_interrupt) +GPIO_INT(PMIC_INT_L, PIN(50), GPIO_INT_FALLING, power_signal_interrupt) +GPIO_INT(PD_MCU_INT, PIN(122), GPIO_INT_RISING | GPIO_INT_DSLEEP, pd_mcu_interrupt) +GPIO_INT(USB_C0_VBUS_WAKE, PIN(152), GPIO_INT_BOTH, vbus1_evt) +GPIO_INT(USB_C1_VBUS_WAKE, PIN(123), GPIO_INT_BOTH, vbus0_evt) +GPIO_INT(USB_C0_BC12_INT_L, PIN(124), GPIO_INT_FALLING, usb0_evt) +GPIO_INT(USB_C1_BC12_INT_L, PIN(145), GPIO_INT_FALLING, usb1_evt) /* Delayed PWR_OK from PMIC */ -GPIO_INT(PMIC_DPWROK, PORT(5), 5, GPIO_INT_BOTH, power_signal_interrupt) +GPIO_INT(PMIC_DPWROK, PIN(55), GPIO_INT_BOTH, power_signal_interrupt) -GPIO(PD_RST_L, PORT(13), 0, GPIO_ODR_HIGH) -GPIO(USB2_OTG_ID, PORT(1), 3, GPIO_ODR_LOW) +GPIO(PD_RST_L, PIN(130), GPIO_ODR_HIGH) +GPIO(USB2_OTG_ID, PIN(13), GPIO_ODR_LOW) /* I2C pins - these will be reconfigured for alternate function below */ -GPIO(I2C0_0_SCL, PORT(1), 5, GPIO_INPUT) -GPIO(I2C0_0_SDA, PORT(1), 6, GPIO_INPUT) -GPIO(I2C0_1_SCL, PORT(13), 4, GPIO_INPUT) -GPIO(I2C0_1_SDA, PORT(1), 7, GPIO_INPUT) -GPIO(I2C1_SCL, PORT(2), 2, GPIO_INPUT) -GPIO(I2C1_SDA, PORT(2), 3, GPIO_INPUT) -GPIO(I2C2_SCL, PORT(2), 0, GPIO_INPUT) -GPIO(I2C2_SDA, PORT(2), 1, GPIO_INPUT) -GPIO(I2C3_SCL, PORT(2), 4, GPIO_INPUT) -GPIO(I2C3_SDA, PORT(2), 5, GPIO_INPUT) -GPIO(PCH_SCI_L, PORT(2), 6, GPIO_ODR_HIGH) +GPIO(I2C0_0_SCL, PIN(15), GPIO_INPUT) +GPIO(I2C0_0_SDA, PIN(16), GPIO_INPUT) +GPIO(I2C0_1_SCL, PIN(134), GPIO_INPUT) +GPIO(I2C0_1_SDA, PIN(17), GPIO_INPUT) +GPIO(I2C1_SCL, PIN(22), GPIO_INPUT) +GPIO(I2C1_SDA, PIN(23), GPIO_INPUT) +GPIO(I2C2_SCL, PIN(20), GPIO_INPUT) +GPIO(I2C2_SDA, PIN(21), GPIO_INPUT) +GPIO(I2C3_SCL, PIN(24), GPIO_INPUT) +GPIO(I2C3_SDA, PIN(25), GPIO_INPUT) +GPIO(PCH_SCI_L, PIN(26), GPIO_ODR_HIGH) /* KB BL PWM, only connected to TP */ -GPIO(PWM_KBLIGHT, PORT(3), 4, GPIO_OUT_LOW) -GPIO(USB1_ENABLE, PORT(3), 6, GPIO_OUT_HIGH) -GPIO(USB2_ENABLE, PORT(6), 7, GPIO_OUT_HIGH) -GPIO(ENTERING_RW, PORT(4), 1, GPIO_OUT_LOW) -GPIO(PCH_SMI_L, PORT(4), 4, GPIO_ODR_HIGH) -GPIO(PCH_PWRBTN_L, PORT(4), 5, GPIO_OUTPUT) -GPIO(USB_C0_DP_HPD, PORT(4), 6, GPIO_OUT_LOW) -GPIO(USB_C1_DP_HPD, PORT(5), 1, GPIO_OUT_LOW) -GPIO(CPU_PROCHOT, PORT(5), 2, GPIO_OUT_LOW) -GPIO(ENABLE_TOUCHPAD, PORT(5), 3, GPIO_OUT_LOW) -GPIO(USB_PD_WAKE, PORT(6), 0, GPIO_OUT_LOW) +GPIO(PWM_KBLIGHT, PIN(34), GPIO_OUT_LOW) +GPIO(USB1_ENABLE, PIN(36), GPIO_OUT_HIGH) +GPIO(USB2_ENABLE, PIN(67), GPIO_OUT_HIGH) +GPIO(ENTERING_RW, PIN(41), GPIO_OUT_LOW) +GPIO(PCH_SMI_L, PIN(44), GPIO_ODR_HIGH) +GPIO(PCH_PWRBTN_L, PIN(45), GPIO_OUTPUT) +GPIO(USB_C0_DP_HPD, PIN(46), GPIO_OUT_LOW) +GPIO(USB_C1_DP_HPD, PIN(51), GPIO_OUT_LOW) +GPIO(CPU_PROCHOT, PIN(52), GPIO_OUT_LOW) +GPIO(ENABLE_TOUCHPAD, PIN(53), GPIO_OUT_LOW) +GPIO(USB_PD_WAKE, PIN(60), GPIO_OUT_LOW) /* When asserted, ME does not lock security descriptor */ -GPIO(PCH_SEC_DISABLE_L, PORT(6), 5, GPIO_OUT_HIGH) -GPIO(PCH_WAKE_L, PORT(6), 6, GPIO_ODR_HIGH) -GPIO(EC_FAN1_TTACH, PORT(10), 5, GPIO_INPUT) +GPIO(PCH_SEC_DISABLE_L, PIN(65), GPIO_OUT_HIGH) +GPIO(PCH_WAKE_L, PIN(66), GPIO_ODR_HIGH) +GPIO(EC_FAN1_TTACH, PIN(105), GPIO_INPUT) /* Fan PWM output - NC / testing only */ -GPIO(EC_FAN1_PWM, PORT(13), 6, GPIO_OUT_LOW) -GPIO(PCH_ACOK, PORT(11), 0, GPIO_OUT_LOW) +GPIO(EC_FAN1_PWM, PIN(136), GPIO_OUT_LOW) +GPIO(PCH_ACOK, PIN(110), GPIO_OUT_LOW) /* Interrupts from accelerometer / gyro -- not yet implemented */ -GPIO(ACCEL1_INT, PORT(16), 1, GPIO_INPUT) -GPIO(ACCEL2_INT, PORT(12), 7, GPIO_INPUT) -GPIO(ACCEL3_INT, PORT(14), 7, GPIO_INPUT) -GPIO(ACCEL4_INT, PORT(13), 3, GPIO_INPUT) -GPIO(WLAN_OFF_L, PORT(13), 2, GPIO_OUT_LOW) +GPIO(ACCEL1_INT, PIN(161), GPIO_INPUT) +GPIO(ACCEL2_INT, PIN(127), GPIO_INPUT) +GPIO(ACCEL3_INT, PIN(147), GPIO_INPUT) +GPIO(ACCEL4_INT, PIN(133), GPIO_INPUT) +GPIO(WLAN_OFF_L, PIN(132), GPIO_OUT_LOW) /* RCIN# line to PCH for 8042 emulation */ -GPIO(PCH_RCIN_L, PORT(13), 5, GPIO_ODR_HIGH) -GPIO(USB2_OTG_VBUSSENSE, PORT(14), 0, GPIO_OUT_LOW) +GPIO(PCH_RCIN_L, PIN(135), GPIO_ODR_HIGH) +GPIO(USB2_OTG_VBUSSENSE, PIN(140), GPIO_OUT_LOW) /* Sensor input for KB PROX - UNUSED */ -GPIO(KB_PROX_INT_L, PORT(14), 1, GPIO_INPUT) -GPIO(PCH_RSMRST_L, PORT(14), 3, GPIO_OUT_LOW) +GPIO(KB_PROX_INT_L, PIN(141), GPIO_INPUT) +GPIO(PCH_RSMRST_L, PIN(143), GPIO_OUT_LOW) /* prochot input from devices */ -GPIO(PLATFORM_EC_PROCHOT, PORT(15), 1, GPIO_INPUT) -GPIO(USB_C0_5V_EN, PORT(15), 4, GPIO_OUT_LOW) -GPIO(USB_C1_5V_EN, PORT(20), 4, GPIO_OUT_LOW) -GPIO(USB_C0_CHARGE_EN_L, PORT(6), 4, GPIO_OUT_LOW) -GPIO(USB_C1_CHARGE_EN_L, PORT(15), 7, GPIO_OUT_LOW) -GPIO(PP1800_DX_SENSOR_EN, PORT(1), 1, GPIO_OUT_LOW) -GPIO(PP1800_DX_AUDIO_EN, PORT(16), 0, GPIO_OUT_LOW) -GPIO(PCH_RTCRST, PORT(16), 3, GPIO_OUT_LOW) +GPIO(PLATFORM_EC_PROCHOT, PIN(151), GPIO_INPUT) +GPIO(USB_C0_5V_EN, PIN(154), GPIO_OUT_LOW) +GPIO(USB_C1_5V_EN, PIN(204), GPIO_OUT_LOW) +GPIO(USB_C0_CHARGE_EN_L, PIN(64), GPIO_OUT_LOW) +GPIO(USB_C1_CHARGE_EN_L, PIN(157), GPIO_OUT_LOW) +GPIO(PP1800_DX_SENSOR_EN, PIN(11), GPIO_OUT_LOW) +GPIO(PP1800_DX_AUDIO_EN, PIN(160), GPIO_OUT_LOW) +GPIO(PCH_RTCRST, PIN(163), GPIO_OUT_LOW) /* From lid sensor */ -GPIO(TABLET_MODE, PORT(20), 1, GPIO_INPUT) -GPIO(ENABLE_BACKLIGHT, PORT(20), 2, GPIO_OUT_HIGH) -GPIO(PP3300_WLAN_EN, PORT(20), 3, GPIO_OUT_LOW) -GPIO(EC_WAKE_CLK, PORT(21), 0, GPIO_INPUT) -GPIO(BOARD_ID0, PORT(0), 6, GPIO_INPUT) -GPIO(BOARD_ID1, PORT(0), 7, GPIO_INPUT) -GPIO(BOARD_ID2, PORT(1), 0, GPIO_INPUT) -GPIO(KBD_KSO2, PORT(10), 1, GPIO_OUT_LOW) -GPIO(PVT_CS0, PORT(14), 6, GPIO_ODR_HIGH) -GPIO(SYS_RESET_L, PORT(12), 1, GPIO_ODR_HIGH) +GPIO(TABLET_MODE, PIN(201), GPIO_INPUT) +GPIO(ENABLE_BACKLIGHT, PIN(202), GPIO_OUT_HIGH) +GPIO(PP3300_WLAN_EN, PIN(203), GPIO_OUT_LOW) +GPIO(EC_WAKE_CLK, PIN(210), GPIO_INPUT) +GPIO(BOARD_ID0, PIN(6), GPIO_INPUT) +GPIO(BOARD_ID1, PIN(7), GPIO_INPUT) +GPIO(BOARD_ID2, PIN(10), GPIO_INPUT) +GPIO(KBD_KSO2, PIN(101), GPIO_OUT_LOW) +GPIO(PVT_CS0, PIN(146), GPIO_ODR_HIGH) +GPIO(SYS_RESET_L, PIN(121), GPIO_ODR_HIGH) /* Alternate functions GPIO definitions */ /* GPIO162(UART_RX), GPIO165(UART_TX) */ -ALTERNATE(PORT(16), 0x24, 1, MODULE_UART, 0) +ALTERNATE(PIN_MASK(16, 0x24), 1, MODULE_UART, 0) /* KB pins */ /* KB ROW - GPIO000-GPIO005 */ -ALTERNATE(PORT(0), 0x3f, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) +ALTERNATE(PIN_MASK(0, 0x3f), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) /* KB ROW - GPIO100-GPIO104, GPIO106-GPIO107 */ -ALTERNATE(PORT(10), 0xdf, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) +ALTERNATE(PIN_MASK(10, 0xdf), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) /* KB COL - GPIO032 */ -ALTERNATE(PORT(3), 0x04, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) +ALTERNATE(PIN_MASK(3, 0x04), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) /* KB COL - GPIO040, GPIO42-GPIO43 */ -ALTERNATE(PORT(4), 0x0d, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) +ALTERNATE(PIN_MASK(4, 0x0d), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) /* KB COL - GPIO125-GPIO126 */ -ALTERNATE(PORT(12), 0x60, 2, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) +ALTERNATE(PIN_MASK(12, 0x60), 2, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) /* KB COL - GPIO142, GPIO144 */ -ALTERNATE(PORT(14), 0x14, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) +ALTERNATE(PIN_MASK(14, 0x14), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) /* LPC pins */ /* LPC_CLK_RUN_L - GPIO014 */ -ALTERNATE(PORT(1), 0x10, 1, MODULE_LPC, 0) +ALTERNATE(PIN_MASK(1, 0x10), 1, MODULE_LPC, 0) /* LAD[0:3] - GPIO111-GPIO114, SERIRQ - GPIO115, PCI_CLK - GPIO117 */ -ALTERNATE(PORT(11), 0xbe, 1, MODULE_LPC, 0) +ALTERNATE(PIN_MASK(11, 0xbe), 1, MODULE_LPC, 0) /* LRESET# - GPIO116 */ -ALTERNATE(PORT(11), 0x40, 1, MODULE_LPC, GPIO_INT_BOTH) +ALTERNATE(PIN_MASK(11, 0x40), 1, MODULE_LPC, GPIO_INT_BOTH) /* LFRAME# - GPIO120 */ -ALTERNATE(PORT(12), 0x01, 1, MODULE_LPC, 0) +ALTERNATE(PIN_MASK(12, 0x01), 1, MODULE_LPC, 0) /* SPI pins */ /* MOSI - GPIO054 */ -ALTERNATE(PORT(5), 0x10, 1, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(5, 0x10), 1, MODULE_SPI, 0) /* PVT_CS0# - GPIO146 */ -ALTERNATE(PORT(14), 0x40, 1, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(14, 0x40), 1, MODULE_SPI, 0) /* MISO - GPIO164 */ -ALTERNATE(PORT(16), 0x10, 1, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(16, 0x10), 1, MODULE_SPI, 0) /* PVT_SCLK - GPIO153 */ -ALTERNATE(PORT(15), 0x08, 1, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(15, 0x08), 1, MODULE_SPI, 0) /* SHD_CS0# - GPIO150. Shared SPI chip select */ -ALTERNATE(PORT(15), 0x00, 1, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(15, 0x00), 1, MODULE_SPI, 0) /* I2C pins */ /* I2C0_0 CLK - GPIO015, I2C0_0 DAT - GPIO016, I2C0_1 DAT - GPIO017 */ -ALTERNATE(PORT(1), 0xe0, 2, MODULE_I2C, GPIO_ODR_HIGH) +ALTERNATE(PIN_MASK(1, 0xe0), 2, MODULE_I2C, GPIO_ODR_HIGH) /* I2C{1,2,3} CLK / DAT - GPIO020-GPIO025*/ -ALTERNATE(PORT(2), 0x3f, 2, MODULE_I2C, GPIO_ODR_HIGH) +ALTERNATE(PIN_MASK(2, 0x3f), 2, MODULE_I2C, GPIO_ODR_HIGH) /* I2C0_1 CLK - GPIO134 */ -ALTERNATE(PORT(13), 0x10, 2, MODULE_I2C, GPIO_ODR_HIGH) +ALTERNATE(PIN_MASK(13, 0x10), 2, MODULE_I2C, GPIO_ODR_HIGH) /* ADC pins */ /* ADC0 - GPIO056 / EC_BATT_TMP. ADC1 - GPIO057 / PPVAR_BOOSTIN_SENSE */ -ALTERNATE(PORT(5), 0xc0, 1, MODULE_ADC, GPIO_ANALOG) +ALTERNATE(PIN_MASK(5, 0xc0), 1, MODULE_ADC, GPIO_ANALOG) /* ADC3 - GPIO061 / IADP_ACMON_BMON. ADC4 - GPIO062 / PMON_PSYS */ -ALTERNATE(PORT(6), 0x06, 1, MODULE_ADC, GPIO_ANALOG) +ALTERNATE(PIN_MASK(6, 0x06), 1, MODULE_ADC, GPIO_ANALOG) /* LED1 - GPIO155. LED2 - GPIO156 */ -ALTERNATE(PORT(15), 0x60, 2, MODULE_POWER_LED, 0) +ALTERNATE(PIN_MASK(15, 0x60), 2, MODULE_POWER_LED, 0) /* VCC1_RST# - GPIO131 */ -ALTERNATE(PORT(13), 0x02, 1, MODULE_PMU, 0) +ALTERNATE(PIN_MASK(13, 0x02), 1, MODULE_PMU, 0) /* nRESET_OUT - GPIO121 */ -ALTERNATE(PORT(12), 0x02, 1, MODULE_PMU, 0) +ALTERNATE(PIN_MASK(12, 0x02), 1, MODULE_PMU, 0) diff --git a/board/glados/lfw/gpio.inc b/board/glados/lfw/gpio.inc index f7500436eb..b7743916bc 100644 --- a/board/glados/lfw/gpio.inc +++ b/board/glados/lfw/gpio.inc @@ -8,12 +8,12 @@ */ /* SPI PVT chip select */ -GPIO(PVT_CS0, PORT(14), 6, GPIO_ODR_HIGH) +GPIO(PVT_CS0, PIN(146), GPIO_ODR_HIGH) /* Alternate functions GPIO definition */ /* UART */ -ALTERNATE(PORT(16), 0x24, 1, MODULE_UART, 0) +ALTERNATE(PIN_MASK(16, 0x24), 1, MODULE_UART, 0) /* SPI pins */ -ALTERNATE(PORT(5), 0x10, 1, MODULE_SPI, 0) -ALTERNATE(PORT(16), 0x10, 1, MODULE_SPI, 0) -ALTERNATE(PORT(15), 0x08, 1, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(5, 0x10), 1, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(16, 0x10), 1, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(15, 0x08), 1, MODULE_SPI, 0) diff --git a/board/glower/gpio.inc b/board/glower/gpio.inc index 5da064b9de..1eb3ca20ad 100644 --- a/board/glower/gpio.inc +++ b/board/glower/gpio.inc @@ -6,89 +6,89 @@ */ /* Inputs with interrupt handlers are first for efficiency */ -GPIO_INT(POWER_BUTTON_L, PORT(20), 3, GPIO_INT_BOTH, power_button_interrupt) -GPIO_INT(LID_OPEN, PORT(16), 0, GPIO_INT_BOTH, lid_interrupt) -GPIO_INT(AC_PRESENT, PORT(16), 3, GPIO_INT_BOTH, extpower_interrupt) -GPIO_INT(PCH_SLP_S3_L, PORT(20), 4, GPIO_INT_BOTH | GPIO_PULL_UP, power_signal_interrupt) /* SLP_S3# signal from PCH */ -GPIO_INT(PCH_SLP_S4_L, PORT(21), 0, GPIO_INT_BOTH | GPIO_PULL_UP, power_signal_interrupt) /* SLP_S4# signal from PCH */ -GPIO_INT(PP1050_PGOOD, PORT(13), 3, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 1.05V */ -GPIO_INT(PP3300_PCH_PGOOD, PORT(4), 4, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 3.3V (PCH supply) */ -GPIO_INT(PP5000_PGOOD, PORT(3), 0, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 5V */ -GPIO_INT(S5_PGOOD, PORT(6), 2, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on S5 supplies */ -GPIO_INT(VCORE_PGOOD, PORT(5), 7, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on core VR */ -GPIO_INT(WP_L, PORT(1), 2, GPIO_INT_BOTH, switch_interrupt) /* Write protect input */ +GPIO_INT(POWER_BUTTON_L, PIN(203), GPIO_INT_BOTH, power_button_interrupt) +GPIO_INT(LID_OPEN, PIN(160), GPIO_INT_BOTH, lid_interrupt) +GPIO_INT(AC_PRESENT, PIN(163), GPIO_INT_BOTH, extpower_interrupt) +GPIO_INT(PCH_SLP_S3_L, PIN(204), GPIO_INT_BOTH | GPIO_PULL_UP, power_signal_interrupt) /* SLP_S3# signal from PCH */ +GPIO_INT(PCH_SLP_S4_L, PIN(210), GPIO_INT_BOTH | GPIO_PULL_UP, power_signal_interrupt) /* SLP_S4# signal from PCH */ +GPIO_INT(PP1050_PGOOD, PIN(133), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 1.05V */ +GPIO_INT(PP3300_PCH_PGOOD, PIN(44), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 3.3V (PCH supply) */ +GPIO_INT(PP5000_PGOOD, PIN(30), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 5V */ +GPIO_INT(S5_PGOOD, PIN(62), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on S5 supplies */ +GPIO_INT(VCORE_PGOOD, PIN(57), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on core VR */ +GPIO_INT(WP_L, PIN(12), GPIO_INT_BOTH, switch_interrupt) /* Write protect input */ /* Other inputs */ -GPIO(BOARD_VERSION1, PORT(0), 6, GPIO_INPUT) -GPIO(BOARD_VERSION2, PORT(12), 3, GPIO_INPUT) -GPIO(BOARD_VERSION3, PORT(12), 7, GPIO_INPUT) +GPIO(BOARD_VERSION1, PIN(6), GPIO_INPUT) +GPIO(BOARD_VERSION2, PIN(123), GPIO_INPUT) +GPIO(BOARD_VERSION3, PIN(127), GPIO_INPUT) #ifdef CONFIG_CHIPSET_DEBUG -GPIO(PCH_SLP_SX_L, PORT(21), 1, GPIO_INPUT | GPIO_PULL_UP) -GPIO(PCH_SUS_STAT_L, PORT(20), 1, GPIO_INPUT | GPIO_PULL_UP) -GPIO(PCH_SUSPWRDNACK, PORT(4), 6, GPIO_INPUT | GPIO_PULL_UP) +GPIO(PCH_SLP_SX_L, PIN(211), GPIO_INPUT | GPIO_PULL_UP) +GPIO(PCH_SUS_STAT_L, PIN(201), GPIO_INPUT | GPIO_PULL_UP) +GPIO(PCH_SUSPWRDNACK, PIN(46), GPIO_INPUT | GPIO_PULL_UP) #endif -GPIO(PP1000_S0IX_PGOOD, PORT(3), 5, GPIO_INPUT) -GPIO(USB1_OC_L, PORT(13), 4, GPIO_INPUT) -GPIO(USB2_OC_L, PORT(1), 6, GPIO_INPUT) +GPIO(PP1000_S0IX_PGOOD, PIN(35), GPIO_INPUT) +GPIO(USB1_OC_L, PIN(134),GPIO_INPUT) +GPIO(USB2_OC_L, PIN(16), GPIO_INPUT) /* Outputs; all unasserted by default except for reset signals */ -GPIO(CPU_PROCHOT, PORT(14), 5, GPIO_OUT_LOW) /* Force CPU to think it's overheated */ -GPIO(ENABLE_BACKLIGHT, PORT(20), 0, GPIO_ODR_HIGH) /* Enable backlight power */ -GPIO(ENABLE_TOUCHPAD, PORT(6), 4, GPIO_OUT_LOW) /* Enable touchpad power */ -GPIO(ENTERING_RW, PORT(3), 3, GPIO_OUT_LOW) /* Indicate when EC is entering RW code */ -GPIO(LPC_CLKRUN_L, PORT(1), 4, GPIO_ODR_HIGH) /* Request that PCH drive LPC clock */ -GPIO(PCH_CORE_PWROK, PORT(12), 2, GPIO_OUT_LOW) /* Indicate core well power is stable */ -GPIO(PCH_PWRBTN_L, PORT(13), 0, GPIO_ODR_HIGH) /* Power button output to PCH */ -GPIO(PCH_RCIN_L, PORT(14), 0, GPIO_ODR_HIGH) /* Reset line to PCH (for 8042 emulation) */ -GPIO(PCH_RSMRST_L, PORT(14), 3, GPIO_OUT_LOW) /* Reset PCH resume power plane logic */ -GPIO(PCH_SMI_L, PORT(5), 5, GPIO_ODR_HIGH) /* System management interrupt to PCH */ -GPIO(PCH_SOC_OVERRIDE_L, PORT(6), 5, GPIO_OUT_LOW) /* SOC override signal to PCH; when high, ME ignores security descriptor */ -GPIO(PCH_SYS_PWROK, PORT(12), 4, GPIO_OUT_LOW) /* EC thinks everything is up and ready */ -GPIO(PCH_WAKE_L, PORT(20), 2, GPIO_ODR_HIGH) /* Wake signal from EC to PCH */ -GPIO(PP1350_EN, PORT(14), 7, GPIO_OUT_LOW) /* Enable 1.35V supply */ -GPIO(PP3300_DX_EN, PORT(5), 0, GPIO_OUT_LOW) /* Enable power to lots of peripherals */ -GPIO(PP3300_LTE_EN, PORT(1), 1, GPIO_OUT_LOW) /* Enable LTE radio */ -GPIO(PP3300_WLAN_EN, PORT(4), 7, GPIO_OUT_LOW) /* Enable WiFi power */ -GPIO(PP5000_EN, PORT(2), 7, GPIO_OUT_LOW) /* Enable 5V supply */ -GPIO(PPSX_EN, PORT(5), 3, GPIO_INPUT) /* Enable PP1350_PCH_SX, PP1000_PCH_SX */ -GPIO(SUSP_VR_EN, PORT(6), 6, GPIO_OUT_LOW) /* Enable 1.05V regulator */ -GPIO(TOUCHSCREEN_RESET_L, PORT(16), 1, GPIO_OUT_HIGH) /* Reset touch screen */ -GPIO(USB_CTL1, PORT(15), 7, GPIO_OUT_LOW) /* USB control signal 1 to both ports */ -GPIO(USB_ILIM_SEL, PORT(3), 6, GPIO_OUT_LOW) /* USB current limit to both ports */ -GPIO(USB1_ENABLE, PORT(1), 5, GPIO_OUT_LOW) /* USB port 1 output power enable */ -GPIO(USB2_ENABLE, PORT(1), 7, GPIO_OUT_LOW) /* USB port 2 output power enable */ -GPIO(VCORE_EN, PORT(15), 0, GPIO_OUT_LOW) /* Enable core power supplies */ -GPIO(WLAN_OFF_L, PORT(5), 2, GPIO_OUT_LOW) /* Disable WiFi radio */ -GPIO(KBD_IRQ_L, PORT(6), 7, GPIO_ODR_HIGH) /* Negative edge triggered irq. */ -GPIO(BAT_LED0, PORT(15), 4, GPIO_ODR_HIGH) -GPIO(BAT_LED1, PORT(15), 5, GPIO_ODR_HIGH) -GPIO(KBD_KSO2, PORT(10), 1, GPIO_OUT_LOW) +GPIO(CPU_PROCHOT, PIN(145), GPIO_OUT_LOW) /* Force CPU to think it's overheated */ +GPIO(ENABLE_BACKLIGHT, PIN(200), GPIO_ODR_HIGH) /* Enable backlight power */ +GPIO(ENABLE_TOUCHPAD, PIN(64), GPIO_OUT_LOW) /* Enable touchpad power */ +GPIO(ENTERING_RW, PIN(33), GPIO_OUT_LOW) /* Indicate when EC is entering RW code */ +GPIO(LPC_CLKRUN_L, PIN(14), GPIO_ODR_HIGH) /* Request that PCH drive LPC clock */ +GPIO(PCH_CORE_PWROK, PIN(122), GPIO_OUT_LOW) /* Indicate core well power is stable */ +GPIO(PCH_PWRBTN_L, PIN(130), GPIO_ODR_HIGH) /* Power button output to PCH */ +GPIO(PCH_RCIN_L, PIN(140), GPIO_ODR_HIGH) /* Reset line to PCH (for 8042 emulation) */ +GPIO(PCH_RSMRST_L, PIN(143), GPIO_OUT_LOW) /* Reset PCH resume power plane logic */ +GPIO(PCH_SMI_L, PIN(55), GPIO_ODR_HIGH) /* System management interrupt to PCH */ +GPIO(PCH_SOC_OVERRIDE_L, PIN(65), GPIO_OUT_LOW) /* SOC override signal to PCH; when high, ME ignores security descriptor */ +GPIO(PCH_SYS_PWROK, PIN(124), GPIO_OUT_LOW) /* EC thinks everything is up and ready */ +GPIO(PCH_WAKE_L, PIN(202), GPIO_ODR_HIGH) /* Wake signal from EC to PCH */ +GPIO(PP1350_EN, PIN(147), GPIO_OUT_LOW) /* Enable 1.35V supply */ +GPIO(PP3300_DX_EN, PIN(50), GPIO_OUT_LOW) /* Enable power to lots of peripherals */ +GPIO(PP3300_LTE_EN, PIN(11), GPIO_OUT_LOW) /* Enable LTE radio */ +GPIO(PP3300_WLAN_EN, PIN(47), GPIO_OUT_LOW) /* Enable WiFi power */ +GPIO(PP5000_EN, PIN(27), GPIO_OUT_LOW) /* Enable 5V supply */ +GPIO(PPSX_EN, PIN(53), GPIO_INPUT) /* Enable PP1350_PCH_SX, PP1000_PCH_SX */ +GPIO(SUSP_VR_EN, PIN(66), GPIO_OUT_LOW) /* Enable 1.05V regulator */ +GPIO(TOUCHSCREEN_RESET_L, PIN(161), GPIO_OUT_HIGH) /* Reset touch screen */ +GPIO(USB_CTL1, PIN(157), GPIO_OUT_LOW) /* USB control signal 1 to both ports */ +GPIO(USB_ILIM_SEL, PIN(36), GPIO_OUT_LOW) /* USB current limit to both ports */ +GPIO(USB1_ENABLE, PIN(15), GPIO_OUT_LOW) /* USB port 1 output power enable */ +GPIO(USB2_ENABLE, PIN(17), GPIO_OUT_LOW) /* USB port 2 output power enable */ +GPIO(VCORE_EN, PIN(150), GPIO_OUT_LOW) /* Enable core power supplies */ +GPIO(WLAN_OFF_L, PIN(52), GPIO_OUT_LOW) /* Disable WiFi radio */ +GPIO(KBD_IRQ_L, PIN(67), GPIO_ODR_HIGH) /* Negative edge triggered irq. */ +GPIO(BAT_LED0, PIN(154), GPIO_ODR_HIGH) +GPIO(BAT_LED1, PIN(155), GPIO_ODR_HIGH) +GPIO(KBD_KSO2, PIN(101), GPIO_OUT_LOW) -GPIO(SYS_RST_L, PORT(12), 1, GPIO_INPUT) -GPIO(EC_HIB, PORT(3), 4, GPIO_INPUT) -GPIO(ICMNT, PORT(6), 1, GPIO_INPUT) -GPIO(PVT_CS0, PORT(14), 6, GPIO_ODR_HIGH) +GPIO(SYS_RST_L, PIN(121), GPIO_INPUT) +GPIO(EC_HIB, PIN(34), GPIO_INPUT) +GPIO(ICMNT, PIN(61), GPIO_INPUT) +GPIO(PVT_CS0, PIN(146), GPIO_ODR_HIGH) /* Configure VCC_PWRGD as GPIO so that it's internally gated high */ -GPIO(TP78, PORT(6), 3, GPIO_OUT_HIGH) +GPIO(TP78, PIN(63), GPIO_OUT_HIGH) -ALTERNATE(PORT(16), 0x24, 1, MODULE_UART, 0) /* UART0 */ -ALTERNATE(PORT(2), 0x0f, 2, MODULE_I2C, 0) /* I2C1 and I2C2 */ -ALTERNATE(PORT(0), 0xfe, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) -ALTERNATE(PORT(1), 0x03, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) -ALTERNATE(PORT(3), 0x04, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) -ALTERNATE(PORT(4), 0x0d, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) -ALTERNATE(PORT(10), 0xd8, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) -ALTERNATE(PORT(12), 0x60, 2, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) -ALTERNATE(PORT(14), 0x14, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) -ALTERNATE(PORT(2), 0x40, 2, MODULE_LPC, 0) /* LPC SCI */ -ALTERNATE(PORT(15), 0x08, 1, MODULE_SPI, 0) -ALTERNATE(PORT(16), 0x10, 1, MODULE_SPI, 0) -ALTERNATE(PORT(5), 0x10, 1, MODULE_SPI, 0) -ALTERNATE(PORT(1), 0x10, 1, MODULE_LPC, 0) /* 14: CLKRUN# */ -ALTERNATE(PORT(11), 0x9e, 1, MODULE_LPC, 0) /* 111~114:LAD[0:3], 117:PCI_CLK */ -ALTERNATE(PORT(11), 0x40, 1, MODULE_LPC, GPIO_INT_BOTH) /* 116: LRESET# */ -ALTERNATE(PORT(12), 0x01, 1, MODULE_LPC, 0) /* 120: LFRAME# */ +ALTERNATE(PIN_MASK(16, 0x24), 1, MODULE_UART, 0) /* UART0 */ +ALTERNATE(PIN_MASK(2, 0x0f), 2, MODULE_I2C, 0) /* I2C1 and I2C2 */ +ALTERNATE(PIN_MASK(0, 0xfe), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) +ALTERNATE(PIN_MASK(1, 0x03), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) +ALTERNATE(PIN_MASK(3, 0x04), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) +ALTERNATE(PIN_MASK(4, 0x0d), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) +ALTERNATE(PIN_MASK(10, 0xd8), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) +ALTERNATE(PIN_MASK(12, 0x60), 2, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) +ALTERNATE(PIN_MASK(14, 0x14), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) +ALTERNATE(PIN_MASK(2, 0x40), 2, MODULE_LPC, 0) /* LPC SCI */ +ALTERNATE(PIN_MASK(15, 0x08), 1, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(16, 0x10), 1, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(5, 0x10), 1, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(1, 0x10), 1, MODULE_LPC, 0) /* 14: CLKRUN# */ +ALTERNATE(PIN_MASK(11, 0x9e), 1, MODULE_LPC, 0) /* 111~114:LAD[0:3], 117:PCI_CLK */ +ALTERNATE(PIN_MASK(11, 0x40), 1, MODULE_LPC, GPIO_INT_BOTH) /* 116: LRESET# */ +ALTERNATE(PIN_MASK(12, 0x01), 1, MODULE_LPC, 0) /* 120: LFRAME# */ diff --git a/board/glower/lfw/gpio.inc b/board/glower/lfw/gpio.inc index d1bb19cfcb..724214cc0e 100644 --- a/board/glower/lfw/gpio.inc +++ b/board/glower/lfw/gpio.inc @@ -7,10 +7,10 @@ * Minimal set of GPIOs needed for LFW loader */ -GPIO(PVT_CS0, PORT(14), 6, GPIO_ODR_HIGH) /* SPI PVT Chip select */ +GPIO(PVT_CS0, PIN(146), GPIO_ODR_HIGH) /* SPI PVT Chip select */ /* Alternate functions GPIO definition */ -ALTERNATE(PORT(16), 0x24, 1, MODULE_UART, 0) /* UART0 */ -ALTERNATE(PORT(5), 0x10, 1, MODULE_SPI, 0) -ALTERNATE(PORT(16), 0x10, 1, MODULE_SPI, 0) -ALTERNATE(PORT(15), 0x08, 1, MODULE_SPI, 0) /* 153: CLK */ +ALTERNATE(PIN_MASK(16, 0x24), 1, MODULE_UART, 0) /* UART0 */ +ALTERNATE(PIN_MASK(5, 0x10), 1, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(16, 0x10), 1, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(15, 0x08), 1, MODULE_SPI, 0) /* 153: CLK */ diff --git a/board/hadoken/gpio.inc b/board/hadoken/gpio.inc index 26e8a0fd76..eb8be3d3f4 100644 --- a/board/hadoken/gpio.inc +++ b/board/hadoken/gpio.inc @@ -14,48 +14,48 @@ /* * TODO(yjlou): call keyboard_raw_gpio_interrupt() in chip/nrf51/keyboard_raw.c */ -GPIO(KB_IN00, 0, 6, GPIO_KB_INPUT) -GPIO(KB_IN01, 0, 24, GPIO_KB_INPUT) -GPIO(KB_IN02, 0, 1, GPIO_KB_INPUT) -GPIO(KB_IN03, 0, 4, GPIO_KB_INPUT) -GPIO(KB_IN04, 0, 0, GPIO_KB_INPUT) -GPIO(KB_IN05, 0, 30, GPIO_KB_INPUT) -GPIO(KB_IN06, 0, 27, GPIO_KB_INPUT) -GPIO(KB_IN07, 0, 26, GPIO_KB_INPUT) +GPIO(KB_IN00, PIN(0, 6), GPIO_KB_INPUT) +GPIO(KB_IN01, PIN(0, 24), GPIO_KB_INPUT) +GPIO(KB_IN02, PIN(0, 1), GPIO_KB_INPUT) +GPIO(KB_IN03, PIN(0, 4), GPIO_KB_INPUT) +GPIO(KB_IN04, PIN(0, 0), GPIO_KB_INPUT) +GPIO(KB_IN05, PIN(0, 30), GPIO_KB_INPUT) +GPIO(KB_IN06, PIN(0, 27), GPIO_KB_INPUT) +GPIO(KB_IN07, PIN(0, 26), GPIO_KB_INPUT) /* Other inputs */ -GPIO(MCU_GPIO_13, 0, 13, GPIO_INPUT) /* PAIR on the debug board */ -GPIO(MCU_GPIO_14, 0, 14, GPIO_INPUT) /* TP 4 */ -GPIO(MCU_GPIO_17, 0, 17, GPIO_INPUT) /* TP 5 */ -GPIO(MCU_GPIO_19, 0, 19, GPIO_INPUT) /* TP 6 */ -GPIO(BQ27621_GPOUT, 0, 20, GPIO_INPUT) /* Fuel Gauge */ -GPIO(LID_PRESENT_L, 0, 31, GPIO_INPUT) /* Hall sensor */ +GPIO(MCU_GPIO_13, PIN(0, 13), GPIO_INPUT) /* PAIR on the debug board */ +GPIO(MCU_GPIO_14, PIN(0, 14), GPIO_INPUT) /* TP 4 */ +GPIO(MCU_GPIO_17, PIN(0, 17), GPIO_INPUT) /* TP 5 */ +GPIO(MCU_GPIO_19, PIN(0, 19), GPIO_INPUT) /* TP 6 */ +GPIO(BQ27621_GPOUT, PIN(0, 20), GPIO_INPUT) /* Fuel Gauge */ +GPIO(LID_PRESENT_L, PIN(0, 31), GPIO_INPUT) /* Hall sensor */ /* Will be an output at some point */ -GPIO(IND_CHRG_DISABLE, 0, 21, GPIO_INPUT) /* Control for charging */ +GPIO(IND_CHRG_DISABLE, PIN(0, 21), GPIO_INPUT) /* Control for charging */ /* Outputs */ -GPIO(KB_OUT00, 0, 2, GPIO_KB_OUTPUT) -GPIO(KB_OUT01, 0, 10, GPIO_KB_OUTPUT) -GPIO(KB_OUT02, 0, 7, GPIO_KB_OUTPUT) -GPIO(KB_OUT03, 0, 5, GPIO_KB_OUTPUT) -GPIO(KB_OUT04, 0, 3, GPIO_KB_OUTPUT) -GPIO(KB_OUT05, 0, 9, GPIO_KB_OUTPUT) -GPIO(KB_OUT06, 0, 8, GPIO_KB_OUTPUT) -GPIO(KB_OUT07, 0, 28, GPIO_KB_OUTPUT) -GPIO(KB_OUT08, 0, 18, GPIO_KB_OUTPUT) -GPIO(KB_OUT09, 0, 16, GPIO_KB_OUTPUT) -GPIO(KB_OUT10, 0, 12, GPIO_KB_OUTPUT) -GPIO(KB_OUT11, 0, 15, GPIO_KB_OUTPUT) -GPIO(KB_OUT12, 0, 11, GPIO_KB_OUTPUT) +GPIO(KB_OUT00, PIN(0, 2), GPIO_KB_OUTPUT) +GPIO(KB_OUT01, PIN(0, 10), GPIO_KB_OUTPUT) +GPIO(KB_OUT02, PIN(0, 7), GPIO_KB_OUTPUT) +GPIO(KB_OUT03, PIN(0, 5), GPIO_KB_OUTPUT) +GPIO(KB_OUT04, PIN(0, 3), GPIO_KB_OUTPUT) +GPIO(KB_OUT05, PIN(0, 9), GPIO_KB_OUTPUT) +GPIO(KB_OUT06, PIN(0, 8), GPIO_KB_OUTPUT) +GPIO(KB_OUT07, PIN(0, 28), GPIO_KB_OUTPUT) +GPIO(KB_OUT08, PIN(0, 18), GPIO_KB_OUTPUT) +GPIO(KB_OUT09, PIN(0, 16), GPIO_KB_OUTPUT) +GPIO(KB_OUT10, PIN(0, 12), GPIO_KB_OUTPUT) +GPIO(KB_OUT11, PIN(0, 15), GPIO_KB_OUTPUT) +GPIO(KB_OUT12, PIN(0, 11), GPIO_KB_OUTPUT) /* Configure the TWI (I2C) interface in the init function. */ -GPIO(MCU_SCL, 0, 23, GPIO_INPUT | GPIO_PULL_UP | GPIO_OPEN_DRAIN) -GPIO(MCU_SDA, 0, 22, GPIO_INPUT | GPIO_PULL_UP | GPIO_OPEN_DRAIN) +GPIO(MCU_SCL, PIN(0, 23), GPIO_INPUT | GPIO_PULL_UP | GPIO_OPEN_DRAIN) +GPIO(MCU_SDA, PIN(0, 22), GPIO_INPUT | GPIO_PULL_UP | GPIO_OPEN_DRAIN) /* Use port 0 for I2C (TWI0), Pins 22 & 23 */ -ALTERNATE(0, 0x800000, NRF51_TWI0_ALT_FUNC_SCL, MODULE_I2C, GPIO_INPUT | GPIO_PULL_UP | GPIO_OPEN_DRAIN) -ALTERNATE(0, 0x400000, NRF51_TWI0_ALT_FUNC_SDA, MODULE_I2C, GPIO_INPUT | GPIO_PULL_UP | GPIO_OPEN_DRAIN) +ALTERNATE(PIN_MASK(0, 0x800000), NRF51_TWI0_ALT_FUNC_SCL, MODULE_I2C, GPIO_INPUT | GPIO_PULL_UP | GPIO_OPEN_DRAIN) +ALTERNATE(PIN_MASK(0, 0x400000), NRF51_TWI0_ALT_FUNC_SDA, MODULE_I2C, GPIO_INPUT | GPIO_PULL_UP | GPIO_OPEN_DRAIN) /* Unimplemented */ UNIMPLEMENTED(ENTERING_RW) diff --git a/board/hoho/gpio.inc b/board/hoho/gpio.inc index 72c8b93b22..787eaf7e90 100644 --- a/board/hoho/gpio.inc +++ b/board/hoho/gpio.inc @@ -5,30 +5,30 @@ * found in the LICENSE file. */ -GPIO_INT(DP_HPD, A, 0, GPIO_INT_BOTH, hpd_event) +GPIO_INT(DP_HPD, PIN(A, 0), GPIO_INT_BOTH, hpd_event) -GPIO(USB_C_CC1_PD, A, 1, GPIO_ANALOG) -GPIO(STM_READY, A, 2, GPIO_OUT_LOW) /* factory test only */ -GPIO(MCDP_RESET_L, A, 3, GPIO_OUT_HIGH) -GPIO(PD_DAC_REF, A, 4, GPIO_ANALOG) +GPIO(USB_C_CC1_PD, PIN(A, 1), GPIO_ANALOG) +GPIO(STM_READY, PIN(A, 2), GPIO_OUT_LOW) /* factory test only */ +GPIO(MCDP_RESET_L, PIN(A, 3), GPIO_OUT_HIGH) +GPIO(PD_DAC_REF, PIN(A, 4), GPIO_ANALOG) -GPIO(MCDP_READY, A, 7, GPIO_OUT_LOW) /* factory test only */ -GPIO(PD_SBU_ENABLE, A, 8, GPIO_OUT_LOW) -GPIO(USB_DM, A, 11, GPIO_ANALOG) -GPIO(USB_DP, A, 12, GPIO_ANALOG) -GPIO(PD_CC1_TX_EN, A, 15, GPIO_OUT_LOW) +GPIO(MCDP_READY, PIN(A, 7), GPIO_OUT_LOW) /* factory test only */ +GPIO(PD_SBU_ENABLE, PIN(A, 8), GPIO_OUT_LOW) +GPIO(USB_DM, PIN(A, 11), GPIO_ANALOG) +GPIO(USB_DP, PIN(A, 12), GPIO_ANALOG) +GPIO(PD_CC1_TX_EN, PIN(A, 15), GPIO_OUT_LOW) -GPIO(MCDP_GPIO1, B, 0, GPIO_INPUT) -GPIO(MCDP_CONFIG1, B, 1, GPIO_INPUT) -GPIO(PD_MCDP_SPI_WP_L, B, 2, GPIO_OUT_LOW) -GPIO(PD_CC1_TX_DATA, B, 4, GPIO_OUT_LOW) -GPIO(PD_MCDP_SPI_CS_L, B, 12, GPIO_INPUT) +GPIO(MCDP_GPIO1, PIN(B, 0), GPIO_INPUT) +GPIO(MCDP_CONFIG1, PIN(B, 1), GPIO_INPUT) +GPIO(PD_MCDP_SPI_WP_L, PIN(B, 2), GPIO_OUT_LOW) +GPIO(PD_CC1_TX_DATA, PIN(B, 4), GPIO_OUT_LOW) +GPIO(PD_MCDP_SPI_CS_L, PIN(B, 12), GPIO_INPUT) /* Unimplemented signals which we need to emulate for now */ UNIMPLEMENTED(ENTERING_RW) UNIMPLEMENTED(WP_L) -ALTERNATE(B, 0x0008, 0, MODULE_USB_PD, 0) /* SPI1: SCK(PB3) */ -ALTERNATE(B, 0x0200, 2, MODULE_USB_PD, 0) /* TIM17_CH1: PB9 */ -ALTERNATE(A, 0x0600, 1, MODULE_UART, GPIO_PULL_UP) /* USART1: PA9/PA10 */ -ALTERNATE(B, 0x0C00, 4, MODULE_UART, GPIO_PULL_UP) /* USART3: PB10/PB11 */ +ALTERNATE(PIN_MASK(B, 0x0008), 0, MODULE_USB_PD, 0) /* SPI1: SCK(PB3) */ +ALTERNATE(PIN_MASK(B, 0x0200), 2, MODULE_USB_PD, 0) /* TIM17_CH1: PB9 */ +ALTERNATE(PIN_MASK(A, 0x0600), 1, MODULE_UART, GPIO_PULL_UP) /* USART1: PA9/PA10 */ +ALTERNATE(PIN_MASK(B, 0x0C00), 4, MODULE_UART, GPIO_PULL_UP) /* USART3: PB10/PB11 */ diff --git a/board/honeybuns/gpio.inc b/board/honeybuns/gpio.inc index 553ab618fc..94b136acfb 100644 --- a/board/honeybuns/gpio.inc +++ b/board/honeybuns/gpio.inc @@ -5,50 +5,50 @@ * found in the LICENSE file. */ -/*GPIO_INT(DP_HPD, A, 0, GPIO_INT_BOTH, hpd_event)*/ -GPIO(DP_HPD, A, 0, GPIO_INPUT) +/*GPIO_INT(DP_HPD, PIN(A, 0), GPIO_INT_BOTH, hpd_event)*/ +GPIO(DP_HPD, PIN(A, 0), GPIO_INPUT) /* PD RX/TX */ -GPIO(USB_CC1_PD, A, 1, GPIO_ANALOG) -GPIO(PD_VBUS_P, A, 5, GPIO_ANALOG) -GPIO(PD_VBUS_N, A, 6, GPIO_ANALOG) -GPIO(PD_TX_EN, A, 15, GPIO_OUT_LOW) -GPIO(PD_TX_DATA, B, 4, GPIO_OUT_LOW) +GPIO(USB_CC1_PD, PIN(A, 1), GPIO_ANALOG) +GPIO(PD_VBUS_P, PIN(A, 5), GPIO_ANALOG) +GPIO(PD_VBUS_N, PIN(A, 6), GPIO_ANALOG) +GPIO(PD_TX_EN, PIN(A, 15), GPIO_OUT_LOW) +GPIO(PD_TX_DATA, PIN(B, 4), GPIO_OUT_LOW) /* Power and muxes control */ -GPIO(PP20000_EN, A, 8, GPIO_OUT_LOW) -GPIO(PPVAR_VBUS_EN, B, 12, GPIO_OUT_LOW) -GPIO(SS_MUX_OE_L, B, 13, GPIO_OUT_HIGH) -GPIO(SS_MUX_SEL, B, 14, GPIO_OUT_LOW) +GPIO(PP20000_EN, PIN(A, 8), GPIO_OUT_LOW) +GPIO(PPVAR_VBUS_EN, PIN(B, 12), GPIO_OUT_LOW) +GPIO(SS_MUX_OE_L, PIN(B, 13), GPIO_OUT_HIGH) +GPIO(SS_MUX_SEL, PIN(B, 14), GPIO_OUT_LOW) /* Display Port/HDMI */ -GPIO(PD_SBU_ENABLE, A, 7, GPIO_OUT_LOW) +GPIO(PD_SBU_ENABLE, PIN(A, 7), GPIO_OUT_LOW) /* Chip Resets */ -GPIO(BRIDGE_RESET_L, B, 0, GPIO_OUT_HIGH) -GPIO(SPLITTER_RESET_L, B, 1, GPIO_OUT_HIGH) -GPIO(HUB_RESET_L, B, 15, GPIO_OUT_HIGH) +GPIO(BRIDGE_RESET_L, PIN(B, 0), GPIO_OUT_HIGH) +GPIO(SPLITTER_RESET_L, PIN(B, 1), GPIO_OUT_HIGH) +GPIO(HUB_RESET_L, PIN(B, 15), GPIO_OUT_HIGH) /* * I2C pins should be configured as inputs until I2C module is * initialized. This will avoid driving the lines unintentionally. */ -GPIO(MASTER_I2C_SCL, B, 6, GPIO_INPUT) -GPIO(MASTER_I2C_SDA, B, 7, GPIO_INPUT) +GPIO(MASTER_I2C_SCL, PIN(B, 6), GPIO_INPUT) +GPIO(MASTER_I2C_SDA, PIN(B, 7), GPIO_INPUT) /* Test points */ -GPIO(TP6, A, 13, GPIO_OUT_HIGH /*GPIO_ODR_HIGH*/) -GPIO(TP7, A, 14, GPIO_OUT_LOW /*GPIO_ODR_HIGH*/) +GPIO(TP6, PIN(A, 13), GPIO_OUT_HIGH /*GPIO_ODR_HIGH*/) +GPIO(TP7, PIN(A, 14), GPIO_OUT_LOW /*GPIO_ODR_HIGH*/) /* Unimplemented signals which we need to emulate for now */ UNIMPLEMENTED(ENTERING_RW) UNIMPLEMENTED(WP_L) -ALTERNATE(B, 0x0018, 0, MODULE_USB_PD, 0) /* SPI1 SCK/MISO: PB3/PB4 */ -ALTERNATE(B, 0x0200, 2, MODULE_USB_PD, 0) /* TIM17_CH1: PB9 */ -ALTERNATE(A, 0x0600, 1, MODULE_UART, GPIO_PULL_UP) /* USART1: PA9/PA10 */ -ALTERNATE(A, 0x000C, 1, MODULE_UART, GPIO_PULL_UP) /* USART2: PA2/PA3 */ -ALTERNATE(B, 0x0C00, 4, MODULE_UART, GPIO_PULL_UP) /* USART3: PB10/PB11 */ -ALTERNATE(B, 0x00C0, 1, MODULE_I2C, 0) /* I2C MASTER: PB6/PB7 */ +ALTERNATE(PIN_MASK(B, 0x0018), 0, MODULE_USB_PD, 0) /* SPI1 SCK/MISO: PB3/PB4 */ +ALTERNATE(PIN_MASK(B, 0x0200), 2, MODULE_USB_PD, 0) /* TIM17_CH1: PB9 */ +ALTERNATE(PIN_MASK(A, 0x0600), 1, MODULE_UART, GPIO_PULL_UP) /* USART1: PA9/PA10 */ +ALTERNATE(PIN_MASK(A, 0x000C), 1, MODULE_UART, GPIO_PULL_UP) /* USART2: PA2/PA3 */ +ALTERNATE(PIN_MASK(B, 0x0C00), 4, MODULE_UART, GPIO_PULL_UP) /* USART3: PB10/PB11 */ +ALTERNATE(PIN_MASK(B, 0x00C0), 1, MODULE_I2C, 0) /* I2C MASTER: PB6/PB7 */ diff --git a/board/host/gpio.inc b/board/host/gpio.inc index 5a69bb5848..8a9c3ae1a5 100644 --- a/board/host/gpio.inc +++ b/board/host/gpio.inc @@ -5,19 +5,19 @@ * found in the LICENSE file. */ -GPIO_INT(LID_OPEN, 0, 0, GPIO_INT_BOTH, lid_interrupt) -GPIO_INT(POWER_BUTTON_L, 0, 0, GPIO_INT_BOTH, power_button_interrupt) -GPIO_INT(AC_PRESENT, 0, 0, GPIO_INT_BOTH, extpower_interrupt) -GPIO_INT(BUTTON_VOLUME_DOWN_L, 0, 0, GPIO_INT_BOTH, button_interrupt) -GPIO_INT(BUTTON_VOLUME_UP, 0, 0, GPIO_INT_BOTH, button_interrupt) -GPIO_INT(CHARGE_DONE, 0, 0, GPIO_INT_BOTH, inductive_charging_interrupt) +GPIO_INT(LID_OPEN, PIN(0, 0), GPIO_INT_BOTH, lid_interrupt) +GPIO_INT(POWER_BUTTON_L, PIN(0, 0), GPIO_INT_BOTH, power_button_interrupt) +GPIO_INT(AC_PRESENT, PIN(0, 0), GPIO_INT_BOTH, extpower_interrupt) +GPIO_INT(BUTTON_VOLUME_DOWN_L, PIN(0, 0), GPIO_INT_BOTH, button_interrupt) +GPIO_INT(BUTTON_VOLUME_UP, PIN(0, 0), GPIO_INT_BOTH, button_interrupt) +GPIO_INT(CHARGE_DONE, PIN(0, 0), GPIO_INT_BOTH, inductive_charging_interrupt) -GPIO(EC_INT, 0, 0, 0) -GPIO(WP, 0, 0, 0) -GPIO(ENTERING_RW, 0, 0, 0) -GPIO(PCH_BKLTEN, 0, 0, 0) -GPIO(ENABLE_BACKLIGHT, 0, 0, 0) +GPIO(EC_INT, PIN(0, 0), 0) +GPIO(WP, PIN(0, 0), 0) +GPIO(ENTERING_RW, PIN(0, 0), 0) +GPIO(PCH_BKLTEN, PIN(0, 0), 0) +GPIO(ENABLE_BACKLIGHT, PIN(0, 0), 0) /* Inductive charging */ -GPIO(CHARGE_EN, 0, 0, 0) -GPIO(BASE_CHG_VDD_EN, 0, 0, 0) +GPIO(CHARGE_EN, PIN(0, 0), 0) +GPIO(BASE_CHG_VDD_EN, PIN(0, 0), 0) diff --git a/board/it8380dev/gpio.inc b/board/it8380dev/gpio.inc index d94ea6cd45..8401f8bc51 100644 --- a/board/it8380dev/gpio.inc +++ b/board/it8380dev/gpio.inc @@ -5,34 +5,34 @@ * found in the LICENSE file. */ -GPIO_INT(POWER_BUTTON_L, E, 4, GPIO_INT_BOTH | GPIO_PULL_UP, power_button_interrupt) -GPIO_INT(LID_OPEN, E, 2, GPIO_INT_BOTH | GPIO_PULL_DOWN, lid_interrupt) +GPIO_INT(POWER_BUTTON_L, PIN(E, 4), GPIO_INT_BOTH | GPIO_PULL_UP, power_button_interrupt) +GPIO_INT(LID_OPEN, PIN(E, 2), GPIO_INT_BOTH | GPIO_PULL_DOWN, lid_interrupt) -GPIO(H_LED0, A, 0, GPIO_ODR_HIGH) -GPIO(H_LED1, A, 1, GPIO_ODR_HIGH) -GPIO(H_LED2, A, 2, GPIO_ODR_HIGH) -GPIO(H_LED3, A, 3, GPIO_ODR_HIGH) -GPIO(H_LED4, A, 4, GPIO_ODR_HIGH) -GPIO(H_LED5, A, 5, GPIO_ODR_HIGH) -GPIO(H_LED6, A, 6, GPIO_ODR_HIGH) -GPIO(L_LED0, I, 0, GPIO_ODR_HIGH) -GPIO(L_LED1, I, 1, GPIO_ODR_HIGH) -GPIO(L_LED2, I, 2, GPIO_ODR_HIGH) -GPIO(L_LED3, I, 3, GPIO_ODR_HIGH) -GPIO(L_LED4, I, 4, GPIO_ODR_HIGH) -GPIO(L_LED5, I, 5, GPIO_ODR_HIGH) -GPIO(L_LED6, I, 6, GPIO_ODR_HIGH) -GPIO(BUSY_LED, J, 0, GPIO_OUT_LOW) -GPIO(GOOD_LED, J, 1, GPIO_OUT_HIGH) -GPIO(FAIL_LED, J, 2, GPIO_OUT_LOW) -GPIO(PCH_PLTRST_L, E, 3, GPIO_INPUT) -GPIO(PCH_SMI_L, D, 3, GPIO_OUT_HIGH) -GPIO(PCH_SCI_L, D, 4, GPIO_OUT_HIGH) -GPIO(GATE_A20_H, B, 5, GPIO_OUT_HIGH) -GPIO(PCH_RCIN_L, B, 6, GPIO_OUT_HIGH) -GPIO(LPC_CLKRUN_L, H, 0, GPIO_OUT_LOW) +GPIO(H_LED0, PIN(A, 0), GPIO_ODR_HIGH) +GPIO(H_LED1, PIN(A, 1), GPIO_ODR_HIGH) +GPIO(H_LED2, PIN(A, 2), GPIO_ODR_HIGH) +GPIO(H_LED3, PIN(A, 3), GPIO_ODR_HIGH) +GPIO(H_LED4, PIN(A, 4), GPIO_ODR_HIGH) +GPIO(H_LED5, PIN(A, 5), GPIO_ODR_HIGH) +GPIO(H_LED6, PIN(A, 6), GPIO_ODR_HIGH) +GPIO(L_LED0, PIN(I, 0), GPIO_ODR_HIGH) +GPIO(L_LED1, PIN(I, 1), GPIO_ODR_HIGH) +GPIO(L_LED2, PIN(I, 2), GPIO_ODR_HIGH) +GPIO(L_LED3, PIN(I, 3), GPIO_ODR_HIGH) +GPIO(L_LED4, PIN(I, 4), GPIO_ODR_HIGH) +GPIO(L_LED5, PIN(I, 5), GPIO_ODR_HIGH) +GPIO(L_LED6, PIN(I, 6), GPIO_ODR_HIGH) +GPIO(BUSY_LED, PIN(J, 0), GPIO_OUT_LOW) +GPIO(GOOD_LED, PIN(J, 1), GPIO_OUT_HIGH) +GPIO(FAIL_LED, PIN(J, 2), GPIO_OUT_LOW) +GPIO(PCH_PLTRST_L, PIN(E, 3), GPIO_INPUT) +GPIO(PCH_SMI_L, PIN(D, 3), GPIO_OUT_HIGH) +GPIO(PCH_SCI_L, PIN(D, 4), GPIO_OUT_HIGH) +GPIO(GATE_A20_H, PIN(B, 5), GPIO_OUT_HIGH) +GPIO(PCH_RCIN_L, PIN(B, 6), GPIO_OUT_HIGH) +GPIO(LPC_CLKRUN_L, PIN(H, 0), GPIO_OUT_LOW) /* Unimplemented signals which we need to emulate for now */ UNIMPLEMENTED(ENTERING_RW) -ALTERNATE(B, 0x03, 1, MODULE_UART, GPIO_PULL_UP) /* UART0 */ +ALTERNATE(PIN_MASK(B, 0x03), 1, MODULE_UART, GPIO_PULL_UP) /* UART0 */ diff --git a/board/jerry/gpio.inc b/board/jerry/gpio.inc index 56be639729..f334dfcf83 100644 --- a/board/jerry/gpio.inc +++ b/board/jerry/gpio.inc @@ -6,54 +6,54 @@ */ /* Inputs with interrupt handlers are first for efficiency */ -GPIO_INT(POWER_BUTTON_L, B, 5, GPIO_INT_BOTH, power_button_interrupt) /* wk6 */ /* active high, the name is for compatibility with existing code */ -GPIO_INT(SOC_POWER_GOOD, A, 3, GPIO_INT_BOTH, power_signal_interrupt) -GPIO_INT(LID_OPEN, C, 13, GPIO_INT_BOTH, lid_interrupt) -GPIO_INT(SUSPEND_L, C, 7, GPIO_INT_BOTH, power_signal_interrupt) -GPIO_INT(SPI1_NSS, A, 4, GPIO_INT_BOTH, spi_event) -GPIO_INT(AC_PRESENT, C, 6, GPIO_INT_BOTH | GPIO_PULL_UP, extpower_interrupt) +GPIO_INT(POWER_BUTTON_L, PIN(B, 5), GPIO_INT_BOTH, power_button_interrupt) /* wk6 */ /* active high, the name is for compatibility with existing code */ +GPIO_INT(SOC_POWER_GOOD, PIN(A, 3), GPIO_INT_BOTH, power_signal_interrupt) +GPIO_INT(LID_OPEN, PIN(C, 13), GPIO_INT_BOTH, lid_interrupt) +GPIO_INT(SUSPEND_L, PIN(C, 7), GPIO_INT_BOTH, power_signal_interrupt) +GPIO_INT(SPI1_NSS, PIN(A, 4), GPIO_INT_BOTH, spi_event) +GPIO_INT(AC_PRESENT, PIN(C, 6), GPIO_INT_BOTH | GPIO_PULL_UP, extpower_interrupt) /* Keyboard inputs */ -GPIO_INT(KB_IN00, C, 8, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN01, C, 9, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN02, C, 10, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN03, C, 11, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN04, C, 12, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN05, C, 14, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN06, C, 15, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN07, D, 2, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN00, PIN(C, 8), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN01, PIN(C, 9), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN02, PIN(C, 10), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN03, PIN(C, 11), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN04, PIN(C, 12), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN05, PIN(C, 14), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN06, PIN(C, 15), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN07, PIN(D, 2), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) /* Other inputs */ -GPIO(EC_WAKE, A, 0, GPIO_INPUT | GPIO_PULL_DOWN) /* wk1 */ -GPIO(WP_L, B, 4, GPIO_INPUT) +GPIO(EC_WAKE, PIN(A, 0), GPIO_INPUT | GPIO_PULL_DOWN) /* wk1 */ +GPIO(WP_L, PIN(B, 4), GPIO_INPUT) /* Outputs */ -GPIO(BAT_LED_RED, B, 11, GPIO_OUT_HIGH) -GPIO(BAT_LED_GREEN, A, 11, GPIO_OUT_HIGH) -GPIO(EC_BL_OVERRIDE, F, 1, GPIO_OUT_LOW) -GPIO(EC_INT, B, 9, GPIO_OUT_LOW) -GPIO(ENTERING_RW, F, 0, GPIO_OUT_LOW) -GPIO(I2C1_SCL, B, 6, GPIO_ODR_HIGH) -GPIO(I2C1_SDA, B, 7, GPIO_ODR_HIGH) -GPIO(KB_OUT00, B, 0, GPIO_KB_OUTPUT) -GPIO(KB_OUT01, B, 8, GPIO_KB_OUTPUT) -GPIO(KB_OUT02, B, 12, GPIO_OUT_LOW) /* Inverted from silegro */ -GPIO(KB_OUT03, B, 13, GPIO_KB_OUTPUT) -GPIO(KB_OUT04, B, 14, GPIO_KB_OUTPUT) -GPIO(KB_OUT05, B, 15, GPIO_KB_OUTPUT) -GPIO(KB_OUT06, C, 0, GPIO_KB_OUTPUT) -GPIO(KB_OUT07, C, 1, GPIO_KB_OUTPUT) -GPIO(KB_OUT08, C, 2, GPIO_KB_OUTPUT) -GPIO(KB_OUT09, B, 1, GPIO_KB_OUTPUT) -GPIO(KB_OUT10, C, 5, GPIO_KB_OUTPUT) -GPIO(KB_OUT11, C, 4, GPIO_KB_OUTPUT) -GPIO(KB_OUT12, A, 13, GPIO_KB_OUTPUT) -GPIO(POWER_LED, A, 2, GPIO_OUT_HIGH) -GPIO(PMIC_PWRON, A, 12, GPIO_OUT_LOW) -GPIO(PMIC_RESET, B, 3, GPIO_OUT_LOW) -GPIO(PMIC_SOURCE_PWREN, B, 10, GPIO_OUT_LOW) -GPIO(PMIC_WARM_RESET_L, C, 3, GPIO_ODR_HIGH) +GPIO(BAT_LED_RED, PIN(B, 11), GPIO_OUT_HIGH) +GPIO(BAT_LED_GREEN, PIN(A, 11), GPIO_OUT_HIGH) +GPIO(EC_BL_OVERRIDE, PIN(F, 1), GPIO_OUT_LOW) +GPIO(EC_INT, PIN(B, 9), GPIO_OUT_LOW) +GPIO(ENTERING_RW, PIN(F, 0), GPIO_OUT_LOW) +GPIO(I2C1_SCL, PIN(B, 6), GPIO_ODR_HIGH) +GPIO(I2C1_SDA, PIN(B, 7), GPIO_ODR_HIGH) +GPIO(KB_OUT00, PIN(B, 0), GPIO_KB_OUTPUT) +GPIO(KB_OUT01, PIN(B, 8), GPIO_KB_OUTPUT) +GPIO(KB_OUT02, PIN(B, 12), GPIO_OUT_LOW) /* Inverted from silegro */ +GPIO(KB_OUT03, PIN(B, 13), GPIO_KB_OUTPUT) +GPIO(KB_OUT04, PIN(B, 14), GPIO_KB_OUTPUT) +GPIO(KB_OUT05, PIN(B, 15), GPIO_KB_OUTPUT) +GPIO(KB_OUT06, PIN(C, 0), GPIO_KB_OUTPUT) +GPIO(KB_OUT07, PIN(C, 1), GPIO_KB_OUTPUT) +GPIO(KB_OUT08, PIN(C, 2), GPIO_KB_OUTPUT) +GPIO(KB_OUT09, PIN(B, 1), GPIO_KB_OUTPUT) +GPIO(KB_OUT10, PIN(C, 5), GPIO_KB_OUTPUT) +GPIO(KB_OUT11, PIN(C, 4), GPIO_KB_OUTPUT) +GPIO(KB_OUT12, PIN(A, 13), GPIO_KB_OUTPUT) +GPIO(POWER_LED, PIN(A, 2), GPIO_OUT_HIGH) +GPIO(PMIC_PWRON, PIN(A, 12), GPIO_OUT_LOW) +GPIO(PMIC_RESET, PIN(B, 3), GPIO_OUT_LOW) +GPIO(PMIC_SOURCE_PWREN, PIN(B, 10), GPIO_OUT_LOW) +GPIO(PMIC_WARM_RESET_L, PIN(C, 3), GPIO_ODR_HIGH) -ALTERNATE(A, 0x00f0, 0, MODULE_SPI, 0) -ALTERNATE(A, 0x0600, 1, MODULE_UART, 0) -ALTERNATE(B, 0x00c0, 1, MODULE_I2C, 0) +ALTERNATE(PIN_MASK(A, 0x00f0), 0, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(A, 0x0600), 1, MODULE_UART, 0) +ALTERNATE(PIN_MASK(B, 0x00c0), 1, MODULE_I2C, 0) diff --git a/board/kunimitsu/gpio.inc b/board/kunimitsu/gpio.inc index 39698c5003..dd5221aab5 100644 --- a/board/kunimitsu/gpio.inc +++ b/board/kunimitsu/gpio.inc @@ -5,139 +5,139 @@ * found in the LICENSE file. */ -GPIO_INT(PCH_SLP_SUS_L, PORT(1), 2, GPIO_INT_BOTH | GPIO_PULL_UP, power_signal_interrupt) /* Deep sleep state */ -GPIO_INT(LID_OPEN, PORT(2), 7, GPIO_INT_BOTH_DSLEEP, lid_interrupt) /* Lid switch */ -GPIO_INT(AC_PRESENT, PORT(3), 0, GPIO_INT_BOTH_DSLEEP, extpower_interrupt) /* BC_ACOK / EC_ACIN - to know if battery or AC connected */ -GPIO_INT(VOLUME_UP_L, PORT(3), 1, GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt) /* Volume up button */ -GPIO_INT(WP_L, PORT(3), 3, GPIO_INT_BOTH, switch_interrupt) /* Write protect input */ -GPIO_INT(POWER_BUTTON_L, PORT(3), 5, GPIO_INT_BOTH_DSLEEP, power_button_interrupt) /* Power button */ -GPIO_INT(VOLUME_DOWN_L, PORT(4), 7, GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt) /* Volume down button */ -GPIO_INT(PMIC_INT, PORT(5), 0, GPIO_INT_FALLING, power_signal_interrupt) /* Alert signal from PMIC */ -GPIO_INT(PD_MCU_INT, PORT(12), 2, GPIO_INT_RISING | GPIO_INT_DSLEEP, pd_mcu_interrupt) /* Interrupt from USB PD Controller to EC */ -GPIO_INT(RSMRST_L_PGOOD, PORT(6), 3, GPIO_INT_BOTH, power_signal_interrupt) /* RSMRST_N_PWRGD from power logic */ -GPIO_INT(USB_C1_VBUS_WAKE, PORT(12), 3, GPIO_INT_BOTH, vbus0_evt) /* USB_C1_VBUS WAKE EVENT DETECT */ -GPIO_INT(USB_C0_BC12_INT_L, PORT(12), 4, GPIO_INT_FALLING, usb0_evt) /* USB_C0_BC12_INT */ +GPIO_INT(PCH_SLP_SUS_L, PIN(12), GPIO_INT_BOTH | GPIO_PULL_UP, power_signal_interrupt) /* Deep sleep state */ +GPIO_INT(LID_OPEN, PIN(27), GPIO_INT_BOTH_DSLEEP, lid_interrupt) /* Lid switch */ +GPIO_INT(AC_PRESENT, PIN(30), GPIO_INT_BOTH_DSLEEP, extpower_interrupt) /* BC_ACOK / EC_ACIN - to know if battery or AC connected */ +GPIO_INT(VOLUME_UP_L, PIN(31), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt) /* Volume up button */ +GPIO_INT(WP_L, PIN(33), GPIO_INT_BOTH, switch_interrupt) /* Write protect input */ +GPIO_INT(POWER_BUTTON_L, PIN(35), GPIO_INT_BOTH_DSLEEP, power_button_interrupt) /* Power button */ +GPIO_INT(VOLUME_DOWN_L, PIN(47), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt) /* Volume down button */ +GPIO_INT(PMIC_INT, PIN(50), GPIO_INT_FALLING, power_signal_interrupt) /* Alert signal from PMIC */ +GPIO_INT(PD_MCU_INT, PIN(122),GPIO_INT_RISING | GPIO_INT_DSLEEP, pd_mcu_interrupt) /* Interrupt from USB PD Controller to EC */ +GPIO_INT(RSMRST_L_PGOOD, PIN(63), GPIO_INT_BOTH, power_signal_interrupt) /* RSMRST_N_PWRGD from power logic */ +GPIO_INT(USB_C1_VBUS_WAKE, PIN(123), GPIO_INT_BOTH, vbus0_evt) /* USB_C1_VBUS WAKE EVENT DETECT */ +GPIO_INT(USB_C0_BC12_INT_L, PIN(124), GPIO_INT_FALLING, usb0_evt) /* USB_C0_BC12_INT */ #if defined(CONFIG_ACCEL_INTERRUPTS) && defined(CONFIG_SHARED_MOTION_INTERRUPT_LINE) -GPIO_INT(GYRO_INT2, PORT(12), 7, GPIO_INT_RISING | GPIO_PULL_DOWN, motion_sns_interrupt) /* Gyro sensor interrupt 2 to EC */ +GPIO_INT(GYRO_INT2, PIN(127), GPIO_INT_RISING | GPIO_PULL_DOWN, motion_sns_interrupt) /* Gyro sensor interrupt 2 to EC */ #else -GPIO_INT(GYRO_INT2, PORT(12), 7, GPIO_INT_RISING | GPIO_PULL_DOWN, NULL) /* Gyro sensor interrupt 2 to EC */ +GPIO_INT(GYRO_INT2, PIN(127), GPIO_INT_RISING | GPIO_PULL_DOWN, NULL) /* Gyro sensor interrupt 2 to EC */ #endif -GPIO_INT(USB_C1_BC12_INT_L, PORT(14), 5, GPIO_INT_FALLING, usb1_evt) /* USB_C1_BC12_INT */ +GPIO_INT(USB_C1_BC12_INT_L, PIN(145), GPIO_INT_FALLING, usb1_evt) /* USB_C1_BC12_INT */ #ifdef CONFIG_ALS_INTERRUPTS -GPIO_INT(ALS_INT, PORT(14), 7, GPIO_INT_FALLING | GPIO_PULL_UP, als_interrupt) /* ALS sensor interrupt to EC */ +GPIO_INT(ALS_INT, PIN(147), GPIO_INT_FALLING | GPIO_PULL_UP, als_interrupt) /* ALS sensor interrupt to EC */ #else -GPIO_INT(ALS_INT, PORT(14), 7, GPIO_INT_FALLING | GPIO_PULL_UP, NULL) /* ALS sensor interrupt to EC */ +GPIO_INT(ALS_INT, PIN(147), GPIO_INT_FALLING | GPIO_PULL_UP, NULL) /* ALS sensor interrupt to EC */ #endif -GPIO_INT(USB_C0_VBUS_WAKE, PORT(15), 2, GPIO_INT_BOTH, vbus1_evt) /* USBC PORT 0 VBUS POWER DETECT */ +GPIO_INT(USB_C0_VBUS_WAKE, PIN(152), GPIO_INT_BOTH, vbus1_evt) /* USBC PORT 0 VBUS POWER DETECT */ #if defined(CONFIG_ACCEL_INTERRUPTS) && defined(CONFIG_SHARED_MOTION_INTERRUPT_LINE) -GPIO_INT(GYRO_INT1, PORT(16), 1, GPIO_INT_RISING | GPIO_PULL_DOWN, motion_sns_interrupt) /* Gyro sensor interrupt 1 to EC */ +GPIO_INT(GYRO_INT1, PIN(161), GPIO_INT_RISING | GPIO_PULL_DOWN, motion_sns_interrupt) /* Gyro sensor interrupt 1 to EC */ #else -GPIO_INT(GYRO_INT1, PORT(16), 1, GPIO_INT_RISING | GPIO_PULL_DOWN, NULL) /* Gyro sensor interrupt 1 to EC */ +GPIO_INT(GYRO_INT1, PIN(161), GPIO_INT_RISING | GPIO_PULL_DOWN, NULL) /* Gyro sensor interrupt 1 to EC */ #endif -GPIO_INT(PCH_SLP_S4_L, PORT(20), 0, GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, power_signal_interrupt) /* SLP_S4# signal from PCH */ -GPIO_INT(PCH_SLP_S3_L, PORT(20), 6, GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, power_signal_interrupt) /* SLP_S3# signal from PCH */ -GPIO_INT(PCH_SLP_S0_L, PORT(21), 1, GPIO_INT_BOTH | GPIO_PULL_UP, power_signal_interrupt) /* Sleep SO signal from SOC to EC */ - -GPIO(EC_BRD_ID0, PORT(0), 6, GPIO_INPUT) /* EC_BRD_ID0 */ -GPIO(EC_BRD_ID1, PORT(0), 7, GPIO_INPUT) /* EC_BRD_ID1 */ - -GPIO(EC_BRD_ID2, PORT(1), 0, GPIO_INPUT) /* EC_BRD_ID2 */ -GPIO(PP1800_DX_SENSOR_EN,PORT(1), 1, GPIO_OUT_LOW) -GPIO(USB2_OTG_ID, PORT(1), 3, GPIO_ODR_HIGH) /* Universal Serial Bus On-The-Go detection signal */ -GPIO(I2C_PORT0_SCL, PORT(1), 5, GPIO_ODR_HIGH) -GPIO(I2C_PORT0_SDA, PORT(1), 6, GPIO_ODR_HIGH) - -GPIO(I2C_PORT2_SCL, PORT(2), 0, GPIO_ODR_HIGH) -GPIO(I2C_PORT2_SDA, PORT(2), 1, GPIO_ODR_HIGH) -GPIO(I2C_PORT1_SCL, PORT(2), 2, GPIO_ODR_HIGH) -GPIO(I2C_PORT1_SDA, PORT(2), 3, GPIO_ODR_HIGH) -GPIO(I2C_PORT3_SCL, PORT(2), 4, GPIO_ODR_HIGH) -GPIO(I2C_PORT3_SDA, PORT(2), 5, GPIO_ODR_HIGH) -GPIO(PCH_SCI_L, PORT(2), 6, GPIO_ODR_HIGH) /* SCI output */ - -GPIO(NC_034, PORT(3), 4, GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(USB_P3_PWR_EN, PORT(3), 6, GPIO_OUT_HIGH) /* Enable power for USB2 Port */ - -GPIO(ENTERING_RW, PORT(4), 1, GPIO_OUT_LOW) /* Indicate when EC is entering RW code */ -GPIO(PCH_SMI_L, PORT(4), 4, GPIO_ODR_HIGH) /* SMI output */ -GPIO(PCH_PWRBTN_L, PORT(4), 5, GPIO_OUT_HIGH) /* Power button output to PCH */ -GPIO(DDI1_HPD, PORT(4), 6, GPIO_OUT_HIGH) /* DP hot plug detect from EC to SOC */ - -GPIO(DDI2_HPD, PORT(5), 1, GPIO_OUT_HIGH) /* DP hot plug detect from EC to SOC */ -GPIO(CPU_PROCHOT, PORT(5), 2, GPIO_OPEN_DRAIN) -GPIO(ENABLE_TOUCHPAD, PORT(5), 3, GPIO_OUT_HIGH) /* Enable power to Track Pad */ -GPIO(ROP_DSW_PWROK, PORT(5), 5, GPIO_INPUT) /* ZERO OHM DNP - RESERVED OPEN DRAIN */ -GPIO(BC_BATPRES, PORT(5), 6, GPIO_INPUT) /* ?? */ -GPIO(V_BOOSTIN, PORT(5), 7, GPIO_INPUT) /* ?? */ - -GPIO(USBPD_WAKE, PORT(6), 0, GPIO_OUT_LOW) /* USBC WAKE NOTIFICATION from MEC EC to STM32 EC */ -GPIO(BC_IBAT, PORT(6), 1, GPIO_INPUT) /* ?? */ -GPIO(BC_MON, PORT(6), 2, GPIO_INPUT) /* ADC FUNCTION - FROM BATTERY CHARGER FOR SYSTEM POWER MONITOR */ -GPIO(EN_USB_C0_CHARGE, PORT(6), 4, GPIO_OUT_HIGH) /* Enable USB-C0 Charge */ -GPIO(FLASH_DSC_OVERRIDE,PORT(6), 5, GPIO_ODR_HIGH) /* Flash Descriptor Override */ -GPIO(PCH_WAKE_L, PORT(6), 6, GPIO_ODR_HIGH) /* PCH wake pin */ -GPIO(USB_P4_PWR_EN, PORT(6), 7, GPIO_OUT_HIGH) /* Enable power for USB3 Port */ - -GPIO(KBD_KSO2, PORT(10), 1, GPIO_KB_OUTPUT_COL2) /* Negative edge triggered irq. */ -GPIO(FAN_TACH, PORT(10), 5, GPIO_INPUT) /* ?? Need Alternate - FAN TACH */ - -GPIO(AC_PRESENT_PCH, PORT(11), 0, GPIO_ODR_HIGH) /* */ - -GPIO(SYS_RESET_L, PORT(12), 1, GPIO_ODR_HIGH) /* PM_SYSRST - ODR High */ -GPIO(USB_PD_EC_INT, PORT(12), 2, GPIO_INT_BOTH) /* Interrupt from USB PD Controller to EC */ - -GPIO(EC_USBPD_RST, PORT(13), 0, GPIO_ODR_HIGH) /* EC_USBPD_RST */ -GPIO(WLAN_OFF_L, PORT(13), 2, GPIO_ODR_HIGH) /* Wireless LAN */ -GPIO(WWAN_PWR_EN, PORT(13), 3, GPIO_OUT_HIGH) /* Enable power for WWAN */ -GPIO(PCH_RCIN_L, PORT(13), 5, GPIO_ODR_HIGH) /* Reset line to PCH (for 8042 emulation) */ - -GPIO(USB2_OTG_VBUSSENSE,PORT(14), 0, GPIO_ODR_HIGH) /* OTG VBUS STATUS TO PCH */ -GPIO(SEN_INT, PORT(14), 1, GPIO_INT_BOTH_DSLEEP) /* SEN_INT */ -GPIO(PCH_RSMRST_L, PORT(14), 3, GPIO_OUT_LOW) /* RSMRST_N to PCH */ -GPIO(PVT_CS0, PORT(14), 6, GPIO_ODR_HIGH) /* SPI PVT Chip select */ - -GPIO(NC_150, PORT(15), 0, GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(DEVICE_PROCHOT, PORT(15), 1, GPIO_INT_FALLING) /* Device Proc Hot */ -GPIO(EN_USB_C0_5V_OUT, PORT(15), 4, GPIO_OUT_LOW) /* Enable USB-C0 5V */ -GPIO(CHARGE_LED1, PORT(15), 5, GPIO_OUT_HIGH) /* Charge LED 1 */ -GPIO(CHARGE_LED2, PORT(15), 6, GPIO_OUT_HIGH) /* Charge LED 2 */ -GPIO(EN_USB_C1_CHARGE, PORT(15), 7, GPIO_OUT_HIGH) /* Enable USB-C1 Charge */ - -GPIO(PP1800_DX_AUDIO_EN,PORT(16), 0, GPIO_OUT_LOW) -GPIO(RTC_RST, PORT(16), 3, GPIO_OPEN_DRAIN) /* RTC_RST */ - -GPIO(NC_201, PORT(20), 1, GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(EC_BL_DISABLE_L, PORT(20), 2, GPIO_OUT_HIGH) /* EDP backligh disable signal from EC */ -GPIO(PP3300_WLAN_EN, PORT(20), 3, GPIO_OUT_HIGH) /* Enable power to wifi */ -GPIO(EN_USB_C1_5V_OUT, PORT(20), 4, GPIO_OUT_LOW) /* Enable USB-C1 5V */ - -GPIO(ROP_EC_1HZ_WAKE, PORT(21), 0, GPIO_INT_BOTH) /* 1 HZ CLOCK FOR LOW POWER MODE FUNCTION */ +GPIO_INT(PCH_SLP_S4_L, PIN(200), GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, power_signal_interrupt) /* SLP_S4# signal from PCH */ +GPIO_INT(PCH_SLP_S3_L, PIN(206), GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, power_signal_interrupt) /* SLP_S3# signal from PCH */ +GPIO_INT(PCH_SLP_S0_L, PIN(211), GPIO_INT_BOTH | GPIO_PULL_UP, power_signal_interrupt) /* Sleep SO signal from SOC to EC */ + +GPIO(EC_BRD_ID0, PIN(6), GPIO_INPUT) /* EC_BRD_ID0 */ +GPIO(EC_BRD_ID1, PIN(7), GPIO_INPUT) /* EC_BRD_ID1 */ + +GPIO(EC_BRD_ID2, PIN(10), GPIO_INPUT) /* EC_BRD_ID2 */ +GPIO(PP1800_DX_SENSOR_EN, PIN(11), GPIO_OUT_LOW) +GPIO(USB2_OTG_ID, PIN(13), GPIO_ODR_HIGH) /* Universal Serial Bus On-The-Go detection signal */ +GPIO(I2C_PORT0_SCL, PIN(15), GPIO_ODR_HIGH) +GPIO(I2C_PORT0_SDA, PIN(16), GPIO_ODR_HIGH) + +GPIO(I2C_PORT2_SCL, PIN(20), GPIO_ODR_HIGH) +GPIO(I2C_PORT2_SDA, PIN(21), GPIO_ODR_HIGH) +GPIO(I2C_PORT1_SCL, PIN(22), GPIO_ODR_HIGH) +GPIO(I2C_PORT1_SDA, PIN(23), GPIO_ODR_HIGH) +GPIO(I2C_PORT3_SCL, PIN(24), GPIO_ODR_HIGH) +GPIO(I2C_PORT3_SDA, PIN(25), GPIO_ODR_HIGH) +GPIO(PCH_SCI_L, PIN(26), GPIO_ODR_HIGH) /* SCI output */ + +GPIO(NC_034, PIN(34), GPIO_INPUT | GPIO_PULL_UP) /* NC */ +GPIO(USB_P3_PWR_EN, PIN(36), GPIO_OUT_HIGH) /* Enable power for USB2 Port */ + +GPIO(ENTERING_RW, PIN(41), GPIO_OUT_LOW) /* Indicate when EC is entering RW code */ +GPIO(PCH_SMI_L, PIN(44), GPIO_ODR_HIGH) /* SMI output */ +GPIO(PCH_PWRBTN_L, PIN(45), GPIO_OUT_HIGH) /* Power button output to PCH */ +GPIO(DDI1_HPD, PIN(46), GPIO_OUT_HIGH) /* DP hot plug detect from EC to SOC */ + +GPIO(DDI2_HPD, PIN(51), GPIO_OUT_HIGH) /* DP hot plug detect from EC to SOC */ +GPIO(CPU_PROCHOT, PIN(52), GPIO_OPEN_DRAIN) +GPIO(ENABLE_TOUCHPAD, PIN(53), GPIO_OUT_HIGH) /* Enable power to Track Pad */ +GPIO(ROP_DSW_PWROK, PIN(55), GPIO_INPUT) /* ZERO OHM DNP - RESERVED OPEN DRAIN */ +GPIO(BC_BATPRES, PIN(56), GPIO_INPUT) /* ?? */ +GPIO(V_BOOSTIN, PIN(57), GPIO_INPUT) /* ?? */ + +GPIO(USBPD_WAKE, PIN(60), GPIO_OUT_LOW) /* USBC WAKE NOTIFICATION from MEC EC to STM32 EC */ +GPIO(BC_IBAT, PIN(61), GPIO_INPUT) /* ?? */ +GPIO(BC_MON, PIN(62), GPIO_INPUT) /* ADC FUNCTION - FROM BATTERY CHARGER FOR SYSTEM POWER MONITOR */ +GPIO(EN_USB_C0_CHARGE, PIN(64), GPIO_OUT_HIGH) /* Enable USB-C0 Charge */ +GPIO(FLASH_DSC_OVERRIDE,PIN(65), GPIO_ODR_HIGH) /* Flash Descriptor Override */ +GPIO(PCH_WAKE_L, PIN(66), GPIO_ODR_HIGH) /* PCH wake pin */ +GPIO(USB_P4_PWR_EN, PIN(67), GPIO_OUT_HIGH) /* Enable power for USB3 Port */ + +GPIO(KBD_KSO2, PIN(101), GPIO_KB_OUTPUT_COL2) /* Negative edge triggered irq. */ +GPIO(FAN_TACH, PIN(105), GPIO_INPUT) /* ?? Need Alternate - FAN TACH */ + +GPIO(AC_PRESENT_PCH, PIN(110), GPIO_ODR_HIGH) /* */ + +GPIO(SYS_RESET_L, PIN(121), GPIO_ODR_HIGH) /* PM_SYSRST - ODR High */ +GPIO(USB_PD_EC_INT, PIN(122), GPIO_INT_BOTH) /* Interrupt from USB PD Controller to EC */ + +GPIO(EC_USBPD_RST, PIN(130), GPIO_ODR_HIGH) /* EC_USBPD_RST */ +GPIO(WLAN_OFF_L, PIN(132), GPIO_ODR_HIGH) /* Wireless LAN */ +GPIO(WWAN_PWR_EN, PIN(133), GPIO_OUT_HIGH) /* Enable power for WWAN */ +GPIO(PCH_RCIN_L, PIN(135), GPIO_ODR_HIGH) /* Reset line to PCH (for 8042 emulation) */ + +GPIO(USB2_OTG_VBUSSENSE,PIN(140), GPIO_ODR_HIGH) /* OTG VBUS STATUS TO PCH */ +GPIO(SEN_INT, PIN(141), GPIO_INT_BOTH_DSLEEP) /* SEN_INT */ +GPIO(PCH_RSMRST_L, PIN(143), GPIO_OUT_LOW) /* RSMRST_N to PCH */ +GPIO(PVT_CS0, PIN(146), GPIO_ODR_HIGH) /* SPI PVT Chip select */ + +GPIO(NC_150, PIN(150), GPIO_INPUT | GPIO_PULL_UP) /* NC */ +GPIO(DEVICE_PROCHOT, PIN(151), GPIO_INT_FALLING) /* Device Proc Hot */ +GPIO(EN_USB_C0_5V_OUT, PIN(154), GPIO_OUT_LOW) /* Enable USB-C0 5V */ +GPIO(CHARGE_LED1, PIN(155), GPIO_OUT_HIGH) /* Charge LED 1 */ +GPIO(CHARGE_LED2, PIN(156), GPIO_OUT_HIGH) /* Charge LED 2 */ +GPIO(EN_USB_C1_CHARGE, PIN(157), GPIO_OUT_HIGH) /* Enable USB-C1 Charge */ + +GPIO(PP1800_DX_AUDIO_EN,PIN(160), GPIO_OUT_LOW) +GPIO(RTC_RST, PIN(163), GPIO_OPEN_DRAIN) /* RTC_RST */ + +GPIO(NC_201, PIN(201), GPIO_INPUT | GPIO_PULL_UP) /* NC */ +GPIO(EC_BL_DISABLE_L, PIN(202), GPIO_OUT_HIGH) /* EDP backligh disable signal from EC */ +GPIO(PP3300_WLAN_EN, PIN(203), GPIO_OUT_HIGH) /* Enable power to wifi */ +GPIO(EN_USB_C1_5V_OUT, PIN(204), GPIO_OUT_LOW) /* Enable USB-C1 5V */ + +GPIO(ROP_EC_1HZ_WAKE, PIN(210), GPIO_INT_BOTH) /* 1 HZ CLOCK FOR LOW POWER MODE FUNCTION */ /* Alternate functions GPIO definition */ -ALTERNATE(PORT(16), 0x24, 1, MODULE_UART, 0) /* UART0 */ +ALTERNATE(PIN_MASK(16, 0x24), 1, MODULE_UART, 0) /* UART0 */ -ALTERNATE(PORT(1), 0x60, 2, MODULE_I2C, GPIO_PULL_UP) /* I2C0: Battery Charger */ -ALTERNATE(PORT(2), 0x3f, 2, MODULE_I2C, GPIO_PULL_UP) /* I2C1: Temp Sensor / I2C2: SOC / I2C3: VNN */ +ALTERNATE(PIN_MASK(1, 0x60), 2, MODULE_I2C, GPIO_PULL_UP) /* I2C0: Battery Charger */ +ALTERNATE(PIN_MASK(2, 0x3f), 2, MODULE_I2C, GPIO_PULL_UP) /* I2C1: Temp Sensor / I2C2: SOC / I2C3: VNN */ /* PORT SEL [3:0] has to be set to 1 to access this port 1 of controller 0 */ -ALTERNATE(PORT(13), 0x10, 2, MODULE_I2C, GPIO_PULL_UP) /* I2C0 - Port 1 : Accel SCL */ -ALTERNATE(PORT(1), 0x80, 2, MODULE_I2C, GPIO_PULL_UP) /* I2C0 - Port 1 : Accel SDA*/ - -ALTERNATE(PORT(0), 0x3d, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) -ALTERNATE(PORT(1), 0x02, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) -ALTERNATE(PORT(10), 0xdd, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) -ALTERNATE(PORT(3), 0x04, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) -ALTERNATE(PORT(4), 0x0d, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) -ALTERNATE(PORT(12), 0x60, 2, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) -ALTERNATE(PORT(14), 0x14, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) - -ALTERNATE(PORT(1), 0x10, 1, MODULE_LPC, 0) /* 14: CLKRUN# */ -ALTERNATE(PORT(11), 0x9e, 1, MODULE_LPC, 0) /* 111~114: LAD[0:3], 117: PCI_CLK */ -ALTERNATE(PORT(11), 0x40, 1, MODULE_LPC, GPIO_INT_BOTH) /* 116: LRESET# */ -ALTERNATE(PORT(12), 0x01, 1, MODULE_LPC, 0) /* 120: LFRAME# */ -ALTERNATE(PORT(11), 0x20, 1, MODULE_LPC, 0) - -ALTERNATE(PORT(5), 0x10, 1, MODULE_SPI, 0) /* 54: MOSI */ -ALTERNATE(PORT(16), 0x10, 1, MODULE_SPI, 0) /* 164: MISO */ -ALTERNATE(PORT(15), 0x08, 1, MODULE_SPI, 0) /* 153: CLK */ - -ALTERNATE(PORT(13), 0x40, 1, MODULE_PWM_LED, GPIO_OPEN_DRAIN) /* 136: PWM1 */ +ALTERNATE(PIN_MASK(13, 0x10), 2, MODULE_I2C, GPIO_PULL_UP) /* I2C0 - Port 1 : Accel SCL */ +ALTERNATE(PIN_MASK(1, 0x80), 2, MODULE_I2C, GPIO_PULL_UP) /* I2C0 - Port 1 : Accel SDA*/ + +ALTERNATE(PIN_MASK(0, 0x3d), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) +ALTERNATE(PIN_MASK(1, 0x02), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) +ALTERNATE(PIN_MASK(10, 0xdd), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) +ALTERNATE(PIN_MASK(3, 0x04), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) +ALTERNATE(PIN_MASK(4, 0x0d), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) +ALTERNATE(PIN_MASK(12, 0x60), 2, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) +ALTERNATE(PIN_MASK(14, 0x14), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) + +ALTERNATE(PIN_MASK(1, 0x10), 1, MODULE_LPC, 0) /* 14: CLKRUN# */ +ALTERNATE(PIN_MASK(11, 0x9e), 1, MODULE_LPC, 0) /* 111~114: LAD[0:3], 117: PCI_CLK */ +ALTERNATE(PIN_MASK(11, 0x40), 1, MODULE_LPC, GPIO_INT_BOTH) /* 116: LRESET# */ +ALTERNATE(PIN_MASK(12, 0x01), 1, MODULE_LPC, 0) /* 120: LFRAME# */ +ALTERNATE(PIN_MASK(11, 0x20), 1, MODULE_LPC, 0) + +ALTERNATE(PIN_MASK(5, 0x10), 1, MODULE_SPI, 0) /* 54: MOSI */ +ALTERNATE(PIN_MASK(16, 0x10), 1, MODULE_SPI, 0) /* 164: MISO */ +ALTERNATE(PIN_MASK(15, 0x08), 1, MODULE_SPI, 0) /* 153: CLK */ + +ALTERNATE(PIN_MASK(13, 0x40), 1, MODULE_PWM_LED, GPIO_OPEN_DRAIN) /* 136: PWM1 */ diff --git a/board/kunimitsu/lfw/gpio.inc b/board/kunimitsu/lfw/gpio.inc index d1bb19cfcb..122aff0cdf 100644 --- a/board/kunimitsu/lfw/gpio.inc +++ b/board/kunimitsu/lfw/gpio.inc @@ -7,10 +7,10 @@ * Minimal set of GPIOs needed for LFW loader */ -GPIO(PVT_CS0, PORT(14), 6, GPIO_ODR_HIGH) /* SPI PVT Chip select */ +GPIO(PVT_CS0, PIN(146), GPIO_ODR_HIGH) /* SPI PVT Chip select */ /* Alternate functions GPIO definition */ -ALTERNATE(PORT(16), 0x24, 1, MODULE_UART, 0) /* UART0 */ -ALTERNATE(PORT(5), 0x10, 1, MODULE_SPI, 0) -ALTERNATE(PORT(16), 0x10, 1, MODULE_SPI, 0) -ALTERNATE(PORT(15), 0x08, 1, MODULE_SPI, 0) /* 153: CLK */ +ALTERNATE(PIN_MASK(16, 0x24), 1, MODULE_UART, 0) /* UART0 */ +ALTERNATE(PIN_MASK(5, 0x10), 1, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(16, 0x10), 1, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(15, 0x08), 1, MODULE_SPI, 0) /* 153: CLK */ diff --git a/board/link/gpio.inc b/board/link/gpio.inc index f4330035d7..bd9b0f2317 100644 --- a/board/link/gpio.inc +++ b/board/link/gpio.inc @@ -6,91 +6,91 @@ */ /* Inputs with interrupt handlers are first for efficiency */ -GPIO_INT(POWER_BUTTON_L, K, 7, GPIO_INT_BOTH, power_button_interrupt) /* Power button */ -GPIO_INT(LID_OPEN, K, 5, GPIO_INT_BOTH, lid_interrupt) /* Lid switch */ -GPIO_INT(AC_PRESENT, H, 3, GPIO_INT_BOTH, extpower_interrupt) /* AC power present */ -GPIO_INT(PCH_BKLTEN, J, 3, GPIO_INT_BOTH, backlight_interrupt) /* Backlight enable signal from PCH */ -GPIO_INT(PCH_SLP_A_L, G, 5, GPIO_INT_BOTH, power_signal_interrupt) /* SLP_A# signal from PCH */ -GPIO_INT(PCH_SLP_ME_CSW_DEV_L, G, 4, GPIO_INT_BOTH, power_signal_interrupt) /* SLP_ME_CSW_DEV# signal from PCH */ -GPIO_INT(PCH_SLP_S3_L, J, 0, GPIO_INT_BOTH, power_signal_interrupt) /* SLP_S3# signal from PCH */ -GPIO_INT(PCH_SLP_S4_L, J, 1, GPIO_INT_BOTH, power_signal_interrupt) /* SLP_S4# signal from PCH */ -GPIO_INT(PCH_SLP_S5_L, J, 2, GPIO_INT_BOTH, power_signal_interrupt) /* SLP_S5# signal from PCH */ -GPIO_INT(PCH_SLP_SUS_L, G, 3, GPIO_INT_BOTH, power_signal_interrupt) /* SLP_SUS# signal from PCH */ -GPIO_INT(PCH_SUSWARN_L, G, 2, GPIO_INT_BOTH, power_interrupt) /* SUSWARN# signal from PCH */ -GPIO_INT(PGOOD_1_5V_DDR, K, 0, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on +1.5V_DDR */ -GPIO_INT(PGOOD_1_5V_PCH, K, 1, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on +1.5V_PCH */ -GPIO_INT(PGOOD_1_8VS, K, 3, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on +1.8VS */ -GPIO_INT(PGOOD_5VALW, H, 0, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on +5VALW */ -GPIO_INT(PGOOD_CPU_CORE, M, 3, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on +CPU_CORE */ -GPIO_INT(PGOOD_VCCP, K, 2, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on +VCCP */ -GPIO_INT(PGOOD_VCCSA, H, 1, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on +VCCSA */ -GPIO_INT(PGOOD_VGFX_CORE, D, 2, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on +VGFX_CORE */ -GPIO_INT(RECOVERY_L, H, 7, GPIO_INT_BOTH, switch_interrupt) /* Recovery signal from servo */ -GPIO_INT(WP, J, 4, GPIO_INT_BOTH, switch_interrupt) /* Write protect input */ +GPIO_INT(POWER_BUTTON_L, PIN(K, 7), GPIO_INT_BOTH, power_button_interrupt) /* Power button */ +GPIO_INT(LID_OPEN, PIN(K, 5), GPIO_INT_BOTH, lid_interrupt) /* Lid switch */ +GPIO_INT(AC_PRESENT, PIN(H, 3), GPIO_INT_BOTH, extpower_interrupt) /* AC power present */ +GPIO_INT(PCH_BKLTEN, PIN(J, 3), GPIO_INT_BOTH, backlight_interrupt) /* Backlight enable signal from PCH */ +GPIO_INT(PCH_SLP_A_L, PIN(G, 5), GPIO_INT_BOTH, power_signal_interrupt) /* SLP_A# signal from PCH */ +GPIO_INT(PCH_SLP_ME_CSW_DEV_L, PIN(G, 4), GPIO_INT_BOTH, power_signal_interrupt) /* SLP_ME_CSW_DEV# signal from PCH */ +GPIO_INT(PCH_SLP_S3_L, PIN(J, 0), GPIO_INT_BOTH, power_signal_interrupt) /* SLP_S3# signal from PCH */ +GPIO_INT(PCH_SLP_S4_L, PIN(J, 1), GPIO_INT_BOTH, power_signal_interrupt) /* SLP_S4# signal from PCH */ +GPIO_INT(PCH_SLP_S5_L, PIN(J, 2), GPIO_INT_BOTH, power_signal_interrupt) /* SLP_S5# signal from PCH */ +GPIO_INT(PCH_SLP_SUS_L, PIN(G, 3), GPIO_INT_BOTH, power_signal_interrupt) /* SLP_SUS# signal from PCH */ +GPIO_INT(PCH_SUSWARN_L, PIN(G, 2), GPIO_INT_BOTH, power_interrupt) /* SUSWARN# signal from PCH */ +GPIO_INT(PGOOD_1_5V_DDR, PIN(K, 0), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on +1.5V_DDR */ +GPIO_INT(PGOOD_1_5V_PCH, PIN(K, 1), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on +1.5V_PCH */ +GPIO_INT(PGOOD_1_8VS, PIN(K, 3), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on +1.8VS */ +GPIO_INT(PGOOD_5VALW, PIN(H, 0), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on +5VALW */ +GPIO_INT(PGOOD_CPU_CORE, PIN(M, 3), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on +CPU_CORE */ +GPIO_INT(PGOOD_VCCP, PIN(K, 2), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on +VCCP */ +GPIO_INT(PGOOD_VCCSA, PIN(H, 1), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on +VCCSA */ +GPIO_INT(PGOOD_VGFX_CORE, PIN(D, 2), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on +VGFX_CORE */ +GPIO_INT(RECOVERY_L, PIN(H, 7), GPIO_INT_BOTH, switch_interrupt) /* Recovery signal from servo */ +GPIO_INT(WP, PIN(J, 4), GPIO_INT_BOTH, switch_interrupt) /* Write protect input */ /* Other inputs */ -GPIO(THERMAL_DATA_READY_L, B, 4, GPIO_INPUT) /* Data ready from I2C thermal sensor */ -GPIO(BOARD_VERSION1, H, 6, GPIO_INPUT) /* Board version stuffing resistor 1 */ -GPIO(BOARD_VERSION2, L, 6, GPIO_INPUT) /* Board version stuffing resistor 2 */ -GPIO(BOARD_VERSION3, L, 7, GPIO_INPUT) /* Board version stuffing resistor 3 */ -GPIO(ONEWIRE, H, 2, GPIO_INPUT) /* One-wire bus to adapter LED */ -GPIO(USB1_STATUS_L, E, 7, GPIO_INPUT) /* USB charger port 1 status output */ -GPIO(USB2_STATUS_L, E, 1, GPIO_INPUT) /* USB charger port 2 status output */ +GPIO(THERMAL_DATA_READY_L, PIN(B, 4), GPIO_INPUT) /* Data ready from I2C thermal sensor */ +GPIO(BOARD_VERSION1, PIN(H, 6), GPIO_INPUT) /* Board version stuffing resistor 1 */ +GPIO(BOARD_VERSION2, PIN(L, 6), GPIO_INPUT) /* Board version stuffing resistor 2 */ +GPIO(BOARD_VERSION3, PIN(L, 7), GPIO_INPUT) /* Board version stuffing resistor 3 */ +GPIO(ONEWIRE, PIN(H, 2), GPIO_INPUT) /* One-wire bus to adapter LED */ +GPIO(USB1_STATUS_L, PIN(E, 7), GPIO_INPUT) /* USB charger port 1 status output */ +GPIO(USB2_STATUS_L, PIN(E, 1), GPIO_INPUT) /* USB charger port 2 status output */ /* Outputs; all unasserted by default except for reset signals */ -GPIO(CPU_PROCHOT, F, 2, GPIO_OUT_LOW) /* Force CPU to think it's overheated */ -GPIO(ENABLE_1_5V_DDR, H, 5, GPIO_OUT_LOW) /* Enable +1.5V_DDR supply */ -GPIO(ENABLE_5VALW, K, 4, GPIO_OUT_HIGH) /* Enable +5V always on rail */ -GPIO(ENABLE_BACKLIGHT, H, 4, GPIO_OUT_LOW) /* Enable backlight power */ -GPIO(ENABLE_TOUCHPAD, C, 6, GPIO_OUT_LOW) /* Enable touchpad power */ -GPIO(ENABLE_VCORE, F, 7, GPIO_OUT_LOW) /* Enable +CPU_CORE and +VGFX_CORE */ -GPIO(ENABLE_VS, G, 6, GPIO_OUT_LOW) /* Enable VS power supplies */ -GPIO(ENABLE_WLAN, Q, 5, GPIO_OUT_LOW) /* Enable WLAN module power (+3VS_WLAN) */ -GPIO(ENTERING_RW, J, 5, GPIO_OUT_LOW) /* Indicate when EC is entering RW code */ -GPIO(LIGHTBAR_RESET_L, B, 1, GPIO_OUT_LOW) /* Reset lightbar controllers */ -GPIO(PCH_A20GATE, Q, 6, GPIO_OUT_LOW) /* A20GATE signal to PCH */ -GPIO(PCH_DPWROK, G, 0, GPIO_OUT_LOW) /* DPWROK signal to PCH */ +GPIO(CPU_PROCHOT, PIN(F, 2), GPIO_OUT_LOW) /* Force CPU to think it's overheated */ +GPIO(ENABLE_1_5V_DDR, PIN(H, 5), GPIO_OUT_LOW) /* Enable +1.5V_DDR supply */ +GPIO(ENABLE_5VALW, PIN(K, 4), GPIO_OUT_HIGH) /* Enable +5V always on rail */ +GPIO(ENABLE_BACKLIGHT, PIN(H, 4), GPIO_OUT_LOW) /* Enable backlight power */ +GPIO(ENABLE_TOUCHPAD, PIN(C, 6), GPIO_OUT_LOW) /* Enable touchpad power */ +GPIO(ENABLE_VCORE, PIN(F, 7), GPIO_OUT_LOW) /* Enable +CPU_CORE and +VGFX_CORE */ +GPIO(ENABLE_VS, PIN(G, 6), GPIO_OUT_LOW) /* Enable VS power supplies */ +GPIO(ENABLE_WLAN, PIN(Q, 5), GPIO_OUT_LOW) /* Enable WLAN module power (+3VS_WLAN) */ +GPIO(ENTERING_RW, PIN(J, 5), GPIO_OUT_LOW) /* Indicate when EC is entering RW code */ +GPIO(LIGHTBAR_RESET_L, PIN(B, 1), GPIO_OUT_LOW) /* Reset lightbar controllers */ +GPIO(PCH_A20GATE, PIN(Q, 6), GPIO_OUT_LOW) /* A20GATE signal to PCH */ +GPIO(PCH_DPWROK, PIN(G, 0), GPIO_OUT_LOW) /* DPWROK signal to PCH */ /* * HDA_SDO is technically an output, but we need to leave it as an * input until we drive it high. So can't use open-drain (HI_Z). */ -GPIO(PCH_HDA_SDO, G, 1, GPIO_INPUT) /* HDA_SDO signal to PCH; when high, ME ignores security descriptor */ -GPIO(PCH_WAKE_L, F, 0, GPIO_OUT_HIGH) /* Wake signal output to PCH */ -GPIO(PCH_NMI_L, M, 2, GPIO_OUT_HIGH) /* Non-maskable interrupt pin to PCH */ -GPIO(PCH_PWRBTN_L, G, 7, GPIO_OUT_HIGH) /* Power button output to PCH */ -GPIO(PCH_PWROK, F, 5, GPIO_OUT_LOW) /* PWROK / APWROK signals to PCH */ -GPIO(PCH_RCIN_L, Q, 7, GPIO_ODR_HIGH) /* RCIN# signal to PCH */ -GPIO(PCH_RSMRST_L, F, 1, GPIO_OUT_LOW) /* Reset PCH resume power plane logic */ -GPIO(PCH_RTCRST_L, F, 6, GPIO_ODR_HIGH) /* Reset PCH RTC well */ -GPIO(PCH_SMI_L, F, 4, GPIO_OUT_HIGH) /* System management interrupt to PCH */ -GPIO(PCH_SRTCRST_L, C, 7, GPIO_ODR_HIGH) /* Reset PCH ME RTC well */ -GPIO(PCH_SUSACK_L, F, 3, GPIO_OUT_HIGH) /* Acknowledge PCH SUSWARN# signal */ -GPIO(RADIO_ENABLE_WLAN, D, 0, GPIO_OUT_LOW) /* Enable WLAN radio */ -GPIO(RADIO_ENABLE_BT, D, 1, GPIO_OUT_LOW) /* Enable bluetooth radio */ -GPIO(SPI_CS_L, A, 3, GPIO_ODR_HIGH) /* SPI chip select */ -GPIO(TOUCHSCREEN_RESET_L, B, 0, GPIO_OUT_LOW) /* Reset touch screen */ -GPIO(USB1_CTL1, E, 2, GPIO_OUT_LOW) /* USB charger port 1 CTL1 output */ -GPIO(USB1_CTL2, E, 3, GPIO_OUT_LOW) /* USB charger port 1 CTL2 output */ -GPIO(USB1_CTL3, E, 4, GPIO_OUT_LOW) /* USB charger port 1 CTL3 output */ -GPIO(USB1_ENABLE, E, 5, GPIO_OUT_LOW) /* USB charger port 1 enable */ -GPIO(USB1_ILIM_SEL, E, 6, GPIO_OUT_LOW) /* USB charger port 1 ILIM_SEL output */ -GPIO(USB2_CTL1, D, 4, GPIO_OUT_LOW) /* USB charger port 2 CTL1 output */ -GPIO(USB2_CTL2, D, 5, GPIO_OUT_LOW) /* USB charger port 2 CTL2 output */ -GPIO(USB2_CTL3, D, 6, GPIO_OUT_LOW) /* USB charger port 2 CTL3 output */ -GPIO(USB2_ENABLE, D, 7, GPIO_OUT_LOW) /* USB charger port 2 enable */ -GPIO(USB2_ILIM_SEL, E, 0, GPIO_OUT_LOW) /* USB charger port 2 ILIM_SEL output */ +GPIO(PCH_HDA_SDO, PIN(G, 1), GPIO_INPUT) /* HDA_SDO signal to PCH; when high, ME ignores security descriptor */ +GPIO(PCH_WAKE_L, PIN(F, 0), GPIO_OUT_HIGH) /* Wake signal output to PCH */ +GPIO(PCH_NMI_L, PIN(M, 2), GPIO_OUT_HIGH) /* Non-maskable interrupt pin to PCH */ +GPIO(PCH_PWRBTN_L, PIN(G, 7), GPIO_OUT_HIGH) /* Power button output to PCH */ +GPIO(PCH_PWROK, PIN(F, 5), GPIO_OUT_LOW) /* PWROK / APWROK signals to PCH */ +GPIO(PCH_RCIN_L, PIN(Q, 7), GPIO_ODR_HIGH) /* RCIN# signal to PCH */ +GPIO(PCH_RSMRST_L, PIN(F, 1), GPIO_OUT_LOW) /* Reset PCH resume power plane logic */ +GPIO(PCH_RTCRST_L, PIN(F, 6), GPIO_ODR_HIGH) /* Reset PCH RTC well */ +GPIO(PCH_SMI_L, PIN(F, 4), GPIO_OUT_HIGH) /* System management interrupt to PCH */ +GPIO(PCH_SRTCRST_L, PIN(C, 7), GPIO_ODR_HIGH) /* Reset PCH ME RTC well */ +GPIO(PCH_SUSACK_L, PIN(F, 3), GPIO_OUT_HIGH) /* Acknowledge PCH SUSWARN# signal */ +GPIO(RADIO_ENABLE_WLAN, PIN(D, 0), GPIO_OUT_LOW) /* Enable WLAN radio */ +GPIO(RADIO_ENABLE_BT, PIN(D, 1), GPIO_OUT_LOW) /* Enable bluetooth radio */ +GPIO(SPI_CS_L, PIN(A, 3), GPIO_ODR_HIGH) /* SPI chip select */ +GPIO(TOUCHSCREEN_RESET_L, PIN(B, 0), GPIO_OUT_LOW) /* Reset touch screen */ +GPIO(USB1_CTL1, PIN(E, 2), GPIO_OUT_LOW) /* USB charger port 1 CTL1 output */ +GPIO(USB1_CTL2, PIN(E, 3), GPIO_OUT_LOW) /* USB charger port 1 CTL2 output */ +GPIO(USB1_CTL3, PIN(E, 4), GPIO_OUT_LOW) /* USB charger port 1 CTL3 output */ +GPIO(USB1_ENABLE, PIN(E, 5), GPIO_OUT_LOW) /* USB charger port 1 enable */ +GPIO(USB1_ILIM_SEL, PIN(E, 6), GPIO_OUT_LOW) /* USB charger port 1 ILIM_SEL output */ +GPIO(USB2_CTL1, PIN(D, 4), GPIO_OUT_LOW) /* USB charger port 2 CTL1 output */ +GPIO(USB2_CTL2, PIN(D, 5), GPIO_OUT_LOW) /* USB charger port 2 CTL2 output */ +GPIO(USB2_CTL3, PIN(D, 6), GPIO_OUT_LOW) /* USB charger port 2 CTL3 output */ +GPIO(USB2_ENABLE, PIN(D, 7), GPIO_OUT_LOW) /* USB charger port 2 enable */ +GPIO(USB2_ILIM_SEL, PIN(E, 0), GPIO_OUT_LOW) /* USB charger port 2 ILIM_SEL output */ -ALTERNATE(A, 0x03, 1, MODULE_UART, 0) /* UART0 */ -ALTERNATE(A, 0x40, 3, MODULE_I2C, 0) /* I2C1 SCL */ -ALTERNATE(A, 0x80, 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C1 SDA */ -ALTERNATE(B, 0x04, 3, MODULE_I2C, 0) /* I2C0 SCL */ -ALTERNATE(B, 0x08, 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C0 SDA */ -ALTERNATE(B, 0x40, 3, MODULE_I2C, 0) /* I2C5 SCL */ -ALTERNATE(B, 0x80, 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C5 SDA */ -ALTERNATE(C, 0x30, 2, MODULE_UART, 0) /* UART1 */ -ALTERNATE(J, 0x40, 1, MODULE_PECI, 0) /* PECI Tx */ -ALTERNATE(J, 0x80, 0, MODULE_PECI, GPIO_ANALOG) /* PECI Rx */ -ALTERNATE(K, 0x40, 1, MODULE_PWM_KBLIGHT, 0) /* FAN0PWM1 */ -ALTERNATE(L, 0x3f, 15, MODULE_LPC, 0) /* LPC */ -ALTERNATE(M, 0x33, 15, MODULE_LPC, 0) /* LPC */ -ALTERNATE(M, 0xc0, 1, MODULE_PWM_FAN, 0) /* FAN0PWM0 */ +ALTERNATE(PIN_MASK(A, 0x03), 1, MODULE_UART, 0) /* UART0 */ +ALTERNATE(PIN_MASK(A, 0x40), 3, MODULE_I2C, 0) /* I2C1 SCL */ +ALTERNATE(PIN_MASK(A, 0x80), 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C1 SDA */ +ALTERNATE(PIN_MASK(B, 0x04), 3, MODULE_I2C, 0) /* I2C0 SCL */ +ALTERNATE(PIN_MASK(B, 0x08), 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C0 SDA */ +ALTERNATE(PIN_MASK(B, 0x40), 3, MODULE_I2C, 0) /* I2C5 SCL */ +ALTERNATE(PIN_MASK(B, 0x80), 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C5 SDA */ +ALTERNATE(PIN_MASK(C, 0x30), 2, MODULE_UART, 0) /* UART1 */ +ALTERNATE(PIN_MASK(J, 0x40), 1, MODULE_PECI, 0) /* PECI Tx */ +ALTERNATE(PIN_MASK(J, 0x80), 0, MODULE_PECI, GPIO_ANALOG) /* PECI Rx */ +ALTERNATE(PIN_MASK(K, 0x40), 1, MODULE_PWM_KBLIGHT, 0) /* FAN0PWM1 */ +ALTERNATE(PIN_MASK(L, 0x3f), 15, MODULE_LPC, 0) /* LPC */ +ALTERNATE(PIN_MASK(M, 0x33), 15, MODULE_LPC, 0) /* LPC */ +ALTERNATE(PIN_MASK(M, 0xc0), 1, MODULE_PWM_FAN, 0) /* FAN0PWM0 */ diff --git a/board/llama/gpio.inc b/board/llama/gpio.inc index a13246ecca..253780ab9a 100644 --- a/board/llama/gpio.inc +++ b/board/llama/gpio.inc @@ -6,59 +6,59 @@ */ /* Inputs with interrupt handlers are first for efficiency */ -GPIO_INT(AC_PRESENT, A, 0, GPIO_INT_BOTH, extpower_interrupt) /* AC power present: PA 0 */ -GPIO_INT(POWER_BUTTON_L, B, 5, GPIO_INT_BOTH | GPIO_PULL_UP, power_button_interrupt) /* Keyboard power button: PB 5 */ -GPIO_INT(SOC_POWER_GOOD_L, A, 3, GPIO_INT_BOTH, power_signal_interrupt) -GPIO_INT(LID_OPEN, C, 13, GPIO_INT_BOTH, lid_interrupt) /* LID switch detection */ -GPIO_INT(SUSPEND_L, C, 7, GPIO_INT_BOTH, power_signal_interrupt) /* AP suspend/resume state */ +GPIO_INT(AC_PRESENT, PIN(A, 0), GPIO_INT_BOTH, extpower_interrupt) /* AC power present: PA 0 */ +GPIO_INT(POWER_BUTTON_L, PIN(B, 5), GPIO_INT_BOTH | GPIO_PULL_UP, power_button_interrupt) /* Keyboard power button: PB 5 */ +GPIO_INT(SOC_POWER_GOOD_L, PIN(A, 3), GPIO_INT_BOTH, power_signal_interrupt) +GPIO_INT(LID_OPEN, PIN(C, 13), GPIO_INT_BOTH, lid_interrupt) /* LID switch detection */ +GPIO_INT(SUSPEND_L, PIN(C, 7), GPIO_INT_BOTH, power_signal_interrupt) /* AP suspend/resume state */ /* Keyboard inputs */ -GPIO_INT(KB_IN00, C, 8, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN01, C, 9, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN02, C, 10, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN03, C, 11, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN04, C, 12, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN05, C, 14, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN06, C, 15, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN07, D, 2, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN00, PIN(C, 8), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN01, PIN(C, 9), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN02, PIN(C, 10), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN03, PIN(C, 11), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN04, PIN(C, 12), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN05, PIN(C, 14), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN06, PIN(C, 15), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN07, PIN(D, 2), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) /* SPI Chip Select */ -GPIO_INT(SPI1_NSS, A, 4, GPIO_INT_BOTH | GPIO_PULL_UP, spi_event) +GPIO_INT(SPI1_NSS, PIN(A, 4), GPIO_INT_BOTH | GPIO_PULL_UP, spi_event) -GPIO(5V_GOOD_L, A, 1, GPIO_INT_BOTH) -GPIO(AP_RESET_H, B, 3, GPIO_OUT_LOW) -GPIO(BOARD_VERSION1, C, 6, GPIO_INPUT|GPIO_PULL_UP) /* Board version stuffing resistor 1 */ +GPIO(5V_GOOD_L, PIN(A, 1), GPIO_INT_BOTH) +GPIO(AP_RESET_H, PIN(B, 3), GPIO_OUT_LOW) +GPIO(BOARD_VERSION1, PIN(C, 6), GPIO_INPUT|GPIO_PULL_UP) /* Board version stuffing resistor 1 */ /* Outputs */ -GPIO(BAT_LED0, B, 11, GPIO_OUT_LOW) /* LED_GREEN */ -GPIO(BAT_LED1, A, 11, GPIO_OUT_LOW) /* LED_ORANGE */ -GPIO(EC_BL_OVERRIDE, F, 1, GPIO_OUT_LOW) -GPIO(EC_INT, B, 9, GPIO_OUT_HIGH) -GPIO(ENTERING_RW, F, 0, GPIO_OUT_LOW) -GPIO(KB_OUT00, B, 0, GPIO_KB_OUTPUT) -GPIO(KB_OUT01, B, 8, GPIO_KB_OUTPUT) -GPIO(KB_OUT02, B, 12, GPIO_OUT_LOW) /* KSO2 is inverted */ -GPIO(KB_OUT03, B, 13, GPIO_KB_OUTPUT) -GPIO(KB_OUT04, B, 14, GPIO_KB_OUTPUT) -GPIO(KB_OUT05, B, 15, GPIO_KB_OUTPUT) -GPIO(KB_OUT06, C, 0, GPIO_KB_OUTPUT) -GPIO(KB_OUT07, C, 1, GPIO_KB_OUTPUT) -GPIO(KB_OUT08, C, 2, GPIO_KB_OUTPUT) -GPIO(KB_OUT09, B, 1, GPIO_KB_OUTPUT) -GPIO(KB_OUT10, C, 5, GPIO_KB_OUTPUT) -GPIO(KB_OUT11, C, 4, GPIO_KB_OUTPUT) -GPIO(KB_OUT12, A, 14, GPIO_KB_OUTPUT) -GPIO(SYSTEM_POWER_H, B, 10, GPIO_OUT_LOW) -GPIO(PMIC_PWRON_H, A, 12, GPIO_OUT_LOW) -GPIO(PMIC_WARM_RESET_H, C, 3, GPIO_ODR_LOW) +GPIO(BAT_LED0, PIN(B, 11), GPIO_OUT_LOW) /* LED_GREEN */ +GPIO(BAT_LED1, PIN(A, 11), GPIO_OUT_LOW) /* LED_ORANGE */ +GPIO(EC_BL_OVERRIDE, PIN(F, 1), GPIO_OUT_LOW) +GPIO(EC_INT, PIN(B, 9), GPIO_OUT_HIGH) +GPIO(ENTERING_RW, PIN(F, 0), GPIO_OUT_LOW) +GPIO(KB_OUT00, PIN(B, 0), GPIO_KB_OUTPUT) +GPIO(KB_OUT01, PIN(B, 8), GPIO_KB_OUTPUT) +GPIO(KB_OUT02, PIN(B, 12), GPIO_OUT_LOW) /* KSO2 is inverted */ +GPIO(KB_OUT03, PIN(B, 13), GPIO_KB_OUTPUT) +GPIO(KB_OUT04, PIN(B, 14), GPIO_KB_OUTPUT) +GPIO(KB_OUT05, PIN(B, 15), GPIO_KB_OUTPUT) +GPIO(KB_OUT06, PIN(C, 0), GPIO_KB_OUTPUT) +GPIO(KB_OUT07, PIN(C, 1), GPIO_KB_OUTPUT) +GPIO(KB_OUT08, PIN(C, 2), GPIO_KB_OUTPUT) +GPIO(KB_OUT09, PIN(B, 1), GPIO_KB_OUTPUT) +GPIO(KB_OUT10, PIN(C, 5), GPIO_KB_OUTPUT) +GPIO(KB_OUT11, PIN(C, 4), GPIO_KB_OUTPUT) +GPIO(KB_OUT12, PIN(A, 14), GPIO_KB_OUTPUT) +GPIO(SYSTEM_POWER_H, PIN(B, 10), GPIO_OUT_LOW) +GPIO(PMIC_PWRON_H, PIN(A, 12), GPIO_OUT_LOW) +GPIO(PMIC_WARM_RESET_H, PIN(C, 3), GPIO_ODR_LOW) /* * I2C pins should be configured as inputs until I2C module is * initialized. This will avoid driving the lines unintentionally. */ -GPIO(MASTER_I2C_SCL, B, 6, GPIO_INPUT) -GPIO(MASTER_I2C_SDA, B, 7, GPIO_INPUT) +GPIO(MASTER_I2C_SCL, PIN(B, 6), GPIO_INPUT) +GPIO(MASTER_I2C_SDA, PIN(B, 7), GPIO_INPUT) /* Unimplemented signals which we need to emulate for now */ /* UNIMPLEMENTED(ENTERING_RW) */ @@ -66,6 +66,6 @@ UNIMPLEMENTED(WP_L) UNIMPLEMENTED(BOARD_VERSION2) UNIMPLEMENTED(BOARD_VERSION3) -ALTERNATE(A, 0x0600, 1, MODULE_UART, 0) /* USART1: PA9/PA10 */ -ALTERNATE(B, 0x00c0, 1, MODULE_I2C, 0) /* I2C MASTER:PB6/7 */ -ALTERNATE(A, 0x00f0, 0, MODULE_SPI, 0) /* SPI SLAVE:PA4/5/6/7 */ +ALTERNATE(PIN_MASK(A, 0x0600), 1, MODULE_UART, 0) /* USART1: PA9/PA10 */ +ALTERNATE(PIN_MASK(B, 0x00c0), 1, MODULE_I2C, 0) /* I2C MASTER:PB6/7 */ +ALTERNATE(PIN_MASK(A, 0x00f0), 0, MODULE_SPI, 0) /* SPI SLAVE:PA4/5/6/7 */ diff --git a/board/mccroskey/gpio.inc b/board/mccroskey/gpio.inc index 61a02c05ff..71aff83c9a 100644 --- a/board/mccroskey/gpio.inc +++ b/board/mccroskey/gpio.inc @@ -6,55 +6,55 @@ */ /* Inputs with interrupt handlers are first for efficiency */ -GPIO_INT(KB_IN00, B, 8, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN01, B, 9, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN02, B, 10, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN03, B, 11, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN04, B, 12, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN05, B, 13, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN06, B, 14, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN07, B, 15, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN00, PIN(B, 8), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN01, PIN(B, 9), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN02, PIN(B, 10), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN03, PIN(B, 11), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN04, PIN(B, 12), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN05, PIN(B, 13), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN06, PIN(B, 14), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN07, PIN(B, 15), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) /* TODO(crosbug.com/p/23494): interrupt handler for power button */ -GPIO(KBD_PWR_BUTTON, B, 2, GPIO_INPUT) +GPIO(KBD_PWR_BUTTON, PIN(B, 2), GPIO_INPUT) -GPIO(OMZO_RDY_L, A, 0, GPIO_INPUT) /* PA0_WKUP */ -GPIO(OZMO_RST_L, A, 2, GPIO_ODR_HIGH) -GPIO(VBUS_UP_DET, A, 3, GPIO_INPUT) -GPIO(OZMO_REQ_L, A, 8, GPIO_INPUT) -GPIO(CHARGE_ZERO, B, 0, GPIO_INPUT) -GPIO(CHARGE_SHUNT, B, 1, GPIO_INPUT) -GPIO(PMIC_INT_L, B, 5, GPIO_INPUT) +GPIO(OMZO_RDY_L, PIN(A, 0), GPIO_INPUT) /* PA0_WKUP */ +GPIO(OZMO_RST_L, PIN(A, 2), GPIO_ODR_HIGH) +GPIO(VBUS_UP_DET, PIN(A, 3), GPIO_INPUT) +GPIO(OZMO_REQ_L, PIN(A, 8), GPIO_INPUT) +GPIO(CHARGE_ZERO, PIN(B, 0), GPIO_INPUT) +GPIO(CHARGE_SHUNT, PIN(B, 1), GPIO_INPUT) +GPIO(PMIC_INT_L, PIN(B, 5), GPIO_INPUT) /* * I2C pins should be configured as inputs until I2C module is * initialized. This will avoid driving the lines unintentionally. */ -GPIO(I2C1_SCL, B, 6, GPIO_INPUT) -GPIO(I2C1_SDA, B, 7, GPIO_INPUT) +GPIO(I2C1_SCL, PIN(B, 6), GPIO_INPUT) +GPIO(I2C1_SDA, PIN(B, 7), GPIO_INPUT) -GPIO(KB_OUT00, C, 0, GPIO_KB_OUTPUT) -GPIO(KB_OUT01, C, 1, GPIO_KB_OUTPUT) -GPIO(KB_OUT02, C, 2, GPIO_KB_OUTPUT) -GPIO(KB_OUT03, C, 3, GPIO_KB_OUTPUT) -GPIO(KB_OUT04, C, 4, GPIO_KB_OUTPUT) -GPIO(KB_OUT05, C, 5, GPIO_KB_OUTPUT) -GPIO(KB_OUT06, C, 6, GPIO_KB_OUTPUT) -GPIO(KB_OUT07, C, 7, GPIO_KB_OUTPUT) -GPIO(KB_OUT08, C, 8, GPIO_KB_OUTPUT) -GPIO(KB_OUT09, C, 9, GPIO_KB_OUTPUT) -GPIO(KB_OUT10, C, 10, GPIO_KB_OUTPUT) -GPIO(KB_OUT11, C, 11, GPIO_KB_OUTPUT) -GPIO(KB_OUT12, C, 12, GPIO_KB_OUTPUT) -GPIO(USB_VBUS_CTRL, C, 13, GPIO_OUT_LOW) -GPIO(HUB_RESET, C, 14, GPIO_ODR_HIGH) -GPIO(WP_L, D, 2, GPIO_INPUT) +GPIO(KB_OUT00, PIN(C, 0), GPIO_KB_OUTPUT) +GPIO(KB_OUT01, PIN(C, 1), GPIO_KB_OUTPUT) +GPIO(KB_OUT02, PIN(C, 2), GPIO_KB_OUTPUT) +GPIO(KB_OUT03, PIN(C, 3), GPIO_KB_OUTPUT) +GPIO(KB_OUT04, PIN(C, 4), GPIO_KB_OUTPUT) +GPIO(KB_OUT05, PIN(C, 5), GPIO_KB_OUTPUT) +GPIO(KB_OUT06, PIN(C, 6), GPIO_KB_OUTPUT) +GPIO(KB_OUT07, PIN(C, 7), GPIO_KB_OUTPUT) +GPIO(KB_OUT08, PIN(C, 8), GPIO_KB_OUTPUT) +GPIO(KB_OUT09, PIN(C, 9), GPIO_KB_OUTPUT) +GPIO(KB_OUT10, PIN(C, 10), GPIO_KB_OUTPUT) +GPIO(KB_OUT11, PIN(C, 11), GPIO_KB_OUTPUT) +GPIO(KB_OUT12, PIN(C, 12), GPIO_KB_OUTPUT) +GPIO(USB_VBUS_CTRL, PIN(C, 13), GPIO_OUT_LOW) +GPIO(HUB_RESET, PIN(C, 14), GPIO_ODR_HIGH) +GPIO(WP_L, PIN(D, 2), GPIO_INPUT) /* * TODO(crosbug.com/p/23494): This will be an alternate function GPIO, * so remove it from here. */ -GPIO(BL_PWM, A, 1, GPIO_OUTPUT) +GPIO(BL_PWM, PIN(A, 1), GPIO_OUTPUT) /* Unimplemented signals which we need to emulate for now */ UNIMPLEMENTED(EC_INT) @@ -62,12 +62,12 @@ UNIMPLEMENTED(ENTERING_RW) #if 0 /* Other GPIOs (probably need to be set up below as alt. function) */ -GPIO(STM_USBDM, A, 11, GPIO_DEFAULT) -GPIO(STM_USBDP, A, 12, GPIO_DEFAULT) -GPIO(JTMS_SWDIO, A, 13, GPIO_DEFAULT) -GPIO(JTCK_SWCLK, A, 14, GPIO_DEFAULT) -GPIO(JTDI, A, 15, GPIO_DEFAULT) -GPIO(JTDO, B, 3, GPIO_DEFAULT) -GPIO(JNTRST, B, 4, GPIO_DEFAULT) -GPIO(OSC32_OUT, C, 15, GPIO_DEFAULT) +GPIO(STM_USBDM, PIN(A, 11), GPIO_DEFAULT) +GPIO(STM_USBDP, PIN(A, 12), GPIO_DEFAULT) +GPIO(JTMS_SWDIO, PIN(A, 13), GPIO_DEFAULT) +GPIO(JTCK_SWCLK, PIN(A, 14), GPIO_DEFAULT) +GPIO(JTDI, PIN(A, 15), GPIO_DEFAULT) +GPIO(JTDO, PIN(B, 3), GPIO_DEFAULT) +GPIO(JNTRST, PIN(B, 4), GPIO_DEFAULT) +GPIO(OSC32_OUT, PIN(C, 15), GPIO_DEFAULT) #endif diff --git a/board/mec1322_evb/gpio.inc b/board/mec1322_evb/gpio.inc index 511fcd8c68..8bb7cf29aa 100644 --- a/board/mec1322_evb/gpio.inc +++ b/board/mec1322_evb/gpio.inc @@ -5,17 +5,17 @@ * found in the LICENSE file. */ -GPIO(LED1, PORT(15), 4, GPIO_ODR_LOW) -GPIO(LED2, PORT(15), 5, GPIO_ODR_HIGH) -GPIO(LED3, PORT(15), 6, GPIO_ODR_LOW) -GPIO(PCH_SMI_L, PORT(4), 4, GPIO_ODR_HIGH) /* SMI output */ -GPIO(PCH_WAKE_L, PORT(20), 0, GPIO_ODR_HIGH) /* PCH wake pin */ +GPIO(LED1, PIN(154), GPIO_ODR_LOW) +GPIO(LED2, PIN(155), GPIO_ODR_HIGH) +GPIO(LED3, PIN(156), GPIO_ODR_LOW) +GPIO(PCH_SMI_L, PIN(44), GPIO_ODR_HIGH) /* SMI output */ +GPIO(PCH_WAKE_L, PIN(200), GPIO_ODR_HIGH) /* PCH wake pin */ /* Switch S1 */ -GPIO(S1, PORT(6), 3, GPIO_INT_FALLING | GPIO_PULL_UP) +GPIO(S1, PIN(63), GPIO_INT_FALLING | GPIO_PULL_UP) /* Shared SPI CS */ -GPIO(SHD_CS0, PORT(15), 0, GPIO_ODR_HIGH) +GPIO(SHD_CS0, PIN(150), GPIO_ODR_HIGH) /* * Signals which aren't implemented on MEC1322 eval board but we'll @@ -25,21 +25,21 @@ UNIMPLEMENTED(RECOVERY_L) /* Recovery signal from DOWN button */ UNIMPLEMENTED(WP_L) /* Write protect input */ UNIMPLEMENTED(ENTERING_RW) /* EC entering RW code */ -ALTERNATE(PORT(16), 0x24, 1, MODULE_UART, 0) /* UART0 */ -ALTERNATE(PORT(3), (1 << 4), 3, MODULE_PWM_FAN, 0) -ALTERNATE(PORT(14), (1 << 0), 3, MODULE_PWM_FAN, 0) +ALTERNATE(PIN_MASK(16, 0x24), 1, MODULE_UART, 0) /* UART0 */ +ALTERNATE(PIN_MASK(3, (1 << 4)), 3, MODULE_PWM_FAN, 0) +ALTERNATE(PIN_MASK(14, (1 << 0)), 3, MODULE_PWM_FAN, 0) /* * I2C0: External pull-up resistors on EVB are too weak. Let's * also enable internal pull-up here. */ -ALTERNATE(PORT(1), 0x60, 2, MODULE_I2C, GPIO_PULL_UP) -ALTERNATE(PORT(0), 0xfe, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) -ALTERNATE(PORT(1), 0x03, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) -ALTERNATE(PORT(3), 0x04, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) -ALTERNATE(PORT(4), 0x0d, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) -ALTERNATE(PORT(10), 0xd8, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) -ALTERNATE(PORT(12), 0x60, 2, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) -ALTERNATE(PORT(14), 0x14, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) -ALTERNATE(PORT(2), 0x20, 2, MODULE_LPC, 0) -ALTERNATE(PORT(12), 0x14, 1, MODULE_SPI, 0) -ALTERNATE(PORT(6), 0x10, 1, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(1, 0x60), 2, MODULE_I2C, GPIO_PULL_UP) +ALTERNATE(PIN_MASK(0, 0xfe), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) +ALTERNATE(PIN_MASK(1, 0x03), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) +ALTERNATE(PIN_MASK(3, 0x04), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) +ALTERNATE(PIN_MASK(4, 0x0d), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) +ALTERNATE(PIN_MASK(10, 0xd8), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) +ALTERNATE(PIN_MASK(12, 0x60), 2, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) +ALTERNATE(PIN_MASK(14, 0x14), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) +ALTERNATE(PIN_MASK(2, 0x20), 2, MODULE_LPC, 0) +ALTERNATE(PIN_MASK(12, 0x14), 1, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(6, 0x10), 1, MODULE_SPI, 0) diff --git a/board/mec1322_evb/lfw/gpio.inc b/board/mec1322_evb/lfw/gpio.inc index 8258067e31..205330262c 100644 --- a/board/mec1322_evb/lfw/gpio.inc +++ b/board/mec1322_evb/lfw/gpio.inc @@ -7,11 +7,11 @@ * Minimal set of GPIOs needed for LFW loader */ -GPIO(PVT_CS0, PORT(14), 6, GPIO_ODR_HIGH) /* SPI PVT Chip select */ -GPIO(SHD_CS0, PORT(15), 0, GPIO_ODR_HIGH) +GPIO(PVT_CS0, PIN(146), GPIO_ODR_HIGH) /* SPI PVT Chip select */ +GPIO(SHD_CS0, PIN(150), GPIO_ODR_HIGH) /* Alternate functions GPIO definition */ -ALTERNATE(PORT(16), 0x24, 1, MODULE_UART, 0) /* UART0 */ -ALTERNATE(PORT(5), 0x10, 1, MODULE_SPI, 0) -ALTERNATE(PORT(16), 0x10, 1, MODULE_SPI, 0) -ALTERNATE(PORT(15), 0x08, 1, MODULE_SPI, 0) /* 153: CLK */ +ALTERNATE(PIN_MASK(16, 0x24), 1, MODULE_UART, 0) /* UART0 */ +ALTERNATE(PIN_MASK(5, 0x10), 1, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(16, 0x10), 1, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(15, 0x08), 1, MODULE_SPI, 0) /* 153: CLK */ diff --git a/board/mighty/gpio.inc b/board/mighty/gpio.inc index 294b097766..79b05dc73f 100644 --- a/board/mighty/gpio.inc +++ b/board/mighty/gpio.inc @@ -6,54 +6,54 @@ */ /* Inputs with interrupt handlers are first for efficiency */ -GPIO_INT(POWER_BUTTON_L, B, 5, GPIO_INT_BOTH, power_button_interrupt) /* wk6 */ /* active high, the name is for compatibility with existing code */ -GPIO_INT(SOC_POWER_GOOD, A, 3, GPIO_INT_BOTH, power_signal_interrupt) -GPIO_INT(LID_OPEN, C, 13, GPIO_INT_BOTH, lid_interrupt) -GPIO_INT(SUSPEND_L, C, 7, GPIO_INT_BOTH, power_signal_interrupt) -GPIO_INT(SPI1_NSS, A, 4, GPIO_INT_BOTH, spi_event) -GPIO_INT(AC_PRESENT, A, 8, GPIO_INT_BOTH | GPIO_PULL_UP, extpower_interrupt) +GPIO_INT(POWER_BUTTON_L, PIN(B, 5), GPIO_INT_BOTH, power_button_interrupt) /* wk6 */ /* active high, the name is for compatibility with existing code */ +GPIO_INT(SOC_POWER_GOOD, PIN(A, 3), GPIO_INT_BOTH, power_signal_interrupt) +GPIO_INT(LID_OPEN, PIN(C, 13), GPIO_INT_BOTH, lid_interrupt) +GPIO_INT(SUSPEND_L, PIN(C, 7), GPIO_INT_BOTH, power_signal_interrupt) +GPIO_INT(SPI1_NSS, PIN(A, 4), GPIO_INT_BOTH, spi_event) +GPIO_INT(AC_PRESENT, PIN(A, 8), GPIO_INT_BOTH | GPIO_PULL_UP, extpower_interrupt) /* Keyboard inputs */ -GPIO_INT(KB_IN00, C, 8, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN01, C, 9, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN02, C, 10, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN03, C, 11, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN04, C, 12, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN05, C, 14, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN06, C, 15, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN07, D, 2, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN00, PIN(C, 8), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN01, PIN(C, 9), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN02, PIN(C, 10), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN03, PIN(C, 11), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN04, PIN(C, 12), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN05, PIN(C, 14), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN06, PIN(C, 15), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN07, PIN(D, 2), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) /* Other inputs */ -GPIO(EC_WAKE, A, 0, GPIO_INPUT | GPIO_PULL_DOWN) /* wk1 */ -GPIO(WP_L, B, 4, GPIO_INPUT) +GPIO(EC_WAKE, PIN(A, 0), GPIO_INPUT | GPIO_PULL_DOWN) /* wk1 */ +GPIO(WP_L, PIN(B, 4), GPIO_INPUT) /* Outputs */ -GPIO(BAT_LED0, B, 11, GPIO_OUT_LOW) -GPIO(BAT_LED1, A, 11, GPIO_OUT_LOW) -GPIO(EC_BL_OVERRIDE, F, 1, GPIO_OUT_LOW) -GPIO(EC_INT, B, 9, GPIO_OUT_LOW) -GPIO(ENTERING_RW, F, 0, GPIO_OUT_LOW) -GPIO(I2C1_SCL, B, 6, GPIO_ODR_HIGH) -GPIO(I2C1_SDA, B, 7, GPIO_ODR_HIGH) -GPIO(KB_OUT00, B, 0, GPIO_KB_OUTPUT) -GPIO(KB_OUT01, B, 8, GPIO_KB_OUTPUT) -GPIO(KB_OUT02, B, 12, GPIO_OUT_LOW) /* Inverted from silegro */ -GPIO(KB_OUT03, B, 13, GPIO_KB_OUTPUT) -GPIO(KB_OUT04, B, 14, GPIO_KB_OUTPUT) -GPIO(KB_OUT05, B, 15, GPIO_KB_OUTPUT) -GPIO(KB_OUT06, C, 0, GPIO_KB_OUTPUT) -GPIO(KB_OUT07, C, 1, GPIO_KB_OUTPUT) -GPIO(KB_OUT08, C, 2, GPIO_KB_OUTPUT) -GPIO(KB_OUT09, B, 1, GPIO_KB_OUTPUT) -GPIO(KB_OUT10, C, 5, GPIO_KB_OUTPUT) -GPIO(KB_OUT11, C, 4, GPIO_KB_OUTPUT) -GPIO(KB_OUT12, A, 13, GPIO_KB_OUTPUT) -GPIO(POWER_LED, A, 2, GPIO_OUT_LOW) -GPIO(PMIC_PWRON, A, 12, GPIO_OUT_LOW) -GPIO(PMIC_RESET, B, 3, GPIO_OUT_LOW) -GPIO(PMIC_SOURCE_PWREN, B, 10, GPIO_OUT_LOW) -GPIO(PMIC_WARM_RESET_L, C, 3, GPIO_ODR_HIGH) +GPIO(BAT_LED0, PIN(B, 11), GPIO_OUT_LOW) +GPIO(BAT_LED1, PIN(A, 11), GPIO_OUT_LOW) +GPIO(EC_BL_OVERRIDE, PIN(F, 1), GPIO_OUT_LOW) +GPIO(EC_INT, PIN(B, 9), GPIO_OUT_LOW) +GPIO(ENTERING_RW, PIN(F, 0), GPIO_OUT_LOW) +GPIO(I2C1_SCL, PIN(B, 6), GPIO_ODR_HIGH) +GPIO(I2C1_SDA, PIN(B, 7), GPIO_ODR_HIGH) +GPIO(KB_OUT00, PIN(B, 0), GPIO_KB_OUTPUT) +GPIO(KB_OUT01, PIN(B, 8), GPIO_KB_OUTPUT) +GPIO(KB_OUT02, PIN(B, 12), GPIO_OUT_LOW) /* Inverted from silegro */ +GPIO(KB_OUT03, PIN(B, 13), GPIO_KB_OUTPUT) +GPIO(KB_OUT04, PIN(B, 14), GPIO_KB_OUTPUT) +GPIO(KB_OUT05, PIN(B, 15), GPIO_KB_OUTPUT) +GPIO(KB_OUT06, PIN(C, 0), GPIO_KB_OUTPUT) +GPIO(KB_OUT07, PIN(C, 1), GPIO_KB_OUTPUT) +GPIO(KB_OUT08, PIN(C, 2), GPIO_KB_OUTPUT) +GPIO(KB_OUT09, PIN(B, 1), GPIO_KB_OUTPUT) +GPIO(KB_OUT10, PIN(C, 5), GPIO_KB_OUTPUT) +GPIO(KB_OUT11, PIN(C, 4), GPIO_KB_OUTPUT) +GPIO(KB_OUT12, PIN(A, 13), GPIO_KB_OUTPUT) +GPIO(POWER_LED, PIN(A, 2), GPIO_OUT_LOW) +GPIO(PMIC_PWRON, PIN(A, 12), GPIO_OUT_LOW) +GPIO(PMIC_RESET, PIN(B, 3), GPIO_OUT_LOW) +GPIO(PMIC_SOURCE_PWREN, PIN(B, 10), GPIO_OUT_LOW) +GPIO(PMIC_WARM_RESET_L, PIN(C, 3), GPIO_ODR_HIGH) -ALTERNATE(A, 0x00f0, 0, MODULE_SPI, 0) -ALTERNATE(A, 0x0600, 1, MODULE_UART, 0) -ALTERNATE(B, 0x00c0, 1, MODULE_I2C, 0) +ALTERNATE(PIN_MASK(A, 0x00f0), 0, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(A, 0x0600), 1, MODULE_UART, 0) +ALTERNATE(PIN_MASK(B, 0x00c0), 1, MODULE_I2C, 0) diff --git a/board/npcx_evb/gpio.inc b/board/npcx_evb/gpio.inc index 77dbd801c5..4c6114c784 100644 --- a/board/npcx_evb/gpio.inc +++ b/board/npcx_evb/gpio.inc @@ -6,43 +6,43 @@ */ /* TODO: Redefine debug 2 inputs */ -GPIO_INT(RECOVERY_L, 0, 0, GPIO_PULL_UP | GPIO_INT_BOTH, switch_interrupt) /* Recovery signal from servo */ -GPIO_INT(WP_L, 9, 3, GPIO_PULL_DOWN | GPIO_INT_BOTH, switch_interrupt) /* Write protect input */ +GPIO_INT(RECOVERY_L, PIN(0, 0), GPIO_PULL_UP | GPIO_INT_BOTH, switch_interrupt) /* Recovery signal from servo */ +GPIO_INT(WP_L, PIN(9, 3), GPIO_PULL_DOWN | GPIO_INT_BOTH, switch_interrupt) /* Write protect input */ /* For testing 8042 commands, we need the following GPIOs */ /* TODO: Redefine 4 inputs */ -GPIO_INT(POWER_BUTTON_L, 0, 2, GPIO_PULL_UP | GPIO_INT_BOTH, power_button_interrupt) /* Power button */ -GPIO_INT(LID_OPEN, 3, 3, GPIO_PULL_DOWN | GPIO_INT_BOTH, lid_interrupt) /* Lid switch */ +GPIO_INT(POWER_BUTTON_L, PIN(0, 2), GPIO_PULL_UP | GPIO_INT_BOTH, power_button_interrupt) /* Power button */ +GPIO_INT(LID_OPEN, PIN(3, 3), GPIO_PULL_DOWN | GPIO_INT_BOTH, lid_interrupt) /* Lid switch */ -GPIO(ENTERING_RW, 3, 6, GPIO_OUT_LOW) /* Indicate when EC is entering RW code */ -GPIO(PCH_WAKE_L, 5, 0, GPIO_OUT_HIGH) /* Wake signal output to PCH */ +GPIO(ENTERING_RW, PIN(3, 6), GPIO_OUT_LOW) /* Indicate when EC is entering RW code */ +GPIO(PCH_WAKE_L, PIN(5, 0), GPIO_OUT_HIGH) /* Wake signal output to PCH */ /* Used for module testing */ -GPIO(PGOOD_FAN, C, 7, GPIO_PULL_UP | GPIO_INPUT) /* Power Good for FAN test */ -GPIO(SPI_CS_L, A, 5, GPIO_OUT_HIGH) /* SPI_CS Ready, Low Active. */ +GPIO(PGOOD_FAN, PIN(C, 7), GPIO_PULL_UP | GPIO_INPUT) /* Power Good for FAN test */ +GPIO(SPI_CS_L, PIN(A, 5), GPIO_OUT_HIGH) /* SPI_CS Ready, Low Active. */ /* * I2C pins should be configured as inputs until I2C module is * initialized. This will avoid driving the lines unintentionally. */ -GPIO(MASTER_I2C_SCL, B, 5, GPIO_INPUT) -GPIO(MASTER_I2C_SDA, B, 4, GPIO_INPUT) +GPIO(MASTER_I2C_SCL, PIN(B, 5), GPIO_INPUT) +GPIO(MASTER_I2C_SDA, PIN(B, 4), GPIO_INPUT) /* Used for board version command */ -GPIO(BOARD_VERSION1, 6, 4, GPIO_INPUT) /* Board version stuffing resistor 1 */ -GPIO(BOARD_VERSION2, 6, 5, GPIO_INPUT) /* Board version stuffing resistor 2 */ -GPIO(BOARD_VERSION3, 6, 6, GPIO_INPUT) /* Board version stuffing resistor 3 */ +GPIO(BOARD_VERSION1, PIN(6, 4), GPIO_INPUT) /* Board version stuffing resistor 1 */ +GPIO(BOARD_VERSION2, PIN(6, 5), GPIO_INPUT) /* Board version stuffing resistor 2 */ +GPIO(BOARD_VERSION3, PIN(6, 6), GPIO_INPUT) /* Board version stuffing resistor 3 */ #ifdef CONFIG_KEYBOARD_COL2_INVERTED -GPIO(KBD_KSO2, 1, 7, GPIO_OUT_LOW) /* Negative edge triggered keyboard irq. */ +GPIO(KBD_KSO2, PIN(1, 7), GPIO_OUT_LOW) /* Negative edge triggered keyboard irq. */ #endif /* Alternate pins for UART/I2C/ADC/SPI/PWM/MFT */ -ALTERNATE(1, 0x03, 1, MODULE_UART, 0) /* CR_SIN/SOUT GPIO10/11 */ -ALTERNATE(B, 0x30, 1, MODULE_I2C, 0) /* I2C0SDA/I2C0SCL GPIOB4/B5 */ -ALTERNATE(8, 0x80, 1, MODULE_I2C, 0) /* I2C1SDA GPIO87 */ -ALTERNATE(9, 0x07, 1, MODULE_I2C, 0) /* I2C1SCL/I2C2SDA/I2C2SCL GPIO90/91/92 */ -ALTERNATE(4, 0x38, 1, MODULE_ADC, 0) /* ADC GPIO45/44/43 */ -ALTERNATE(A, 0x0A, 1, MODULE_SPI, 0) /* SPIP_MOSI/SPIP_SCLK GPIOA3/A1 */ -ALTERNATE(9, 0x20, 1, MODULE_SPI, 0) /* SPIP_MISO GPIO95 */ -ALTERNATE(C, 0x04, 3, MODULE_PWM_KBLIGHT, 0) /* PWM1 for PWM/KBLIGHT Test GPIOC2 */ -ALTERNATE(C, 0x08, 7, MODULE_PWM_FAN, 0) /* PWM0 for PWM/FAN Test GPIOC3 */ -ALTERNATE(4, 0x01, 3, MODULE_PWM_FAN, 0) /* MFT-1/TA1_TACH1 for FAN Test GPIO40 */ +ALTERNATE(PIN_MASK(1, 0x03), 1, MODULE_UART, 0) /* CR_SIN/SOUT GPIO10/11 */ +ALTERNATE(PIN_MASK(B, 0x30), 1, MODULE_I2C, 0) /* I2C0SDA/I2C0SCL GPIOB4/B5 */ +ALTERNATE(PIN_MASK(8, 0x80), 1, MODULE_I2C, 0) /* I2C1SDA GPIO87 */ +ALTERNATE(PIN_MASK(9, 0x07), 1, MODULE_I2C, 0) /* I2C1SCL/I2C2SDA/I2C2SCL GPIO90/91/92 */ +ALTERNATE(PIN_MASK(4, 0x38), 1, MODULE_ADC, 0) /* ADC GPIO45/44/43 */ +ALTERNATE(PIN_MASK(A, 0x0A), 1, MODULE_SPI, 0) /* SPIP_MOSI/SPIP_SCLK GPIOA3/A1 */ +ALTERNATE(PIN_MASK(9, 0x20), 1, MODULE_SPI, 0) /* SPIP_MISO GPIO95 */ +ALTERNATE(PIN_MASK(C, 0x04), 3, MODULE_PWM_KBLIGHT, 0) /* PWM1 for PWM/KBLIGHT Test GPIOC2 */ +ALTERNATE(PIN_MASK(C, 0x08), 7, MODULE_PWM_FAN, 0) /* PWM0 for PWM/FAN Test GPIOC3 */ +ALTERNATE(PIN_MASK(4, 0x01), 3, MODULE_PWM_FAN, 0) /* MFT-1/TA1_TACH1 for FAN Test GPIO40 */ diff --git a/board/nyan/gpio.inc b/board/nyan/gpio.inc index 54e541f55b..31ed5e30b6 100644 --- a/board/nyan/gpio.inc +++ b/board/nyan/gpio.inc @@ -6,57 +6,57 @@ */ /* Inputs with interrupt handlers are first for efficiency */ -GPIO_INT(POWER_BUTTON_L, B, 5, GPIO_INT_BOTH, power_button_interrupt) -GPIO_INT(SOC1V8_XPSHOLD, A, 3, GPIO_INT_BOTH, power_signal_interrupt) -GPIO_INT(LID_OPEN, C, 13, GPIO_INT_BOTH, lid_interrupt) -GPIO_INT(SUSPEND_L, C, 7, GPIO_KB_INPUT, power_signal_interrupt) -GPIO_INT(SPI1_NSS, A, 4, GPIO_INT_BOTH | GPIO_PULL_UP, spi_event) -GPIO_INT(AC_PRESENT, A, 0, GPIO_INT_BOTH, extpower_interrupt) +GPIO_INT(POWER_BUTTON_L, PIN(B, 5), GPIO_INT_BOTH, power_button_interrupt) +GPIO_INT(SOC1V8_XPSHOLD, PIN(A, 3), GPIO_INT_BOTH, power_signal_interrupt) +GPIO_INT(LID_OPEN, PIN(C, 13), GPIO_INT_BOTH, lid_interrupt) +GPIO_INT(SUSPEND_L, PIN(C, 7), GPIO_KB_INPUT, power_signal_interrupt) +GPIO_INT(SPI1_NSS, PIN(A, 4), GPIO_INT_BOTH | GPIO_PULL_UP, spi_event) +GPIO_INT(AC_PRESENT, PIN(A, 0), GPIO_INT_BOTH, extpower_interrupt) /* Keyboard inputs */ -GPIO_INT(KB_IN00, C, 8, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN01, C, 9, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN02, C, 10, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN03, C, 11, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN04, C, 12, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN05, C, 14, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN06, C, 15, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN07, D, 2, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN00, PIN(C, 8), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN01, PIN(C, 9), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN02, PIN(C, 10), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN03, PIN(C, 11), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN04, PIN(C, 12), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN05, PIN(C, 14), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN06, PIN(C, 15), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN07, PIN(D, 2), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) /* Other inputs */ -GPIO(WP_L, B, 4, GPIO_INPUT) +GPIO(WP_L, PIN(B, 4), GPIO_INPUT) /* Outputs */ -GPIO(AP_RESET_L, B, 3, GPIO_ODR_HIGH) -GPIO(CHARGER_EN, B, 2, GPIO_OUT_LOW) -GPIO(EC_INT, B, 9, GPIO_ODR_HIGH) -GPIO(ENTERING_RW, H, 0, GPIO_OUT_LOW) -GPIO(I2C1_SCL, B, 6, GPIO_ODR_HIGH) -GPIO(I2C1_SDA, B, 7, GPIO_ODR_HIGH) -GPIO(LED_POWER_L, A, 2, GPIO_OUT_HIGH) /* PWR_LED1 */ -GPIO(PMIC_PWRON_L, A, 12, GPIO_OUT_HIGH) -GPIO(PMIC_RESET, A, 15, GPIO_OUT_LOW) -GPIO(KB_OUT00, B, 0, GPIO_KB_OUTPUT) -GPIO(KB_OUT01, B, 8, GPIO_KB_OUTPUT) -GPIO(KB_OUT02, B, 12, GPIO_KB_OUTPUT) -GPIO(KB_OUT03, B, 13, GPIO_KB_OUTPUT) -GPIO(KB_OUT04, B, 14, GPIO_KB_OUTPUT) -GPIO(KB_OUT05, B, 15, GPIO_KB_OUTPUT) -GPIO(KB_OUT06, C, 0, GPIO_KB_OUTPUT) -GPIO(KB_OUT07, C, 1, GPIO_KB_OUTPUT) -GPIO(KB_OUT08, C, 2, GPIO_KB_OUTPUT) -GPIO(KB_OUT09, B, 1, GPIO_KB_OUTPUT) -GPIO(KB_OUT10, C, 5, GPIO_KB_OUTPUT) -GPIO(KB_OUT11, C, 4, GPIO_KB_OUTPUT) -GPIO(KB_OUT12, A, 13, GPIO_KB_OUTPUT) -GPIO(PWR_LED0, B, 10, GPIO_OUT_LOW) -GPIO(BAT_LED0, B, 11, GPIO_OUT_LOW) -GPIO(BAT_LED1, A, 8, GPIO_OUT_LOW) -GPIO(CHARGING, A, 11, GPIO_OUT_LOW) -GPIO(EC_BL_OVERRIDE, H, 1, GPIO_ODR_HIGH) -GPIO(PMIC_THERM_L, A, 1, GPIO_ODR_HIGH) -GPIO(PMIC_WARM_RESET_L, C, 3, GPIO_ODR_HIGH) +GPIO(AP_RESET_L, PIN(B, 3), GPIO_ODR_HIGH) +GPIO(CHARGER_EN, PIN(B, 2), GPIO_OUT_LOW) +GPIO(EC_INT, PIN(B, 9), GPIO_ODR_HIGH) +GPIO(ENTERING_RW, PIN(H, 0), GPIO_OUT_LOW) +GPIO(I2C1_SCL, PIN(B, 6), GPIO_ODR_HIGH) +GPIO(I2C1_SDA, PIN(B, 7), GPIO_ODR_HIGH) +GPIO(LED_POWER_L, PIN(A, 2), GPIO_OUT_HIGH) /* PWR_LED1 */ +GPIO(PMIC_PWRON_L, PIN(A, 12), GPIO_OUT_HIGH) +GPIO(PMIC_RESET, PIN(A, 15), GPIO_OUT_LOW) +GPIO(KB_OUT00, PIN(B, 0), GPIO_KB_OUTPUT) +GPIO(KB_OUT01, PIN(B, 8), GPIO_KB_OUTPUT) +GPIO(KB_OUT02, PIN(B, 12), GPIO_KB_OUTPUT) +GPIO(KB_OUT03, PIN(B, 13), GPIO_KB_OUTPUT) +GPIO(KB_OUT04, PIN(B, 14), GPIO_KB_OUTPUT) +GPIO(KB_OUT05, PIN(B, 15), GPIO_KB_OUTPUT) +GPIO(KB_OUT06, PIN(C, 0), GPIO_KB_OUTPUT) +GPIO(KB_OUT07, PIN(C, 1), GPIO_KB_OUTPUT) +GPIO(KB_OUT08, PIN(C, 2), GPIO_KB_OUTPUT) +GPIO(KB_OUT09, PIN(B, 1), GPIO_KB_OUTPUT) +GPIO(KB_OUT10, PIN(C, 5), GPIO_KB_OUTPUT) +GPIO(KB_OUT11, PIN(C, 4), GPIO_KB_OUTPUT) +GPIO(KB_OUT12, PIN(A, 13), GPIO_KB_OUTPUT) +GPIO(PWR_LED0, PIN(B, 10), GPIO_OUT_LOW) +GPIO(BAT_LED0, PIN(B, 11), GPIO_OUT_LOW) +GPIO(BAT_LED1, PIN(A, 8), GPIO_OUT_LOW) +GPIO(CHARGING, PIN(A, 11), GPIO_OUT_LOW) +GPIO(EC_BL_OVERRIDE, PIN(H, 1), GPIO_ODR_HIGH) +GPIO(PMIC_THERM_L, PIN(A, 1), GPIO_ODR_HIGH) +GPIO(PMIC_WARM_RESET_L, PIN(C, 3), GPIO_ODR_HIGH) -ALTERNATE(A, 0x00f0, GPIO_ALT_SPI, MODULE_SPI, GPIO_DEFAULT) -ALTERNATE(A, 0x0600, GPIO_ALT_USART, MODULE_UART, GPIO_DEFAULT) -ALTERNATE(B, 0x00c0, GPIO_ALT_I2C, MODULE_I2C, GPIO_DEFAULT) +ALTERNATE(PIN_MASK(A, 0x00f0), GPIO_ALT_SPI, MODULE_SPI, GPIO_DEFAULT) +ALTERNATE(PIN_MASK(A, 0x0600), GPIO_ALT_USART, MODULE_UART, GPIO_DEFAULT) +ALTERNATE(PIN_MASK(B, 0x00c0), GPIO_ALT_I2C, MODULE_I2C, GPIO_DEFAULT) diff --git a/board/peppy/gpio.inc b/board/peppy/gpio.inc index 0ce95b1f43..0cbd553a5a 100644 --- a/board/peppy/gpio.inc +++ b/board/peppy/gpio.inc @@ -6,96 +6,96 @@ */ /* Inputs with interrupt handlers are first for efficiency */ -GPIO_INT(POWER_BUTTON_L, A, 2, GPIO_INT_BOTH_DSLEEP, power_button_interrupt) /* Power button */ -GPIO_INT(LID_OPEN, A, 3, GPIO_INT_BOTH_DSLEEP, lid_interrupt) /* Lid switch */ -GPIO_INT(AC_PRESENT, H, 3, GPIO_INT_BOTH_DSLEEP, extpower_interrupt) /* AC power present */ -GPIO_INT(PCH_BKLTEN, M, 3, GPIO_INT_BOTH, backlight_interrupt) /* Backlight enable signal from PCH */ -GPIO_INT(PCH_SLP_S0_L, G, 6, GPIO_INT_BOTH, power_signal_interrupt) /* SLP_S0# signal from PCH */ -GPIO_INT(PCH_SLP_S3_L, G, 7, GPIO_INT_BOTH_DSLEEP, power_signal_interrupt) /* SLP_S3# signal from PCH */ -GPIO_INT(PCH_SLP_S5_L, H, 1, GPIO_INT_BOTH_DSLEEP, power_signal_interrupt) /* SLP_S5# signal from PCH */ -GPIO_INT(PCH_SLP_SUS_L, G, 3, GPIO_INT_BOTH, power_signal_interrupt) /* SLP_SUS# signal from PCH */ -GPIO_INT(PP1050_PGOOD, H, 4, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 1.05V */ -GPIO_INT(PP1350_PGOOD, H, 6, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 1.35V (DRAM) */ -GPIO_INT(PP5000_PGOOD, N, 0, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 5V */ -GPIO_INT(VCORE_PGOOD, C, 6, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on core VR */ -GPIO_INT(PCH_EDP_VDD_EN, J, 1, GPIO_INT_BOTH, power_interrupt) /* PCH wants EDP enabled */ -GPIO_INT(RECOVERY_L, A, 5, GPIO_PULL_UP | GPIO_INT_BOTH, switch_interrupt) /* Recovery signal from servo */ -GPIO_INT(WP_L, A, 4, GPIO_INT_BOTH, switch_interrupt) /* Write protect input */ -GPIO_INT(JTAG_TCK, C, 0, GPIO_DEFAULT, jtag_interrupt) /* JTAG clock input */ -GPIO_INT(UART0_RX, A, 0, GPIO_PULL_UP | GPIO_INT_BOTH_DSLEEP, uart_deepsleep_interrupt) /* UART0 RX input */ +GPIO_INT(POWER_BUTTON_L, PIN(A, 2), GPIO_INT_BOTH_DSLEEP, power_button_interrupt) /* Power button */ +GPIO_INT(LID_OPEN, PIN(A, 3), GPIO_INT_BOTH_DSLEEP, lid_interrupt) /* Lid switch */ +GPIO_INT(AC_PRESENT, PIN(H, 3), GPIO_INT_BOTH_DSLEEP, extpower_interrupt) /* AC power present */ +GPIO_INT(PCH_BKLTEN, PIN(M, 3), GPIO_INT_BOTH, backlight_interrupt) /* Backlight enable signal from PCH */ +GPIO_INT(PCH_SLP_S0_L, PIN(G, 6), GPIO_INT_BOTH, power_signal_interrupt) /* SLP_S0# signal from PCH */ +GPIO_INT(PCH_SLP_S3_L, PIN(G, 7), GPIO_INT_BOTH_DSLEEP, power_signal_interrupt) /* SLP_S3# signal from PCH */ +GPIO_INT(PCH_SLP_S5_L, PIN(H, 1), GPIO_INT_BOTH_DSLEEP, power_signal_interrupt) /* SLP_S5# signal from PCH */ +GPIO_INT(PCH_SLP_SUS_L, PIN(G, 3), GPIO_INT_BOTH, power_signal_interrupt) /* SLP_SUS# signal from PCH */ +GPIO_INT(PP1050_PGOOD, PIN(H, 4), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 1.05V */ +GPIO_INT(PP1350_PGOOD, PIN(H, 6), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 1.35V (DRAM) */ +GPIO_INT(PP5000_PGOOD, PIN(N, 0), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 5V */ +GPIO_INT(VCORE_PGOOD, PIN(C, 6), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on core VR */ +GPIO_INT(PCH_EDP_VDD_EN, PIN(J, 1), GPIO_INT_BOTH, power_interrupt) /* PCH wants EDP enabled */ +GPIO_INT(RECOVERY_L, PIN(A, 5), GPIO_PULL_UP | GPIO_INT_BOTH, switch_interrupt) /* Recovery signal from servo */ +GPIO_INT(WP_L, PIN(A, 4), GPIO_INT_BOTH, switch_interrupt) /* Write protect input */ +GPIO_INT(JTAG_TCK, PIN(C, 0), GPIO_DEFAULT, jtag_interrupt) /* JTAG clock input */ +GPIO_INT(UART0_RX, PIN(A, 0), GPIO_PULL_UP | GPIO_INT_BOTH_DSLEEP, uart_deepsleep_interrupt) /* UART0 RX input */ /* Other inputs */ -GPIO(FAN_ALERT_L, B, 0, GPIO_INPUT) /* From thermal sensor */ -GPIO(PCH_SUSWARN_L, G, 2, GPIO_INT_BOTH) /* SUSWARN# signal from PCH */ -GPIO(USB1_OC_L, E, 7, GPIO_INPUT) /* USB port overcurrent warning */ -GPIO(USB2_OC_L, E, 0, GPIO_INPUT) /* USB port overcurrent warning */ -GPIO(BOARD_VERSION1, Q, 5, GPIO_INPUT) /* Board version stuffing resistor 1 */ -GPIO(BOARD_VERSION2, Q, 6, GPIO_INPUT) /* Board version stuffing resistor 2 */ -GPIO(BOARD_VERSION3, Q, 7, GPIO_INPUT) /* Board version stuffing resistor 3 */ -GPIO(CPU_PGOOD, C, 4, GPIO_INPUT) /* Power good to the CPU */ -GPIO(BAT_PRESENT_L, B, 4, GPIO_INPUT) /* Battery present. Repurposed BAT_TEMP */ +GPIO(FAN_ALERT_L, PIN(B, 0), GPIO_INPUT) /* From thermal sensor */ +GPIO(PCH_SUSWARN_L, PIN(G, 2), GPIO_INT_BOTH) /* SUSWARN# signal from PCH */ +GPIO(USB1_OC_L, PIN(E, 7), GPIO_INPUT) /* USB port overcurrent warning */ +GPIO(USB2_OC_L, PIN(E, 0), GPIO_INPUT) /* USB port overcurrent warning */ +GPIO(BOARD_VERSION1, PIN(Q, 5), GPIO_INPUT) /* Board version stuffing resistor 1 */ +GPIO(BOARD_VERSION2, PIN(Q, 6), GPIO_INPUT) /* Board version stuffing resistor 2 */ +GPIO(BOARD_VERSION3, PIN(Q, 7), GPIO_INPUT) /* Board version stuffing resistor 3 */ +GPIO(CPU_PGOOD, PIN(C, 4), GPIO_INPUT) /* Power good to the CPU */ +GPIO(BAT_PRESENT_L, PIN(B, 4), GPIO_INPUT) /* Battery present. Repurposed BAT_TEMP */ /* Outputs; all unasserted by default except for reset signals */ -GPIO(CPU_PROCHOT, B, 1, GPIO_OUT_LOW) /* Force CPU to think it's overheated */ -GPIO(PP1350_EN, H, 5, GPIO_OUT_LOW) /* Enable 1.35V supply */ -GPIO(PP3300_DX_EN, J, 2, GPIO_OUT_LOW) /* Enable power to lots of peripherals */ -GPIO(PP3300_LTE_EN, D, 2, GPIO_OUT_LOW) /* Enable LTE radio */ -GPIO(PP3300_WLAN_EN, J, 0, GPIO_OUT_LOW) /* Enable WiFi power */ -GPIO(SUSP_VR_EN, C, 7, GPIO_OUT_LOW) /* Enable 1.05V regulator */ -GPIO(VCORE_EN, C, 5, GPIO_OUT_LOW) /* Stuffing option - not connected */ -GPIO(PP5000_EN, H, 7, GPIO_OUT_LOW) /* Enable 5V supply */ -GPIO(PP5000_FAN_EN, J, 3, GPIO_OUT_LOW) /* Enable fan power rail */ -GPIO(SYS_PWROK, H, 2, GPIO_OUT_LOW) /* EC thinks everything is up and ready */ -GPIO(WLAN_OFF_L, J, 4, GPIO_OUT_LOW) /* Disable WiFi radio */ -GPIO(CHARGE_L, E, 6, GPIO_OUT_LOW) /* Allow battery to charge when on AC */ +GPIO(CPU_PROCHOT, PIN(B, 1), GPIO_OUT_LOW) /* Force CPU to think it's overheated */ +GPIO(PP1350_EN, PIN(H, 5), GPIO_OUT_LOW) /* Enable 1.35V supply */ +GPIO(PP3300_DX_EN, PIN(J, 2), GPIO_OUT_LOW) /* Enable power to lots of peripherals */ +GPIO(PP3300_LTE_EN, PIN(D, 2), GPIO_OUT_LOW) /* Enable LTE radio */ +GPIO(PP3300_WLAN_EN, PIN(J, 0), GPIO_OUT_LOW) /* Enable WiFi power */ +GPIO(SUSP_VR_EN, PIN(C, 7), GPIO_OUT_LOW) /* Enable 1.05V regulator */ +GPIO(VCORE_EN, PIN(C, 5), GPIO_OUT_LOW) /* Stuffing option - not connected */ +GPIO(PP5000_EN, PIN(H, 7), GPIO_OUT_LOW) /* Enable 5V supply */ +GPIO(PP5000_FAN_EN, PIN(J, 3), GPIO_OUT_LOW) /* Enable fan power rail */ +GPIO(SYS_PWROK, PIN(H, 2), GPIO_OUT_LOW) /* EC thinks everything is up and ready */ +GPIO(WLAN_OFF_L, PIN(J, 4), GPIO_OUT_LOW) /* Disable WiFi radio */ +GPIO(CHARGE_L, PIN(E, 6), GPIO_OUT_LOW) /* Allow battery to charge when on AC */ -GPIO(ENABLE_BACKLIGHT, M, 7, GPIO_OUT_LOW) /* Enable backlight power */ -GPIO(ENABLE_TOUCHPAD, N, 1, GPIO_OUT_LOW) /* Enable touchpad power */ -GPIO(ENTERING_RW, D, 3, GPIO_OUT_LOW) /* Indicate when EC is entering RW code */ -GPIO(PCH_DPWROK, G, 0, GPIO_OUT_LOW) /* Indicate when VccDSW is good */ +GPIO(ENABLE_BACKLIGHT, PIN(M, 7), GPIO_OUT_LOW) /* Enable backlight power */ +GPIO(ENABLE_TOUCHPAD, PIN(N, 1), GPIO_OUT_LOW) /* Enable touchpad power */ +GPIO(ENTERING_RW, PIN(D, 3), GPIO_OUT_LOW) /* Indicate when EC is entering RW code */ +GPIO(PCH_DPWROK, PIN(G, 0), GPIO_OUT_LOW) /* Indicate when VccDSW is good */ /* * HDA_SDO is technically an output, but we need to leave it as an * input until we drive it high. So can't use open-drain (HI_Z). */ -GPIO(PCH_HDA_SDO, G, 1, GPIO_INPUT) /* HDA_SDO signal to PCH; when high, ME ignores security descriptor */ -GPIO(PCH_WAKE_L, F, 0, GPIO_OUT_HIGH) /* Wake signal from EC to PCH */ -GPIO(PCH_NMI_L, F, 2, GPIO_OUT_HIGH) /* Non-maskable interrupt pin to PCH */ -GPIO(PCH_PWRBTN_L, H, 0, GPIO_OUT_HIGH) /* Power button output to PCH */ -GPIO(PCH_PWROK, F, 5, GPIO_OUT_LOW) /* PWROK / APWROK signals to PCH */ +GPIO(PCH_HDA_SDO, PIN(G, 1), GPIO_INPUT) /* HDA_SDO signal to PCH; when high, ME ignores security descriptor */ +GPIO(PCH_WAKE_L, PIN(F, 0), GPIO_OUT_HIGH) /* Wake signal from EC to PCH */ +GPIO(PCH_NMI_L, PIN(F, 2), GPIO_OUT_HIGH) /* Non-maskable interrupt pin to PCH */ +GPIO(PCH_PWRBTN_L, PIN(H, 0), GPIO_OUT_HIGH) /* Power button output to PCH */ +GPIO(PCH_PWROK, PIN(F, 5), GPIO_OUT_LOW) /* PWROK / APWROK signals to PCH */ /* * PL6 is one of 4 pins on the EC which can't be used in open-drain * mode. To work around this PCH_RCIN_L is set to an input. It will * only be set to an output when it needs to be driven to 0. */ -GPIO(PCH_RCIN_L, L, 6, GPIO_INPUT) /* RCIN# line to PCH (for 8042 emulation) */ -GPIO(PCH_RSMRST_L, F, 1, GPIO_OUT_LOW) /* Reset PCH resume power plane logic */ -GPIO(PCH_SMI_L, F, 4, GPIO_ODR_HIGH) /* System management interrupt to PCH */ -GPIO(TOUCHSCREEN_RESET_L, N, 7, GPIO_OUT_LOW) /* Reset touch screen */ -GPIO(EC_EDP_VDD_EN, J, 5, GPIO_OUT_LOW) /* Enable EDP (passthru from PCH) */ +GPIO(PCH_RCIN_L, PIN(L, 6), GPIO_INPUT) /* RCIN# line to PCH (for 8042 emulation) */ +GPIO(PCH_RSMRST_L, PIN(F, 1), GPIO_OUT_LOW) /* Reset PCH resume power plane logic */ +GPIO(PCH_SMI_L, PIN(F, 4), GPIO_ODR_HIGH) /* System management interrupt to PCH */ +GPIO(TOUCHSCREEN_RESET_L, PIN(N, 7), GPIO_OUT_LOW) /* Reset touch screen */ +GPIO(EC_EDP_VDD_EN, PIN(J, 5), GPIO_OUT_LOW) /* Enable EDP (passthru from PCH) */ -GPIO(LPC_CLKRUN_L, M, 2, GPIO_ODR_HIGH) /* Dunno. Probably important, though. */ -GPIO(USB1_ENABLE, E, 4, GPIO_OUT_LOW) /* USB port 1 output power enable */ -GPIO(USB2_ENABLE, D, 5, GPIO_OUT_LOW) /* USB port 2 output power enable */ +GPIO(LPC_CLKRUN_L, PIN(M, 2), GPIO_ODR_HIGH) /* Dunno. Probably important, though. */ +GPIO(USB1_ENABLE, PIN(E, 4), GPIO_OUT_LOW) /* USB port 1 output power enable */ +GPIO(USB2_ENABLE, PIN(D, 5), GPIO_OUT_LOW) /* USB port 2 output power enable */ -GPIO(PCH_SUSACK_L, F, 3, GPIO_OUT_HIGH) /* Acknowledge PCH SUSWARN# signal */ -GPIO(PCH_RTCRST_L, F, 6, GPIO_ODR_HIGH) /* Not supposed to be here */ -GPIO(PCH_SRTCRST_L, F, 7, GPIO_ODR_HIGH) /* Not supposed to be here */ +GPIO(PCH_SUSACK_L, PIN(F, 3), GPIO_OUT_HIGH) /* Acknowledge PCH SUSWARN# signal */ +GPIO(PCH_RTCRST_L, PIN(F, 6), GPIO_ODR_HIGH) /* Not supposed to be here */ +GPIO(PCH_SRTCRST_L, PIN(F, 7), GPIO_ODR_HIGH) /* Not supposed to be here */ -GPIO(BAT_LED0_L, D, 0, GPIO_ODR_HIGH) /* Battery charging LED - blue */ -GPIO(BAT_LED1_L, N, 4, GPIO_ODR_HIGH) /* Battery charging LED - orange */ -GPIO(PWR_LED0_L, D, 1, GPIO_ODR_HIGH) /* Power LED - blue */ -GPIO(PWR_LED1_L, N, 6, GPIO_ODR_HIGH) /* Power LED - orange */ +GPIO(BAT_LED0_L, PIN(D, 0), GPIO_ODR_HIGH) /* Battery charging LED - blue */ +GPIO(BAT_LED1_L, PIN(N, 4), GPIO_ODR_HIGH) /* Battery charging LED - orange */ +GPIO(PWR_LED0_L, PIN(D, 1), GPIO_ODR_HIGH) /* Power LED - blue */ +GPIO(PWR_LED1_L, PIN(N, 6), GPIO_ODR_HIGH) /* Power LED - orange */ -ALTERNATE(A, 0x03, 1, MODULE_UART, GPIO_PULL_UP) /* UART0 */ -ALTERNATE(B, 0x04, 3, MODULE_I2C, 0) /* I2C0 SCL */ -ALTERNATE(B, 0x08, 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C0 SDA */ -ALTERNATE(B, 0x40, 3, MODULE_I2C, 0) /* I2C5 SCL */ -ALTERNATE(B, 0x80, 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C5 SDA */ -ALTERNATE(G, 0x30, 1, MODULE_UART, 0) /* UART2 */ -ALTERNATE(J, 0x40, 1, MODULE_PECI, 0) /* PECI Tx */ -ALTERNATE(J, 0x80, 0, MODULE_PECI, GPIO_ANALOG) /* PECI Rx */ -ALTERNATE(L, 0x3f, 15, MODULE_LPC, 0) /* LPC */ -ALTERNATE(M, 0x33, 15, MODULE_LPC, 0) /* LPC */ -ALTERNATE(N, 0x0c, 1, MODULE_PWM_FAN, 0) /* FAN0PWM2 */ +ALTERNATE(PIN_MASK(A, 0x03), 1, MODULE_UART, GPIO_PULL_UP) /* UART0 */ +ALTERNATE(PIN_MASK(B, 0x04), 3, MODULE_I2C, 0) /* I2C0 SCL */ +ALTERNATE(PIN_MASK(B, 0x08), 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C0 SDA */ +ALTERNATE(PIN_MASK(B, 0x40), 3, MODULE_I2C, 0) /* I2C5 SCL */ +ALTERNATE(PIN_MASK(B, 0x80), 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C5 SDA */ +ALTERNATE(PIN_MASK(G, 0x30), 1, MODULE_UART, 0) /* UART2 */ +ALTERNATE(PIN_MASK(J, 0x40), 1, MODULE_PECI, 0) /* PECI Tx */ +ALTERNATE(PIN_MASK(J, 0x80), 0, MODULE_PECI, GPIO_ANALOG) /* PECI Rx */ +ALTERNATE(PIN_MASK(L, 0x3f), 15, MODULE_LPC, 0) /* LPC */ +ALTERNATE(PIN_MASK(M, 0x33), 15, MODULE_LPC, 0) /* LPC */ +ALTERNATE(PIN_MASK(N, 0x0c), 1, MODULE_PWM_FAN, 0) /* FAN0PWM2 */ diff --git a/board/pinky/gpio.inc b/board/pinky/gpio.inc index e4dca2ba78..6b134103f0 100644 --- a/board/pinky/gpio.inc +++ b/board/pinky/gpio.inc @@ -6,53 +6,53 @@ */ /* Inputs with interrupt handlers are first for efficiency */ -GPIO_INT(POWER_BUTTON_L, B, 5, GPIO_INT_BOTH, power_button_interrupt) -GPIO_INT(SOC_POWER_GOOD, A, 3, GPIO_INT_BOTH, power_signal_interrupt) -GPIO_INT(LID_OPEN, C, 13, GPIO_INT_BOTH, lid_interrupt) -GPIO_INT(SUSPEND_L, C, 7, GPIO_INT_BOTH, power_signal_interrupt) -GPIO_INT(SPI1_NSS, A, 4, GPIO_INT_BOTH, spi_event) -GPIO_INT(AC_PRESENT, A, 0, GPIO_INT_BOTH | GPIO_PULL_UP, extpower_interrupt) +GPIO_INT(POWER_BUTTON_L, PIN(B, 5), GPIO_INT_BOTH, power_button_interrupt) +GPIO_INT(SOC_POWER_GOOD, PIN(A, 3), GPIO_INT_BOTH, power_signal_interrupt) +GPIO_INT(LID_OPEN, PIN(C, 13), GPIO_INT_BOTH, lid_interrupt) +GPIO_INT(SUSPEND_L, PIN(C, 7), GPIO_INT_BOTH, power_signal_interrupt) +GPIO_INT(SPI1_NSS, PIN(A, 4), GPIO_INT_BOTH, spi_event) +GPIO_INT(AC_PRESENT, PIN(A, 0), GPIO_INT_BOTH | GPIO_PULL_UP, extpower_interrupt) /* Keyboard inputs */ -GPIO_INT(KB_IN00, C, 8, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN01, C, 9, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN02, C, 10, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN03, C, 11, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN04, C, 12, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN05, C, 14, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN06, C, 15, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN07, D, 2, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN00, PIN(C, 8), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN01, PIN(C, 9), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN02, PIN(C, 10), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN03, PIN(C, 11), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN04, PIN(C, 12), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN05, PIN(C, 14), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN06, PIN(C, 15), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN07, PIN(D, 2), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) /* Other inputs */ -GPIO(WP_L, B, 4, GPIO_INPUT) +GPIO(WP_L, PIN(B, 4), GPIO_INPUT) /* Outputs */ -GPIO(5V_DRV, A, 8, GPIO_OUT_LOW) -GPIO(BAT_LED0, B, 11, GPIO_OUT_LOW) -GPIO(BAT_LED1, A, 11, GPIO_OUT_LOW) -GPIO(EC_BL_OVERRIDE, F, 1, GPIO_OUT_LOW) -GPIO(EC_INT, B, 9, GPIO_OUT_LOW) -GPIO(ENTERING_RW, F, 0, GPIO_OUT_LOW) -GPIO(I2C1_SCL, B, 6, GPIO_ODR_HIGH) -GPIO(I2C1_SDA, B, 7, GPIO_ODR_HIGH) -GPIO(KB_OUT00, B, 0, GPIO_KB_OUTPUT) -GPIO(KB_OUT01, B, 8, GPIO_KB_OUTPUT) -GPIO(KB_OUT02, B, 12, GPIO_OUT_LOW) /* Inverted from silegro */ -GPIO(KB_OUT03, B, 13, GPIO_KB_OUTPUT) -GPIO(KB_OUT04, B, 14, GPIO_KB_OUTPUT) -GPIO(KB_OUT05, B, 15, GPIO_KB_OUTPUT) -GPIO(KB_OUT06, C, 0, GPIO_KB_OUTPUT) -GPIO(KB_OUT07, C, 1, GPIO_KB_OUTPUT) -GPIO(KB_OUT08, C, 2, GPIO_KB_OUTPUT) -GPIO(KB_OUT09, B, 1, GPIO_KB_OUTPUT) -GPIO(KB_OUT10, C, 5, GPIO_KB_OUTPUT) -GPIO(KB_OUT11, C, 4, GPIO_KB_OUTPUT) -GPIO(KB_OUT12, A, 13, GPIO_KB_OUTPUT) -GPIO(PMIC_PWRON, A, 12, GPIO_OUT_LOW) -GPIO(PMIC_RESET, B, 3, GPIO_OUT_LOW) -GPIO(PMIC_SOURCE_PWREN, B, 10, GPIO_OUT_LOW) -GPIO(PMIC_WARM_RESET_L, C, 3, GPIO_ODR_HIGH) +GPIO(5V_DRV, PIN(A, 8), GPIO_OUT_LOW) +GPIO(BAT_LED0, PIN(B, 11), GPIO_OUT_LOW) +GPIO(BAT_LED1, PIN(A, 11), GPIO_OUT_LOW) +GPIO(EC_BL_OVERRIDE, PIN(F, 1), GPIO_OUT_LOW) +GPIO(EC_INT, PIN(B, 9), GPIO_OUT_LOW) +GPIO(ENTERING_RW, PIN(F, 0), GPIO_OUT_LOW) +GPIO(I2C1_SCL, PIN(B, 6), GPIO_ODR_HIGH) +GPIO(I2C1_SDA, PIN(B, 7), GPIO_ODR_HIGH) +GPIO(KB_OUT00, PIN(B, 0), GPIO_KB_OUTPUT) +GPIO(KB_OUT01, PIN(B, 8), GPIO_KB_OUTPUT) +GPIO(KB_OUT02, PIN(B, 12), GPIO_OUT_LOW) /* Inverted from silegro */ +GPIO(KB_OUT03, PIN(B, 13), GPIO_KB_OUTPUT) +GPIO(KB_OUT04, PIN(B, 14), GPIO_KB_OUTPUT) +GPIO(KB_OUT05, PIN(B, 15), GPIO_KB_OUTPUT) +GPIO(KB_OUT06, PIN(C, 0), GPIO_KB_OUTPUT) +GPIO(KB_OUT07, PIN(C, 1), GPIO_KB_OUTPUT) +GPIO(KB_OUT08, PIN(C, 2), GPIO_KB_OUTPUT) +GPIO(KB_OUT09, PIN(B, 1), GPIO_KB_OUTPUT) +GPIO(KB_OUT10, PIN(C, 5), GPIO_KB_OUTPUT) +GPIO(KB_OUT11, PIN(C, 4), GPIO_KB_OUTPUT) +GPIO(KB_OUT12, PIN(A, 13), GPIO_KB_OUTPUT) +GPIO(PMIC_PWRON, PIN(A, 12), GPIO_OUT_LOW) +GPIO(PMIC_RESET, PIN(B, 3), GPIO_OUT_LOW) +GPIO(PMIC_SOURCE_PWREN, PIN(B, 10), GPIO_OUT_LOW) +GPIO(PMIC_WARM_RESET_L, PIN(C, 3), GPIO_ODR_HIGH) -ALTERNATE(A, 0x00f0, 0, MODULE_SPI, 0) -ALTERNATE(A, 0x0600, 1, MODULE_UART, 0) -ALTERNATE(B, 0x00c0, 1, MODULE_I2C, 0) +ALTERNATE(PIN_MASK(A, 0x00f0), 0, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(A, 0x0600), 1, MODULE_UART, 0) +ALTERNATE(PIN_MASK(B, 0x00c0), 1, MODULE_I2C, 0) diff --git a/board/pit/gpio.inc b/board/pit/gpio.inc index 7717295d62..7a729001ea 100644 --- a/board/pit/gpio.inc +++ b/board/pit/gpio.inc @@ -6,57 +6,57 @@ */ /* Inputs with interrupt handlers are first for efficiency */ -GPIO_INT(KB_PWR_ON_L, B, 5, GPIO_INT_BOTH, power_signal_interrupt) -GPIO_INT(PP1800_LDO2, A, 1, GPIO_INT_BOTH, power_signal_interrupt) -GPIO_INT(SOC1V8_XPSHOLD, A, 3, GPIO_INT_RISING, power_signal_interrupt) -GPIO_INT(CHARGER_INT_L, C, 6, GPIO_INT_FALLING, pmu_irq_handler) -GPIO_INT(LID_OPEN, C, 13, GPIO_INT_BOTH, lid_interrupt) -GPIO_INT(SUSPEND_L, C, 7, GPIO_INT_BOTH, power_signal_interrupt) -GPIO_INT(SPI1_NSS, A, 4, GPIO_INT_BOTH | GPIO_PULL_UP, spi_event) -GPIO_INT(AC_PRESENT, A, 0, GPIO_INT_BOTH, extpower_interrupt) +GPIO_INT(KB_PWR_ON_L, PIN(B, 5), GPIO_INT_BOTH, power_signal_interrupt) +GPIO_INT(PP1800_LDO2, PIN(A, 1), GPIO_INT_BOTH, power_signal_interrupt) +GPIO_INT(SOC1V8_XPSHOLD, PIN(A, 3), GPIO_INT_RISING, power_signal_interrupt) +GPIO_INT(CHARGER_INT_L, PIN(C, 6), GPIO_INT_FALLING, pmu_irq_handler) +GPIO_INT(LID_OPEN, PIN(C, 13), GPIO_INT_BOTH, lid_interrupt) +GPIO_INT(SUSPEND_L, PIN(C, 7), GPIO_INT_BOTH, power_signal_interrupt) +GPIO_INT(SPI1_NSS, PIN(A, 4), GPIO_INT_BOTH | GPIO_PULL_UP, spi_event) +GPIO_INT(AC_PRESENT, PIN(A, 0), GPIO_INT_BOTH, extpower_interrupt) /* Keyboard inputs */ -GPIO_INT(KB_IN00, C, 8, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN01, C, 9, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN02, C, 10, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN03, C, 11, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN04, C, 12, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN05, C, 14, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN06, C, 15, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN07, D, 2, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN00, PIN(C, 8), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN01, PIN(C, 9), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN02, PIN(C, 10), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN03, PIN(C, 11), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN04, PIN(C, 12), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN05, PIN(C, 14), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN06, PIN(C, 15), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN07, PIN(D, 2), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) /* Other inputs */ -GPIO(WP_L, B, 4, GPIO_INPUT) +GPIO(WP_L, PIN(B, 4), GPIO_INPUT) /* Outputs */ -GPIO(AP_RESET_L, B, 3, GPIO_ODR_HIGH) -GPIO(CHARGER_EN, B, 2, GPIO_OUT_LOW) -GPIO(EC_INT, B, 9, GPIO_ODR_HIGH) -GPIO(EN_PP1350, H, 1, GPIO_OUT_LOW) -GPIO(EN_PP3300, A, 8, GPIO_OUT_LOW) -GPIO(EN_PP5000, A, 11, GPIO_OUT_LOW) -GPIO(ENTERING_RW, H, 0, GPIO_OUT_LOW) -GPIO(I2C1_SCL, B, 6, GPIO_ODR_HIGH) -GPIO(I2C1_SDA, B, 7, GPIO_ODR_HIGH) -GPIO(I2C2_SCL, B, 10, GPIO_ODR_HIGH) -GPIO(I2C2_SDA, B, 11, GPIO_ODR_HIGH) -GPIO(CHARGING_LED,A, 2, GPIO_OUT_LOW) -GPIO(PMIC_PWRON, A, 12, GPIO_OUT_LOW) -GPIO(PMIC_RESET, A, 15, GPIO_OUT_LOW) -GPIO(KB_OUT00, B, 0, GPIO_KB_OUTPUT) -GPIO(KB_OUT01, B, 8, GPIO_KB_OUTPUT) -GPIO(KB_OUT02, B, 12, GPIO_KB_OUTPUT) -GPIO(KB_OUT03, B, 13, GPIO_KB_OUTPUT) -GPIO(KB_OUT04, B, 14, GPIO_KB_OUTPUT) -GPIO(KB_OUT05, B, 15, GPIO_KB_OUTPUT) -GPIO(KB_OUT06, C, 0, GPIO_KB_OUTPUT) -GPIO(KB_OUT07, C, 1, GPIO_KB_OUTPUT) -GPIO(KB_OUT08, C, 2, GPIO_KB_OUTPUT) -GPIO(KB_OUT09, B, 1, GPIO_KB_OUTPUT) -GPIO(KB_OUT10, C, 5, GPIO_KB_OUTPUT) -GPIO(KB_OUT11, C, 4, GPIO_KB_OUTPUT) -GPIO(KB_OUT12, A, 13, GPIO_KB_OUTPUT) +GPIO(AP_RESET_L, PIN(B, 3), GPIO_ODR_HIGH) +GPIO(CHARGER_EN, PIN(B, 2), GPIO_OUT_LOW) +GPIO(EC_INT, PIN(B, 9), GPIO_ODR_HIGH) +GPIO(EN_PP1350, PIN(H, 1), GPIO_OUT_LOW) +GPIO(EN_PP3300, PIN(A, 8), GPIO_OUT_LOW) +GPIO(EN_PP5000, PIN(A, 11), GPIO_OUT_LOW) +GPIO(ENTERING_RW, PIN(H, 0), GPIO_OUT_LOW) +GPIO(I2C1_SCL, PIN(B, 6), GPIO_ODR_HIGH) +GPIO(I2C1_SDA, PIN(B, 7), GPIO_ODR_HIGH) +GPIO(I2C2_SCL, PIN(B, 10), GPIO_ODR_HIGH) +GPIO(I2C2_SDA, PIN(B, 11), GPIO_ODR_HIGH) +GPIO(CHARGING_LED,PIN(A, 2), GPIO_OUT_LOW) +GPIO(PMIC_PWRON, PIN(A, 12), GPIO_OUT_LOW) +GPIO(PMIC_RESET, PIN(A, 15), GPIO_OUT_LOW) +GPIO(KB_OUT00, PIN(B, 0), GPIO_KB_OUTPUT) +GPIO(KB_OUT01, PIN(B, 8), GPIO_KB_OUTPUT) +GPIO(KB_OUT02, PIN(B, 12), GPIO_KB_OUTPUT) +GPIO(KB_OUT03, PIN(B, 13), GPIO_KB_OUTPUT) +GPIO(KB_OUT04, PIN(B, 14), GPIO_KB_OUTPUT) +GPIO(KB_OUT05, PIN(B, 15), GPIO_KB_OUTPUT) +GPIO(KB_OUT06, PIN(C, 0), GPIO_KB_OUTPUT) +GPIO(KB_OUT07, PIN(C, 1), GPIO_KB_OUTPUT) +GPIO(KB_OUT08, PIN(C, 2), GPIO_KB_OUTPUT) +GPIO(KB_OUT09, PIN(B, 1), GPIO_KB_OUTPUT) +GPIO(KB_OUT10, PIN(C, 5), GPIO_KB_OUTPUT) +GPIO(KB_OUT11, PIN(C, 4), GPIO_KB_OUTPUT) +GPIO(KB_OUT12, PIN(A, 13), GPIO_KB_OUTPUT) -ALTERNATE(A, 0x00f0, GPIO_ALT_SPI, MODULE_SPI, 0) -ALTERNATE(A, 0x0600, GPIO_ALT_USART, MODULE_UART, 0) -ALTERNATE(B, 0x0cc0, GPIO_ALT_I2C, MODULE_I2C, 0) +ALTERNATE(PIN_MASK(A, 0x00f0), GPIO_ALT_SPI, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(A, 0x0600), GPIO_ALT_USART, MODULE_UART, 0) +ALTERNATE(PIN_MASK(B, 0x0cc0), GPIO_ALT_I2C, MODULE_I2C, 0) diff --git a/board/plankton/gpio.inc b/board/plankton/gpio.inc index 6ee250ebce..1f97b63fed 100644 --- a/board/plankton/gpio.inc +++ b/board/plankton/gpio.inc @@ -6,71 +6,71 @@ */ /* Inputs with interrupt handlers are first for efficiency */ -GPIO_INT(VBUS_WAKE, B, 5, GPIO_INT_BOTH, vbus_event) -GPIO_INT(DPSRC_HPD, B, 13, GPIO_INT_BOTH, hpd_event) -GPIO_INT(DBG_12V_TO_DUT_L, B, 14, GPIO_INT_FALLING, button_event) -GPIO_INT(DBG_5V_TO_DUT_L, B, 8, GPIO_INT_FALLING, button_event) -GPIO_INT(DBG_CHG_TO_DEV_L, F, 1, GPIO_INT_FALLING, button_event) -GPIO_INT(DBG_USB_TOGGLE_L, F, 0, GPIO_INT_FALLING, button_event) -GPIO_INT(DBG_CASE_CLOSE_EN_L, B, 12, GPIO_INT_FALLING, button_event) -GPIO_INT(DBG_MUX_FLIP_L, B, 15, GPIO_INT_FALLING, button_event) +GPIO_INT(VBUS_WAKE, PIN(B, 5), GPIO_INT_BOTH, vbus_event) +GPIO_INT(DPSRC_HPD, PIN(B, 13), GPIO_INT_BOTH, hpd_event) +GPIO_INT(DBG_12V_TO_DUT_L, PIN(B, 14), GPIO_INT_FALLING, button_event) +GPIO_INT(DBG_5V_TO_DUT_L, PIN(B, 8), GPIO_INT_FALLING, button_event) +GPIO_INT(DBG_CHG_TO_DEV_L, PIN(F, 1), GPIO_INT_FALLING, button_event) +GPIO_INT(DBG_USB_TOGGLE_L, PIN(F, 0), GPIO_INT_FALLING, button_event) +GPIO_INT(DBG_CASE_CLOSE_EN_L, PIN(B, 12), GPIO_INT_FALLING, button_event) +GPIO_INT(DBG_MUX_FLIP_L, PIN(B, 15), GPIO_INT_FALLING, button_event) /* TODO(crosbug.com/p/33761) : This interrupt is double booked w/ HPD */ -GPIO(DBG_20V_TO_DUT_L, C, 13, GPIO_INPUT) +GPIO(DBG_20V_TO_DUT_L, PIN(C, 13), GPIO_INPUT) /* PD RX/TX */ -GPIO(USBC_PD_REF, A, 1, GPIO_ANALOG) -GPIO(USBC_CC1_PD, A, 0, GPIO_ANALOG) -GPIO(USBC_CC1_TX_EN, A, 3, GPIO_OUT_LOW) -GPIO(USBC_CC2_PD, A, 4, GPIO_ANALOG) -GPIO(USBC_CC2_TX_EN, B, 2, GPIO_OUT_LOW) -GPIO(USBC_CC_TX_DATA, A, 6, GPIO_OUT_LOW) +GPIO(USBC_PD_REF, PIN(A, 1), GPIO_ANALOG) +GPIO(USBC_CC1_PD, PIN(A, 0), GPIO_ANALOG) +GPIO(USBC_CC1_TX_EN, PIN(A, 3), GPIO_OUT_LOW) +GPIO(USBC_CC2_PD, PIN(A, 4), GPIO_ANALOG) +GPIO(USBC_CC2_TX_EN, PIN(B, 2), GPIO_OUT_LOW) +GPIO(USBC_CC_TX_DATA, PIN(A, 6), GPIO_OUT_LOW) #if 0 /* Alternate functions */ -GPIO(USBC_TX_CLKOUT, B, 9, GPIO_OUT_LOW) -GPIO(USBC_TX_CLKIN, A, 5, GPIO_OUT_LOW) +GPIO(USBC_TX_CLKOUT, PIN(B, 9), GPIO_OUT_LOW) +GPIO(USBC_TX_CLKIN, PIN(A, 5), GPIO_OUT_LOW) #endif /* USB-C Power and muxes control */ -GPIO(USBC_CHARGE_EN, A, 8, GPIO_OUT_HIGH) -GPIO(USBC_CC1_DEVICE_ODL, A, 9, GPIO_OUT_LOW) -GPIO(USBC_CC1_HOST, A, 2, GPIO_INPUT) -GPIO(USBC_CC2_DEVICE_ODL, B, 7, GPIO_OUT_LOW) -GPIO(USBC_CC2_HOST, B, 6, GPIO_INPUT) -GPIO(USBC_POLARITY, B, 1, GPIO_OUT_HIGH) -GPIO(USBC_SS_USB_MODE, B, 3, GPIO_OUT_LOW) -GPIO(USB_CC1_VCONN_EN_L, A, 11, GPIO_OUT_HIGH) -GPIO(USB_CC2_VCONN_EN_L, A, 12, GPIO_OUT_HIGH) +GPIO(USBC_CHARGE_EN, PIN(A, 8), GPIO_OUT_HIGH) +GPIO(USBC_CC1_DEVICE_ODL, PIN(A, 9), GPIO_OUT_LOW) +GPIO(USBC_CC1_HOST, PIN(A, 2), GPIO_INPUT) +GPIO(USBC_CC2_DEVICE_ODL, PIN(B, 7), GPIO_OUT_LOW) +GPIO(USBC_CC2_HOST, PIN(B, 6), GPIO_INPUT) +GPIO(USBC_POLARITY, PIN(B, 1), GPIO_OUT_HIGH) +GPIO(USBC_SS_USB_MODE, PIN(B, 3), GPIO_OUT_LOW) +GPIO(USB_CC1_VCONN_EN_L, PIN(A, 11), GPIO_OUT_HIGH) +GPIO(USB_CC2_VCONN_EN_L, PIN(A, 12), GPIO_OUT_HIGH) -GPIO(VBUS_CHARGER_EN, B, 0, GPIO_OUT_LOW) +GPIO(VBUS_CHARGER_EN, PIN(B, 0), GPIO_OUT_LOW) /* VSEL_0/1: 0/0 = 5V, 1/0 = 12V, 1/1 = 20V */ -GPIO(USBC_VSEL_1, A, 10, GPIO_OUT_LOW) -GPIO(USBC_VSEL_0, C, 14, GPIO_OUT_LOW) +GPIO(USBC_VSEL_1, PIN(A, 10), GPIO_OUT_LOW) +GPIO(USBC_VSEL_0, PIN(C, 14), GPIO_OUT_LOW) /* Case closed debugging */ -GPIO(CASE_CLOSE_EN, A, 7, GPIO_OUT_LOW) -GPIO(CASE_CLOSE_DFU_L, A, 13, GPIO_OUT_HIGH) -GPIO(DEBUG_TOGGLE, B, 4, GPIO_OUT_LOW) +GPIO(CASE_CLOSE_EN, PIN(A, 7), GPIO_OUT_LOW) +GPIO(CASE_CLOSE_DFU_L, PIN(A, 13), GPIO_OUT_HIGH) +GPIO(DEBUG_TOGGLE, PIN(B, 4), GPIO_OUT_LOW) /* Alternate functions */ #if 0 -GPIO(UART_TX, A, 14, GPIO_OUT_LOW) -GPIO(UART_RX, A, 15, GPIO_OUT_LOW) +GPIO(UART_TX, PIN(A, 14), GPIO_OUT_LOW) +GPIO(UART_RX, PIN(A, 15), GPIO_OUT_LOW) #endif /* * I2C pins should be configured as inputs until I2C module is * initialized. This will avoid driving the lines unintentionally. */ -GPIO(MASTER_I2C_SCL, B, 10, GPIO_INPUT) -GPIO(MASTER_I2C_SDA, B, 11, GPIO_INPUT) +GPIO(MASTER_I2C_SCL, PIN(B, 10), GPIO_INPUT) +GPIO(MASTER_I2C_SDA, PIN(B, 11), GPIO_INPUT) /* Unimplemented signals which we need to emulate for now */ UNIMPLEMENTED(ENTERING_RW) UNIMPLEMENTED(WP_L) -ALTERNATE(A, 0x0020, 0, MODULE_USB_PD, 0) /* SPI1: SCK(PA5) */ -ALTERNATE(B, 0x0200, 2, MODULE_USB_PD, 0) /* TIM17_CH1: (PB9) */ -ALTERNATE(A, 0xC000, 1, MODULE_UART, 0) /* USART2: PA14/PA15 */ -ALTERNATE(B, 0x0C00, 1, MODULE_I2C, 0) /* I2C MASTER:PB10/11 */ +ALTERNATE(PIN_MASK(A, 0x0020), 0, MODULE_USB_PD, 0) /* SPI1: SCK(PA5) */ +ALTERNATE(PIN_MASK(B, 0x0200), 2, MODULE_USB_PD, 0) /* TIM17_CH1: (PB9) */ +ALTERNATE(PIN_MASK(A, 0xC000), 1, MODULE_UART, 0) /* USART2: PA14/PA15 */ +ALTERNATE(PIN_MASK(B, 0x0C00), 1, MODULE_I2C, 0) /* I2C MASTER:PB10/11 */ diff --git a/board/rambi/gpio.inc b/board/rambi/gpio.inc index c4f52acbd1..a4fdf129b6 100644 --- a/board/rambi/gpio.inc +++ b/board/rambi/gpio.inc @@ -6,72 +6,72 @@ */ /* Inputs with interrupt handlers are first for efficiency */ -GPIO_INT(POWER_BUTTON_L, A, 2, GPIO_INT_BOTH_DSLEEP, power_button_interrupt) -GPIO_INT(LID_OPEN, A, 3, GPIO_INT_BOTH_DSLEEP, lid_interrupt) -GPIO_INT(AC_PRESENT, H, 3, GPIO_INT_BOTH_DSLEEP, extpower_interrupt) -GPIO_INT(PCH_SLP_S3_L, G, 7, GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, power_signal_interrupt) /* SLP_S3# signal from PCH */ -GPIO_INT(PCH_SLP_S4_L, H, 1, GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, power_signal_interrupt) /* SLP_S4# signal from PCH */ -GPIO_INT(PP1050_PGOOD, H, 4, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 1.05V */ -GPIO_INT(PP3300_PCH_PGOOD, C, 4, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 3.3V (PCH supply) */ -GPIO_INT(PP5000_PGOOD, N, 0, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 5V */ -GPIO_INT(S5_PGOOD, G, 0, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on S5 supplies */ -GPIO_INT(VCORE_PGOOD, C, 6, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on core VR */ -GPIO_INT(WP_L, A, 4, GPIO_INT_BOTH, switch_interrupt) /* Write protect input */ -GPIO_INT(JTAG_TCK, C, 0, GPIO_DEFAULT, jtag_interrupt) /* JTAG clock input */ -GPIO_INT(UART0_RX, A, 0, GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, uart_deepsleep_interrupt) /* UART0 RX input */ +GPIO_INT(POWER_BUTTON_L, PIN(A, 2), GPIO_INT_BOTH_DSLEEP, power_button_interrupt) +GPIO_INT(LID_OPEN, PIN(A, 3), GPIO_INT_BOTH_DSLEEP, lid_interrupt) +GPIO_INT(AC_PRESENT, PIN(H, 3), GPIO_INT_BOTH_DSLEEP, extpower_interrupt) +GPIO_INT(PCH_SLP_S3_L, PIN(G, 7), GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, power_signal_interrupt) /* SLP_S3# signal from PCH */ +GPIO_INT(PCH_SLP_S4_L, PIN(H, 1), GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, power_signal_interrupt) /* SLP_S4# signal from PCH */ +GPIO_INT(PP1050_PGOOD, PIN(H, 4), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 1.05V */ +GPIO_INT(PP3300_PCH_PGOOD, PIN(C, 4), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 3.3V (PCH supply) */ +GPIO_INT(PP5000_PGOOD, PIN(N, 0), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 5V */ +GPIO_INT(S5_PGOOD, PIN(G, 0), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on S5 supplies */ +GPIO_INT(VCORE_PGOOD, PIN(C, 6), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on core VR */ +GPIO_INT(WP_L, PIN(A, 4), GPIO_INT_BOTH, switch_interrupt) /* Write protect input */ +GPIO_INT(JTAG_TCK, PIN(C, 0), GPIO_DEFAULT, jtag_interrupt) /* JTAG clock input */ +GPIO_INT(UART0_RX, PIN(A, 0), GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, uart_deepsleep_interrupt) /* UART0 RX input */ /* Other inputs */ -GPIO(BOARD_VERSION1, Q, 5, GPIO_INPUT) -GPIO(BOARD_VERSION2, Q, 6, GPIO_INPUT) -GPIO(BOARD_VERSION3, Q, 7, GPIO_INPUT) +GPIO(BOARD_VERSION1, PIN(Q, 5), GPIO_INPUT) +GPIO(BOARD_VERSION2, PIN(Q, 6), GPIO_INPUT) +GPIO(BOARD_VERSION3, PIN(Q, 7), GPIO_INPUT) #ifdef CONFIG_CHIPSET_DEBUG -GPIO(PCH_SLP_SX_L, G, 3, GPIO_INPUT | GPIO_PULL_UP) /* SLP_S0IX# signal from PCH */ -GPIO(PCH_SUS_STAT_L, G, 6, GPIO_INPUT | GPIO_PULL_UP) /* SUS_STAT# signal from PCH */ -GPIO(PCH_SUSPWRDNACK, G, 2, GPIO_INPUT | GPIO_PULL_UP) /* SUSPWRDNACK signal from PCH */ +GPIO(PCH_SLP_SX_L, PIN(G, 3), GPIO_INPUT | GPIO_PULL_UP) /* SLP_S0IX# signal from PCH */ +GPIO(PCH_SUS_STAT_L, PIN(G, 6), GPIO_INPUT | GPIO_PULL_UP) /* SUS_STAT# signal from PCH */ +GPIO(PCH_SUSPWRDNACK, PIN(G, 2), GPIO_INPUT | GPIO_PULL_UP) /* SUSPWRDNACK signal from PCH */ #endif -GPIO(PP1000_S0IX_PGOOD, H, 6, GPIO_INPUT) /* Power good on 1.00V (S0iX supplies) */ -GPIO(USB1_OC_L, E, 7, GPIO_INPUT) /* USB port overcurrent warning */ -GPIO(USB2_OC_L, E, 0, GPIO_INPUT) /* USB port overcurrent warning */ +GPIO(PP1000_S0IX_PGOOD, PIN(H, 6), GPIO_INPUT) /* Power good on 1.00V (S0iX supplies) */ +GPIO(USB1_OC_L, PIN(E, 7), GPIO_INPUT) /* USB port overcurrent warning */ +GPIO(USB2_OC_L, PIN(E, 0), GPIO_INPUT) /* USB port overcurrent warning */ /* Outputs; all unasserted by default except for reset signals */ -GPIO(CPU_PROCHOT, B, 5, GPIO_OUT_LOW) /* Force CPU to think it's overheated */ -GPIO(ENABLE_BACKLIGHT, M, 7, GPIO_ODR_HIGH) /* Enable backlight power */ -GPIO(ENABLE_TOUCHPAD, N, 1, GPIO_OUT_LOW) /* Enable touchpad power */ -GPIO(ENTERING_RW, D, 6, GPIO_OUT_LOW) /* Indicate when EC is entering RW code */ -GPIO(LPC_CLKRUN_L, M, 2, GPIO_ODR_HIGH) /* Request that PCH drive LPC clock */ -GPIO(PCH_CORE_PWROK, F, 5, GPIO_OUT_LOW) /* Indicate core well power is stable */ -GPIO(PCH_PWRBTN_L, H, 0, GPIO_ODR_HIGH) /* Power button output to PCH */ -GPIO(PCH_RCIN_L, F, 3, GPIO_ODR_HIGH) /* Reset line to PCH (for 8042 emulation) */ -GPIO(PCH_RSMRST_L, F, 1, GPIO_OUT_LOW) /* Reset PCH resume power plane logic */ -GPIO(PCH_SMI_L, F, 4, GPIO_ODR_HIGH) /* System management interrupt to PCH */ -GPIO(PCH_SOC_OVERRIDE, G, 1, GPIO_OUT_LOW) /* SOC override signal to PCH; when high, ME ignores security descriptor */ -GPIO(PCH_SYS_PWROK, J, 1, GPIO_OUT_LOW) /* EC thinks everything is up and ready */ -GPIO(PCH_WAKE_L, F, 0, GPIO_ODR_HIGH) /* Wake signal from EC to PCH */ -GPIO(PP1350_EN, H, 5, GPIO_OUT_LOW) /* Enable 1.35V supply */ -GPIO(PP3300_DX_EN, J, 2, GPIO_OUT_LOW) /* Enable power to lots of peripherals */ -GPIO(PP3300_LTE_EN, D, 4, GPIO_OUT_LOW) /* Enable LTE radio */ -GPIO(PP3300_WLAN_EN, J, 0, GPIO_OUT_LOW) /* Enable WiFi power */ -GPIO(PP5000_EN, H, 7, GPIO_OUT_LOW) /* Enable 5V supply */ -GPIO(PPSX_EN, L, 6, GPIO_OUT_LOW) /* Enable PP1350_PCH_SX, PP1000_PCH_SX */ -GPIO(SUSP_VR_EN, C, 7, GPIO_OUT_LOW) /* Enable 1.05V regulator */ -GPIO(TOUCHSCREEN_RESET_L, N, 7, GPIO_OUT_LOW) /* Reset touch screen */ -GPIO(USB_CTL1, E, 6, GPIO_OUT_LOW) /* USB control signal 1 to both ports */ -GPIO(USB_ILIM_SEL, E, 5, GPIO_OUT_LOW) /* USB current limit to both ports */ -GPIO(USB1_ENABLE, E, 4, GPIO_OUT_LOW) /* USB port 1 output power enable */ -GPIO(USB2_ENABLE, D, 5, GPIO_OUT_LOW) /* USB port 2 output power enable */ -GPIO(VCORE_EN, C, 5, GPIO_OUT_LOW) /* Enable core power supplies */ -GPIO(WLAN_OFF_L, J, 4, GPIO_OUT_LOW) /* Disable WiFi radio */ -GPIO(PCH_SCI_L, M, 1, GPIO_ODR_HIGH) /* Assert SCI to PCH */ -GPIO(KBD_IRQ_L, M, 3, GPIO_ODR_HIGH) /* Negative edge triggered irq. */ +GPIO(CPU_PROCHOT, PIN(B, 5), GPIO_OUT_LOW) /* Force CPU to think it's overheated */ +GPIO(ENABLE_BACKLIGHT, PIN(M, 7), GPIO_ODR_HIGH) /* Enable backlight power */ +GPIO(ENABLE_TOUCHPAD, PIN(N, 1), GPIO_OUT_LOW) /* Enable touchpad power */ +GPIO(ENTERING_RW, PIN(D, 6), GPIO_OUT_LOW) /* Indicate when EC is entering RW code */ +GPIO(LPC_CLKRUN_L, PIN(M, 2), GPIO_ODR_HIGH) /* Request that PCH drive LPC clock */ +GPIO(PCH_CORE_PWROK, PIN(F, 5), GPIO_OUT_LOW) /* Indicate core well power is stable */ +GPIO(PCH_PWRBTN_L, PIN(H, 0), GPIO_ODR_HIGH) /* Power button output to PCH */ +GPIO(PCH_RCIN_L, PIN(F, 3), GPIO_ODR_HIGH) /* Reset line to PCH (for 8042 emulation) */ +GPIO(PCH_RSMRST_L, PIN(F, 1), GPIO_OUT_LOW) /* Reset PCH resume power plane logic */ +GPIO(PCH_SMI_L, PIN(F, 4), GPIO_ODR_HIGH) /* System management interrupt to PCH */ +GPIO(PCH_SOC_OVERRIDE, PIN(G, 1), GPIO_OUT_LOW) /* SOC override signal to PCH; when high, ME ignores security descriptor */ +GPIO(PCH_SYS_PWROK, PIN(J, 1), GPIO_OUT_LOW) /* EC thinks everything is up and ready */ +GPIO(PCH_WAKE_L, PIN(F, 0), GPIO_ODR_HIGH) /* Wake signal from EC to PCH */ +GPIO(PP1350_EN, PIN(H, 5), GPIO_OUT_LOW) /* Enable 1.35V supply */ +GPIO(PP3300_DX_EN, PIN(J, 2), GPIO_OUT_LOW) /* Enable power to lots of peripherals */ +GPIO(PP3300_LTE_EN, PIN(D, 4), GPIO_OUT_LOW) /* Enable LTE radio */ +GPIO(PP3300_WLAN_EN, PIN(J, 0), GPIO_OUT_LOW) /* Enable WiFi power */ +GPIO(PP5000_EN, PIN(H, 7), GPIO_OUT_LOW) /* Enable 5V supply */ +GPIO(PPSX_EN, PIN(L, 6), GPIO_OUT_LOW) /* Enable PP1350_PCH_SX, PP1000_PCH_SX */ +GPIO(SUSP_VR_EN, PIN(C, 7), GPIO_OUT_LOW) /* Enable 1.05V regulator */ +GPIO(TOUCHSCREEN_RESET_L, PIN(N, 7), GPIO_OUT_LOW) /* Reset touch screen */ +GPIO(USB_CTL1, PIN(E, 6), GPIO_OUT_LOW) /* USB control signal 1 to both ports */ +GPIO(USB_ILIM_SEL, PIN(E, 5), GPIO_OUT_LOW) /* USB current limit to both ports */ +GPIO(USB1_ENABLE, PIN(E, 4), GPIO_OUT_LOW) /* USB port 1 output power enable */ +GPIO(USB2_ENABLE, PIN(D, 5), GPIO_OUT_LOW) /* USB port 2 output power enable */ +GPIO(VCORE_EN, PIN(C, 5), GPIO_OUT_LOW) /* Enable core power supplies */ +GPIO(WLAN_OFF_L, PIN(J, 4), GPIO_OUT_LOW) /* Disable WiFi radio */ +GPIO(PCH_SCI_L, PIN(M, 1), GPIO_ODR_HIGH) /* Assert SCI to PCH */ +GPIO(KBD_IRQ_L, PIN(M, 3), GPIO_ODR_HIGH) /* Negative edge triggered irq. */ -ALTERNATE(A, 0x03, 1, MODULE_UART, 0) /* UART0 */ -ALTERNATE(B, 0x04, 3, MODULE_I2C, 0) /* I2C0 SCL */ -ALTERNATE(B, 0x08, 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C0 SDA */ -ALTERNATE(B, 0x40, 3, MODULE_I2C, 0) /* I2C5 SCL */ -ALTERNATE(B, 0x80, 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C5 SDA */ -ALTERNATE(D, 0x0f, 2, MODULE_SPI, 0) /* SPI1 */ -ALTERNATE(L, 0x3f, 15, MODULE_LPC, 0) /* LPC */ -ALTERNATE(M, 0x21, 15, MODULE_LPC, 0) /* LPC */ -ALTERNATE(N, 0x50, 1, MODULE_PWM_LED, GPIO_OPEN_DRAIN) /* FAN0PWM 3&4 */ +ALTERNATE(PIN_MASK(A, 0x03), 1, MODULE_UART, 0) /* UART0 */ +ALTERNATE(PIN_MASK(B, 0x04), 3, MODULE_I2C, 0) /* I2C0 SCL */ +ALTERNATE(PIN_MASK(B, 0x08), 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C0 SDA */ +ALTERNATE(PIN_MASK(B, 0x40), 3, MODULE_I2C, 0) /* I2C5 SCL */ +ALTERNATE(PIN_MASK(B, 0x80), 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C5 SDA */ +ALTERNATE(PIN_MASK(D, 0x0f), 2, MODULE_SPI, 0) /* SPI1 */ +ALTERNATE(PIN_MASK(L, 0x3f), 15, MODULE_LPC, 0) /* LPC */ +ALTERNATE(PIN_MASK(M, 0x21), 15, MODULE_LPC, 0) /* LPC */ +ALTERNATE(PIN_MASK(N, 0x50), 1, MODULE_PWM_LED, GPIO_OPEN_DRAIN) /* FAN0PWM 3&4 */ diff --git a/board/ryu/gpio.inc b/board/ryu/gpio.inc index e65e7a0186..145543800d 100644 --- a/board/ryu/gpio.inc +++ b/board/ryu/gpio.inc @@ -6,136 +6,135 @@ */ /* Interrupts */ -GPIO_INT(CHGR_ACOK, D, 4, GPIO_INT_BOTH, vbus_evt) -GPIO_INT(POWER_BUTTON_L, C, 13, GPIO_INT_BOTH, power_button_interrupt) /* active high, the name is for compatibility with existing code */ -GPIO_INT(USBC_BC12_INT_L, D, 11, GPIO_INT_FALLING | GPIO_PULL_UP, usb_evt) -GPIO_INT(LID_OPEN, E, 1, GPIO_INT_BOTH | GPIO_PULL_UP, lid_interrupt) -GPIO_INT(CHARGE_DONE, E, 6, GPIO_INT_BOTH, inductive_charging_interrupt) -GPIO_INT(AP_IN_SUSPEND, F, 9, GPIO_INT_BOTH, power_signal_interrupt) -GPIO_INT(AP_HOLD, E, 3, GPIO_INT_BOTH, power_signal_interrupt) +GPIO_INT(CHGR_ACOK, PIN(D, 4), GPIO_INT_BOTH, vbus_evt) +GPIO_INT(POWER_BUTTON_L, PIN(C, 13), GPIO_INT_BOTH, power_button_interrupt) /* active high, the name is for compatibility with existing code */ +GPIO_INT(USBC_BC12_INT_L, PIN(D, 11), GPIO_INT_FALLING | GPIO_PULL_UP, usb_evt) +GPIO_INT(LID_OPEN, PIN(E, 1), GPIO_INT_BOTH | GPIO_PULL_UP, lid_interrupt) +GPIO_INT(CHARGE_DONE, PIN(E, 6), GPIO_INT_BOTH, inductive_charging_interrupt) +GPIO_INT(AP_IN_SUSPEND, PIN(F, 9), GPIO_INT_BOTH, power_signal_interrupt) +GPIO_INT(AP_HOLD, PIN(E, 3), GPIO_INT_BOTH, power_signal_interrupt) /* Interrupt lines not used yet */ -GPIO(BC_TEMP_ALERT_L, C, 5, GPIO_INT_FALLING) -GPIO(LB_INT_L, C, 14, GPIO_INT_FALLING | GPIO_PULL_UP) -GPIO(LIGHTBAR_EN_L, E, 8, GPIO_INT_FALLING | GPIO_PULL_UP) -GPIO(BASE_PRES_L, E, 10, GPIO_INT_BOTH | GPIO_PULL_UP) -GPIO(CHGR_INT_L, B, 2, GPIO_INT_FALLING) -GPIO(CAM_SYNC_INT_L, C, 7, GPIO_INT_FALLING) -GPIO(ACC_IRQ, D, 12, GPIO_INPUT) -GPIO(COMPASS_DRDY, A, 8, GPIO_INPUT) +GPIO(BC_TEMP_ALERT_L, PIN(C, 5), GPIO_INT_FALLING) +GPIO(LB_INT_L, PIN(C, 14), GPIO_INT_FALLING | GPIO_PULL_UP) +GPIO(LIGHTBAR_EN_L, PIN(E, 8), GPIO_INT_FALLING | GPIO_PULL_UP) +GPIO(BASE_PRES_L, PIN(E, 10), GPIO_INT_BOTH | GPIO_PULL_UP) +GPIO(CHGR_INT_L, PIN(B, 2), GPIO_INT_FALLING) +GPIO(CAM_SYNC_INT_L, PIN(C, 7), GPIO_INT_FALLING) +GPIO(ACC_IRQ, PIN(D, 12), GPIO_INPUT) +GPIO(COMPASS_DRDY, PIN(A, 8), GPIO_INPUT) /* Buttons */ -GPIO(BTN_VOLD_L, C, 0, GPIO_INPUT | GPIO_PULL_UP) -GPIO(BTN_VOLU_L, A, 2, GPIO_INPUT | GPIO_PULL_UP) +GPIO(BTN_VOLD_L, PIN(C, 0), GPIO_INPUT | GPIO_PULL_UP) +GPIO(BTN_VOLU_L, PIN(A, 2), GPIO_INPUT | GPIO_PULL_UP) /* PD RX/TX */ -GPIO(USBC_CC1_PD, A, 1, GPIO_ANALOG) -GPIO(USBC_CC2_PD, A, 3, GPIO_ANALOG) -GPIO(USBC_CC_EN, A, 4, GPIO_OUT_LOW) -GPIO(USBC_CC_TX_DATA, A, 6, GPIO_OUT_LOW) -GPIO(USBC_CC_TX_EN, D, 7, GPIO_OUT_LOW) +GPIO(USBC_CC1_PD, PIN(A, 1), GPIO_ANALOG) +GPIO(USBC_CC2_PD, PIN(A, 3), GPIO_ANALOG) +GPIO(USBC_CC_EN, PIN(A, 4), GPIO_OUT_LOW) +GPIO(USBC_CC_TX_DATA, PIN(A, 6), GPIO_OUT_LOW) +GPIO(USBC_CC_TX_EN, PIN(D, 7), GPIO_OUT_LOW) #if 0 /* Alternate functions */ -GPIO(USBC_TX_CLKOUT, B, 1, GPIO_OUT_LOW) -GPIO(USBC_TX_CLKIN, B, 3, GPIO_OUT_LOW) +GPIO(USBC_TX_CLKOUT, PIN(B, 1), GPIO_OUT_LOW) +GPIO(USBC_TX_CLKIN, PIN(B, 3), GPIO_OUT_LOW) #endif /* System power */ -GPIO(PMIC_PWRON_L, D, 14, GPIO_ODR_HIGH) -GPIO(PMIC_WARM_RESET_L, E, 4, GPIO_ODR_HIGH) +GPIO(PMIC_PWRON_L, PIN(D, 14), GPIO_ODR_HIGH) +GPIO(PMIC_WARM_RESET_L, PIN(E, 4), GPIO_ODR_HIGH) /* * We are missing an external pull-up for EN_PP3300. * This GPIO is used to pull it up through an external 100kOhm. * EN_PP3300 is still controlled by PMIC though. */ -GPIO(EN_PP3300_RSVD, E, 13, GPIO_OUT_LOW) +GPIO(EN_PP3300_RSVD, PIN(E, 13), GPIO_OUT_LOW) /* sensor temp output and PMIC reset input */ -GPIO(PMIC_THERM_L, B, 8, GPIO_ODR_HIGH) - -GPIO(VBUS_SENSE, A, 0, GPIO_ANALOG) -GPIO(CHGR_PSEL, B, 0, GPIO_OUT_LOW) -GPIO(CHGR_OTG, C, 3, GPIO_OUT_LOW) +GPIO(PMIC_THERM_L, PIN(B, 8), GPIO_ODR_HIGH) +GPIO(VBUS_SENSE, PIN(A, 0), GPIO_ANALOG) +GPIO(CHGR_PSEL, PIN(B, 0), GPIO_OUT_LOW) +GPIO(CHGR_OTG, PIN(C, 3), GPIO_OUT_LOW) /* Inductive charging */ -GPIO(CHARGE_EN, D, 13, GPIO_OUT_LOW) -GPIO(BASE_CHG_VDD_EN, E, 5, GPIO_OUT_LOW) +GPIO(CHARGE_EN, PIN(D, 13), GPIO_OUT_LOW) +GPIO(BASE_CHG_VDD_EN, PIN(E, 5), GPIO_OUT_LOW) /* USB-C Power and muxes control */ -GPIO(USBC_CHARGE_EN_L, A, 7, GPIO_OUT_LOW) -GPIO(USBC_VCONN1_EN_L, F, 10, GPIO_OUT_HIGH) -GPIO(USBC_VCONN2_EN_L, D, 10, GPIO_OUT_HIGH) +GPIO(USBC_CHARGE_EN_L, PIN(A, 7), GPIO_OUT_LOW) +GPIO(USBC_VCONN1_EN_L, PIN(F, 10), GPIO_OUT_HIGH) +GPIO(USBC_VCONN2_EN_L, PIN(D, 10), GPIO_OUT_HIGH) -GPIO(USBC_CC1_DEVICE_ODL, A, 5, GPIO_ODR_LOW) -GPIO(USBC_CC2_DEVICE_ODL, E, 14, GPIO_ODR_LOW) -GPIO(USBC_CC_PUEN1, D, 0, GPIO_INPUT) -GPIO(USBC_CC_PUEN2, C, 8, GPIO_INPUT) +GPIO(USBC_CC1_DEVICE_ODL, PIN(A, 5), GPIO_ODR_LOW) +GPIO(USBC_CC2_DEVICE_ODL, PIN(E, 14), GPIO_ODR_LOW) +GPIO(USBC_CC_PUEN1, PIN(D, 0), GPIO_INPUT) +GPIO(USBC_CC_PUEN2, PIN(C, 8), GPIO_INPUT) /* Pericom PI3USB30592 mux controls on Proto 5+ */ -GPIO(USBC_MUX_CONF0, D, 3, GPIO_OUT_LOW) -GPIO(USBC_MUX_CONF1, D, 9, GPIO_OUT_LOW) -GPIO(USBC_MUX_CONF2, E, 0, GPIO_OUT_LOW) +GPIO(USBC_MUX_CONF0, PIN(D, 3), GPIO_OUT_LOW) +GPIO(USBC_MUX_CONF1, PIN(D, 9), GPIO_OUT_LOW) +GPIO(USBC_MUX_CONF2, PIN(E, 0), GPIO_OUT_LOW) -GPIO(USBC_DP_HPD, C, 1, GPIO_ODR_LOW) +GPIO(USBC_DP_HPD, PIN(C, 1), GPIO_ODR_LOW) /* Inputs */ -GPIO(BOARD_ID0, E, 11, GPIO_INPUT) -GPIO(BOARD_ID1, E, 12, GPIO_INPUT) -GPIO(SH_SIGNAL, E, 2, GPIO_INPUT) +GPIO(BOARD_ID0, PIN(E, 11), GPIO_INPUT) +GPIO(BOARD_ID1, PIN(E, 12), GPIO_INPUT) +GPIO(SH_SIGNAL, PIN(E, 2), GPIO_INPUT) /* Lightbar reset */ -GPIO(LB_RST_L, D, 15, GPIO_ODR_HIGH | GPIO_PULL_UP) +GPIO(LB_RST_L, PIN(D, 15), GPIO_ODR_HIGH | GPIO_PULL_UP) #if 0 /* Alternate functions */ -GPIO(USB_DM, A, 11, GPIO_ANALOG) -GPIO(USB_DP, A, 12, GPIO_ANALOG) -GPIO(UART_TX, D, 5, GPIO_OUT_LOW) -GPIO(UART_RX, D, 6, GPIO_OUT_LOW) +GPIO(USB_DM, PIN(A, 11), GPIO_ANALOG) +GPIO(USB_DP, PIN(A, 12), GPIO_ANALOG) +GPIO(UART_TX, PIN(D, 5), GPIO_OUT_LOW) +GPIO(UART_RX, PIN(D, 6), GPIO_OUT_LOW) #endif /* * I2C pins should be configured as inputs until I2C module is * initialized. This will avoid driving the lines unintentionally. */ -GPIO(MASTER_I2C_SCL, A, 15, GPIO_INPUT) -GPIO(MASTER_I2C_SDA, A, 14, GPIO_INPUT) -GPIO(SLAVE_I2C_SCL, A, 9, GPIO_INPUT) -GPIO(SLAVE_I2C_SDA, A, 10, GPIO_INPUT) +GPIO(MASTER_I2C_SCL, PIN(A, 15), GPIO_INPUT) +GPIO(MASTER_I2C_SDA, PIN(A, 14), GPIO_INPUT) +GPIO(SLAVE_I2C_SCL, PIN(A, 9), GPIO_INPUT) +GPIO(SLAVE_I2C_SDA, PIN(A, 10), GPIO_INPUT) /* SCL gating for PI3USB9281 */ -GPIO(PERICOM_CLK_EN, C, 15, GPIO_OUT_HIGH) +GPIO(PERICOM_CLK_EN, PIN(C, 15), GPIO_OUT_HIGH) /* Case closed debugging. */ -GPIO(USB_PU_EN_L, C, 2, GPIO_OUT_HIGH) -GPIO(PD_DISABLE_DEBUG, C, 6, GPIO_OUT_LOW) -GPIO(SPI_FLASH_NSS, B, 9, GPIO_INPUT) -GPIO(VDDSPI_EN, C, 12, GPIO_OUT_LOW) -GPIO(SH_RESET, C, 4, GPIO_ODR_HIGH) -GPIO(SH_BOOT, C, 9, GPIO_ODR_HIGH) -GPIO(EC_INT_L, F, 2, GPIO_ODR_HIGH) -GPIO(ENTERING_RW, E, 9, GPIO_OUT_LOW) -GPIO(WP_L, F, 6, GPIO_INPUT) -GPIO(FW_DEBUG_MODE_L, D, 1, GPIO_ODR_HIGH) -GPIO(EC_BOOT_SPI_EN, F, 4, GPIO_ODR_HIGH) +GPIO(USB_PU_EN_L, PIN(C, 2), GPIO_OUT_HIGH) +GPIO(PD_DISABLE_DEBUG, PIN(C, 6), GPIO_OUT_LOW) +GPIO(SPI_FLASH_NSS, PIN(B, 9), GPIO_INPUT) +GPIO(VDDSPI_EN, PIN(C, 12), GPIO_OUT_LOW) +GPIO(SH_RESET, PIN(C, 4), GPIO_ODR_HIGH) +GPIO(SH_BOOT, PIN(C, 9), GPIO_ODR_HIGH) +GPIO(EC_INT_L, PIN(F, 2), GPIO_ODR_HIGH) +GPIO(ENTERING_RW, PIN(E, 9), GPIO_OUT_LOW) +GPIO(WP_L, PIN(F, 6), GPIO_INPUT) +GPIO(FW_DEBUG_MODE_L, PIN(D, 1), GPIO_ODR_HIGH) +GPIO(EC_BOOT_SPI_EN, PIN(F, 4), GPIO_ODR_HIGH) #if 0 /* Alternate functions */ -GPIO(SH_UART_TX, C, 11, GPIO_OUT_LOW) -GPIO(SH_UART_RX, C, 10, GPIO_INPUT) -GPIO(AP_UART_TX, B, 6, GPIO_OUT_LOW) -GPIO(AP_UART_RX, B, 7, GPIO_INPUT) +GPIO(SH_UART_TX, PIN(C, 11), GPIO_OUT_LOW) +GPIO(SH_UART_RX, PIN(C, 10), GPIO_INPUT) +GPIO(AP_UART_TX, PIN(B, 6), GPIO_OUT_LOW) +GPIO(AP_UART_RX, PIN(B, 7), GPIO_INPUT) #endif UNIMPLEMENTED(AP_RESET_L) #define GPIO_ODR_UP GPIO_OPEN_DRAIN | GPIO_PULL_UP -ALTERNATE(B, 0xC400, 5, MODULE_SPI_MASTER, 0) /* SPI2: PB10/14/15 */ -ALTERNATE(B, 0x0008, 5, MODULE_USB_PD, 0) /* SPI1: SCK(PB3) */ -ALTERNATE(B, 0x0002, 2, MODULE_USB_PD, 0) /* TIM3_CH4: PB1 */ -ALTERNATE(B, 0x00C0, 7, MODULE_USART, 0) /* USART1: PB6/PB7 */ -ALTERNATE(D, 0x0060, 7, MODULE_UART, GPIO_PULL_UP) /* USART2: PD4/PD5 */ -ALTERNATE(C, 0x0C00, 7, MODULE_USART, GPIO_ODR_UP) /* USART3: PC10/PC11 */ -ALTERNATE(A, 0xC600, 4, MODULE_I2C, 0) /* I2C SLAVE:PA9/10 MASTER:PA14/15 */ -ALTERNATE(A, 0x1800,14, MODULE_USB, 0) /* USB: PA11/12 */ +ALTERNATE(PIN_MASK(B, 0xC400), 5, MODULE_SPI_MASTER, 0) /* SPI2: PB10/14/15 */ +ALTERNATE(PIN_MASK(B, 0x0008), 5, MODULE_USB_PD, 0) /* SPI1: SCK(PB3) */ +ALTERNATE(PIN_MASK(B, 0x0002), 2, MODULE_USB_PD, 0) /* TIM3_CH4: PB1 */ +ALTERNATE(PIN_MASK(B, 0x00C0), 7, MODULE_USART, 0) /* USART1: PB6/PB7 */ +ALTERNATE(PIN_MASK(D, 0x0060), 7, MODULE_UART, GPIO_PULL_UP) /* USART2: PD4/PD5 */ +ALTERNATE(PIN_MASK(C, 0x0C00), 7, MODULE_USART, GPIO_ODR_UP) /* USART3: PC10/PC11 */ +ALTERNATE(PIN_MASK(A, 0xC600), 4, MODULE_I2C, 0) /* I2C SLAVE:PA9/10 MASTER:PA14/15 */ +ALTERNATE(PIN_MASK(A, 0x1800),14, MODULE_USB, 0) /* USB: PA11/12 */ diff --git a/board/ryu_p4p5/gpio.inc b/board/ryu_p4p5/gpio.inc index 890c64390d..ecd6451489 100644 --- a/board/ryu_p4p5/gpio.inc +++ b/board/ryu_p4p5/gpio.inc @@ -6,139 +6,139 @@ */ /* Interrupts */ -GPIO_INT(CHGR_ACOK, D, 4, GPIO_INT_BOTH | GPIO_PULL_UP, vbus_evt) -GPIO_INT(POWER_BUTTON_L, C, 13, GPIO_INT_BOTH, power_button_interrupt) /* active high, the name is for compatibility with existing code */ -GPIO_INT(USBC_BC12_INT_L, D, 11, GPIO_INT_FALLING | GPIO_PULL_UP, usb_evt) -GPIO_INT(LID_OPEN, E, 1, GPIO_INT_BOTH | GPIO_PULL_UP, lid_interrupt) -GPIO_INT(CHARGE_DONE, E, 6, GPIO_INT_BOTH, inductive_charging_interrupt) -GPIO_INT(AP_IN_SUSPEND, F, 9, GPIO_INT_BOTH, power_signal_interrupt) -GPIO_INT(AP_HOLD, E, 3, GPIO_INT_BOTH, power_signal_interrupt) +GPIO_INT(CHGR_ACOK, PIN(D, 4), GPIO_INT_BOTH | GPIO_PULL_UP, vbus_evt) +GPIO_INT(POWER_BUTTON_L, PIN(C, 13), GPIO_INT_BOTH, power_button_interrupt) /* active high, the name is for compatibility with existing code */ +GPIO_INT(USBC_BC12_INT_L, PIN(D, 11), GPIO_INT_FALLING | GPIO_PULL_UP, usb_evt) +GPIO_INT(LID_OPEN, PIN(E, 1), GPIO_INT_BOTH | GPIO_PULL_UP, lid_interrupt) +GPIO_INT(CHARGE_DONE, PIN(E, 6), GPIO_INT_BOTH, inductive_charging_interrupt) +GPIO_INT(AP_IN_SUSPEND, PIN(F, 9), GPIO_INT_BOTH, power_signal_interrupt) +GPIO_INT(AP_HOLD, PIN(E, 3), GPIO_INT_BOTH, power_signal_interrupt) /* * TODO(crosbug.com/p/38689) Workaround for MAX77620 PMIC PP3300 issue * Put back as GPIO_ODR_HIGH for P6+ */ -GPIO_INT(HPD_IN, C, 1, GPIO_INT_BOTH, pp1800_on_off_evt) +GPIO_INT(HPD_IN, PIN(C, 1), GPIO_INT_BOTH, pp1800_on_off_evt) /* Interrupt lines not used yet */ -GPIO(BC_TEMP_ALERT_L, C, 5, GPIO_INT_FALLING) -GPIO(LB_INT_L, E, 7, GPIO_INT_FALLING | GPIO_PULL_UP) -GPIO(LIGHTBAR_EN_L, E, 8, GPIO_INT_FALLING | GPIO_PULL_UP) -GPIO(BASE_PRES_L, E, 10, GPIO_INT_BOTH | GPIO_PULL_UP) +GPIO(BC_TEMP_ALERT_L, PIN(C, 5), GPIO_INT_FALLING) +GPIO(LB_INT_L, PIN(E, 7), GPIO_INT_FALLING | GPIO_PULL_UP) +GPIO(LIGHTBAR_EN_L, PIN(E, 8), GPIO_INT_FALLING | GPIO_PULL_UP) +GPIO(BASE_PRES_L, PIN(E, 10), GPIO_INT_BOTH | GPIO_PULL_UP) /* Buttons */ -GPIO(BTN_VOLD_L, C, 0, GPIO_INPUT | GPIO_PULL_UP) -GPIO(BTN_VOLU_L, A, 2, GPIO_INPUT | GPIO_PULL_UP) +GPIO(BTN_VOLD_L, PIN(C, 0), GPIO_INPUT | GPIO_PULL_UP) +GPIO(BTN_VOLU_L, PIN(A, 2), GPIO_INPUT | GPIO_PULL_UP) /* PD RX/TX */ -GPIO(USBC_CC1_PD, A, 1, GPIO_ANALOG) -GPIO(USBC_CC2_PD, A, 3, GPIO_ANALOG) -GPIO(USBC_CC_EN, A, 4, GPIO_OUT_LOW) -GPIO(USBC_CC_TX_DATA, A, 6, GPIO_OUT_LOW) -GPIO(USBC_CC_TX_EN, D, 7, GPIO_OUT_LOW) +GPIO(USBC_CC1_PD, PIN(A, 1), GPIO_ANALOG) +GPIO(USBC_CC2_PD, PIN(A, 3), GPIO_ANALOG) +GPIO(USBC_CC_EN, PIN(A, 4), GPIO_OUT_LOW) +GPIO(USBC_CC_TX_DATA, PIN(A, 6), GPIO_OUT_LOW) +GPIO(USBC_CC_TX_EN, PIN(D, 7), GPIO_OUT_LOW) #if 0 /* Alternate functions */ -GPIO(USBC_TX_CLKOUT, B, 1, GPIO_OUT_LOW) -GPIO(USBC_TX_CLKIN, B, 3, GPIO_OUT_LOW) +GPIO(USBC_TX_CLKOUT, PIN(B, 1), GPIO_OUT_LOW) +GPIO(USBC_TX_CLKIN, PIN(B, 3), GPIO_OUT_LOW) #endif /* System power */ -GPIO(PMIC_PWRON_L, D, 14, GPIO_ODR_HIGH) -GPIO(PMIC_WARM_RESET_L, E, 4, GPIO_ODR_HIGH) -GPIO(EN_PP5000, A, 14, GPIO_OUT_LOW) /* Proto 5+ */ +GPIO(PMIC_PWRON_L, PIN(D, 14), GPIO_ODR_HIGH) +GPIO(PMIC_WARM_RESET_L, PIN(E, 4), GPIO_ODR_HIGH) +GPIO(EN_PP5000, PIN(A, 14), GPIO_OUT_LOW) /* Proto 5+ */ /* * We are missing an external pull-up for EN_PP3300. * This GPIO is used to pull it up through an external 100kOhm. * EN_PP3300 is still controlled by PMIC though. */ -GPIO(EN_PP3300_RSVD, E, 13, GPIO_OUT_LOW) +GPIO(EN_PP3300_RSVD, PIN(E, 13), GPIO_OUT_LOW) /* sensor temp output and PMIC reset input */ -GPIO(P5_PMIC_THERM_L, B, 8, GPIO_ODR_HIGH) +GPIO(P5_PMIC_THERM_L, PIN(B, 8), GPIO_ODR_HIGH) /* TODO(crosbug.com/p/38333) remove P4_PMIC_THERM_L */ -GPIO(P4_PMIC_THERM_L, D, 12, GPIO_ODR_HIGH) +GPIO(P4_PMIC_THERM_L, PIN(D, 12), GPIO_ODR_HIGH) -GPIO(VBUS_SENSE, A, 0, GPIO_ANALOG) -GPIO(CHGR_IADP, B, 0, GPIO_ANALOG) -GPIO(CHGR_IBAT, C, 3, GPIO_ANALOG) +GPIO(VBUS_SENSE, PIN(A, 0), GPIO_ANALOG) +GPIO(CHGR_IADP, PIN(B, 0), GPIO_ANALOG) +GPIO(CHGR_IBAT, PIN(C, 3), GPIO_ANALOG) /* Inductive charging */ -GPIO(CHARGE_EN, D, 13, GPIO_OUT_LOW) -GPIO(BASE_CHG_VDD_EN, E, 5, GPIO_OUT_LOW) +GPIO(CHARGE_EN, PIN(D, 13), GPIO_OUT_LOW) +GPIO(BASE_CHG_VDD_EN, PIN(E, 5), GPIO_OUT_LOW) /* USB-C Power and muxes control */ -GPIO(USBC_CHARGE_EN_L, A, 7, GPIO_OUT_LOW) -GPIO(USBC_5V_EN, D, 8, GPIO_OUT_LOW) -GPIO(USBC_VCONN1_EN_L, F, 10, GPIO_OUT_HIGH) -GPIO(USBC_VCONN2_EN_L, D, 10, GPIO_OUT_HIGH) +GPIO(USBC_CHARGE_EN_L, PIN(A, 7), GPIO_OUT_LOW) +GPIO(USBC_5V_EN, PIN(D, 8), GPIO_OUT_LOW) +GPIO(USBC_VCONN1_EN_L, PIN(F, 10), GPIO_OUT_HIGH) +GPIO(USBC_VCONN2_EN_L, PIN(D, 10), GPIO_OUT_HIGH) -GPIO(USBC_CC1_DEVICE_ODL, A, 5, GPIO_ODR_LOW) -GPIO(USBC_CC2_DEVICE_ODL, E, 14, GPIO_ODR_LOW) +GPIO(USBC_CC1_DEVICE_ODL, PIN(A, 5), GPIO_ODR_LOW) +GPIO(USBC_CC2_DEVICE_ODL, PIN(E, 14), GPIO_ODR_LOW) /* Pericom PI3USB30592 mux controls on Proto 5+ */ -GPIO(USBC_MUX_CONF0, D, 3, GPIO_OUT_LOW) -GPIO(USBC_MUX_CONF1, D, 9, GPIO_OUT_LOW) -GPIO(USBC_MUX_CONF2, E, 0, GPIO_OUT_LOW) +GPIO(USBC_MUX_CONF0, PIN(D, 3), GPIO_OUT_LOW) +GPIO(USBC_MUX_CONF1, PIN(D, 9), GPIO_OUT_LOW) +GPIO(USBC_MUX_CONF2, PIN(E, 0), GPIO_OUT_LOW) /* TODO(crosbug.com/p/38333) remove USBC_DP_xxx GPIOs */ -GPIO(USBC_DP_MODE_L, D, 1, GPIO_OUT_HIGH) -GPIO(USBC_DP_POLARITY, D, 2, GPIO_OUT_HIGH) +GPIO(USBC_DP_MODE_L, PIN(D, 1), GPIO_OUT_HIGH) +GPIO(USBC_DP_POLARITY, PIN(D, 2), GPIO_OUT_HIGH) /* Inputs */ -GPIO(BOARD_ID0, E, 11, GPIO_INPUT) -GPIO(BOARD_ID1, E, 12, GPIO_INPUT) -GPIO(SH_SIGNAL, E, 2, GPIO_INPUT) +GPIO(BOARD_ID0, PIN(E, 11), GPIO_INPUT) +GPIO(BOARD_ID1, PIN(E, 12), GPIO_INPUT) +GPIO(SH_SIGNAL, PIN(E, 2), GPIO_INPUT) /* Lightbar reset */ -GPIO(LB_RST_L, D, 15, GPIO_ODR_HIGH | GPIO_PULL_UP) +GPIO(LB_RST_L, PIN(D, 15), GPIO_ODR_HIGH | GPIO_PULL_UP) #if 0 /* Alternate functions */ -GPIO(USB_DM, A, 11, GPIO_ANALOG) -GPIO(USB_DP, A, 12, GPIO_ANALOG) -GPIO(UART_TX, D, 5, GPIO_OUT_LOW) -GPIO(UART_RX, D, 6, GPIO_OUT_LOW) +GPIO(USB_DM, PIN(A, 11), GPIO_ANALOG) +GPIO(USB_DP, PIN(A, 12), GPIO_ANALOG) +GPIO(UART_TX, PIN(D, 5), GPIO_OUT_LOW) +GPIO(UART_RX, PIN(D, 6), GPIO_OUT_LOW) #endif /* * I2C pins should be configured as inputs until I2C module is * initialized. This will avoid driving the lines unintentionally. */ -GPIO(MASTER_I2C_SCL, A, 15, GPIO_INPUT) -GPIO(MASTER_I2C_SDA, A, 14, GPIO_INPUT) -GPIO(SLAVE_I2C_SCL, A, 9, GPIO_INPUT) -GPIO(SLAVE_I2C_SDA, A, 10, GPIO_INPUT) +GPIO(MASTER_I2C_SCL, PIN(A, 15), GPIO_INPUT) +GPIO(MASTER_I2C_SDA, PIN(A, 14), GPIO_INPUT) +GPIO(SLAVE_I2C_SCL, PIN(A, 9), GPIO_INPUT) +GPIO(SLAVE_I2C_SDA, PIN(A, 10), GPIO_INPUT) /* SCL gating for PI3USB9281 */ -GPIO(PERICOM_CLK_EN, C, 15, GPIO_OUT_HIGH) +GPIO(PERICOM_CLK_EN, PIN(C, 15), GPIO_OUT_HIGH) /* Case closed debugging. */ -GPIO(USB_PU_EN_L, C, 2, GPIO_OUT_HIGH) -GPIO(PD_DISABLE_DEBUG, C, 6, GPIO_OUT_LOW) -GPIO(SPI_FLASH_NSS, B, 9, GPIO_INPUT) -GPIO(VDDSPI_EN, C, 12, GPIO_OUT_LOW) -GPIO(SH_RESET, C, 4, GPIO_ODR_HIGH) -GPIO(SH_BOOT, C, 9, GPIO_ODR_HIGH) -GPIO(EC_INT_L, F, 2, GPIO_ODR_HIGH) -GPIO(ENTERING_RW, E, 15, GPIO_OUT_LOW) -GPIO(WP_L, F, 6, GPIO_INPUT) -GPIO(FW_DEBUG_MODE_L, C, 7, GPIO_ODR_HIGH) /* Proto 5+ */ +GPIO(USB_PU_EN_L, PIN(C, 2), GPIO_OUT_HIGH) +GPIO(PD_DISABLE_DEBUG, PIN(C, 6), GPIO_OUT_LOW) +GPIO(SPI_FLASH_NSS, PIN(B, 9), GPIO_INPUT) +GPIO(VDDSPI_EN, PIN(C, 12), GPIO_OUT_LOW) +GPIO(SH_RESET, PIN(C, 4), GPIO_ODR_HIGH) +GPIO(SH_BOOT, PIN(C, 9), GPIO_ODR_HIGH) +GPIO(EC_INT_L, PIN(F, 2), GPIO_ODR_HIGH) +GPIO(ENTERING_RW, PIN(E, 15), GPIO_OUT_LOW) +GPIO(WP_L, PIN(F, 6), GPIO_INPUT) +GPIO(FW_DEBUG_MODE_L, PIN(C, 7), GPIO_ODR_HIGH) /* Proto 5+ */ #if 0 /* Alternate functions */ -GPIO(SH_UART_TX, C, 11, GPIO_OUT_LOW) -GPIO(SH_UART_RX, C, 10, GPIO_INPUT) -GPIO(AP_UART_TX, B, 6, GPIO_OUT_LOW) -GPIO(AP_UART_RX, B, 7, GPIO_INPUT) +GPIO(SH_UART_TX, PIN(C, 11), GPIO_OUT_LOW) +GPIO(SH_UART_RX, PIN(C, 10), GPIO_INPUT) +GPIO(AP_UART_TX, PIN(B, 6), GPIO_OUT_LOW) +GPIO(AP_UART_RX, PIN(B, 7), GPIO_INPUT) #endif UNIMPLEMENTED(AP_RESET_L) #define GPIO_ODR_UP GPIO_OPEN_DRAIN | GPIO_PULL_UP -ALTERNATE(B, 0xC400, 5, MODULE_SPI_MASTER, 0) /* SPI2: PB10/14/15 */ -ALTERNATE(B, 0x0008, 5, MODULE_USB_PD, 0) /* SPI1: SCK(PB3) */ -ALTERNATE(B, 0x0002, 2, MODULE_USB_PD, 0) /* TIM3_CH4: PB1 */ -ALTERNATE(B, 0x00C0, 7, MODULE_USART, 0) /* USART1: PB6/PB7 */ -ALTERNATE(D, 0x0060, 7, MODULE_UART, GPIO_PULL_UP) /* USART2: PD4/PD5 */ -ALTERNATE(C, 0x0C00, 7, MODULE_USART, GPIO_ODR_UP) /* USART3: PC10/PC11 */ -ALTERNATE(A, 0xC600, 4, MODULE_I2C, 0) /* I2C SLAVE:PA9/10 MASTER:PA14/15 */ -ALTERNATE(A, 0x1800,14, MODULE_USB, 0) /* USB: PA11/12 */ +ALTERNATE(PIN_MASK(B, 0xC400), 5, MODULE_SPI_MASTER, 0) /* SPI2: PB10/14/15 */ +ALTERNATE(PIN_MASK(B, 0x0008), 5, MODULE_USB_PD, 0) /* SPI1: SCK(PB3) */ +ALTERNATE(PIN_MASK(B, 0x0002), 2, MODULE_USB_PD, 0) /* TIM3_CH4: PB1 */ +ALTERNATE(PIN_MASK(B, 0x00C0), 7, MODULE_USART, 0) /* USART1: PB6/PB7 */ +ALTERNATE(PIN_MASK(D, 0x0060), 7, MODULE_UART, GPIO_PULL_UP) /* USART2: PD4/PD5 */ +ALTERNATE(PIN_MASK(C, 0x0C00), 7, MODULE_USART, GPIO_ODR_UP) /* USART3: PC10/PC11 */ +ALTERNATE(PIN_MASK(A, 0xC600), 4, MODULE_I2C, 0) /* I2C SLAVE:PA9/10 MASTER:PA14/15 */ +ALTERNATE(PIN_MASK(A, 0x1800),14, MODULE_USB, 0) /* USB: PA11/12 */ diff --git a/board/ryu_sh/gpio.inc b/board/ryu_sh/gpio.inc index f508ac8e9d..772309018a 100644 --- a/board/ryu_sh/gpio.inc +++ b/board/ryu_sh/gpio.inc @@ -6,27 +6,27 @@ */ /* Interrupts */ -GPIO_INT(AP_IN_SUSPEND, E, 9, GPIO_INT_BOTH, power_signal_interrupt) +GPIO_INT(AP_IN_SUSPEND, PIN(E, 9), GPIO_INT_BOTH, power_signal_interrupt) /* * TODO(gwendal): Follow Rambus work. * Combined accelerometer input. This will become an interrupt, once we have * support for it. */ -GPIO(ACC_IRQ, B, 12, GPIO_INPUT) +GPIO(ACC_IRQ, PIN(B, 12), GPIO_INPUT) /* Outputs */ -GPIO(SH_EC_SIGNAL, A, 7, GPIO_OUT_LOW) -GPIO(SH_IRQ_L, A, 11, GPIO_OUT_LOW) +GPIO(SH_EC_SIGNAL, PIN(A, 7), GPIO_OUT_LOW) +GPIO(SH_IRQ_L, PIN(A, 11), GPIO_OUT_LOW) /* Inputs */ -GPIO(LID_CLOSED, A, 2, GPIO_INPUT) -GPIO(BASE_PRESENT, A, 3, GPIO_INPUT) -GPIO(COMPASS_DRDY, B, 11, GPIO_INPUT) +GPIO(LID_CLOSED, PIN(A, 2), GPIO_INPUT) +GPIO(BASE_PRESENT, PIN(A, 3), GPIO_INPUT) +GPIO(COMPASS_DRDY, PIN(B, 11), GPIO_INPUT) #if 0 /* Alternate functions */ -GPIO(UART_TX, A, 9, GPIO_OUT_LOW) -GPIO(UART_RX, A, 10, GPIO_OUT_LOW) +GPIO(UART_TX, PIN(A, 9), GPIO_OUT_LOW) +GPIO(UART_RX, PIN(A, 10), GPIO_OUT_LOW) #endif /* Needed to bypass flash write protection */ @@ -37,11 +37,11 @@ UNIMPLEMENTED(WP) * I2C pins should be configured as inputs until I2C module is * initialized. This will avoid driving the lines unintentionally. */ -GPIO(SLAVE_I2C_SCL, B, 6, GPIO_INPUT) -GPIO(SLAVE_I2C_SDA, B, 7, GPIO_INPUT) -GPIO(MASTER_I2C_SCL, B, 13, GPIO_INPUT) -GPIO(MASTER_I2C_SDA, B, 14, GPIO_INPUT) +GPIO(SLAVE_I2C_SCL, PIN(B, 6), GPIO_INPUT) +GPIO(SLAVE_I2C_SDA, PIN(B, 7), GPIO_INPUT) +GPIO(MASTER_I2C_SCL, PIN(B, 13), GPIO_INPUT) +GPIO(MASTER_I2C_SDA, PIN(B, 14), GPIO_INPUT) -ALTERNATE(A, 0x0600, 1, MODULE_UART, 0) /* USART1: PA9/PA10 */ -ALTERNATE(B, 0x00C0, 1, MODULE_I2C, 0) /* I2C SLAVE:PB6/7 */ -ALTERNATE(B, 0x6000, 5, MODULE_I2C, 0) /* I2C MASTER:PB13/14 */ +ALTERNATE(PIN_MASK(A, 0x0600), 1, MODULE_UART, 0) /* USART1: PA9/PA10 */ +ALTERNATE(PIN_MASK(B, 0x00C0), 1, MODULE_I2C, 0) /* I2C SLAVE:PB6/7 */ +ALTERNATE(PIN_MASK(B, 0x6000), 5, MODULE_I2C, 0) /* I2C MASTER:PB13/14 */ diff --git a/board/ryu_sh_loader/gpio.inc b/board/ryu_sh_loader/gpio.inc index d4c9e85054..52565b3fa1 100644 --- a/board/ryu_sh_loader/gpio.inc +++ b/board/ryu_sh_loader/gpio.inc @@ -6,20 +6,20 @@ */ /* Interrupts */ -GPIO_INT(AP_IN_SUSPEND, E, 9, GPIO_INT_BOTH, power_signal_interrupt) +GPIO_INT(AP_IN_SUSPEND, PIN(E, 9), GPIO_INT_BOTH, power_signal_interrupt) /* Outputs */ -GPIO(SH_EC_SIGNAL, A, 7, GPIO_OUT_LOW) -GPIO(SH_IRQ_L, A, 11, GPIO_OUT_LOW) +GPIO(SH_EC_SIGNAL, PIN(A, 7), GPIO_OUT_LOW) +GPIO(SH_IRQ_L, PIN(A, 11), GPIO_OUT_LOW) /* Inputs */ -GPIO(LID_CLOSED, A, 2, GPIO_INPUT) -GPIO(BASE_PRESENT, A, 3, GPIO_INPUT) +GPIO(LID_CLOSED, PIN(A, 2), GPIO_INPUT) +GPIO(BASE_PRESENT, PIN(A, 3), GPIO_INPUT) #if 0 /* Alternate functions */ -GPIO(UART_TX, A, 9, GPIO_OUT_LOW) -GPIO(UART_RX, A, 10, GPIO_OUT_LOW) +GPIO(UART_TX, PIN(A, 9), GPIO_OUT_LOW) +GPIO(UART_RX, PIN(A, 10), GPIO_OUT_LOW) #endif /* Needed to bypass flash write protection */ @@ -30,8 +30,8 @@ UNIMPLEMENTED(WP) * I2C pins should be configured as inputs until I2C module is * initialized. This will avoid driving the lines unintentionally. */ -GPIO(SLAVE_I2C_SCL, B, 6, GPIO_INPUT) -GPIO(SLAVE_I2C_SDA, B, 7, GPIO_INPUT) +GPIO(SLAVE_I2C_SCL, PIN(B, 6), GPIO_INPUT) +GPIO(SLAVE_I2C_SDA, PIN(B, 7), GPIO_INPUT) -ALTERNATE(A, 0x0600, 1, MODULE_UART, 0) /* USART1: PA9/PA10 */ -ALTERNATE(B, 0x00C0, 1, MODULE_I2C, 0) /* I2C SLAVE:PB6/7 */ +ALTERNATE(PIN_MASK(A, 0x0600), 1, MODULE_UART, 0) /* USART1: PA9/PA10 */ +ALTERNATE(PIN_MASK(B, 0x00C0), 1, MODULE_I2C, 0) /* I2C SLAVE:PB6/7 */ diff --git a/board/samus/gpio.inc b/board/samus/gpio.inc index 91d51a58ce..969f3f072d 100644 --- a/board/samus/gpio.inc +++ b/board/samus/gpio.inc @@ -6,115 +6,115 @@ */ /* Inputs with interrupt handlers are first for efficiency */ -GPIO_INT(POWER_BUTTON_L, A, 2, GPIO_INT_BOTH_DSLEEP, power_button_interrupt) /* Power button */ -GPIO_INT(LID_OPEN, A, 3, GPIO_INT_BOTH_DSLEEP, lid_interrupt) /* Lid switch */ -GPIO_INT(AC_PRESENT, H, 3, GPIO_INT_BOTH_DSLEEP, extpower_interrupt) /* AC power present */ -GPIO_INT(PCH_SLP_S0_L, G, 6, GPIO_INT_BOTH, power_signal_interrupt) /* SLP_S0# signal from PCH */ -GPIO_INT(PCH_SLP_S3_L, G, 7, GPIO_INT_BOTH_DSLEEP, power_signal_interrupt) /* SLP_S3# signal from PCH */ -GPIO_INT(PCH_SLP_S5_L, H, 1, GPIO_INT_BOTH_DSLEEP, power_signal_interrupt) /* SLP_S5# signal from PCH */ -GPIO_INT(PCH_SLP_SUS_L, G, 3, GPIO_INT_BOTH, power_signal_interrupt) /* SLP_SUS# signal from PCH */ -GPIO_INT(PCH_SUSWARN_L, G, 2, GPIO_INT_BOTH, power_signal_interrupt) /* SUSWARN# signal from PCH */ -GPIO_INT(PP1050_PGOOD, H, 4, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 1.05V */ -GPIO_INT(PP1200_PGOOD, H, 6, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 1.2V (DRAM) */ -GPIO_INT(PP1800_PGOOD, L, 7, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 1.8V (DRAM) */ -GPIO_INT(VCORE_PGOOD, C, 6, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on core VR */ -GPIO_INT(WP_L, A, 4, GPIO_INT_BOTH, switch_interrupt) /* Write protect input */ -GPIO_INT(PCH_BL_EN, M, 3, GPIO_INT_RISING, backlight_interrupt) /* PCH backlight input */ -GPIO_INT(JTAG_TCK, C, 0, GPIO_DEFAULT, jtag_interrupt) /* JTAG clock input */ -GPIO_INT(UART0_RX, A, 0, GPIO_PULL_UP | GPIO_INT_BOTH_DSLEEP, uart_deepsleep_interrupt) /* UART0 RX input */ -GPIO_INT(BKBOOST_DET, B, 5, GPIO_INT_RISING, bkboost_det_interrupt) /* Backboost detect */ +GPIO_INT(POWER_BUTTON_L, PIN(A, 2), GPIO_INT_BOTH_DSLEEP, power_button_interrupt) /* Power button */ +GPIO_INT(LID_OPEN, PIN(A, 3), GPIO_INT_BOTH_DSLEEP, lid_interrupt) /* Lid switch */ +GPIO_INT(AC_PRESENT, PIN(H, 3), GPIO_INT_BOTH_DSLEEP, extpower_interrupt) /* AC power present */ +GPIO_INT(PCH_SLP_S0_L, PIN(G, 6), GPIO_INT_BOTH, power_signal_interrupt) /* SLP_S0# signal from PCH */ +GPIO_INT(PCH_SLP_S3_L, PIN(G, 7), GPIO_INT_BOTH_DSLEEP, power_signal_interrupt) /* SLP_S3# signal from PCH */ +GPIO_INT(PCH_SLP_S5_L, PIN(H, 1), GPIO_INT_BOTH_DSLEEP, power_signal_interrupt) /* SLP_S5# signal from PCH */ +GPIO_INT(PCH_SLP_SUS_L, PIN(G, 3), GPIO_INT_BOTH, power_signal_interrupt) /* SLP_SUS# signal from PCH */ +GPIO_INT(PCH_SUSWARN_L, PIN(G, 2), GPIO_INT_BOTH, power_signal_interrupt) /* SUSWARN# signal from PCH */ +GPIO_INT(PP1050_PGOOD, PIN(H, 4), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 1.05V */ +GPIO_INT(PP1200_PGOOD, PIN(H, 6), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 1.2V (DRAM) */ +GPIO_INT(PP1800_PGOOD, PIN(L, 7), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 1.8V (DRAM) */ +GPIO_INT(VCORE_PGOOD, PIN(C, 6), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on core VR */ +GPIO_INT(WP_L, PIN(A, 4), GPIO_INT_BOTH, switch_interrupt) /* Write protect input */ +GPIO_INT(PCH_BL_EN, PIN(M, 3), GPIO_INT_RISING, backlight_interrupt) /* PCH backlight input */ +GPIO_INT(JTAG_TCK, PIN(C, 0), GPIO_DEFAULT, jtag_interrupt) /* JTAG clock input */ +GPIO_INT(UART0_RX, PIN(A, 0), GPIO_PULL_UP | GPIO_INT_BOTH_DSLEEP, uart_deepsleep_interrupt) /* UART0 RX input */ +GPIO_INT(BKBOOST_DET, PIN(B, 5), GPIO_INT_RISING, bkboost_det_interrupt) /* Backboost detect */ /* Interrupt signal from PD MCU, external pull-down */ -GPIO_INT(PD_MCU_INT, J, 5, GPIO_INT_RISING | GPIO_INT_DSLEEP, pd_mcu_interrupt) +GPIO_INT(PD_MCU_INT, PIN(J, 5), GPIO_INT_RISING | GPIO_INT_DSLEEP, pd_mcu_interrupt) /* * Combined accelerometer input. This will become an interrupt, once we have * support for it. */ -GPIO(ACCEL_INT, F, 7, GPIO_INPUT) +GPIO(ACCEL_INT, PIN(F, 7), GPIO_INPUT) /* * Ambient Light Sensor input. This could become an interrupt once supported. */ -GPIO(ALS_INT_L, N, 0, GPIO_INPUT) +GPIO(ALS_INT_L, PIN(N, 0), GPIO_INPUT) /* Other inputs */ -GPIO(BOARD_VERSION1, Q, 7, GPIO_INPUT) /* Board version stuffing resistor 1 */ -GPIO(BOARD_VERSION2, Q, 6, GPIO_INPUT) /* Board version stuffing resistor 2 */ -GPIO(BOARD_VERSION3, Q, 5, GPIO_INPUT) /* Board version stuffing resistor 3 */ -GPIO(USB1_OC_L, E, 7, GPIO_INPUT) /* USB port overcurrent warning */ -GPIO(USB1_STATUS_L, E, 6, GPIO_INPUT) /* USB charger port 1 status output */ -GPIO(USB2_OC_L, E, 0, GPIO_INPUT) /* USB port overcurrent warning */ -GPIO(USB2_STATUS_L, D, 7, GPIO_INPUT) /* USB charger port 2 status output */ -GPIO(PD_IN_RW, A, 5, GPIO_INPUT) /* PD is in RW */ -GPIO(PCH_HDA_SDO_L, G, 1, GPIO_INPUT) /* HDA_SDO signal to PCH to disable ME */ +GPIO(BOARD_VERSION1, PIN(Q, 7), GPIO_INPUT) /* Board version stuffing resistor 1 */ +GPIO(BOARD_VERSION2, PIN(Q, 6), GPIO_INPUT) /* Board version stuffing resistor 2 */ +GPIO(BOARD_VERSION3, PIN(Q, 5), GPIO_INPUT) /* Board version stuffing resistor 3 */ +GPIO(USB1_OC_L, PIN(E, 7), GPIO_INPUT) /* USB port overcurrent warning */ +GPIO(USB1_STATUS_L, PIN(E, 6), GPIO_INPUT) /* USB charger port 1 status output */ +GPIO(USB2_OC_L, PIN(E, 0), GPIO_INPUT) /* USB port overcurrent warning */ +GPIO(USB2_STATUS_L, PIN(D, 7), GPIO_INPUT) /* USB charger port 2 status output */ +GPIO(PD_IN_RW, PIN(A, 5), GPIO_INPUT) /* PD is in RW */ +GPIO(PCH_HDA_SDO_L, PIN(G, 1), GPIO_INPUT) /* HDA_SDO signal to PCH to disable ME */ /* Outputs; all unasserted by default except for reset signals */ -GPIO(CPU_PROCHOT, B, 1, GPIO_OUT_LOW) /* Force CPU to think it's overheated */ -GPIO(PP1200_EN, H, 5, GPIO_OUT_LOW) /* Enable 1.20V supply */ -GPIO(PP3300_DSW_EN, F, 6, GPIO_OUT_LOW) /* Enable 3.3V DSW rail */ -GPIO(PP3300_DSW_GATED_EN, J, 3, GPIO_OUT_LOW) /* Enable 3.3V Gated DSW and core VDD */ -GPIO(PP3300_LTE_EN, D, 2, GPIO_OUT_LOW) /* Enable LTE radio */ -GPIO(PP3300_WLAN_EN, J, 0, GPIO_OUT_LOW) /* Enable WiFi power */ -GPIO(PP1050_EN, C, 7, GPIO_OUT_LOW) /* Enable 1.05V regulator */ -GPIO(PP5000_USB_EN, C, 5, GPIO_OUT_LOW) /* Enable USB power */ -GPIO(PP5000_EN, H, 7, GPIO_OUT_LOW) /* Enable 5V supply */ -GPIO(PP1800_EN, L, 6, GPIO_OUT_LOW) /* Enable 1.8V supply */ -GPIO(SYS_PWROK, H, 2, GPIO_OUT_LOW) /* EC thinks everything is up and ready */ -GPIO(WLAN_OFF_L, J, 4, GPIO_OUT_LOW) /* Disable WiFi radio */ -GPIO(USB_MCU_RST, B, 0, GPIO_OUT_LOW) /* USB PD MCU reset */ -GPIO(ENABLE_BACKLIGHT, M, 7, GPIO_OUT_LOW) /* Enable backlight power */ -GPIO(ENABLE_TOUCHPAD, N, 1, GPIO_OUT_LOW) /* Enable touchpad power */ -GPIO(ENTERING_RW, D, 3, GPIO_OUT_LOW) /* Indicate when EC is entering RW code */ -GPIO(LIGHTBAR_RESET_L, J, 2, GPIO_ODR_LOW) /* Reset lightbar controllers */ -GPIO(PCH_DPWROK, G, 0, GPIO_OUT_LOW) /* Indicate when VccDSW is good */ -GPIO(PCH_RSMRST_L, C, 4, GPIO_OUT_LOW) /* Reset PCH resume power plane logic */ -GPIO(PCH_RTCRST_L, J, 1, GPIO_ODR_HIGH) /* Reset PCH RTC well */ -GPIO(PCH_WAKE_L, F, 0, GPIO_ODR_HIGH) /* Wake signal from EC to PCH */ -GPIO(PCH_NMI_L, F, 2, GPIO_ODR_HIGH) /* Non-maskable interrupt pin to PCH */ -GPIO(PCH_PWRBTN_L, H, 0, GPIO_ODR_HIGH) /* Power button output to PCH */ -GPIO(PCH_PWROK, F, 5, GPIO_OUT_LOW) /* PWROK / APWROK signals to PCH */ -GPIO(PCH_RCIN_L, F, 3, GPIO_ODR_HIGH) /* RCIN# line to PCH (for 8042 emulation) */ -GPIO(PCH_SYS_RST_L, F, 1, GPIO_ODR_HIGH) /* Reset PCH resume power plane logic */ -GPIO(PCH_SMI_L, F, 4, GPIO_ODR_HIGH) /* System management interrupt to PCH */ -GPIO(TOUCHSCREEN_RESET_L, N, 7, GPIO_ODR_LOW) /* Reset touch screen */ -GPIO(PCH_ACOK, M, 6, GPIO_OUT_LOW) /* AC present signal buffered to PCH */ +GPIO(CPU_PROCHOT, PIN(B, 1), GPIO_OUT_LOW) /* Force CPU to think it's overheated */ +GPIO(PP1200_EN, PIN(H, 5), GPIO_OUT_LOW) /* Enable 1.20V supply */ +GPIO(PP3300_DSW_EN, PIN(F, 6), GPIO_OUT_LOW) /* Enable 3.3V DSW rail */ +GPIO(PP3300_DSW_GATED_EN, PIN(J, 3), GPIO_OUT_LOW) /* Enable 3.3V Gated DSW and core VDD */ +GPIO(PP3300_LTE_EN, PIN(D, 2), GPIO_OUT_LOW) /* Enable LTE radio */ +GPIO(PP3300_WLAN_EN, PIN(J, 0), GPIO_OUT_LOW) /* Enable WiFi power */ +GPIO(PP1050_EN, PIN(C, 7), GPIO_OUT_LOW) /* Enable 1.05V regulator */ +GPIO(PP5000_USB_EN, PIN(C, 5), GPIO_OUT_LOW) /* Enable USB power */ +GPIO(PP5000_EN, PIN(H, 7), GPIO_OUT_LOW) /* Enable 5V supply */ +GPIO(PP1800_EN, PIN(L, 6), GPIO_OUT_LOW) /* Enable 1.8V supply */ +GPIO(SYS_PWROK, PIN(H, 2), GPIO_OUT_LOW) /* EC thinks everything is up and ready */ +GPIO(WLAN_OFF_L, PIN(J, 4), GPIO_OUT_LOW) /* Disable WiFi radio */ +GPIO(USB_MCU_RST, PIN(B, 0), GPIO_OUT_LOW) /* USB PD MCU reset */ +GPIO(ENABLE_BACKLIGHT, PIN(M, 7), GPIO_OUT_LOW) /* Enable backlight power */ +GPIO(ENABLE_TOUCHPAD, PIN(N, 1), GPIO_OUT_LOW) /* Enable touchpad power */ +GPIO(ENTERING_RW, PIN(D, 3), GPIO_OUT_LOW) /* Indicate when EC is entering RW code */ +GPIO(LIGHTBAR_RESET_L, PIN(J, 2), GPIO_ODR_LOW) /* Reset lightbar controllers */ +GPIO(PCH_DPWROK, PIN(G, 0), GPIO_OUT_LOW) /* Indicate when VccDSW is good */ +GPIO(PCH_RSMRST_L, PIN(C, 4), GPIO_OUT_LOW) /* Reset PCH resume power plane logic */ +GPIO(PCH_RTCRST_L, PIN(J, 1), GPIO_ODR_HIGH) /* Reset PCH RTC well */ +GPIO(PCH_WAKE_L, PIN(F, 0), GPIO_ODR_HIGH) /* Wake signal from EC to PCH */ +GPIO(PCH_NMI_L, PIN(F, 2), GPIO_ODR_HIGH) /* Non-maskable interrupt pin to PCH */ +GPIO(PCH_PWRBTN_L, PIN(H, 0), GPIO_ODR_HIGH) /* Power button output to PCH */ +GPIO(PCH_PWROK, PIN(F, 5), GPIO_OUT_LOW) /* PWROK / APWROK signals to PCH */ +GPIO(PCH_RCIN_L, PIN(F, 3), GPIO_ODR_HIGH) /* RCIN# line to PCH (for 8042 emulation) */ +GPIO(PCH_SYS_RST_L, PIN(F, 1), GPIO_ODR_HIGH) /* Reset PCH resume power plane logic */ +GPIO(PCH_SMI_L, PIN(F, 4), GPIO_ODR_HIGH) /* System management interrupt to PCH */ +GPIO(TOUCHSCREEN_RESET_L, PIN(N, 7), GPIO_ODR_LOW) /* Reset touch screen */ +GPIO(PCH_ACOK, PIN(M, 6), GPIO_OUT_LOW) /* AC present signal buffered to PCH */ #ifndef HEY_USE_BUILTIN_CLKRUN -GPIO(LPC_CLKRUN_L, M, 2, GPIO_ODR_HIGH) /* Dunno. Probably important, though. */ +GPIO(LPC_CLKRUN_L, PIN(M, 2), GPIO_ODR_HIGH) /* Dunno. Probably important, though. */ #endif -GPIO(USB1_CTL1, E, 1, GPIO_OUT_LOW) /* USB charger port 1 CTL1 output */ -GPIO(USB1_CTL2, E, 2, GPIO_OUT_HIGH) /* USB charger port 1 CTL2 output */ -GPIO(USB1_CTL3, E, 3, GPIO_OUT_LOW) /* USB charger port 1 CTL3 output */ -GPIO(USB1_ENABLE, E, 4, GPIO_OUT_HIGH) /* USB charger port 1 enable */ -GPIO(USB1_ILIM_SEL_L, E, 5, GPIO_OUT_HIGH) /* USB charger port 1 ILIM_SEL output */ -GPIO(USB2_CTL1, D, 0, GPIO_OUT_LOW) /* USB charger port 2 CTL1 output */ -GPIO(USB2_CTL2, D, 1, GPIO_OUT_HIGH) /* USB charger port 2 CTL2 output */ -GPIO(USB2_CTL3, D, 4, GPIO_OUT_LOW) /* USB charger port 2 CTL3 output */ -GPIO(USB2_ENABLE, D, 5, GPIO_OUT_HIGH) /* USB charger port 2 enable */ -GPIO(USB2_ILIM_SEL_L, D, 6, GPIO_OUT_HIGH) /* USB charger port 2 ILIM_SEL output */ +GPIO(USB1_CTL1, PIN(E, 1), GPIO_OUT_LOW) /* USB charger port 1 CTL1 output */ +GPIO(USB1_CTL2, PIN(E, 2), GPIO_OUT_HIGH) /* USB charger port 1 CTL2 output */ +GPIO(USB1_CTL3, PIN(E, 3), GPIO_OUT_LOW) /* USB charger port 1 CTL3 output */ +GPIO(USB1_ENABLE, PIN(E, 4), GPIO_OUT_HIGH) /* USB charger port 1 enable */ +GPIO(USB1_ILIM_SEL_L, PIN(E, 5), GPIO_OUT_HIGH) /* USB charger port 1 ILIM_SEL output */ +GPIO(USB2_CTL1, PIN(D, 0), GPIO_OUT_LOW) /* USB charger port 2 CTL1 output */ +GPIO(USB2_CTL2, PIN(D, 1), GPIO_OUT_HIGH) /* USB charger port 2 CTL2 output */ +GPIO(USB2_CTL3, PIN(D, 4), GPIO_OUT_LOW) /* USB charger port 2 CTL3 output */ +GPIO(USB2_ENABLE, PIN(D, 5), GPIO_OUT_HIGH) /* USB charger port 2 enable */ +GPIO(USB2_ILIM_SEL_L, PIN(D, 6), GPIO_OUT_HIGH) /* USB charger port 2 ILIM_SEL output */ -GPIO(I2C0_SCL, B, 2, GPIO_ODR_HIGH) /* I2C port 0 SCL */ -GPIO(I2C0_SDA, B, 3, GPIO_ODR_HIGH) /* I2C port 0 SDA */ -GPIO(I2C1_SCL, A, 6, GPIO_ODR_HIGH) /* I2C port 1 SCL */ -GPIO(I2C1_SDA, A, 7, GPIO_ODR_HIGH) /* I2C port 1 SDA */ -GPIO(I2C5_SCL, B, 6, GPIO_ODR_HIGH) /* I2C port 5 SCL */ -GPIO(I2C5_SDA, B, 7, GPIO_ODR_HIGH) /* I2C port 5 SDA */ +GPIO(I2C0_SCL, PIN(B, 2), GPIO_ODR_HIGH) /* I2C port 0 SCL */ +GPIO(I2C0_SDA, PIN(B, 3), GPIO_ODR_HIGH) /* I2C port 0 SDA */ +GPIO(I2C1_SCL, PIN(A, 6), GPIO_ODR_HIGH) /* I2C port 1 SCL */ +GPIO(I2C1_SDA, PIN(A, 7), GPIO_ODR_HIGH) /* I2C port 1 SDA */ +GPIO(I2C5_SCL, PIN(B, 6), GPIO_ODR_HIGH) /* I2C port 5 SCL */ +GPIO(I2C5_SDA, PIN(B, 7), GPIO_ODR_HIGH) /* I2C port 5 SDA */ -ALTERNATE(A, 0x03, 1, MODULE_UART, 0) /* UART0 */ -ALTERNATE(A, 0x40, 3, MODULE_I2C, 0) /* I2C1 SCL */ -ALTERNATE(A, 0x80, 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C1 SDA */ -ALTERNATE(B, 0x04, 3, MODULE_I2C, 0) /* I2C0 SCL */ -ALTERNATE(B, 0x08, 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C0 SDA */ -ALTERNATE(B, 0x40, 3, MODULE_I2C, 0) /* I2C5 SCL */ -ALTERNATE(B, 0x80, 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C5 SDA */ -ALTERNATE(G, 0x30, 1, MODULE_UART, 0) /* UART2 */ -ALTERNATE(J, 0x40, 1, MODULE_PECI, 0) /* PECI Tx */ -ALTERNATE(J, 0x80, 0, MODULE_PECI, GPIO_ANALOG) /* PECI Rx */ -ALTERNATE(L, 0x3f, 15, MODULE_LPC, 0) /* LPC */ -ALTERNATE(M, 0x33, 15, MODULE_LPC, 0) /* LPC */ +ALTERNATE(PIN_MASK(A, 0x03), 1, MODULE_UART, 0) /* UART0 */ +ALTERNATE(PIN_MASK(A, 0x40), 3, MODULE_I2C, 0) /* I2C1 SCL */ +ALTERNATE(PIN_MASK(A, 0x80), 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C1 SDA */ +ALTERNATE(PIN_MASK(B, 0x04), 3, MODULE_I2C, 0) /* I2C0 SCL */ +ALTERNATE(PIN_MASK(B, 0x08), 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C0 SDA */ +ALTERNATE(PIN_MASK(B, 0x40), 3, MODULE_I2C, 0) /* I2C5 SCL */ +ALTERNATE(PIN_MASK(B, 0x80), 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C5 SDA */ +ALTERNATE(PIN_MASK(G, 0x30), 1, MODULE_UART, 0) /* UART2 */ +ALTERNATE(PIN_MASK(J, 0x40), 1, MODULE_PECI, 0) /* PECI Tx */ +ALTERNATE(PIN_MASK(J, 0x80), 0, MODULE_PECI, GPIO_ANALOG) /* PECI Rx */ +ALTERNATE(PIN_MASK(L, 0x3f), 15, MODULE_LPC, 0) /* LPC */ +ALTERNATE(PIN_MASK(M, 0x33), 15, MODULE_LPC, 0) /* LPC */ #ifdef HEY_USE_BUILTIN_CLKRUN -ALTERNATE(M, 0x04, 15, MODULE_LPC, GPIO_OPEN_DRAIN) /* LPC */ +ALTERNATE(PIN_MASK(M, 0x04), 15, MODULE_LPC, GPIO_OPEN_DRAIN) /* LPC */ #endif -ALTERNATE(N, 0x3c, 1, MODULE_PWM_FAN, 0) /* FAN0PWM 2&3 */ -ALTERNATE(N, 0x40, 1, MODULE_PWM_KBLIGHT, 0) /* FAN0PWM4 */ +ALTERNATE(PIN_MASK(N, 0x3c), 1, MODULE_PWM_FAN, 0) /* FAN0PWM 2&3 */ +ALTERNATE(PIN_MASK(N, 0x40), 1, MODULE_PWM_KBLIGHT, 0) /* FAN0PWM4 */ diff --git a/board/samus_pd/gpio.inc b/board/samus_pd/gpio.inc index 3a44daa662..407e073a5f 100644 --- a/board/samus_pd/gpio.inc +++ b/board/samus_pd/gpio.inc @@ -6,125 +6,125 @@ */ /* Interrupts */ -GPIO_INT(USB_C0_VBUS_WAKE, E, 6, GPIO_INT_BOTH, vbus0_evt) -GPIO_INT(USB_C1_VBUS_WAKE, F, 2, GPIO_INT_BOTH, vbus1_evt) -GPIO_INT(USB_C0_BC12_INT_L, B, 0, GPIO_INT_FALLING, usb0_evt) -GPIO_INT(USB_C1_BC12_INT_L, C, 11, GPIO_INT_FALLING, usb1_evt) -GPIO_INT(PCH_SLP_S0_L, C, 14, GPIO_INT_BOTH, pch_evt) -GPIO_INT(PCH_SLP_S3_L, C, 15, GPIO_INT_BOTH, pch_evt) -GPIO_INT(PCH_SLP_S5_L, D, 7, GPIO_INT_BOTH, pch_evt) -GPIO_INT(WP_L, D, 2, GPIO_INT_BOTH, switch_interrupt) +GPIO_INT(USB_C0_VBUS_WAKE, PIN(E, 6), GPIO_INT_BOTH, vbus0_evt) +GPIO_INT(USB_C1_VBUS_WAKE, PIN(F, 2), GPIO_INT_BOTH, vbus1_evt) +GPIO_INT(USB_C0_BC12_INT_L, PIN(B, 0), GPIO_INT_FALLING, usb0_evt) +GPIO_INT(USB_C1_BC12_INT_L, PIN(C, 11), GPIO_INT_FALLING, usb1_evt) +GPIO_INT(PCH_SLP_S0_L, PIN(C, 14), GPIO_INT_BOTH, pch_evt) +GPIO_INT(PCH_SLP_S3_L, PIN(C, 15), GPIO_INT_BOTH, pch_evt) +GPIO_INT(PCH_SLP_S5_L, PIN(D, 7), GPIO_INT_BOTH, pch_evt) +GPIO_INT(WP_L, PIN(D, 2), GPIO_INT_BOTH, switch_interrupt) /* PD RX/TX */ -GPIO(USB_C0_CC1_PD, A, 0, GPIO_ANALOG) -GPIO(USB_C0_REF, A, 1, GPIO_ANALOG) -GPIO(USB_C1_CC1_PD, A, 2, GPIO_ANALOG) -GPIO(USB_C0_CC2_PD, A, 4, GPIO_ANALOG) -GPIO(USB_C1_CC2_PD, A, 5, GPIO_ANALOG) -GPIO(USB_C0_REF_PD_ODL, A, 6, GPIO_ODR_LOW) +GPIO(USB_C0_CC1_PD, PIN(A, 0), GPIO_ANALOG) +GPIO(USB_C0_REF, PIN(A, 1), GPIO_ANALOG) +GPIO(USB_C1_CC1_PD, PIN(A, 2), GPIO_ANALOG) +GPIO(USB_C0_CC2_PD, PIN(A, 4), GPIO_ANALOG) +GPIO(USB_C1_CC2_PD, PIN(A, 5), GPIO_ANALOG) +GPIO(USB_C0_REF_PD_ODL, PIN(A, 6), GPIO_ODR_LOW) -GPIO(USB_C_CC_EN, C, 10, GPIO_OUT_LOW) -GPIO(USB_C1_CC_TX_EN, A, 15, GPIO_OUT_LOW) -GPIO(USB_C0_CC_TX_EN, B, 9, GPIO_OUT_LOW) -GPIO(USB_C1_CC1_TX_DATA, B, 4, GPIO_OUT_LOW) -GPIO(USB_C0_CC1_TX_DATA, B, 14, GPIO_OUT_LOW) -GPIO(USB_C1_CC2_TX_DATA, E, 14, GPIO_OUT_LOW) -GPIO(USB_C0_CC2_TX_DATA, D, 3, GPIO_OUT_LOW) +GPIO(USB_C_CC_EN, PIN(C, 10), GPIO_OUT_LOW) +GPIO(USB_C1_CC_TX_EN, PIN(A, 15), GPIO_OUT_LOW) +GPIO(USB_C0_CC_TX_EN, PIN(B, 9), GPIO_OUT_LOW) +GPIO(USB_C1_CC1_TX_DATA, PIN(B, 4), GPIO_OUT_LOW) +GPIO(USB_C0_CC1_TX_DATA, PIN(B, 14), GPIO_OUT_LOW) +GPIO(USB_C1_CC2_TX_DATA, PIN(E, 14), GPIO_OUT_LOW) +GPIO(USB_C0_CC2_TX_DATA, PIN(D, 3), GPIO_OUT_LOW) #if 0 /* Alternate functions */ -GPIO(USB_C1_TX_CLKOUT, B, 1, GPIO_OUT_LOW) -GPIO(USB_C0_TX_CLKOUT, E, 1, GPIO_OUT_LOW) -GPIO(USB_C1_TX_CLKIN, B, 3, GPIO_OUT_LOW) -GPIO(USB_C0_TX_CLKIN, B, 13, GPIO_OUT_LOW) +GPIO(USB_C1_TX_CLKOUT, PIN(B, 1), GPIO_OUT_LOW) +GPIO(USB_C0_TX_CLKOUT, PIN(E, 1), GPIO_OUT_LOW) +GPIO(USB_C1_TX_CLKIN, PIN(B, 3), GPIO_OUT_LOW) +GPIO(USB_C0_TX_CLKIN, PIN(B, 13), GPIO_OUT_LOW) #endif /* Power and muxes control */ -GPIO(PPVAR_BOOSTIN_SENSE, C, 1, GPIO_ANALOG) -GPIO(PP3300_USB_PD_EN, A, 8, GPIO_OUT_HIGH) -GPIO(USB_C0_CHARGE_EN_L, D, 12, GPIO_OUT_LOW) -GPIO(USB_C1_CHARGE_EN_L, D, 13, GPIO_OUT_LOW) -GPIO(USB_C0_5V_EN, D, 14, GPIO_OUT_LOW) -GPIO(USB_C1_5V_EN, D, 15, GPIO_OUT_LOW) -GPIO(USB_C0_CC1_VCONN1_EN_L, D, 8, GPIO_OUT_HIGH) -GPIO(USB_C0_CC2_VCONN1_EN_L, D, 9, GPIO_OUT_HIGH) -GPIO(USB_C1_CC1_VCONN1_EN_L, D, 10, GPIO_OUT_HIGH) -GPIO(USB_C1_CC2_VCONN1_EN_L, D, 11, GPIO_OUT_HIGH) -GPIO(USB_C0_CC_1A5_EN, B, 12, GPIO_OUT_LOW) -GPIO(USB_C1_CC_1A5_EN, E, 12, GPIO_OUT_LOW) -GPIO(ILIM_ADJ_PWM, B, 15, GPIO_OUT_LOW) +GPIO(PPVAR_BOOSTIN_SENSE, PIN(C, 1), GPIO_ANALOG) +GPIO(PP3300_USB_PD_EN, PIN(A, 8), GPIO_OUT_HIGH) +GPIO(USB_C0_CHARGE_EN_L, PIN(D, 12), GPIO_OUT_LOW) +GPIO(USB_C1_CHARGE_EN_L, PIN(D, 13), GPIO_OUT_LOW) +GPIO(USB_C0_5V_EN, PIN(D, 14), GPIO_OUT_LOW) +GPIO(USB_C1_5V_EN, PIN(D, 15), GPIO_OUT_LOW) +GPIO(USB_C0_CC1_VCONN1_EN_L, PIN(D, 8), GPIO_OUT_HIGH) +GPIO(USB_C0_CC2_VCONN1_EN_L, PIN(D, 9), GPIO_OUT_HIGH) +GPIO(USB_C1_CC1_VCONN1_EN_L, PIN(D, 10), GPIO_OUT_HIGH) +GPIO(USB_C1_CC2_VCONN1_EN_L, PIN(D, 11), GPIO_OUT_HIGH) +GPIO(USB_C0_CC_1A5_EN, PIN(B, 12), GPIO_OUT_LOW) +GPIO(USB_C1_CC_1A5_EN, PIN(E, 12), GPIO_OUT_LOW) +GPIO(ILIM_ADJ_PWM, PIN(B, 15), GPIO_OUT_LOW) -GPIO(USB_C0_CC1_ODL, B, 8, GPIO_ODR_LOW) -GPIO(USB_C0_CC2_ODL, E, 0, GPIO_ODR_LOW) -GPIO(USB_C1_CC1_ODL, F, 9, GPIO_ODR_LOW) -GPIO(USB_C1_CC2_ODL, F, 10, GPIO_ODR_LOW) +GPIO(USB_C0_CC1_ODL, PIN(B, 8), GPIO_ODR_LOW) +GPIO(USB_C0_CC2_ODL, PIN(E, 0), GPIO_ODR_LOW) +GPIO(USB_C1_CC1_ODL, PIN(F, 9), GPIO_ODR_LOW) +GPIO(USB_C1_CC2_ODL, PIN(F, 10), GPIO_ODR_LOW) -GPIO(USB_C_BC12_SEL, C, 0, GPIO_OUT_LOW) -GPIO(USB_C0_SS1_EN_L, E, 2, GPIO_OUT_HIGH) -GPIO(USB_C0_SS2_EN_L, E, 3, GPIO_OUT_HIGH) -GPIO(USB_C1_SS1_EN_L, E, 9, GPIO_OUT_HIGH) -GPIO(USB_C1_SS2_EN_L, E, 10, GPIO_OUT_HIGH) -GPIO(USB_C0_SS1_DP_MODE, E, 4, GPIO_OUT_HIGH) -GPIO(USB_C0_SS2_DP_MODE, E, 5, GPIO_OUT_HIGH) -GPIO(USB_C1_SS1_DP_MODE, E, 11, GPIO_OUT_HIGH) -GPIO(USB_C1_SS2_DP_MODE, E, 13, GPIO_OUT_HIGH) -GPIO(USB_C0_DP_MODE_L, E, 8, GPIO_OUT_HIGH) -GPIO(USB_C1_DP_MODE_L, F, 6, GPIO_OUT_HIGH) -GPIO(USB_C0_DP_POLARITY, E, 7, GPIO_OUT_HIGH) -GPIO(USB_C1_DP_POLARITY, F, 3, GPIO_OUT_HIGH) -GPIO(USB_C0_DP_HPD, F, 0, GPIO_OUT_LOW) -GPIO(USB_C1_DP_HPD, F, 1, GPIO_OUT_LOW) +GPIO(USB_C_BC12_SEL, PIN(C, 0), GPIO_OUT_LOW) +GPIO(USB_C0_SS1_EN_L, PIN(E, 2), GPIO_OUT_HIGH) +GPIO(USB_C0_SS2_EN_L, PIN(E, 3), GPIO_OUT_HIGH) +GPIO(USB_C1_SS1_EN_L, PIN(E, 9), GPIO_OUT_HIGH) +GPIO(USB_C1_SS2_EN_L, PIN(E, 10), GPIO_OUT_HIGH) +GPIO(USB_C0_SS1_DP_MODE, PIN(E, 4), GPIO_OUT_HIGH) +GPIO(USB_C0_SS2_DP_MODE, PIN(E, 5), GPIO_OUT_HIGH) +GPIO(USB_C1_SS1_DP_MODE, PIN(E, 11), GPIO_OUT_HIGH) +GPIO(USB_C1_SS2_DP_MODE, PIN(E, 13), GPIO_OUT_HIGH) +GPIO(USB_C0_DP_MODE_L, PIN(E, 8), GPIO_OUT_HIGH) +GPIO(USB_C1_DP_MODE_L, PIN(F, 6), GPIO_OUT_HIGH) +GPIO(USB_C0_DP_POLARITY, PIN(E, 7), GPIO_OUT_HIGH) +GPIO(USB_C1_DP_POLARITY, PIN(F, 3), GPIO_OUT_HIGH) +GPIO(USB_C0_DP_HPD, PIN(F, 0), GPIO_OUT_LOW) +GPIO(USB_C1_DP_HPD, PIN(F, 1), GPIO_OUT_LOW) #if 0 /* Alternate functions */ -GPIO(USB_DM, A, 11, GPIO_ANALOG) -GPIO(USB_DP, A, 12, GPIO_ANALOG) -GPIO(UART_TX, A, 9, GPIO_OUT_LOW) -GPIO(UART_RX, A, 10, GPIO_OUT_LOW) -GPIO(TP64, A, 13, GPIO_ODR_HIGH) -GPIO(TP71, A, 14, GPIO_ODR_HIGH) +GPIO(USB_DM, PIN(A, 11), GPIO_ANALOG) +GPIO(USB_DP, PIN(A, 12), GPIO_ANALOG) +GPIO(UART_TX, PIN(A, 9), GPIO_OUT_LOW) +GPIO(UART_RX, PIN(A, 10), GPIO_OUT_LOW) +GPIO(TP64, PIN(A, 13), GPIO_ODR_HIGH) +GPIO(TP71, PIN(A, 14), GPIO_ODR_HIGH) #endif /* * I2C pins should be configured as inputs until I2C module is * initialized. This will avoid driving the lines unintentionally. */ -GPIO(SLAVE_I2C_SCL, B, 6, GPIO_INPUT) -GPIO(SLAVE_I2C_SDA, B, 7, GPIO_INPUT) -GPIO(MASTER_I2C_SCL, B, 10, GPIO_INPUT) -GPIO(MASTER_I2C_SDA, B, 11, GPIO_INPUT) +GPIO(SLAVE_I2C_SCL, PIN(B, 6), GPIO_INPUT) +GPIO(SLAVE_I2C_SDA, PIN(B, 7), GPIO_INPUT) +GPIO(MASTER_I2C_SCL, PIN(B, 10), GPIO_INPUT) +GPIO(MASTER_I2C_SDA, PIN(B, 11), GPIO_INPUT) /* Case closed debugging. */ -GPIO(EC_INT, B, 2, GPIO_OUT_LOW) -GPIO(EC_IN_RW, C, 12, GPIO_INPUT | GPIO_PULL_UP) -GPIO(EC_RST_L, C, 13, GPIO_OUT_HIGH) -GPIO(SPI_FLASH_CS_L, D, 0, GPIO_INPUT) -GPIO(SPI_FLASH_CSK, D, 1, GPIO_INPUT) -GPIO(SPI_FLASH_MOSI, C, 3, GPIO_INPUT) -GPIO(SPI_FLASH_MISO, C, 2, GPIO_INPUT) -GPIO(EC_JTAG_TCK, C, 6, GPIO_INPUT) -GPIO(EC_JTAG_TMS, C, 7, GPIO_INPUT) -GPIO(EC_JTAG_TDO, C, 8, GPIO_INPUT) -GPIO(EC_JTAG_TDI, C, 9, GPIO_INPUT) -GPIO(ENTERING_RW, B, 5, GPIO_OUT_LOW) -GPIO(PD_DISABLE_DEBUG, E, 15, GPIO_OUT_HIGH) -GPIO(PD_DEBUG_EN_L, D, 4, GPIO_INPUT | GPIO_PULL_UP) -GPIO(PD_SPI_PP3300_EN_L, A, 7, GPIO_OUT_HIGH) -GPIO(BST_DISABLE, A, 3, GPIO_OUT_LOW) +GPIO(EC_INT, PIN(B, 2), GPIO_OUT_LOW) +GPIO(EC_IN_RW, PIN(C, 12), GPIO_INPUT | GPIO_PULL_UP) +GPIO(EC_RST_L, PIN(C, 13), GPIO_OUT_HIGH) +GPIO(SPI_FLASH_CS_L, PIN(D, 0), GPIO_INPUT) +GPIO(SPI_FLASH_CSK, PIN(D, 1), GPIO_INPUT) +GPIO(SPI_FLASH_MOSI, PIN(C, 3), GPIO_INPUT) +GPIO(SPI_FLASH_MISO, PIN(C, 2), GPIO_INPUT) +GPIO(EC_JTAG_TCK, PIN(C, 6), GPIO_INPUT) +GPIO(EC_JTAG_TMS, PIN(C, 7), GPIO_INPUT) +GPIO(EC_JTAG_TDO, PIN(C, 8), GPIO_INPUT) +GPIO(EC_JTAG_TDI, PIN(C, 9), GPIO_INPUT) +GPIO(ENTERING_RW, PIN(B, 5), GPIO_OUT_LOW) +GPIO(PD_DISABLE_DEBUG, PIN(E, 15), GPIO_OUT_HIGH) +GPIO(PD_DEBUG_EN_L, PIN(D, 4), GPIO_INPUT | GPIO_PULL_UP) +GPIO(PD_SPI_PP3300_EN_L, PIN(A, 7), GPIO_OUT_HIGH) +GPIO(BST_DISABLE, PIN(A, 3), GPIO_OUT_LOW) #if 0 /* Alternate functions */ -GPIO(EC_UART_TX, C, 4, GPIO_OUT_LOW) -GPIO(EC_UART_RX, C, 5, GPIO_INPUT) -GPIO(AP_UART_TX, D, 5, GPIO_OUT_LOW) -GPIO(AP_UART_RX, D, 6, GPIO_INPUT) +GPIO(EC_UART_TX, PIN(C, 4), GPIO_OUT_LOW) +GPIO(EC_UART_RX, PIN(C, 5), GPIO_INPUT) +GPIO(AP_UART_TX, PIN(D, 5), GPIO_OUT_LOW) +GPIO(AP_UART_RX, PIN(D, 6), GPIO_INPUT) #endif -ALTERNATE(B, 0x0008, 0, MODULE_USB_PD, 0) /* SPI1: SCK(PB3) */ -ALTERNATE(B, 0x2000, 0, MODULE_USB_PD, 0) /* SPI2: SCK(PB13) */ -ALTERNATE(B, 0x0002, 0, MODULE_USB_PD, 0) /* TIM14_CH1: PB1) */ -ALTERNATE(E, 0x0002, 0, MODULE_USB_PD, 0) /* TIM17_CH1: PE1) */ -ALTERNATE(A, 0x0600, 1, MODULE_UART, 0) /* USART1: PA9/PA10 */ -ALTERNATE(D, 0x0060, 0, MODULE_UART, 0) /* USART2: PD5/PD6 */ -ALTERNATE(C, 0x0030, 1, MODULE_UART, 0) /* USART3: PC4/PC5 */ -ALTERNATE(B, 0x0cc0, 1, MODULE_I2C, 0) /* I2C SLAVE:PB6/7 MASTER:PB10/11 */ +ALTERNATE(PIN_MASK(B, 0x0008), 0, MODULE_USB_PD, 0) /* SPI1: SCK(PB3) */ +ALTERNATE(PIN_MASK(B, 0x2000), 0, MODULE_USB_PD, 0) /* SPI2: SCK(PB13) */ +ALTERNATE(PIN_MASK(B, 0x0002), 0, MODULE_USB_PD, 0) /* TIM14_CH1: PB1) */ +ALTERNATE(PIN_MASK(E, 0x0002), 0, MODULE_USB_PD, 0) /* TIM17_CH1: PE1) */ +ALTERNATE(PIN_MASK(A, 0x0600), 1, MODULE_UART, 0) /* USART1: PA9/PA10 */ +ALTERNATE(PIN_MASK(D, 0x0060), 0, MODULE_UART, 0) /* USART2: PD5/PD6 */ +ALTERNATE(PIN_MASK(C, 0x0030), 1, MODULE_UART, 0) /* USART3: PC4/PC5 */ +ALTERNATE(PIN_MASK(B, 0x0cc0), 1, MODULE_I2C, 0) /* I2C SLAVE:PB6/7 MASTER:PB10/11 */ diff --git a/board/snow/gpio.inc b/board/snow/gpio.inc index db7d92d3ca..359530bf81 100644 --- a/board/snow/gpio.inc +++ b/board/snow/gpio.inc @@ -6,65 +6,65 @@ */ /* Inputs with interrupt handlers are first for efficiency */ -GPIO_INT(KB_PWR_ON_L, B, 5, GPIO_INT_BOTH, power_signal_interrupt) /* Keyboard power button */ -GPIO_INT(PP1800_LDO2, A, 1, GPIO_INT_BOTH, power_signal_interrupt) /* LDO2 is ON (end of PMIC sequence) */ -GPIO_INT(SOC1V8_XPSHOLD, A, 3, GPIO_INT_BOTH, power_signal_interrupt) /* App Processor ON */ -GPIO_INT(CHARGER_INT_L, C, 4, GPIO_INT_FALLING, pmu_irq_handler) -GPIO_INT(LID_OPEN, C, 13, GPIO_INT_BOTH, lid_interrupt) /* LID switch detection */ -GPIO_INT(SUSPEND_L, A, 7, INT_BOTH_FLOATING, power_signal_interrupt) /* AP suspend/resume state */ -GPIO_INT(SPI1_NSS, A, 4, GPIO_DEFAULT, spi_event) +GPIO_INT(KB_PWR_ON_L, PIN(B, 5), GPIO_INT_BOTH, power_signal_interrupt) /* Keyboard power button */ +GPIO_INT(PP1800_LDO2, PIN(A, 1), GPIO_INT_BOTH, power_signal_interrupt) /* LDO2 is ON (end of PMIC sequence) */ +GPIO_INT(SOC1V8_XPSHOLD, PIN(A, 3), GPIO_INT_BOTH, power_signal_interrupt) /* App Processor ON */ +GPIO_INT(CHARGER_INT_L, PIN(C, 4), GPIO_INT_FALLING, pmu_irq_handler) +GPIO_INT(LID_OPEN, PIN(C, 13), GPIO_INT_BOTH, lid_interrupt) /* LID switch detection */ +GPIO_INT(SUSPEND_L, PIN(A, 7), INT_BOTH_FLOATING, power_signal_interrupt) /* AP suspend/resume state */ +GPIO_INT(SPI1_NSS, PIN(A, 4), GPIO_DEFAULT, spi_event) /* Keyboard inputs */ -GPIO_INT(KB_IN00, C, 8, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN01, C, 9, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN02, C, 10, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN03, C, 11, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN04, C, 12, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN05, C, 14, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN06, C, 15, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN07, D, 2, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN00, PIN(C, 8), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN01, PIN(C, 9), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN02, PIN(C, 10), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN03, PIN(C, 11), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN04, PIN(C, 12), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN05, PIN(C, 14), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN06, PIN(C, 15), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN07, PIN(D, 2), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) /* Other inputs */ -GPIO(AC_PWRBTN_L, A, 0, GPIO_INT_BOTH) -GPIO(WP_L, B, 4, GPIO_INPUT) /* Write protection pin (low active) */ +GPIO(AC_PWRBTN_L, PIN(A, 0), GPIO_INT_BOTH) +GPIO(WP_L, PIN(B, 4), GPIO_INPUT) /* Write protection pin (low active) */ /* * I2C pins should be configured as inputs until I2C module is * initialized. This will avoid driving the lines unintentionally. */ -GPIO(I2C1_SCL, B, 6, GPIO_INPUT) -GPIO(I2C1_SDA, B, 7, GPIO_INPUT) -GPIO(I2C2_SCL, B, 10, GPIO_INPUT) -GPIO(I2C2_SDA, B, 11, GPIO_INPUT) +GPIO(I2C1_SCL, PIN(B, 6), GPIO_INPUT) +GPIO(I2C1_SDA, PIN(B, 7), GPIO_INPUT) +GPIO(I2C2_SCL, PIN(B, 10), GPIO_INPUT) +GPIO(I2C2_SDA, PIN(B, 11), GPIO_INPUT) /* Outputs */ -GPIO(AC_STATUS, A, 5, GPIO_DEFAULT) -GPIO(SPI1_MISO, A, 6, GPIO_DEFAULT) -GPIO(EN_PP1350, A, 2, GPIO_OUT_LOW) /* DDR 1.35v rail enable */ -GPIO(EN_PP5000, A, 11, GPIO_OUT_LOW) /* 5.0v rail enable */ -GPIO(EN_PP3300, A, 8, GPIO_OUT_LOW) /* 3.3v rail enable */ -GPIO(PMIC_PWRON_L,A, 12, GPIO_OUT_HIGH) /* 5v rail ready */ -GPIO(PMIC_RESET, A, 15, GPIO_OUT_LOW) /* Force hard reset of the pmic */ +GPIO(AC_STATUS, PIN(A, 5), GPIO_DEFAULT) +GPIO(SPI1_MISO, PIN(A, 6), GPIO_DEFAULT) +GPIO(EN_PP1350, PIN(A, 2), GPIO_OUT_LOW) /* DDR 1.35v rail enable */ +GPIO(EN_PP5000, PIN(A, 11), GPIO_OUT_LOW) /* 5.0v rail enable */ +GPIO(EN_PP3300, PIN(A, 8), GPIO_OUT_LOW) /* 3.3v rail enable */ +GPIO(PMIC_PWRON_L,PIN(A, 12), GPIO_OUT_HIGH) /* 5v rail ready */ +GPIO(PMIC_RESET, PIN(A, 15), GPIO_OUT_LOW) /* Force hard reset of the pmic */ /* EC is R/W mode for the kbc mux */ -GPIO(ENTERING_RW, D, 0, GPIO_OUT_LOW) -GPIO(CHARGER_EN, B, 2, GPIO_OUT_LOW) -GPIO(EC_INT, B, 9, GPIO_ODR_HIGH) +GPIO(ENTERING_RW, PIN(D, 0), GPIO_OUT_LOW) +GPIO(CHARGER_EN, PIN(B, 2), GPIO_OUT_LOW) +GPIO(EC_INT, PIN(B, 9), GPIO_ODR_HIGH) /* To audio codec (KB noise cancellation) */ -GPIO(CODEC_INT, D, 1, GPIO_ODR_HIGH) -GPIO(LED_POWER_L, B, 3, GPIO_INPUT) /* Keyboard power LED */ -GPIO(KB_OUT00, B, 0, GPIO_KB_OUTPUT) -GPIO(KB_OUT01, B, 8, GPIO_KB_OUTPUT) -GPIO(KB_OUT02, B, 12, GPIO_KB_OUTPUT) -GPIO(KB_OUT03, B, 13, GPIO_KB_OUTPUT) -GPIO(KB_OUT04, B, 14, GPIO_KB_OUTPUT) -GPIO(KB_OUT05, B, 15, GPIO_KB_OUTPUT) -GPIO(KB_OUT06, C, 0, GPIO_KB_OUTPUT) -GPIO(KB_OUT07, C, 1, GPIO_KB_OUTPUT) -GPIO(KB_OUT08, C, 2, GPIO_KB_OUTPUT) -GPIO(KB_OUT09, B, 1, GPIO_KB_OUTPUT) -GPIO(KB_OUT10, C, 5, GPIO_KB_OUTPUT) -GPIO(KB_OUT11, C, 6, GPIO_KB_OUTPUT) -GPIO(KB_OUT12, C, 7, GPIO_KB_OUTPUT) +GPIO(CODEC_INT, PIN(D, 1), GPIO_ODR_HIGH) +GPIO(LED_POWER_L, PIN(B, 3), GPIO_INPUT) /* Keyboard power LED */ +GPIO(KB_OUT00, PIN(B, 0), GPIO_KB_OUTPUT) +GPIO(KB_OUT01, PIN(B, 8), GPIO_KB_OUTPUT) +GPIO(KB_OUT02, PIN(B, 12), GPIO_KB_OUTPUT) +GPIO(KB_OUT03, PIN(B, 13), GPIO_KB_OUTPUT) +GPIO(KB_OUT04, PIN(B, 14), GPIO_KB_OUTPUT) +GPIO(KB_OUT05, PIN(B, 15), GPIO_KB_OUTPUT) +GPIO(KB_OUT06, PIN(C, 0), GPIO_KB_OUTPUT) +GPIO(KB_OUT07, PIN(C, 1), GPIO_KB_OUTPUT) +GPIO(KB_OUT08, PIN(C, 2), GPIO_KB_OUTPUT) +GPIO(KB_OUT09, PIN(B, 1), GPIO_KB_OUTPUT) +GPIO(KB_OUT10, PIN(C, 5), GPIO_KB_OUTPUT) +GPIO(KB_OUT11, PIN(C, 6), GPIO_KB_OUTPUT) +GPIO(KB_OUT12, PIN(C, 7), GPIO_KB_OUTPUT) diff --git a/board/speedy/gpio.inc b/board/speedy/gpio.inc index 294b097766..79b05dc73f 100644 --- a/board/speedy/gpio.inc +++ b/board/speedy/gpio.inc @@ -6,54 +6,54 @@ */ /* Inputs with interrupt handlers are first for efficiency */ -GPIO_INT(POWER_BUTTON_L, B, 5, GPIO_INT_BOTH, power_button_interrupt) /* wk6 */ /* active high, the name is for compatibility with existing code */ -GPIO_INT(SOC_POWER_GOOD, A, 3, GPIO_INT_BOTH, power_signal_interrupt) -GPIO_INT(LID_OPEN, C, 13, GPIO_INT_BOTH, lid_interrupt) -GPIO_INT(SUSPEND_L, C, 7, GPIO_INT_BOTH, power_signal_interrupt) -GPIO_INT(SPI1_NSS, A, 4, GPIO_INT_BOTH, spi_event) -GPIO_INT(AC_PRESENT, A, 8, GPIO_INT_BOTH | GPIO_PULL_UP, extpower_interrupt) +GPIO_INT(POWER_BUTTON_L, PIN(B, 5), GPIO_INT_BOTH, power_button_interrupt) /* wk6 */ /* active high, the name is for compatibility with existing code */ +GPIO_INT(SOC_POWER_GOOD, PIN(A, 3), GPIO_INT_BOTH, power_signal_interrupt) +GPIO_INT(LID_OPEN, PIN(C, 13), GPIO_INT_BOTH, lid_interrupt) +GPIO_INT(SUSPEND_L, PIN(C, 7), GPIO_INT_BOTH, power_signal_interrupt) +GPIO_INT(SPI1_NSS, PIN(A, 4), GPIO_INT_BOTH, spi_event) +GPIO_INT(AC_PRESENT, PIN(A, 8), GPIO_INT_BOTH | GPIO_PULL_UP, extpower_interrupt) /* Keyboard inputs */ -GPIO_INT(KB_IN00, C, 8, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN01, C, 9, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN02, C, 10, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN03, C, 11, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN04, C, 12, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN05, C, 14, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN06, C, 15, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN07, D, 2, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN00, PIN(C, 8), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN01, PIN(C, 9), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN02, PIN(C, 10), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN03, PIN(C, 11), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN04, PIN(C, 12), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN05, PIN(C, 14), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN06, PIN(C, 15), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN07, PIN(D, 2), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) /* Other inputs */ -GPIO(EC_WAKE, A, 0, GPIO_INPUT | GPIO_PULL_DOWN) /* wk1 */ -GPIO(WP_L, B, 4, GPIO_INPUT) +GPIO(EC_WAKE, PIN(A, 0), GPIO_INPUT | GPIO_PULL_DOWN) /* wk1 */ +GPIO(WP_L, PIN(B, 4), GPIO_INPUT) /* Outputs */ -GPIO(BAT_LED0, B, 11, GPIO_OUT_LOW) -GPIO(BAT_LED1, A, 11, GPIO_OUT_LOW) -GPIO(EC_BL_OVERRIDE, F, 1, GPIO_OUT_LOW) -GPIO(EC_INT, B, 9, GPIO_OUT_LOW) -GPIO(ENTERING_RW, F, 0, GPIO_OUT_LOW) -GPIO(I2C1_SCL, B, 6, GPIO_ODR_HIGH) -GPIO(I2C1_SDA, B, 7, GPIO_ODR_HIGH) -GPIO(KB_OUT00, B, 0, GPIO_KB_OUTPUT) -GPIO(KB_OUT01, B, 8, GPIO_KB_OUTPUT) -GPIO(KB_OUT02, B, 12, GPIO_OUT_LOW) /* Inverted from silegro */ -GPIO(KB_OUT03, B, 13, GPIO_KB_OUTPUT) -GPIO(KB_OUT04, B, 14, GPIO_KB_OUTPUT) -GPIO(KB_OUT05, B, 15, GPIO_KB_OUTPUT) -GPIO(KB_OUT06, C, 0, GPIO_KB_OUTPUT) -GPIO(KB_OUT07, C, 1, GPIO_KB_OUTPUT) -GPIO(KB_OUT08, C, 2, GPIO_KB_OUTPUT) -GPIO(KB_OUT09, B, 1, GPIO_KB_OUTPUT) -GPIO(KB_OUT10, C, 5, GPIO_KB_OUTPUT) -GPIO(KB_OUT11, C, 4, GPIO_KB_OUTPUT) -GPIO(KB_OUT12, A, 13, GPIO_KB_OUTPUT) -GPIO(POWER_LED, A, 2, GPIO_OUT_LOW) -GPIO(PMIC_PWRON, A, 12, GPIO_OUT_LOW) -GPIO(PMIC_RESET, B, 3, GPIO_OUT_LOW) -GPIO(PMIC_SOURCE_PWREN, B, 10, GPIO_OUT_LOW) -GPIO(PMIC_WARM_RESET_L, C, 3, GPIO_ODR_HIGH) +GPIO(BAT_LED0, PIN(B, 11), GPIO_OUT_LOW) +GPIO(BAT_LED1, PIN(A, 11), GPIO_OUT_LOW) +GPIO(EC_BL_OVERRIDE, PIN(F, 1), GPIO_OUT_LOW) +GPIO(EC_INT, PIN(B, 9), GPIO_OUT_LOW) +GPIO(ENTERING_RW, PIN(F, 0), GPIO_OUT_LOW) +GPIO(I2C1_SCL, PIN(B, 6), GPIO_ODR_HIGH) +GPIO(I2C1_SDA, PIN(B, 7), GPIO_ODR_HIGH) +GPIO(KB_OUT00, PIN(B, 0), GPIO_KB_OUTPUT) +GPIO(KB_OUT01, PIN(B, 8), GPIO_KB_OUTPUT) +GPIO(KB_OUT02, PIN(B, 12), GPIO_OUT_LOW) /* Inverted from silegro */ +GPIO(KB_OUT03, PIN(B, 13), GPIO_KB_OUTPUT) +GPIO(KB_OUT04, PIN(B, 14), GPIO_KB_OUTPUT) +GPIO(KB_OUT05, PIN(B, 15), GPIO_KB_OUTPUT) +GPIO(KB_OUT06, PIN(C, 0), GPIO_KB_OUTPUT) +GPIO(KB_OUT07, PIN(C, 1), GPIO_KB_OUTPUT) +GPIO(KB_OUT08, PIN(C, 2), GPIO_KB_OUTPUT) +GPIO(KB_OUT09, PIN(B, 1), GPIO_KB_OUTPUT) +GPIO(KB_OUT10, PIN(C, 5), GPIO_KB_OUTPUT) +GPIO(KB_OUT11, PIN(C, 4), GPIO_KB_OUTPUT) +GPIO(KB_OUT12, PIN(A, 13), GPIO_KB_OUTPUT) +GPIO(POWER_LED, PIN(A, 2), GPIO_OUT_LOW) +GPIO(PMIC_PWRON, PIN(A, 12), GPIO_OUT_LOW) +GPIO(PMIC_RESET, PIN(B, 3), GPIO_OUT_LOW) +GPIO(PMIC_SOURCE_PWREN, PIN(B, 10), GPIO_OUT_LOW) +GPIO(PMIC_WARM_RESET_L, PIN(C, 3), GPIO_ODR_HIGH) -ALTERNATE(A, 0x00f0, 0, MODULE_SPI, 0) -ALTERNATE(A, 0x0600, 1, MODULE_UART, 0) -ALTERNATE(B, 0x00c0, 1, MODULE_I2C, 0) +ALTERNATE(PIN_MASK(A, 0x00f0), 0, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(A, 0x0600), 1, MODULE_UART, 0) +ALTERNATE(PIN_MASK(B, 0x00c0), 1, MODULE_I2C, 0) diff --git a/board/spring/gpio.inc b/board/spring/gpio.inc index eedef23fbc..cb7c2b7e94 100644 --- a/board/spring/gpio.inc +++ b/board/spring/gpio.inc @@ -7,59 +7,59 @@ /* Inputs with interrupt handlers are first for efficiency */ /* Keyboard power button */ -GPIO_INT(KB_PWR_ON_L, B, 5, GPIO_INT_BOTH, power_signal_interrupt) -GPIO_INT(PP1800_LDO2, A, 1, GPIO_INT_BOTH, power_signal_interrupt) /* LDO2 is ON (end of PMIC sequence) */ -GPIO_INT(SOC1V8_XPSHOLD, A, 3, GPIO_INT_BOTH, power_signal_interrupt) /* App Processor ON */ -GPIO_INT(CHARGER_INT_L, C, 4, GPIO_INT_FALLING, pmu_irq_handler) -GPIO_INT(LID_OPEN, C, 13, GPIO_INT_BOTH, lid_interrupt) /* LID switch detection */ -GPIO_INT(SUSPEND_L, A, 7, INT_BOTH_FLOATING, power_signal_interrupt) /* AP suspend/resume state */ +GPIO_INT(KB_PWR_ON_L, PIN(B, 5), GPIO_INT_BOTH, power_signal_interrupt) +GPIO_INT(PP1800_LDO2, PIN(A, 1), GPIO_INT_BOTH, power_signal_interrupt) /* LDO2 is ON (end of PMIC sequence) */ +GPIO_INT(SOC1V8_XPSHOLD, PIN(A, 3), GPIO_INT_BOTH, power_signal_interrupt) /* App Processor ON */ +GPIO_INT(CHARGER_INT_L, PIN(C, 4), GPIO_INT_FALLING, pmu_irq_handler) +GPIO_INT(LID_OPEN, PIN(C, 13), GPIO_INT_BOTH, lid_interrupt) /* LID switch detection */ +GPIO_INT(SUSPEND_L, PIN(A, 7), INT_BOTH_FLOATING, power_signal_interrupt) /* AP suspend/resume state */ /* Keyboard inputs */ -GPIO_INT(KB_IN00, C, 8, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN01, C, 9, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN02, C, 10, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN03, C, 11, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN04, C, 12, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN05, C, 14, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN06, C, 15, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(KB_IN07, D, 2, GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) -GPIO_INT(USB_CHG_INT, A, 6, GPIO_INT_FALLING, extpower_interrupt) +GPIO_INT(KB_IN00, PIN(C, 8), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN01, PIN(C, 9), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN02, PIN(C, 10), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN03, PIN(C, 11), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN04, PIN(C, 12), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN05, PIN(C, 14), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN06, PIN(C, 15), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(KB_IN07, PIN(D, 2), GPIO_KB_INPUT, keyboard_raw_gpio_interrupt) +GPIO_INT(USB_CHG_INT, PIN(A, 6), GPIO_INT_FALLING, extpower_interrupt) /* Other inputs */ -GPIO(BCHGR_VACG, A, 0, GPIO_INT_BOTH) /* AC good on TPSChrome */ -GPIO(WP_L, A, 13, GPIO_INPUT) /* Write protection pin (low active) */ +GPIO(BCHGR_VACG, PIN(A, 0), GPIO_INT_BOTH) /* AC good on TPSChrome */ +GPIO(WP_L, PIN(A, 13), GPIO_INPUT) /* Write protection pin (low active) */ /* * I2C pins should be configured as inputs until I2C module is * initialized. This will avoid driving the lines unintentionally. */ -GPIO(I2C1_SCL, B, 6, GPIO_INPUT) -GPIO(I2C1_SDA, B, 7, GPIO_INPUT) -GPIO(I2C2_SCL, B, 10, GPIO_INPUT) -GPIO(I2C2_SDA, B, 11, GPIO_INPUT) +GPIO(I2C1_SCL, PIN(B, 6), GPIO_INPUT) +GPIO(I2C1_SDA, PIN(B, 7), GPIO_INPUT) +GPIO(I2C2_SCL, PIN(B, 10), GPIO_INPUT) +GPIO(I2C2_SDA, PIN(B, 11), GPIO_INPUT) /* Outputs */ -GPIO(EN_PP1350, A, 14, GPIO_OUT_LOW) /* DDR 1.35v rail enable */ -GPIO(EN_PP5000, A, 11, GPIO_OUT_LOW) /* 5.0v rail enable */ -GPIO(EN_PP3300, A, 8, GPIO_OUT_LOW) /* 3.3v rail enable */ -GPIO(PMIC_PWRON_L,A, 12, GPIO_OUT_HIGH) /* 5v rail ready */ -GPIO(PMIC_RESET, A, 15, GPIO_OUT_LOW) /* Force hard reset of the pmic */ -GPIO(ENTERING_RW, D, 0, GPIO_OUT_LOW) /* EC is R/W mode for the kbc mux */ -GPIO(CHARGER_EN, B, 2, GPIO_OUT_LOW) -GPIO(EC_INT, B, 9, GPIO_ODR_HIGH) -GPIO(ID_MUX, D, 1, GPIO_OUT_LOW) -GPIO(KB_OUT00, B, 0, GPIO_KB_OUTPUT) -GPIO(KB_OUT01, B, 8, GPIO_KB_OUTPUT) -GPIO(KB_OUT02, B, 12, GPIO_KB_OUTPUT) -GPIO(KB_OUT03, B, 13, GPIO_KB_OUTPUT) -GPIO(KB_OUT04, B, 14, GPIO_KB_OUTPUT) -GPIO(KB_OUT05, B, 15, GPIO_KB_OUTPUT) -GPIO(KB_OUT06, C, 0, GPIO_KB_OUTPUT) -GPIO(KB_OUT07, C, 1, GPIO_KB_OUTPUT) -GPIO(KB_OUT08, C, 2, GPIO_KB_OUTPUT) -GPIO(KB_OUT09, B, 1, GPIO_KB_OUTPUT) -GPIO(KB_OUT10, C, 5, GPIO_KB_OUTPUT) -GPIO(KB_OUT11, C, 6, GPIO_KB_OUTPUT) -GPIO(KB_OUT12, C, 7, GPIO_KB_OUTPUT) -GPIO(BOOST_EN, B, 3, GPIO_OUT_HIGH) -GPIO(ILIM, B, 4, GPIO_OUT_LOW) +GPIO(EN_PP1350, PIN(A, 14), GPIO_OUT_LOW) /* DDR 1.35v rail enable */ +GPIO(EN_PP5000, PIN(A, 11), GPIO_OUT_LOW) /* 5.0v rail enable */ +GPIO(EN_PP3300, PIN(A, 8), GPIO_OUT_LOW) /* 3.3v rail enable */ +GPIO(PMIC_PWRON_L,PIN(A, 12), GPIO_OUT_HIGH) /* 5v rail ready */ +GPIO(PMIC_RESET, PIN(A, 15), GPIO_OUT_LOW) /* Force hard reset of the pmic */ +GPIO(ENTERING_RW, PIN(D, 0), GPIO_OUT_LOW) /* EC is R/W mode for the kbc mux */ +GPIO(CHARGER_EN, PIN(B, 2), GPIO_OUT_LOW) +GPIO(EC_INT, PIN(B, 9), GPIO_ODR_HIGH) +GPIO(ID_MUX, PIN(D, 1), GPIO_OUT_LOW) +GPIO(KB_OUT00, PIN(B, 0), GPIO_KB_OUTPUT) +GPIO(KB_OUT01, PIN(B, 8), GPIO_KB_OUTPUT) +GPIO(KB_OUT02, PIN(B, 12), GPIO_KB_OUTPUT) +GPIO(KB_OUT03, PIN(B, 13), GPIO_KB_OUTPUT) +GPIO(KB_OUT04, PIN(B, 14), GPIO_KB_OUTPUT) +GPIO(KB_OUT05, PIN(B, 15), GPIO_KB_OUTPUT) +GPIO(KB_OUT06, PIN(C, 0), GPIO_KB_OUTPUT) +GPIO(KB_OUT07, PIN(C, 1), GPIO_KB_OUTPUT) +GPIO(KB_OUT08, PIN(C, 2), GPIO_KB_OUTPUT) +GPIO(KB_OUT09, PIN(B, 1), GPIO_KB_OUTPUT) +GPIO(KB_OUT10, PIN(C, 5), GPIO_KB_OUTPUT) +GPIO(KB_OUT11, PIN(C, 6), GPIO_KB_OUTPUT) +GPIO(KB_OUT12, PIN(C, 7), GPIO_KB_OUTPUT) +GPIO(BOOST_EN, PIN(B, 3), GPIO_OUT_HIGH) +GPIO(ILIM, PIN(B, 4), GPIO_OUT_LOW) diff --git a/board/squawks/gpio.inc b/board/squawks/gpio.inc index 78f7ad4d06..ada4e5080f 100644 --- a/board/squawks/gpio.inc +++ b/board/squawks/gpio.inc @@ -6,73 +6,73 @@ */ /* Inputs with interrupt handlers are first for efficiency */ -GPIO_INT(POWER_BUTTON_L, A, 2, GPIO_INT_BOTH_DSLEEP, power_button_interrupt) /* Power button */ -GPIO_INT(LID_OPEN, A, 3, GPIO_INT_BOTH_DSLEEP, lid_interrupt) /* Lid switch */ -GPIO_INT(AC_PRESENT, H, 3, GPIO_INT_BOTH_DSLEEP, extpower_interrupt) /* AC power present */ -GPIO_INT(PCH_SLP_S3_L, G, 7, GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, power_signal_interrupt) /* SLP_S3# signal from PCH */ -GPIO_INT(PCH_SLP_S4_L, H, 1, GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, power_signal_interrupt) /* SLP_S4# signal from PCH */ -GPIO_INT(PP1050_PGOOD, H, 4, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 1.05V */ -GPIO_INT(PP3300_PCH_PGOOD, C, 4, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 3.3V (PCH supply) */ -GPIO_INT(PP5000_PGOOD, N, 0, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 5V */ -GPIO_INT(S5_PGOOD, G, 0, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on S5 supplies */ -GPIO_INT(VCORE_PGOOD, C, 6, GPIO_INT_BOTH, power_signal_interrupt) /* Power good on core VR */ -GPIO_INT(WP_L, A, 4, GPIO_INT_BOTH, switch_interrupt) /* Write protect input */ -GPIO_INT(JTAG_TCK, C, 0, GPIO_DEFAULT, jtag_interrupt) /* JTAG clock input */ -GPIO_INT(UART0_RX, A, 0, GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, uart_deepsleep_interrupt) /* UART0 RX input */ +GPIO_INT(POWER_BUTTON_L, PIN(A, 2), GPIO_INT_BOTH_DSLEEP, power_button_interrupt) /* Power button */ +GPIO_INT(LID_OPEN, PIN(A, 3), GPIO_INT_BOTH_DSLEEP, lid_interrupt) /* Lid switch */ +GPIO_INT(AC_PRESENT, PIN(H, 3), GPIO_INT_BOTH_DSLEEP, extpower_interrupt) /* AC power present */ +GPIO_INT(PCH_SLP_S3_L, PIN(G, 7), GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, power_signal_interrupt) /* SLP_S3# signal from PCH */ +GPIO_INT(PCH_SLP_S4_L, PIN(H, 1), GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, power_signal_interrupt) /* SLP_S4# signal from PCH */ +GPIO_INT(PP1050_PGOOD, PIN(H, 4), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 1.05V */ +GPIO_INT(PP3300_PCH_PGOOD, PIN(C, 4), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 3.3V (PCH supply) */ +GPIO_INT(PP5000_PGOOD, PIN(N, 0), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on 5V */ +GPIO_INT(S5_PGOOD, PIN(G, 0), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on S5 supplies */ +GPIO_INT(VCORE_PGOOD, PIN(C, 6), GPIO_INT_BOTH, power_signal_interrupt) /* Power good on core VR */ +GPIO_INT(WP_L, PIN(A, 4), GPIO_INT_BOTH, switch_interrupt) /* Write protect input */ +GPIO_INT(JTAG_TCK, PIN(C, 0), GPIO_DEFAULT, jtag_interrupt) /* JTAG clock input */ +GPIO_INT(UART0_RX, PIN(A, 0), GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, uart_deepsleep_interrupt) /* UART0 RX input */ /* Other inputs */ -GPIO(BOARD_VERSION1, Q, 5, GPIO_INPUT) /* Board version stuffing resistor 1 */ -GPIO(BOARD_VERSION2, Q, 6, GPIO_INPUT) /* Board version stuffing resistor 2 */ -GPIO(BOARD_VERSION3, Q, 7, GPIO_INPUT) /* Board version stuffing resistor 3 */ +GPIO(BOARD_VERSION1, PIN(Q, 5), GPIO_INPUT) /* Board version stuffing resistor 1 */ +GPIO(BOARD_VERSION2, PIN(Q, 6), GPIO_INPUT) /* Board version stuffing resistor 2 */ +GPIO(BOARD_VERSION3, PIN(Q, 7), GPIO_INPUT) /* Board version stuffing resistor 3 */ #ifdef CONFIG_CHIPSET_DEBUG -GPIO(PCH_SLP_SX_L, G, 3, GPIO_INPUT | GPIO_PULL_UP) /* SLP_S0IX# signal from PCH */ -GPIO(PCH_SUS_STAT_L, G, 6, GPIO_INPUT | GPIO_PULL_UP) /* SUS_STAT# signal from PCH */ -GPIO(PCH_SUSPWRDNACK, G, 2, GPIO_INPUT | GPIO_PULL_UP) /* SUSPWRDNACK signal from PCH */ +GPIO(PCH_SLP_SX_L, PIN(G, 3), GPIO_INPUT | GPIO_PULL_UP) /* SLP_S0IX# signal from PCH */ +GPIO(PCH_SUS_STAT_L, PIN(G, 6), GPIO_INPUT | GPIO_PULL_UP) /* SUS_STAT# signal from PCH */ +GPIO(PCH_SUSPWRDNACK, PIN(G, 2), GPIO_INPUT | GPIO_PULL_UP) /* SUSPWRDNACK signal from PCH */ #endif -GPIO(PP1000_S0IX_PGOOD, H, 6, GPIO_INPUT) /* Power good on 1.00V (S0iX supplies) */ -GPIO(USB1_OC_L, E, 7, GPIO_INPUT) /* USB port overcurrent warning */ -GPIO(USB2_OC_L, E, 0, GPIO_INPUT) /* USB port overcurrent warning */ +GPIO(PP1000_S0IX_PGOOD, PIN(H, 6), GPIO_INPUT) /* Power good on 1.00V (S0iX supplies) */ +GPIO(USB1_OC_L, PIN(E, 7), GPIO_INPUT) /* USB port overcurrent warning */ +GPIO(USB2_OC_L, PIN(E, 0), GPIO_INPUT) /* USB port overcurrent warning */ /* Outputs; all unasserted by default except for reset signals */ -GPIO(CPU_PROCHOT, B, 5, GPIO_OUT_LOW) /* Force CPU to think it's overheated */ -GPIO(ENABLE_BACKLIGHT, M, 7, GPIO_ODR_HIGH) /* Enable backlight power */ -GPIO(ENABLE_TOUCHPAD, N, 1, GPIO_OUT_LOW) /* Enable touchpad power */ -GPIO(ENTERING_RW, D, 6, GPIO_OUT_LOW) /* Indicate when EC is entering RW code */ -GPIO(LPC_CLKRUN_L, M, 2, GPIO_ODR_HIGH) /* Request that PCH drive LPC clock */ -GPIO(PCH_CORE_PWROK, F, 5, GPIO_OUT_LOW) /* Indicate core well power is stable */ -GPIO(PCH_PWRBTN_L, H, 0, GPIO_ODR_HIGH) /* Power button output to PCH */ -GPIO(PCH_RCIN_L, F, 3, GPIO_ODR_HIGH) /* Reset line to PCH (for 8042 emulation) */ -GPIO(PCH_RSMRST_L, F, 1, GPIO_OUT_LOW) /* Reset PCH resume power plane logic */ -GPIO(PCH_SMI_L, F, 4, GPIO_ODR_HIGH) /* System management interrupt to PCH */ -GPIO(PCH_SOC_OVERRIDE, G, 1, GPIO_OUT_LOW) /* SOC override signal to PCH; when high, ME ignores security descriptor */ -GPIO(PCH_SYS_PWROK, J, 1, GPIO_OUT_LOW) /* EC thinks everything is up and ready */ -GPIO(PCH_WAKE_L, F, 0, GPIO_ODR_HIGH) /* Wake signal from EC to PCH */ -GPIO(PP1350_EN, H, 5, GPIO_OUT_LOW) /* Enable 1.35V supply */ -GPIO(PP3300_DX_EN, J, 2, GPIO_OUT_LOW) /* Enable power to lots of peripherals */ -GPIO(PP3300_LTE_EN, D, 4, GPIO_OUT_LOW) /* Enable LTE radio */ -GPIO(PP3300_WLAN_EN, J, 0, GPIO_OUT_LOW) /* Enable WiFi power */ -GPIO(PP5000_EN, H, 7, GPIO_OUT_LOW) /* Enable 5V supply */ -GPIO(PPSX_EN, L, 6, GPIO_OUT_LOW) /* Enable PP1350_PCH_SX, PP1000_PCH_SX */ -GPIO(SUSP_VR_EN, C, 7, GPIO_OUT_LOW) /* Enable 1.05V regulator */ -GPIO(TOUCHSCREEN_RESET_L, N, 7, GPIO_OUT_LOW) /* Reset touch screen */ -GPIO(USB_CTL1, E, 6, GPIO_OUT_LOW) /* USB control signal 1 to both ports */ -GPIO(USB_ILIM_SEL, E, 5, GPIO_OUT_LOW) /* USB current limit to both ports */ -GPIO(USB1_ENABLE, E, 4, GPIO_OUT_LOW) /* USB port 1 output power enable */ -GPIO(USB2_ENABLE, D, 5, GPIO_OUT_LOW) /* USB port 2 output power enable */ -GPIO(VCORE_EN, C, 5, GPIO_OUT_LOW) /* Enable core power supplies */ -GPIO(WLAN_OFF_L, J, 4, GPIO_OUT_LOW) /* Disable WiFi radio */ -GPIO(PCH_SCI_L, M, 1, GPIO_ODR_HIGH) /* Assert SCI to PCH */ -GPIO(KBD_IRQ_L, M, 3, GPIO_ODR_HIGH) /* Negative edge triggered irq. */ +GPIO(CPU_PROCHOT, PIN(B, 5), GPIO_OUT_LOW) /* Force CPU to think it's overheated */ +GPIO(ENABLE_BACKLIGHT, PIN(M, 7), GPIO_ODR_HIGH) /* Enable backlight power */ +GPIO(ENABLE_TOUCHPAD, PIN(N, 1), GPIO_OUT_LOW) /* Enable touchpad power */ +GPIO(ENTERING_RW, PIN(D, 6), GPIO_OUT_LOW) /* Indicate when EC is entering RW code */ +GPIO(LPC_CLKRUN_L, PIN(M, 2), GPIO_ODR_HIGH) /* Request that PCH drive LPC clock */ +GPIO(PCH_CORE_PWROK, PIN(F, 5), GPIO_OUT_LOW) /* Indicate core well power is stable */ +GPIO(PCH_PWRBTN_L, PIN(H, 0), GPIO_ODR_HIGH) /* Power button output to PCH */ +GPIO(PCH_RCIN_L, PIN(F, 3), GPIO_ODR_HIGH) /* Reset line to PCH (for 8042 emulation) */ +GPIO(PCH_RSMRST_L, PIN(F, 1), GPIO_OUT_LOW) /* Reset PCH resume power plane logic */ +GPIO(PCH_SMI_L, PIN(F, 4), GPIO_ODR_HIGH) /* System management interrupt to PCH */ +GPIO(PCH_SOC_OVERRIDE, PIN(G, 1), GPIO_OUT_LOW) /* SOC override signal to PCH; when high, ME ignores security descriptor */ +GPIO(PCH_SYS_PWROK, PIN(J, 1), GPIO_OUT_LOW) /* EC thinks everything is up and ready */ +GPIO(PCH_WAKE_L, PIN(F, 0), GPIO_ODR_HIGH) /* Wake signal from EC to PCH */ +GPIO(PP1350_EN, PIN(H, 5), GPIO_OUT_LOW) /* Enable 1.35V supply */ +GPIO(PP3300_DX_EN, PIN(J, 2), GPIO_OUT_LOW) /* Enable power to lots of peripherals */ +GPIO(PP3300_LTE_EN, PIN(D, 4), GPIO_OUT_LOW) /* Enable LTE radio */ +GPIO(PP3300_WLAN_EN, PIN(J, 0), GPIO_OUT_LOW) /* Enable WiFi power */ +GPIO(PP5000_EN, PIN(H, 7), GPIO_OUT_LOW) /* Enable 5V supply */ +GPIO(PPSX_EN, PIN(L, 6), GPIO_OUT_LOW) /* Enable PP1350_PCH_SX, PP1000_PCH_SX */ +GPIO(SUSP_VR_EN, PIN(C, 7), GPIO_OUT_LOW) /* Enable 1.05V regulator */ +GPIO(TOUCHSCREEN_RESET_L, PIN(N, 7), GPIO_OUT_LOW) /* Reset touch screen */ +GPIO(USB_CTL1, PIN(E, 6), GPIO_OUT_LOW) /* USB control signal 1 to both ports */ +GPIO(USB_ILIM_SEL, PIN(E, 5), GPIO_OUT_LOW) /* USB current limit to both ports */ +GPIO(USB1_ENABLE, PIN(E, 4), GPIO_OUT_LOW) /* USB port 1 output power enable */ +GPIO(USB2_ENABLE, PIN(D, 5), GPIO_OUT_LOW) /* USB port 2 output power enable */ +GPIO(VCORE_EN, PIN(C, 5), GPIO_OUT_LOW) /* Enable core power supplies */ +GPIO(WLAN_OFF_L, PIN(J, 4), GPIO_OUT_LOW) /* Disable WiFi radio */ +GPIO(PCH_SCI_L, PIN(M, 1), GPIO_ODR_HIGH) /* Assert SCI to PCH */ +GPIO(KBD_IRQ_L, PIN(M, 3), GPIO_ODR_HIGH) /* Negative edge triggered irq. */ -ALTERNATE(A, 0x03, 1, MODULE_UART, 0) /* UART0 */ -ALTERNATE(B, 0x04, 3, MODULE_I2C, 0) /* I2C0 SCL */ -ALTERNATE(B, 0x08, 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C0 SDA */ -ALTERNATE(B, 0x40, 3, MODULE_I2C, 0) /* I2C5 SCL */ -ALTERNATE(B, 0x80, 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C5 SDA */ -ALTERNATE(D, 0x0f, 2, MODULE_SPI, 0) /* SPI1 */ -ALTERNATE(L, 0x3f, 15, MODULE_LPC, 0) /* LPC */ -ALTERNATE(M, 0x21, 15, MODULE_LPC, 0) /* LPC */ -ALTERNATE(N, 0x50, 1, MODULE_PWM_LED, GPIO_OPEN_DRAIN) /* FAN0PWM 3&4 */ -ALTERNATE(M, 0x40, 1, MODULE_PWM_LED, GPIO_OPEN_DRAIN) /* FAN0PWM0 */ +ALTERNATE(PIN_MASK(A, 0x03), 1, MODULE_UART, 0) /* UART0 */ +ALTERNATE(PIN_MASK(B, 0x04), 3, MODULE_I2C, 0) /* I2C0 SCL */ +ALTERNATE(PIN_MASK(B, 0x08), 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C0 SDA */ +ALTERNATE(PIN_MASK(B, 0x40), 3, MODULE_I2C, 0) /* I2C5 SCL */ +ALTERNATE(PIN_MASK(B, 0x80), 3, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C5 SDA */ +ALTERNATE(PIN_MASK(D, 0x0f), 2, MODULE_SPI, 0) /* SPI1 */ +ALTERNATE(PIN_MASK(L, 0x3f), 15, MODULE_LPC, 0) /* LPC */ +ALTERNATE(PIN_MASK(M, 0x21), 15, MODULE_LPC, 0) /* LPC */ +ALTERNATE(PIN_MASK(N, 0x50), 1, MODULE_PWM_LED, GPIO_OPEN_DRAIN) /* FAN0PWM 3&4 */ +ALTERNATE(PIN_MASK(M, 0x40), 1, MODULE_PWM_LED, GPIO_OPEN_DRAIN) /* FAN0PWM0 */ diff --git a/board/strago/gpio.inc b/board/strago/gpio.inc index e098399765..80482d5171 100644 --- a/board/strago/gpio.inc +++ b/board/strago/gpio.inc @@ -5,116 +5,115 @@ * found in the LICENSE file. */ -GPIO_INT(LID_OPEN, PORT(2), 7, GPIO_INT_BOTH_DSLEEP, lid_interrupt) /* Lid switch */ -GPIO_INT(AC_PRESENT, PORT(3), 0, GPIO_INT_BOTH_DSLEEP, extpower_interrupt) /* BC_ACOK / EC_ACIN - to know if battery or AC connected */ -GPIO_INT(POWER_BUTTON_L, PORT(3), 5, GPIO_INT_BOTH_DSLEEP, power_button_interrupt) /* Power button */ -GPIO_INT(RSMRST_L_PGOOD, PORT(6), 3, GPIO_INT_BOTH, power_signal_interrupt) /* RSMRST_N_PWRGD from power logic */ -GPIO_INT(ALL_SYS_PGOOD, PORT(13), 0, GPIO_INT_BOTH_DSLEEP, power_signal_interrupt) /* ALL_SYS_PWRGD from power logic */ -GPIO_INT(PCH_SLP_S4_L, PORT(20), 0, GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, power_signal_interrupt) /* SLP_S4# signal from PCH */ -GPIO_INT(PCH_SLP_S3_L, PORT(20), 6, GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, power_signal_interrupt) /* SLP_S3# signal from PCH */ - -GPIO(KBD_KSO2, PORT(0), 1, GPIO_KB_OUTPUT_COL2) /* Negative edge triggered irq. */ - -GPIO(USB_ILIM_SEL, PORT(1), 3, GPIO_OUT_HIGH) /* USB current control */ - -GPIO(I2C_PORT0_SCL, PORT(1), 5, GPIO_ODR_HIGH) -GPIO(I2C_PORT0_SDA, PORT(1), 6, GPIO_ODR_HIGH) -GPIO(BOARD_ID2, PORT(1), 7, GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(I2C_PORT1_SCL, PORT(2), 2, GPIO_ODR_HIGH) -GPIO(I2C_PORT1_SDA, PORT(2), 3, GPIO_ODR_HIGH) -GPIO(I2C_PORT2_SCL, PORT(2), 0, GPIO_ODR_HIGH) -GPIO(I2C_PORT2_SDA, PORT(2), 1, GPIO_ODR_HIGH) -GPIO(I2C_PORT3_SCL, PORT(2), 4, GPIO_ODR_HIGH) -GPIO(I2C_PORT3_SDA, PORT(2), 5, GPIO_ODR_HIGH) - -GPIO(PCH_SCI_L, PORT(2), 6, GPIO_ODR_HIGH) /* SCI output */ - -GPIO(VOLUME_UP, PORT(3), 1, GPIO_INT_FALLING) /* Volume up button */ -GPIO(VOLUME_DOWN, PORT(3), 4, GPIO_INT_FALLING) /* Volume down button */ -GPIO(USB2_PWR_EN, PORT(3), 6, GPIO_OUT_LOW) /* Enable power for USB2 Port */ - -GPIO(ENTERING_RW, PORT(4), 1, GPIO_OUT_LOW) /* Indicate when EC is entering RW code */ -GPIO(PCH_SMI_L, PORT(4), 4, GPIO_ODR_HIGH) /* SMI output */ -GPIO(USB_OC1_L, PORT(4), 5, GPIO_INT_FALLING) /* DB2 BC1.2 over current signal to EC */ -GPIO(DP_USB_C_HPD_Q, PORT(4), 6, GPIO_OUT_HIGH) /* DP hot plug detect from EC to SOC */ -GPIO(PWR_BTN_SELECT, PORT(4), 7, GPIO_OUT_HIGH) /* HIGH in clamshell mode and LOW in tablet mode */ - -GPIO(OTG_SW_EN, PORT(5), 0, GPIO_OUT_LOW) /* */ -GPIO(PCH_SUS_STAT_L, PORT(5), 1, GPIO_INT_FALLING) /* Signal to inform EC that SOC is entering low power state */ -GPIO(NC_52, PORT(5), 2, GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(TRACKPAD_PWREN, PORT(5), 3, GPIO_OUT_HIGH) /* Enable power for Track Pad */ -GPIO(USB_OC0_L, PORT(5), 5, GPIO_INT_FALLING) /* Over current signal of the BC1.2 charger to EC */ -GPIO(TEMP_SENSOR_1, PORT(5), 6, GPIO_INPUT) /* EC_ADC0 */ -GPIO(TEMP_SENSOR_2, PORT(5), 7, GPIO_INPUT) /* EC_ADC0 */ - -GPIO(CHGR_PMON, PORT(6), 0, GPIO_ANALOG) -GPIO(NC_61, PORT(6), 1, GPIO_INPUT) /* NC */ -GPIO(TEMP_SENSOR_3, PORT(6), 2, GPIO_INPUT) /* */ -GPIO(USBPD_BST_OFF, PORT(6), 4, GPIO_OUT_HIGH) /* USB PD Boost Enable */ -GPIO(PCH_SYS_PWROK, PORT(6), 5, GPIO_OUT_LOW) /* EC thinks everything is up and ready (DELAY_ALL_SYS_PWRGD) */ -GPIO(PCH_WAKE_L, PORT(6), 6, GPIO_ODR_HIGH) /* PCH wake pin */ -GPIO(USB3_PWR_EN, PORT(6), 7, GPIO_OUT_LOW) /* Enable power for USB3 Port */ - -GPIO(USB_CTL1, PORT(10), 5, GPIO_OUT_HIGH) /* USB charging mode control */ - -GPIO(PCH_RCIN_L, PORT(11), 0, GPIO_ODR_HIGH) /* Reset line to PCH (for 8042 emulation) */ -GPIO(NC_115, PORT(11), 5, GPIO_INPUT | GPIO_PULL_UP) /* NC */ - -GPIO(USB_PD_EC_INT, PORT(12), 2, GPIO_INT_BOTH) /* Interrupt from USB PD Controller to EC */ -GPIO(STRAP_L, PORT(12), 3, GPIO_OUT_LOW) -GPIO(PERICOM_INT, PORT(12), 4, GPIO_INT_BOTH) /* */ -GPIO(GYRO_INT2, PORT(12), 7, GPIO_INT_FALLING) /* Gyro sensor interrupt 2 to EC */ - -GPIO(EC_PLUG_DETECT, PORT(13), 2, GPIO_INT_BOTH) -GPIO(BOARD_ID1, PORT(15), 4, GPIO_INPUT | GPIO_PULL_UP) /* Board Id 1 */ -GPIO(NC_135, PORT(13), 5, GPIO_INPUT | GPIO_PULL_UP) /* NC */ - -GPIO(THERMAL_PROBE_EN_L,PORT(14), 0, GPIO_OUT_HIGH) -GPIO(PCH_RSMRST_L, PORT(14), 3, GPIO_OUT_LOW) /* RSMRST_N to PCH */ -GPIO(NC_145, PORT(14), 5, GPIO_OUT_LOW | GPIO_PULL_UP) /* NC */ -GPIO(PVT_CS0, PORT(14), 6, GPIO_ODR_HIGH) /* SPI PVT Chip select */ -GPIO(ALS_INT, PORT(14), 7, GPIO_INT_FALLING) /* ALS sensor interrupt to EC */ - -GPIO(WLAN_OFF_L, PORT(15), 0, GPIO_ODR_HIGH) /* Wireless LAN */ -GPIO(CPU_PROCHOT, PORT(15), 1, GPIO_OUT_LOW) -GPIO(KBD_IRQ_L, PORT(15), 2, GPIO_ODR_HIGH) /* Negative edge triggered irq. */ -GPIO(BOARD_ID0, PORT(15), 4, GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(CORE_PWROK, PORT(15), 5, GPIO_ODR_HIGH) /* CORE_PWR_OK_R */ -GPIO(LID_OPEN2, PORT(15), 6, GPIO_INT_BOTH_DSLEEP) /* LID_OPEN_OUT2_R */ -GPIO(PCH_SUSPWRDNACK, PORT(15), 7, GPIO_INT_FALLING) /* PMC SUSPWRDNACK signal from SOC to EC */ - -GPIO(PCH_PWRBTN_L, PORT(16), 0, GPIO_OUT_HIGH) /* Power button output to PCH */ -GPIO(GYRO_INT1, PORT(16), 1, GPIO_INT_FALLING) /* Gyro sensor interrupt 1 to EC */ -GPIO(CROSS_BAR_EN_NC, PORT(16), 3, GPIO_INPUT | GPIO_PULL_UP) /* NC */ - -GPIO(STARTUP_LATCH_SET, PORT(20), 1, GPIO_OUT_HIGH) /* Output from EC to POL signal of USB Type C Mux */ -GPIO(EC_BL_DISABLE_L, PORT(20), 2, GPIO_OUT_HIGH) /* EDP backligh disable signal from EC */ -GPIO(SMC_SHUTDOWN, PORT(20), 3, GPIO_OUT_LOW) /* Shutdown signal from EC to power sequencing PLD */ -GPIO(CROSS_BAR_MODE_NC, PORT(20), 4, GPIO_INPUT | GPIO_PULL_UP) /* NC */ - -GPIO(SUSPWRDNACK_SOC_EC,PORT(21), 0, GPIO_OUT_LOW) /* SUSPWRDNACK signal from MOIC device to EC */ -GPIO(GPIO_3_EC, PORT(21), 1, GPIO_OUT_LOW) /* Sleep SOIX signal from SOC to EC */ +GPIO_INT(LID_OPEN, PIN(27), GPIO_INT_BOTH_DSLEEP, lid_interrupt) /* Lid switch */ +GPIO_INT(AC_PRESENT, PIN(30), GPIO_INT_BOTH_DSLEEP, extpower_interrupt) /* BC_ACOK / EC_ACIN - to know if battery or AC connected */ +GPIO_INT(POWER_BUTTON_L, PIN(35), GPIO_INT_BOTH_DSLEEP, power_button_interrupt) /* Power button */ +GPIO_INT(RSMRST_L_PGOOD, PIN(63), GPIO_INT_BOTH, power_signal_interrupt) /* RSMRST_N_PWRGD from power logic */ +GPIO_INT(ALL_SYS_PGOOD, PIN(130), GPIO_INT_BOTH_DSLEEP, power_signal_interrupt) /* ALL_SYS_PWRGD from power logic */ +GPIO_INT(PCH_SLP_S4_L, PIN(200), GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, power_signal_interrupt) /* SLP_S4# signal from PCH */ +GPIO_INT(PCH_SLP_S3_L, PIN(206), GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, power_signal_interrupt) /* SLP_S3# signal from PCH */ + +GPIO(KBD_KSO2, PIN(1), GPIO_KB_OUTPUT_COL2) /* Negative edge triggered irq. */ + +GPIO(USB_ILIM_SEL, PIN(13), GPIO_OUT_HIGH) /* USB current control */ + +GPIO(I2C_PORT0_SCL, PIN(15), GPIO_ODR_HIGH) +GPIO(I2C_PORT0_SDA, PIN(16), GPIO_ODR_HIGH) +GPIO(BOARD_ID2, PIN(17), GPIO_INPUT | GPIO_PULL_UP) /* NC */ +GPIO(I2C_PORT1_SCL, PIN(22), GPIO_ODR_HIGH) +GPIO(I2C_PORT1_SDA, PIN(23), GPIO_ODR_HIGH) +GPIO(I2C_PORT2_SCL, PIN(20), GPIO_ODR_HIGH) +GPIO(I2C_PORT2_SDA, PIN(21), GPIO_ODR_HIGH) +GPIO(I2C_PORT3_SCL, PIN(24), GPIO_ODR_HIGH) +GPIO(I2C_PORT3_SDA, PIN(25), GPIO_ODR_HIGH) + +GPIO(PCH_SCI_L, PIN(26), GPIO_ODR_HIGH) /* SCI output */ + +GPIO(VOLUME_UP, PIN(31), GPIO_INT_FALLING) /* Volume up button */ +GPIO(VOLUME_DOWN, PIN(34), GPIO_INT_FALLING) /* Volume down button */ +GPIO(USB2_PWR_EN, PIN(36), GPIO_OUT_LOW) /* Enable power for USB2 Port */ + +GPIO(ENTERING_RW, PIN(41), GPIO_OUT_LOW) /* Indicate when EC is entering RW code */ +GPIO(PCH_SMI_L, PIN(44), GPIO_ODR_HIGH) /* SMI output */ +GPIO(USB_OC1_L, PIN(45), GPIO_INT_FALLING) /* DB2 BC1.2 over current signal to EC */ +GPIO(DP_USB_C_HPD_Q, PIN(46), GPIO_OUT_HIGH) /* DP hot plug detect from EC to SOC */ +GPIO(PWR_BTN_SELECT, PIN(47), GPIO_OUT_HIGH) /* HIGH in clamshell mode and LOW in tablet mode */ + +GPIO(OTG_SW_EN, PIN(50), GPIO_OUT_LOW) /* */ +GPIO(PCH_SUS_STAT_L, PIN(51), GPIO_INT_FALLING) /* Signal to inform EC that SOC is entering low power state */ +GPIO(NC_52, PIN(52), GPIO_INPUT | GPIO_PULL_UP) /* NC */ +GPIO(TRACKPAD_PWREN, PIN(53), GPIO_OUT_HIGH) /* Enable power for Track Pad */ +GPIO(USB_OC0_L, PIN(55), GPIO_INT_FALLING) /* Over current signal of the BC1.2 charger to EC */ +GPIO(TEMP_SENSOR_1, PIN(56), GPIO_INPUT) /* EC_ADC0 */ +GPIO(TEMP_SENSOR_2, PIN(57), GPIO_INPUT) /* EC_ADC0 */ + +GPIO(CHGR_PMON, PIN(60), GPIO_ANALOG) +GPIO(NC_61, PIN(61), GPIO_INPUT) /* NC */ +GPIO(TEMP_SENSOR_3, PIN(62), GPIO_INPUT) /* */ +GPIO(USBPD_BST_OFF, PIN(64), GPIO_OUT_HIGH) /* USB PD Boost Enable */ +GPIO(PCH_SYS_PWROK, PIN(65), GPIO_OUT_LOW) /* EC thinks everything is up and ready (DELAY_ALL_SYS_PWRGD) */ +GPIO(PCH_WAKE_L, PIN(66), GPIO_ODR_HIGH) /* PCH wake pin */ +GPIO(USB3_PWR_EN, PIN(67), GPIO_OUT_LOW) /* Enable power for USB3 Port */ + +GPIO(USB_CTL1, PIN(105), GPIO_OUT_HIGH) /* USB charging mode control */ + +GPIO(PCH_RCIN_L, PIN(110), GPIO_ODR_HIGH) /* Reset line to PCH (for 8042 emulation) */ +GPIO(NC_115, PIN(115), GPIO_INPUT | GPIO_PULL_UP) /* NC */ + +GPIO(USB_PD_EC_INT, PIN(122), GPIO_INT_BOTH) /* Interrupt from USB PD Controller to EC */ +GPIO(STRAP_L, PIN(123), GPIO_OUT_LOW) +GPIO(PERICOM_INT, PIN(124), GPIO_INT_BOTH) /* */ +GPIO(GYRO_INT2, PIN(127), GPIO_INT_FALLING) /* Gyro sensor interrupt 2 to EC */ + +GPIO(EC_PLUG_DETECT, PIN(132), GPIO_INT_BOTH) +GPIO(BOARD_ID1, PIN(154), GPIO_INPUT | GPIO_PULL_UP) /* Board Id 1 */ +GPIO(NC_135, PIN(135), GPIO_INPUT | GPIO_PULL_UP) /* NC */ + +GPIO(THERMAL_PROBE_EN_L,PIN(140), GPIO_OUT_HIGH) +GPIO(PCH_RSMRST_L, PIN(143), GPIO_OUT_LOW) /* RSMRST_N to PCH */ +GPIO(NC_145, PIN(145), GPIO_OUT_LOW | GPIO_PULL_UP) /* NC */ +GPIO(PVT_CS0, PIN(146), GPIO_ODR_HIGH) /* SPI PVT Chip select */ +GPIO(ALS_INT, PIN(147), GPIO_INT_FALLING) /* ALS sensor interrupt to EC */ + +GPIO(WLAN_OFF_L, PIN(150), GPIO_ODR_HIGH) /* Wireless LAN */ +GPIO(CPU_PROCHOT, PIN(151), GPIO_OUT_LOW) +GPIO(KBD_IRQ_L, PIN(152), GPIO_ODR_HIGH) /* Negative edge triggered irq. */ +GPIO(BOARD_ID0, PIN(154), GPIO_INPUT | GPIO_PULL_UP) /* NC */ +GPIO(CORE_PWROK, PIN(155), GPIO_ODR_HIGH) /* CORE_PWR_OK_R */ +GPIO(LID_OPEN2, PIN(156), GPIO_INT_BOTH_DSLEEP) /* LID_OPEN_OUT2_R */ +GPIO(PCH_SUSPWRDNACK, PIN(157), GPIO_INT_FALLING) /* PMC SUSPWRDNACK signal from SOC to EC */ + +GPIO(PCH_PWRBTN_L, PIN(160), GPIO_OUT_HIGH) /* Power button output to PCH */ +GPIO(GYRO_INT1, PIN(161), GPIO_INT_FALLING) /* Gyro sensor interrupt 1 to EC */ +GPIO(CROSS_BAR_EN_NC, PIN(163), GPIO_INPUT | GPIO_PULL_UP) /* NC */ + +GPIO(STARTUP_LATCH_SET, PIN(201), GPIO_OUT_HIGH) /* Output from EC to POL signal of USB Type C Mux */ +GPIO(EC_BL_DISABLE_L, PIN(202), GPIO_OUT_HIGH) /* EDP backligh disable signal from EC */ +GPIO(SMC_SHUTDOWN, PIN(203), GPIO_OUT_LOW) /* Shutdown signal from EC to power sequencing PLD */ +GPIO(CROSS_BAR_MODE_NC, PIN(204), GPIO_INPUT | GPIO_PULL_UP) /* NC */ + +GPIO(SUSPWRDNACK_SOC_EC,PIN(210), GPIO_OUT_LOW) /* SUSPWRDNACK signal from MOIC device to EC */ +GPIO(GPIO_3_EC, PIN(211), GPIO_OUT_LOW) UNIMPLEMENTED(WP_L) /* Alternate functions GPIO definition */ -ALTERNATE(PORT(16), 0x24, 1, MODULE_UART, 0) /* UART0 */ -ALTERNATE(PORT(1), 0x60, 2, MODULE_I2C, GPIO_PULL_UP) /* I2C0: Battery Charger */ -ALTERNATE(PORT(2), 0x3f, 2, MODULE_I2C, GPIO_PULL_UP) /* I2C1: Temp Sensor / I2C2: SOC / I2C3: VNN */ -ALTERNATE(PORT(0), 0xfc, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) -ALTERNATE(PORT(1), 0x03, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) -ALTERNATE(PORT(10), 0xd8, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) -ALTERNATE(PORT(3), 0x04, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) -ALTERNATE(PORT(4), 0x0d, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) -ALTERNATE(PORT(12), 0x60, 2, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) -ALTERNATE(PORT(14), 0x14, 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) -ALTERNATE(PORT(1), 0x10, 1, MODULE_LPC, 0) /* 14: CLKRUN# */ -ALTERNATE(PORT(11), 0x9e, 1, MODULE_LPC, 0) /* 111~114:LAD[0:3], 117:PCI_CLK */ -ALTERNATE(PORT(11), 0x40, 1, MODULE_LPC, GPIO_INT_BOTH) /* 116: LRESET# */ -ALTERNATE(PORT(12), 0x01, 1, MODULE_LPC, 0) /* 120: LFRAME# */ -ALTERNATE(PORT(5), 0x10, 1, MODULE_SPI, 0) -ALTERNATE(PORT(16), 0x10, 1, MODULE_SPI, 0) -ALTERNATE(PORT(15), 0x08, 1, MODULE_SPI, 0) /* 153: CLK */ -ALTERNATE(PORT(13), 0x48, 1, MODULE_PWM_LED, GPIO_OPEN_DRAIN) /* 133: PWM0, 136: PWM1 */ -ALTERNATE(PORT(14), 0x02, 1, MODULE_PWM_LED, GPIO_OPEN_DRAIN) /* 141: PWM3 */ - +ALTERNATE(PIN_MASK(16, 0x24), 1, MODULE_UART, 0) /* UART0 */ +ALTERNATE(PIN_MASK(1, 0x60), 2, MODULE_I2C, GPIO_PULL_UP) /* I2C0: Battery Charger */ +ALTERNATE(PIN_MASK(2, 0x3f), 2, MODULE_I2C, GPIO_PULL_UP) /* I2C1: Temp Sensor / I2C2: SOC / I2C3: VNN */ +ALTERNATE(PIN_MASK(0, 0xfc), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) +ALTERNATE(PIN_MASK(1, 0x03), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) +ALTERNATE(PIN_MASK(10, 0xd8), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) +ALTERNATE(PIN_MASK(3, 0x04), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) +ALTERNATE(PIN_MASK(4, 0x0d), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) +ALTERNATE(PIN_MASK(12, 0x60), 2, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) +ALTERNATE(PIN_MASK(14, 0x14), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) +ALTERNATE(PIN_MASK(1, 0x10), 1, MODULE_LPC, 0) /* 14: CLKRUN# */ +ALTERNATE(PIN_MASK(11, 0x9e), 1, MODULE_LPC, 0) /* 111~114:LAD[0:3], 117:PCI_CLK */ +ALTERNATE(PIN_MASK(11, 0x40), 1, MODULE_LPC, GPIO_INT_BOTH) /* 116: LRESET# */ +ALTERNATE(PIN_MASK(12, 0x01), 1, MODULE_LPC, 0) /* 120: LFRAME# */ +ALTERNATE(PIN_MASK(5, 0x10), 1, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(16, 0x10), 1, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(15, 0x08), 1, MODULE_SPI, 0) /* 153: CLK */ +ALTERNATE(PIN_MASK(13, 0x48), 1, MODULE_PWM_LED, GPIO_OPEN_DRAIN) /* 133: PWM0, 136: PWM1 */ +ALTERNATE(PIN_MASK(14, 0x02), 1, MODULE_PWM_LED, GPIO_OPEN_DRAIN) /* 141: PWM3 */ diff --git a/board/strago/lfw/gpio.inc b/board/strago/lfw/gpio.inc index d1bb19cfcb..122aff0cdf 100644 --- a/board/strago/lfw/gpio.inc +++ b/board/strago/lfw/gpio.inc @@ -7,10 +7,10 @@ * Minimal set of GPIOs needed for LFW loader */ -GPIO(PVT_CS0, PORT(14), 6, GPIO_ODR_HIGH) /* SPI PVT Chip select */ +GPIO(PVT_CS0, PIN(146), GPIO_ODR_HIGH) /* SPI PVT Chip select */ /* Alternate functions GPIO definition */ -ALTERNATE(PORT(16), 0x24, 1, MODULE_UART, 0) /* UART0 */ -ALTERNATE(PORT(5), 0x10, 1, MODULE_SPI, 0) -ALTERNATE(PORT(16), 0x10, 1, MODULE_SPI, 0) -ALTERNATE(PORT(15), 0x08, 1, MODULE_SPI, 0) /* 153: CLK */ +ALTERNATE(PIN_MASK(16, 0x24), 1, MODULE_UART, 0) /* UART0 */ +ALTERNATE(PIN_MASK(5, 0x10), 1, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(16, 0x10), 1, MODULE_SPI, 0) +ALTERNATE(PIN_MASK(15, 0x08), 1, MODULE_SPI, 0) /* 153: CLK */ diff --git a/board/twinkie/gpio.inc b/board/twinkie/gpio.inc index 15d76dbb45..07b935fceb 100644 --- a/board/twinkie/gpio.inc +++ b/board/twinkie/gpio.inc @@ -4,43 +4,43 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -GPIO_INT(CC2_ALERT_L, A, 7, GPIO_INT_BOTH | GPIO_PULL_UP, cc2_event) -GPIO_INT(VBUS_ALERT_L, B, 2, GPIO_INT_BOTH | GPIO_PULL_UP, vbus_event) +GPIO_INT(CC2_ALERT_L, PIN(A, 7), GPIO_INT_BOTH | GPIO_PULL_UP, cc2_event) +GPIO_INT(VBUS_ALERT_L, PIN(B, 2), GPIO_INT_BOTH | GPIO_PULL_UP, vbus_event) -GPIO(CC1_EN, A, 0, GPIO_OUT_HIGH) -GPIO(CC1_PD, A, 1, GPIO_ANALOG) -GPIO(CC2_EN, A, 2, GPIO_OUT_HIGH) -GPIO(CC2_PD, A, 3, GPIO_ANALOG) -GPIO(DAC, A, 4, GPIO_ANALOG) -GPIO(CC2_TX_DATA, A, 6, GPIO_OUT_LOW) +GPIO(CC1_EN, PIN(A, 0), GPIO_OUT_HIGH) +GPIO(CC1_PD, PIN(A, 1), GPIO_ANALOG) +GPIO(CC2_EN, PIN(A, 2), GPIO_OUT_HIGH) +GPIO(CC2_PD, PIN(A, 3), GPIO_ANALOG) +GPIO(DAC, PIN(A, 4), GPIO_ANALOG) +GPIO(CC2_TX_DATA, PIN(A, 6), GPIO_OUT_LOW) -GPIO(CC1_RA, A, 8, GPIO_ODR_HIGH) -GPIO(USB_DM, A, 11, GPIO_ANALOG) -GPIO(USB_DP, A, 12, GPIO_ANALOG) -GPIO(CC1_RPUSB, A, 13, GPIO_ODR_HIGH) -GPIO(CC1_RP1A5, A, 14, GPIO_ODR_HIGH) -GPIO(CC1_RP3A0, A, 15, GPIO_ODR_HIGH) -GPIO(CC2_RPUSB, B, 0, GPIO_ODR_HIGH) +GPIO(CC1_RA, PIN(A, 8), GPIO_ODR_HIGH) +GPIO(USB_DM, PIN(A, 11), GPIO_ANALOG) +GPIO(USB_DP, PIN(A, 12), GPIO_ANALOG) +GPIO(CC1_RPUSB, PIN(A, 13), GPIO_ODR_HIGH) +GPIO(CC1_RP1A5, PIN(A, 14), GPIO_ODR_HIGH) +GPIO(CC1_RP3A0, PIN(A, 15), GPIO_ODR_HIGH) +GPIO(CC2_RPUSB, PIN(B, 0), GPIO_ODR_HIGH) -GPIO(CC1_TX_EN, B, 1, GPIO_OUT_LOW) -GPIO(CC2_TX_EN, B, 3, GPIO_OUT_LOW) -GPIO(CC1_TX_DATA, B, 4, GPIO_OUT_LOW) -GPIO(CC1_RD, B, 5, GPIO_ODR_HIGH) -GPIO(I2C_SCL, B, 6, GPIO_INPUT) -GPIO(I2C_SDA, B, 7, GPIO_INPUT) -GPIO(CC2_RD, B, 8, GPIO_ODR_HIGH) -GPIO(LED_G_L, B, 11, GPIO_ODR_HIGH) -GPIO(LED_R_L, B, 13, GPIO_ODR_HIGH) -GPIO(LED_B_L, B, 14, GPIO_ODR_HIGH) -GPIO(CC2_RA, B, 15, GPIO_ODR_HIGH) -GPIO(CC2_RP1A5, C, 14, GPIO_ODR_HIGH) -GPIO(CC2_RP3A0, C, 15, GPIO_ODR_HIGH) +GPIO(CC1_TX_EN, PIN(B, 1), GPIO_OUT_LOW) +GPIO(CC2_TX_EN, PIN(B, 3), GPIO_OUT_LOW) +GPIO(CC1_TX_DATA, PIN(B, 4), GPIO_OUT_LOW) +GPIO(CC1_RD, PIN(B, 5), GPIO_ODR_HIGH) +GPIO(I2C_SCL, PIN(B, 6), GPIO_INPUT) +GPIO(I2C_SDA, PIN(B, 7), GPIO_INPUT) +GPIO(CC2_RD, PIN(B, 8), GPIO_ODR_HIGH) +GPIO(LED_G_L, PIN(B, 11), GPIO_ODR_HIGH) +GPIO(LED_R_L, PIN(B, 13), GPIO_ODR_HIGH) +GPIO(LED_B_L, PIN(B, 14), GPIO_ODR_HIGH) +GPIO(CC2_RA, PIN(B, 15), GPIO_ODR_HIGH) +GPIO(CC2_RP1A5, PIN(C, 14), GPIO_ODR_HIGH) +GPIO(CC2_RP3A0, PIN(C, 15), GPIO_ODR_HIGH) /* Unimplemented signals which we need to emulate for now */ UNIMPLEMENTED(ENTERING_RW) UNIMPLEMENTED(WP_L) -ALTERNATE(A, 0x0020, 0, MODULE_USB_PD, 0) /* SPI1: SCK(PA5) */ -ALTERNATE(B, 0x0200, 2, MODULE_USB_PD, 0) /* TIM17_CH1: PB9 */ -ALTERNATE(A, 0x0600, 1, MODULE_UART, GPIO_PULL_UP) /* USART1: PA9/PA10 */ -ALTERNATE(B, 0x00C0, 1, MODULE_I2C, 0) /* I2C1 MASTER:PB6/7 */ +ALTERNATE(PIN_MASK(A, 0x0020), 0, MODULE_USB_PD, 0) /* SPI1: SCK(PA5) */ +ALTERNATE(PIN_MASK(B, 0x0200), 2, MODULE_USB_PD, 0) /* TIM17_CH1: PB9 */ +ALTERNATE(PIN_MASK(A, 0x0600), 1, MODULE_UART, GPIO_PULL_UP) /* USART1: PA9/PA10 */ +ALTERNATE(PIN_MASK(B, 0x00C0), 1, MODULE_I2C, 0) /* I2C1 MASTER:PB6/7 */ diff --git a/chip/g/config_chip.h b/chip/g/config_chip.h index 79b44f4ddd..01a32d6219 100644 --- a/chip/g/config_chip.h +++ b/chip/g/config_chip.h @@ -57,4 +57,7 @@ #define CONFIG_USB_RAM_ACCESS_SIZE 0 #define CONFIG_USB_RAM_SIZE 0 +#define GPIO_PIN(port, index) GPIO_##port, (1 << index) +#define GPIO_PIN_MASK(port, mask) GPIO_##port, (mask) + #endif /* __CROS_EC_CONFIG_CHIP_H */ diff --git a/chip/host/config_chip.h b/chip/host/config_chip.h index b809134e83..5df44a9315 100644 --- a/chip/host/config_chip.h +++ b/chip/host/config_chip.h @@ -36,4 +36,7 @@ extern char __host_flash[CONFIG_FLASH_PHYSICAL_SIZE]; /* Do NOT use common timer code which is designed for hardware counters. */ #undef CONFIG_COMMON_TIMER +#define GPIO_PIN(port, index) GPIO_##port, (1 << index) +#define GPIO_PIN_MASK(port, mask) GPIO_##port, (mask) + #endif /* __CROS_EC_CONFIG_CHIP_H */ diff --git a/chip/it83xx/config_chip.h b/chip/it83xx/config_chip.h index 2c433262c9..0d688f7eb3 100644 --- a/chip/it83xx/config_chip.h +++ b/chip/it83xx/config_chip.h @@ -73,4 +73,7 @@ #define CONFIG_EC2I #define CONFIG_LPC +#define GPIO_PIN(port, index) GPIO_##port, (1 << index) +#define GPIO_PIN_MASK(port, mask) GPIO_##port, (mask) + #endif /* __CROS_EC_CONFIG_CHIP_H */ diff --git a/chip/lm4/config_chip.h b/chip/lm4/config_chip.h index 4bf6c75a18..ca615ca492 100644 --- a/chip/lm4/config_chip.h +++ b/chip/lm4/config_chip.h @@ -97,4 +97,7 @@ /* Compile for running from RAM instead of flash */ /* #define COMPILE_FOR_RAM */ +#define GPIO_PIN(port, index) GPIO_##port, (1 << index) +#define GPIO_PIN_MASK(port, mask) GPIO_##port, (mask) + #endif /* __CROS_EC_CONFIG_CHIP_H */ diff --git a/chip/mec1322/config_chip.h b/chip/mec1322/config_chip.h index c1f11cf08e..1780e9a8d3 100644 --- a/chip/mec1322/config_chip.h +++ b/chip/mec1322/config_chip.h @@ -177,4 +177,7 @@ which contains Loader and RO Images */ #define CONFIG_SPI #define CONFIG_SWITCH +#define GPIO_PIN(index) (index / 10), (1 << (index % 10)) +#define GPIO_PIN_MASK(pin, mask) (pin), (mask) + #endif /* __CROS_EC_CONFIG_CHIP_H */ diff --git a/chip/mec1322/registers.h b/chip/mec1322/registers.h index 88b055eaa5..1c21e9b8bf 100644 --- a/chip/mec1322/registers.h +++ b/chip/mec1322/registers.h @@ -89,8 +89,7 @@ /* GPIO */ #define MEC1322_GPIO_BASE 0x40081000 -#define MEC1322_GPIO_PORT(x) (x) -#define GPIO_PORT(x) MEC1322_GPIO_PORT(x) + static inline uintptr_t gpio_port_base(int port_id) { int oct = (port_id / 10) * 8 + port_id % 10; @@ -98,7 +97,7 @@ static inline uintptr_t gpio_port_base(int port_id) } #define MEC1322_GPIO_CTL(port, id) REG32(gpio_port_base(port) + (id << 2)) -#define DUMMY_GPIO_BANK GPIO_PORT(0) +#define DUMMY_GPIO_BANK 0 /* Timer */ diff --git a/chip/npcx/config_chip.h b/chip/npcx/config_chip.h index 272c5eebed..cd951e1f22 100644 --- a/chip/npcx/config_chip.h +++ b/chip/npcx/config_chip.h @@ -110,4 +110,7 @@ /* Compile for running from RAM instead of flash */ /* #define COMPILE_FOR_RAM */ +#define GPIO_PIN(port, index) GPIO_##port, (1 << index) +#define GPIO_PIN_MASK(port, mask) GPIO_##port, (mask) + #endif /* __CROS_EC_CONFIG_CHIP_H */ diff --git a/chip/nrf51/config_chip.h b/chip/nrf51/config_chip.h index 78ee610601..328471967c 100644 --- a/chip/nrf51/config_chip.h +++ b/chip/nrf51/config_chip.h @@ -52,5 +52,8 @@ #undef CONFIG_UART_TX_BUF_SIZE #define CONFIG_UART_TX_BUF_SIZE 1024 +#define GPIO_PIN(port, index) GPIO_##port, (1 << index) +#define GPIO_PIN_MASK(port, mask) GPIO_##port, (mask) + #endif /* __CROS_EC_CONFIG_CHIP_H */ diff --git a/chip/stm32/config_chip.h b/chip/stm32/config_chip.h index 541b50d8a4..2454b216ed 100644 --- a/chip/stm32/config_chip.h +++ b/chip/stm32/config_chip.h @@ -93,4 +93,8 @@ /* Compile for running from RAM instead of flash */ /* #define COMPILE_FOR_RAM */ +#define GPIO_NAME_BY_PIN(port, index) #port#index +#define GPIO_PIN(port, index) GPIO_##port, (1 << index) +#define GPIO_PIN_MASK(port, mask) GPIO_##port, (mask) + #endif /* __CROS_EC_CONFIG_CHIP_H */ diff --git a/include/gpio.wrap b/include/gpio.wrap index 1eb9f3643e..d9f9db2890 100644 --- a/include/gpio.wrap +++ b/include/gpio.wrap @@ -5,19 +5,26 @@ * found in the LICENSE file. */ +#ifndef GPIO_PIN +#error "Your architecture must define GPIO_PIN and it did not." +#endif + +#ifndef GPIO_PIN_MASK +#error "Your architecture must define GPIO_PIN_MASK and it did not." +#endif + /* * The GPIO macro is used to define a new GPIO pin name and function. * * The name is used to populate the gpio_signal enum by first * prepending GPIO_ to the name. It is also used to construct the - * string name that is presented in the shell interface. Similarly, - * the port parameter has GPIO_ prepended to it before it is used to - * initialize the port base address of a gpio_info struct. The pin - * number is used to create a bitmask. The flags parameter is passed - * on to the gpio_info directly. + * string name that is presented in the shell interface. The pin + * parameter should use PIN macro and will be expand to GPIO_PIN + * defined on each board. The flags parameter is passed on to the + * gpio_info directly. */ #ifndef GPIO -#define GPIO(name, port, pin, flags) +#define GPIO(name, pin, flags) #endif /* @@ -27,7 +34,7 @@ * array. */ #ifndef GPIO_INT -#define GPIO_INT(name, port, pin, flags, signal) +#define GPIO_INT(name, pin, flags, signal) #endif /* @@ -40,11 +47,11 @@ * alternate function mode. The function parameter is chip/variant specific * and will usually need to be looked up in the datasheet. The flags parameter * has the same meaning as in the GPIO macro above. This macro can assign - * multiple pins on the same port to a module, the second parameter is the - * bitmask of pins to be assigned. + * multiple pins on the same port to a module, pinmasks should use PIN_MASK + * and will be expanded as GPIO_PIN_MASK defined in each config_chip.h. */ #ifndef ALTERNATE -#define ALTERNATE(port, mask, function, module, flags) +#define ALTERNATE(pinmask, function, module, flags) #endif /* diff --git a/include/gpio_list.h b/include/gpio_list.h index c9bdd5668d..a94b6e7a9c 100644 --- a/include/gpio_list.h +++ b/include/gpio_list.h @@ -6,18 +6,14 @@ #include "gpio_signal.h" #ifdef CONFIG_COMMON_GPIO_SHORTNAMES -#define GPIO(name, port, pin, flags) \ - {#port#pin, GPIO_##port, (1 << pin), flags}, +#define GPIO(name, pin, flags) {GPIO_NAME_BY_##pin, GPIO_##pin, flags}, #else -#define GPIO(name, port, pin, flags) \ - {#name, GPIO_##port, (1 << pin), flags}, +#define GPIO(name, pin, flags) {#name, GPIO_##pin, flags}, #endif -#define UNIMPLEMENTED(name) \ - {#name, DUMMY_GPIO_BANK, 0, GPIO_DEFAULT}, +#define UNIMPLEMENTED(name) {#name, DUMMY_GPIO_BANK, 0, GPIO_DEFAULT}, +#define GPIO_INT(name, pin, flags, signal) GPIO(name, pin, flags) -#define GPIO_INT(name, port, pin, flags, signal) \ - GPIO(name, port, pin, flags) /* GPIO signal list. */ const struct gpio_info gpio_list[] = { #include "gpio.wrap" @@ -29,8 +25,8 @@ BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT); * Construct the gpio_alt_funcs array. This array is used by gpio_config_module * to enable and disable GPIO alternate functions on a module by module basis. */ -#define ALTERNATE(port, mask, function, module, flags) \ - {GPIO_##port, mask, function, module, flags}, +#define ALTERNATE(pinmask, function, module, flags) \ + {GPIO_##pinmask, function, module, flags}, const struct gpio_alt_func gpio_alt_funcs[] = { #include "gpio.wrap" @@ -39,7 +35,7 @@ const struct gpio_alt_func gpio_alt_funcs[] = { const int gpio_alt_funcs_count = ARRAY_SIZE(gpio_alt_funcs); /* GPIO Interrupt Handlers */ -#define GPIO_INT(name, port, pin, flags, signal) signal, +#define GPIO_INT(name, pin, flags, signal) signal, void (* const gpio_irq_handlers[])(enum gpio_signal signal) = { #include "gpio.wrap" }; @@ -49,6 +45,6 @@ const int gpio_ih_count = ARRAY_SIZE(gpio_irq_handlers); * ALL GPIOs with interrupt handlers must be declared at the top of the gpio.inc * file. */ -#define GPIO_INT(name, port, pin, flags, signal) \ +#define GPIO_INT(name, pin, flags, signal) \ BUILD_ASSERT(GPIO_##name < ARRAY_SIZE(gpio_irq_handlers)); #include "gpio.wrap" diff --git a/include/gpio_signal.h b/include/gpio_signal.h index bcec1b522f..3270ba6a2d 100644 --- a/include/gpio_signal.h +++ b/include/gpio_signal.h @@ -6,9 +6,9 @@ #ifndef __CROS_EC_GPIO_SIGNAL_H #define __CROS_EC_GPIO_SIGNAL_H -#define GPIO(name, port, pin, flags) GPIO_##name, +#define GPIO(name, pin, flags) GPIO_##name, #define UNIMPLEMENTED(name) GPIO_##name, -#define GPIO_INT(name, port, pin, flags, signal) GPIO_##name, +#define GPIO_INT(name, pin, flags, signal) GPIO_##name, enum gpio_signal { #include "gpio.wrap" |