Skip to content

Commit 4556ecd

Browse files
P33Mpopcornmix
P33M
authored andcommitted
dwc_otg: don't unconditionally force host mode in dwc_otg_cil_init()
Add the ability to disable force_host_mode for those that want to use dwc_otg in both device and host modes.
1 parent 4c5865d commit 4556ecd

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

drivers/usb/host/dwc_otg/dwc_otg_cil.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@
6161
#include "dwc_otg_regs.h"
6262
#include "dwc_otg_cil.h"
6363

64+
extern bool cil_force_host;
65+
6466
static int dwc_otg_setup_params(dwc_otg_core_if_t * core_if);
6567

6668
/**
@@ -192,7 +194,10 @@ dwc_otg_core_if_t *dwc_otg_cil_init(const uint32_t * reg_base_addr)
192194
core_if->hptxfsiz.d32 =
193195
DWC_READ_REG32(&core_if->core_global_regs->hptxfsiz);
194196
gusbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg);
195-
gusbcfg.b.force_host_mode = 1;
197+
if (cil_force_host)
198+
gusbcfg.b.force_host_mode = 1;
199+
else
200+
gusbcfg.b.force_host_mode = 0;
196201
DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, gusbcfg.d32);
197202
dwc_mdelay(100);
198203
}

drivers/usb/host/dwc_otg/dwc_otg_driver.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,9 @@ bool fiq_fsm_enable = true;
247247
//Bulk split-transaction NAK holdoff in microframes
248248
uint16_t nak_holdoff = 8;
249249

250+
//Force host mode during CIL re-init
251+
bool cil_force_host = true;
252+
250253
unsigned short fiq_fsm_mask = 0x0F;
251254

252255
unsigned short int_ep_interval_min = 0;
@@ -1403,6 +1406,10 @@ MODULE_PARM_DESC(int_ep_interval_min, "Clamp high-speed Interrupt endpoints to a
14031406
"0..1 = Use endpoint default\n"
14041407
"2..n = Minimum interval n microframes. Use powers of 2.\n");
14051408

1409+
module_param(cil_force_host, bool, 0644);
1410+
MODULE_PARM_DESC(cil_force_host, "On a connector-ID status change, "
1411+
"force Host Mode regardless of OTG state.");
1412+
14061413
/** @page "Module Parameters"
14071414
*
14081415
* The following parameters may be specified when starting the module.

0 commit comments

Comments
 (0)