Skip to content

Commit

Permalink
dwc_otg: don't unconditionally force host mode in dwc_otg_cil_init()
Browse files Browse the repository at this point in the history
Add the ability to disable force_host_mode for those that want to use
dwc_otg in both device and host modes.
  • Loading branch information
P33M authored and pelwell committed Jan 9, 2018
1 parent 8d80658 commit cb68aeb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/usb/host/dwc_otg/dwc_otg_cil.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
#include "dwc_otg_regs.h"
#include "dwc_otg_cil.h"

extern bool cil_force_host;

static int dwc_otg_setup_params(dwc_otg_core_if_t * core_if);

/**
Expand Down Expand Up @@ -192,7 +194,10 @@ dwc_otg_core_if_t *dwc_otg_cil_init(const uint32_t * reg_base_addr)
core_if->hptxfsiz.d32 =
DWC_READ_REG32(&core_if->core_global_regs->hptxfsiz);
gusbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg);
gusbcfg.b.force_host_mode = 1;
if (cil_force_host)
gusbcfg.b.force_host_mode = 1;
else
gusbcfg.b.force_host_mode = 0;
DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, gusbcfg.d32);
dwc_mdelay(100);
}
Expand Down
7 changes: 7 additions & 0 deletions drivers/usb/host/dwc_otg/dwc_otg_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ bool fiq_fsm_enable = true;
//Bulk split-transaction NAK holdoff in microframes
uint16_t nak_holdoff = 8;

//Force host mode during CIL re-init
bool cil_force_host = true;

unsigned short fiq_fsm_mask = 0x0F;

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

module_param(cil_force_host, bool, 0644);
MODULE_PARM_DESC(cil_force_host, "On a connector-ID status change, "
"force Host Mode regardless of OTG state.");

/** @page "Module Parameters"
*
* The following parameters may be specified when starting the module.
Expand Down

0 comments on commit cb68aeb

Please sign in to comment.