Lines Matching refs:fc_usb

71 	struct flexcop_usb *fc_usb = fc->bus_specific;  in flexcop_usb_readwrite_dw()  local
78 mutex_lock(&fc_usb->data_mutex); in flexcop_usb_readwrite_dw()
80 memcpy(fc_usb->data, val, sizeof(*val)); in flexcop_usb_readwrite_dw()
82 ret = usb_control_msg(fc_usb->udev, in flexcop_usb_readwrite_dw()
88 fc_usb->data, in flexcop_usb_readwrite_dw()
100 memcpy(val, fc_usb->data, sizeof(*val)); in flexcop_usb_readwrite_dw()
101 mutex_unlock(&fc_usb->data_mutex); in flexcop_usb_readwrite_dw()
108 static int flexcop_usb_v8_memory_req(struct flexcop_usb *fc_usb, in flexcop_usb_v8_memory_req() argument
117 if (buflen > sizeof(fc_usb->data)) { in flexcop_usb_v8_memory_req()
146 mutex_lock(&fc_usb->data_mutex); in flexcop_usb_v8_memory_req()
149 memcpy(fc_usb->data, pbBuffer, buflen); in flexcop_usb_v8_memory_req()
151 ret = usb_control_msg(fc_usb->udev, pipe, in flexcop_usb_v8_memory_req()
156 fc_usb->data, in flexcop_usb_v8_memory_req()
165 memcpy(pbBuffer, fc_usb->data, buflen); in flexcop_usb_v8_memory_req()
168 mutex_unlock(&fc_usb->data_mutex); in flexcop_usb_v8_memory_req()
178 static int flexcop_usb_memory_req(struct flexcop_usb *fc_usb, in flexcop_usb_memory_req() argument
205 ret = flexcop_usb_v8_memory_req(fc_usb, req, in flexcop_usb_memory_req()
232 struct flexcop_usb *fc_usb = i2c->fc->bus_specific; in flexcop_usb_i2c_req() local
237 if (buflen > sizeof(fc_usb->data)) { in flexcop_usb_i2c_req()
270 mutex_lock(&fc_usb->data_mutex); in flexcop_usb_i2c_req()
273 memcpy(fc_usb->data, buf, buflen); in flexcop_usb_i2c_req()
275 ret = usb_control_msg(fc_usb->udev, pipe, in flexcop_usb_i2c_req()
280 fc_usb->data, in flexcop_usb_i2c_req()
290 memcpy(buf, fc_usb->data, buflen); in flexcop_usb_i2c_req()
293 mutex_unlock(&fc_usb->data_mutex); in flexcop_usb_i2c_req()
326 static void flexcop_usb_process_frame(struct flexcop_usb *fc_usb, in flexcop_usb_process_frame() argument
333 fc_usb->tmp_buffer_length, buffer_length); in flexcop_usb_process_frame()
335 if (fc_usb->tmp_buffer_length > 0) { in flexcop_usb_process_frame()
336 memcpy(fc_usb->tmp_buffer+fc_usb->tmp_buffer_length, buffer, in flexcop_usb_process_frame()
338 fc_usb->tmp_buffer_length += buffer_length; in flexcop_usb_process_frame()
339 b = fc_usb->tmp_buffer; in flexcop_usb_process_frame()
340 l = fc_usb->tmp_buffer_length; in flexcop_usb_process_frame()
352 fc_usb->fc_dev, b+2, 1); in flexcop_usb_process_frame()
370 memcpy(fc_usb->tmp_buffer, b, l); in flexcop_usb_process_frame()
371 fc_usb->tmp_buffer_length = l; in flexcop_usb_process_frame()
376 struct flexcop_usb *fc_usb = urb->context; in flexcop_usb_urb_complete() local
392 flexcop_usb_process_frame(fc_usb, in flexcop_usb_urb_complete()
409 static void flexcop_usb_transfer_exit(struct flexcop_usb *fc_usb) in flexcop_usb_transfer_exit() argument
413 if (fc_usb->iso_urb[i] != NULL) { in flexcop_usb_transfer_exit()
415 usb_kill_urb(fc_usb->iso_urb[i]); in flexcop_usb_transfer_exit()
416 usb_free_urb(fc_usb->iso_urb[i]); in flexcop_usb_transfer_exit()
419 usb_free_coherent(fc_usb->udev, fc_usb->buffer_size, in flexcop_usb_transfer_exit()
420 fc_usb->iso_buffer, fc_usb->dma_addr); in flexcop_usb_transfer_exit()
424 static int flexcop_usb_transfer_init(struct flexcop_usb *fc_usb) in flexcop_usb_transfer_init() argument
426 struct usb_host_interface *alt = fc_usb->uintf->cur_altsetting; in flexcop_usb_transfer_init()
438 fc_usb->iso_buffer = usb_alloc_coherent(fc_usb->udev, in flexcop_usb_transfer_init()
439 bufsize, GFP_KERNEL, &fc_usb->dma_addr); in flexcop_usb_transfer_init()
440 if (fc_usb->iso_buffer == NULL) in flexcop_usb_transfer_init()
443 memset(fc_usb->iso_buffer, 0, bufsize); in flexcop_usb_transfer_init()
444 fc_usb->buffer_size = bufsize; in flexcop_usb_transfer_init()
448 fc_usb->iso_urb[i] = usb_alloc_urb(B2C2_USB_FRAMES_PER_ISO, in flexcop_usb_transfer_init()
450 if (fc_usb->iso_urb[i] == NULL) { in flexcop_usb_transfer_init()
459 struct urb *urb = fc_usb->iso_urb[i]; in flexcop_usb_transfer_init()
463 urb->dev = fc_usb->udev; in flexcop_usb_transfer_init()
464 urb->context = fc_usb; in flexcop_usb_transfer_init()
471 urb->transfer_buffer = fc_usb->iso_buffer + buffer_offset; in flexcop_usb_transfer_init()
482 if ((ret = usb_submit_urb(fc_usb->iso_urb[i],GFP_KERNEL))) { in flexcop_usb_transfer_init()
490 flexcop_sram_set_dest(fc_usb->fc_dev, FC_SRAM_DEST_MEDIA | in flexcop_usb_transfer_init()
493 flexcop_wan_set_speed(fc_usb->fc_dev, FC_WAN_SPEED_8MBITS); in flexcop_usb_transfer_init()
494 flexcop_sram_ctrl(fc_usb->fc_dev, 1, 1, 1); in flexcop_usb_transfer_init()
498 flexcop_usb_transfer_exit(fc_usb); in flexcop_usb_transfer_init()
502 static int flexcop_usb_init(struct flexcop_usb *fc_usb) in flexcop_usb_init() argument
508 ret = usb_set_interface(fc_usb->udev, 0, 1); in flexcop_usb_init()
514 alt = fc_usb->uintf->cur_altsetting; in flexcop_usb_init()
521 switch (fc_usb->udev->speed) { in flexcop_usb_init()
543 usb_set_intfdata(fc_usb->uintf, fc_usb); in flexcop_usb_init()
547 static void flexcop_usb_exit(struct flexcop_usb *fc_usb) in flexcop_usb_exit() argument
549 usb_set_intfdata(fc_usb->uintf, NULL); in flexcop_usb_exit()
556 struct flexcop_usb *fc_usb = NULL; in flexcop_usb_probe() local
566 fc_usb = fc->bus_specific; in flexcop_usb_probe()
567 fc_usb->fc_dev = fc; in flexcop_usb_probe()
568 mutex_init(&fc_usb->data_mutex); in flexcop_usb_probe()
584 fc_usb->udev = udev; in flexcop_usb_probe()
585 fc_usb->uintf = intf; in flexcop_usb_probe()
586 if ((ret = flexcop_usb_init(fc_usb)) != 0) in flexcop_usb_probe()
594 if ((ret = flexcop_usb_transfer_init(fc_usb)) != 0) in flexcop_usb_probe()
603 flexcop_usb_exit(fc_usb); in flexcop_usb_probe()
611 struct flexcop_usb *fc_usb = usb_get_intfdata(intf); in flexcop_usb_disconnect() local
612 flexcop_usb_transfer_exit(fc_usb); in flexcop_usb_disconnect()
613 flexcop_device_exit(fc_usb->fc_dev); in flexcop_usb_disconnect()
614 flexcop_usb_exit(fc_usb); in flexcop_usb_disconnect()
615 flexcop_device_kfree(fc_usb->fc_dev); in flexcop_usb_disconnect()