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> |
Furquan Shaikh | da459c4 | 2020-06-18 01:34:48 -0700 | [diff] [blame] | 9 | |
| 10 | static const struct soc_amd_gpio ezkinil_bid1_gpio_set_stage_ram[] = { |
Josie Nordrum | 4cc87d4 | 2020-08-19 15:52:42 -0700 | [diff] [blame] | 11 | /* PEN_DETECT_ODL - Not connected */ |
| 12 | PAD_NC(GPIO_4), |
| 13 | /* PEN_POWER_EN - Not connected */ |
| 14 | PAD_NC(GPIO_5), |
Furquan Shaikh | da459c4 | 2020-06-18 01:34:48 -0700 | [diff] [blame] | 15 | /* DMIC_SEL */ |
| 16 | PAD_GPO(GPIO_13, LOW), // Select Camera 1 Dmic |
Raul E Rangel | b3c4132 | 2020-05-20 14:07:41 -0600 | [diff] [blame] | 17 | /* USB_OC4_L - USB_A1 */ |
Furquan Shaikh | f6b2e6f | 2020-07-17 15:30:47 -0700 | [diff] [blame] | 18 | PAD_NF(GPIO_14, USB_OC4_L, PULL_NONE), |
Raul E Rangel | b3c4132 | 2020-05-20 14:07:41 -0600 | [diff] [blame] | 19 | /* USB_OC2_L - USB A0 */ |
Furquan Shaikh | f6b2e6f | 2020-07-17 15:30:47 -0700 | [diff] [blame] | 20 | PAD_NF(GPIO_18, USB_OC2_L, PULL_NONE), |
Furquan Shaikh | 65e1117 | 2020-07-21 21:51:27 -0700 | [diff] [blame] | 21 | /* EN_PWR_WIFI */ |
| 22 | PAD_GPO(GPIO_29, HIGH), |
Furquan Shaikh | da459c4 | 2020-06-18 01:34:48 -0700 | [diff] [blame] | 23 | /* EN_PWR_TOUCHPAD_PS2 */ |
| 24 | PAD_GPO(GPIO_67, HIGH), |
| 25 | /* MST_GPIO_2 (Fw Update HDMI hub) */ |
| 26 | PAD_GPI(GPIO_86, PULL_NONE), |
Furquan Shaikh | 79dba4a | 2020-08-04 17:16:33 -0700 | [diff] [blame] | 27 | /* EN_DEV_BEEP_L */ |
| 28 | PAD_GPO(GPIO_89, HIGH), |
Furquan Shaikh | da459c4 | 2020-06-18 01:34:48 -0700 | [diff] [blame] | 29 | /* MST_GPIO_3 (Fw Update HDMI hub) */ |
| 30 | PAD_GPI(GPIO_90, PULL_NONE), |
Furquan Shaikh | cc6c41f | 2020-08-04 20:16:55 -0700 | [diff] [blame] | 31 | /* USI_RESET */ |
| 32 | PAD_GPO(GPIO_140, HIGH), |
Raul E Rangel | b3c4132 | 2020-05-20 14:07:41 -0600 | [diff] [blame] | 33 | }; |
Furquan Shaikh | da459c4 | 2020-06-18 01:34:48 -0700 | [diff] [blame] | 34 | |
| 35 | static const struct soc_amd_gpio ezkinil_bid2_gpio_set_stage_ram[] = { |
Josie Nordrum | 4cc87d4 | 2020-08-19 15:52:42 -0700 | [diff] [blame] | 36 | /* PEN_DETECT_ODL - Not connected */ |
| 37 | PAD_NC(GPIO_4), |
| 38 | /* PEN_POWER_EN - Not connected */ |
| 39 | PAD_NC(GPIO_5), |
Furquan Shaikh | da459c4 | 2020-06-18 01:34:48 -0700 | [diff] [blame] | 40 | /* FPMCU_RST_L Change NC */ |
Furquan Shaikh | f6b2e6f | 2020-07-17 15:30:47 -0700 | [diff] [blame] | 41 | PAD_NC(GPIO_11), |
Furquan Shaikh | da459c4 | 2020-06-18 01:34:48 -0700 | [diff] [blame] | 42 | /* DMIC_SEL */ |
| 43 | PAD_GPO(GPIO_13, LOW), // Select Camera 1 Dmic |
Furquan Shaikh | 65e1117 | 2020-07-21 21:51:27 -0700 | [diff] [blame] | 44 | /* EN_PWR_WIFI */ |
| 45 | PAD_GPO(GPIO_29, HIGH), |
Furquan Shaikh | da459c4 | 2020-06-18 01:34:48 -0700 | [diff] [blame] | 46 | /* EN_PWR_TOUCHPAD_PS2 */ |
| 47 | PAD_GPO(GPIO_67, HIGH), |
| 48 | /* FPMCU_BOOT0 Change NC */ |
Furquan Shaikh | f6b2e6f | 2020-07-17 15:30:47 -0700 | [diff] [blame] | 49 | PAD_NC(GPIO_69), |
Furquan Shaikh | da459c4 | 2020-06-18 01:34:48 -0700 | [diff] [blame] | 50 | /* MST_GPIO_2 (Fw Update HDMI hub) Change NC */ |
Furquan Shaikh | f6b2e6f | 2020-07-17 15:30:47 -0700 | [diff] [blame] | 51 | PAD_NC(GPIO_86), |
Furquan Shaikh | 79dba4a | 2020-08-04 17:16:33 -0700 | [diff] [blame] | 52 | /* EN_DEV_BEEP_L */ |
| 53 | PAD_GPO(GPIO_89, HIGH), |
Furquan Shaikh | 5474f8e | 2020-08-05 14:54:39 -0700 | [diff] [blame] | 54 | /* TP */ |
| 55 | PAD_NC(GPIO_90), |
Furquan Shaikh | cc6c41f | 2020-08-04 20:16:55 -0700 | [diff] [blame] | 56 | /* USI_RESET */ |
| 57 | PAD_GPO(GPIO_140, HIGH), |
Furquan Shaikh | da459c4 | 2020-06-18 01:34:48 -0700 | [diff] [blame] | 58 | }; |
| 59 | |
| 60 | static const struct soc_amd_gpio ezkinil_bid3_gpio_set_stage_ram[] = { |
Josie Nordrum | 4cc87d4 | 2020-08-19 15:52:42 -0700 | [diff] [blame] | 61 | /* PEN_DETECT_ODL - Not connected */ |
| 62 | PAD_NC(GPIO_4), |
| 63 | /* PEN_POWER_EN - Not connected */ |
| 64 | PAD_NC(GPIO_5), |
Furquan Shaikh | da459c4 | 2020-06-18 01:34:48 -0700 | [diff] [blame] | 65 | /* FPMCU_RST_L Change NC */ |
Furquan Shaikh | f6b2e6f | 2020-07-17 15:30:47 -0700 | [diff] [blame] | 66 | PAD_NC(GPIO_11), |
Furquan Shaikh | da459c4 | 2020-06-18 01:34:48 -0700 | [diff] [blame] | 67 | /* FPMCU_BOOT0 Change NC */ |
Furquan Shaikh | f6b2e6f | 2020-07-17 15:30:47 -0700 | [diff] [blame] | 68 | PAD_NC(GPIO_69), |
Furquan Shaikh | 79dba4a | 2020-08-04 17:16:33 -0700 | [diff] [blame] | 69 | /* EN_DEV_BEEP_L */ |
| 70 | PAD_GPO(GPIO_89, HIGH), |
Furquan Shaikh | cc6c41f | 2020-08-04 20:16:55 -0700 | [diff] [blame] | 71 | /* USI_RESET */ |
| 72 | PAD_GPO(GPIO_140, HIGH), |
Furquan Shaikh | da459c4 | 2020-06-18 01:34:48 -0700 | [diff] [blame] | 73 | }; |
| 74 | |
Raul E Rangel | b3c4132 | 2020-05-20 14:07:41 -0600 | [diff] [blame] | 75 | const struct soc_amd_gpio *variant_override_gpio_table(size_t *size) |
| 76 | { |
| 77 | uint32_t board_version; |
| 78 | |
| 79 | /* |
| 80 | * If board version cannot be read, assume that this is an older revision of the board |
| 81 | * and so apply overrides. If board version is provided by the EC, then apply overrides |
| 82 | * if version < 2. |
| 83 | */ |
Eric Lai | f209b18 | 2020-10-20 02:44:53 +0800 | [diff] [blame^] | 84 | if (google_chromeec_cbi_get_board_version(&board_version) != 0) |
Raul E Rangel | b3c4132 | 2020-05-20 14:07:41 -0600 | [diff] [blame] | 85 | board_version = 1; |
| 86 | |
| 87 | if (board_version <= 1) { |
Furquan Shaikh | da459c4 | 2020-06-18 01:34:48 -0700 | [diff] [blame] | 88 | *size = ARRAY_SIZE(ezkinil_bid1_gpio_set_stage_ram); |
| 89 | return ezkinil_bid1_gpio_set_stage_ram; |
| 90 | } else if (board_version == 2) { |
| 91 | *size = ARRAY_SIZE(ezkinil_bid2_gpio_set_stage_ram); |
| 92 | return ezkinil_bid2_gpio_set_stage_ram; |
Raul E Rangel | b3c4132 | 2020-05-20 14:07:41 -0600 | [diff] [blame] | 93 | } |
| 94 | |
Furquan Shaikh | da459c4 | 2020-06-18 01:34:48 -0700 | [diff] [blame] | 95 | *size = ARRAY_SIZE(ezkinil_bid3_gpio_set_stage_ram); |
| 96 | return ezkinil_bid3_gpio_set_stage_ram; |
Raul E Rangel | b3c4132 | 2020-05-20 14:07:41 -0600 | [diff] [blame] | 97 | } |