usbhcd only add useful channel to freelist
authoryangkai <yk@rock-chips.com>
Tue, 13 Nov 2012 09:45:23 +0000 (17:45 +0800)
committeryangkai <yk@rock-chips.com>
Tue, 13 Nov 2012 09:45:23 +0000 (17:45 +0800)
drivers/usb/dwc_otg/dwc_otg_cil.c
drivers/usb/dwc_otg/dwc_otg_hcd.c

index 8acc6b0cdacf968985fda22f09b91bf720ce3985..c61117fa15c95c062c0efcb507b8ddb89af1876c 100755 (executable)
@@ -66,6 +66,7 @@
 #include "dwc_otg_driver.h"
 #include "dwc_otg_cil.h"
 #include "dwc_otg_pcd.h"
+#include "dwc_otg_hcd.h"
 #include "usbdev_rk.h"
 static dwc_otg_core_if_t * dwc_core_if = NULL;
 /** 
@@ -917,6 +918,8 @@ void dwc_otg_core_host_init(dwc_otg_core_if_t *_core_if)
        dwc_otg_hc_regs_t       *hc_regs;
        int                     num_channels;
        gotgctl_data_t  gotgctl = {.d32 = 0};
+       dwc_hc_t                *channel;
+       dwc_otg_hcd_t *_hcd = _core_if->otg_dev->hcd;
        struct dwc_otg_platform_data *pldata;
     pldata = _core_if->otg_dev->pldata;
 
@@ -1008,6 +1011,11 @@ void dwc_otg_core_host_init(dwc_otg_core_if_t *_core_if)
                        }
                } 
                while (hcchar.b.chen);
+
+               /* add channel to free list */
+               channel = _core_if->otg_dev->hcd->hc_ptr_array[i];
+               list_add_tail(&channel->hc_list_entry, &_hcd->free_hc_list);
+               dwc_otg_hc_cleanup(_hcd->core_if, channel);
        }
 
        /* Turn on the vbus power. */
index 5018584f64d85984e9a58fc2b2d26cf4d7038308..acb383b38dc05749a91bb59056eb6941fead67dc 100755 (executable)
@@ -1252,13 +1252,14 @@ static void hcd_reinit(dwc_otg_hcd_t *_hcd)
                list_del(item);
                item = _hcd->free_hc_list.next;
        }
+#if 0
        num_channels = _hcd->core_if->core_params->host_channels;
        for (i = 0; i < num_channels; i++) {
                channel = _hcd->hc_ptr_array[i];
                list_add_tail(&channel->hc_list_entry, &_hcd->free_hc_list);
                dwc_otg_hc_cleanup(_hcd->core_if, channel);
        }
-
+#endif
        /* Initialize the DWC core for host mode operation. */
        dwc_otg_core_host_init(_hcd->core_if);
 }