Lines Matching refs:i2400m
117 struct i2400m *i2400m = wimax_dev_to_i2400m(wimax_dev); in i2400m_op_msg_from_user() local
118 struct device *dev = i2400m_dev(i2400m); in i2400m_op_msg_from_user()
122 "msg_len %zu genl_info %p)\n", wimax_dev, i2400m, in i2400m_op_msg_from_user()
124 ack_skb = i2400m_msg_to_dev(i2400m, msg_buf, msg_len); in i2400m_op_msg_from_user()
128 result = wimax_msg_send(&i2400m->wimax_dev, ack_skb); in i2400m_op_msg_from_user()
131 "genl_info %p) = %d\n", wimax_dev, i2400m, msg_buf, msg_len, in i2400m_op_msg_from_user()
166 struct i2400m *i2400m = wimax_dev_to_i2400m(wimax_dev); in i2400m_op_reset() local
167 struct device *dev = i2400m_dev(i2400m); in i2400m_op_reset()
174 mutex_lock(&i2400m->init_mutex); in i2400m_op_reset()
175 i2400m->reset_ctx = &ctx; in i2400m_op_reset()
176 mutex_unlock(&i2400m->init_mutex); in i2400m_op_reset()
177 result = i2400m_reset(i2400m, I2400M_RT_WARM); in i2400m_op_reset()
186 mutex_lock(&i2400m->init_mutex); in i2400m_op_reset()
187 i2400m->reset_ctx = NULL; in i2400m_op_reset()
188 mutex_unlock(&i2400m->init_mutex); in i2400m_op_reset()
203 int i2400m_check_mac_addr(struct i2400m *i2400m) in i2400m_check_mac_addr() argument
206 struct device *dev = i2400m_dev(i2400m); in i2400m_check_mac_addr()
209 struct net_device *net_dev = i2400m->wimax_dev.net_dev; in i2400m_check_mac_addr()
211 d_fnstart(3, dev, "(i2400m %p)\n", i2400m); in i2400m_check_mac_addr()
212 skb = i2400m_get_device_info(i2400m); in i2400m_check_mac_addr()
244 d_fnend(3, dev, "(i2400m %p) = %d\n", i2400m, result); in i2400m_check_mac_addr()
269 int __i2400m_dev_start(struct i2400m *i2400m, enum i2400m_bri flags) in __i2400m_dev_start() argument
272 struct wimax_dev *wimax_dev = &i2400m->wimax_dev; in __i2400m_dev_start()
274 struct device *dev = i2400m_dev(i2400m); in __i2400m_dev_start()
275 int times = i2400m->bus_bm_retries; in __i2400m_dev_start()
277 d_fnstart(3, dev, "(i2400m %p)\n", i2400m); in __i2400m_dev_start()
279 result = i2400m_dev_bootstrap(i2400m, flags); in __i2400m_dev_start()
284 result = i2400m_tx_setup(i2400m); in __i2400m_dev_start()
287 result = i2400m_rx_setup(i2400m); in __i2400m_dev_start()
290 i2400m->work_queue = create_singlethread_workqueue(wimax_dev->name); in __i2400m_dev_start()
291 if (i2400m->work_queue == NULL) { in __i2400m_dev_start()
296 if (i2400m->bus_dev_start) { in __i2400m_dev_start()
297 result = i2400m->bus_dev_start(i2400m); in __i2400m_dev_start()
301 i2400m->ready = 1; in __i2400m_dev_start()
304 queue_work(i2400m->work_queue, &i2400m->rx_report_ws); in __i2400m_dev_start()
305 result = i2400m_firmware_check(i2400m); /* fw versions ok? */ in __i2400m_dev_start()
309 result = i2400m_check_mac_addr(i2400m); in __i2400m_dev_start()
312 result = i2400m_dev_initialize(i2400m); in __i2400m_dev_start()
321 atomic_dec(&i2400m->error_recovery); in __i2400m_dev_start()
328 net_dev, i2400m, result); in __i2400m_dev_start()
334 i2400m->ready = 0; in __i2400m_dev_start()
336 flush_workqueue(i2400m->work_queue); in __i2400m_dev_start()
337 if (i2400m->bus_dev_stop) in __i2400m_dev_start()
338 i2400m->bus_dev_stop(i2400m); in __i2400m_dev_start()
340 destroy_workqueue(i2400m->work_queue); in __i2400m_dev_start()
342 i2400m_rx_release(i2400m); in __i2400m_dev_start()
344 i2400m_tx_release(i2400m); in __i2400m_dev_start()
352 net_dev, i2400m, result); in __i2400m_dev_start()
358 int i2400m_dev_start(struct i2400m *i2400m, enum i2400m_bri bm_flags) in i2400m_dev_start() argument
361 mutex_lock(&i2400m->init_mutex); /* Well, start the device */ in i2400m_dev_start()
362 if (i2400m->updown == 0) { in i2400m_dev_start()
363 result = __i2400m_dev_start(i2400m, bm_flags); in i2400m_dev_start()
365 i2400m->updown = 1; in i2400m_dev_start()
366 i2400m->alive = 1; in i2400m_dev_start()
370 mutex_unlock(&i2400m->init_mutex); in i2400m_dev_start()
387 void __i2400m_dev_stop(struct i2400m *i2400m) in __i2400m_dev_stop() argument
389 struct wimax_dev *wimax_dev = &i2400m->wimax_dev; in __i2400m_dev_stop()
390 struct device *dev = i2400m_dev(i2400m); in __i2400m_dev_stop()
392 d_fnstart(3, dev, "(i2400m %p)\n", i2400m); in __i2400m_dev_stop()
394 i2400m_msg_to_dev_cancel_wait(i2400m, -EL3RST); in __i2400m_dev_stop()
395 complete(&i2400m->msg_completion); in __i2400m_dev_stop()
396 i2400m_net_wake_stop(i2400m); in __i2400m_dev_stop()
397 i2400m_dev_shutdown(i2400m); in __i2400m_dev_stop()
402 i2400m->ready = 0; /* nobody can queue work anymore */ in __i2400m_dev_stop()
404 flush_workqueue(i2400m->work_queue); in __i2400m_dev_stop()
406 if (i2400m->bus_dev_stop) in __i2400m_dev_stop()
407 i2400m->bus_dev_stop(i2400m); in __i2400m_dev_stop()
408 destroy_workqueue(i2400m->work_queue); in __i2400m_dev_stop()
409 i2400m_rx_release(i2400m); in __i2400m_dev_stop()
410 i2400m_tx_release(i2400m); in __i2400m_dev_stop()
412 d_fnend(3, dev, "(i2400m %p) = 0\n", i2400m); in __i2400m_dev_stop()
422 void i2400m_dev_stop(struct i2400m *i2400m) in i2400m_dev_stop() argument
424 mutex_lock(&i2400m->init_mutex); in i2400m_dev_stop()
425 if (i2400m->updown) { in i2400m_dev_stop()
426 __i2400m_dev_stop(i2400m); in i2400m_dev_stop()
427 i2400m->updown = 0; in i2400m_dev_stop()
428 i2400m->alive = 0; in i2400m_dev_stop()
431 mutex_unlock(&i2400m->init_mutex); in i2400m_dev_stop()
453 struct i2400m *i2400m = in i2400m_pm_notifier() local
454 container_of(notifier, struct i2400m, pm_notifier); in i2400m_pm_notifier()
455 struct device *dev = i2400m_dev(i2400m); in i2400m_pm_notifier()
457 d_fnstart(3, dev, "(i2400m %p pm_event %lx)\n", i2400m, pm_event); in i2400m_pm_notifier()
461 i2400m_fw_cache(i2400m); in i2400m_pm_notifier()
468 i2400m_fw_uncache(i2400m); in i2400m_pm_notifier()
475 d_fnend(3, dev, "(i2400m %p pm_event %lx) = void\n", i2400m, pm_event); in i2400m_pm_notifier()
486 int i2400m_pre_reset(struct i2400m *i2400m) in i2400m_pre_reset() argument
488 struct device *dev = i2400m_dev(i2400m); in i2400m_pre_reset()
490 d_fnstart(3, dev, "(i2400m %p)\n", i2400m); in i2400m_pre_reset()
493 mutex_lock(&i2400m->init_mutex); in i2400m_pre_reset()
494 if (i2400m->updown) { in i2400m_pre_reset()
495 netif_tx_disable(i2400m->wimax_dev.net_dev); in i2400m_pre_reset()
496 __i2400m_dev_stop(i2400m); in i2400m_pre_reset()
500 mutex_unlock(&i2400m->init_mutex); in i2400m_pre_reset()
501 if (i2400m->bus_release) in i2400m_pre_reset()
502 i2400m->bus_release(i2400m); in i2400m_pre_reset()
503 d_fnend(3, dev, "(i2400m %p) = 0\n", i2400m); in i2400m_pre_reset()
517 int i2400m_post_reset(struct i2400m *i2400m) in i2400m_post_reset() argument
520 struct device *dev = i2400m_dev(i2400m); in i2400m_post_reset()
522 d_fnstart(3, dev, "(i2400m %p)\n", i2400m); in i2400m_post_reset()
524 if (i2400m->bus_setup) { in i2400m_post_reset()
525 result = i2400m->bus_setup(i2400m); in i2400m_post_reset()
532 mutex_lock(&i2400m->init_mutex); in i2400m_post_reset()
533 if (i2400m->updown) { in i2400m_post_reset()
535 i2400m, I2400M_BRI_SOFT | I2400M_BRI_MAC_REINIT); in i2400m_post_reset()
539 mutex_unlock(&i2400m->init_mutex); in i2400m_post_reset()
540 d_fnend(3, dev, "(i2400m %p) = %d\n", i2400m, result); in i2400m_post_reset()
544 if (i2400m->bus_release) in i2400m_post_reset()
545 i2400m->bus_release(i2400m); in i2400m_post_reset()
548 i2400m->updown = 0; in i2400m_post_reset()
550 mutex_unlock(&i2400m->init_mutex); in i2400m_post_reset()
552 d_fnend(3, dev, "(i2400m %p) = %d\n", i2400m, result); in i2400m_post_reset()
584 struct i2400m *i2400m = container_of(ws, struct i2400m, reset_ws); in __i2400m_dev_reset_handle() local
585 const char *reason = i2400m->reset_reason; in __i2400m_dev_reset_handle()
586 struct device *dev = i2400m_dev(i2400m); in __i2400m_dev_reset_handle()
587 struct i2400m_reset_ctx *ctx = i2400m->reset_ctx; in __i2400m_dev_reset_handle()
590 d_fnstart(3, dev, "(ws %p i2400m %p reason %s)\n", ws, i2400m, reason); in __i2400m_dev_reset_handle()
592 i2400m->boot_mode = 1; in __i2400m_dev_reset_handle()
596 if (mutex_trylock(&i2400m->init_mutex) == 0) { in __i2400m_dev_reset_handle()
601 i2400m_msg_to_dev_cancel_wait(i2400m, -EL3RST); in __i2400m_dev_reset_handle()
602 complete(&i2400m->msg_completion); in __i2400m_dev_reset_handle()
608 if (i2400m->updown) { in __i2400m_dev_reset_handle()
609 __i2400m_dev_stop(i2400m); in __i2400m_dev_reset_handle()
610 i2400m->updown = 0; in __i2400m_dev_reset_handle()
614 if (i2400m->alive) { in __i2400m_dev_reset_handle()
615 result = __i2400m_dev_start(i2400m, in __i2400m_dev_reset_handle()
621 if (atomic_read(&i2400m->bus_reset_retries) in __i2400m_dev_reset_handle()
630 if (i2400m->reset_ctx) { in __i2400m_dev_reset_handle()
634 mutex_unlock(&i2400m->init_mutex); in __i2400m_dev_reset_handle()
644 i2400m->boot_mode = 0; in __i2400m_dev_reset_handle()
647 atomic_inc(&i2400m->bus_reset_retries); in __i2400m_dev_reset_handle()
649 result = i2400m_reset(i2400m, I2400M_RT_BUS); in __i2400m_dev_reset_handle()
654 if (i2400m->alive) { in __i2400m_dev_reset_handle()
657 i2400m->updown = 1; in __i2400m_dev_reset_handle()
659 atomic_set(&i2400m->bus_reset_retries, 0); in __i2400m_dev_reset_handle()
664 ws, i2400m, reason); in __i2400m_dev_reset_handle()
680 int i2400m_dev_reset_handle(struct i2400m *i2400m, const char *reason) in i2400m_dev_reset_handle() argument
682 i2400m->reset_reason = reason; in i2400m_dev_reset_handle()
683 return schedule_work(&i2400m->reset_ws); in i2400m_dev_reset_handle()
696 struct i2400m *i2400m = container_of(ws, struct i2400m, recovery_ws); in __i2400m_error_recovery() local
698 i2400m_reset(i2400m, I2400M_RT_BUS); in __i2400m_error_recovery()
726 void i2400m_error_recovery(struct i2400m *i2400m) in i2400m_error_recovery() argument
728 if (atomic_add_return(1, &i2400m->error_recovery) == 1) in i2400m_error_recovery()
729 schedule_work(&i2400m->recovery_ws); in i2400m_error_recovery()
731 atomic_dec(&i2400m->error_recovery); in i2400m_error_recovery()
741 int i2400m_bm_buf_alloc(struct i2400m *i2400m) in i2400m_bm_buf_alloc() argument
743 i2400m->bm_cmd_buf = kzalloc(I2400M_BM_CMD_BUF_SIZE, GFP_KERNEL); in i2400m_bm_buf_alloc()
744 if (i2400m->bm_cmd_buf == NULL) in i2400m_bm_buf_alloc()
746 i2400m->bm_ack_buf = kzalloc(I2400M_BM_ACK_BUF_SIZE, GFP_KERNEL); in i2400m_bm_buf_alloc()
747 if (i2400m->bm_ack_buf == NULL) in i2400m_bm_buf_alloc()
752 kfree(i2400m->bm_cmd_buf); in i2400m_bm_buf_alloc()
762 void i2400m_bm_buf_free(struct i2400m *i2400m) in i2400m_bm_buf_free() argument
764 kfree(i2400m->bm_ack_buf); in i2400m_bm_buf_free()
765 kfree(i2400m->bm_cmd_buf); in i2400m_bm_buf_free()
774 void i2400m_init(struct i2400m *i2400m) in i2400m_init() argument
776 wimax_dev_init(&i2400m->wimax_dev); in i2400m_init()
778 i2400m->boot_mode = 1; in i2400m_init()
779 i2400m->rx_reorder = 1; in i2400m_init()
780 init_waitqueue_head(&i2400m->state_wq); in i2400m_init()
782 spin_lock_init(&i2400m->tx_lock); in i2400m_init()
783 i2400m->tx_pl_min = UINT_MAX; in i2400m_init()
784 i2400m->tx_size_min = UINT_MAX; in i2400m_init()
786 spin_lock_init(&i2400m->rx_lock); in i2400m_init()
787 i2400m->rx_pl_min = UINT_MAX; in i2400m_init()
788 i2400m->rx_size_min = UINT_MAX; in i2400m_init()
789 INIT_LIST_HEAD(&i2400m->rx_reports); in i2400m_init()
790 INIT_WORK(&i2400m->rx_report_ws, i2400m_report_hook_work); in i2400m_init()
792 mutex_init(&i2400m->msg_mutex); in i2400m_init()
793 init_completion(&i2400m->msg_completion); in i2400m_init()
795 mutex_init(&i2400m->init_mutex); in i2400m_init()
798 INIT_WORK(&i2400m->reset_ws, __i2400m_dev_reset_handle); in i2400m_init()
799 INIT_WORK(&i2400m->recovery_ws, __i2400m_error_recovery); in i2400m_init()
801 atomic_set(&i2400m->bus_reset_retries, 0); in i2400m_init()
803 i2400m->alive = 0; in i2400m_init()
807 atomic_set(&i2400m->error_recovery, 1); in i2400m_init()
812 int i2400m_reset(struct i2400m *i2400m, enum i2400m_reset_type rt) in i2400m_reset() argument
814 struct net_device *net_dev = i2400m->wimax_dev.net_dev; in i2400m_reset()
825 return i2400m->bus_reset(i2400m, rt); in i2400m_reset()
841 int i2400m_setup(struct i2400m *i2400m, enum i2400m_bri bm_flags) in i2400m_setup() argument
844 struct device *dev = i2400m_dev(i2400m); in i2400m_setup()
845 struct wimax_dev *wimax_dev = &i2400m->wimax_dev; in i2400m_setup()
846 struct net_device *net_dev = i2400m->wimax_dev.net_dev; in i2400m_setup()
848 d_fnstart(3, dev, "(i2400m %p)\n", i2400m); in i2400m_setup()
853 result = i2400m_bm_buf_alloc(i2400m); in i2400m_setup()
859 if (i2400m->bus_setup) { in i2400m_setup()
860 result = i2400m->bus_setup(i2400m); in i2400m_setup()
868 result = i2400m_bootrom_init(i2400m, bm_flags); in i2400m_setup()
874 result = i2400m_read_mac_addr(i2400m); in i2400m_setup()
877 eth_random_addr(i2400m->src_mac_addr); in i2400m_setup()
879 i2400m->pm_notifier.notifier_call = i2400m_pm_notifier; in i2400m_setup()
880 register_pm_notifier(&i2400m->pm_notifier); in i2400m_setup()
890 i2400m->wimax_dev.op_msg_from_user = i2400m_op_msg_from_user; in i2400m_setup()
891 i2400m->wimax_dev.op_rfkill_sw_toggle = i2400m_op_rfkill_sw_toggle; in i2400m_setup()
892 i2400m->wimax_dev.op_reset = i2400m_op_reset; in i2400m_setup()
894 result = wimax_dev_add(&i2400m->wimax_dev, net_dev); in i2400m_setup()
905 i2400m_debugfs_add(i2400m); in i2400m_setup()
907 result = i2400m_dev_start(i2400m, bm_flags); in i2400m_setup()
910 d_fnend(3, dev, "(i2400m %p) = %d\n", i2400m, result); in i2400m_setup()
914 i2400m_debugfs_rm(i2400m); in i2400m_setup()
915 sysfs_remove_group(&i2400m->wimax_dev.net_dev->dev.kobj, in i2400m_setup()
918 wimax_dev_rm(&i2400m->wimax_dev); in i2400m_setup()
922 unregister_pm_notifier(&i2400m->pm_notifier); in i2400m_setup()
925 if (i2400m->bus_release) in i2400m_setup()
926 i2400m->bus_release(i2400m); in i2400m_setup()
928 i2400m_bm_buf_free(i2400m); in i2400m_setup()
930 d_fnend(3, dev, "(i2400m %p) = %d\n", i2400m, result); in i2400m_setup()
941 void i2400m_release(struct i2400m *i2400m) in i2400m_release() argument
943 struct device *dev = i2400m_dev(i2400m); in i2400m_release()
945 d_fnstart(3, dev, "(i2400m %p)\n", i2400m); in i2400m_release()
946 netif_stop_queue(i2400m->wimax_dev.net_dev); in i2400m_release()
948 i2400m_dev_stop(i2400m); in i2400m_release()
950 cancel_work_sync(&i2400m->reset_ws); in i2400m_release()
951 cancel_work_sync(&i2400m->recovery_ws); in i2400m_release()
953 i2400m_debugfs_rm(i2400m); in i2400m_release()
954 sysfs_remove_group(&i2400m->wimax_dev.net_dev->dev.kobj, in i2400m_release()
956 wimax_dev_rm(&i2400m->wimax_dev); in i2400m_release()
957 unregister_netdev(i2400m->wimax_dev.net_dev); in i2400m_release()
958 unregister_pm_notifier(&i2400m->pm_notifier); in i2400m_release()
959 if (i2400m->bus_release) in i2400m_release()
960 i2400m->bus_release(i2400m); in i2400m_release()
961 i2400m_bm_buf_free(i2400m); in i2400m_release()
962 d_fnend(3, dev, "(i2400m %p) = void\n", i2400m); in i2400m_release()