Lines Matching +full:num +full:- +full:inputs

4  * SPDX-License-Identifier: Apache-2.0
15 #include <zephyr/dt-bindings/espi/npcx_espi.h>
32 /* mapping table between eSPI reset signal and wake-up input */
77 ((struct espi_reg *)((const struct espi_npcx_config *)(dev)->config)->base)
132 /* eSPI Virtual Wire Input (Master-to-Slave) signals configuration structure */
136 uint8_t bitmask; /* VW signal bits-mask */
140 /* eSPI Virtual Wire Output (Slave-to-Master) signals configuration structure */
144 uint8_t bitmask; /* VW signal bits-mask */
149 * npcxn-espi-vws-map.dtsi device tree file for more detail.
237 /* VW signal which has no wake-up input source */ in espi_init_wui_callback()
238 if (wui->table == NPCX_MIWU_TABLE_NONE) { in espi_init_wui_callback()
255 uint32_t err = inst->ESPIERR; in espi_bus_err_isr()
259 inst->ESPIERR = err; in espi_bus_err_isr()
279 struct espi_npcx_data *const data = dev->data; in espi_npcx_flash_fake_request()
281 inst->FLASHCTL &= ~BIT(NPCX_FLASHCTL_AMTEN); in espi_npcx_flash_fake_request()
283 data->fake_req_flag = true; in espi_npcx_flash_fake_request()
293 struct espi_npcx_data *const data = dev->data; in espi_bus_cfg_update_isr()
298 uint8_t chg_mask = GET_FIELD(inst->ESPICFG, NPCX_ESPICFG_HCHANS_FIELD) in espi_bus_cfg_update_isr()
299 ^ GET_FIELD(inst->ESPICFG, NPCX_ESPICFG_CHANS_FIELD); in espi_bus_cfg_update_isr()
312 evt.evt_data = IS_BIT_SET(inst->ESPICFG, in espi_bus_cfg_update_isr()
318 IS_BIT_SET(inst->FLASHCTL, NPCX_FLASHCTL_FLASH_TX_AVAIL)) { in espi_bus_cfg_update_isr()
324 inst->ESPICFG |= BIT(chan); in espi_bus_cfg_update_isr()
326 inst->ESPICFG &= ~BIT(chan); in espi_bus_cfg_update_isr()
329 espi_send_callbacks(&data->callbacks, dev, evt); in espi_bus_cfg_update_isr()
332 LOG_DBG("ESPI CFG EC Updated! 0x%02X", GET_FIELD(inst->ESPICFG, in espi_bus_cfg_update_isr()
336 if ((chg_mask & BIT(NPCX_ESPI_CH_VW)) && IS_BIT_SET(inst->ESPICFG, in espi_bus_cfg_update_isr()
345 if (IS_BIT_SET(inst->ESPICFG, NPCX_ESPICFG_FLCHANMODE)) { in espi_bus_cfg_update_isr()
347 inst->FLASHCTL |= BIT(NPCX_FLASHCTL_SAF_AUTO_READ); in espi_bus_cfg_update_isr()
349 inst->FLASHCTL &= ~BIT(NPCX_FLASHCTL_SAF_AUTO_READ); in espi_bus_cfg_update_isr()
358 struct espi_npcx_data *const data = dev->data; in espi_bus_oob_rx_isr()
368 evt.evt_details = NPCX_OOB_RX_PACKAGE_LEN(inst->OOBRXBUF[0]); in espi_bus_oob_rx_isr()
369 espi_send_callbacks(&data->callbacks, dev, evt); in espi_bus_oob_rx_isr()
373 k_sem_give(&data->oob_rx_lock); in espi_bus_oob_rx_isr()
390 head_data = inst->FLASHRXBUF[0]; in espi_taf_parse()
402 taf_addr = inst->FLASHRXBUF[1]; in espi_taf_parse()
411 taf_pckt.src[i] = inst->FLASHRXBUF[2 + i]; in espi_taf_parse()
422 struct espi_npcx_data *const data = dev->data; in espi_bus_flash_rx_isr()
425 if ((inst->ESPICFG & BIT(NPCX_ESPICFG_FLCHANMODE)) == 0) { in espi_bus_flash_rx_isr()
427 if (data->fake_req_flag == true) { in espi_bus_flash_rx_isr()
433 data->fake_req_flag = false; in espi_bus_flash_rx_isr()
437 k_sem_give(&data->flash_rx_lock); in espi_bus_flash_rx_isr()
445 espi_send_callbacks(&data->callbacks, dev, evt); in espi_bus_flash_rx_isr()
476 mask = inst->ESPIIE | (1 << NPCX_ESPISTS_VWUPDW); in espi_bus_generic_isr()
477 status = inst->ESPISTS & mask; in espi_bus_generic_isr()
480 inst->ESPISTS = status; in espi_bus_generic_isr()
494 /* eSPI local virtual-wire service functions */
499 int idx = config_in->reg_idx; in espi_vw_config_input()
502 if (IS_BIT_SET(inst->VWEVMS[idx], NPCX_VWEVMS_IE) && in espi_vw_config_input()
503 IS_BIT_SET(inst->VWEVMS[idx], NPCX_VWEVMS_WE)) { in espi_vw_config_input()
508 inst->VWEVMS[idx] |= BIT(NPCX_VWEVMS_IE) | BIT(NPCX_VWEVMS_WE); in espi_vw_config_input()
509 LOG_DBG("VWEVMS%d 0x%08X", idx, inst->VWEVMS[idx]); in espi_vw_config_input()
516 int idx = config_out->reg_idx; in espi_vw_config_output()
517 uint8_t valid = GET_FIELD(inst->VWEVSM[idx], NPCX_VWEVSM_VALID); in espi_vw_config_output()
520 valid |= config_out->bitmask; in espi_vw_config_output()
521 SET_FIELD(inst->VWEVSM[idx], NPCX_VWEVSM_VALID, valid); in espi_vw_config_output()
524 * Turn off hardware-wire feature which generates VW events that in espi_vw_config_output()
527 SET_FIELD(inst->VWEVSM[idx], NPCX_VWEVSM_HW_WIRE, 0); in espi_vw_config_output()
529 LOG_DBG("VWEVSM%d 0x%08X", idx, inst->VWEVSM[idx]); in espi_vw_config_output()
537 int idx = config_out->reg_idx; in espi_vw_gpio_config_output()
538 uint8_t valid = GET_FIELD(inst->VWGPSM[idx], NPCX_VWEVSM_VALID); in espi_vw_gpio_config_output()
539 uint8_t val = GET_FIELD(inst->VWGPSM[idx], NPCX_VWEVSM_WIRE); in espi_vw_gpio_config_output()
542 valid |= config_out->bitmask; in espi_vw_gpio_config_output()
543 SET_FIELD(inst->VWGPSM[idx], NPCX_VWEVSM_VALID, valid); in espi_vw_gpio_config_output()
545 inst->VWGPSM[idx] |= BIT(NPCX_VWGPSM_INDEX_EN); in espi_vw_gpio_config_output()
548 val |= config_out->bitmask; in espi_vw_gpio_config_output()
550 val &= ~config_out->bitmask; in espi_vw_gpio_config_output()
553 SET_FIELD(inst->VWGPSM[idx], NPCX_VWEVSM_WIRE, val); in espi_vw_gpio_config_output()
555 LOG_DBG("VWEVSM%d 0x%08X", idx, inst->VWGPSM[idx]); in espi_vw_gpio_config_output()
561 struct espi_npcx_data *const data = dev->data; in espi_vw_notify_system_state()
567 data->sx_state = signal; in espi_vw_notify_system_state()
572 espi_send_callbacks(&data->callbacks, dev, evt); in espi_vw_notify_system_state()
609 struct espi_npcx_data *const data = dev->data; in espi_vw_notify_plt_rst()
619 /* Set Peripheral Channel ready when PLTRST is de-asserted */ in espi_vw_notify_plt_rst()
620 inst->ESPICFG |= BIT(NPCX_ESPICFG_PCHANEN); in espi_vw_notify_plt_rst()
621 /* Configure all host sub-modules in host domain */ in espi_vw_notify_plt_rst()
626 if (wire != data->plt_rst_asserted) { in espi_vw_notify_plt_rst()
627 data->plt_rst_asserted = wire; in espi_vw_notify_plt_rst()
629 espi_send_callbacks(&data->callbacks, dev, evt); in espi_vw_notify_plt_rst()
652 LOG_DBG("%s: WUI %d %d %d", __func__, wui->table, wui->group, wui->bit); in espi_vw_generic_isr()
654 if (wui->table == vw_in_tbl[idx].vw_wui.table && in espi_vw_generic_isr()
655 wui->group == vw_in_tbl[idx].vw_wui.group && in espi_vw_generic_isr()
656 wui->bit == vw_in_tbl[idx].vw_wui.bit) { in espi_vw_generic_isr()
662 LOG_ERR("Unknown VW event! %d %d %d", wui->table, in espi_vw_generic_isr()
663 wui->group, wui->bit); in espi_vw_generic_isr()
692 struct espi_npcx_data *const data = dev->data; in espi_vw_espi_rst_isr()
695 data->espi_rst_level = IS_BIT_SET(inst->ESPISTS, in espi_vw_espi_rst_isr()
697 LOG_DBG("eSPI RST level is %d!", data->espi_rst_level); in espi_vw_espi_rst_isr()
699 evt.evt_data = data->espi_rst_level; in espi_vw_espi_rst_isr()
700 espi_send_callbacks(&data->callbacks, dev, evt); in espi_vw_espi_rst_isr()
712 switch (cfg->max_freq) { in espi_npcx_configure()
731 return -EINVAL; in espi_npcx_configure()
733 SET_FIELD(inst->ESPICFG, NPCX_ESPICFG_MAXFREQ_FIELD, max_freq); in espi_npcx_configure()
736 io_mode = (cfg->io_caps >> 1); in espi_npcx_configure()
738 return -EINVAL; in espi_npcx_configure()
741 cur_io_mode = GET_FIELD(inst->ESPICFG, NPCX_ESPICFG_IOMODE_FIELD); in espi_npcx_configure()
743 SET_FIELD(inst->ESPICFG, NPCX_ESPICFG_IOMODE_FIELD, io_mode); in espi_npcx_configure()
747 if (cfg->channel_caps & ESPI_CHANNEL_PERIPHERAL) { in espi_npcx_configure()
748 inst->ESPICFG |= BIT(NPCX_ESPICFG_PCCHN_SUPP); in espi_npcx_configure()
751 if (cfg->channel_caps & ESPI_CHANNEL_VWIRE) { in espi_npcx_configure()
752 inst->ESPICFG |= BIT(NPCX_ESPICFG_VWCHN_SUPP); in espi_npcx_configure()
755 if (cfg->channel_caps & ESPI_CHANNEL_OOB) { in espi_npcx_configure()
756 inst->ESPICFG |= BIT(NPCX_ESPICFG_OOBCHN_SUPP); in espi_npcx_configure()
759 if (cfg->channel_caps & ESPI_CHANNEL_FLASH) { in espi_npcx_configure()
760 inst->ESPICFG |= BIT(NPCX_ESPICFG_FLASHCHN_SUPP); in espi_npcx_configure()
764 max_freq, io_mode, inst->ESPICFG); in espi_npcx_configure()
777 sts = IS_BIT_SET(inst->ESPICFG, NPCX_ESPICFG_PCHANEN); in espi_npcx_channel_ready()
780 sts = IS_BIT_SET(inst->ESPICFG, NPCX_ESPICFG_VWCHANEN); in espi_npcx_channel_ready()
783 sts = IS_BIT_SET(inst->ESPICFG, NPCX_ESPICFG_OOBCHANEN); in espi_npcx_channel_ready()
786 sts = IS_BIT_SET(inst->ESPICFG, NPCX_ESPICFG_FLASHCHANEN); in espi_npcx_channel_ready()
807 return -EINVAL; in espi_npcx_send_vwire()
829 return -EIO; in espi_npcx_send_vwire()
837 val = GET_FIELD(inst->VWGPSM[reg_idx], NPCX_VWEVSM_WIRE); in espi_npcx_send_vwire()
839 val = GET_FIELD(inst->VWEVSM[reg_idx], NPCX_VWEVSM_WIRE); in espi_npcx_send_vwire()
849 SET_FIELD(inst->VWGPSM[reg_idx], NPCX_VWEVSM_WIRE, val); in espi_npcx_send_vwire()
850 reg_val = inst->VWGPSM[reg_idx]; in espi_npcx_send_vwire()
852 SET_FIELD(inst->VWEVSM[reg_idx], NPCX_VWEVSM_WIRE, val); in espi_npcx_send_vwire()
853 reg_val = inst->VWEVSM[reg_idx]; in espi_npcx_send_vwire()
873 val = GET_FIELD(inst->VWEVMS[reg_idx], in espi_npcx_receive_vwire()
877 val &= GET_FIELD(inst->VWEVMS[reg_idx], in espi_npcx_receive_vwire()
892 val = GET_FIELD(inst->VWEVSM[reg_idx], in espi_npcx_receive_vwire()
896 val &= GET_FIELD(inst->VWEVSM[reg_idx], in espi_npcx_receive_vwire()
906 return -EIO; in espi_npcx_receive_vwire()
912 struct espi_npcx_data *const data = dev->data; in espi_npcx_manage_callback()
914 return espi_manage_callback(&data->callbacks, callback, set); in espi_npcx_manage_callback()
940 uint8_t *oob_buf = pckt->buf; in espi_npcx_send_oob()
941 int sz_oob_tx = pckt->len; in espi_npcx_send_oob()
948 return -EINVAL; in espi_npcx_send_oob()
952 if (IS_BIT_SET(inst->OOBCTL, NPCX_OOBCTL_OOB_AVAIL)) { in espi_npcx_send_oob()
954 return -EBUSY; in espi_npcx_send_oob()
958 * GET_OOB header (first 4 bytes) in npcx 32-bits tx buffer in espi_npcx_send_oob()
960 * [24:31] - LEN[0:7] Data length of GET_OOB request package in espi_npcx_send_oob()
961 * [20:23] - TAG Tag of GET_OOB in espi_npcx_send_oob()
962 * [16:19] - LEN[8:11] Ignore it since max payload is 64 bytes in espi_npcx_send_oob()
963 * [8:15] - CYCLE_TYPE Cycle type of GET_OOB in espi_npcx_send_oob()
964 * [0:7] - SZ_PACK Package size plus 3 bytes header. (Npcx only) in espi_npcx_send_oob()
966 inst->OOBTXBUF[0] = (sz_oob_tx + 3) in espi_npcx_send_oob()
971 /* Write GET_OOB data into 32-bits tx buffer in little endian */ in espi_npcx_send_oob()
974 inst->OOBTXBUF[idx_tx_buf + 1] = oob_buf[0] in espi_npcx_send_oob()
987 inst->OOBTXBUF[idx_tx_buf + 1] = oob_data; in espi_npcx_send_oob()
994 oob_data = inst->OOBCTL & ~(BIT(NPCX_OOBCTL_OOB_FREE)); in espi_npcx_send_oob()
996 inst->OOBCTL = oob_data; in espi_npcx_send_oob()
998 while (IS_BIT_SET(inst->OOBCTL, NPCX_OOBCTL_OOB_AVAIL)) { in espi_npcx_send_oob()
1010 uint8_t *oob_buf = pckt->buf; in espi_npcx_receive_oob()
1015 if (IS_BIT_SET(inst->ESPISTS, NPCX_ESPISTS_BERR)) { in espi_npcx_receive_oob()
1016 LOG_ERR("%s: eSPI Bus Error: 0x%08X", __func__, inst->ESPIERR); in espi_npcx_receive_oob()
1017 return -EIO; in espi_npcx_receive_oob()
1021 struct espi_npcx_data *const data = dev->data; in espi_npcx_receive_oob()
1025 ret = k_sem_take(&data->oob_rx_lock, K_MSEC(ESPI_OOB_MAX_TIMEOUT)); in espi_npcx_receive_oob()
1026 if (ret == -EAGAIN) { in espi_npcx_receive_oob()
1028 return -ETIMEDOUT; in espi_npcx_receive_oob()
1033 * PUT_OOB header (first 4 bytes) in npcx 32-bits rx buffer in espi_npcx_receive_oob()
1035 * [24:31] - LEN[0:7] Data length of PUT_OOB request package in espi_npcx_receive_oob()
1036 * [20:23] - TAG Tag of PUT_OOB in espi_npcx_receive_oob()
1037 * [16:19] - LEN[8:11] Data length of PUT_OOB request package in espi_npcx_receive_oob()
1038 * [8:15] - CYCLE_TYPE Cycle type of PUT_OOB in espi_npcx_receive_oob()
1039 * [0:7] - SZ_PACK Reserved. (Npcx only) in espi_npcx_receive_oob()
1041 oob_data = inst->OOBRXBUF[0]; in espi_npcx_receive_oob()
1048 return -EINVAL; in espi_npcx_receive_oob()
1052 pckt->len = sz_oob_rx; in espi_npcx_receive_oob()
1054 /* Read PUT_OOB data into 32-bits rx buffer in little endian */ in espi_npcx_receive_oob()
1056 oob_data = inst->OOBRXBUF[idx_rx_buf + 1]; in espi_npcx_receive_oob()
1068 oob_data = inst->OOBRXBUF[idx_rx_buf + 1]; in espi_npcx_receive_oob()
1075 inst->OOBCTL |= BIT(NPCX_OOBCTL_OOB_FREE); in espi_npcx_receive_oob()
1089 * [24:31] - LEN[0:7] = n Data length of flash cycle request in espi_npcx_flash_prepare_tx_header()
1090 * [16:23] - LEN[8:15] = 0 Ignore it since max buffer size is 64 bytes in espi_npcx_flash_prepare_tx_header()
1091 * [12:15] - TAG = 0 Tag of flash cycle command is always 0 here in espi_npcx_flash_prepare_tx_header()
1092 * [8:11] - CYCLE_TYPE = 0 Cycle type of flash command in espi_npcx_flash_prepare_tx_header()
1093 * [0:7] - SZ_PACK = 7 Overall tx package size. (Used internally.) in espi_npcx_flash_prepare_tx_header()
1095 inst->FLASHTXBUF[0] = (flash_len << 24) | in espi_npcx_flash_prepare_tx_header()
1102 * [24:31] - ADDR[0:7] Start address of flash cycle command request in espi_npcx_flash_prepare_tx_header()
1103 * [16:23] - ADDR[15:8] in espi_npcx_flash_prepare_tx_header()
1104 * [8:15] - ADDR[23:16] in espi_npcx_flash_prepare_tx_header()
1105 * [0:7] - ADDR[31:24] in espi_npcx_flash_prepare_tx_header()
1107 inst->FLASHTXBUF[1] = sys_cpu_to_be32(flash_addr); in espi_npcx_flash_prepare_tx_header()
1119 * [24:31] - LEN[0:7] Data length of flash cycle completion package in espi_npcx_flash_parse_completion()
1120 * [16:23] - LEN[8:15] Ignore it since rx bufer size is 64 bytes in espi_npcx_flash_parse_completion()
1121 * [12:15] - TAG Tag of flash cycle completion package in espi_npcx_flash_parse_completion()
1122 * [8:11] - CYCLE_TYPE Cycle type of flash completion in espi_npcx_flash_parse_completion()
1123 * [0:7] - Reserved in espi_npcx_flash_parse_completion()
1125 cycle_type = (inst->FLASHRXBUF[0] & 0xff00) >> 8; in espi_npcx_flash_parse_completion()
1130 return -EIO; in espi_npcx_flash_parse_completion()
1142 * [24:31] - LEN[0:7] Data length of flash cycle completion package in espi_npcx_flash_parse_completion_with_data()
1143 * [16:23] - LEN[8:15] Ignore it since rx bufer size is 64 bytes in espi_npcx_flash_parse_completion_with_data()
1144 * [12:15] - TAG Tag of flash cycle completion package in espi_npcx_flash_parse_completion_with_data()
1145 * [8:11] - CYCLE_TYPE Cycle type of flash completion in espi_npcx_flash_parse_completion_with_data()
1146 * [0:7] - Reserved in espi_npcx_flash_parse_completion_with_data()
1150 cycle_type = (inst->FLASHRXBUF[0] & 0xff00) >> 8; in espi_npcx_flash_parse_completion_with_data()
1151 sz_rx_payload = inst->FLASHRXBUF[0] >> 24; in espi_npcx_flash_parse_completion_with_data()
1153 volatile uint32_t *rx_buf = &inst->FLASHRXBUF[1]; in espi_npcx_flash_parse_completion_with_data()
1154 uint8_t *buf = pckt->buf; in espi_npcx_flash_parse_completion_with_data()
1178 return -EIO; in espi_npcx_flash_parse_completion_with_data()
1186 struct espi_npcx_data *const data = dev->data; in espi_npcx_flash_read()
1189 if (pckt->len > NPCX_ESPI_FLASH_MAX_RX_PAYLOAD) { in espi_npcx_flash_read()
1190 LOG_ERR("Out of FLASH transmitted buffer: %d", pckt->len); in espi_npcx_flash_read()
1191 return -EINVAL; in espi_npcx_flash_read()
1195 if (IS_BIT_SET(inst->FLASHCTL, NPCX_FLASHCTL_FLASH_TX_AVAIL)) { in espi_npcx_flash_read()
1197 return -EBUSY; in espi_npcx_flash_read()
1203 pckt->flash_addr, in espi_npcx_flash_read()
1204 pckt->len, in espi_npcx_flash_read()
1208 inst->FLASHCTL |= BIT(NPCX_FLASHCTL_FLASH_TX_AVAIL); in espi_npcx_flash_read()
1211 ret = k_sem_take(&data->flash_rx_lock, K_MSEC(ESPI_FLASH_MAX_TIMEOUT)); in espi_npcx_flash_read()
1212 if (ret == -EAGAIN) { in espi_npcx_flash_read()
1214 return -ETIMEDOUT; in espi_npcx_flash_read()
1226 struct espi_npcx_data *const data = dev->data; in espi_npcx_flash_write()
1227 volatile uint32_t *tx_buf = &inst->FLASHTXBUF[2]; in espi_npcx_flash_write()
1228 uint8_t *buf = pckt->buf; in espi_npcx_flash_write()
1231 if (pckt->len > NPCX_ESPI_FLASH_MAX_TX_PAYLOAD) { in espi_npcx_flash_write()
1232 LOG_ERR("Out of FLASH transmitted buffer: %d", pckt->len); in espi_npcx_flash_write()
1233 return -EINVAL; in espi_npcx_flash_write()
1237 if (IS_BIT_SET(inst->FLASHCTL, NPCX_FLASHCTL_FLASH_TX_AVAIL)) { in espi_npcx_flash_write()
1239 return -EBUSY; in espi_npcx_flash_write()
1245 pckt->flash_addr, in espi_npcx_flash_write()
1246 pckt->len, in espi_npcx_flash_write()
1247 pckt->len); in espi_npcx_flash_write()
1250 for (int i = 0; i < pckt->len / 4; i++, tx_buf++) { in espi_npcx_flash_write()
1259 if (pckt->len % 4) { in espi_npcx_flash_write()
1261 for (int j = 0; j < pckt->len % 4; j++, buf++) { in espi_npcx_flash_write()
1268 inst->FLASHCTL |= BIT(NPCX_FLASHCTL_FLASH_TX_AVAIL); in espi_npcx_flash_write()
1271 ret = k_sem_take(&data->flash_rx_lock, K_MSEC(ESPI_FLASH_MAX_TIMEOUT)); in espi_npcx_flash_write()
1272 if (ret == -EAGAIN) { in espi_npcx_flash_write()
1274 return -ETIMEDOUT; in espi_npcx_flash_write()
1286 struct espi_npcx_data *const data = dev->data; in espi_npcx_flash_erase()
1289 if (IS_BIT_SET(inst->FLASHCTL, NPCX_FLASHCTL_FLASH_TX_AVAIL)) { in espi_npcx_flash_erase()
1291 return -EBUSY; in espi_npcx_flash_erase()
1297 pckt->flash_addr, in espi_npcx_flash_erase()
1298 pckt->len, in espi_npcx_flash_erase()
1302 inst->FLASHCTL |= BIT(NPCX_FLASHCTL_FLASH_TX_AVAIL); in espi_npcx_flash_erase()
1305 ret = k_sem_take(&data->flash_rx_lock, K_MSEC(ESPI_FLASH_MAX_TIMEOUT)); in espi_npcx_flash_erase()
1306 if (ret == -EAGAIN) { in espi_npcx_flash_erase()
1308 return -ETIMEDOUT; in espi_npcx_flash_erase()
1319 const struct espi_npcx_config *const config = dev->config; in npcx_espi_enable_interrupts()
1324 /* Turn on all VW inputs' MIWU interrupts */ in npcx_espi_enable_interrupts()
1329 npcx_miwu_irq_enable(&config->espi_rst_wui); in npcx_espi_enable_interrupts()
1334 const struct espi_npcx_config *const config = dev->config; in npcx_espi_disable_interrupts()
1339 /* Turn off all VW inputs' MIWU interrupts */ in npcx_espi_disable_interrupts()
1344 npcx_miwu_irq_disable(&config->espi_rst_wui); in npcx_espi_disable_interrupts()
1389 const struct espi_npcx_config *const config = dev->config; in espi_npcx_init()
1390 struct espi_npcx_data *const data = dev->data; in espi_npcx_init()
1397 return -ENODEV; in espi_npcx_init()
1402 &config->clk_cfg); in espi_npcx_init()
1410 inst->NPCX_ONLY_ESPI_REG1 = NPCX_ONLY_ESPI_REG1_UNLOCK_REG2; in espi_npcx_init()
1411 inst->NPCX_ONLY_ESPI_REG2 &= ~BIT(NPCX_ONLY_ESPI_REG2_TRANS_END_CONFIG); in espi_npcx_init()
1413 inst->NPCX_ONLY_ESPI_REG1 = NPCX_ONLY_ESPI_REG1_LOCK_REG2; in espi_npcx_init()
1418 inst->ESPIIE |= BIT(espi_bus_isr_tbl[i].int_en_bit); in espi_npcx_init()
1419 inst->ESPIWE |= BIT(espi_bus_isr_tbl[i].wake_en_bit); in espi_npcx_init()
1423 k_sem_init(&data->oob_rx_lock, 0, 1); in espi_npcx_init()
1427 k_sem_init(&data->flash_rx_lock, 0, 1); in espi_npcx_init()
1445 /* Configure wake-up input and callback for eSPI VW input signal */ in espi_npcx_init()
1451 /* Configure wake-up input and callback for ESPI_RST signal */ in espi_npcx_init()
1453 &config->espi_rst_wui, espi_vw_espi_rst_isr); in espi_npcx_init()
1457 uint8_t dir, num, index; in espi_npcx_init() local
1461 num = espi_npcx_vw_ex_0[i].group_num; in espi_npcx_init()
1465 if (num >= NPCX_VWEVMS_MAX) { in espi_npcx_init()
1466 LOG_ERR("Error Setting for VW extend MS group (%x)", num); in espi_npcx_init()
1467 return -EINVAL; in espi_npcx_init()
1469 SET_FIELD(inst->VWEVMS[num], NPCX_VWEVMS_INDEX, index); in espi_npcx_init()
1470 SET_FIELD(inst->VWEVMS[num], NPCX_VWEVMS_VALID, 0x0); in espi_npcx_init()
1471 inst->VWEVMS[num] |= BIT(NPCX_VWEVMS_INDEX_EN); in espi_npcx_init()
1473 if (num >= NPCX_VWEVSM_MAX) { in espi_npcx_init()
1474 LOG_ERR("Error Setting for VW extend SM group (%x)", num); in espi_npcx_init()
1475 return -EINVAL; in espi_npcx_init()
1477 SET_FIELD(inst->VWEVSM[num], NPCX_VWEVSM_INDEX, index); in espi_npcx_init()
1478 SET_FIELD(inst->VWEVSM[num], NPCX_VWEVSM_VALID, 0x0); in espi_npcx_init()
1479 inst->VWEVSM[num] |= BIT(NPCX_VWEVSM_INDEX_EN); in espi_npcx_init()
1482 return -EINVAL; in espi_npcx_init()
1487 /* Configure pin-mux for eSPI bus device */ in espi_npcx_init()
1488 ret = pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT); in espi_npcx_init()
1494 /* Configure host sub-modules which HW blocks belong to core domain */ in espi_npcx_init()
1495 npcx_host_init_subs_core_domain(dev, &data->callbacks); in espi_npcx_init()
1498 npcx_init_taf(dev, &data->callbacks); in espi_npcx_init()