brcm2708: add kernel 4.14 support
[openwrt/staging/lynxis.git] / target / linux / brcm2708 / patches-4.14 / 950-0147-dwc_otg-don-t-unconditionally-force-host-mode-in-dwc.patch
1 From 71f116335e08f82f73efec6da10893f545455b5f Mon Sep 17 00:00:00 2001
2 From: P33M <p33m@github.com>
3 Date: Tue, 9 Jan 2018 15:16:35 +0000
4 Subject: [PATCH 147/454] dwc_otg: don't unconditionally force host mode in
5 dwc_otg_cil_init()
6
7 Add the ability to disable force_host_mode for those that want to use
8 dwc_otg in both device and host modes.
9 ---
10 drivers/usb/host/dwc_otg/dwc_otg_cil.c | 7 ++++++-
11 drivers/usb/host/dwc_otg/dwc_otg_driver.c | 7 +++++++
12 2 files changed, 13 insertions(+), 1 deletion(-)
13
14 --- a/drivers/usb/host/dwc_otg/dwc_otg_cil.c
15 +++ b/drivers/usb/host/dwc_otg/dwc_otg_cil.c
16 @@ -61,6 +61,8 @@
17 #include "dwc_otg_regs.h"
18 #include "dwc_otg_cil.h"
19
20 +extern bool cil_force_host;
21 +
22 static int dwc_otg_setup_params(dwc_otg_core_if_t * core_if);
23
24 /**
25 @@ -192,7 +194,10 @@ dwc_otg_core_if_t *dwc_otg_cil_init(cons
26 core_if->hptxfsiz.d32 =
27 DWC_READ_REG32(&core_if->core_global_regs->hptxfsiz);
28 gusbcfg.d32 = DWC_READ_REG32(&core_if->core_global_regs->gusbcfg);
29 - gusbcfg.b.force_host_mode = 1;
30 + if (cil_force_host)
31 + gusbcfg.b.force_host_mode = 1;
32 + else
33 + gusbcfg.b.force_host_mode = 0;
34 DWC_WRITE_REG32(&core_if->core_global_regs->gusbcfg, gusbcfg.d32);
35 dwc_mdelay(100);
36 }
37 --- a/drivers/usb/host/dwc_otg/dwc_otg_driver.c
38 +++ b/drivers/usb/host/dwc_otg/dwc_otg_driver.c
39 @@ -247,6 +247,9 @@ bool fiq_fsm_enable = true;
40 //Bulk split-transaction NAK holdoff in microframes
41 uint16_t nak_holdoff = 8;
42
43 +//Force host mode during CIL re-init
44 +bool cil_force_host = true;
45 +
46 unsigned short fiq_fsm_mask = 0x0F;
47
48 unsigned short int_ep_interval_min = 0;
49 @@ -1403,6 +1406,10 @@ MODULE_PARM_DESC(int_ep_interval_min, "C
50 "0..1 = Use endpoint default\n"
51 "2..n = Minimum interval n microframes. Use powers of 2.\n");
52
53 +module_param(cil_force_host, bool, 0644);
54 +MODULE_PARM_DESC(cil_force_host, "On a connector-ID status change, "
55 + "force Host Mode regardless of OTG state.");
56 +
57 /** @page "Module Parameters"
58 *
59 * The following parameters may be specified when starting the module.