openwrt/target/linux/brcm2708/patches-4.14/950-0147-dwc_otg-don-t-unco...

60 lines
2.0 KiB
Diff

From 71f116335e08f82f73efec6da10893f545455b5f Mon Sep 17 00:00:00 2001
From: P33M <p33m@github.com>
Date: Tue, 9 Jan 2018 15:16:35 +0000
Subject: [PATCH 147/454] 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.
---
drivers/usb/host/dwc_otg/dwc_otg_cil.c | 7 ++++++-
drivers/usb/host/dwc_otg/dwc_otg_driver.c | 7 +++++++
2 files changed, 13 insertions(+), 1 deletion(-)
--- a/drivers/usb/host/dwc_otg/dwc_otg_cil.c
+++ b/drivers/usb/host/dwc_otg/dwc_otg_cil.c
@@ -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);
/**
@@ -192,7 +194,10 @@ dwc_otg_core_if_t *dwc_otg_cil_init(cons
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);
}
--- a/drivers/usb/host/dwc_otg/dwc_otg_driver.c
+++ b/drivers/usb/host/dwc_otg/dwc_otg_driver.c
@@ -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;
@@ -1403,6 +1406,10 @@ MODULE_PARM_DESC(int_ep_interval_min, "C
"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.