stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/49] usb: dwc2: fixes, enhancements and new features
@ 2017-12-25 11:15 Grigor Tovmasyan
  2017-12-25 11:18 ` [PATCH v2 03/49] usb: dwc2: Remove version check in GSNPSID Grigor Tovmasyan
  0 siblings, 1 reply; 2+ messages in thread
From: Grigor Tovmasyan @ 2017-12-25 11:15 UTC (permalink / raw)
  To: John Youn, Felipe Balbi, Greg Kroah-Hartman, linux-usb
  Cc: Artur Petrosyan, Minas Harutyunyan, Vardan Mikayelyan,
	Razmik Karapetyan, Gevorg Sahakyan, Sevak Arakelyan,
	Grigor Tovmasyan, stable, Stefan Wahren

This patch series includes new features such us Active Clock Gating(ACG), 
LPM and Hibernation, enhancements and fixes for already existing features.
All this patches were already sent to lkml separately. ACG, LPM and Hibernation
were sent as patch series.

All patches were tested in our lab.

Changes from v1:

"usb: dwc2: pci: Fix error handling in dwc2_pci_probe" was divided into 4 patches:
    "usb: dwc2: pci: Handle error cleanup in probe"
    "usb: dwc2: pci: Move devm_kzalloc() before platform_device_add()"
    "usb: dwc2: pci: Move usb_phy_generic_register()"
    "usb: dwc2: pci: Replace kzalloc() with devm_kzalloc()"

"usb: dwc2: Move polling function to core.c."  and "usb: dwc2: Use common polling function." 
patches were merged into "usb: dwc2: Bit polling functionality update.".
Also created dwc2_hsotg_wait_bit_clear() function, because in some cases,
we should wait for bit would be cleared not set. Updated all new loops which 
came with patches in this series.
 

usb: dwc2: gadget: Add LPM functionality (LPM):
    
    - "usb: gadget: Allow a non-SuperSpeed gadget to support LPM" 
      and "usb: gadget: composite: Exclude SS Dev Cap Desc" patches were 
      removed, because they were already merged to kernel. 
    - "usb: dwc2: Add core state checking" and "usb: dwc2: Add call_gadget() function call" 
      patches were added.
    - Fixed GLPMCFG initialization. Now hird and besl values also writes into GLPMCFG.
    - Replaced shift operator with BIT() macro. 

usb: dwc2: Add hibernation feature support (Hibernation):
   
   - Added WA in dwc2_restore_device_registers() function for enabled EPx's IN
     in DDMA mode for not to get BNA Interrupt asserted on hibernation exit. 
   - Added argument is_host to determine if core is in host mode or not and 
     changed some udelay values in dwc2_hib_restore_common() function. 
   - Added is_host function parameter to determine being in host mode, checking
     host mode to set pcgcctl properly and changed hard coded numbers to 
     defined values also changed the logic of loading restore values for 
     [31:14] bits in dwc2_restore_essential_regs() function.
   - Fixed a minor bug: added checks for determine hibernation exiting flows 
     in dwc2_handle_gpwrdn_intr() function. Also changed the way of clearing 
     all interrupts. 
   - dwc2_gadget_enter_hibernation() fixed some minor bugs, phy clock now 
     remains not stopped. Added unmasking of GPWRDN_STS_CHGINT_MSK device
     mode interrupts in GPWRDN.
   - dwc2_host_enter_hibernation() added a udelay after writing in gpwrdn register.

ACG support for dwc2 driver (ACG):
   
   - Added new acg_enable filed in dwc2_hw_params checks ACG support from hardware side.
   - Similar acg_enable field in dwc2_core_params used for dynamically disabling/enabling
     ACG functionality from driver. 

usb: dwc2: Add safety check in setting of descriptor chain pointer
      
    Updated description of patch.

usb: dwc2: host: Fix transaction errors in host mode

    - Rename patch name from "usb: dwc2: host: Setting TOUTCAL and USBTRDTIM fields in host mode".
    - Remove programming of USBTRDTIM bitfiled, because this field available
      only in Device mode.
    - Added comment with description of TOUTCAL bitfiled in comment.
    - In description added platforms for which this patch fixes transactions error.

usb: dwc2: hcd: Fix host channel halt flow 

    Rebased to latest Kernel.                

usb: dwc2: Change TxFIFO and RxFIFO flushing flow 

    Rewritten loop for waiting AHB master IDLE state.





Gevorg Sahakyan (1):
  usb: dwc2: Remove version check in GSNPSID

Grigor Tovmasyan (4):
  usb: dwc2: Delete unused functionality
  usb: dwc2: Make function static
  usb: dwc2: Add call_gadget() function call
  usb: dwc2: Add core state checking

John Youn (2):
  usb: dwc2: Enable LPM
  usb: dwc2: Enable power down

Minas Harutyunyan (5):
  usb: dwc2: Change TxFIFO and RxFIFO flushing flow
  usb: dwc2: hcd: Fix host channel halt flow
  usb: dwc2: Add safety check for STSPHSERCVD intr
  usb: dwc2: host: Fix transaction errors in host mode
  usb: dwc2: Add safety check in setting of descriptor chain pointers

Razmik Karapetyan (10):
  usb: dwc2: Set AHB burst size to INCR
  usb: dwc2: Remove unnecessary debug prints
  usb: dwc2: Define PCGCCTL1 register in hw.h
  usb: dwc2: Define Active Clock Gating support bit in GHWCFG4
  usb: dwc2: Add dwc2_enable_acg function
  usb: dwc2: Backup and restore PCGCCTL1 register
  usb: dwc2: Update dwc2_handle_incomplete_isoc_in() function
  usb: dwc2: Update dwc2_handle_incomplete_isoc_out() function
  usb: dwc2: Update GINTSTS_GOUTNAKEFF interrupt handling
  usb: dwc2: Rename function names

Sevak Arakelyan (7):
  usb: dwc2: Fix GLPMCFG... definitions
  usb: dwc2: Add core parameters for LPM support
  usb: dwc2: gadget: Add functionality to exit from LPM L1 state
  usb: dwc2: gadget: LPM interrupt handler
  usb: dwc2: Enable LPM Transaction Received interrupt.
  usb: dwc2: gadget: Configure the core to enable LPM.
  usb: dwc2: Bit polling functionality update.

Vardan Mikayelyan (20):
  usb: dwc2: eliminate irq parameter from dwc2_gadget_init
  usb: dwc2: Force mode optimizations
  usb: dwc2: Rename hibernation to partial_power_down
  usb: dwc2: Add hibernation field into dwc2_hw_params
  usb: dwc2: gadget: Moved dtxfsiz backup array place
  usb: dwc2: gadget: Fix dwc2_restore_device_registers
  usb: dwc2: core: Add hibernated flag
  usb: dwc2: gadget: Add remote_wakeup_allowed flag
  usb: dwc2: Changes in registers backup/restore functions
  usb: dwc2: Add helper functions for restore routine
  usb: dwc2: Add host/device hibernation functions
  usb: dwc2: Add dwc2_enter_hibernation(), dwc2_exit_hibernation()
  usb: dwc2: Allow entering hibernation from USB_SUSPEND interrupt
  usb: dwc2: Add dwc2_handle_gpwrdn_intr() handler
  usb: dwc2: Change hub-control to allow hibernation
  usb: dwc2: Fix dwc2_hsotg_core_init_disconnected()
  usb: dwc2: pci: Replace kzalloc() with devm_kzalloc()
  usb: dwc2: pci: Move usb_phy_generic_register()
  usb: dwc2: pci: Move devm_kzalloc() before platform_device_add()
  usb: dwc2: pci: Handle error cleanup in probe

 drivers/usb/dwc2/core.c      | 410 ++++++++++++++++++++++++++++++-----------
 drivers/usb/dwc2/core.h      | 134 ++++++++++----
 drivers/usb/dwc2/core_intr.c | 304 +++++++++++++++++++++++++++---
 drivers/usb/dwc2/debugfs.c   |   7 +-
 drivers/usb/dwc2/gadget.c    | 425 ++++++++++++++++++++++++++++++++----------
 drivers/usb/dwc2/hcd.c       | 430 +++++++++++++++++++++++++++++++------------
 drivers/usb/dwc2/hcd.h       |  56 ------
 drivers/usb/dwc2/hw.h        |  44 +++--
 drivers/usb/dwc2/params.c    |  90 +++++++--
 drivers/usb/dwc2/pci.c       |  27 ++-
 drivers/usb/dwc2/platform.c  |  12 +-
 11 files changed, 1450 insertions(+), 489 deletions(-)

-- 
2.11.0

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH v2 03/49] usb: dwc2: Remove version check in GSNPSID
  2017-12-25 11:15 [PATCH v2 00/49] usb: dwc2: fixes, enhancements and new features Grigor Tovmasyan
@ 2017-12-25 11:18 ` Grigor Tovmasyan
  0 siblings, 0 replies; 2+ messages in thread
From: Grigor Tovmasyan @ 2017-12-25 11:18 UTC (permalink / raw)
  To: John Youn, Felipe Balbi, Greg Kroah-Hartman, linux-usb
  Cc: Minas Harutyunyan, Gevorg Sahakyan, Grigor Tovmasyan, stable

From: Gevorg Sahakyan <sahakyan@synopsys.com>

Only check the ID portion of the GSNPSID register and don’t check
the version. This will allow the driver to work with version 4.00a
and later of the DWC_hsotg IP.

Cc: stable@vger.kernel.org
Signed-off-by: Gevorg Sahakyan <sahakyan@synopsys.com>
Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
Signed-off-by: Grigor Tovmasyan <tovmasya@synopsys.com>
---
 drivers/usb/dwc2/core.h   |  5 +++++
 drivers/usb/dwc2/hw.h     |  1 +
 drivers/usb/dwc2/params.c | 11 +++++------
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index 0f0c21cf0192..7439aa6e35f6 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -951,6 +951,11 @@ struct dwc2_hsotg {
 #define DWC2_FS_IOT_REV_1_00a	0x5531100a
 #define DWC2_HS_IOT_REV_1_00a	0x5532100a
 
+	/* DWC OTG HW Core ID */
+#define DWC2_OTG_ID		0x4f540000
+#define DWC2_FS_IOT_ID		0x55310000
+#define DWC2_HS_IOT_ID		0x55320000
+
 #if IS_ENABLED(CONFIG_USB_DWC2_HOST) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
 	union dwc2_hcd_internal_flags {
 		u32 d32;
diff --git a/drivers/usb/dwc2/hw.h b/drivers/usb/dwc2/hw.h
index 2c906d8ee465..43a3fb00f14f 100644
--- a/drivers/usb/dwc2/hw.h
+++ b/drivers/usb/dwc2/hw.h
@@ -231,6 +231,7 @@
 #define GUID				HSOTG_REG(0x003c)
 #define GSNPSID				HSOTG_REG(0x0040)
 #define GHWCFG1				HSOTG_REG(0x0044)
+#define GSNPSID_ID_MASK			GENMASK(31, 16)
 
 #define GHWCFG2				HSOTG_REG(0x0048)
 #define GHWCFG2_OTG_ENABLE_IC_USB		BIT(31)
diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c
index 9c3ff66a2eb8..fc4d93d78ec3 100644
--- a/drivers/usb/dwc2/params.c
+++ b/drivers/usb/dwc2/params.c
@@ -630,14 +630,13 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)
 	/*
 	 * Attempt to ensure this device is really a DWC_otg Controller.
 	 * Read and verify the GSNPSID register contents. The value should be
-	 * 0x45f42xxx or 0x45f43xxx, which corresponds to either "OT2" or "OT3",
-	 * as in "OTG version 2.xx" or "OTG version 3.xx".
+	 * 0x45f4xxxx, 0x5531xxxx or 0x5532xxxx
 	 */
+
 	hw->snpsid = dwc2_readl(hsotg->regs + GSNPSID);
-	if ((hw->snpsid & 0xfffff000) != 0x4f542000 &&
-	    (hw->snpsid & 0xfffff000) != 0x4f543000 &&
-	    (hw->snpsid & 0xffff0000) != 0x55310000 &&
-	    (hw->snpsid & 0xffff0000) != 0x55320000) {
+	if ((hw->snpsid & GSNPSID_ID_MASK) != DWC2_OTG_ID &&
+	    (hw->snpsid & GSNPSID_ID_MASK) != DWC2_FS_IOT_ID &&
+	    (hw->snpsid & GSNPSID_ID_MASK) != DWC2_HS_IOT_ID) {
 		dev_err(hsotg->dev, "Bad value for GSNPSID: 0x%08x\n",
 			hw->snpsid);
 		return -ENODEV;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-12-25 11:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-25 11:15 [PATCH v2 00/49] usb: dwc2: fixes, enhancements and new features Grigor Tovmasyan
2017-12-25 11:18 ` [PATCH v2 03/49] usb: dwc2: Remove version check in GSNPSID Grigor Tovmasyan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).