hidg: support boot protocol
[firefly-linux-kernel-4.4.55.git] / drivers / usb / dwc_otg / dwc_otg_hcd_queue.c
index 2d71e478f25bb7cf356c7eeb694e5d4ada724369..a0b9357626584c2d4af78a6a60524ea78ab42ee9 100755 (executable)
@@ -145,17 +145,11 @@ void dwc_otg_hcd_qh_init(dwc_otg_hcd_t *_hcd, dwc_otg_qh_t *_qh, struct urb *_ur
        _qh->maxp = usb_maxpacket(_urb->dev, _urb->pipe, !(usb_pipein(_urb->pipe)));
        INIT_LIST_HEAD(&_qh->qtd_list);
        INIT_LIST_HEAD(&_qh->qh_list_entry);
-       _qh->channel = NULL;
 
        /* FS/LS Enpoint on HS Hub 
         * NOT virtual root hub */
        _qh->do_split = 0;
 
-       /* yk@rk 20100625
-        * _urb->dev->tt->hub may be null
-        */
-       if((_urb->dev->tt)&&(!_urb->dev->tt->hub))
-               DWC_PRINT("%s tt->hub null!\n",__func__);
        if (((_urb->dev->speed == USB_SPEED_LOW) || 
             (_urb->dev->speed == USB_SPEED_FULL)) &&
            (_urb->dev->tt) && (_urb->dev->tt->hub)&&
@@ -253,7 +247,7 @@ static int periodic_channel_available(dwc_otg_hcd_t *_hcd)
         * non-periodic transactions.
         */
        int status;
-#ifdef CONFIG_ARCH_RK30
+#if defined(CONFIG_ARCH_RK30) || defined(CONFIG_ARCH_RK3188)
        int num_channels;
 
        num_channels = _hcd->core_if->core_params->host_channels;
@@ -380,6 +374,7 @@ static int schedule_periodic(dwc_otg_hcd_t *_hcd, dwc_otg_qh_t *_qh)
 
        /* Always start in the inactive schedule. */
        list_add_tail(&_qh->qh_list_entry, &_hcd->periodic_sched_inactive);
+       _qh->qh_state = QH_INACTIVE;
 
        /* Reserve the periodic channel. */
        _hcd->periodic_channels++;
@@ -565,11 +560,13 @@ void dwc_otg_hcd_qh_deactivate(dwc_otg_hcd_t *_hcd, dwc_otg_qh_t *_qh, int sched
                         * appropriate queue.
                         */
                        if (_qh->sched_frame == frame_number) {
-                               list_move_tail(&_qh->qh_list_entry,
-                                         &_hcd->periodic_sched_ready);
+                               //list_move_tail(&_qh->qh_list_entry,
+                               //        &_hcd->periodic_sched_ready);
+                   _qh->qh_state = QH_READY;
                        } else {
-                               list_move_tail(&_qh->qh_list_entry,
-                                         &_hcd->periodic_sched_inactive);
+                               //list_move_tail(&_qh->qh_list_entry,
+                               //        &_hcd->periodic_sched_inactive);
+                   _qh->qh_state = QH_INACTIVE;
                        }
                }
        }
@@ -647,7 +644,6 @@ int dwc_otg_hcd_qtd_add (dwc_otg_qtd_t *_qtd,
 
        struct urb *urb = _qtd->urb;
 
-
        /*
         * Get the QH which holds the QTD-list to insert to. Create QH if it
         * doesn't exist.
@@ -662,15 +658,15 @@ int dwc_otg_hcd_qtd_add (dwc_otg_qtd_t *_qtd,
                }
                ep->hcpriv = qh;
        }
-
-       local_irq_save(flags);  
+    spin_lock_irqsave(&_dwc_otg_hcd->global_lock, flags);
        retval = dwc_otg_hcd_qh_add(_dwc_otg_hcd, qh);
        if (retval == 0) {
                list_add_tail(&_qtd->qtd_list_entry, &qh->qtd_list);
        }
 
+    spin_unlock_irqrestore(&_dwc_otg_hcd->global_lock, flags);
+
  done:
-       local_irq_restore(flags);
        return retval;
 }