Lines Matching refs:fw_dnld

108 	if (priv->fw_dnld.fw) {  in fw_dnld_over()
109 release_firmware(priv->fw_dnld.fw); in fw_dnld_over()
110 priv->fw_dnld.fw = NULL; in fw_dnld_over()
111 priv->fw_dnld.header = NULL; in fw_dnld_over()
112 priv->fw_dnld.binary_config = NULL; in fw_dnld_over()
120 if (timer_pending(&priv->fw_dnld.timer)) in fw_dnld_over()
121 del_timer_sync(&priv->fw_dnld.timer); in fw_dnld_over()
130 nfc_fw_download_done(priv->ndev->nfc_dev, priv->fw_dnld.name, error); in fw_dnld_over()
135 struct nfcmrvl_private *priv = from_timer(priv, t, fw_dnld.timer); in fw_dnld_timeout()
138 priv->fw_dnld.state = STATE_RESET; in fw_dnld_timeout()
153 priv->fw_dnld.state = STATE_INIT; in process_state_reset()
171 memcpy(cmd.param.val, &priv->fw_dnld.header->ref_clock, 4); in process_state_init()
176 priv->fw_dnld.state = STATE_SET_REF_CLOCK; in process_state_init()
184 priv->fw_dnld.state = STATE_OPEN_LC; in create_lc()
204 &priv->fw_dnld.binary_config->uart.baudrate, in process_state_set_ref_clock()
207 priv->fw_dnld.binary_config->uart.flow_control; in process_state_set_ref_clock()
212 &priv->fw_dnld.binary_config->i2c.clk, in process_state_set_ref_clock()
219 &priv->fw_dnld.binary_config->spi.clk, in process_state_set_ref_clock()
228 priv->fw_dnld.state = STATE_SET_HI_CONFIG; in process_state_set_ref_clock()
253 priv->fw_dnld.state = STATE_FW_DNLD; in process_state_open_lc()
254 priv->fw_dnld.substate = SUBSTATE_WAIT_COMMAND; in process_state_open_lc()
255 priv->fw_dnld.offset = priv->fw_dnld.binary_config->offset; in process_state_open_lc()
266 switch (priv->fw_dnld.substate) { in process_state_fw_dnld()
297 priv->fw_dnld.substate = SUBSTATE_WAIT_NACK_CREDIT; in process_state_fw_dnld()
300 priv->fw_dnld.chunk_len = len; in process_state_fw_dnld()
306 priv->fw_dnld.substate = SUBSTATE_WAIT_ACK_CREDIT; in process_state_fw_dnld()
316 if (priv->fw_dnld.chunk_len == 0) { in process_state_fw_dnld()
320 priv->fw_dnld.state = STATE_CLOSE_LC; in process_state_fw_dnld()
324 out_skb = alloc_lc_skb(priv, priv->fw_dnld.chunk_len); in process_state_fw_dnld()
328 ((uint8_t *)priv->fw_dnld.fw->data) + priv->fw_dnld.offset, in process_state_fw_dnld()
329 priv->fw_dnld.chunk_len); in process_state_fw_dnld()
331 priv->fw_dnld.substate = SUBSTATE_WAIT_DATA_CREDIT; in process_state_fw_dnld()
342 priv->fw_dnld.offset += priv->fw_dnld.chunk_len; in process_state_fw_dnld()
343 priv->fw_dnld.chunk_len = 0; in process_state_fw_dnld()
344 priv->fw_dnld.substate = SUBSTATE_WAIT_COMMAND; in process_state_fw_dnld()
354 priv->fw_dnld.substate = SUBSTATE_WAIT_COMMAND; in process_state_fw_dnld()
367 priv->fw_dnld.state = STATE_BOOT; in process_state_close_lc()
383 &priv->fw_dnld.binary_config->config); in process_state_boot()
385 if (priv->fw_dnld.binary_config == &priv->fw_dnld.header->helper) { in process_state_boot()
391 priv->fw_dnld.state = STATE_RESET; in process_state_boot()
392 priv->fw_dnld.binary_config = &priv->fw_dnld.header->firmware; in process_state_boot()
405 struct nfcmrvl_fw_dnld *fw_dnld = container_of(work, in fw_dnld_rx_work() local
408 struct nfcmrvl_private *priv = container_of(fw_dnld, in fw_dnld_rx_work()
410 fw_dnld); in fw_dnld_rx_work()
412 while ((skb = skb_dequeue(&fw_dnld->rx_q))) { in fw_dnld_rx_work()
415 switch (fw_dnld->state) { in fw_dnld_rx_work()
458 INIT_WORK(&priv->fw_dnld.rx_work, fw_dnld_rx_work); in nfcmrvl_fw_dnld_init()
461 priv->fw_dnld.rx_wq = create_singlethread_workqueue(name); in nfcmrvl_fw_dnld_init()
462 if (!priv->fw_dnld.rx_wq) in nfcmrvl_fw_dnld_init()
464 skb_queue_head_init(&priv->fw_dnld.rx_q); in nfcmrvl_fw_dnld_init()
470 destroy_workqueue(priv->fw_dnld.rx_wq); in nfcmrvl_fw_dnld_deinit()
484 skb_queue_tail(&priv->fw_dnld.rx_q, skb); in nfcmrvl_fw_dnld_recv_frame()
485 queue_work(priv->fw_dnld.rx_wq, &priv->fw_dnld.rx_work); in nfcmrvl_fw_dnld_recv_frame()
496 struct nfcmrvl_fw_dnld *fw_dnld = &priv->fw_dnld; in nfcmrvl_fw_dnld_start() local
505 strcpy(fw_dnld->name, firmware_name); in nfcmrvl_fw_dnld_start()
513 res = request_firmware(&fw_dnld->fw, firmware_name, in nfcmrvl_fw_dnld_start()
520 fw_dnld->header = (const struct nfcmrvl_fw *) priv->fw_dnld.fw->data; in nfcmrvl_fw_dnld_start()
522 if (fw_dnld->header->magic != NFCMRVL_FW_MAGIC || in nfcmrvl_fw_dnld_start()
523 fw_dnld->header->phy != priv->phy) { in nfcmrvl_fw_dnld_start()
525 firmware_name, fw_dnld->header->magic, in nfcmrvl_fw_dnld_start()
526 fw_dnld->header->phy); in nfcmrvl_fw_dnld_start()
527 release_firmware(fw_dnld->fw); in nfcmrvl_fw_dnld_start()
528 fw_dnld->header = NULL; in nfcmrvl_fw_dnld_start()
532 if (fw_dnld->header->helper.offset != 0) { in nfcmrvl_fw_dnld_start()
534 fw_dnld->binary_config = &fw_dnld->header->helper; in nfcmrvl_fw_dnld_start()
537 fw_dnld->binary_config = &fw_dnld->header->firmware; in nfcmrvl_fw_dnld_start()
541 timer_setup(&priv->fw_dnld.timer, fw_dnld_timeout, 0); in nfcmrvl_fw_dnld_start()
542 mod_timer(&priv->fw_dnld.timer, in nfcmrvl_fw_dnld_start()
547 &fw_dnld->header->bootrom.config); in nfcmrvl_fw_dnld_start()
553 priv->fw_dnld.state = STATE_RESET; in nfcmrvl_fw_dnld_start()