Lines Matching refs:fc_usb
71 struct flexcop_usb *fc_usb = fc->bus_specific; in flexcop_usb_readwrite_dw() local
77 int len = usb_control_msg(fc_usb->udev, in flexcop_usb_readwrite_dw()
97 static int flexcop_usb_v8_memory_req(struct flexcop_usb *fc_usb, in flexcop_usb_v8_memory_req() argument
130 len = usb_control_msg(fc_usb->udev, pipe, in flexcop_usb_v8_memory_req()
147 static int flexcop_usb_memory_req(struct flexcop_usb *fc_usb, in flexcop_usb_memory_req() argument
178 ret = flexcop_usb_v8_memory_req(fc_usb, req, in flexcop_usb_memory_req()
200 static int flexcop_usb_utility_req(struct flexcop_usb *fc_usb, int set,
210 len = usb_control_msg(fc_usb->udev,pipe,
227 struct flexcop_usb *fc_usb = i2c->fc->bus_specific; in flexcop_usb_i2c_req() local
260 len = usb_control_msg(fc_usb->udev,pipe, in flexcop_usb_i2c_req()
299 static void flexcop_usb_process_frame(struct flexcop_usb *fc_usb, in flexcop_usb_process_frame() argument
306 fc_usb->tmp_buffer_length, buffer_length); in flexcop_usb_process_frame()
308 if (fc_usb->tmp_buffer_length > 0) { in flexcop_usb_process_frame()
309 memcpy(fc_usb->tmp_buffer+fc_usb->tmp_buffer_length, buffer, in flexcop_usb_process_frame()
311 fc_usb->tmp_buffer_length += buffer_length; in flexcop_usb_process_frame()
312 b = fc_usb->tmp_buffer; in flexcop_usb_process_frame()
313 l = fc_usb->tmp_buffer_length; in flexcop_usb_process_frame()
325 fc_usb->fc_dev, b+2, 1); in flexcop_usb_process_frame()
343 memcpy(fc_usb->tmp_buffer, b, l); in flexcop_usb_process_frame()
344 fc_usb->tmp_buffer_length = l; in flexcop_usb_process_frame()
349 struct flexcop_usb *fc_usb = urb->context; in flexcop_usb_urb_complete() local
365 flexcop_usb_process_frame(fc_usb, in flexcop_usb_urb_complete()
382 static void flexcop_usb_transfer_exit(struct flexcop_usb *fc_usb) in flexcop_usb_transfer_exit() argument
386 if (fc_usb->iso_urb[i] != NULL) { in flexcop_usb_transfer_exit()
388 usb_kill_urb(fc_usb->iso_urb[i]); in flexcop_usb_transfer_exit()
389 usb_free_urb(fc_usb->iso_urb[i]); in flexcop_usb_transfer_exit()
392 if (fc_usb->iso_buffer != NULL) in flexcop_usb_transfer_exit()
393 usb_free_coherent(fc_usb->udev, in flexcop_usb_transfer_exit()
394 fc_usb->buffer_size, fc_usb->iso_buffer, in flexcop_usb_transfer_exit()
395 fc_usb->dma_addr); in flexcop_usb_transfer_exit()
398 static int flexcop_usb_transfer_init(struct flexcop_usb *fc_usb) in flexcop_usb_transfer_init() argument
401 fc_usb->uintf->cur_altsetting->endpoint[0].desc.wMaxPacketSize); in flexcop_usb_transfer_init()
410 fc_usb->iso_buffer = usb_alloc_coherent(fc_usb->udev, in flexcop_usb_transfer_init()
411 bufsize, GFP_KERNEL, &fc_usb->dma_addr); in flexcop_usb_transfer_init()
412 if (fc_usb->iso_buffer == NULL) in flexcop_usb_transfer_init()
415 memset(fc_usb->iso_buffer, 0, bufsize); in flexcop_usb_transfer_init()
416 fc_usb->buffer_size = bufsize; in flexcop_usb_transfer_init()
420 fc_usb->iso_urb[i] = usb_alloc_urb(B2C2_USB_FRAMES_PER_ISO, in flexcop_usb_transfer_init()
422 if (fc_usb->iso_urb[i] == NULL) { in flexcop_usb_transfer_init()
431 struct urb *urb = fc_usb->iso_urb[i]; in flexcop_usb_transfer_init()
435 urb->dev = fc_usb->udev; in flexcop_usb_transfer_init()
436 urb->context = fc_usb; in flexcop_usb_transfer_init()
443 urb->transfer_buffer = fc_usb->iso_buffer + buffer_offset; in flexcop_usb_transfer_init()
454 if ((ret = usb_submit_urb(fc_usb->iso_urb[i],GFP_ATOMIC))) { in flexcop_usb_transfer_init()
462 flexcop_sram_set_dest(fc_usb->fc_dev, FC_SRAM_DEST_MEDIA | in flexcop_usb_transfer_init()
465 flexcop_wan_set_speed(fc_usb->fc_dev, FC_WAN_SPEED_8MBITS); in flexcop_usb_transfer_init()
466 flexcop_sram_ctrl(fc_usb->fc_dev, 1, 1, 1); in flexcop_usb_transfer_init()
470 flexcop_usb_transfer_exit(fc_usb); in flexcop_usb_transfer_init()
474 static int flexcop_usb_init(struct flexcop_usb *fc_usb) in flexcop_usb_init() argument
477 usb_set_interface(fc_usb->udev,0,1); in flexcop_usb_init()
478 switch (fc_usb->udev->speed) { in flexcop_usb_init()
494 usb_set_intfdata(fc_usb->uintf, fc_usb); in flexcop_usb_init()
498 static void flexcop_usb_exit(struct flexcop_usb *fc_usb) in flexcop_usb_exit() argument
500 usb_set_intfdata(fc_usb->uintf, NULL); in flexcop_usb_exit()
507 struct flexcop_usb *fc_usb = NULL; in flexcop_usb_probe() local
517 fc_usb = fc->bus_specific; in flexcop_usb_probe()
518 fc_usb->fc_dev = fc; in flexcop_usb_probe()
534 fc_usb->udev = udev; in flexcop_usb_probe()
535 fc_usb->uintf = intf; in flexcop_usb_probe()
536 if ((ret = flexcop_usb_init(fc_usb)) != 0) in flexcop_usb_probe()
544 if ((ret = flexcop_usb_transfer_init(fc_usb)) != 0) in flexcop_usb_probe()
553 flexcop_usb_exit(fc_usb); in flexcop_usb_probe()
561 struct flexcop_usb *fc_usb = usb_get_intfdata(intf); in flexcop_usb_disconnect() local
562 flexcop_usb_transfer_exit(fc_usb); in flexcop_usb_disconnect()
563 flexcop_device_exit(fc_usb->fc_dev); in flexcop_usb_disconnect()
564 flexcop_usb_exit(fc_usb); in flexcop_usb_disconnect()
565 flexcop_device_kfree(fc_usb->fc_dev); in flexcop_usb_disconnect()