Raul E Rangel | b3c4132 | 2020-05-20 14:07:41 -0600 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
| 2 | |
| 3 | #include <baseboard/gpio.h> |
| 4 | #include <baseboard/variants.h> |
| 5 | #include <boardid.h> |
| 6 | #include <gpio.h> |
| 7 | #include <soc/gpio.h> |
| 8 | #include <ec/google/chromeec/ec.h> |
| 9 | |
Furquan Shaikh | da459c4 | 2020-06-18 01:34:48 -0700 | [diff] [blame] | 10 | static const struct soc_amd_gpio trembyle_bid1_bid2_gpio_set_stage_ram[] = { |
| 11 | /* DMIC_SEL */ |
| 12 | PAD_GPO(GPIO_13, LOW), // Select Camera 1 Dmic |
Raul E Rangel | b3c4132 | 2020-05-20 14:07:41 -0600 | [diff] [blame] | 13 | /* USB_OC4_L - USB_A1 */ |
Furquan Shaikh | f6b2e6f | 2020-07-17 15:30:47 -0700 | [diff] [blame] | 14 | PAD_NF(GPIO_14, USB_OC4_L, PULL_NONE), |
Raul E Rangel | b3c4132 | 2020-05-20 14:07:41 -0600 | [diff] [blame] | 15 | /* USB_OC2_L - USB A0 */ |
Furquan Shaikh | f6b2e6f | 2020-07-17 15:30:47 -0700 | [diff] [blame] | 16 | PAD_NF(GPIO_18, USB_OC2_L, PULL_NONE), |
Furquan Shaikh | 65e1117 | 2020-07-21 21:51:27 -0700 | [diff] [blame] | 17 | /* EN_PWR_WIFI */ |
| 18 | PAD_GPO(GPIO_29, HIGH), |
Furquan Shaikh | da459c4 | 2020-06-18 01:34:48 -0700 | [diff] [blame] | 19 | /* EN_PWR_TOUCHPAD_PS2 */ |
| 20 | PAD_GPO(GPIO_67, HIGH), |
Raul E Rangel | b3c4132 | 2020-05-20 14:07:41 -0600 | [diff] [blame] | 21 | /* DMIC_AD_EN */ |
| 22 | PAD_GPO(GPIO_84, HIGH), |
Furquan Shaikh | da459c4 | 2020-06-18 01:34:48 -0700 | [diff] [blame] | 23 | /* MST_GPIO_2 (Fw Update HDMI hub) */ |
| 24 | PAD_GPI(GPIO_86, PULL_NONE), |
Furquan Shaikh | 79dba4a | 2020-08-04 17:16:33 -0700 | [diff] [blame] | 25 | /* EN_DEV_BEEP_L */ |
| 26 | PAD_GPO(GPIO_89, HIGH), |
Furquan Shaikh | da459c4 | 2020-06-18 01:34:48 -0700 | [diff] [blame] | 27 | /* MST_GPIO_3 (Fw Update HDMI hub) */ |
| 28 | PAD_GPI(GPIO_90, PULL_NONE), |
Furquan Shaikh | cc6c41f | 2020-08-04 20:16:55 -0700 | [diff] [blame] | 29 | /* USI_RESET */ |
| 30 | PAD_GPO(GPIO_140, HIGH), |
Raul E Rangel | b3c4132 | 2020-05-20 14:07:41 -0600 | [diff] [blame] | 31 | }; |
| 32 | |
Furquan Shaikh | da459c4 | 2020-06-18 01:34:48 -0700 | [diff] [blame] | 33 | static const struct soc_amd_gpio trembyle_bid3_gpio_set_stage_ram[] = { |
| 34 | /* DMIC_SEL */ |
| 35 | PAD_GPO(GPIO_13, LOW), // Select Camera 1 Dmic |
Raul E Rangel | b3c4132 | 2020-05-20 14:07:41 -0600 | [diff] [blame] | 36 | /* USB_OC4_L - USB_A1 */ |
Furquan Shaikh | f6b2e6f | 2020-07-17 15:30:47 -0700 | [diff] [blame] | 37 | PAD_NF(GPIO_14, USB_OC4_L, PULL_NONE), |
Raul E Rangel | b3c4132 | 2020-05-20 14:07:41 -0600 | [diff] [blame] | 38 | /* USB_OC2_L - USB A0 */ |
Furquan Shaikh | f6b2e6f | 2020-07-17 15:30:47 -0700 | [diff] [blame] | 39 | PAD_NF(GPIO_18, USB_OC2_L, PULL_NONE), |
Furquan Shaikh | 65e1117 | 2020-07-21 21:51:27 -0700 | [diff] [blame] | 40 | /* EN_PWR_WIFI */ |
| 41 | PAD_GPO(GPIO_29, HIGH), |
Furquan Shaikh | da459c4 | 2020-06-18 01:34:48 -0700 | [diff] [blame] | 42 | /* EN_PWR_TOUCHPAD_PS2 */ |
| 43 | PAD_GPO(GPIO_67, HIGH), |
| 44 | /* MST_GPIO_2 (Fw Update HDMI hub) */ |
| 45 | PAD_GPI(GPIO_86, PULL_NONE), |
Furquan Shaikh | 79dba4a | 2020-08-04 17:16:33 -0700 | [diff] [blame] | 46 | /* EN_DEV_BEEP_L */ |
| 47 | PAD_GPO(GPIO_89, HIGH), |
Furquan Shaikh | da459c4 | 2020-06-18 01:34:48 -0700 | [diff] [blame] | 48 | /* MST_GPIO_3 (Fw Update HDMI hub) */ |
| 49 | PAD_GPI(GPIO_90, PULL_NONE), |
Furquan Shaikh | cc6c41f | 2020-08-04 20:16:55 -0700 | [diff] [blame] | 50 | /* USI_RESET */ |
| 51 | PAD_GPO(GPIO_140, HIGH), |
Raul E Rangel | b3c4132 | 2020-05-20 14:07:41 -0600 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | const struct soc_amd_gpio *variant_override_gpio_table(size_t *size) |
| 55 | { |
| 56 | uint32_t board_version; |
| 57 | |
| 58 | /* |
| 59 | * If board version cannot be read, assume that this is an older revision of the board |
| 60 | * and so apply overrides. If board version is provided by the EC, then apply overrides |
| 61 | * if version < 2. |
| 62 | */ |
Eric Lai | f209b18 | 2020-10-20 02:44:53 +0800 | [diff] [blame^] | 63 | if (google_chromeec_cbi_get_board_version(&board_version) != 0) |
Raul E Rangel | b3c4132 | 2020-05-20 14:07:41 -0600 | [diff] [blame] | 64 | board_version = 1; |
| 65 | |
| 66 | if (board_version <= 2) { |
Furquan Shaikh | da459c4 | 2020-06-18 01:34:48 -0700 | [diff] [blame] | 67 | *size = ARRAY_SIZE(trembyle_bid1_bid2_gpio_set_stage_ram); |
| 68 | return trembyle_bid1_bid2_gpio_set_stage_ram; |
Raul E Rangel | b3c4132 | 2020-05-20 14:07:41 -0600 | [diff] [blame] | 69 | } else if (board_version <= 3) { |
Furquan Shaikh | da459c4 | 2020-06-18 01:34:48 -0700 | [diff] [blame] | 70 | *size = ARRAY_SIZE(trembyle_bid3_gpio_set_stage_ram); |
| 71 | return trembyle_bid3_gpio_set_stage_ram; |
Raul E Rangel | b3c4132 | 2020-05-20 14:07:41 -0600 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | *size = 0; |
| 75 | return NULL; |
| 76 | } |