Skip to content

Instantly share code, notes, and snippets.

@ddv2005
Created September 21, 2012 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ddv2005/3762318 to your computer and use it in GitHub Desktop.
Save ddv2005/3762318 to your computer and use it in GitHub Desktop.
usb_split_delay.patch
diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cil.c b/drivers/usb/host/dwc_otg/dwc_otg_cil.c
index 9b67537..f064a69 100644
--- a/drivers/usb/host/dwc_otg/dwc_otg_cil.c
+++ b/drivers/usb/host/dwc_otg/dwc_otg_cil.c
@@ -61,6 +61,9 @@
#include "dwc_otg_regs.h"
#include "dwc_otg_cil.h"
+extern int split_delay_static;
+extern int split_delay_dynamic;
+
static int dwc_otg_setup_params(dwc_otg_core_if_t * core_if);
/**
@@ -2881,6 +2884,32 @@ void dwc_otg_hc_start_transfer(dwc_otg_core_if_t * core_if, dwc_hc_t * hc)
/* Load OUT packet into the appropriate Tx FIFO. */
dwc_otg_hc_write_packet(core_if, hc);
}
+ if (hc->do_split)
+ {
+ if(split_delay_static>0)
+ DWC_UDELAY(split_delay_static);
+
+ if(split_delay_dynamic>0)
+ {
+ hcint_data_t hcint;
+ int i = 0;
+ int mask;
+
+ if (hc->complete_split)
+ mask = 0x63;
+ else
+ mask = 0x73;
+
+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint);
+
+ while (i < split_delay_dynamic && !(hcint.d32 & mask))
+ {
+ i++;
+ DWC_UDELAY(1);
+ hcint.d32 = DWC_READ_REG32(&hc_regs->hcint);
+ }
+ }
+ }
#ifdef DEBUG
if (hc->ep_type != DWC_OTG_EP_TYPE_INTR) {
DWC_DEBUGPL(DBG_HCDV, "transfer %d from core_if %p\n",
diff --git a/drivers/usb/host/dwc_otg/dwc_otg_driver.c b/drivers/usb/host/dwc_otg/dwc_otg_driver.c
index d5d8c4b..5e71c97 100644
--- a/drivers/usb/host/dwc_otg/dwc_otg_driver.c
+++ b/drivers/usb/host/dwc_otg/dwc_otg_driver.c
@@ -61,6 +61,8 @@
#define DWC_DRIVER_DESC "HS OTG USB Controller driver"
bool microframe_schedule=true;
+int split_delay_static = 0;
+int split_delay_dynamic = 0;
static const char dwc_driver_name[] = "dwc_otg";
@@ -1369,6 +1371,11 @@ module_param_named(otg_ver, dwc_otg_module_params.otg_ver, int, 0444);
MODULE_PARM_DESC(otg_ver, "OTG revision supported 0=OTG 1.3 1=OTG 2.0");
module_param(microframe_schedule, bool, 0444);
MODULE_PARM_DESC(microframe_schedule, "Enable the microframe scheduler");
+module_param(split_delay_static, int, 0644);
+MODULE_PARM_DESC(split_delay_static, "Enable static delay on split (0 - disabled, N - usec)");
+module_param(split_delay_dynamic, int, 0644);
+MODULE_PARM_DESC(split_delay_dynamic, "Enable dynamic delay on split (0 - disabled, N - usec)");
+
module_param(fiq_fix_enable, bool, 0444);
MODULE_PARM_DESC(fiq_fix_enable, "Enable the fiq fix");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment