Lines Matching +full:no +full:- +full:mmc
1 // SPDX-License-Identifier: GPL-2.0-only
7 * based on USB Skeleton driver - 2.2
9 * Copyright (C) 2001-2004 Greg Kroah-Hartman (greg@kroah.com)
11 * VUB300: is a USB 2.0 client device with a single SDIO/SDmem/MMC slot
12 * Any SDIO/SDmem/MMC device plugged into the VUB300 will appear,
16 * client device driver AND an MMC host controller driver. Thus
17 * if there is an existing driver for the inserted SDIO/SDmem/MMC
22 * RANT: this driver was written using a display 128x48 - converting it
44 #include <linux/mmc/host.h>
45 #include <linux/mmc/card.h>
46 #include <linux/mmc/sdio_func.h>
47 #include <linux/mmc/sdio_ids.h>
64 u8 command_type; /* Bit7 - Rd/Wr */
79 u8 command_type; /* Bit7 - Rd/Wr */
220 #define FUN(c) (0x000007 & (c->arg>>28))
221 #define REG(c) (0x01FFFF & (c->arg>>9))
239 "Force SDIO Data Transfers to 1-bit Mode");
280 return -1; in interface_to_InterfaceNumber()
281 if (!interface->cur_altsetting) in interface_to_InterfaceNumber()
282 return -1; in interface_to_InterfaceNumber()
283 return interface->cur_altsetting->desc.bInterfaceNumber; in interface_to_InterfaceNumber()
312 bool irq_enabled; /* by the MMC CORE */
327 #define MAXREGMASK (MAXREGS-1)
336 struct mmc_host *mmc; member
370 { /* kref callback - softirq */ in vub300_delete()
372 struct mmc_host *mmc = vub300->mmc; in vub300_delete() local
373 usb_free_urb(vub300->command_out_urb); in vub300_delete()
374 vub300->command_out_urb = NULL; in vub300_delete()
375 usb_free_urb(vub300->command_res_urb); in vub300_delete()
376 vub300->command_res_urb = NULL; in vub300_delete()
377 usb_put_dev(vub300->udev); in vub300_delete()
378 mmc_free_host(mmc); in vub300_delete()
381 * which is contained at the end of struct mmc in vub300_delete()
387 kref_get(&vub300->kref); in vub300_queue_cmnd_work()
388 if (queue_work(cmndworkqueue, &vub300->cmndwork)) { in vub300_queue_cmnd_work()
401 kref_put(&vub300->kref, vub300_delete); in vub300_queue_cmnd_work()
407 kref_get(&vub300->kref); in vub300_queue_poll_work()
408 if (queue_delayed_work(pollworkqueue, &vub300->pollwork, delay)) { in vub300_queue_poll_work()
421 kref_put(&vub300->kref, vub300_delete); in vub300_queue_poll_work()
427 kref_get(&vub300->kref); in vub300_queue_dead_work()
428 if (queue_work(deadworkqueue, &vub300->deadwork)) { in vub300_queue_dead_work()
441 kref_put(&vub300->kref, vub300_delete); in vub300_queue_dead_work()
446 { /* urb completion handler - hardirq */ in irqpoll_res_completed()
447 struct vub300_mmc_host *vub300 = (struct vub300_mmc_host *)urb->context; in irqpoll_res_completed()
448 if (urb->status) in irqpoll_res_completed()
449 vub300->usb_transport_fail = urb->status; in irqpoll_res_completed()
450 complete(&vub300->irqpoll_complete); in irqpoll_res_completed()
454 { /* urb completion handler - hardirq */ in irqpoll_out_completed()
455 struct vub300_mmc_host *vub300 = (struct vub300_mmc_host *)urb->context; in irqpoll_out_completed()
456 if (urb->status) { in irqpoll_out_completed()
457 vub300->usb_transport_fail = urb->status; in irqpoll_out_completed()
458 complete(&vub300->irqpoll_complete); in irqpoll_out_completed()
463 usb_rcvbulkpipe(vub300->udev, vub300->cmnd_res_ep); in irqpoll_out_completed()
464 usb_fill_bulk_urb(vub300->command_res_urb, vub300->udev, pipe, in irqpoll_out_completed()
465 &vub300->resp, sizeof(vub300->resp), in irqpoll_out_completed()
467 vub300->command_res_urb->actual_length = 0; in irqpoll_out_completed()
468 ret = usb_submit_urb(vub300->command_res_urb, GFP_ATOMIC); in irqpoll_out_completed()
470 vub300->usb_transport_fail = ret; in irqpoll_out_completed()
471 complete(&vub300->irqpoll_complete); in irqpoll_out_completed()
481 int timeout = 0xFFFF & (0x0001FFFF - firmware_irqpoll_timeout); in send_irqpoll()
482 vub300->cmnd.poll.header_size = 22; in send_irqpoll()
483 vub300->cmnd.poll.header_type = 1; in send_irqpoll()
484 vub300->cmnd.poll.port_number = 0; in send_irqpoll()
485 vub300->cmnd.poll.command_type = 2; in send_irqpoll()
486 vub300->cmnd.poll.poll_timeout_lsb = 0xFF & (unsigned)timeout; in send_irqpoll()
487 vub300->cmnd.poll.poll_timeout_msb = 0xFF & (unsigned)(timeout >> 8); in send_irqpoll()
488 usb_fill_bulk_urb(vub300->command_out_urb, vub300->udev, in send_irqpoll()
489 usb_sndbulkpipe(vub300->udev, vub300->cmnd_out_ep) in send_irqpoll()
490 , &vub300->cmnd, sizeof(vub300->cmnd) in send_irqpoll()
492 retval = usb_submit_urb(vub300->command_out_urb, GFP_KERNEL); in send_irqpoll()
494 vub300->usb_transport_fail = retval; in send_irqpoll()
496 complete(&vub300->irqpoll_complete); in send_irqpoll()
505 int old_card_present = vub300->card_present; in new_system_port_status()
507 (0x0001 & vub300->system_port_status.port_flags) ? 1 : 0; in new_system_port_status()
508 vub300->read_only = in new_system_port_status()
509 (0x0010 & vub300->system_port_status.port_flags) ? 1 : 0; in new_system_port_status()
511 dev_info(&vub300->udev->dev, "card just inserted\n"); in new_system_port_status()
512 vub300->card_present = 1; in new_system_port_status()
513 vub300->bus_width = 0; in new_system_port_status()
515 strscpy(vub300->vub_name, "EMPTY Processing Disabled", in new_system_port_status()
516 sizeof(vub300->vub_name)); in new_system_port_status()
518 vub300->vub_name[0] = 0; in new_system_port_status()
519 mmc_detect_change(vub300->mmc, 1); in new_system_port_status()
521 dev_info(&vub300->udev->dev, "card just ejected\n"); in new_system_port_status()
522 vub300->card_present = 0; in new_system_port_status()
523 mmc_detect_change(vub300->mmc, 0); in new_system_port_status()
525 /* no change */ in new_system_port_status()
533 u8 r = vub300->fn[func].offload_point + vub300->fn[func].offload_count; in __add_offloaded_reg_to_fifo()
534 memcpy(&vub300->fn[func].reg[MAXREGMASK & r], register_access, in __add_offloaded_reg_to_fifo()
536 vub300->fn[func].offload_count += 1; in __add_offloaded_reg_to_fifo()
537 vub300->total_offload_count += 1; in __add_offloaded_reg_to_fifo()
543 u32 Register = ((0x03 & register_access->command_byte[0]) << 15) in add_offloaded_reg()
544 | ((0xFF & register_access->command_byte[1]) << 7) in add_offloaded_reg()
545 | ((0xFE & register_access->command_byte[2]) >> 1); in add_offloaded_reg()
546 u8 func = ((0x70 & register_access->command_byte[0]) >> 4); in add_offloaded_reg()
547 u8 regs = vub300->dynamic_register_count; in add_offloaded_reg()
549 while (0 < regs-- && 1 == vub300->sdio_register[i].activate) { in add_offloaded_reg()
550 if (vub300->sdio_register[i].func_num == func && in add_offloaded_reg()
551 vub300->sdio_register[i].sdio_reg == Register) { in add_offloaded_reg()
552 if (vub300->sdio_register[i].prepared == 0) in add_offloaded_reg()
553 vub300->sdio_register[i].prepared = 1; in add_offloaded_reg()
554 vub300->sdio_register[i].response = in add_offloaded_reg()
555 register_access->Respond_Byte[2]; in add_offloaded_reg()
556 vub300->sdio_register[i].regvalue = in add_offloaded_reg()
557 register_access->Respond_Byte[3]; in add_offloaded_reg()
575 usb_control_msg(vub300->udev, usb_rcvctrlpipe(vub300->udev, 0), in check_vub300_port_status()
578 0x0000, 0x0000, &vub300->system_port_status, in check_vub300_port_status()
579 sizeof(vub300->system_port_status), 1000); in check_vub300_port_status()
580 if (sizeof(vub300->system_port_status) == retval) in check_vub300_port_status()
587 if (vub300->command_res_urb->actual_length == 0) in __vub300_irqpoll_response()
590 switch (vub300->resp.common.header_type) { in __vub300_irqpoll_response()
592 mutex_lock(&vub300->irq_mutex); in __vub300_irqpoll_response()
593 if (vub300->irq_enabled) in __vub300_irqpoll_response()
594 mmc_signal_sdio_irq(vub300->mmc); in __vub300_irqpoll_response()
596 vub300->irqs_queued += 1; in __vub300_irqpoll_response()
597 vub300->irq_disabled = 1; in __vub300_irqpoll_response()
598 mutex_unlock(&vub300->irq_mutex); in __vub300_irqpoll_response()
601 if (vub300->resp.error.error_code == SD_ERROR_NO_DEVICE) in __vub300_irqpoll_response()
605 vub300->system_port_status = vub300->resp.status; in __vub300_irqpoll_response()
607 if (!vub300->card_present) in __vub300_irqpoll_response()
612 int offloaded_data_length = vub300->resp.common.header_size - 3; in __vub300_irqpoll_response()
615 while (register_count--) { in __vub300_irqpoll_response()
616 add_offloaded_reg(vub300, &vub300->resp.irq.reg[ri]); in __vub300_irqpoll_response()
619 mutex_lock(&vub300->irq_mutex); in __vub300_irqpoll_response()
620 if (vub300->irq_enabled) in __vub300_irqpoll_response()
621 mmc_signal_sdio_irq(vub300->mmc); in __vub300_irqpoll_response()
623 vub300->irqs_queued += 1; in __vub300_irqpoll_response()
624 vub300->irq_disabled = 1; in __vub300_irqpoll_response()
625 mutex_unlock(&vub300->irq_mutex); in __vub300_irqpoll_response()
630 int offloaded_data_length = vub300->resp.common.header_size - 3; in __vub300_irqpoll_response()
633 while (register_count--) { in __vub300_irqpoll_response()
634 add_offloaded_reg(vub300, &vub300->resp.irq.reg[ri]); in __vub300_irqpoll_response()
637 mutex_lock(&vub300->irq_mutex); in __vub300_irqpoll_response()
638 if (vub300->irq_enabled) in __vub300_irqpoll_response()
639 mmc_signal_sdio_irq(vub300->mmc); in __vub300_irqpoll_response()
641 vub300->irqs_queued += 1; in __vub300_irqpoll_response()
642 vub300->irq_disabled = 0; in __vub300_irqpoll_response()
643 mutex_unlock(&vub300->irq_mutex); in __vub300_irqpoll_response()
658 mod_timer(&vub300->inactivity_timer, jiffies + HZ); in __do_poll()
659 init_completion(&vub300->irqpoll_complete); in __do_poll()
661 commretval = wait_for_completion_timeout(&vub300->irqpoll_complete, in __do_poll()
663 if (vub300->usb_transport_fail) { in __do_poll()
664 /* no need to do anything */ in __do_poll()
666 vub300->usb_timed_out = 1; in __do_poll()
667 usb_kill_urb(vub300->command_out_urb); in __do_poll()
668 usb_kill_urb(vub300->command_res_urb); in __do_poll()
681 if (!vub300->interface) { in vub300_pollwork_thread()
682 kref_put(&vub300->kref, vub300_delete); in vub300_pollwork_thread()
685 mutex_lock(&vub300->cmd_mutex); in vub300_pollwork_thread()
686 if (vub300->cmd) { in vub300_pollwork_thread()
688 } else if (!vub300->card_present) { in vub300_pollwork_thread()
689 /* no need to do anything */ in vub300_pollwork_thread()
690 } else { /* vub300->card_present */ in vub300_pollwork_thread()
691 mutex_lock(&vub300->irq_mutex); in vub300_pollwork_thread()
692 if (!vub300->irq_enabled) { in vub300_pollwork_thread()
693 mutex_unlock(&vub300->irq_mutex); in vub300_pollwork_thread()
694 } else if (vub300->irqs_queued) { in vub300_pollwork_thread()
695 vub300->irqs_queued -= 1; in vub300_pollwork_thread()
696 mmc_signal_sdio_irq(vub300->mmc); in vub300_pollwork_thread()
697 mod_timer(&vub300->inactivity_timer, jiffies + HZ); in vub300_pollwork_thread()
698 mutex_unlock(&vub300->irq_mutex); in vub300_pollwork_thread()
699 } else { /* NOT vub300->irqs_queued */ in vub300_pollwork_thread()
700 mutex_unlock(&vub300->irq_mutex); in vub300_pollwork_thread()
704 mutex_unlock(&vub300->cmd_mutex); in vub300_pollwork_thread()
705 kref_put(&vub300->kref, vub300_delete); in vub300_pollwork_thread()
712 if (!vub300->interface) { in vub300_deadwork_thread()
713 kref_put(&vub300->kref, vub300_delete); in vub300_deadwork_thread()
716 mutex_lock(&vub300->cmd_mutex); in vub300_deadwork_thread()
717 if (vub300->cmd) { in vub300_deadwork_thread()
720 * timer expired - so we just let the in vub300_deadwork_thread()
724 } else if (vub300->card_present) { in vub300_deadwork_thread()
726 } else if (vub300->mmc && vub300->mmc->card) { in vub300_deadwork_thread()
728 * the MMC core must not have responded in vub300_deadwork_thread()
729 * to the previous indication - lets in vub300_deadwork_thread()
736 mod_timer(&vub300->inactivity_timer, jiffies + HZ); in vub300_deadwork_thread()
737 mutex_unlock(&vub300->cmd_mutex); in vub300_deadwork_thread()
738 kref_put(&vub300->kref, vub300_delete); in vub300_deadwork_thread()
745 if (!vub300->interface) { in vub300_inactivity_timer_expired()
746 kref_put(&vub300->kref, vub300_delete); in vub300_inactivity_timer_expired()
747 } else if (vub300->cmd) { in vub300_inactivity_timer_expired()
748 mod_timer(&vub300->inactivity_timer, jiffies + HZ); in vub300_inactivity_timer_expired()
751 mod_timer(&vub300->inactivity_timer, jiffies + HZ); in vub300_inactivity_timer_expired()
761 return -ETIMEDOUT; in vub300_response_error()
779 return -EILSEQ; in vub300_response_error()
781 return -EILSEQ; in vub300_response_error()
783 return -EINVAL; in vub300_response_error()
785 return -ENOMEDIUM; in vub300_response_error()
787 return -ENODEV; in vub300_response_error()
792 { /* urb completion handler - hardirq */ in command_res_completed()
793 struct vub300_mmc_host *vub300 = (struct vub300_mmc_host *)urb->context; in command_res_completed()
794 if (urb->status) { in command_res_completed()
796 } else if (vub300->command_res_urb->actual_length == 0) { in command_res_completed()
801 } else if (!vub300->data) { in command_res_completed()
803 } else if (vub300->resp.common.header_type != 0x02) { in command_res_completed()
808 } else if (vub300->urb) { in command_res_completed()
809 vub300->cmd->error = in command_res_completed()
810 vub300_response_error(vub300->resp.error.error_code); in command_res_completed()
811 usb_unlink_urb(vub300->urb); in command_res_completed()
813 vub300->cmd->error = in command_res_completed()
814 vub300_response_error(vub300->resp.error.error_code); in command_res_completed()
815 usb_sg_cancel(&vub300->sg_request); in command_res_completed()
817 complete(&vub300->command_complete); /* got_response_in */ in command_res_completed()
821 { /* urb completion handler - hardirq */ in command_out_completed()
822 struct vub300_mmc_host *vub300 = (struct vub300_mmc_host *)urb->context; in command_out_completed()
823 if (urb->status) { in command_out_completed()
824 complete(&vub300->command_complete); in command_out_completed()
828 usb_rcvbulkpipe(vub300->udev, vub300->cmnd_res_ep); in command_out_completed()
829 usb_fill_bulk_urb(vub300->command_res_urb, vub300->udev, pipe, in command_out_completed()
830 &vub300->resp, sizeof(vub300->resp), in command_out_completed()
832 vub300->command_res_urb->actual_length = 0; in command_out_completed()
833 ret = usb_submit_urb(vub300->command_res_urb, GFP_ATOMIC); in command_out_completed()
844 complete(&vub300->command_complete); in command_out_completed()
856 vub300->fbs[1] = (cmd_arg << 8) | (0x00FF & vub300->fbs[1]); in snoop_block_size_and_bus_width()
858 vub300->fbs[1] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[1]); in snoop_block_size_and_bus_width()
860 vub300->fbs[2] = (cmd_arg << 8) | (0x00FF & vub300->fbs[2]); in snoop_block_size_and_bus_width()
862 vub300->fbs[2] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[2]); in snoop_block_size_and_bus_width()
864 vub300->fbs[3] = (cmd_arg << 8) | (0x00FF & vub300->fbs[3]); in snoop_block_size_and_bus_width()
866 vub300->fbs[3] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[3]); in snoop_block_size_and_bus_width()
868 vub300->fbs[4] = (cmd_arg << 8) | (0x00FF & vub300->fbs[4]); in snoop_block_size_and_bus_width()
870 vub300->fbs[4] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[4]); in snoop_block_size_and_bus_width()
872 vub300->fbs[5] = (cmd_arg << 8) | (0x00FF & vub300->fbs[5]); in snoop_block_size_and_bus_width()
874 vub300->fbs[5] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[5]); in snoop_block_size_and_bus_width()
876 vub300->fbs[6] = (cmd_arg << 8) | (0x00FF & vub300->fbs[6]); in snoop_block_size_and_bus_width()
878 vub300->fbs[6] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[6]); in snoop_block_size_and_bus_width()
880 vub300->fbs[7] = (cmd_arg << 8) | (0x00FF & vub300->fbs[7]); in snoop_block_size_and_bus_width()
882 vub300->fbs[7] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[7]); in snoop_block_size_and_bus_width()
884 vub300->bus_width = 1; in snoop_block_size_and_bus_width()
886 vub300->bus_width = 4; in snoop_block_size_and_bus_width()
892 struct mmc_command *cmd = vub300->cmd; in send_command()
893 struct mmc_data *data = vub300->data; in send_command()
897 if (vub300->app_spec) { in send_command()
898 switch (cmd->opcode) { in send_command()
901 vub300->resp_len = 6; in send_command()
902 if (0x00000000 == (0x00000003 & cmd->arg)) in send_command()
903 vub300->bus_width = 1; in send_command()
904 else if (0x00000002 == (0x00000003 & cmd->arg)) in send_command()
905 vub300->bus_width = 4; in send_command()
907 dev_err(&vub300->udev->dev, in send_command()
909 0x00000003 & cmd->arg); in send_command()
913 vub300->resp_len = 6; in send_command()
917 vub300->resp_len = 6; in send_command()
921 vub300->resp_len = 6; in send_command()
925 vub300->resp_len = 6; in send_command()
929 vub300->resp_len = 6; in send_command()
933 vub300->resp_len = 6; in send_command()
937 vub300->resp_len = 6; in send_command()
940 vub300->resp_len = 0; in send_command()
941 cmd->error = -EINVAL; in send_command()
942 complete(&vub300->command_complete); in send_command()
945 vub300->app_spec = 0; in send_command()
947 switch (cmd->opcode) { in send_command()
950 vub300->resp_len = 0; in send_command()
954 vub300->resp_len = 6; in send_command()
958 vub300->resp_len = 17; in send_command()
962 vub300->resp_len = 6; in send_command()
966 vub300->resp_len = 0; in send_command()
970 vub300->resp_len = 6; in send_command()
974 vub300->resp_len = 6; in send_command()
978 vub300->resp_len = 6; in send_command()
982 vub300->resp_len = 6; in send_command()
986 vub300->resp_len = 17; in send_command()
990 vub300->resp_len = 17; in send_command()
994 vub300->resp_len = 6; in send_command()
998 vub300->resp_len = 6; in send_command()
1002 vub300->resp_len = 0; in send_command()
1005 for (i = 0; i < ARRAY_SIZE(vub300->fbs); i++) in send_command()
1006 vub300->fbs[i] = 0xFFFF & cmd->arg; in send_command()
1008 vub300->resp_len = 6; in send_command()
1016 vub300->resp_len = 6; in send_command()
1021 vub300->resp_len = 6; in send_command()
1027 vub300->resp_len = 6; in send_command()
1031 vub300->resp_len = 6; in send_command()
1035 vub300->resp_len = 6; in send_command()
1039 vub300->resp_len = 6; in send_command()
1040 snoop_block_size_and_bus_width(vub300, cmd->arg); in send_command()
1044 vub300->resp_len = 6; in send_command()
1048 vub300->resp_len = 6; in send_command()
1049 vub300->app_spec = 1; in send_command()
1053 vub300->resp_len = 6; in send_command()
1056 vub300->resp_len = 0; in send_command()
1057 cmd->error = -EINVAL; in send_command()
1058 complete(&vub300->command_complete); in send_command()
1066 vub300->cmnd.head.header_size = 20; in send_command()
1067 vub300->cmnd.head.header_type = 0x00; in send_command()
1068 vub300->cmnd.head.port_number = 0; /* "0" means port 1 */ in send_command()
1069 vub300->cmnd.head.command_type = 0x00; /* standard read command */ in send_command()
1070 vub300->cmnd.head.response_type = response_type; in send_command()
1071 vub300->cmnd.head.command_index = cmd->opcode; in send_command()
1072 vub300->cmnd.head.arguments[0] = cmd->arg >> 24; in send_command()
1073 vub300->cmnd.head.arguments[1] = cmd->arg >> 16; in send_command()
1074 vub300->cmnd.head.arguments[2] = cmd->arg >> 8; in send_command()
1075 vub300->cmnd.head.arguments[3] = cmd->arg >> 0; in send_command()
1076 if (cmd->opcode == 52) { in send_command()
1077 int fn = 0x7 & (cmd->arg >> 28); in send_command()
1078 vub300->cmnd.head.block_count[0] = 0; in send_command()
1079 vub300->cmnd.head.block_count[1] = 0; in send_command()
1080 vub300->cmnd.head.block_size[0] = (vub300->fbs[fn] >> 8) & 0xFF; in send_command()
1081 vub300->cmnd.head.block_size[1] = (vub300->fbs[fn] >> 0) & 0xFF; in send_command()
1082 vub300->cmnd.head.command_type = 0x00; in send_command()
1083 vub300->cmnd.head.transfer_size[0] = 0; in send_command()
1084 vub300->cmnd.head.transfer_size[1] = 0; in send_command()
1085 vub300->cmnd.head.transfer_size[2] = 0; in send_command()
1086 vub300->cmnd.head.transfer_size[3] = 0; in send_command()
1088 vub300->cmnd.head.block_count[0] = 0; in send_command()
1089 vub300->cmnd.head.block_count[1] = 0; in send_command()
1090 vub300->cmnd.head.block_size[0] = (vub300->fbs[0] >> 8) & 0xFF; in send_command()
1091 vub300->cmnd.head.block_size[1] = (vub300->fbs[0] >> 0) & 0xFF; in send_command()
1092 vub300->cmnd.head.command_type = 0x00; in send_command()
1093 vub300->cmnd.head.transfer_size[0] = 0; in send_command()
1094 vub300->cmnd.head.transfer_size[1] = 0; in send_command()
1095 vub300->cmnd.head.transfer_size[2] = 0; in send_command()
1096 vub300->cmnd.head.transfer_size[3] = 0; in send_command()
1097 } else if (cmd->opcode == 53) { in send_command()
1098 int fn = 0x7 & (cmd->arg >> 28); in send_command()
1099 if (0x08 & vub300->cmnd.head.arguments[0]) { /* BLOCK MODE */ in send_command()
1100 vub300->cmnd.head.block_count[0] = in send_command()
1101 (data->blocks >> 8) & 0xFF; in send_command()
1102 vub300->cmnd.head.block_count[1] = in send_command()
1103 (data->blocks >> 0) & 0xFF; in send_command()
1104 vub300->cmnd.head.block_size[0] = in send_command()
1105 (data->blksz >> 8) & 0xFF; in send_command()
1106 vub300->cmnd.head.block_size[1] = in send_command()
1107 (data->blksz >> 0) & 0xFF; in send_command()
1109 vub300->cmnd.head.block_count[0] = 0; in send_command()
1110 vub300->cmnd.head.block_count[1] = 0; in send_command()
1111 vub300->cmnd.head.block_size[0] = in send_command()
1112 (vub300->datasize >> 8) & 0xFF; in send_command()
1113 vub300->cmnd.head.block_size[1] = in send_command()
1114 (vub300->datasize >> 0) & 0xFF; in send_command()
1116 vub300->cmnd.head.command_type = in send_command()
1117 (MMC_DATA_READ & data->flags) ? 0x00 : 0x80; in send_command()
1118 vub300->cmnd.head.transfer_size[0] = in send_command()
1119 (vub300->datasize >> 24) & 0xFF; in send_command()
1120 vub300->cmnd.head.transfer_size[1] = in send_command()
1121 (vub300->datasize >> 16) & 0xFF; in send_command()
1122 vub300->cmnd.head.transfer_size[2] = in send_command()
1123 (vub300->datasize >> 8) & 0xFF; in send_command()
1124 vub300->cmnd.head.transfer_size[3] = in send_command()
1125 (vub300->datasize >> 0) & 0xFF; in send_command()
1126 if (vub300->datasize < vub300->fbs[fn]) { in send_command()
1127 vub300->cmnd.head.block_count[0] = 0; in send_command()
1128 vub300->cmnd.head.block_count[1] = 0; in send_command()
1131 vub300->cmnd.head.block_count[0] = (data->blocks >> 8) & 0xFF; in send_command()
1132 vub300->cmnd.head.block_count[1] = (data->blocks >> 0) & 0xFF; in send_command()
1133 vub300->cmnd.head.block_size[0] = (data->blksz >> 8) & 0xFF; in send_command()
1134 vub300->cmnd.head.block_size[1] = (data->blksz >> 0) & 0xFF; in send_command()
1135 vub300->cmnd.head.command_type = in send_command()
1136 (MMC_DATA_READ & data->flags) ? 0x00 : 0x80; in send_command()
1137 vub300->cmnd.head.transfer_size[0] = in send_command()
1138 (vub300->datasize >> 24) & 0xFF; in send_command()
1139 vub300->cmnd.head.transfer_size[1] = in send_command()
1140 (vub300->datasize >> 16) & 0xFF; in send_command()
1141 vub300->cmnd.head.transfer_size[2] = in send_command()
1142 (vub300->datasize >> 8) & 0xFF; in send_command()
1143 vub300->cmnd.head.transfer_size[3] = in send_command()
1144 (vub300->datasize >> 0) & 0xFF; in send_command()
1145 if (vub300->datasize < vub300->fbs[0]) { in send_command()
1146 vub300->cmnd.head.block_count[0] = 0; in send_command()
1147 vub300->cmnd.head.block_count[1] = 0; in send_command()
1150 if (vub300->cmnd.head.block_size[0] || vub300->cmnd.head.block_size[1]) { in send_command()
1151 u16 block_size = vub300->cmnd.head.block_size[1] | in send_command()
1152 (vub300->cmnd.head.block_size[0] << 8); in send_command()
1153 u16 block_boundary = FIRMWARE_BLOCK_BOUNDARY - in send_command()
1155 vub300->cmnd.head.block_boundary[0] = in send_command()
1157 vub300->cmnd.head.block_boundary[1] = in send_command()
1160 vub300->cmnd.head.block_boundary[0] = 0; in send_command()
1161 vub300->cmnd.head.block_boundary[1] = 0; in send_command()
1163 usb_fill_bulk_urb(vub300->command_out_urb, vub300->udev, in send_command()
1164 usb_sndbulkpipe(vub300->udev, vub300->cmnd_out_ep), in send_command()
1165 &vub300->cmnd, sizeof(vub300->cmnd), in send_command()
1167 retval = usb_submit_urb(vub300->command_out_urb, GFP_KERNEL); in send_command()
1169 cmd->error = retval; in send_command()
1170 complete(&vub300->command_complete); in send_command()
1185 vub300->usb_timed_out = 1; in vub300_sg_timed_out()
1186 usb_sg_cancel(&vub300->sg_request); in vub300_sg_timed_out()
1187 usb_unlink_urb(vub300->command_out_urb); in vub300_sg_timed_out()
1188 usb_unlink_urb(vub300->command_res_urb); in vub300_sg_timed_out()
1205 const u8 *data = fw->data; in __download_offload_pseudocode()
1206 int size = fw->size; in __download_offload_pseudocode()
1208 dev_info(&vub300->udev->dev, "using %s for SDIO offload processing\n", in __download_offload_pseudocode()
1209 vub300->vub_name); in __download_offload_pseudocode()
1212 } while (size-- && c); /* skip comment */ in __download_offload_pseudocode()
1213 dev_info(&vub300->udev->dev, "using offload firmware %s %s\n", fw->data, in __download_offload_pseudocode()
1214 vub300->vub_name); in __download_offload_pseudocode()
1216 dev_err(&vub300->udev->dev, in __download_offload_pseudocode()
1218 vub300->vub_name); in __download_offload_pseudocode()
1219 strscpy(vub300->vub_name, "corrupt offload pseudocode", in __download_offload_pseudocode()
1220 sizeof(vub300->vub_name)); in __download_offload_pseudocode()
1224 size -= 1; in __download_offload_pseudocode()
1227 size -= 1; in __download_offload_pseudocode()
1235 xfer_length - interrupt_size); in __download_offload_pseudocode()
1236 size -= interrupt_size; in __download_offload_pseudocode()
1239 usb_control_msg(vub300->udev, in __download_offload_pseudocode()
1240 usb_sndctrlpipe(vub300->udev, 0), in __download_offload_pseudocode()
1249 dev_err(&vub300->udev->dev, in __download_offload_pseudocode()
1251 " INTERRUPT_PSEUDOCODE for %s %s\n", fw->data, in __download_offload_pseudocode()
1252 vub300->vub_name); in __download_offload_pseudocode()
1253 strscpy(vub300->vub_name, in __download_offload_pseudocode()
1255 sizeof(vub300->vub_name)); in __download_offload_pseudocode()
1259 dev_err(&vub300->udev->dev, in __download_offload_pseudocode()
1261 fw->data, vub300->vub_name); in __download_offload_pseudocode()
1262 strscpy(vub300->vub_name, "corrupt interrupt pseudocode", in __download_offload_pseudocode()
1263 sizeof(vub300->vub_name)); in __download_offload_pseudocode()
1267 size -= 1; in __download_offload_pseudocode()
1270 size -= 1; in __download_offload_pseudocode()
1278 xfer_length - ts); in __download_offload_pseudocode()
1279 size -= ts; in __download_offload_pseudocode()
1282 usb_control_msg(vub300->udev, in __download_offload_pseudocode()
1283 usb_sndctrlpipe(vub300->udev, 0), in __download_offload_pseudocode()
1292 dev_err(&vub300->udev->dev, in __download_offload_pseudocode()
1294 " TRANSFER_PSEUDOCODE for %s %s\n", fw->data, in __download_offload_pseudocode()
1295 vub300->vub_name); in __download_offload_pseudocode()
1296 strscpy(vub300->vub_name, in __download_offload_pseudocode()
1298 sizeof(vub300->vub_name)); in __download_offload_pseudocode()
1302 dev_err(&vub300->udev->dev, in __download_offload_pseudocode()
1304 fw->data, vub300->vub_name); in __download_offload_pseudocode()
1305 strscpy(vub300->vub_name, "corrupt transfer pseudocode", in __download_offload_pseudocode()
1306 sizeof(vub300->vub_name)); in __download_offload_pseudocode()
1310 size -= 1; in __download_offload_pseudocode()
1312 int I = vub300->dynamic_register_count = register_count; in __download_offload_pseudocode()
1314 while (I--) { in __download_offload_pseudocode()
1316 vub300->sdio_register[i].func_num = *data++; in __download_offload_pseudocode()
1317 size -= 1; in __download_offload_pseudocode()
1319 size -= 1; in __download_offload_pseudocode()
1322 size -= 1; in __download_offload_pseudocode()
1325 size -= 1; in __download_offload_pseudocode()
1326 vub300->sdio_register[i].sdio_reg = func_num; in __download_offload_pseudocode()
1327 vub300->sdio_register[i].activate = 1; in __download_offload_pseudocode()
1328 vub300->sdio_register[i].prepared = 0; in __download_offload_pseudocode()
1331 dev_info(&vub300->udev->dev, in __download_offload_pseudocode()
1333 vub300->dynamic_register_count); in __download_offload_pseudocode()
1336 dev_err(&vub300->udev->dev, in __download_offload_pseudocode()
1338 vub300->vub_name); in __download_offload_pseudocode()
1339 strscpy(vub300->vub_name, "corrupt dynamic registers", in __download_offload_pseudocode()
1340 sizeof(vub300->vub_name)); in __download_offload_pseudocode()
1345 strscpy(vub300->vub_name, "SDIO pseudocode download failed", in __download_offload_pseudocode()
1346 sizeof(vub300->vub_name)); in __download_offload_pseudocode()
1351 * vub300->vub_name is set anyway in order to prevent an automatic retry
1355 struct mmc_card *card = vub300->mmc->card; in download_offload_pseudocode()
1356 int sdio_funcs = card->sdio_funcs; in download_offload_pseudocode()
1358 int l = snprintf(vub300->vub_name, sizeof(vub300->vub_name), in download_offload_pseudocode()
1359 "vub_%04X%04X", card->cis.vendor, card->cis.device); in download_offload_pseudocode()
1363 struct sdio_func *sf = card->sdio_func[n]; in download_offload_pseudocode()
1364 l += scnprintf(vub300->vub_name + l, in download_offload_pseudocode()
1365 sizeof(vub300->vub_name) - l, "_%04X%04X", in download_offload_pseudocode()
1366 sf->vendor, sf->device); in download_offload_pseudocode()
1368 snprintf(vub300->vub_name + l, sizeof(vub300->vub_name) - l, ".bin"); in download_offload_pseudocode()
1369 dev_info(&vub300->udev->dev, "requesting offload firmware %s\n", in download_offload_pseudocode()
1370 vub300->vub_name); in download_offload_pseudocode()
1371 retval = request_firmware(&fw, vub300->vub_name, &card->dev); in download_offload_pseudocode()
1373 strscpy(vub300->vub_name, "vub_default.bin", in download_offload_pseudocode()
1374 sizeof(vub300->vub_name)); in download_offload_pseudocode()
1375 retval = request_firmware(&fw, vub300->vub_name, &card->dev); in download_offload_pseudocode()
1377 strscpy(vub300->vub_name, in download_offload_pseudocode()
1378 "no SDIO offload firmware found", in download_offload_pseudocode()
1379 sizeof(vub300->vub_name)); in download_offload_pseudocode()
1391 { /* urb completion handler - hardirq */ in vub300_usb_bulk_msg_completion()
1392 complete((struct completion *)urb->context); in vub300_usb_bulk_msg_completion()
1400 struct usb_device *usb_dev = vub300->udev; in vub300_usb_bulk_msg()
1403 vub300->urb = usb_alloc_urb(0, GFP_KERNEL); in vub300_usb_bulk_msg()
1404 if (!vub300->urb) in vub300_usb_bulk_msg()
1405 return -ENOMEM; in vub300_usb_bulk_msg()
1406 usb_fill_bulk_urb(vub300->urb, usb_dev, pipe, data, len, in vub300_usb_bulk_msg()
1409 vub300->urb->context = &done; in vub300_usb_bulk_msg()
1410 vub300->urb->actual_length = 0; in vub300_usb_bulk_msg()
1411 retval = usb_submit_urb(vub300->urb, GFP_KERNEL); in vub300_usb_bulk_msg()
1416 retval = -ETIMEDOUT; in vub300_usb_bulk_msg()
1417 usb_kill_urb(vub300->urb); in vub300_usb_bulk_msg()
1419 retval = vub300->urb->status; in vub300_usb_bulk_msg()
1422 *actual_length = vub300->urb->actual_length; in vub300_usb_bulk_msg()
1423 usb_free_urb(vub300->urb); in vub300_usb_bulk_msg()
1424 vub300->urb = NULL; in vub300_usb_bulk_msg()
1432 int linear_length = vub300->datasize; in __command_read_data()
1433 int padded_length = vub300->large_usb_packets ? in __command_read_data()
1439 pipe = usb_rcvbulkpipe(vub300->udev, vub300->data_inp_ep); in __command_read_data()
1440 result = usb_sg_init(&vub300->sg_request, vub300->udev, in __command_read_data()
1441 pipe, 0, data->sg, in __command_read_data()
1442 data->sg_len, 0, GFP_KERNEL); in __command_read_data()
1444 usb_unlink_urb(vub300->command_out_urb); in __command_read_data()
1445 usb_unlink_urb(vub300->command_res_urb); in __command_read_data()
1446 cmd->error = result; in __command_read_data()
1447 data->bytes_xfered = 0; in __command_read_data()
1450 vub300->sg_transfer_timer.expires = in __command_read_data()
1453 add_timer(&vub300->sg_transfer_timer); in __command_read_data()
1454 usb_sg_wait(&vub300->sg_request); in __command_read_data()
1455 del_timer(&vub300->sg_transfer_timer); in __command_read_data()
1456 if (vub300->sg_request.status < 0) { in __command_read_data()
1457 cmd->error = vub300->sg_request.status; in __command_read_data()
1458 data->bytes_xfered = 0; in __command_read_data()
1461 data->bytes_xfered = vub300->datasize; in __command_read_data()
1469 unsigned pipe = usb_rcvbulkpipe(vub300->udev, in __command_read_data()
1470 vub300->data_inp_ep); in __command_read_data()
1476 cmd->error = result; in __command_read_data()
1477 data->bytes_xfered = 0; in __command_read_data()
1481 cmd->error = -EREMOTEIO; in __command_read_data()
1482 data->bytes_xfered = 0; in __command_read_data()
1486 sg_copy_from_buffer(data->sg, data->sg_len, buf, in __command_read_data()
1489 data->bytes_xfered = vub300->datasize; in __command_read_data()
1493 cmd->error = -ENOMEM; in __command_read_data()
1494 data->bytes_xfered = 0; in __command_read_data()
1504 unsigned pipe = usb_sndbulkpipe(vub300->udev, vub300->data_out_ep); in __command_write_data()
1505 int linear_length = vub300->datasize; in __command_write_data()
1511 sg_copy_to_buffer(data->sg, data->sg_len, in __command_write_data()
1512 vub300->padded_buffer, in __command_write_data()
1513 sizeof(vub300->padded_buffer)); in __command_write_data()
1514 memset(vub300->padded_buffer + linear_length, 0, in __command_write_data()
1515 sizeof(vub300->padded_buffer) - linear_length); in __command_write_data()
1516 result = vub300_usb_bulk_msg(vub300, pipe, vub300->padded_buffer, in __command_write_data()
1517 sizeof(vub300->padded_buffer), in __command_write_data()
1519 (sizeof(vub300->padded_buffer) / in __command_write_data()
1522 cmd->error = result; in __command_write_data()
1523 data->bytes_xfered = 0; in __command_write_data()
1525 data->bytes_xfered = vub300->datasize; in __command_write_data()
1527 } else if ((!vub300->large_usb_packets && (0 < modulo_64_length)) || in __command_write_data()
1528 (vub300->large_usb_packets && (64 > modulo_512_length)) in __command_write_data()
1529 ) { /* don't you just love these work-rounds */ in __command_write_data()
1535 sg_copy_to_buffer(data->sg, data->sg_len, buf, in __command_write_data()
1538 padded_length - linear_length); in __command_write_data()
1545 cmd->error = result; in __command_write_data()
1546 data->bytes_xfered = 0; in __command_write_data()
1548 data->bytes_xfered = vub300->datasize; in __command_write_data()
1551 cmd->error = -ENOMEM; in __command_write_data()
1552 data->bytes_xfered = 0; in __command_write_data()
1554 } else { /* no data padding required */ in __command_write_data()
1557 sg_copy_to_buffer(data->sg, data->sg_len, buf, sizeof(buf)); in __command_write_data()
1558 result = usb_sg_init(&vub300->sg_request, vub300->udev, in __command_write_data()
1559 pipe, 0, data->sg, in __command_write_data()
1560 data->sg_len, 0, GFP_KERNEL); in __command_write_data()
1562 usb_unlink_urb(vub300->command_out_urb); in __command_write_data()
1563 usb_unlink_urb(vub300->command_res_urb); in __command_write_data()
1564 cmd->error = result; in __command_write_data()
1565 data->bytes_xfered = 0; in __command_write_data()
1567 vub300->sg_transfer_timer.expires = in __command_write_data()
1570 add_timer(&vub300->sg_transfer_timer); in __command_write_data()
1571 usb_sg_wait(&vub300->sg_request); in __command_write_data()
1572 if (cmd->error) { in __command_write_data()
1573 data->bytes_xfered = 0; in __command_write_data()
1575 del_timer(&vub300->sg_transfer_timer); in __command_write_data()
1576 if (vub300->sg_request.status < 0) { in __command_write_data()
1577 cmd->error = vub300->sg_request.status; in __command_write_data()
1578 data->bytes_xfered = 0; in __command_write_data()
1580 data->bytes_xfered = vub300->datasize; in __command_write_data()
1596 wait_for_completion_timeout(&vub300->command_complete, in __vub300_command_response()
1601 vub300->usb_timed_out = 1; in __vub300_command_response()
1602 usb_kill_urb(vub300->command_out_urb); in __vub300_command_response()
1603 usb_kill_urb(vub300->command_res_urb); in __vub300_command_response()
1604 cmd->error = -ETIMEDOUT; in __vub300_command_response()
1605 result = usb_lock_device_for_reset(vub300->udev, in __vub300_command_response()
1606 vub300->interface); in __vub300_command_response()
1608 result = usb_reset_device(vub300->udev); in __vub300_command_response()
1609 usb_unlock_device(vub300->udev); in __vub300_command_response()
1613 usb_kill_urb(vub300->command_out_urb); in __vub300_command_response()
1614 usb_kill_urb(vub300->command_res_urb); in __vub300_command_response()
1615 cmd->error = respretval; in __vub300_command_response()
1616 } else if (cmd->error) { in __vub300_command_response()
1621 } else if (vub300->command_out_urb->status) { in __vub300_command_response()
1622 vub300->usb_transport_fail = vub300->command_out_urb->status; in __vub300_command_response()
1623 cmd->error = -EPROTO == vub300->command_out_urb->status ? in __vub300_command_response()
1624 -ESHUTDOWN : vub300->command_out_urb->status; in __vub300_command_response()
1625 } else if (vub300->command_res_urb->status) { in __vub300_command_response()
1626 vub300->usb_transport_fail = vub300->command_res_urb->status; in __vub300_command_response()
1627 cmd->error = -EPROTO == vub300->command_res_urb->status ? in __vub300_command_response()
1628 -ESHUTDOWN : vub300->command_res_urb->status; in __vub300_command_response()
1629 } else if (vub300->resp.common.header_type == 0x00) { in __vub300_command_response()
1632 * and there was no piggybacked data in __vub300_command_response()
1634 } else if (vub300->resp.common.header_type == RESPONSE_ERROR) { in __vub300_command_response()
1635 cmd->error = in __vub300_command_response()
1636 vub300_response_error(vub300->resp.error.error_code); in __vub300_command_response()
1637 if (vub300->data) in __vub300_command_response()
1638 usb_sg_cancel(&vub300->sg_request); in __vub300_command_response()
1639 } else if (vub300->resp.common.header_type == RESPONSE_PIGGYBACKED) { in __vub300_command_response()
1641 vub300->resp.common.header_size - in __vub300_command_response()
1645 while (register_count--) { in __vub300_command_response()
1646 add_offloaded_reg(vub300, &vub300->resp.pig.reg[ri]); in __vub300_command_response()
1649 vub300->resp.common.header_size = in __vub300_command_response()
1651 vub300->resp.common.header_type = 0x00; in __vub300_command_response()
1652 cmd->error = 0; in __vub300_command_response()
1653 } else if (vub300->resp.common.header_type == RESPONSE_PIG_DISABLED) { in __vub300_command_response()
1655 vub300->resp.common.header_size - in __vub300_command_response()
1659 while (register_count--) { in __vub300_command_response()
1660 add_offloaded_reg(vub300, &vub300->resp.pig.reg[ri]); in __vub300_command_response()
1663 mutex_lock(&vub300->irq_mutex); in __vub300_command_response()
1664 if (vub300->irqs_queued) { in __vub300_command_response()
1665 vub300->irqs_queued += 1; in __vub300_command_response()
1666 } else if (vub300->irq_enabled) { in __vub300_command_response()
1667 vub300->irqs_queued += 1; in __vub300_command_response()
1670 vub300->irqs_queued += 1; in __vub300_command_response()
1672 vub300->irq_disabled = 1; in __vub300_command_response()
1673 mutex_unlock(&vub300->irq_mutex); in __vub300_command_response()
1674 vub300->resp.common.header_size = in __vub300_command_response()
1676 vub300->resp.common.header_type = 0x00; in __vub300_command_response()
1677 cmd->error = 0; in __vub300_command_response()
1678 } else if (vub300->resp.common.header_type == RESPONSE_PIG_ENABLED) { in __vub300_command_response()
1680 vub300->resp.common.header_size - in __vub300_command_response()
1684 while (register_count--) { in __vub300_command_response()
1685 add_offloaded_reg(vub300, &vub300->resp.pig.reg[ri]); in __vub300_command_response()
1688 mutex_lock(&vub300->irq_mutex); in __vub300_command_response()
1689 if (vub300->irqs_queued) { in __vub300_command_response()
1690 vub300->irqs_queued += 1; in __vub300_command_response()
1691 } else if (vub300->irq_enabled) { in __vub300_command_response()
1692 vub300->irqs_queued += 1; in __vub300_command_response()
1695 vub300->irqs_queued += 1; in __vub300_command_response()
1697 vub300->irq_disabled = 0; in __vub300_command_response()
1698 mutex_unlock(&vub300->irq_mutex); in __vub300_command_response()
1699 vub300->resp.common.header_size = in __vub300_command_response()
1701 vub300->resp.common.header_type = 0x00; in __vub300_command_response()
1702 cmd->error = 0; in __vub300_command_response()
1704 cmd->error = -EINVAL; in __vub300_command_response()
1711 int resp_len = vub300->resp_len; in construct_request_response()
1712 int less_cmd = (17 == resp_len) ? resp_len : resp_len - 1; in construct_request_response()
1715 u8 *r = vub300->resp.response.command_response; in construct_request_response()
1720 cmd->resp[words] = (r[1 + (words << 2)] << 24) in construct_request_response()
1724 cmd->resp[words] = (r[1 + (words << 2)] << 24) in construct_request_response()
1727 cmd->resp[words] = (r[1 + (words << 2)] << 24); in construct_request_response()
1729 while (words-- > 0) { in construct_request_response()
1730 cmd->resp[words] = (r[1 + (words << 2)] << 24) in construct_request_response()
1735 if ((cmd->opcode == 53) && (0x000000FF & cmd->resp[0])) in construct_request_response()
1736 cmd->resp[0] &= 0xFFFFFF00; in construct_request_response()
1744 if (!vub300->interface) { in vub300_cmndwork_thread()
1745 kref_put(&vub300->kref, vub300_delete); in vub300_cmndwork_thread()
1748 struct mmc_request *req = vub300->req; in vub300_cmndwork_thread()
1749 struct mmc_command *cmd = vub300->cmd; in vub300_cmndwork_thread()
1750 struct mmc_data *data = vub300->data; in vub300_cmndwork_thread()
1752 mutex_lock(&vub300->cmd_mutex); in vub300_cmndwork_thread()
1753 init_completion(&vub300->command_complete); in vub300_cmndwork_thread()
1754 if (likely(vub300->vub_name[0]) || !vub300->mmc->card) { in vub300_cmndwork_thread()
1760 } else if (0 == vub300->mmc->card->sdio_funcs) { in vub300_cmndwork_thread()
1761 strscpy(vub300->vub_name, "SD memory device", in vub300_cmndwork_thread()
1762 sizeof(vub300->vub_name)); in vub300_cmndwork_thread()
1769 else if (MMC_DATA_READ & data->flags) in vub300_cmndwork_thread()
1774 vub300->req = NULL; in vub300_cmndwork_thread()
1775 vub300->cmd = NULL; in vub300_cmndwork_thread()
1776 vub300->data = NULL; in vub300_cmndwork_thread()
1777 if (cmd->error) { in vub300_cmndwork_thread()
1778 if (cmd->error == -ENOMEDIUM) in vub300_cmndwork_thread()
1780 mutex_unlock(&vub300->cmd_mutex); in vub300_cmndwork_thread()
1781 mmc_request_done(vub300->mmc, req); in vub300_cmndwork_thread()
1782 kref_put(&vub300->kref, vub300_delete); in vub300_cmndwork_thread()
1786 vub300->resp_len = 0; in vub300_cmndwork_thread()
1787 mutex_unlock(&vub300->cmd_mutex); in vub300_cmndwork_thread()
1788 kref_put(&vub300->kref, vub300_delete); in vub300_cmndwork_thread()
1789 mmc_request_done(vub300->mmc, req); in vub300_cmndwork_thread()
1799 u8 cmd0 = 0xFF & (cmd->arg >> 24); in examine_cyclic_buffer()
1800 u8 cmd1 = 0xFF & (cmd->arg >> 16); in examine_cyclic_buffer()
1801 u8 cmd2 = 0xFF & (cmd->arg >> 8); in examine_cyclic_buffer()
1802 u8 cmd3 = 0xFF & (cmd->arg >> 0); in examine_cyclic_buffer()
1803 int first = MAXREGMASK & vub300->fn[Function].offload_point; in examine_cyclic_buffer()
1804 struct offload_registers_access *rf = &vub300->fn[Function].reg[first]; in examine_cyclic_buffer()
1805 if (cmd0 == rf->command_byte[0] && in examine_cyclic_buffer()
1806 cmd1 == rf->command_byte[1] && in examine_cyclic_buffer()
1807 cmd2 == rf->command_byte[2] && in examine_cyclic_buffer()
1808 cmd3 == rf->command_byte[3]) { in examine_cyclic_buffer()
1810 cmd->resp[1] = checksum << 24; in examine_cyclic_buffer()
1811 cmd->resp[0] = (rf->Respond_Byte[0] << 24) in examine_cyclic_buffer()
1812 | (rf->Respond_Byte[1] << 16) in examine_cyclic_buffer()
1813 | (rf->Respond_Byte[2] << 8) in examine_cyclic_buffer()
1814 | (rf->Respond_Byte[3] << 0); in examine_cyclic_buffer()
1815 vub300->fn[Function].offload_point += 1; in examine_cyclic_buffer()
1816 vub300->fn[Function].offload_count -= 1; in examine_cyclic_buffer()
1817 vub300->total_offload_count -= 1; in examine_cyclic_buffer()
1821 u8 register_count = vub300->fn[Function].offload_count - 1; in examine_cyclic_buffer()
1822 u32 register_point = vub300->fn[Function].offload_point + 1; in examine_cyclic_buffer()
1826 &vub300->fn[Function].reg[point]; in examine_cyclic_buffer()
1827 if (cmd0 == r->command_byte[0] && in examine_cyclic_buffer()
1828 cmd1 == r->command_byte[1] && in examine_cyclic_buffer()
1829 cmd2 == r->command_byte[2] && in examine_cyclic_buffer()
1830 cmd3 == r->command_byte[3]) { in examine_cyclic_buffer()
1832 cmd->resp[1] = checksum << 24; in examine_cyclic_buffer()
1833 cmd->resp[0] = (r->Respond_Byte[0] << 24) in examine_cyclic_buffer()
1834 | (r->Respond_Byte[1] << 16) in examine_cyclic_buffer()
1835 | (r->Respond_Byte[2] << 8) in examine_cyclic_buffer()
1836 | (r->Respond_Byte[3] << 0); in examine_cyclic_buffer()
1837 vub300->fn[Function].offload_point += delta; in examine_cyclic_buffer()
1838 vub300->fn[Function].offload_count -= delta; in examine_cyclic_buffer()
1839 vub300->total_offload_count -= delta; in examine_cyclic_buffer()
1843 register_count -= 1; in examine_cyclic_buffer()
1856 u8 regs = vub300->dynamic_register_count; in satisfy_request_from_offloaded_data()
1860 while (0 < regs--) { in satisfy_request_from_offloaded_data()
1861 if ((vub300->sdio_register[i].func_num == func) && in satisfy_request_from_offloaded_data()
1862 (vub300->sdio_register[i].sdio_reg == reg)) { in satisfy_request_from_offloaded_data()
1863 if (!vub300->sdio_register[i].prepared) { in satisfy_request_from_offloaded_data()
1865 } else if ((0x80000000 & cmd->arg) == 0x80000000) { in satisfy_request_from_offloaded_data()
1870 vub300->sdio_register[i].prepared = 0; in satisfy_request_from_offloaded_data()
1876 u8 rsp2 = vub300->sdio_register[i].response; in satisfy_request_from_offloaded_data()
1877 u8 rsp3 = vub300->sdio_register[i].regvalue; in satisfy_request_from_offloaded_data()
1878 vub300->sdio_register[i].prepared = 0; in satisfy_request_from_offloaded_data()
1879 cmd->resp[1] = checksum << 24; in satisfy_request_from_offloaded_data()
1880 cmd->resp[0] = (rsp0 << 24) in satisfy_request_from_offloaded_data()
1891 if (vub300->total_offload_count == 0) in satisfy_request_from_offloaded_data()
1893 else if (vub300->fn[func].offload_count == 0) in satisfy_request_from_offloaded_data()
1899 static void vub300_mmc_request(struct mmc_host *mmc, struct mmc_request *req) in vub300_mmc_request() argument
1901 struct mmc_command *cmd = req->cmd; in vub300_mmc_request()
1902 struct vub300_mmc_host *vub300 = mmc_priv(mmc); in vub300_mmc_request()
1903 if (!vub300->interface) { in vub300_mmc_request()
1904 cmd->error = -ESHUTDOWN; in vub300_mmc_request()
1905 mmc_request_done(mmc, req); in vub300_mmc_request()
1908 struct mmc_data *data = req->data; in vub300_mmc_request()
1909 if (!vub300->card_powered) { in vub300_mmc_request()
1910 cmd->error = -ENOMEDIUM; in vub300_mmc_request()
1911 mmc_request_done(mmc, req); in vub300_mmc_request()
1914 if (!vub300->card_present) { in vub300_mmc_request()
1915 cmd->error = -ENOMEDIUM; in vub300_mmc_request()
1916 mmc_request_done(mmc, req); in vub300_mmc_request()
1919 if (vub300->usb_transport_fail) { in vub300_mmc_request()
1920 cmd->error = vub300->usb_transport_fail; in vub300_mmc_request()
1921 mmc_request_done(mmc, req); in vub300_mmc_request()
1924 if (!vub300->interface) { in vub300_mmc_request()
1925 cmd->error = -ENODEV; in vub300_mmc_request()
1926 mmc_request_done(mmc, req); in vub300_mmc_request()
1929 kref_get(&vub300->kref); in vub300_mmc_request()
1930 mutex_lock(&vub300->cmd_mutex); in vub300_mmc_request()
1931 mod_timer(&vub300->inactivity_timer, jiffies + HZ); in vub300_mmc_request()
1936 if (cmd->opcode == 52 && in vub300_mmc_request()
1938 cmd->error = 0; in vub300_mmc_request()
1939 mutex_unlock(&vub300->cmd_mutex); in vub300_mmc_request()
1940 kref_put(&vub300->kref, vub300_delete); in vub300_mmc_request()
1941 mmc_request_done(mmc, req); in vub300_mmc_request()
1944 vub300->cmd = cmd; in vub300_mmc_request()
1945 vub300->req = req; in vub300_mmc_request()
1946 vub300->data = data; in vub300_mmc_request()
1948 vub300->datasize = data->blksz * data->blocks; in vub300_mmc_request()
1950 vub300->datasize = 0; in vub300_mmc_request()
1952 mutex_unlock(&vub300->cmd_mutex); in vub300_mmc_request()
1953 kref_put(&vub300->kref, vub300_delete); in vub300_mmc_request()
1959 * and re-acquire it in the cmndwork thread in vub300_mmc_request()
1971 if (ios->clock >= 48000000) in __set_clock_speed()
1973 else if (ios->clock >= 24000000) in __set_clock_speed()
1975 else if (ios->clock >= 20000000) in __set_clock_speed()
1977 else if (ios->clock >= 15000000) in __set_clock_speed()
1979 else if (ios->clock >= 200000) in __set_clock_speed()
1992 usb_control_msg(vub300->udev, usb_sndctrlpipe(vub300->udev, 0), in __set_clock_speed()
1997 dev_err(&vub300->udev->dev, "SET_CLOCK_SPEED" in __set_clock_speed()
2000 dev_dbg(&vub300->udev->dev, "SET_CLOCK_SPEED" in __set_clock_speed()
2005 static void vub300_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) in vub300_mmc_set_ios() argument
2007 struct vub300_mmc_host *vub300 = mmc_priv(mmc); in vub300_mmc_set_ios()
2008 if (!vub300->interface) in vub300_mmc_set_ios()
2010 kref_get(&vub300->kref); in vub300_mmc_set_ios()
2011 mutex_lock(&vub300->cmd_mutex); in vub300_mmc_set_ios()
2012 if ((ios->power_mode == MMC_POWER_OFF) && vub300->card_powered) { in vub300_mmc_set_ios()
2013 vub300->card_powered = 0; in vub300_mmc_set_ios()
2014 usb_control_msg(vub300->udev, usb_sndctrlpipe(vub300->udev, 0), in vub300_mmc_set_ios()
2018 /* must wait for the VUB300 u-proc to boot up */ in vub300_mmc_set_ios()
2020 } else if ((ios->power_mode == MMC_POWER_UP) && !vub300->card_powered) { in vub300_mmc_set_ios()
2021 usb_control_msg(vub300->udev, usb_sndctrlpipe(vub300->udev, 0), in vub300_mmc_set_ios()
2026 vub300->card_powered = 1; in vub300_mmc_set_ios()
2027 } else if (ios->power_mode == MMC_POWER_ON) { in vub300_mmc_set_ios()
2034 /* this should mean no change of state */ in vub300_mmc_set_ios()
2036 mutex_unlock(&vub300->cmd_mutex); in vub300_mmc_set_ios()
2037 kref_put(&vub300->kref, vub300_delete); in vub300_mmc_set_ios()
2040 static int vub300_mmc_get_ro(struct mmc_host *mmc) in vub300_mmc_get_ro() argument
2042 struct vub300_mmc_host *vub300 = mmc_priv(mmc); in vub300_mmc_get_ro()
2043 return vub300->read_only; in vub300_mmc_get_ro()
2046 static void vub300_enable_sdio_irq(struct mmc_host *mmc, int enable) in vub300_enable_sdio_irq() argument
2048 struct vub300_mmc_host *vub300 = mmc_priv(mmc); in vub300_enable_sdio_irq()
2049 if (!vub300->interface) in vub300_enable_sdio_irq()
2051 kref_get(&vub300->kref); in vub300_enable_sdio_irq()
2054 mutex_lock(&vub300->irq_mutex); in vub300_enable_sdio_irq()
2055 if (vub300->irqs_queued) { in vub300_enable_sdio_irq()
2056 vub300->irqs_queued -= 1; in vub300_enable_sdio_irq()
2057 mmc_signal_sdio_irq(vub300->mmc); in vub300_enable_sdio_irq()
2058 } else if (vub300->irq_disabled) { in vub300_enable_sdio_irq()
2059 vub300->irq_disabled = 0; in vub300_enable_sdio_irq()
2060 vub300->irq_enabled = 1; in vub300_enable_sdio_irq()
2062 } else if (vub300->irq_enabled) { in vub300_enable_sdio_irq()
2065 vub300->irq_enabled = 1; in vub300_enable_sdio_irq()
2068 mutex_unlock(&vub300->irq_mutex); in vub300_enable_sdio_irq()
2071 vub300->irq_enabled = 0; in vub300_enable_sdio_irq()
2073 kref_put(&vub300->kref, vub300_delete); in vub300_enable_sdio_irq()
2090 int retval = -ENOMEM; in vub300_probe()
2093 struct mmc_host *mmc; in vub300_probe() local
2097 usb_string(udev, udev->descriptor.iManufacturer, manufacturer, in vub300_probe()
2099 usb_string(udev, udev->descriptor.iProduct, product, sizeof(product)); in vub300_probe()
2100 usb_string(udev, udev->descriptor.iSerialNumber, serial_number, in vub300_probe()
2102 dev_info(&udev->dev, "probing VID:PID(%04X:%04X) %s %s %s\n", in vub300_probe()
2103 le16_to_cpu(udev->descriptor.idVendor), in vub300_probe()
2104 le16_to_cpu(udev->descriptor.idProduct), in vub300_probe()
2108 retval = -ENOMEM; in vub300_probe()
2113 retval = -ENOMEM; in vub300_probe()
2116 /* this also allocates memory for our VUB300 mmc host device */ in vub300_probe()
2117 mmc = mmc_alloc_host(sizeof(struct vub300_mmc_host), &udev->dev); in vub300_probe()
2118 if (!mmc) { in vub300_probe()
2119 retval = -ENOMEM; in vub300_probe()
2120 dev_err(&udev->dev, "not enough memory for the mmc_host\n"); in vub300_probe()
2123 /* MMC core transfer sizes tunable parameters */ in vub300_probe()
2124 mmc->caps = 0; in vub300_probe()
2126 mmc->caps |= MMC_CAP_4_BIT_DATA; in vub300_probe()
2128 mmc->caps |= MMC_CAP_SDIO_IRQ; in vub300_probe()
2129 mmc->caps &= ~MMC_CAP_NEEDS_POLL; in vub300_probe()
2136 mmc->caps |= MMC_CAP_MMC_HIGHSPEED; in vub300_probe()
2137 mmc->caps |= MMC_CAP_SD_HIGHSPEED; in vub300_probe()
2138 mmc->f_max = 24000000; in vub300_probe()
2139 dev_info(&udev->dev, "limiting SDIO speed to 24_MHz\n"); in vub300_probe()
2141 mmc->caps |= MMC_CAP_MMC_HIGHSPEED; in vub300_probe()
2142 mmc->caps |= MMC_CAP_SD_HIGHSPEED; in vub300_probe()
2143 mmc->f_max = 48000000; in vub300_probe()
2145 mmc->f_min = 200000; in vub300_probe()
2146 mmc->max_blk_count = 511; in vub300_probe()
2147 mmc->max_blk_size = 512; in vub300_probe()
2148 mmc->max_segs = 128; in vub300_probe()
2150 mmc->max_req_size = force_max_req_size * 1024; in vub300_probe()
2152 mmc->max_req_size = 64 * 1024; in vub300_probe()
2153 mmc->max_seg_size = mmc->max_req_size; in vub300_probe()
2154 mmc->ocr_avail = 0; in vub300_probe()
2155 mmc->ocr_avail |= MMC_VDD_165_195; in vub300_probe()
2156 mmc->ocr_avail |= MMC_VDD_20_21; in vub300_probe()
2157 mmc->ocr_avail |= MMC_VDD_21_22; in vub300_probe()
2158 mmc->ocr_avail |= MMC_VDD_22_23; in vub300_probe()
2159 mmc->ocr_avail |= MMC_VDD_23_24; in vub300_probe()
2160 mmc->ocr_avail |= MMC_VDD_24_25; in vub300_probe()
2161 mmc->ocr_avail |= MMC_VDD_25_26; in vub300_probe()
2162 mmc->ocr_avail |= MMC_VDD_26_27; in vub300_probe()
2163 mmc->ocr_avail |= MMC_VDD_27_28; in vub300_probe()
2164 mmc->ocr_avail |= MMC_VDD_28_29; in vub300_probe()
2165 mmc->ocr_avail |= MMC_VDD_29_30; in vub300_probe()
2166 mmc->ocr_avail |= MMC_VDD_30_31; in vub300_probe()
2167 mmc->ocr_avail |= MMC_VDD_31_32; in vub300_probe()
2168 mmc->ocr_avail |= MMC_VDD_32_33; in vub300_probe()
2169 mmc->ocr_avail |= MMC_VDD_33_34; in vub300_probe()
2170 mmc->ocr_avail |= MMC_VDD_34_35; in vub300_probe()
2171 mmc->ocr_avail |= MMC_VDD_35_36; in vub300_probe()
2172 mmc->ops = &vub300_mmc_ops; in vub300_probe()
2173 vub300 = mmc_priv(mmc); in vub300_probe()
2174 vub300->mmc = mmc; in vub300_probe()
2175 vub300->card_powered = 0; in vub300_probe()
2176 vub300->bus_width = 0; in vub300_probe()
2177 vub300->cmnd.head.block_size[0] = 0x00; in vub300_probe()
2178 vub300->cmnd.head.block_size[1] = 0x00; in vub300_probe()
2179 vub300->app_spec = 0; in vub300_probe()
2180 mutex_init(&vub300->cmd_mutex); in vub300_probe()
2181 mutex_init(&vub300->irq_mutex); in vub300_probe()
2182 vub300->command_out_urb = command_out_urb; in vub300_probe()
2183 vub300->command_res_urb = command_res_urb; in vub300_probe()
2184 vub300->usb_timed_out = 0; in vub300_probe()
2185 vub300->dynamic_register_count = 0; in vub300_probe()
2187 for (i = 0; i < ARRAY_SIZE(vub300->fn); i++) { in vub300_probe()
2188 vub300->fn[i].offload_point = 0; in vub300_probe()
2189 vub300->fn[i].offload_count = 0; in vub300_probe()
2192 vub300->total_offload_count = 0; in vub300_probe()
2193 vub300->irq_enabled = 0; in vub300_probe()
2194 vub300->irq_disabled = 0; in vub300_probe()
2195 vub300->irqs_queued = 0; in vub300_probe()
2197 for (i = 0; i < ARRAY_SIZE(vub300->sdio_register); i++) in vub300_probe()
2198 vub300->sdio_register[i++].activate = 0; in vub300_probe()
2200 vub300->udev = udev; in vub300_probe()
2201 vub300->interface = interface; in vub300_probe()
2202 vub300->cmnd_res_ep = 0; in vub300_probe()
2203 vub300->cmnd_out_ep = 0; in vub300_probe()
2204 vub300->data_inp_ep = 0; in vub300_probe()
2205 vub300->data_out_ep = 0; in vub300_probe()
2207 for (i = 0; i < ARRAY_SIZE(vub300->fbs); i++) in vub300_probe()
2208 vub300->fbs[i] = 512; in vub300_probe()
2213 * use the first pair of bulk-in and bulk-out in vub300_probe()
2216 * use the second pair of bulk-in and bulk-out in vub300_probe()
2219 vub300->large_usb_packets = 0; in vub300_probe()
2220 iface_desc = interface->cur_altsetting; in vub300_probe()
2221 for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { in vub300_probe()
2223 &iface_desc->endpoint[i].desc; in vub300_probe()
2224 dev_info(&vub300->udev->dev, in vub300_probe()
2228 "UNKNOWN", i, endpoint->bEndpointAddress); in vub300_probe()
2229 if (endpoint->wMaxPacketSize > 64) in vub300_probe()
2230 vub300->large_usb_packets = 1; in vub300_probe()
2232 if (!vub300->cmnd_res_ep) { in vub300_probe()
2233 vub300->cmnd_res_ep = in vub300_probe()
2234 endpoint->bEndpointAddress; in vub300_probe()
2235 } else if (!vub300->data_inp_ep) { in vub300_probe()
2236 vub300->data_inp_ep = in vub300_probe()
2237 endpoint->bEndpointAddress; in vub300_probe()
2239 dev_warn(&vub300->udev->dev, in vub300_probe()
2244 if (!vub300->cmnd_out_ep) { in vub300_probe()
2245 vub300->cmnd_out_ep = in vub300_probe()
2246 endpoint->bEndpointAddress; in vub300_probe()
2247 } else if (!vub300->data_out_ep) { in vub300_probe()
2248 vub300->data_out_ep = in vub300_probe()
2249 endpoint->bEndpointAddress; in vub300_probe()
2251 dev_warn(&vub300->udev->dev, in vub300_probe()
2256 dev_warn(&vub300->udev->dev, in vub300_probe()
2258 endpoint->bEndpointAddress); in vub300_probe()
2261 if (vub300->cmnd_res_ep && vub300->cmnd_out_ep && in vub300_probe()
2262 vub300->data_inp_ep && vub300->data_out_ep) { in vub300_probe()
2263 dev_info(&vub300->udev->dev, in vub300_probe()
2266 vub300->large_usb_packets ? "LARGE" : "SMALL", in vub300_probe()
2267 vub300->cmnd_out_ep, vub300->cmnd_res_ep, in vub300_probe()
2268 vub300->data_out_ep, vub300->data_inp_ep); in vub300_probe()
2271 dev_err(&vub300->udev->dev, in vub300_probe()
2272 "Could not find two sets of bulk-in/out endpoint pairs\n"); in vub300_probe()
2273 retval = -EINVAL; in vub300_probe()
2277 usb_control_msg(vub300->udev, usb_rcvctrlpipe(vub300->udev, 0), in vub300_probe()
2280 0x0000, 0x0000, &vub300->hc_info, in vub300_probe()
2281 sizeof(vub300->hc_info), 1000); in vub300_probe()
2285 usb_control_msg(vub300->udev, usb_sndctrlpipe(vub300->udev, 0), in vub300_probe()
2291 dev_info(&vub300->udev->dev, in vub300_probe()
2293 (mmc->caps & MMC_CAP_SDIO_IRQ) ? "IRQs" : "POLL", in vub300_probe()
2294 (mmc->caps & MMC_CAP_4_BIT_DATA) ? "4-bit" : "1-bit", in vub300_probe()
2295 mmc->f_max / 1000000, in vub300_probe()
2297 vub300->large_usb_packets ? 512 : 64); in vub300_probe()
2299 usb_control_msg(vub300->udev, usb_rcvctrlpipe(vub300->udev, 0), in vub300_probe()
2302 0x0000, 0x0000, &vub300->system_port_status, in vub300_probe()
2303 sizeof(vub300->system_port_status), 1000); in vub300_probe()
2306 } else if (sizeof(vub300->system_port_status) == retval) { in vub300_probe()
2307 vub300->card_present = in vub300_probe()
2308 (0x0001 & vub300->system_port_status.port_flags) ? 1 : 0; in vub300_probe()
2309 vub300->read_only = in vub300_probe()
2310 (0x0010 & vub300->system_port_status.port_flags) ? 1 : 0; in vub300_probe()
2312 retval = -EINVAL; in vub300_probe()
2316 INIT_DELAYED_WORK(&vub300->pollwork, vub300_pollwork_thread); in vub300_probe()
2317 INIT_WORK(&vub300->cmndwork, vub300_cmndwork_thread); in vub300_probe()
2318 INIT_WORK(&vub300->deadwork, vub300_deadwork_thread); in vub300_probe()
2319 kref_init(&vub300->kref); in vub300_probe()
2320 timer_setup(&vub300->sg_transfer_timer, vub300_sg_timed_out, 0); in vub300_probe()
2321 kref_get(&vub300->kref); in vub300_probe()
2322 timer_setup(&vub300->inactivity_timer, in vub300_probe()
2324 vub300->inactivity_timer.expires = jiffies + HZ; in vub300_probe()
2325 add_timer(&vub300->inactivity_timer); in vub300_probe()
2326 if (vub300->card_present) in vub300_probe()
2327 dev_info(&vub300->udev->dev, in vub300_probe()
2332 dev_info(&vub300->udev->dev, in vub300_probe()
2334 "connected with no SD/SDIO card inserted\n", in vub300_probe()
2336 retval = mmc_add_host(mmc); in vub300_probe()
2342 del_timer_sync(&vub300->inactivity_timer); in vub300_probe()
2344 mmc_free_host(mmc); in vub300_probe()
2347 * which is contained at the end of struct mmc in vub300_probe()
2361 if (!vub300 || !vub300->mmc) { in vub300_disconnect()
2364 struct mmc_host *mmc = vub300->mmc; in vub300_disconnect() local
2365 if (!vub300->mmc) { in vub300_disconnect()
2371 vub300->interface = NULL; in vub300_disconnect()
2372 kref_put(&vub300->kref, vub300_delete); in vub300_disconnect()
2373 mmc_remove_host(mmc); in vub300_disconnect()
2398 mutex_lock(&vub300->cmd_mutex); in vub300_pre_reset()
2405 /* we are sure no URBs are active - no locking needed */ in vub300_post_reset()
2406 vub300->errors = -EPIPE; in vub300_post_reset()
2407 mutex_unlock(&vub300->cmd_mutex); in vub300_post_reset()
2432 result = -ENOMEM; in vub300_init()
2438 result = -ENOMEM; in vub300_init()
2444 result = -ENOMEM; in vub300_init()
2478 MODULE_DESCRIPTION("VUB300 USB to SD/MMC/SDIO adapter driver");