Lines Matching refs:tcs_id

142 tcs_reg_addr(const struct rsc_drv *drv, int reg, int tcs_id)  in tcs_reg_addr()  argument
144 return drv->tcs_base + RSC_DRV_TCS_OFFSET * tcs_id + reg; in tcs_reg_addr()
148 tcs_cmd_addr(const struct rsc_drv *drv, int reg, int tcs_id, int cmd_id) in tcs_cmd_addr() argument
150 return tcs_reg_addr(drv, reg, tcs_id) + RSC_DRV_CMD_OFFSET * cmd_id; in tcs_cmd_addr()
153 static u32 read_tcs_cmd(const struct rsc_drv *drv, int reg, int tcs_id, in read_tcs_cmd() argument
156 return readl_relaxed(tcs_cmd_addr(drv, reg, tcs_id, cmd_id)); in read_tcs_cmd()
159 static u32 read_tcs_reg(const struct rsc_drv *drv, int reg, int tcs_id) in read_tcs_reg() argument
161 return readl_relaxed(tcs_reg_addr(drv, reg, tcs_id)); in read_tcs_reg()
164 static void write_tcs_cmd(const struct rsc_drv *drv, int reg, int tcs_id, in write_tcs_cmd() argument
167 writel_relaxed(data, tcs_cmd_addr(drv, reg, tcs_id, cmd_id)); in write_tcs_cmd()
170 static void write_tcs_reg(const struct rsc_drv *drv, int reg, int tcs_id, in write_tcs_reg() argument
173 writel_relaxed(data, tcs_reg_addr(drv, reg, tcs_id)); in write_tcs_reg()
176 static void write_tcs_reg_sync(const struct rsc_drv *drv, int reg, int tcs_id, in write_tcs_reg_sync() argument
181 writel(data, tcs_reg_addr(drv, reg, tcs_id)); in write_tcs_reg_sync()
188 if (readl(tcs_reg_addr(drv, reg, tcs_id)) == data) in write_tcs_reg_sync()
193 data, tcs_id, reg); in write_tcs_reg_sync()
207 static bool tcs_is_free(struct rsc_drv *drv, int tcs_id) in tcs_is_free() argument
209 return !test_bit(tcs_id, drv->tcs_in_use); in tcs_is_free()
315 int tcs_id) in get_req_from_tcs() argument
322 if (tcs->mask & BIT(tcs_id)) in get_req_from_tcs()
323 return tcs->req[tcs_id - tcs->offset]; in get_req_from_tcs()
346 static void __tcs_set_trigger(struct rsc_drv *drv, int tcs_id, bool trigger) in __tcs_set_trigger() argument
355 enable = read_tcs_reg(drv, RSC_DRV_CONTROL, tcs_id); in __tcs_set_trigger()
357 write_tcs_reg_sync(drv, RSC_DRV_CONTROL, tcs_id, enable); in __tcs_set_trigger()
359 write_tcs_reg_sync(drv, RSC_DRV_CONTROL, tcs_id, enable); in __tcs_set_trigger()
364 write_tcs_reg_sync(drv, RSC_DRV_CONTROL, tcs_id, enable); in __tcs_set_trigger()
366 write_tcs_reg_sync(drv, RSC_DRV_CONTROL, tcs_id, enable); in __tcs_set_trigger()
379 static void enable_tcs_irq(struct rsc_drv *drv, int tcs_id, bool enable) in enable_tcs_irq() argument
385 data |= BIT(tcs_id); in enable_tcs_irq()
387 data &= ~BIT(tcs_id); in enable_tcs_irq()
475 static void __tcs_buffer_write(struct rsc_drv *drv, int tcs_id, int cmd_id, in __tcs_buffer_write() argument
488 cmd_complete = read_tcs_reg(drv, RSC_DRV_CMD_WAIT_FOR_CMPL, tcs_id); in __tcs_buffer_write()
497 write_tcs_cmd(drv, RSC_DRV_CMD_MSGID, tcs_id, j, msgid); in __tcs_buffer_write()
498 write_tcs_cmd(drv, RSC_DRV_CMD_ADDR, tcs_id, j, cmd->addr); in __tcs_buffer_write()
499 write_tcs_cmd(drv, RSC_DRV_CMD_DATA, tcs_id, j, cmd->data); in __tcs_buffer_write()
500 trace_rpmh_send_msg_rcuidle(drv, tcs_id, j, msgid, cmd); in __tcs_buffer_write()
503 write_tcs_reg(drv, RSC_DRV_CMD_WAIT_FOR_CMPL, tcs_id, cmd_complete); in __tcs_buffer_write()
504 cmd_enable |= read_tcs_reg(drv, RSC_DRV_CMD_ENABLE, tcs_id); in __tcs_buffer_write()
505 write_tcs_reg(drv, RSC_DRV_CMD_ENABLE, tcs_id, cmd_enable); in __tcs_buffer_write()
534 int tcs_id = tcs->offset; in check_for_req_inflight() local
536 for (i = 0; i < tcs->num_tcs; i++, tcs_id++) { in check_for_req_inflight()
537 if (tcs_is_free(drv, tcs_id)) in check_for_req_inflight()
540 curr_enabled = read_tcs_reg(drv, RSC_DRV_CMD_ENABLE, tcs_id); in check_for_req_inflight()
543 addr = read_tcs_cmd(drv, RSC_DRV_CMD_ADDR, tcs_id, j); in check_for_req_inflight()
631 int tcs_id; in rpmh_rsc_send_data() local
642 (tcs_id = claim_tcs_for_req(drv, tcs, msg)) >= 0, in rpmh_rsc_send_data()
645 tcs->req[tcs_id - tcs->offset] = msg; in rpmh_rsc_send_data()
646 set_bit(tcs_id, drv->tcs_in_use); in rpmh_rsc_send_data()
653 write_tcs_reg_sync(drv, RSC_DRV_CMD_ENABLE, tcs_id, 0); in rpmh_rsc_send_data()
654 write_tcs_reg_sync(drv, RSC_DRV_CMD_WAIT_FOR_CMPL, tcs_id, 0); in rpmh_rsc_send_data()
655 enable_tcs_irq(drv, tcs_id, true); in rpmh_rsc_send_data()
667 __tcs_buffer_write(drv, tcs_id, 0, msg); in rpmh_rsc_send_data()
668 __tcs_set_trigger(drv, tcs_id, true); in rpmh_rsc_send_data()
689 int *tcs_id, int *cmd_id) in find_slots() argument
706 *tcs_id = offset + tcs->offset; in find_slots()
728 int tcs_id = 0, cmd_id = 0; in rpmh_rsc_write_ctrl_data() local
736 ret = find_slots(tcs, msg, &tcs_id, &cmd_id); in rpmh_rsc_write_ctrl_data()
738 __tcs_buffer_write(drv, tcs_id, cmd_id, msg); in rpmh_rsc_write_ctrl_data()