aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm2708/patches-3.14/0029-dwc_otg-fiq_fsm-Base-commit-for-driver-rewrite.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/brcm2708/patches-3.14/0029-dwc_otg-fiq_fsm-Base-commit-for-driver-rewrite.patch')
-rw-r--r--target/linux/brcm2708/patches-3.14/0029-dwc_otg-fiq_fsm-Base-commit-for-driver-rewrite.patch218
1 files changed, 90 insertions, 128 deletions
diff --git a/target/linux/brcm2708/patches-3.14/0029-dwc_otg-fiq_fsm-Base-commit-for-driver-rewrite.patch b/target/linux/brcm2708/patches-3.14/0029-dwc_otg-fiq_fsm-Base-commit-for-driver-rewrite.patch
index f2f12c4d34..eeed3cfc3d 100644
--- a/target/linux/brcm2708/patches-3.14/0029-dwc_otg-fiq_fsm-Base-commit-for-driver-rewrite.patch
+++ b/target/linux/brcm2708/patches-3.14/0029-dwc_otg-fiq_fsm-Base-commit-for-driver-rewrite.patch
@@ -121,11 +121,9 @@ fiq_fsm: Enable by default
delete mode 100755 drivers/usb/host/dwc_otg/dwc_otg_mphi_fix.c
delete mode 100755 drivers/usb/host/dwc_otg/dwc_otg_mphi_fix.h
-diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c
-index 47a66f8..89d0824 100644
--- a/arch/arm/mach-bcm2708/bcm2708.c
+++ b/arch/arm/mach-bcm2708/bcm2708.c
-@@ -330,22 +330,13 @@ static struct resource bcm2708_usb_resources[] = {
+@@ -330,22 +330,13 @@ static struct resource bcm2708_usb_resou
.end = IRQ_HOSTPORT,
.flags = IORESOURCE_IRQ,
},
@@ -165,11 +163,9 @@ index 47a66f8..89d0824 100644
bcm_register_device(&bcm2708_usb_device);
bcm_register_device(&bcm2708_uart1_device);
bcm_register_device(&bcm2708_powerman_device);
-diff --git a/drivers/usb/host/dwc_otg/Makefile b/drivers/usb/host/dwc_otg/Makefile
-index a56f193..e7bdd12 100644
--- a/drivers/usb/host/dwc_otg/Makefile
+++ b/drivers/usb/host/dwc_otg/Makefile
-@@ -36,7 +36,8 @@ dwc_otg-objs += dwc_otg_cil.o dwc_otg_cil_intr.o
+@@ -36,7 +36,8 @@ dwc_otg-objs += dwc_otg_cil.o dwc_otg_ci
dwc_otg-objs += dwc_otg_pcd_linux.o dwc_otg_pcd.o dwc_otg_pcd_intr.o
dwc_otg-objs += dwc_otg_hcd.o dwc_otg_hcd_linux.o dwc_otg_hcd_intr.o dwc_otg_hcd_queue.o dwc_otg_hcd_ddma.o
dwc_otg-objs += dwc_otg_adp.o
@@ -179,8 +175,6 @@ index a56f193..e7bdd12 100644
ifneq ($(CFI),)
dwc_otg-objs += dwc_otg_cfi.o
endif
-diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c
-index 2f8b3bd..065807f 100644
--- a/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c
+++ b/drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c
@@ -45,7 +45,6 @@
@@ -191,7 +185,7 @@ index 2f8b3bd..065807f 100644
#ifdef DEBUG
inline const char *op_state_str(dwc_otg_core_if_t * core_if)
-@@ -1319,7 +1318,7 @@ static int32_t dwc_otg_handle_lpm_intr(dwc_otg_core_if_t * core_if)
+@@ -1319,7 +1318,7 @@ static int32_t dwc_otg_handle_lpm_intr(d
/**
* This function returns the Core Interrupt register.
*/
@@ -200,7 +194,7 @@ index 2f8b3bd..065807f 100644
{
gahbcfg_data_t gahbcfg = {.d32 = 0 };
gintsts_data_t gintsts;
-@@ -1345,16 +1344,15 @@ static inline uint32_t dwc_otg_read_common_intr(dwc_otg_core_if_t * core_if, gin
+@@ -1345,16 +1344,15 @@ static inline uint32_t dwc_otg_read_comm
}
gintsts.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintsts);
gintmsk.d32 = DWC_READ_REG32(&core_if->core_global_regs->gintmsk);
@@ -225,7 +219,7 @@ index 2f8b3bd..065807f 100644
}
gahbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gahbcfg);
-@@ -1366,13 +1364,15 @@ static inline uint32_t dwc_otg_read_common_intr(dwc_otg_core_if_t * core_if, gin
+@@ -1366,13 +1364,15 @@ static inline uint32_t dwc_otg_read_comm
gintsts.d32, gintmsk.d32);
}
#endif
@@ -244,7 +238,7 @@ index 2f8b3bd..065807f 100644
return ((gintsts.d32 & gintmsk.d32) & gintmsk_common.d32);
}
-@@ -1406,7 +1406,7 @@ int32_t dwc_otg_handle_common_intr(void *dev)
+@@ -1406,7 +1406,7 @@ int32_t dwc_otg_handle_common_intr(void
{
int retval = 0;
gintsts_data_t gintsts;
@@ -253,7 +247,7 @@ index 2f8b3bd..065807f 100644
gpwrdn_data_t gpwrdn = {.d32 = 0 };
dwc_otg_device_t *otg_dev = dev;
dwc_otg_core_if_t *core_if = otg_dev->core_if;
-@@ -1428,7 +1428,10 @@ int32_t dwc_otg_handle_common_intr(void *dev)
+@@ -1428,7 +1428,10 @@ int32_t dwc_otg_handle_common_intr(void
}
if (core_if->hibernation_suspend <= 0) {
@@ -265,7 +259,7 @@ index 2f8b3bd..065807f 100644
if (gintsts.b.modemismatch) {
retval |= dwc_otg_handle_mode_mismatch_intr(core_if);
-@@ -1525,11 +1528,16 @@ int32_t dwc_otg_handle_common_intr(void *dev)
+@@ -1525,11 +1528,16 @@ int32_t dwc_otg_handle_common_intr(void
gintsts.b.portintr = 1;
DWC_WRITE_REG32(&core_if->core_global_regs->gintsts,gintsts.d32);
retval |= 1;
@@ -285,15 +279,13 @@ index 2f8b3bd..065807f 100644
} else {
DWC_DEBUGPL(DBG_ANY, "gpwrdn=%08x\n", gpwrdn.d32);
-@@ -1583,6 +1591,5 @@ int32_t dwc_otg_handle_common_intr(void *dev)
+@@ -1583,6 +1591,5 @@ int32_t dwc_otg_handle_common_intr(void
}
if (core_if->lock)
DWC_SPINUNLOCK(core_if->lock);
-
return retval;
}
-diff --git a/drivers/usb/host/dwc_otg/dwc_otg_driver.c b/drivers/usb/host/dwc_otg/dwc_otg_driver.c
-index f06c3d22..dc7cd32 100644
--- a/drivers/usb/host/dwc_otg/dwc_otg_driver.c
+++ b/drivers/usb/host/dwc_otg/dwc_otg_driver.c
@@ -56,6 +56,7 @@
@@ -312,7 +304,7 @@ index f06c3d22..dc7cd32 100644
extern int pcd_init(
#ifdef LM_INTERFACE
-@@ -240,13 +240,14 @@ static struct dwc_otg_driver_module_params dwc_otg_module_params = {
+@@ -240,13 +240,14 @@ static struct dwc_otg_driver_module_para
.adp_enable = -1,
};
@@ -361,7 +353,7 @@ index f06c3d22..dc7cd32 100644
#endif
DWC_DEBUGPL(DBG_CIL, "registering (common) handler for irq%d\n",
devirq);
-@@ -1071,9 +1071,9 @@ static int __init dwc_otg_driver_init(void)
+@@ -1071,9 +1071,9 @@ static int __init dwc_otg_driver_init(vo
int error;
struct device_driver *drv;
@@ -374,7 +366,7 @@ index f06c3d22..dc7cd32 100644
}
printk(KERN_INFO "%s: version %s (%s bus)\n", dwc_driver_name,
-@@ -1095,9 +1095,9 @@ static int __init dwc_otg_driver_init(void)
+@@ -1095,9 +1095,9 @@ static int __init dwc_otg_driver_init(vo
printk(KERN_ERR "%s retval=%d\n", __func__, retval);
return retval;
}
@@ -387,7 +379,7 @@ index f06c3d22..dc7cd32 100644
error = driver_create_file(drv, &driver_attr_version);
#ifdef DEBUG
-@@ -1378,12 +1378,19 @@ MODULE_PARM_DESC(otg_ver, "OTG revision supported 0=OTG 1.3 1=OTG 2.0");
+@@ -1378,12 +1378,19 @@ MODULE_PARM_DESC(otg_ver, "OTG revision
module_param(microframe_schedule, bool, 0444);
MODULE_PARM_DESC(microframe_schedule, "Enable the microframe scheduler");
@@ -413,9 +405,6 @@ index f06c3d22..dc7cd32 100644
/** @page "Module Parameters"
*
-diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c
-new file mode 100644
-index 0000000..7aad7f7
--- /dev/null
+++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c
@@ -0,0 +1,1290 @@
@@ -1709,9 +1698,6 @@ index 0000000..7aad7f7
+ state->fiq_done++;
+ mb();
+}
-diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h
-new file mode 100644
-index 0000000..7572958
--- /dev/null
+++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h
@@ -0,0 +1,353 @@
@@ -2068,9 +2054,6 @@ index 0000000..7572958
+extern void dwc_otg_fiq_nop(struct fiq_state *state);
+
+#endif /* DWC_OTG_FIQ_FSM_H_ */
-diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S b/drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S
-new file mode 100644
-index 0000000..8cfe364
--- /dev/null
+++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S
@@ -0,0 +1,81 @@
@@ -2155,8 +2138,6 @@ index 0000000..8cfe364
+_dwc_otg_fiq_stub_end:
+END(_dwc_otg_fiq_stub)
+
-diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c
-index 22300f0..daea770 100644
--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c
+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c
@@ -45,9 +45,10 @@
@@ -2172,7 +2153,7 @@ index 22300f0..daea770 100644
//#define DEBUG_HOST_CHANNELS
#ifdef DEBUG_HOST_CHANNELS
-@@ -57,12 +58,6 @@ static int last_sel_trans_num_avail_hc_at_start = 0;
+@@ -57,12 +58,6 @@ static int last_sel_trans_num_avail_hc_a
static int last_sel_trans_num_avail_hc_at_end = 0;
#endif /* DEBUG_HOST_CHANNELS */
@@ -2185,7 +2166,7 @@ index 22300f0..daea770 100644
dwc_otg_hcd_t *dwc_otg_hcd_alloc_hcd(void)
{
-@@ -295,7 +290,7 @@ static int32_t dwc_otg_hcd_disconnect_cb(void *p)
+@@ -295,7 +290,7 @@ static int32_t dwc_otg_hcd_disconnect_cb
*/
dwc_otg_hcd->flags.b.port_connect_status_change = 1;
dwc_otg_hcd->flags.b.port_connect_status = 0;
@@ -2194,7 +2175,7 @@ index 22300f0..daea770 100644
local_fiq_disable();
/*
* Shutdown any transfers in process by clearing the Tx FIFO Empty
-@@ -392,20 +387,15 @@ static int32_t dwc_otg_hcd_disconnect_cb(void *p)
+@@ -392,20 +387,15 @@ static int32_t dwc_otg_hcd_disconnect_cb
channel->qh = NULL;
}
}
@@ -2217,7 +2198,7 @@ index 22300f0..daea770 100644
local_fiq_enable();
if (dwc_otg_hcd->fops->disconnect) {
-@@ -542,7 +532,7 @@ int dwc_otg_hcd_urb_enqueue(dwc_otg_hcd_t * hcd,
+@@ -542,7 +532,7 @@ int dwc_otg_hcd_urb_enqueue(dwc_otg_hcd_
}
#endif
intr_mask.d32 = DWC_READ_REG32(&hcd->core_if->core_global_regs->gintmsk);
@@ -2226,7 +2207,7 @@ index 22300f0..daea770 100644
if((((dwc_otg_qh_t *)ep_handle)->ep_type == UE_BULK) && !(qtd->urb->flags & URB_GIVEBACK_ASAP))
/* Do not schedule SG transactions until qtd has URB_GIVEBACK_ASAP set */
needs_scheduling = 0;
-@@ -613,6 +603,7 @@ int dwc_otg_hcd_urb_dequeue(dwc_otg_hcd_t * hcd,
+@@ -613,6 +603,7 @@ int dwc_otg_hcd_urb_dequeue(dwc_otg_hcd_
if (urb_qtd->in_process && qh->channel) {
/* The QTD is in process (it has been assigned to a channel). */
if (hcd->flags.b.port_connect_status) {
@@ -2234,7 +2215,7 @@ index 22300f0..daea770 100644
/*
* If still connected (i.e. in host mode), halt the
* channel so it can be used for other transfers. If
-@@ -620,10 +611,16 @@ int dwc_otg_hcd_urb_dequeue(dwc_otg_hcd_t * hcd,
+@@ -620,10 +611,16 @@ int dwc_otg_hcd_urb_dequeue(dwc_otg_hcd_
* written to halt the channel since the core is in
* device mode.
*/
@@ -2255,7 +2236,7 @@ index 22300f0..daea770 100644
}
}
-@@ -759,7 +756,6 @@ static void completion_tasklet_func(void *ptr)
+@@ -759,7 +756,6 @@ static void completion_tasklet_func(void
usb_hcd_giveback_urb(hcd->priv, urb, urb->status);
@@ -2298,7 +2279,7 @@ index 22300f0..daea770 100644
/**
* Frees secondary storage associated with the dwc_otg_hcd structure contained
* in the struct usb_hcd field.
-@@ -907,6 +931,7 @@ static void dwc_otg_hcd_free(dwc_otg_hcd_t * dwc_otg_hcd)
+@@ -907,6 +931,7 @@ static void dwc_otg_hcd_free(dwc_otg_hcd
DWC_TIMER_FREE(dwc_otg_hcd->conn_timer);
DWC_TASK_FREE(dwc_otg_hcd->reset_tasklet);
DWC_TASK_FREE(dwc_otg_hcd->completion_tasklet);
@@ -2306,7 +2287,7 @@ index 22300f0..daea770 100644
#ifdef DWC_DEV_SRPCAP
if (dwc_otg_hcd->core_if->power_down == 2 &&
-@@ -979,6 +1004,59 @@ int dwc_otg_hcd_init(dwc_otg_hcd_t * hcd, dwc_otg_core_if_t * core_if)
+@@ -979,6 +1004,59 @@ int dwc_otg_hcd_init(dwc_otg_hcd_t * hcd
channel);
}
@@ -2366,7 +2347,7 @@ index 22300f0..daea770 100644
/* Initialize the Connection timeout timer. */
hcd->conn_timer = DWC_TIMER_ALLOC("Connection timer",
dwc_otg_hcd_connect_timeout, 0);
-@@ -1176,7 +1254,8 @@ static void assign_and_init_hc(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh)
+@@ -1176,7 +1254,8 @@ static void assign_and_init_hc(dwc_otg_h
hc->do_split = 1;
hc->xact_pos = qtd->isoc_split_pos;
/* We don't need to do complete splits anymore */
@@ -2376,7 +2357,7 @@ index 22300f0..daea770 100644
hc->complete_split = qtd->complete_split = 0;
else
hc->complete_split = qtd->complete_split;
-@@ -1327,62 +1406,487 @@ static void assign_and_init_hc(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh)
+@@ -1327,62 +1406,487 @@ static void assign_and_init_hc(dwc_otg_h
hc->qh = qh;
}
@@ -2430,7 +2411,9 @@ index 22300f0..daea770 100644
+ int nr_iso_frames = urb->packet_count;
+ int i;
+ uint32_t ptr;
-+
+
+- if(!fiq_split_enable)
+- return 0;
+ if (nr_iso_frames < 2)
+ return 0;
+ for (i = 0; i < nr_iso_frames; i++) {
@@ -2448,8 +2431,7 @@ index 22300f0..daea770 100644
+ return 0;
+}
-- if(!fiq_split_enable)
-- return 0;
+- hcd->fops->hub_info(hcd, DWC_CIRCLEQ_FIRST(&qh->qtd_list)->urb->priv, &hub_addr, &port_addr);
+/**
+ * fiq_fsm_setup_periodic_dma() - Set up DMA bounce buffers
+ * @hcd: Pointer to the dwc_otg_hcd struct
@@ -2495,24 +2477,23 @@ index 22300f0..daea770 100644
+ } else {
+ if (qh->ep_type == UE_ISOCHRONOUS) {
-- hcd->fops->hub_info(hcd, DWC_CIRCLEQ_FIRST(&qh->qtd_list)->urb->priv, &hub_addr, &port_addr);
-+ dwc_otg_qtd_t *qtd = DWC_CIRCLEQ_FIRST(&qh->qtd_list);
-
- if(hcd->hub_port[hub_addr] & (1 << port_addr))
- {
- fiq_print(FIQDBG_PORTHUB, "H%dP%d:S%02d", hub_addr, port_addr, qh->skip_count);
-+ frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index];
-+ frame_length = frame_desc->length;
++ dwc_otg_qtd_t *qtd = DWC_CIRCLEQ_FIRST(&qh->qtd_list);
- qh->skip_count++;
-+ /* Virtual address for bounce buffers */
-+ blob = hcd->fiq_dmab;
++ frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index];
++ frame_length = frame_desc->length;
- if(qh->skip_count > 40000)
- {
- printk_once(KERN_ERR "Error: Having to skip port allocation");
- local_fiq_disable();
- BUG();
++ /* Virtual address for bounce buffers */
++ blob = hcd->fiq_dmab;
++
+ ptr = qtd->urb->buf + frame_desc->offset;
+ if (frame_length == 0) {
+ /*
@@ -2707,7 +2688,8 @@ index 22300f0..daea770 100644
+ if (st->fsm != FIQ_PASSTHROUGH)
+ return 0;
+ st->nr_errors = 0;
-+
+
+- hcd->fops->hub_info(hcd, DWC_CIRCLEQ_FIRST(&qh->qtd_list)->urb->priv, &hub_addr, &port_addr);
+ st->hcchar_copy.d32 = 0;
+ st->hcchar_copy.b.mps = hc->max_packet;
+ st->hcchar_copy.b.epdir = hc->ep_is_in;
@@ -2726,7 +2708,12 @@ index 22300f0..daea770 100644
+ }
+ st->hcchar_copy.b.lspddev = (hc->speed == DWC_OTG_EP_SPEED_LOW) ? 1 : 0;
+ /* Enable the channel later as a final register write. */
-+
+
+- hcd->hub_port[hub_addr] &= ~(1 << port_addr);
+-#ifdef FIQ_DEBUG
+- hcd->hub_port_alloc[hub_addr * 16 + port_addr] = -1;
+-#endif
+- fiq_print(FIQDBG_PORTHUB, "H%dP%d:RO%d", hub_addr, port_addr, DWC_CIRCLEQ_FIRST(&qh->qtd_list)->urb->pipe_info.ep_num);
+ st->hcsplt_copy.d32 = 0;
+ if(qh->do_split) {
+ hcd->fops->hub_info(hcd, DWC_CIRCLEQ_FIRST(&qh->qtd_list)->urb->priv, &hub_addr, &port_addr);
@@ -2748,26 +2735,20 @@ index 22300f0..daea770 100644
+ st->hub_addr = hub_addr;
+ st->port_addr = port_addr;
+ }
-
-- hcd->fops->hub_info(hcd, DWC_CIRCLEQ_FIRST(&qh->qtd_list)->urb->priv, &hub_addr, &port_addr);
++
+ st->hctsiz_copy.d32 = 0;
+ st->hctsiz_copy.b.dopng = 0;
+ st->hctsiz_copy.b.pid = hc->data_pid_start;
-
-- hcd->hub_port[hub_addr] &= ~(1 << port_addr);
--#ifdef FIQ_DEBUG
-- hcd->hub_port_alloc[hub_addr * 16 + port_addr] = -1;
--#endif
-- fiq_print(FIQDBG_PORTHUB, "H%dP%d:RO%d", hub_addr, port_addr, DWC_CIRCLEQ_FIRST(&qh->qtd_list)->urb->pipe_info.ep_num);
++
+ if (hc->ep_is_in || (hc->xfer_len > hc->max_packet)) {
+ hc->xfer_len = hc->max_packet;
+ } else if (!hc->ep_is_in && (hc->xfer_len > 188)) {
+ hc->xfer_len = 188;
+ }
+ st->hctsiz_copy.b.xfersize = hc->xfer_len;
-+
-+ st->hctsiz_copy.b.pktcnt = 1;
++ st->hctsiz_copy.b.pktcnt = 1;
++
+ if (hc->ep_type & 0x1) {
+ /*
+ * For potentially multi-packet transfers, must use the DMA bounce buffers. For IN transfers,
@@ -2903,7 +2884,7 @@ index 22300f0..daea770 100644
}
-@@ -1399,16 +1903,11 @@ dwc_otg_transaction_type_e dwc_otg_hcd_select_transactions(dwc_otg_hcd_t * hcd)
+@@ -1399,16 +1903,11 @@ dwc_otg_transaction_type_e dwc_otg_hcd_s
{
dwc_list_link_t *qh_ptr;
dwc_otg_qh_t *qh;
@@ -2920,7 +2901,7 @@ index 22300f0..daea770 100644
#ifdef DEBUG_HOST_CHANNELS
last_sel_trans_num_per_scheduled = 0;
last_sel_trans_num_nonper_scheduled = 0;
-@@ -1423,26 +1922,11 @@ dwc_otg_transaction_type_e dwc_otg_hcd_select_transactions(dwc_otg_hcd_t * hcd)
+@@ -1423,26 +1922,11 @@ dwc_otg_transaction_type_e dwc_otg_hcd_s
qh = DWC_LIST_ENTRY(qh_ptr, dwc_otg_qh_t, qh_list_entry);
@@ -2947,7 +2928,7 @@ index 22300f0..daea770 100644
break;
}
hcd->available_host_channels--;
-@@ -1478,27 +1962,24 @@ dwc_otg_transaction_type_e dwc_otg_hcd_select_transactions(dwc_otg_hcd_t * hcd)
+@@ -1478,27 +1962,24 @@ dwc_otg_transaction_type_e dwc_otg_hcd_s
!DWC_CIRCLEQ_EMPTY(&hcd->free_hc_list)) {
qh = DWC_LIST_ENTRY(qh_ptr, dwc_otg_qh_t, qh_list_entry);
@@ -2988,7 +2969,7 @@ index 22300f0..daea770 100644
}
}
-@@ -1527,12 +2008,31 @@ dwc_otg_transaction_type_e dwc_otg_hcd_select_transactions(dwc_otg_hcd_t * hcd)
+@@ -1527,12 +2008,31 @@ dwc_otg_transaction_type_e dwc_otg_hcd_s
&qh->qh_list_entry);
DWC_SPINUNLOCK_IRQRESTORE(channel_lock, flags);
@@ -3022,7 +3003,7 @@ index 22300f0..daea770 100644
if(!DWC_LIST_EMPTY(&hcd->periodic_sched_assigned))
ret_val |= DWC_OTG_TRANSACTION_PERIODIC;
-@@ -1577,6 +2077,12 @@ static int queue_transaction(dwc_otg_hcd_t * hcd,
+@@ -1577,6 +2077,12 @@ static int queue_transaction(dwc_otg_hcd
hc->qh->ping_state = 0;
}
} else if (!hc->xfer_started) {
@@ -3035,7 +3016,7 @@ index 22300f0..daea770 100644
dwc_otg_hc_start_transfer(hcd->core_if, hc);
hc->qh->ping_state = 0;
}
-@@ -1629,7 +2135,7 @@ static void process_periodic_channels(dwc_otg_hcd_t * hcd)
+@@ -1629,7 +2135,7 @@ static void process_periodic_channels(dw
hptxsts_data_t tx_status;
dwc_list_link_t *qh_ptr;
dwc_otg_qh_t *qh;
@@ -3044,7 +3025,7 @@ index 22300f0..daea770 100644
int no_queue_space = 0;
int no_fifo_space = 0;
-@@ -1658,27 +2164,34 @@ static void process_periodic_channels(dwc_otg_hcd_t * hcd)
+@@ -1658,27 +2164,34 @@ static void process_periodic_channels(dw
// Do not send a split start transaction any later than frame .6
// Note, we have to schedule a periodic in .5 to make it go in .6
@@ -3095,7 +3076,7 @@ index 22300f0..daea770 100644
}
/*
-@@ -1795,25 +2308,19 @@ static void process_non_periodic_channels(dwc_otg_hcd_t * hcd)
+@@ -1795,25 +2308,19 @@ static void process_non_periodic_channel
qh = DWC_LIST_ENTRY(hcd->non_periodic_qh_ptr, dwc_otg_qh_t,
qh_list_entry);
@@ -3132,8 +3113,6 @@ index 22300f0..daea770 100644
/* Advance to next QH, skipping start-of-list entry. */
hcd->non_periodic_qh_ptr = hcd->non_periodic_qh_ptr->next;
if (hcd->non_periodic_qh_ptr == &hcd->non_periodic_sched_active) {
-diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd.h b/drivers/usb/host/dwc_otg/dwc_otg_hcd.h
-index 0007fa1..da2986244 100644
--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd.h
+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.h
@@ -40,6 +40,8 @@
@@ -3158,7 +3137,7 @@ index 0007fa1..da2986244 100644
#ifdef DEBUG
uint32_t frrem_samples;
uint64_t frrem_accum;
-@@ -615,6 +623,9 @@ extern void dwc_otg_hcd_queue_transactions(dwc_otg_hcd_t * hcd,
+@@ -615,6 +623,9 @@ extern void dwc_otg_hcd_queue_transactio
int dwc_otg_hcd_allocate_port(dwc_otg_hcd_t * hcd, dwc_otg_qh_t *qh);
void dwc_otg_hcd_release_port(dwc_otg_hcd_t * dwc_otg_hcd, dwc_otg_qh_t *qh);
@@ -3168,8 +3147,6 @@ index 0007fa1..da2986244 100644
/** @} */
-diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c
-index 64d33a5..d3e2035 100644
--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c
+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c
@@ -34,7 +34,6 @@
@@ -3214,7 +3191,7 @@ index 64d33a5..d3e2035 100644
#ifdef FIQ_DEBUG
char buffer[1000*16];
int wptr;
-@@ -83,12 +57,10 @@ void notrace _fiq_print(FIQDBG_T dbg_lvl, char *fmt, ...)
+@@ -83,12 +57,10 @@ void notrace _fiq_print(FIQDBG_T dbg_lvl
va_list args;
char text[17];
hfnum_data_t hfnum = { .d32 = FIQ_READ(dwc_regs_base + 0x408) };
@@ -3228,7 +3205,7 @@ index 64d33a5..d3e2035 100644
snprintf(text, 9, "%4d%d:%d ", hfnum.b.frnum/8, hfnum.b.frnum%8, 8 - hfnum.b.frrem/937);
va_start(args, fmt);
vsnprintf(text+8, 9, fmt, args);
-@@ -96,410 +68,21 @@ void notrace _fiq_print(FIQDBG_T dbg_lvl, char *fmt, ...)
+@@ -96,410 +68,21 @@ void notrace _fiq_print(FIQDBG_T dbg_lvl
memcpy(buffer + wptr, text, 16);
wptr = (wptr + 16) % sizeof(buffer);
@@ -3641,7 +3618,7 @@ index 64d33a5..d3e2035 100644
#ifdef DEBUG
dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs;
-@@ -516,15 +99,29 @@ int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd)
+@@ -516,15 +99,29 @@ int32_t dwc_otg_hcd_handle_intr(dwc_otg_
DWC_SPINLOCK(dwc_otg_hcd->lock);
/* Check if HOST Mode */
if (dwc_otg_is_host_mode(core_if)) {
@@ -3677,7 +3654,7 @@ index 64d33a5..d3e2035 100644
#ifdef DEBUG
// We should be OK doing this because the common interrupts should already have been serviced
-@@ -544,12 +141,7 @@ int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd)
+@@ -544,12 +141,7 @@ int32_t dwc_otg_hcd_handle_intr(dwc_otg_
gintsts.d32, core_if);
#endif
hfnum.d32 = DWC_READ_REG32(&dwc_otg_hcd->core_if->host_if->host_global_regs->hfnum);
@@ -3691,7 +3668,7 @@ index 64d33a5..d3e2035 100644
retval |= dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd);
}
-@@ -604,37 +196,43 @@ int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd)
+@@ -604,37 +196,43 @@ int32_t dwc_otg_hcd_handle_intr(dwc_otg_
}
exit_handler_routine:
@@ -3716,12 +3693,17 @@ index 64d33a5..d3e2035 100644
- mphi_int_count = 0;
- }
- int_done++;
+- }
+-
+- // Unmask handled interrupts
+- FIQ_WRITE(dwc_regs_base + 0x18, gintmsk.d32);
+- //DWC_MODIFY_REG32((uint32_t *)IO_ADDRESS(USB_BASE + 0x8), 0 , 1);
+ gintmsk_new.d32 = *(volatile uint32_t *)&dwc_otg_hcd->fiq_state->gintmsk_saved.d32;
+ if(fiq_fsm_enable)
+ haintmsk_new.d32 = *(volatile uint32_t *)&dwc_otg_hcd->fiq_state->haintmsk_saved.d32;
+ else
+ haintmsk_new.d32 = 0x0000FFFF;
-+
+
+ /* The FIQ could have sneaked another interrupt in. If so, don't clear MPHI */
+ if ((gintmsk_new.d32 == ~0) && (haintmsk_new.d32 == 0x0000FFFF)) {
+ DWC_WRITE_REG32(dwc_otg_hcd->fiq_state->mphi_regs.intstat, (1<<16));
@@ -3734,12 +3716,7 @@ index 64d33a5..d3e2035 100644
+ dwc_otg_hcd->fiq_state->mphi_int_count = 0;
+ }
+ int_done++;
- }
--
-- // Unmask handled interrupts
-- FIQ_WRITE(dwc_regs_base + 0x18, gintmsk.d32);
-- //DWC_MODIFY_REG32((uint32_t *)IO_ADDRESS(USB_BASE + 0x8), 0 , 1);
--
++ }
+ haintmsk.d32 = DWC_READ_REG32(&core_if->host_if->host_global_regs->haintmsk);
+ /* Re-enable interrupts that the FIQ masked (first time round) */
+ FIQ_WRITE(dwc_otg_hcd->fiq_state->dwc_regs_base + GINTMSK, gintmsk.d32);
@@ -3760,7 +3737,7 @@ index 64d33a5..d3e2035 100644
}
}
-@@ -686,6 +284,7 @@ static inline void track_missed_sofs(uint16_t curr_frame_number)
+@@ -686,6 +284,7 @@ static inline void track_missed_sofs(uin
int32_t dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd_t * hcd)
{
hfnum_data_t hfnum;
@@ -3768,7 +3745,7 @@ index 64d33a5..d3e2035 100644
dwc_list_link_t *qh_entry;
dwc_otg_qh_t *qh;
dwc_otg_transaction_type_e tr_type;
-@@ -732,8 +331,8 @@ int32_t dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd_t * hcd)
+@@ -732,8 +331,8 @@ int32_t dwc_otg_hcd_handle_sof_intr(dwc_
}
}
}
@@ -3779,7 +3756,7 @@ index 64d33a5..d3e2035 100644
tr_type = dwc_otg_hcd_select_transactions(hcd);
if (tr_type != DWC_OTG_TRANSACTION_NONE) {
-@@ -741,10 +340,11 @@ int32_t dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd_t * hcd)
+@@ -741,10 +340,11 @@ int32_t dwc_otg_hcd_handle_sof_intr(dwc_
did_something = 1;
}
@@ -3795,7 +3772,7 @@ index 64d33a5..d3e2035 100644
return 1;
}
-@@ -1020,19 +620,21 @@ int32_t dwc_otg_hcd_handle_hc_intr(dwc_otg_hcd_t * dwc_otg_hcd)
+@@ -1020,19 +620,21 @@ int32_t dwc_otg_hcd_handle_hc_intr(dwc_o
{
int i;
int retval = 0;
@@ -3822,7 +3799,7 @@ index 64d33a5..d3e2035 100644
local_fiq_enable();
}
-@@ -1076,9 +678,7 @@ static uint32_t get_actual_xfer_length(dwc_hc_t * hc,
+@@ -1076,9 +678,7 @@ static uint32_t get_actual_xfer_length(d
*short_read = (hctsiz.b.xfersize != 0);
}
} else if (hc->qh->do_split) {
@@ -3833,7 +3810,7 @@ index 64d33a5..d3e2035 100644
length = qtd->ssplit_out_xfer_count;
} else {
length = hc->xfer_len;
-@@ -1325,19 +925,17 @@ static void release_channel(dwc_otg_hcd_t * hcd,
+@@ -1325,19 +925,17 @@ static void release_channel(dwc_otg_hcd_
int free_qtd;
dwc_irqflags_t flags;
dwc_spinlock_t *channel_lock = hcd->channel_lock;
@@ -3894,7 +3871,7 @@ index 64d33a5..d3e2035 100644
/* Try to queue more transfers now that there's a free channel. */
tr_type = dwc_otg_hcd_select_transactions(hcd);
if (tr_type != DWC_OTG_TRANSACTION_NONE) {
-@@ -1858,7 +1441,7 @@ static int32_t handle_hc_nak_intr(dwc_otg_hcd_t * hcd,
+@@ -1858,7 +1441,7 @@ static int32_t handle_hc_nak_intr(dwc_ot
switch(dwc_otg_hcd_get_pipe_type(&qtd->urb->pipe_info)) {
case UE_BULK:
case UE_CONTROL:
@@ -3903,7 +3880,7 @@ index 64d33a5..d3e2035 100644
hc->qh->nak_frame = dwc_otg_hcd_get_frame_number(hcd);
}
-@@ -2074,7 +1657,7 @@ static int32_t handle_hc_nyet_intr(dwc_otg_hcd_t * hcd,
+@@ -2074,7 +1657,7 @@ static int32_t handle_hc_nyet_intr(dwc_o
// With the FIQ running we only ever see the failed NYET
if (dwc_full_frame_num(frnum) !=
dwc_full_frame_num(hc->qh->sched_frame) ||
@@ -3912,7 +3889,7 @@ index 64d33a5..d3e2035 100644
/*
* No longer in the same full speed frame.
* Treat this as a transaction error.
-@@ -2460,12 +2043,11 @@ static inline int halt_status_ok(dwc_otg_hcd_t * hcd,
+@@ -2460,12 +2043,11 @@ static inline int halt_status_ok(dwc_otg
static void handle_hc_chhltd_intr_dma(dwc_otg_hcd_t * hcd,
dwc_hc_t * hc,
dwc_otg_hc_regs_t * hc_regs,
@@ -3928,7 +3905,7 @@ index 64d33a5..d3e2035 100644
/* For core with OUT NAK enhancement, the flow for high-
* speed CONTROL/BULK OUT is handled a little differently.
*/
-@@ -2495,11 +2077,9 @@ static void handle_hc_chhltd_intr_dma(dwc_otg_hcd_t * hcd,
+@@ -2495,11 +2077,9 @@ static void handle_hc_chhltd_intr_dma(dw
}
/* Read the HCINTn register to determine the cause for the halt. */
@@ -3943,7 +3920,7 @@ index 64d33a5..d3e2035 100644
if (hcint.b.xfercomp) {
/** @todo This is here because of a possible hardware bug. Spec
-@@ -2624,15 +2204,13 @@ static void handle_hc_chhltd_intr_dma(dwc_otg_hcd_t * hcd,
+@@ -2624,15 +2204,13 @@ static void handle_hc_chhltd_intr_dma(dw
static int32_t handle_hc_chhltd_intr(dwc_otg_hcd_t * hcd,
dwc_hc_t * hc,
dwc_otg_hc_regs_t * hc_regs,
@@ -3961,7 +3938,7 @@ index 64d33a5..d3e2035 100644
} else {
#ifdef DEBUG
if (!halt_status_ok(hcd, hc, hc_regs, qtd)) {
-@@ -2645,11 +2223,372 @@ static int32_t handle_hc_chhltd_intr(dwc_otg_hcd_t * hcd,
+@@ -2645,11 +2223,372 @@ static int32_t handle_hc_chhltd_intr(dwc
return 1;
}
@@ -4335,7 +4312,7 @@ index 64d33a5..d3e2035 100644
hcintmsk_data_t hcintmsk;
dwc_hc_t *hc;
dwc_otg_hc_regs_t *hc_regs;
-@@ -2668,24 +2607,32 @@ int32_t dwc_otg_hcd_handle_hc_n_intr(dwc_otg_hcd_t * dwc_otg_hcd, uint32_t num)
+@@ -2668,24 +2607,32 @@ int32_t dwc_otg_hcd_handle_hc_n_intr(dwc
}
qtd = DWC_CIRCLEQ_FIRST(&hc->qh->qtd_list);
@@ -4383,7 +4360,7 @@ index 64d33a5..d3e2035 100644
if (!dwc_otg_hcd->core_if->dma_enable) {
if (hcint.b.chhltd && hcint.d32 != 0x2) {
hcint.b.chhltd = 0;
-@@ -2703,7 +2650,7 @@ int32_t dwc_otg_hcd_handle_hc_n_intr(dwc_otg_hcd_t * dwc_otg_hcd, uint32_t num)
+@@ -2703,7 +2650,7 @@ int32_t dwc_otg_hcd_handle_hc_n_intr(dwc
hcint.b.nyet = 0;
}
if (hcint.b.chhltd) {
@@ -4392,8 +4369,6 @@ index 64d33a5..d3e2035 100644
}
if (hcint.b.ahberr) {
retval |= handle_hc_ahberr_intr(dwc_otg_hcd, hc, hc_regs, qtd);
-diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
-index ee8eec9..07b1808 100644
--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
@@ -58,6 +58,7 @@
@@ -4423,7 +4398,7 @@ index ee8eec9..07b1808 100644
/** @name Linux HC Driver API Functions */
/** @{ */
-@@ -351,7 +353,6 @@ static int _complete(dwc_otg_hcd_t * hcd, void *urb_handle,
+@@ -351,7 +353,6 @@ static int _complete(dwc_otg_hcd_t * hcd
urb);
}
}
@@ -4431,7 +4406,7 @@ index ee8eec9..07b1808 100644
DWC_FREE(dwc_otg_urb);
if (!new_entry) {
DWC_ERROR("dwc_otg_hcd: complete: cannot allocate URB TQ entry\n");
-@@ -395,13 +396,9 @@ static struct dwc_otg_hcd_function_ops hcd_fops = {
+@@ -395,13 +396,9 @@ static struct dwc_otg_hcd_function_ops h
static struct fiq_handler fh = {
.name = "usb_fiq",
};
@@ -4583,8 +4558,6 @@ index ee8eec9..07b1808 100644
}
#ifdef DEBUG
-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 db95851..8706a5c 100644
--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c
+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c
@@ -41,7 +41,6 @@
@@ -4595,7 +4568,7 @@ index db95851..8706a5c 100644
extern bool microframe_schedule;
-@@ -576,7 +575,6 @@ static int check_max_xfer_size(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh)
+@@ -576,7 +575,6 @@ static int check_max_xfer_size(dwc_otg_h
}
@@ -4603,7 +4576,7 @@ index db95851..8706a5c 100644
/**
* Schedules an interrupt or isochronous transfer in the periodic schedule.
-@@ -636,9 +634,9 @@ static int schedule_periodic(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh)
+@@ -636,9 +634,9 @@ static int schedule_periodic(dwc_otg_hcd
DWC_LIST_INSERT_TAIL(&hcd->periodic_sched_ready, &qh->qh_list_entry);
}
else {
@@ -4615,7 +4588,7 @@ index db95851..8706a5c 100644
}
/* Always start in the inactive schedule. */
-@@ -679,7 +677,7 @@ int dwc_otg_hcd_qh_add(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh)
+@@ -679,7 +677,7 @@ int dwc_otg_hcd_qh_add(dwc_otg_hcd_t * h
/* Always start in the inactive schedule. */
DWC_LIST_INSERT_TAIL(&hcd->non_periodic_sched_inactive,
&qh->qh_list_entry);
@@ -4624,7 +4597,7 @@ index db95851..8706a5c 100644
} else {
status = schedule_periodic(hcd, qh);
if ( !hcd->periodic_qh_count ) {
-@@ -739,13 +737,12 @@ void dwc_otg_hcd_qh_remove(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh)
+@@ -739,13 +737,12 @@ void dwc_otg_hcd_qh_remove(dwc_otg_hcd_t
hcd->non_periodic_qh_ptr->next;
}
DWC_LIST_REMOVE_INIT(&qh->qh_list_entry);
@@ -4641,7 +4614,7 @@ index db95851..8706a5c 100644
intr_mask.b.sofintr = 1;
DWC_MODIFY_REG32(&hcd->core_if->core_global_regs->gintmsk,
intr_mask.d32, 0);
-@@ -770,28 +767,11 @@ void dwc_otg_hcd_qh_deactivate(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh,
+@@ -770,28 +767,11 @@ void dwc_otg_hcd_qh_deactivate(dwc_otg_h
int sched_next_periodic_split)
{
if (dwc_qh_is_non_per(qh)) {
@@ -4671,7 +4644,7 @@ index db95851..8706a5c 100644
}
} else {
uint16_t frame_number = dwc_otg_hcd_get_frame_number(hcd);
-@@ -850,9 +830,9 @@ void dwc_otg_hcd_qh_deactivate(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh,
+@@ -850,9 +830,9 @@ void dwc_otg_hcd_qh_deactivate(dwc_otg_h
DWC_LIST_MOVE_HEAD(&hcd->periodic_sched_ready,
&qh->qh_list_entry);
} else {
@@ -4683,7 +4656,7 @@ index db95851..8706a5c 100644
}
DWC_LIST_MOVE_HEAD
-@@ -943,6 +923,9 @@ int dwc_otg_hcd_qtd_add(dwc_otg_qtd_t * qtd,
+@@ -943,6 +923,9 @@ int dwc_otg_hcd_qtd_add(dwc_otg_qtd_t *
if (*qh == NULL) {
retval = -DWC_E_NO_MEMORY;
goto done;
@@ -4693,9 +4666,6 @@ index db95851..8706a5c 100644
}
}
retval = dwc_otg_hcd_qh_add(hcd, *qh);
-diff --git a/drivers/usb/host/dwc_otg/dwc_otg_mphi_fix.c b/drivers/usb/host/dwc_otg/dwc_otg_mphi_fix.c
-deleted file mode 100755
-index 50b94a8..0000000
--- a/drivers/usb/host/dwc_otg/dwc_otg_mphi_fix.c
+++ /dev/null
@@ -1,113 +0,0 @@
@@ -4812,9 +4782,6 @@ index 50b94a8..0000000
-
- return;
-}
-diff --git a/drivers/usb/host/dwc_otg/dwc_otg_mphi_fix.h b/drivers/usb/host/dwc_otg/dwc_otg_mphi_fix.h
-deleted file mode 100755
-index ca17379..0000000
--- a/drivers/usb/host/dwc_otg/dwc_otg_mphi_fix.h
+++ /dev/null
@@ -1,48 +0,0 @@
@@ -4866,8 +4833,6 @@ index ca17379..0000000
-extern bool fiq_fix_enable, nak_holdoff_enable, fiq_split_enable;
-
-#endif
-diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c b/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c
-index 5d310df..4b32941 100644
--- a/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c
+++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c
@@ -59,6 +59,8 @@
@@ -4896,6 +4861,3 @@ index 5d310df..4b32941 100644
free_wrapper(gadget_wrapper);
return -EBUSY;
}
---
-1.9.1
-