Lines Matching refs:target

21 static int htc_issue_send(struct htc_target *target, struct sk_buff* skb,  in htc_issue_send()  argument
26 struct htc_endpoint *endpoint = &target->endpoint[epid]; in htc_issue_send()
35 status = target->hif->send(target->hif_dev, endpoint->ul_pipeid, skb); in htc_issue_send()
88 static void htc_process_target_rdy(struct htc_target *target, in htc_process_target_rdy() argument
94 target->credit_size = be16_to_cpu(htc_ready_msg->credit_size); in htc_process_target_rdy()
96 endpoint = &target->endpoint[ENDPOINT0]; in htc_process_target_rdy()
99 atomic_inc(&target->tgt_ready); in htc_process_target_rdy()
100 complete(&target->target_wait); in htc_process_target_rdy()
103 static void htc_process_conn_rsp(struct htc_target *target, in htc_process_conn_rsp() argument
122 endpoint = &target->endpoint[epid]; in htc_process_conn_rsp()
125 tmp_endpoint = &target->endpoint[tepid]; in htc_process_conn_rsp()
141 target->conn_rsp_epid = epid; in htc_process_conn_rsp()
142 complete(&target->cmd_wait); in htc_process_conn_rsp()
144 target->conn_rsp_epid = ENDPOINT_UNUSED; in htc_process_conn_rsp()
148 static int htc_config_pipe_credits(struct htc_target *target) in htc_config_pipe_credits() argument
157 dev_err(target->dev, "failed to allocate send buffer\n"); in htc_config_pipe_credits()
166 cp_msg->credits = target->credits; in htc_config_pipe_credits()
168 target->htc_flags |= HTC_OP_CONFIG_PIPE_CREDITS; in htc_config_pipe_credits()
170 ret = htc_issue_send(target, skb, skb->len, 0, ENDPOINT0); in htc_config_pipe_credits()
174 time_left = wait_for_completion_timeout(&target->cmd_wait, HZ); in htc_config_pipe_credits()
176 dev_err(target->dev, "HTC credit config timeout\n"); in htc_config_pipe_credits()
186 static int htc_setup_complete(struct htc_target *target) in htc_setup_complete() argument
195 dev_err(target->dev, "failed to allocate send buffer\n"); in htc_setup_complete()
203 target->htc_flags |= HTC_OP_START_WAIT; in htc_setup_complete()
205 ret = htc_issue_send(target, skb, skb->len, 0, ENDPOINT0); in htc_setup_complete()
209 time_left = wait_for_completion_timeout(&target->cmd_wait, HZ); in htc_setup_complete()
211 dev_err(target->dev, "HTC start timeout\n"); in htc_setup_complete()
224 int htc_init(struct htc_target *target) in htc_init() argument
228 ret = htc_config_pipe_credits(target); in htc_init()
232 return htc_setup_complete(target); in htc_init()
235 int htc_connect_service(struct htc_target *target, in htc_connect_service() argument
246 endpoint = get_next_avail_ep(target->endpoint); in htc_connect_service()
248 dev_err(target->dev, "Endpoint is not available for service %d\n", in htc_connect_service()
262 dev_err(target->dev, "Failed to allocate buf to send" in htc_connect_service()
280 ret = htc_issue_send(target, skb, skb->len, 0, ENDPOINT0); in htc_connect_service()
284 time_left = wait_for_completion_timeout(&target->cmd_wait, HZ); in htc_connect_service()
286 dev_err(target->dev, "Service connection timeout for: %d\n", in htc_connect_service()
291 *conn_rsp_epid = target->conn_rsp_epid; in htc_connect_service()
298 int htc_send(struct htc_target *target, struct sk_buff *skb) in htc_send() argument
303 return htc_issue_send(target, skb, skb->len, 0, tx_ctl->epid); in htc_send()
306 int htc_send_epid(struct htc_target *target, struct sk_buff *skb, in htc_send_epid() argument
309 return htc_issue_send(target, skb, skb->len, 0, epid); in htc_send_epid()
312 void htc_stop(struct htc_target *target) in htc_stop() argument
314 target->hif->stop(target->hif_dev); in htc_stop()
317 void htc_start(struct htc_target *target) in htc_start() argument
319 target->hif->start(target->hif_dev); in htc_start()
322 void htc_sta_drain(struct htc_target *target, u8 idx) in htc_sta_drain() argument
324 target->hif->sta_drain(target->hif_dev, idx); in htc_sta_drain()
491 struct htc_target *target; in ath9k_htc_hw_alloc() local
493 target = kzalloc(sizeof(struct htc_target), GFP_KERNEL); in ath9k_htc_hw_alloc()
494 if (!target) in ath9k_htc_hw_alloc()
497 init_completion(&target->target_wait); in ath9k_htc_hw_alloc()
498 init_completion(&target->cmd_wait); in ath9k_htc_hw_alloc()
500 target->hif = hif; in ath9k_htc_hw_alloc()
501 target->hif_dev = hif_handle; in ath9k_htc_hw_alloc()
502 target->dev = dev; in ath9k_htc_hw_alloc()
505 endpoint = &target->endpoint[ENDPOINT0]; in ath9k_htc_hw_alloc()
509 atomic_set(&target->tgt_ready, 0); in ath9k_htc_hw_alloc()
511 return target; in ath9k_htc_hw_alloc()
519 int ath9k_htc_hw_init(struct htc_target *target, in ath9k_htc_hw_init() argument
523 if (ath9k_htc_probe_device(target, dev, devid, product, drv_info)) { in ath9k_htc_hw_init()
531 void ath9k_htc_hw_deinit(struct htc_target *target, bool hot_unplug) in ath9k_htc_hw_deinit() argument
533 if (target) in ath9k_htc_hw_deinit()
534 ath9k_htc_disconnect_device(target, hot_unplug); in ath9k_htc_hw_deinit()