[PATCH v3 11/15] usb: dwc3: Track DWC_usb31 VERSIONTYPE

2018-01-17 Thread Thinh Nguyen
Add a new field to dwc3 structure to track VERSIONTYPE. The VERSIONTYPE is represented in ASCII in the 32-bit VERSIONTYPE register. In DWC_usb31, sub releases for each version are tracked with VERSIONTYPE such as "ea01" and "ea02". Signed-off-by: Thinh Nguyen --- drivers

[PATCH v3 10/15] usb: dwc3: Dump LSP and BMU debug info

2018-01-17 Thread Thinh Nguyen
Dump LSP and BMU debug info. Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/core.h| 5 + drivers/usb/dwc3/debugfs.c | 5 + 2 files changed, 10 insertions(+) diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index e53ae6038bbe..fd794972802d 100644 --- a/drivers/usb

[PATCH v3 08/15] usb: dwc3: Make TX/RX threshold configurable

2018-01-17 Thread Thinh Nguyen
DWC_usb31 periodic transfer at 48K+ bytes per interval may need modification to the TX/RX packet threshold to achieve optimal result. Add properties to make it configurable. Cc: John Youn Signed-off-by: Thinh Nguyen --- Documentation/devicetree/bindings/usb/dwc3.txt | 4 1 file changed, 4

[PATCH v3 12/15] usb: dwc3: Add disabling of start_transfer failure quirk

2018-01-17 Thread Thinh Nguyen
microframe number for isochronous IN endpoints. Cc: John Youn Signed-off-by: Thinh Nguyen --- Documentation/devicetree/bindings/usb/dwc3.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt index

[PATCH v3 14/15] usb: dwc3: Check controller type before setting speed

2018-01-17 Thread Thinh Nguyen
DWC_usb3 speed can only be set up to SuperSpeed. Limit the setting to SuperSpeed only should the value be higher. Otherwise, the controller will read an invalid speed value and set the device to an incorrect speed. Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/gadget.c | 5 - 1 file

[PATCH v3 13/15] usb: dwc3: Add workaround for isoc start transfer failure

2018-01-17 Thread Thinh Nguyen
test1 fails, BIT[15:14] is 'b11 if test0 fails and test1 fails, BIT[15:14] is 'b10 if test0 fails and test1 passes, BIT[15:14] is 'b01 Synopsys STAR 9001202023: Wrong microframe number for isochronous IN endpoints. Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/core.c | 2 +

[PATCH v3 15/15] usb: gadget: mass_storage: Set max_speed to SSP

2018-01-17 Thread Thinh Nguyen
: Thinh Nguyen --- drivers/usb/gadget/legacy/mass_storage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/legacy/mass_storage.c b/drivers/usb/gadget/legacy/mass_storage.c index ef3d25259b0e..fd5595ac5bf7 100644 --- a/drivers/usb/gadget/legacy/mass_storage.c

Re: [PATCH v3 08/15] usb: dwc3: Make TX/RX threshold configurable

2018-01-29 Thread Thinh Nguyen
Hi, On 1/29/2018 10:46 AM, Rob Herring wrote: > On Wed, Jan 17, 2018 at 05:57:15PM -0800, Thinh Nguyen wrote: >> DWC_usb31 periodic transfer at 48K+ bytes per interval may need >> modification to the TX/RX packet threshold to achieve optimal result. >> Add properties to

[PATCH v4 00/15] usb: dwc3: Add new updates for DWC_usb31

2018-01-31 Thread Thinh Nguyen
) instead of mdelay() for SoftReset PHY sync delay - Rename new USB31 macros from DWC3_USB31_* to DWC31_* - Rename device properties and replace '_' with '-' - Minor fixes in the commit messages Thinh Nguyen (15): usb: dwc3: Add SoftReset PHY synchonization delay usb: core

[PATCH v4 01/15] usb: dwc3: Add SoftReset PHY synchonization delay

2018-01-31 Thread Thinh Nguyen
>From DWC_usb31 programming guide section 1.3.2, once DWC3_DCTL_CSFTRST bit is cleared, we must wait at least 50ms before accessing the PHY domain (synchronization delay). Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/core.c | 13 - 1 file changed, 12 insertions(+), 1 delet

[PATCH v4 02/15] usb: core: urb: Check SSP isoc ep comp descriptor

2018-01-31 Thread Thinh Nguyen
The maximum bytes per interval for USB SuperSpeed Plus can be set by isoc endpoint companion descriptor when it is above 48K. If the descriptor is provided, then use its value. USB 3.1 spec 9.6.8 Signed-off-by: Thinh Nguyen --- drivers/usb/core/urb.c | 8 1 file changed, 8 insertions

[PATCH v4 03/15] usb: dwc3: Update DWC_usb31 GTXFIFOSIZ reg fields

2018-01-31 Thread Thinh Nguyen
| +---+---+--+ Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/core.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 4a4a4c98508c..70666d336e86 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -239,6 +239,8 @@ #define

[PATCH v4 04/15] usb: dwc3: Check IP revision for GTXFIFOSIZ

2018-01-31 Thread Thinh Nguyen
DWC_usb31 controller has different GTXFIFOSIZE bit field for TXFDEF. Check for DWC_usb31 IP revision to read the appropriate bit fields. Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/gadget.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/gadget.c b

[PATCH v4 07/15] usb: dwc3: Add DWC_usb31 GTXTHRCFG reg fields

2018-01-31 Thread Thinh Nguyen
burst size| +---+--+---+ Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/core.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 61c2b78d5809..7d15d92f622a

[PATCH v4 06/15] usb: dwc3: gadget: Check IP revision for GRXTHRCFG

2018-01-31 Thread Thinh Nguyen
DWC_usb31 controller has a different UsbRxPktCnt bit fields from GRXTHRCFG register. Check for DWC_usb31 IP revision to read the appropriate value. Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/gadget.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3

[PATCH v4 05/15] usb: dwc3: Add DWC_usb31 GRXTHRCFG bit fields

2018-01-31 Thread Thinh Nguyen
| +---+--+--+ Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/core.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 70666d336e86..61c2b78d5809 100644 --- a/drivers

[PATCH v4 09/15] usb: dwc3: Check for ESS TX/RX threshold config

2018-01-31 Thread Thinh Nguyen
Check and configure TX/RX threshold for DWC_usb31. Update dwc3 structure with new fields to store these threshold configurations. Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/core.c | 55 + drivers/usb/dwc3/core.h | 8 +++ 2 files changed

[PATCH v4 08/15] usb: dwc3: Make TX/RX threshold configurable

2018-01-31 Thread Thinh Nguyen
threshold count and max burst size properties must be set to a valid non-zero value 1-16. DWC_usb31 programming guide section 1.2.3 and 1.2.4. Cc: John Youn Signed-off-by: Thinh Nguyen --- Documentation/devicetree/bindings/usb/dwc3.txt | 16 1 file changed, 16 insertions(+) diff

[PATCH v4 10/15] usb: dwc3: Dump LSP and BMU debug info

2018-01-31 Thread Thinh Nguyen
Dump LSP and BMU debug info. Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/core.h| 5 + drivers/usb/dwc3/debugfs.c | 5 + 2 files changed, 10 insertions(+) diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index e53ae6038bbe..fd794972802d 100644 --- a/drivers/usb

[PATCH v4 11/15] usb: dwc3: Track DWC_usb31 VERSIONTYPE

2018-01-31 Thread Thinh Nguyen
Add a new field to dwc3 structure to track VERSIONTYPE. The VERSIONTYPE is represented in ASCII in the 32-bit VERSIONTYPE register. In DWC_usb31, sub releases for each version are tracked with VERSIONTYPE such as "ea01" and "ea02". Signed-off-by: Thinh Nguyen --- drivers

[PATCH v4 12/15] usb: dwc3: Add disabling of start_transfer failure quirk

2018-01-31 Thread Thinh Nguyen
microframe number for isochronous IN endpoints. Cc: John Youn Signed-off-by: Thinh Nguyen --- Documentation/devicetree/bindings/usb/dwc3.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt b/Documentation/devicetree/bindings/usb/dwc3.txt index

[PATCH v4 14/15] usb: dwc3: Check controller type before setting speed

2018-01-31 Thread Thinh Nguyen
DWC_usb3 speed can only be set up to SuperSpeed. Limit the setting to SuperSpeed only should the value be higher. Otherwise, the controller will read an invalid speed value and set the device to an incorrect speed. Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/gadget.c | 5 - 1 file

[PATCH v4 13/15] usb: dwc3: Add workaround for isoc start transfer failure

2018-01-31 Thread Thinh Nguyen
test1 fails, BIT[15:14] is 'b11 if test0 fails and test1 fails, BIT[15:14] is 'b10 if test0 fails and test1 passes, BIT[15:14] is 'b01 Synopsys STAR 9001202023: Wrong microframe number for isochronous IN endpoints. Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/core.c | 2 +

[PATCH v4 15/15] usb: gadget: mass_storage: Set max_speed to SSP

2018-01-31 Thread Thinh Nguyen
: Thinh Nguyen --- drivers/usb/gadget/legacy/mass_storage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/legacy/mass_storage.c b/drivers/usb/gadget/legacy/mass_storage.c index ef3d25259b0e..fd5595ac5bf7 100644 --- a/drivers/usb/gadget/legacy/mass_storage.c

[PATCH] usb: dwc3: Fix GDBGFIFOSPACE_TYPE values

2018-02-02 Thread Thinh Nguyen
The FIFO/Queue type values are incorrect. Correct them according to DWC_usb3 programming guide section 1.2.27 (or DWC_usb31 section 1.2.25). Additionally, this patch includes ProtocolStatusQ and AuxEventQ types. Fixes: cf6d867d3b57 ("usb: dwc3: core: add fifo space helper") Signed-off

[PATCH 2/7] usb: dwc3: pci: Set an easily recognizable device name

2018-02-16 Thread Thinh Nguyen
Set the device name for PCI glue layer to "dwc3-pci.BB:SS.FF" where BB is PCI bus number, SS is PCI slot, and FF is PCI function number. Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/dwc3-pci.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/dwc3/dwc3-pci.c b/d

[PATCH 0/7] usb: dwc3: pci: Make device properties customizable

2018-02-16 Thread Thinh Nguyen
is only one property -- maximum_speed. --- Hi Felipe, Can you review to see if this new update is ok. If so, I'll update this patch series and add more properties. Thank, Thinh Thinh Nguyen (7): usb: dwc3: pci: Properly cleanup resource usb: dwc3: pci: Set an easily recognizable device nam

[PATCH 3/7] usb: dwc3: pci: Store device properties dynamically

2018-02-16 Thread Thinh Nguyen
r all the selected properties to add to a platform device. Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/dwc3-pci.c | 107 1 file changed, 98 insertions(+), 9 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pc

[PATCH 1/7] usb: dwc3: pci: Properly cleanup resource

2018-02-16 Thread Thinh Nguyen
Platform device is allocated before adding resources. Make sure to properly cleanup on error case. Fixes: f1c7e7108109 ("usb: dwc3: convert to pcim_enable_device()") Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/dwc3-pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) di

[PATCH 4/7] usb: dwc3: pci: Move platform creation from probe function

2018-02-16 Thread Thinh Nguyen
Refactor and move dwc3 platform creation from dwc3_pci_probe() to a new function called dwc3_pci_add_platform_device(). This way, it can be called later. Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/dwc3-pci.c | 89 - 1 file changed, 56 insertions

[PATCH 7/7] usb: dwc3: pci: Add debugfs for device properties

2018-02-16 Thread Thinh Nguyen
is only one property -- maximum_speed. Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/Kconfig | 11 drivers/usb/dwc3/Makefile | 3 + drivers/usb/dwc3/dwc3-pci.h| 26 drivers/usb/dwc3/pci-debugfs.c | 144 + drivers/usb/dwc3/pci.c

[PATCH 5/7] usb: dwc3: Rename dwc3-pci.c to pci.c

2018-02-16 Thread Thinh Nguyen
Rename dwc3-pci.c to pci.c. There will be multiple source files to create dwc3-pci module, so dwc3-pci.c needs to use a different name than the module name. Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/Makefile | 2 ++ drivers/usb/dwc3/{dwc3-pci.c => pci.c} | 0 2 files chan

[PATCH 6/7] usb: dwc3: pci: Create header file

2018-02-16 Thread Thinh Nguyen
Move dwc3_pci structure definition and some common function declarations to their own header file so multiple source files can reference them. Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/dwc3-pci.h | 46 + drivers/usb/dwc3/pci.c | 34

Re: [PATCH 2/7] usb: dwc3: pci: Set an easily recognizable device name

2018-02-20 Thread Thinh Nguyen
Hi, On 2/17/2018 7:12 AM, Andy Shevchenko wrote: > On Fri, Feb 16, 2018 at 11:55 PM, Thinh Nguyen > wrote: >> Set the device name for PCI glue layer to "dwc3-pci.BB:SS.FF" where BB >> is PCI bus number, SS is PCI slot, and FF is PCI function number. > > Isn&#x

Re: [PATCH 3/7] usb: dwc3: pci: Store device properties dynamically

2018-02-20 Thread Thinh Nguyen
On 2/17/2018 7:29 AM, Andy Shevchenko wrote: > On Fri, Feb 16, 2018 at 11:55 PM, Thinh Nguyen > wrote: >> Add the ability to add device properties dynamically. Currently, device >> properties are added to platform device using >> platform_device_add_properties(). However

Re: [PATCH 3/7] usb: dwc3: pci: Store device properties dynamically

2018-02-21 Thread Thinh Nguyen
Hi Andy, On 2/21/2018 6:46 AM, Andy Shevchenko wrote: > On Tue, Feb 20, 2018 at 11:12 PM, Thinh Nguyen > wrote: >> On 2/17/2018 7:29 AM, Andy Shevchenko wrote: >>> On Fri, Feb 16, 2018 at 11:55 PM, Thinh Nguyen >>> wrote: >>>> Add the ability to ad

Re: [PATCH v4 01/15] usb: dwc3: Add SoftReset PHY synchonization delay

2018-03-12 Thread Thinh Nguyen
Hi Felipe, On 3/12/2018 3:24 AM, Felipe Balbi wrote: > Thinh Nguyen writes: > >> From DWC_usb31 programming guide section 1.3.2, once DWC3_DCTL_CSFTRST >> bit is cleared, we must wait at least 50ms before accessing the PHY >> domain (synchronization delay). >>

Re: [PATCH v4 13/15] usb: dwc3: Add workaround for isoc start transfer failure

2018-03-13 Thread Thinh Nguyen
Hi Felipe, On 3/13/2018 1:45 AM, Felipe Balbi wrote: > > Hi, > > Thinh Nguyen writes: >> In DWC_usb31 version 1.70a-ea06 and prior, for highspeed and fullspeed >> isochronous IN, BIT[15:14] of the 16-bit microframe number reported by >> the XferNotReady event are

Re: [PATCH v4 02/15] usb: core: urb: Check SSP isoc ep comp descriptor

2018-03-13 Thread Thinh Nguyen
Hi, On 3/13/2018 1:31 AM, Felipe Balbi wrote: > > Hi, > > Thinh Nguyen writes: >> The maximum bytes per interval for USB SuperSpeed Plus can be set by >> isoc endpoint companion descriptor when it is above 48K. If the >> descriptor is provided, then use its v

Re: [PATCH v4 13/15] usb: dwc3: Add workaround for isoc start transfer failure

2018-03-14 Thread Thinh Nguyen
Hi Felipe, On 3/14/2018 1:56 AM, Felipe Balbi wrote: > > Hi, > > Thinh Nguyen writes: >>> Thinh Nguyen writes: >>>> In DWC_usb31 version 1.70a-ea06 and prior, for highspeed and fullspeed >>>> isochronous IN, BIT[15:14] of the 16-bit microframe n

[PATCH 3/3] usb: gadget: f_mass_storage: Serialize wake and sleep execution

2017-04-07 Thread Thinh Nguyen
memory barrier between waker and waiter. See DEFINE_WAIT_FUNC comment in kernel scheduling wait.c as this solution is similar to its implementation. Signed-off-by: Thinh Nguyen --- drivers/usb/gadget/function/f_mass_storage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH 2/3] usb: dwc3: gadget: Fix early exit in set/clear ep halt

2017-04-07 Thread Thinh Nguyen
ing to see whether the set/halt ep call is a protocol call before early exit to make sure that set/clear halt endpoint command can go through if it is a device class protocol. Fixes: ffb80fc672c3 ("usb: dwc3: gadget: skip Set/Clear Halt when invalid") Signed-off-by: Thinh Nguyen -

[PATCH 1/3] usb: dwc3: gadget: Prevent losing events in event cache

2017-04-07 Thread Thinh Nguyen
uld return IRQ_HANDLED if the mask is still set since IRQ handler was invoked for our usb interrupt. Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/gadget.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 4d

Re: [PATCH 3/3] usb: gadget: f_mass_storage: Serialize wake and sleep execution

2017-04-10 Thread Thinh Nguyen
ation needs to consider the driver's own variables. This also means that the analysis provided by Thinh Nguyen in the original patch description is wrong. And that the bug is elsewhere? Presumably. On the other hand, Thinh Nguyen claimed to have narrowed the problem down to this pa

Re: [PATCH 2/3] usb: dwc3: gadget: Fix early exit in set/clear ep halt

2017-04-10 Thread Thinh Nguyen
Hi Felipe, On 4/10/2017 12:04 AM, Felipe Balbi wrote: Hi again, Felipe Balbi writes: Thinh Nguyen writes: This patch fixes a commit that causes a hang from device waiting for data with the wrong sequence number. The commit ffb80fc672c3 ("usb: dwc3: gadget: skip Set/Clear Halt when in

Re: [PATCH 3/3] usb: gadget: f_mass_storage: Serialize wake and sleep execution

2017-04-11 Thread Thinh Nguyen
On 4/11/2017 7:35 AM, Alan Stern wrote: On Mon, 10 Apr 2017, Thinh Nguyen wrote: To fix this problem, both the smp_rmb() in sleep_thread() and the smp_wmb() in wakeup_thread() should be changed to smp_mb(). Wouldn't it be sufficient to have smp_mb() just either in the sleep_thread() o

Re: [PATCH 2/3] usb: dwc3: gadget: Fix early exit in set/clear ep halt

2017-04-11 Thread Thinh Nguyen
On 4/11/2017 12:36 AM, Felipe Balbi wrote: Hi, Thinh Nguyen writes: Felipe Balbi writes: Thinh Nguyen writes: This patch fixes a commit that causes a hang from device waiting for data with the wrong sequence number. The commit ffb80fc672c3 ("usb: dwc3: gadget: skip Set/Clear Halt

Re: [PATCH 1/3] usb: dwc3: gadget: Prevent losing events in event cache

2017-04-12 Thread Thinh Nguyen
wice in in a row. However, I also tested with replacing the code above with a udelay(4), from reading the kernel trace, to take in account the latency of reading the registers. I also don't see TH get called twice in a row. The extra latency from reading the registers above can mask this i

Re: [PATCH 2/2] USB: f_mass_storage: improve memory barriers and synchronization

2017-04-19 Thread Thinh Nguyen
some trivial checkpatch complains. Kernel: 4.11-rc5 Driver: dwc3 Platform: HAPS-DX IP: USB 3.0 IP version 3.10a and USB 3.1 version 1.60a System: x86_64 Tested-by: Thinh Nguyen BR, Thinh Nguyen -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH 1/3] usb: dwc3: gadget: Prevent losing events in event cache

2017-05-10 Thread Thinh Nguyen
Hi Felipe, On 4/21/2017 10:26 AM, John Youn wrote: > On 04/18/2017 05:47 AM, Felipe Balbi wrote: >> >> Hi, >> >> Thinh Nguyen writes: >>>> (Thinh, for whatever I didn't receive your email via the list, replying >>>> to

[PATCH v2 1/2] usb: dwc3: gadget: Prevent losing events in event cache

2017-05-11 Thread Thinh Nguyen
tion delay in the SW. To avoid this issue, Check DWC3_EVENT_PENDING flag to determine if the events are processed in the bottom-half IRQ handler. If not, return IRQ_HANDLED and don't process new event. Cc: sta...@vger.kernel.org Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/gadget.c | 9 ++

[PATCH v2 2/2] usb: gadget: f_mass_storage: Serialize wake and sleep execution

2017-05-11 Thread Thinh Nguyen
order which the thread_wakeup_needed and bh->state are written and loaded. However, a better solution in the future would be to use wait_queue method that takes care of managing memory barrier between waker and waiter. Cc: sta...@vger.kernel.org Signed-off-by: Thinh Nguyen --- drivers/u

Re: [PATCH 1/3] usb: dwc3: gadget: Prevent losing events in event cache

2017-05-11 Thread Thinh Nguyen
Hi, On 5/11/2017 1:22 AM, Felipe Balbi wrote: > > Hi, > > John Youn writes: >> The device hangs at the end of the log. I repeated the test with USB 3.0 IP version 2.90a and USB 3.1 IP version 1.60, and I found the same result where the TH is occasionally called twice bac

Re: [PATCH 2/3] usb: dwc3: gadget: Fix early exit in set/clear ep halt

2017-05-11 Thread Thinh Nguyen
Hi Felipe, On 4/11/2017 11:03 PM, Felipe Balbi wrote: > > Hi, > > Thinh Nguyen writes: >>>>> Felipe Balbi writes: >>>>>> Thinh Nguyen writes: >>>>>>> This patch fixes a commit that causes a hang from device waiting for &g

Re: [PATCH v2 2/2] usb: gadget: f_mass_storage: Serialize wake and sleep execution

2017-05-18 Thread Thinh Nguyen
Hi Felipe, On 5/11/2017 5:27 PM, Thinh Nguyen wrote: > f_mass_storage has a memorry barrier issue with the sleep and wake > functions that can cause a deadlock. This results in intermittent hangs > during MSC file transfer. The host will reset the device after receiving > no respon

Re: [PATCH 2/3] usb: dwc3: gadget: Fix early exit in set/clear ep halt

2017-05-23 Thread Thinh Nguyen
Hi Felipe, On 5/11/2017 6:12 PM, Thinh Nguyen wrote: > On 4/11/2017 11:03 PM, Felipe Balbi wrote: >> Thinh Nguyen writes: >>>>>> Felipe Balbi writes: >>>>>>> Thinh Nguyen writes: >>>>>>>> This patch fixes a commit that cau

Re: [PATCH 2/3] usb: dwc3: gadget: Fix early exit in set/clear ep halt

2017-06-06 Thread Thinh Nguyen
Hi Felipe, On 6/4/2017 11:08 PM, Felipe Balbi wrote: > Paul Zimmerman writes: >> Forgot to CC linux-usb, doing that now >> >> On Fri, 2 Jun 2017 16:27:56 -0700, Paul Zimmerman wrote: >> >>> Felipe Balbi writes: >>>> Thinh Nguyen writes: >&g

Re: [PATCH 2/3] usb: dwc3: gadget: Fix early exit in set/clear ep halt

2017-06-12 Thread Thinh Nguyen
Hi Felipe, On 6/6/2017 11:52 AM, Thinh Nguyen wrote: > On 6/4/2017 11:08 PM, Felipe Balbi wrote: >> Paul Zimmerman writes: >>> Forgot to CC linux-usb, doing that now >>> >>> On Fri, 2 Jun 2017 16:27:56 -0700, Paul Zimmerman >>> wrote: >>>

Re: [PATCH 2/3] usb: dwc3: gadget: Fix early exit in set/clear ep halt

2017-06-13 Thread Thinh Nguyen
Hi, On 6/13/2017 12:32 AM, Felipe Balbi wrote: > Thinh Nguyen writes: >>>>>>>>>>>> this could be, I don't remember if I checked this or not :-) >>>>>>>>>>>> >>>>>>>>>>>> Really

Re: [PATCH] usb: dwc3: gadget: only unmap requests from DMA if mapped

2017-09-06 Thread Thinh Nguyen
Hi, On 6/29/2017 12:54 AM, Jack Pham wrote: > A recent optimization was made so that a request put on the > pending_list wouldn't get mapped for DMA until just before > preparing a TRB for it. However, this poses a problem in case > the request is dequeued or the endpoint is disabled before the >

Re: [PATCH] usb: dwc3: gadget: only unmap requests from DMA if mapped

2017-09-07 Thread Thinh Nguyen
Hi Felipe, On 9/7/2017 12:16 AM, Felipe Balbi wrote: drivers/usb/dwc3/gadget.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 9e41605a..6b299c7 100644 --- a/drivers/usb/dwc3/g

Re: [PATCH] usb: dwc3: gadget: only unmap requests from DMA if mapped

2017-09-08 Thread Thinh Nguyen
Hi, On 9/8/2017 2:34 AM, Felipe Balbi wrote: > Felipe Balbi writes: >> Thinh Nguyen writes: >> >>> Hi Felipe, >>> >>> On 9/7/2017 12:16 AM, Felipe Balbi wrote: >>>>>>> drivers/usb/dwc3/gadget.c | 8 +--- >>>>&

[PATCH] usb: dwc3: Set default mode for dwc_usb31

2018-07-26 Thread Thinh Nguyen
dwc_usb31 does not support OTG mode. If the controller supports DRD but the dr_mode is not specified or set to OTG, then set the mode to peripheral. Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/core.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/usb/dwc3/core.c b

Re: [PATCH] usb: dwc3: Set default mode for dwc_usb31

2018-07-26 Thread Thinh Nguyen
On 7/26/2018 2:32 PM, Andy Shevchenko wrote: > On Thu, Jul 26, 2018 at 11:52 PM, Thinh Nguyen > wrote: >> dwc_usb31 does not support OTG mode. If the controller supports DRD but >> the dr_mode is not specified or set to OTG, then set the mode to >> peripheral. >>

Re: [PATCH] usb: dwc3: Set default mode for dwc_usb31

2018-07-26 Thread Thinh Nguyen
On 7/26/2018 2:59 PM, Thinh Nguyen wrote: > On 7/26/2018 2:32 PM, Andy Shevchenko wrote: >> On Thu, Jul 26, 2018 at 11:52 PM, Thinh Nguyen >> wrote: >>> dwc_usb31 does not support OTG mode. If the controller supports DRD but >>> the dr_mode is not specified or

[PATCH 2/3] usb: dwc3: gadget: Don't skip updating remaining data

2018-07-27 Thread Thinh Nguyen
DWC3 must check for the BUFSIZ and update the req->remaining regardless of transfer alignment. Returning early from transfer OUT unalignment will skip updating the req->remaining. Fixes: c6267a51639b ("usb: dwc3: gadget: align transfers to wMaxPacketSize") Signed-off-

[PATCH 3/3] usb: dwc3: gadget: Return correct actual bytes written

2018-07-27 Thread Thinh Nguyen
: actual = round_up(expected_length, MaxPacketSize) - remaining_length Fixes: e62c5bc57367 ("usb: dwc3: gadget: tracking per-TRB remaining bytes") Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/gadget.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/driver

[PATCH 1/3] usb: dwc3: gadget: Check MaxPacketSize from descriptor

2018-07-27 Thread Thinh Nguyen
tent and use the MaxPacketSize from the endpoint's descriptor instead. Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/gadget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 69bf137aab37..032ea7d709ba 100644 --- a/driv

Re: [PATCH 2/3] usb: dwc3: gadget: Don't skip updating remaining data

2018-07-30 Thread Thinh Nguyen
Hi Felipe, On 7/29/2018 11:08 PM, Felipe Balbi wrote: > Thinh Nguyen writes: >> DWC3 must check for the BUFSIZ and update the req->remaining >> regardless of transfer alignment. Returning early from transfer OUT >> unalignment will skip updating the req->remaining

Re: [PATCH 2/3] usb: dwc3: gadget: Don't skip updating remaining data

2018-08-01 Thread Thinh Nguyen
Hi Felipe, On 8/1/2018 1:33 AM, Felipe Balbi wrote: > Felipe Balbi writes: > >> Hi, >> >> Felipe Balbi writes: >> >> >> This is an issue, but it's not the same one. irq/16-dwc3-5032 [003] d...65.404194: dwc3_complete_trb: ep1out: trb 890522d5 buf b

Re: [PATCH 2/3] usb: dwc3: gadget: Don't skip updating remaining data

2018-08-01 Thread Thinh Nguyen
On 8/1/2018 6:26 PM, Thinh Nguyen wrote: > Hi Felipe, > > > On 8/1/2018 1:33 AM, Felipe Balbi wrote: >> Felipe Balbi writes: >> >>> Hi, >>> >>> Felipe Balbi writes: >>> >>> >>> >>>>> This is an

[PATCH] usb: dwc3: gadget: Properly check last unaligned/zero chain TRB

2018-08-02 Thread Thinh Nguyen
ze") Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/gadget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 032ea7d709ba..c09e4f784810 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2

Re: [PATCH 2/3] usb: dwc3: gadget: Don't skip updating remaining data

2018-08-02 Thread Thinh Nguyen
On 8/2/2018 12:46 AM, Felipe Balbi wrote: > Hi, > > Thinh Nguyen writes: > > > >>> These patches will not fix the issue. >>> >> What do you think of this fix? >> >> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c >>

Re: g_audio regression on dwc3 udc

2018-08-10 Thread Thinh Nguyen
Hi Bin, On 8/10/2018 12:05 PM, Bin Liu wrote: > Hi Felipe, > > I noticed a regression on g_audio (uac2) with dwc3 udc on v4.14: > > - nosound in playback > - playback can only play once, the following error happens from the 2nd > playback > > aplay: set_params:1361: Unable to install hw params

Re: [PATCH 2/4] usb: dwc3: gadget: check if dep->frame_number is still valid

2018-08-20 Thread Thinh Nguyen
Hi Felipe, On 8/20/2018 3:34 AM, Felipe Balbi wrote: > Gadget driver may take an unbounded amount of time to queue requests > after XferNotReady. This is important for isochronous endpoints which > need to be started for a specific (micro-)frame. > > Before kicking the transfer, let's check if cur

Re: [PATCH 2/4] usb: dwc3: gadget: check if dep->frame_number is still valid

2018-08-23 Thread Thinh Nguyen
On 8/23/2018 3:15 AM, Felipe Balbi wrote: > Hi, > > Thinh Nguyen writes: >> On 8/20/2018 3:34 AM, Felipe Balbi wrote: >>> Gadget driver may take an unbounded amount of time to queue requests >>> after XferNotReady. This is important for isochronous endpoints w

[PATCH] usb: dwc3: gadget: Check ENBLSLPM before sending ep command

2018-09-11 Thread Thinh Nguyen
GUSB2PHYCFG.SUSPHY settings. Restore them after the command is completed. DWC_usb3 3.30a and DWC_usb31 1.90a programming guide section 3.2.2 Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/gadget.c | 29 +++-- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/drivers/usb

Re: [PATCH] usb: dwc3: gadget: Properly check last unaligned/zero chain TRB

2018-10-09 Thread Thinh Nguyen
Hi Felipe, On 8/2/2018 8:17 PM, Thinh Nguyen wrote: > Current check for the last extra TRB for zero and unaligned transfers > does not account for isoc OUT. The last TRB of the Buffer Descriptor for > isoc OUT transfers will be retired with HWO=0. As a result, we won't > retu

[PATCH 0/3] usb: dwc3: Introduce refclk lpm

2018-11-02 Thread Thinh Nguyen
This patch series introduce a new feature in DWC_usb31 with more aggressive low power management using reference clock. Thinh Nguyen (3): usb: dwc3: Add reference clock properties usb: dwc3: Set reference clock period usb: dwc3: Enable low power management using refclk Documentation

[PATCH 1/3] usb: dwc3: Add reference clock properties

2018-11-02 Thread Thinh Nguyen
eference clock. Both "snps,dis_u2_susphy_quirk" and "snps,dis_enblslpm_quirk" must not be set for this feature to be enabled. Signed-off-by: Thinh Nguyen --- Documentation/devicetree/bindings/usb/dwc3.txt | 18 ++ 1 file changed, 18 insertions(+) diff --git a/Do

[PATCH 2/3] usb: dwc3: Set reference clock period

2018-11-02 Thread Thinh Nguyen
Get the reference clock period from the device property and reprogram it during core power-on initialization. Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/core.c | 22 ++ drivers/usb/dwc3/core.h | 10 ++ 2 files changed, 32 insertions(+) diff --git a/drivers/usb

[PATCH 3/3] usb: dwc3: Enable low power management using refclk

2018-11-02 Thread Thinh Nguyen
Both "snps,dis_u2_susphy_quirk" and "snps,dis_enblslpm_quirk" must not be set for this feature to be enabled. Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/core.c | 12 drivers/usb/dwc3/core.h | 4 2 files changed, 16 insertions(+) diff --git a/drivers/usb/dwc3/co

[PATCH] usb: dwc3: debugfs: Dump internal states

2018-11-02 Thread Thinh Nguyen
user must specify a LSP register by writing to the debugfs attribute "internal_states" with the LSP number selection. Fixes: 80b776340c78 ("usb: dwc3: Dump LSP and BMU debug info") Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/core.h| 11 +++ drivers/usb/

[PATCH] usb: dwc3: Set default mode for DWC_usb3 v3.30a and higher

2018-11-02 Thread Thinh Nguyen
DWC_usb31 and DWC_usb3 v3.30a and higher do not support OTG mode. If the controller supports DRD but the dr_mode is not specified or set to OTG, then set the mode to peripheral. Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/core.c | 9 + drivers/usb/dwc3/core.h | 1 + 2 files changed

[PATCH 1/2] pci: pci_ids: Move Synopsys HAPS platform device IDs

2018-11-02 Thread Thinh Nguyen
Move Synopsys HAPS platform device IDs to pci_ids.h. Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/dwc3-haps.c | 4 include/linux/pci_ids.h | 3 +++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-haps.c b/drivers/usb/dwc3/dwc3-haps.c index

Re: [PATCH 1/2] pci: pci_ids: Move Synopsys HAPS platform device IDs

2018-11-05 Thread Thinh Nguyen
Hi Greg, On 11/2/2018 11:26 PM, Greg KH wrote: > On Fri, Nov 02, 2018 at 06:47:38PM -0700, Thinh Nguyen wrote: >> Move Synopsys HAPS platform device IDs to pci_ids.h. > Why? pci_ids.h, at the top of the file, says to not add new entries to > the file. Yes, I notice. However, I wa

Re: [PATCH 2/2] pci: quirks: Override Synopsys USB 3.x HAPS device driver

2018-11-05 Thread Thinh Nguyen
++ linux-usb ++ Greg On 11/2/2018 6:47 PM, Thinh Nguyen wrote: > Synopsys USB 3.x host HAPS platform has a class code of > PCI_CLASS_SERIAL_USB_XHCI, and xhci driver can claim it. However, these > devices should use dwc3-haps driver. Set driver_override to dwc3-haps > for the

Re: [PATCH] usb: dwc3: debugfs: Dump internal states

2018-11-05 Thread Thinh Nguyen
Hi Felipe, On 11/5/2018 4:16 AM, Felipe Balbi wrote: > Hi, > > Thinh Nguyen writes: >> +static void dwc3_dump_gadget_internal_states(struct seq_file *s) >> +{ >> +struct dwc3 *dwc = s->private; >> +int num_selects = 1

Re: [PATCH 2/8] usb: dwc3: gadget: combine unaligned and zero flags

2018-11-05 Thread Thinh Nguyen
On 11/4/2018 11:11 PM, Felipe Balbi wrote: > Both flags are used for the same purpose in dwc3: appending an extra > TRB at the end to deal with controller requirements. By combining both > flags into one, we make it clear that the situation is the same and > that they should be treated equally. > >

Re: [PATCH] usb: dwc3: debugfs: Dump internal states

2018-11-06 Thread Thinh Nguyen
Hi Felipe, On 11/5/2018 11:35 PM, Felipe Balbi wrote: > Hi, > > Thinh Nguyen writes: >>>> +static int dwc3_internal_states_show(struct seq_file *s, void *unused) >>>> +{ >>>> + struct dwc3 *dwc = s->private; >>>> +

Re: [PATCH 1/3] usb: dwc3: Add reference clock properties

2018-11-06 Thread Thinh Nguyen
Hi Felipe, On 11/6/2018 3:26 AM, Felipe Balbi wrote: > hi, > > Thinh Nguyen writes: >> Add two new device properties to program the reference clock period and >> to enable low power management using the reference clock. This allows a >> higher demand to go in low p

Re: [PATCH 1/3] usb: dwc3: Add reference clock properties

2018-11-07 Thread Thinh Nguyen
Hi Felipe, On 11/6/2018 10:37 PM, Felipe Balbi wrote: > Hi, > > Thinh Nguyen writes: >>> Thinh Nguyen writes: >>>> Add two new device properties to program the reference clock period and >>>> to enable low power management using the reference clock. Thi

[PATCH v2 0/5] usb: dwc3: debugfs: Add various updates

2018-11-07 Thread Thinh Nguyen
This patch series add various fixes to the debugfs printouts Thinh Nguyen (5): usb: dwc3: debugfs: Properly name Tx/RxFIFO usb: dwc3: debugfs: Print eps Tx/RxFIFO in bytes usb: dwc3: debugfs: Dump internal LSP and ep registers usb: dwc3: debugfs: Properly print/set link state for HS

[PATCH v2 1/5] usb: dwc3: debugfs: Properly name Tx/RxFIFO

2018-11-07 Thread Thinh Nguyen
The Tx/RxFIFO types in the GDBGFIFOSPACE.FIFO_QUEUE_SELECT are not queue. Properly rename them. Signed-off-by: Thinh Nguyen --- Change in v2: - New patch, no previous change drivers/usb/dwc3/core.h| 4 ++-- drivers/usb/dwc3/debugfs.c | 16 2 files changed, 10 insertions

[PATCH v2 2/5] usb: dwc3: debugfs: Print eps Tx/RxFIFO in bytes

2018-11-07 Thread Thinh Nguyen
TxFIFO and RxFIFO from GDBGFIFOSPACE are fifo depths in MDWIDTH. Convert them into bytes for easier read. Signed-off-by: Thinh Nguyen --- Change in v2: - New patch, no previous change drivers/usb/dwc3/debugfs.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/usb/dwc3

[PATCH v2 4/5] usb: dwc3: debugfs: Properly print/set link state for HS

2018-11-07 Thread Thinh Nguyen
Highspeed device and below has different state names than superspeed and higher. Add proper checks and printouts of link states for highspeed and below. Signed-off-by: Thinh Nguyen --- Change in v2: - New patch, no previous change drivers/usb/dwc3/debug.h | 29

[PATCH v2 3/5] usb: dwc3: debugfs: Dump internal LSP and ep registers

2018-11-07 Thread Thinh Nguyen
_dump". In host mode, the user has to write the LSP number to "lsp_dump" to dump a specific LSP selection. Fixes: 80b776340c78 ("usb: dwc3: Dump LSP and BMU debug info") Signed-off-by: Thinh Nguyen --- Change in v2: - Some cleanup and fix locking drivers/usb/dwc3/core.h

[PATCH v2 5/5] usb: dwc3: debugfs: Print/set link state for peripheral mode

2018-11-07 Thread Thinh Nguyen
Current implementation only prints/sets the link state for peripheral mode only. Check and prevent printing bogus link state if the current mode of operation is not peripheral. Signed-off-by: Thinh Nguyen --- Change in v2: - New patch, no previous change drivers/usb/dwc3/debugfs.c | 13

[PATCH 0/3] usb: dwc3: Misc USB2 LPM settings

2018-11-07 Thread Thinh Nguyen
This patch series adds miscellaneous USB2 LPM related settings Thinh Nguyen (3): usb: dwc3: Set GUSB2PHYCFG.ENBLSLPM usb: dwc3: Add a property to disable USB2 LPM usb: dwc3: Support option to disable USB2 LPM Documentation/devicetree/bindings/usb/dwc3.txt | 1 + drivers/usb/dwc3/core.c

[PATCH 3/3] usb: dwc3: Support option to disable USB2 LPM

2018-11-07 Thread Thinh Nguyen
Support the option to disable USB2 LPM. Set xhci "usb2-lpm-disable" property via "snps,usb2-lpm-disable" property. Signed-off-by: Thinh Nguyen --- drivers/usb/dwc3/core.c | 2 ++ drivers/usb/dwc3/core.h | 2 ++ drivers/usb/dwc3/host.c | 5 - 3 files changed, 8 inser

<    1   2   3   >