Skip to content

Commit 3ee0eee

Browse files
committed
lemp14: NVMe power sequence
Change-Id: I412d890ccb61a0bc3283d6050a36f54b315a00b8 Signed-off-by: Tim Crawford <tcrawford@system76.com>
1 parent 88608e1 commit 3ee0eee

2 files changed

Lines changed: 31 additions & 3 deletions

File tree

src/mainboard/system76/ptl/variants/lemp14/gpio.c

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* SPDX-License-Identifier: GPL-2.0-only */
22

3+
#include <bootstate.h>
34
#include <mainboard/gpio.h>
45
#include <soc/gpio.h>
56

@@ -30,8 +31,8 @@ static const struct pad_config gpio_table[] = {
3031
PAD_CFG_GPO(GPP_B06, 0, DEEP), // ROM_I2C_EN
3132
PAD_NC(GPP_B07, NONE),
3233
PAD_NC(GPP_B08, NONE),
33-
PAD_CFG_GPO(GPP_B09, 1, PLTRST), // M2_SSD1_RST#
34-
PAD_CFG_GPO(GPP_B10, 1, PLTRST), // SSD1_PWR_EN
34+
//PAD_CFG_GPO(GPP_B09, 0, PLTRST), // M2_SSD1_RST#
35+
//PAD_CFG_GPO(GPP_B10, 1, PLTRST), // SSD1_PWR_EN
3536
PAD_CFG_GPI(GPP_B11, NONE, PLTRST),
3637
PAD_CFG_NF(GPP_B12, NONE, DEEP, NF1), // SLP_S0#
3738
PAD_CFG_NF(GPP_B13, NONE, DEEP, NF1), // PLT_RST#
@@ -91,7 +92,7 @@ static const struct pad_config gpio_table[] = {
9192
PAD_CFG_GPI(GPP_D15, NONE, DEEP), // CNVI_WAKE#
9293
PAD_CFG_NF(GPP_D16, NONE, DEEP, NF1), // HDA_RST#
9394
PAD_NC(GPP_D17, NONE),
94-
PAD_CFG_NF(GPP_D18, NONE, DEEP, NF1), // SSD1_CLKREQ#_N
95+
//PAD_CFG_NF(GPP_D18, NONE, DEEP, NF1), // SSD1_CLKREQ#_N
9596
PAD_CFG_GPO(GPP_D19, 1, PLTRST), // SD_PCIE_RST_N
9697
PAD_NC(GPP_D20, NONE),
9798
PAD_NC(GPP_D21, NONE),
@@ -198,3 +199,26 @@ void mainboard_configure_gpios(void)
198199
{
199200
gpio_configure_pads(gpio_table, ARRAY_SIZE(gpio_table));
200201
}
202+
203+
static const struct pad_config nvme_pwr_seq2[] = {
204+
PAD_CFG_GPO(GPP_B10, 1, PLTRST), // SSD1_PWR_EN
205+
PAD_CFG_NF(GPP_D18, NONE, DEEP, NF1), // SSD1_CLKREQ#_N
206+
};
207+
208+
static void nvme_enable_power(void *unused)
209+
{
210+
gpio_configure_pads(nvme_pwr_seq2, ARRAY_SIZE(nvme_pwr_seq2));
211+
}
212+
213+
BOOT_STATE_INIT_ENTRY(BS_PRE_DEVICE, BS_ON_EXIT, nvme_enable_power, NULL);
214+
215+
static const struct pad_config nvme_pwr_seq3[] = {
216+
PAD_CFG_GPO(GPP_B09, 1, PLTRST), // M2_SSD1_RST#
217+
};
218+
219+
static void nvme_deassert_perst(void *unused)
220+
{
221+
gpio_configure_pads(nvme_pwr_seq3, ARRAY_SIZE(nvme_pwr_seq3));
222+
}
223+
224+
BOOT_STATE_INIT_ENTRY(BS_DEV_INIT_CHIPS, BS_ON_ENTRY, nvme_deassert_perst, NULL);

src/mainboard/system76/ptl/variants/lemp14/gpio_early.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ static const struct pad_config early_gpio_table[] = {
88
PAD_CFG_GPI(GPP_E15, NONE, DEEP), // BOARD_ID3
99
PAD_CFG_NF(GPP_H08, NONE, DEEP, NF1), // UART0_RX
1010
PAD_CFG_NF(GPP_H09, NONE, DEEP, NF1), // UART0_TX
11+
12+
PAD_CFG_GPO(GPP_B09, 0, PLTRST), // M2_SSD1_RST#
13+
PAD_CFG_GPO(GPP_B10, 0, PLTRST), // SSD1_PWR_EN
14+
PAD_CFG_GPI(GPP_D18, NONE, DEEP), // SSD1_CLKREQ#_N
1115
};
1216

1317
void mainboard_configure_early_gpios(void)

0 commit comments

Comments
 (0)