From 0872b20fbea2377c6286c39cbc60d3bd83a814aa Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 19 Aug 2012 14:06:11 +0100 Subject: [PATCH] Make microframe schedule patch a little closer to denx version. Remove vestiges of HW2937_WORKAROUND --- drivers/usb/host/dwc_otg/dwc_otg_cil.c | 1 - drivers/usb/host/dwc_otg/dwc_otg_cil.h | 2 -- drivers/usb/host/dwc_otg/dwc_otg_hcd.c | 3 ++- drivers/usb/host/dwc_otg/dwc_otg_hcd.h | 18 ---------------- drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c | 22 ++++++++++---------- 5 files changed, 13 insertions(+), 33 deletions(-) diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cil.c b/drivers/usb/host/dwc_otg/dwc_otg_cil.c index 1b33b669cf4264..83545c097aeeaf 100755 --- a/drivers/usb/host/dwc_otg/dwc_otg_cil.c +++ b/drivers/usb/host/dwc_otg/dwc_otg_cil.c @@ -2403,7 +2403,6 @@ void dwc_otg_hc_halt(dwc_otg_core_if_t * core_if, dwc_otg_core_global_regs_t *global_regs; dwc_otg_host_global_regs_t *host_global_regs; - DWC_DEBUGPL(DBG_HW2937, " dwc_otg_hc_halt(%d)\n", hc->hc_num); hc_regs = core_if->host_if->hc_regs[hc->hc_num]; global_regs = core_if->core_global_regs; host_global_regs = core_if->host_if->host_global_regs; diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cil.h b/drivers/usb/host/dwc_otg/dwc_otg_cil.h index b76fdd965c343f..9547362e465169 100755 --- a/drivers/usb/host/dwc_otg/dwc_otg_cil.h +++ b/drivers/usb/host/dwc_otg/dwc_otg_cil.h @@ -34,8 +34,6 @@ #if !defined(__DWC_CIL_H__) #define __DWC_CIL_H__ -#define DBG_HW2937 0x400 - #include "dwc_list.h" #include "dwc_otg_dbg.h" #include "dwc_otg_regs.h" diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c index 174ba7ee5a62fd..434d0c418b7734 100755 --- a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c +++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c @@ -1336,7 +1336,8 @@ dwc_otg_transaction_type_e dwc_otg_hcd_select_transactions(dwc_otg_hcd_t * hcd) ret_val = DWC_OTG_TRANSACTION_ALL; } - hcd->non_periodic_channels++; + if (!microframe_schedule) + hcd->non_periodic_channels++; } #ifdef DEBUG_HOST_CHANNELS diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd.h b/drivers/usb/host/dwc_otg/dwc_otg_hcd.h index d2220cba9293a2..8075595893a845 100755 --- a/drivers/usb/host/dwc_otg/dwc_otg_hcd.h +++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.h @@ -369,16 +369,6 @@ typedef struct dwc_otg_qh { DWC_CIRCLEQ_HEAD(hc_list, dwc_hc); -#ifdef HW2937_WORKAROUND - -typedef enum { - HW2937_XFER_MODE_IDLE, - HW2937_XFER_MODE_IN, - HW2937_XFER_MODE_OUT, - HW2937_XFER_MODE_PAUSEIN /* Transitioning from IN to IDLE */ -} hw2937_xfer_mode_t; -#endif - /** * This structure holds the state of the HCD, including the non-periodic and * periodic schedules. @@ -572,14 +562,6 @@ struct dwc_otg_hcd { /** Frame List DMA address */ dma_addr_t frame_list_dma; -#ifdef HW2937_WORKAROUND - /** Current transfer mode (IN, OUT, or IDLE) */ - hw2937_xfer_mode_t hw2937_xfer_mode; - - /** Mask of channels assigned to the current mode */ - uint32_t hw2937_assigned_channels; -#endif - #ifdef DEBUG uint32_t frrem_samples; uint64_t frrem_accum; diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c index 2d3d5c356822e8..4791033f450a2b 100755 --- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c +++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c @@ -613,16 +613,16 @@ static int schedule_periodic(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) } status = check_periodic_bandwidth(hcd, qh); - - if (status) { - DWC_INFO("%s: Insufficient periodic bandwidth for " "periodic transfer.\n", __func__); //NOTICE - return status; - } - - status = check_max_xfer_size(hcd, qh); } if (status) { - DWC_INFO("%s: Channel max transfer size too small " "for periodic transfer.\n", __func__); //NOTICE + DWC_INFO("%s: Insufficient periodic bandwidth for " + "periodic transfer.\n", __func__); + return status; + } + status = check_max_xfer_size(hcd, qh); + if (status) { + DWC_INFO("%s: Channel max transfer size too small " + "for periodic transfer.\n", __func__); return status; } @@ -692,12 +692,12 @@ static void deschedule_periodic(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) int i; DWC_LIST_REMOVE_INIT(&qh->qh_list_entry); + /* Update claimed usecs per (micro)frame. */ + hcd->periodic_usecs -= qh->usecs; + if (!microframe_schedule) { /* Release the periodic channel reservation. */ hcd->periodic_channels--; - - /* Update claimed usecs per (micro)frame. */ - hcd->periodic_usecs -= qh->usecs; } else { for (i = 0; i < 8; i++) { hcd->frame_usecs[i] += qh->frame_usecs[i];