Lines Matching refs:tcs_id
64 static u32 read_tcs_reg(struct rsc_drv *drv, int reg, int tcs_id, int cmd_id) in read_tcs_reg() argument
66 return readl_relaxed(drv->tcs_base + reg + RSC_DRV_TCS_OFFSET * tcs_id + in read_tcs_reg()
70 static void write_tcs_cmd(struct rsc_drv *drv, int reg, int tcs_id, int cmd_id, in write_tcs_cmd() argument
73 writel_relaxed(data, drv->tcs_base + reg + RSC_DRV_TCS_OFFSET * tcs_id + in write_tcs_cmd()
77 static void write_tcs_reg(struct rsc_drv *drv, int reg, int tcs_id, u32 data) in write_tcs_reg() argument
79 writel_relaxed(data, drv->tcs_base + reg + RSC_DRV_TCS_OFFSET * tcs_id); in write_tcs_reg()
82 static void write_tcs_reg_sync(struct rsc_drv *drv, int reg, int tcs_id, in write_tcs_reg_sync() argument
85 writel(data, drv->tcs_base + reg + RSC_DRV_TCS_OFFSET * tcs_id); in write_tcs_reg_sync()
88 RSC_DRV_TCS_OFFSET * tcs_id)) in write_tcs_reg_sync()
94 static bool tcs_is_free(struct rsc_drv *drv, int tcs_id) in tcs_is_free() argument
96 return !test_bit(tcs_id, drv->tcs_in_use) && in tcs_is_free()
97 read_tcs_reg(drv, RSC_DRV_STATUS, tcs_id, 0); in tcs_is_free()
190 int tcs_id) in get_req_from_tcs() argument
197 if (tcs->mask & BIT(tcs_id)) in get_req_from_tcs()
198 return tcs->req[tcs_id - tcs->offset]; in get_req_from_tcs()
255 static void __tcs_buffer_write(struct rsc_drv *drv, int tcs_id, int cmd_id, in __tcs_buffer_write() argument
268 cmd_complete = read_tcs_reg(drv, RSC_DRV_CMD_WAIT_FOR_CMPL, tcs_id, 0); in __tcs_buffer_write()
277 write_tcs_cmd(drv, RSC_DRV_CMD_MSGID, tcs_id, j, msgid); in __tcs_buffer_write()
278 write_tcs_cmd(drv, RSC_DRV_CMD_ADDR, tcs_id, j, cmd->addr); in __tcs_buffer_write()
279 write_tcs_cmd(drv, RSC_DRV_CMD_DATA, tcs_id, j, cmd->data); in __tcs_buffer_write()
280 trace_rpmh_send_msg(drv, tcs_id, j, msgid, cmd); in __tcs_buffer_write()
283 write_tcs_reg(drv, RSC_DRV_CMD_WAIT_FOR_CMPL, tcs_id, cmd_complete); in __tcs_buffer_write()
284 cmd_enable |= read_tcs_reg(drv, RSC_DRV_CMD_ENABLE, tcs_id, 0); in __tcs_buffer_write()
285 write_tcs_reg(drv, RSC_DRV_CMD_ENABLE, tcs_id, cmd_enable); in __tcs_buffer_write()
288 static void __tcs_trigger(struct rsc_drv *drv, int tcs_id) in __tcs_trigger() argument
297 enable = read_tcs_reg(drv, RSC_DRV_CONTROL, tcs_id, 0); in __tcs_trigger()
299 write_tcs_reg_sync(drv, RSC_DRV_CONTROL, tcs_id, enable); in __tcs_trigger()
301 write_tcs_reg_sync(drv, RSC_DRV_CONTROL, tcs_id, enable); in __tcs_trigger()
305 write_tcs_reg_sync(drv, RSC_DRV_CONTROL, tcs_id, enable); in __tcs_trigger()
307 write_tcs_reg_sync(drv, RSC_DRV_CONTROL, tcs_id, enable); in __tcs_trigger()
316 int tcs_id = tcs->offset; in check_for_req_inflight() local
318 for (i = 0; i < tcs->num_tcs; i++, tcs_id++) { in check_for_req_inflight()
319 if (tcs_is_free(drv, tcs_id)) in check_for_req_inflight()
322 curr_enabled = read_tcs_reg(drv, RSC_DRV_CMD_ENABLE, tcs_id, 0); in check_for_req_inflight()
325 addr = read_tcs_reg(drv, RSC_DRV_CMD_ADDR, tcs_id, j); in check_for_req_inflight()
351 int tcs_id; in tcs_write() local
371 tcs_id = find_free_tcs(tcs); in tcs_write()
372 if (tcs_id < 0) { in tcs_write()
373 ret = tcs_id; in tcs_write()
378 tcs->req[tcs_id - tcs->offset] = msg; in tcs_write()
379 set_bit(tcs_id, drv->tcs_in_use); in tcs_write()
382 __tcs_buffer_write(drv, tcs_id, 0, msg); in tcs_write()
383 __tcs_trigger(drv, tcs_id); in tcs_write()
448 int *tcs_id, int *cmd_id) in find_slots() argument
474 *tcs_id = offset + tcs->offset; in find_slots()
483 int tcs_id = 0, cmd_id = 0; in tcs_ctrl_write() local
493 ret = find_slots(tcs, msg, &tcs_id, &cmd_id); in tcs_ctrl_write()
495 __tcs_buffer_write(drv, tcs_id, cmd_id, msg); in tcs_ctrl_write()