Lines Matching refs:base
126 static struct mec_i2c_info const *get_i2c_smb_info(struct mec_i2c_smb_regs *base) in get_i2c_smb_info() argument
131 if (p->base_addr == (uintptr_t)base) { in get_i2c_smb_info()
145 const struct mec_i2c_info *info = get_i2c_smb_info(ctx->base); in mec_hal_i2c_smb_reset()
156 static void i2c_timing(struct mec_i2c_smb_regs *base, const struct mec_i2c_freq_cfg *freq_cfg) in i2c_timing() argument
158 base->BUSCLK = freq_cfg->bus_clk; in i2c_timing()
159 base->RSHT = freq_cfg->rpt_start_hold_time; in i2c_timing()
160 base->DATATM = freq_cfg->data_timing; in i2c_timing()
161 base->IDLESC = freq_cfg->idle_scaling; in i2c_timing()
162 base->TMOUTSC = freq_cfg->timeout_scaling; in i2c_timing()
168 struct mec_i2c_smb_regs *base = ctx->base; in i2c_config() local
172 base->CONFIG = (((uint32_t)config->port << MEC_I2C_SMB_CONFIG_PORT_SEL_Pos) in i2c_config()
174 base->CONFIG |= MEC_BIT(MEC_I2C_SMB_CONFIG_FEN_Pos); /* enable digital filter */ in i2c_config()
176 base->CTRL = control; in i2c_config()
183 base->OWN_ADDR = config->target_addr2; in i2c_config()
184 base->OWN_ADDR = (base->OWN_ADDR << 8) | config->target_addr1; in i2c_config()
187 i2c_timing(base, custom_freq_cfg); in i2c_config()
189 i2c_timing(base, &freq_cfg_dflt[config->std_freq]); in i2c_config()
192 base->COMPL = MEC_I2C_SMB_COMPL_STS_RW1C_MSK; in i2c_config()
198 base->CTRL = control; in i2c_config()
200 base->CONFIG |= MEC_BIT(MEC_I2C_SMB_CONFIG_ENAB_Pos); in i2c_config()
202 base->EXTLEN = 0; in i2c_config()
204 base->COMPL |= MEC_I2C_SMB_COMPL_STS_RW1C_MSK; in i2c_config()
212 if (!ctx || !ctx->base || !bus_freq_hz) { in mec_hal_i2c_smb_bus_freq_get()
216 struct mec_i2c_smb_regs *regs = ctx->base; in mec_hal_i2c_smb_bus_freq_get()
235 const struct mec_i2c_info *info = get_i2c_smb_info(ctx->base); in mec_hal_i2c_smb_init()
244 own_addrs = ctx->base->OWN_ADDR; in mec_hal_i2c_smb_init()
285 const struct mec_i2c_info *info = get_i2c_smb_info(ctx->base); in mec_hal_i2c_smb_own_addr()
304 struct mec_i2c_smb_regs *regs = ctx->base; in mec_hal_i2c_smb_own_addr()
338 struct mec_i2c_smb_regs *regs = ctx->base; in mec_hal_i2c_smb_clr_target_addr()
412 if (!ctx || !ctx->base) { in mec_hal_i2c_smb_is_bus_owned()
416 struct mec_i2c_smb_regs *base = ctx->base; in mec_hal_i2c_smb_is_bus_owned() local
418 if (base->STATUS & MEC_BIT(MEC_I2C_SMB_STATUS_NBB_Pos)) { in mec_hal_i2c_smb_is_bus_owned()
428 if (!ctx || !ctx->base) { in mec_hal_i2c_smb_ctrl_set()
432 struct mec_i2c_smb_regs *base = ctx->base; in mec_hal_i2c_smb_ctrl_set() local
435 base->CTRL = ctrl; in mec_hal_i2c_smb_ctrl_set()
452 if (!ctx || !ctx->base) { in mec_hal_i2c_cmd_ack_ctrl()
456 struct mec_i2c_smb_regs *base = ctx->base; in mec_hal_i2c_cmd_ack_ctrl() local
466 base->CTRL = ctrl; in mec_hal_i2c_cmd_ack_ctrl()
483 if (!ctx || !ctx->base) { in mec_hal_i2c_smb_auto_ack_enable()
487 struct mec_i2c_smb_regs *base = ctx->base; in mec_hal_i2c_smb_auto_ack_enable() local
495 base->CTRL = ctr; in mec_hal_i2c_smb_auto_ack_enable()
502 if (!ctx || !ctx->base) { in mec_hal_i2c_smb_auto_ack_disable()
506 struct mec_i2c_smb_regs *base = ctx->base; in mec_hal_i2c_smb_auto_ack_disable() local
514 base->CTRL = ctr; in mec_hal_i2c_smb_auto_ack_disable()
521 if (!ctx || !ctx->base) { in mec_hal_i2c_smb_idle_intr_enable()
526 struct mec_i2c_smb_regs *base = ctx->base; in mec_hal_i2c_smb_idle_intr_enable() local
529 base->CONFIG |= MEC_BIT(MEC_I2C_SMB_CONFIG_ENI_IDLE_Pos); in mec_hal_i2c_smb_idle_intr_enable()
531 base->CONFIG &= (uint32_t)~MEC_BIT(MEC_I2C_SMB_CONFIG_ENI_IDLE_Pos); in mec_hal_i2c_smb_idle_intr_enable()
542 if (!ctx || !ctx->base) { in mec_hal_i2c_smb_intr_ctrl()
547 struct mec_i2c_smb_regs *regs = ctx->base; in mec_hal_i2c_smb_intr_ctrl()
591 if (!ctx || !ctx->base) { in mec_hal_i2c_smb_status()
595 struct mec_i2c_smb_regs *base = ctx->base; in mec_hal_i2c_smb_status() local
596 uint32_t status = base->STATUS; in mec_hal_i2c_smb_status()
597 uint32_t compl = base->COMPL; in mec_hal_i2c_smb_status()
600 base->COMPL = compl; in mec_hal_i2c_smb_status()
612 struct mec_i2c_smb_regs *base = ctx->base; in mec_hal_i2c_smb_wake_status() local
614 return base->WAKE_STS; in mec_hal_i2c_smb_wake_status()
620 if (!ctx || !ctx->base) { in mec_hal_i2c_smb_wake_status_clr()
625 struct mec_i2c_smb_regs *base = ctx->base; in mec_hal_i2c_smb_wake_status_clr() local
627 base->WAKE_STS = MEC_BIT(MEC_I2C_SMB_WAKE_STS_START_DET_Pos); in mec_hal_i2c_smb_wake_status_clr()
633 if (!ctx || !ctx->base) { in mec_hal_i2c_smb_is_idle_ien()
637 struct mec_i2c_smb_regs *regs = ctx->base; in mec_hal_i2c_smb_is_idle_ien()
649 if (!ctx || !ctx->base) { in mec_hal_i2c_smb_is_idle_intr()
653 struct mec_i2c_smb_regs *base = ctx->base; in mec_hal_i2c_smb_is_idle_intr() local
654 uint32_t cfg = base->CONFIG & MEC_BIT(MEC_I2C_SMB_CONFIG_ENI_IDLE_Pos); in mec_hal_i2c_smb_is_idle_intr()
655 uint32_t compl = base->COMPL & MEC_BIT(MEC_I2C_SMB_COMPL_IDLE_Pos); in mec_hal_i2c_smb_is_idle_intr()
672 if (!ctx || !ctx->base) { in mec_hal_i2c_smb_is_aat_ien()
676 struct mec_i2c_smb_regs *base = ctx->base; in mec_hal_i2c_smb_is_aat_ien() local
677 uint32_t cfg = base->CONFIG & MEC_BIT(MEC_I2C_SMB_CONFIG_ENI_AAT_Pos); in mec_hal_i2c_smb_is_aat_ien()
689 if (!ctx || !ctx->base) { in mec_hal_i2c_smb_idle_status_clr()
693 struct mec_i2c_smb_regs *base = ctx->base; in mec_hal_i2c_smb_idle_status_clr() local
695 base->COMPL |= MEC_BIT(MEC_I2C_SMB_COMPL_IDLE_Pos); in mec_hal_i2c_smb_idle_status_clr()
711 if (!ctx || !ctx->base) { in mec_hal_i2c_smb_start_gen()
715 struct mec_i2c_smb_regs *base = ctx->base; in mec_hal_i2c_smb_start_gen() local
723 if (base->STATUS & MEC_BIT(MEC_I2C_SMB_STATUS_NBB_Pos)) { in mec_hal_i2c_smb_start_gen()
726 base->DATA = target_addr; in mec_hal_i2c_smb_start_gen()
727 base->CTRL = ctr; in mec_hal_i2c_smb_start_gen()
730 base->CTRL = ctr; in mec_hal_i2c_smb_start_gen()
731 base->DATA = target_addr; in mec_hal_i2c_smb_start_gen()
740 if (!ctx || !ctx->base) { in mec_hal_i2c_smb_stop_gen()
744 struct mec_i2c_smb_regs *base = ctx->base; in mec_hal_i2c_smb_stop_gen() local
749 if (base->STATUS & MEC_BIT(MEC_I2C_SMB_STATUS_NBB_Pos)) { in mec_hal_i2c_smb_stop_gen()
754 base->CTRL = control; in mec_hal_i2c_smb_stop_gen()
768 if (!ctx || !ctx->base) { in mec_hal_i2c_smb_xmit_byte()
772 struct mec_i2c_smb_regs *base = ctx->base; in mec_hal_i2c_smb_xmit_byte() local
781 base->DATA = msg_byte; in mec_hal_i2c_smb_xmit_byte()
792 if (!ctx || !ctx->base) { in mec_hal_i2c_smb_read_byte()
796 struct mec_i2c_smb_regs *base = ctx->base; in mec_hal_i2c_smb_read_byte() local
797 uint8_t b = base->DATA; in mec_hal_i2c_smb_read_byte()
809 if (!ctx || !ctx->base) { in mec_hal_i2c_smb_bbctrl()
813 struct mec_i2c_smb_regs *base = ctx->base; in mec_hal_i2c_smb_bbctrl() local
826 base->BBCTRL = bbctr; in mec_hal_i2c_smb_bbctrl()
841 if (!ctx || !ctx->base) { in mec_hal_i2c_smb_bbctrl_pin_states()
845 struct mec_i2c_smb_regs *base = ctx->base; in mec_hal_i2c_smb_bbctrl_pin_states() local
847 return (base->BBCTRL >> MEC_I2C_SMB_BBCTRL_BBCLKI_Pos) & 0x3u; in mec_hal_i2c_smb_bbctrl_pin_states()
860 if (!ctx || !ctx->base) { in mec_hal_i2c_nl_cm_cfg_start()
864 struct mec_i2c_smb_regs *regs = ctx->base; in mec_hal_i2c_nl_cm_cfg_start()
942 if (!ctx || !ctx->base) { in mec_hal_i2c_nl_cm_event()
946 struct mec_i2c_smb_regs *regs = ctx->base; in mec_hal_i2c_nl_cm_event()
966 if (!ctx || !ctx->base) { in mec_hal_i2c_nl_cmd_clear()
971 ctx->base->TM_CMD = 0; in mec_hal_i2c_nl_cmd_clear()
973 ctx->base->CM_CMD = 0; in mec_hal_i2c_nl_cmd_clear()
975 ctx->base->EXTLEN = 0; in mec_hal_i2c_nl_cmd_clear()
983 if (!ctx || !ctx->base) { in mec_hal_i2c_nl_cm_proceed()
987 ctx->base->CM_CMD |= (MEC_BIT(MEC_I2C_SMB_CM_CMD_RUN_Pos) in mec_hal_i2c_nl_cm_proceed()
995 if (!ctx || !ctx->base) { in mec_hal_i2c_nl_tm_proceed()
999 ctx->base->TM_CMD |= (MEC_BIT(MEC_I2C_SMB_TM_CMD_RUN_Pos) in mec_hal_i2c_nl_tm_proceed()
1108 if (!ctx || !ctx->base) { in mec_hal_i2c_nl_cmd_get()
1113 return ctx->base->CM_CMD; in mec_hal_i2c_nl_cmd_get()
1116 return ctx->base->TM_CMD; in mec_hal_i2c_nl_cmd_get()
1178 struct mec_i2c_smb_regs *regs = ctx->base; in mec_hal_i2c_nl_tm_config()
1227 if (!ctx || !ctx->base) { in mec_hal_i2c_nl_tm_event()
1231 struct mec_i2c_smb_regs *regs = ctx->base; in mec_hal_i2c_nl_tm_event()
1254 if (!ctx || !ctx->base) { in mec_hal_i2c_nl_tm_xfr_count_get()
1258 struct mec_i2c_smb_regs *regs = ctx->base; in mec_hal_i2c_nl_tm_xfr_count_get()
1316 if (!ctx || !ctx->base) { in mec_hal_i2c_nl_tm_transfered()