Skip to content

Commit

Permalink
soc: npcm4xx: add gpio reset select
Browse files Browse the repository at this point in the history
add gpio reset select.

GPIO 0-9, A-F reset when core domain reset.

Signed-off-by: cpchiang <[email protected]>
  • Loading branch information
cpchiang committed Mar 18, 2024
1 parent 05fd52d commit f9b8495
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
14 changes: 10 additions & 4 deletions soc/arm/npcm4xx/common/reg/reg_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,18 +156,22 @@ struct scfg_reg {
volatile uint8_t reserved1[3];
/* 0x006: Device Control 4 */
volatile uint8_t DEV_CTL4;
volatile uint8_t reserved2[9];
volatile uint8_t reserved2[4];
volatile uint8_t DEVALT10;
volatile uint8_t DEVALT11;
volatile uint8_t DEVALT12;
volatile uint8_t reserved3[2];
/* 0x010 - 1F: Device Alternate Function 0 - F */
volatile uint8_t DEVALT0[16];
volatile uint8_t reserved3[4];
volatile uint8_t reserved4[4];
/* 0x024: DEVALTCX */
volatile uint8_t DEVALTCX;
volatile uint8_t reserved4[3];
volatile uint8_t reserved5[3];
/* 0x028: Device Pull-Up Enable 0 */
volatile uint8_t DEVPU0;
/* 0x029: Device Pull-Down Enable 1 */
volatile uint8_t DEVPD1;
volatile uint8_t reserved5;
volatile uint8_t reserved6;
/* 0x02B: Low-Voltage Pins Control 1 */
volatile uint8_t LV_CTL1;
};
Expand Down Expand Up @@ -202,6 +206,8 @@ struct scfg_reg {
#define NPCM4XX_DEVPU0_I2C2_0_PUE 4
#define NPCM4XX_DEVPU0_I2C3_0_PUE 6
#define NPCM4XX_DEVPU1_F_SPI_PUD_EN 7
#define NPCM4XX_DEVALT10_CRGPIO_SELECT_SL_CORE 0
#define NPCM4XX_DEVALT10_CRGPIO_SELECT_SL_POWER 1
#define NPCM4XX_DEVALTCX_GPIO_PULL_EN 7

#define SCFG_BASE_ADDR (0x400C3000)
Expand Down
15 changes: 15 additions & 0 deletions soc/arm/npcm4xx/npcm400f/Kconfig.defconfig.series
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@ config ESPI_NPCM4XX
https://www.intel.com/content/www/us/en/support/articles/000020952/
software/chipset-software.html for more detail.

choice GPIO_NPCM4XX_RESET_SL
prompt "Selects the GPIO reset to the corresponding reset source"
default GPIO_NPCM4XX_RESET_SL_CORE_DOMAIN

config GPIO_NPCM4XX_RESET_SL_CORE_DOMAIN
bool "GPIO Reset by Core domain reset"
help
GPIO port 0-9, A-F is reset by Core domain reset.

config GPIO_NPCM4XX_RESET_SL_POWER_UP
bool "GPIO Reset by VSB Power-Up reset"
help
GPIO port 0-9, A-F is reset by VSB Power-Up reset.
endchoice

DT_CHOSEN_Z_FLASH := zephyr,flash

config FLASH_SIZE
Expand Down
11 changes: 11 additions & 0 deletions soc/arm/npcm4xx/npcm400f/soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,19 @@

LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL);

uintptr_t scfg_base = DT_REG_ADDR_BY_IDX(DT_NODELABEL(scfg), 0);

void z_platform_init(void)
{
struct scfg_reg *inst_scfg = (struct scfg_reg *)scfg_base;

if (scfg_base) {
#if CONFIG_GPIO_NPCM4XX_RESET_SL_POWER_UP
inst_scfg->DEVALT10 = NPCM4XX_DEVALT10_CRGPIO_SELECT_SL_POWER;
#else
inst_scfg->DEVALT10 = NPCM4XX_DEVALT10_CRGPIO_SELECT_SL_CORE;
#endif
}
}

static int soc_init(const struct device *dev)
Expand Down

0 comments on commit f9b8495

Please sign in to comment.