soc: npcx: scfg: add a new function to select the host interface type

The host interface type (eSPI/SHI) is selected via HIF_TYP_SEL field in
DEVCNT register. This commit adds a function to set it.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
This commit is contained in:
Jun Lin 2021-07-30 17:41:27 +08:00 committed by Carles Cufí
commit c3cde54303
3 changed files with 21 additions and 0 deletions

View file

@ -226,6 +226,13 @@ static inline uint32_t npcx_lv_gpio_ctl_offset(uint32_t ctl_no)
#define NPCX_DEVPU0_I2C3_0_PUE 6
#define NPCX_DEVPU1_F_SPI_PUD_EN 7
/* Supported host interface type for HIF_TYP_SEL FILED in DEVCNT register. */
enum npcx_hif_type {
NPCX_HIF_TYPE_NONE,
NPCX_HIF_TYPE_LPC,
NPCX_HIF_TYPE_ESPI_SHI,
};
/*
* System Glue (GLUE) device registers
*/

View file

@ -209,6 +209,13 @@ void npcx_pinctrl_psl_input_configure(void)
}
}
void npcx_host_interface_sel(enum npcx_hif_type hif_type)
{
struct scfg_reg *inst_scfg = HAL_SFCG_INST();
SET_FIELD(inst_scfg->DEVCNT, NPCX_DEVCNT_HIF_TYP_SEL_FIELD, hif_type);
}
/* Pin-control driver registration */
static int npcx_scfg_init(const struct device *dev)
{

View file

@ -168,6 +168,13 @@ void npcx_lvol_suspend_io_pads(void);
*/
bool npcx_lvol_is_enabled(int port, int pin);
/**
* @brief Select the host interface type
*
* @param hif_type host interface type
*/
void npcx_host_interface_sel(enum npcx_hif_type hif_type);
#ifdef __cplusplus
}
#endif