Skip to content

Commit 33d28d4

Browse files
P33Mpopcornmix
P33M
authored andcommitted
dwc_otg: fix interrupt registration for fiq_enable=0
Additionally make the module parameter conditional for wherever hcd->fiq_state is touched.
1 parent 94b26e0 commit 33d28d4

File tree

7 files changed

+39
-27
lines changed

7 files changed

+39
-27
lines changed

arch/arm/mach-bcm2708/bcm2708.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,11 @@ static struct resource bcm2708_usb_resources[] = {
326326
.end = IRQ_HOSTPORT,
327327
.flags = IORESOURCE_IRQ,
328328
},
329+
[3] = {
330+
.start = IRQ_USB,
331+
.end = IRQ_USB,
332+
.flags = IORESOURCE_IRQ,
333+
},
329334
};
330335

331336

drivers/usb/host/dwc_otg/dwc_otg_driver.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -902,9 +902,9 @@ static int dwc_otg_driver_probe(
902902
*/
903903

904904
#if defined(PLATFORM_INTERFACE)
905-
devirq = platform_get_irq(_dev, 0);
905+
devirq = platform_get_irq(_dev, fiq_enable ? 0 : 1);
906906
#else
907-
devirq = _dev->irq;
907+
devirq = _dev->irq;
908908
#endif
909909
DWC_DEBUGPL(DBG_CIL, "registering (common) handler for irq%d\n",
910910
devirq);

drivers/usb/host/dwc_otg/dwc_otg_hcd.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2016,17 +2016,19 @@ dwc_otg_transaction_type_e dwc_otg_hcd_select_transactions(dwc_otg_hcd_t * hcd)
20162016
* stop the FIQ from kicking us. We could potentially still have elements here if we
20172017
* ran out of host channels.
20182018
*/
2019-
if (DWC_LIST_EMPTY(&hcd->non_periodic_sched_inactive)) {
2019+
if (fiq_enable) {
2020+
if (DWC_LIST_EMPTY(&hcd->non_periodic_sched_inactive)) {
20202021
hcd->fiq_state->kick_np_queues = 0;
2021-
} else {
2022-
/* For each entry remaining in the NP inactive queue,
2023-
* if this a NAK'd retransmit then don't set the kick flag.
2024-
*/
2025-
if(nak_holdoff) {
2026-
DWC_LIST_FOREACH(qh_ptr, &hcd->non_periodic_sched_inactive) {
2027-
qh = DWC_LIST_ENTRY(qh_ptr, dwc_otg_qh_t, qh_list_entry);
2028-
if (qh->nak_frame == 0xFFFF) {
2029-
hcd->fiq_state->kick_np_queues = 1;
2022+
} else {
2023+
/* For each entry remaining in the NP inactive queue,
2024+
* if this a NAK'd retransmit then don't set the kick flag.
2025+
*/
2026+
if(nak_holdoff) {
2027+
DWC_LIST_FOREACH(qh_ptr, &hcd->non_periodic_sched_inactive) {
2028+
qh = DWC_LIST_ENTRY(qh_ptr, dwc_otg_qh_t, qh_list_entry);
2029+
if (qh->nak_frame == 0xFFFF) {
2030+
hcd->fiq_state->kick_np_queues = 1;
2031+
}
20302032
}
20312033
}
20322034
}

drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,12 @@ int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd)
9999
DWC_SPINLOCK(dwc_otg_hcd->lock);
100100
/* Check if HOST Mode */
101101
if (dwc_otg_is_host_mode(core_if)) {
102-
local_fiq_disable();
103-
/* Pull in from the FIQ's disabled mask */
104-
gintmsk.d32 = gintmsk.d32 | ~(dwc_otg_hcd->fiq_state->gintmsk_saved.d32);
105-
dwc_otg_hcd->fiq_state->gintmsk_saved.d32 = ~0;
106-
102+
if (fiq_enable) {
103+
local_fiq_disable();
104+
/* Pull in from the FIQ's disabled mask */
105+
gintmsk.d32 = gintmsk.d32 | ~(dwc_otg_hcd->fiq_state->gintmsk_saved.d32);
106+
dwc_otg_hcd->fiq_state->gintmsk_saved.d32 = ~0;
107+
}
107108

108109
if (fiq_fsm_enable && ( 0x0000FFFF & ~(dwc_otg_hcd->fiq_state->haintmsk_saved.b2.chint))) {
109110
gintsts.b.hcintr = 1;
@@ -115,7 +116,9 @@ int32_t dwc_otg_hcd_handle_intr(dwc_otg_hcd_t * dwc_otg_hcd)
115116
}
116117
gintsts.d32 &= gintmsk.d32;
117118

118-
local_fiq_enable();
119+
if (fiq_enable)
120+
local_fiq_enable();
121+
119122
if (!gintsts.d32) {
120123
goto exit_handler_routine;
121124
}
@@ -328,8 +331,8 @@ int32_t dwc_otg_hcd_handle_sof_intr(dwc_otg_hcd_t * hcd)
328331
}
329332
}
330333
}
331-
332-
hcd->fiq_state->next_sched_frame = next_sched_frame;
334+
if (fiq_enable)
335+
hcd->fiq_state->next_sched_frame = next_sched_frame;
333336

334337
tr_type = dwc_otg_hcd_select_transactions(hcd);
335338
if (tr_type != DWC_OTG_TRANSACTION_NONE) {

drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,9 +527,9 @@ int hcd_init(dwc_bus_dev_t *_dev)
527527
* IRQ line, and calls hcd_start method.
528528
*/
529529
#ifdef PLATFORM_INTERFACE
530-
retval = usb_add_hcd(hcd, platform_get_irq(_dev, 0), IRQF_SHARED | IRQF_DISABLED);
530+
retval = usb_add_hcd(hcd, platform_get_irq(_dev, fiq_enable ? 0 : 1), IRQF_SHARED | IRQF_DISABLED);
531531
#else
532-
retval = usb_add_hcd(hcd, _dev->irq, IRQF_SHARED | IRQF_DISABLED);
532+
retval = usb_add_hcd(hcd, _dev->irq, IRQF_SHARED | IRQF_DISABLED);
533533
#endif
534534
if (retval < 0) {
535535
goto error2;

drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ static int schedule_periodic(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh)
634634
DWC_LIST_INSERT_TAIL(&hcd->periodic_sched_ready, &qh->qh_list_entry);
635635
}
636636
else {
637-
if(DWC_LIST_EMPTY(&hcd->periodic_sched_inactive) || dwc_frame_num_le(qh->sched_frame, hcd->fiq_state->next_sched_frame))
637+
if(fiq_enable && (DWC_LIST_EMPTY(&hcd->periodic_sched_inactive) || dwc_frame_num_le(qh->sched_frame, hcd->fiq_state->next_sched_frame)))
638638
{
639639
hcd->fiq_state->next_sched_frame = qh->sched_frame;
640640

@@ -830,7 +830,7 @@ void dwc_otg_hcd_qh_deactivate(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh,
830830
DWC_LIST_MOVE_HEAD(&hcd->periodic_sched_ready,
831831
&qh->qh_list_entry);
832832
} else {
833-
if(!dwc_frame_num_le(hcd->fiq_state->next_sched_frame, qh->sched_frame))
833+
if(fiq_enable && !dwc_frame_num_le(hcd->fiq_state->next_sched_frame, qh->sched_frame))
834834
{
835835
hcd->fiq_state->next_sched_frame = qh->sched_frame;
836836
}

drivers/usb/host/dwc_otg/dwc_otg_pcd_linux.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@
5959
#include "dwc_otg_driver.h"
6060
#include "dwc_otg_dbg.h"
6161

62+
extern bool fiq_enable;
63+
6264
static struct gadget_wrapper {
6365
dwc_otg_pcd_t *pcd;
6466

@@ -1222,13 +1224,13 @@ int pcd_init(dwc_bus_dev_t *_dev)
12221224
*/
12231225
#ifdef PLATFORM_INTERFACE
12241226
DWC_DEBUGPL(DBG_ANY, "registering handler for irq%d\n",
1225-
platform_get_irq(_dev, 0));
1226-
retval = request_irq(platform_get_irq(_dev, 0), dwc_otg_pcd_irq,
1227+
platform_get_irq(_dev, fiq_enable ? 0 : 1));
1228+
retval = request_irq(platform_get_irq(_dev, fiq_enable ? 0 : 1), dwc_otg_pcd_irq,
12271229
IRQF_SHARED, gadget_wrapper->gadget.name,
12281230
otg_dev->pcd);
12291231
if (retval != 0) {
12301232
DWC_ERROR("request of irq%d failed\n",
1231-
platform_get_irq(_dev, 0));
1233+
platform_get_irq(_dev, fiq_enable ? 0 : 1));
12321234
free_wrapper(gadget_wrapper);
12331235
return -EBUSY;
12341236
}

0 commit comments

Comments
 (0)