1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter.git synced 2025-02-15 04:42:02 +00:00
openmptcprouter/root/target/linux/brcm2708/patches-4.14/0165-dwc_otg-don-t-unconditionally-force-host-mode-in-dwc.patch
2018-03-23 21:58:08 +01:00

66 lines
2.3 KiB
Diff

From 09a03fa87bf73d76fb1d5119ba5a6dd68bef7843 Mon Sep 17 00:00:00 2001
From: P33M <p33m@github.com>
Date: Tue, 9 Jan 2018 15:16:35 +0000
Subject: [PATCH 165/277] 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(-)
diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cil.c b/drivers/usb/host/dwc_otg/dwc_otg_cil.c
index 38abd0b1f034..14300ad0f2af 100644
--- 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(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);
}
diff --git a/drivers/usb/host/dwc_otg/dwc_otg_driver.c b/drivers/usb/host/dwc_otg/dwc_otg_driver.c
index af123d01f3ef..e945900c503c 100644
--- 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, "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.
--
2.16.1