Re: dwc2 gadget issues

2017-02-28 Thread Vardan Mikayelyan
On 2/28/2017 3:44 PM, Francesco Lavra wrote: > Hi Vardan, > > On 02/28/2017 09:41 AM, Vardan Mikayelyan wrote: >> On 2/27/2017 11:55 PM, Francesco Lavra wrote: >>> Hi, >>> >>> On 02/23/2017 08:27 PM, Heiko Stuebner wrote: >>>> Hi Francesco, &

Re: dwc2 gadget issues

2017-02-28 Thread Vardan Mikayelyan
On 2/27/2017 11:55 PM, Francesco Lavra wrote: > Hi, > > On 02/23/2017 08:27 PM, Heiko Stuebner wrote: >> Hi Francesco, >> >> Am Donnerstag, 23. Februar 2017, 19:11:37 CET schrieb Francesco Lavra: >>> I'm having trouble getting the RK3288 OTG controller (the one at >>> ff58) to work in periphera

[PATCH] usb: dwc2: Fix dwc2_hsotg_core_init_disconnected()

2017-02-25 Thread Vardan Mikayelyan
switch to B-DEVICE. Signed-off-by: Vardan Mikayelyan --- drivers/usb/dwc2/gadget.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 98a4a79..9322f80 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb

[PATCH v2 05/14] usb: dwc2: core: Add hibernated flag

2017-02-23 Thread Vardan Mikayelyan
True if core is hibernated. Signed-off-by: Vardan Mikayelyan Signed-off-by: John Youn --- drivers/usb/dwc2/core.h | 2 ++ drivers/usb/dwc2/platform.c | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 60ad2e6..d84d0ce 100644 --- a

[PATCH v2 10/14] usb: dwc2: Add dwc2_enter_hibernation(), dwc2_exit_hibernation()

2017-02-23 Thread Vardan Mikayelyan
These are wrapper functions which are calling device or host enter/exit hibernation functions. Signed-off-by: Vardan Mikayelyan Signed-off-by: John Youn --- drivers/usb/dwc2/core.c | 38 ++ drivers/usb/dwc2/core.h | 3 +++ 2 files changed, 41 insertions

[PATCH v2 09/14] usb: dwc2: Add host/device hibernation functions

2017-02-23 Thread Vardan Mikayelyan
ation() dwc2_gadget_exit_hibernation() dwc2_host_enter_hibernation() dwc2_host_exit_hibernation() Signed-off-by: Vardan Mikayelyan Signed-off-by: John Youn --- drivers/usb/dwc2/core.c | 4 +- drivers/usb/dwc2/core.h | 18 drivers/usb/dwc2/gadget.c

[PATCH v2 06/14] usb: dwc2: gadget: Add remote_wakeup_allowed flag

2017-02-23 Thread Vardan Mikayelyan
signalling. Signed-off-by: Vardan Mikayelyan Signed-off-by: John Youn --- drivers/usb/dwc2/core.h | 3 +++ drivers/usb/dwc2/gadget.c | 6 ++ 2 files changed, 9 insertions(+) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index d84d0ce..ace383f 100644 --- a/drivers/usb/dwc2/core.h

[PATCH v2 08/14] usb: dwc2: Add helper functions for restore routine

2017-02-23 Thread Vardan Mikayelyan
Add common (host/device) helper functions, which will be called while exiting from hibernation, from both sides. dwc2_restore_essential_regs() dwc2_hib_restore_common() Signed-off-by: Vardan Mikayelyan Signed-off-by: John Youn --- drivers/usb/dwc2/core.c | 136

[PATCH v2 07/14] usb: dwc2: Changes in registers backup/restore functions

2017-02-23 Thread Vardan Mikayelyan
_registers() dwc2_restore_host_registers() dwc2_backup_global_registers() dwc2_restore_global_registers() Signed-off-by: Vardan Mikayelyan Signed-off-by: John Youn --- drivers/usb/dwc2/core.c | 8 ++-- drivers/usb/dwc2/core.h | 6 -- drivers/usb/dwc2/hcd.c | 2 ++ 3 files changed, 12 insertions(+), 4 deletion

[PATCH v2 04/14] usb: dwc2: gadget: Fix dwc2_restore_device_registers

2017-02-23 Thread Vardan Mikayelyan
function responsible for exiting from hibernation. Signed-off-by: Vardan Mikayelyan Signed-off-by: John Youn --- drivers/usb/dwc2/core.c | 2 +- drivers/usb/dwc2/core.h | 5 +++-- drivers/usb/dwc2/gadget.c | 16 +++- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git

[PATCH v2 02/14] usb: dwc2: Add hibernation field into dwc2_hw_params

2017-02-23 Thread Vardan Mikayelyan
Add parameter and it's initialization, needed for hibernation. Reimplement dwc2_set_param_power_down() to support hibernation too. Now 'power_down' parameter can be initialized with 0, 1 or 2. 0 - No 1 - Partial power down 2 - Hibernation Signed-off-by: Vardan Mikayelyan Sign

[PATCH v2 03/14] usb: dwc2: gadget: Moved dtxfsiz backup array place

2017-02-23 Thread Vardan Mikayelyan
Moved dtxfsiz from dwc2_gregs_backup to dwc2_dregs_backup, because it is device register. Signed-off-by: Vardan Mikayelyan Signed-off-by: John Youn --- drivers/usb/dwc2/core.c | 8 ++-- drivers/usb/dwc2/core.h | 4 ++-- drivers/usb/dwc2/gadget.c | 2 ++ 3 files changed, 6 insertions

[PATCH v2 11/14] usb: dwc2: Allow entering hibernation from USB_SUSPEND interrupt

2017-02-23 Thread Vardan Mikayelyan
Do changes to allow entering hibernated state from USB_SUSPEND interrupt. All code is added under if conditions and mustn't impact existing functionality. Signed-off-by: Vardan Mikayelyan Signed-off-by: John Youn --- drivers/usb/dwc2/core_intr.c

[PATCH v2 14/14] usb: dwc2: Enable power down

2017-02-23 Thread Vardan Mikayelyan
From: John Youn Enable the power down option based on the core capability. Signed-off-by: John Youn Signed-off-by: Vardan Mikayelyan --- drivers/usb/dwc2/params.c | 16 +++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2

[PATCH v2 12/14] usb: dwc2: Add dwc2_handle_gpwrdn_intr() handler

2017-02-23 Thread Vardan Mikayelyan
corresponing functions for host and gadget), maybe in the future we'll resolve this problem and will use dwc2_core_init for both sides. Signed-off-by: Vardan Mikayelyan Signed-off-by: John Youn --- drivers/usb/dwc2/core.h | 3 ++ drivers/usb/dwc2/core_intr.c

[PATCH v2 13/14] usb: dwc2: Change hub-control to allow hibernation

2017-02-23 Thread Vardan Mikayelyan
Affected cases: ClearPortFeature's USB_PORT_FEAT_SUSPEND SetPortFeature's USB_PORT_FEAT_SUSPEND USB_PORT_FEAT_RESET Signed-off-by: Vardan Mikayelyan Signed-off-by: John Youn --- drivers/usb/dwc2/hcd.c | 16 +--- 1 file changed, 13 insertions(+), 3 deletions(-) di

[PATCH v2 00/14] usb: dwc2: Add hibernation feature support.

2017-02-23 Thread Vardan Mikayelyan
: -remove "usb: dwc2: Replace msleep with mdelay in dwc2_clear_force_mode()" from this series because it is unnescessary after force mode optimizations. John Youn (1): usb: dwc2: Enable power down Vardan Mikayelyan (13): usb: dwc2: Rename hibernation to partial_power_down usb:

[PATCH v2 01/14] usb: dwc2: Rename hibernation to partial_power_down

2017-02-23 Thread Vardan Mikayelyan
No-op change, only rename. This code was misnamed originally. It was only responsible for partial power down and not for hibernation. Rename core_params->hibernation to core_params->power_down, dwc2_set_param_hibernation() to dwc2_set_param_power_down(). Signed-off-by: Vardan Mikayelyan

Re: [PATCH 15/15] usb: dwc2: Replace msleep with mdelay in dwc2_clear_force_mode()

2017-02-22 Thread Vardan Mikayelyan
On 2/22/2017 10:59 PM, John Youn wrote: > On 2/21/2017 5:16 AM, David Laight wrote: >> From: Vardan Mikayelyan >>> Sent: 20 February 2017 15:15 >>> dwc2_clear_force_mode() can be called in hibernation exit flow which >>> can occur in interrupt context. >

[PATCH 04/15] usb: dwc2: gadget: Fix dwc2_restore_device_registers

2017-02-20 Thread Vardan Mikayelyan
function responsible for exiting from hibernation. Signed-off-by: Vardan Mikayelyan Signed-off-by: John Youn --- drivers/usb/dwc2/core.c | 2 +- drivers/usb/dwc2/core.h | 5 +++-- drivers/usb/dwc2/gadget.c | 16 +++- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git

[PATCH 15/15] usb: dwc2: Replace msleep with mdelay in dwc2_clear_force_mode()

2017-02-20 Thread Vardan Mikayelyan
dwc2_clear_force_mode() can be called in hibernation exit flow which can occur in interrupt context. Signed-off-by: Vardan Mikayelyan --- drivers/usb/dwc2/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index 2c90d8e

[PATCH 13/15] usb: dwc2: Change hub-control to allow hibernation

2017-02-20 Thread Vardan Mikayelyan
Affected cases: ClearPortFeature's USB_PORT_FEAT_SUSPEND SetPortFeature's USB_PORT_FEAT_SUSPEND USB_PORT_FEAT_RESET Signed-off-by: Vardan Mikayelyan Signed-off-by: John Youn --- drivers/usb/dwc2/hcd.c | 16 +--- 1 file changed, 13 insertions(+), 3 deletions(-) di

[PATCH 12/15] usb: dwc2: Add dwc2_handle_gpwrdn_intr() handler

2017-02-20 Thread Vardan Mikayelyan
corresponing functions for host and gadget), maybe in the future we'll resolve this problem and will use dwc2_core_init for both sides. Signed-off-by: Vardan Mikayelyan Signed-off-by: John Youn --- drivers/usb/dwc2/core.h | 3 ++ drivers/usb/dwc2/core_intr.c

[PATCH 14/15] usb: dwc2: Enable power down

2017-02-20 Thread Vardan Mikayelyan
From: John Youn Enable the power down option based on the core capability. Signed-off-by: John Youn Signed-off-by: Vardan Mikayelyan --- drivers/usb/dwc2/params.c | 16 +++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2

[PATCH 01/15] usb: dwc2: Rename hibernation to partial_power_down

2017-02-20 Thread Vardan Mikayelyan
No-op change, only rename. This code was misnamed originally. It was only responsible for partial power down and not for hibernation. Rename core_params->hibernation to core_params->power_down, dwc2_set_param_hibernation() to dwc2_set_param_power_down(). Signed-off-by: Vardan Mikayelyan

[PATCH 02/15] usb: dwc2: Add hibernation field into dwc2_hw_params

2017-02-20 Thread Vardan Mikayelyan
Add parameter and it's initialization, needed for hibernation. Reimplement dwc2_set_param_power_down() to support hibernation too. Now 'power_down' parameter can be initialized with 0, 1 or 2. 0 - No 1 - Partial power down 2 - Hibernation Signed-off-by: Vardan Mikayelyan Sign

[PATCH 10/15] usb: dwc2: Add dwc2_enter_hibernation(), dwc2_exit_hibernation()

2017-02-20 Thread Vardan Mikayelyan
These are wrapper functions which are calling device or host enter/exit hibernation functions. Signed-off-by: Vardan Mikayelyan Signed-off-by: John Youn --- drivers/usb/dwc2/core.c | 38 ++ drivers/usb/dwc2/core.h | 3 +++ 2 files changed, 41 insertions

[PATCH 11/15] usb: dwc2: Allow entering hibernation from USB_SUSPEND interrupt

2017-02-20 Thread Vardan Mikayelyan
Do changes to allow entering hibernated state from USB_SUSPEND interrupt. All code is added under if conditions and mustn't impact existing functionality. Signed-off-by: Vardan Mikayelyan Signed-off-by: John Youn --- drivers/usb/dwc2/core_intr.c

[PATCH 00/15] usb: dwc2: Add hibernation support.

2017-02-20 Thread Vardan Mikayelyan
): usb: dwc2: Enable power down Vardan Mikayelyan (14): 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

[PATCH 06/15] usb: dwc2: gadget: Add remote_wakeup_allowed flag

2017-02-20 Thread Vardan Mikayelyan
signalling. Signed-off-by: Vardan Mikayelyan Signed-off-by: John Youn --- drivers/usb/dwc2/core.h | 3 +++ drivers/usb/dwc2/gadget.c | 6 ++ 2 files changed, 9 insertions(+) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index d84d0ce..ace383f 100644 --- a/drivers/usb/dwc2/core.h

[PATCH 07/15] usb: dwc2: Changes in registers backup/restore functions

2017-02-20 Thread Vardan Mikayelyan
_registers() dwc2_restore_host_registers() dwc2_backup_global_registers() dwc2_restore_global_registers() Signed-off-by: Vardan Mikayelyan Signed-off-by: John Youn --- drivers/usb/dwc2/core.c | 8 ++-- drivers/usb/dwc2/core.h | 6 -- drivers/usb/dwc2/hcd.c | 2 ++ 3 files changed, 12 insertions(+), 4 deletion

[PATCH 08/15] usb: dwc2: Add helper functions for restore routine

2017-02-20 Thread Vardan Mikayelyan
Add common (host/device) helper functions, which will be called while exiting from hibernation, from both sides. dwc2_restore_essential_regs() dwc2_hib_restore_common() Signed-off-by: Vardan Mikayelyan Signed-off-by: John Youn --- drivers/usb/dwc2/core.c | 136

[PATCH 05/15] usb: dwc2: core: Add hibernated flag

2017-02-20 Thread Vardan Mikayelyan
True if core is hibernated. Signed-off-by: Vardan Mikayelyan Signed-off-by: John Youn --- drivers/usb/dwc2/core.h | 2 ++ drivers/usb/dwc2/platform.c | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 60ad2e6..d84d0ce 100644 --- a

[PATCH 09/15] usb: dwc2: Add host/device hibernation functions

2017-02-20 Thread Vardan Mikayelyan
ation() dwc2_gadget_exit_hibernation() dwc2_host_enter_hibernation() dwc2_host_exit_hibernation() Signed-off-by: Vardan Mikayelyan Signed-off-by: John Youn --- drivers/usb/dwc2/core.c | 4 +- drivers/usb/dwc2/core.h | 18 drivers/usb/dwc2/gadget.c

[PATCH 03/15] usb: dwc2: gadget: Moved dtxfsiz backup array place

2017-02-20 Thread Vardan Mikayelyan
Moved dtxfsiz from dwc2_gregs_backup to dwc2_dregs_backup, because it is device register. Signed-off-by: Vardan Mikayelyan Signed-off-by: John Youn --- drivers/usb/dwc2/core.c | 8 ++-- drivers/usb/dwc2/core.h | 4 ++-- drivers/usb/dwc2/gadget.c | 2 ++ 3 files changed, 6 insertions

[PATCH v2] usb: dwc2: pci: Fix error handling in dwc2_pci_probe

2017-02-17 Thread Vardan Mikayelyan
avoid calling of platform_device_unregister(). Reviewed-by: Wei Yongjun Signed-off-by: Vardan Mikayelyan --- Changes in v2: - Remove kfree(glue) as suggested Janusz Dziedzic. drivers/usb/dwc2/pci.c | 27 +-- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git

[PATCH] usb: dwc2: pci: Fix error handling in dwc2_pci_probe

2017-02-17 Thread Vardan Mikayelyan
avoid calling of platform_device_unregister(). Reviewed-by: Wei Yongjun Signed-off-by: Vardan Mikayelyan --- drivers/usb/dwc2/pci.c | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/usb/dwc2/pci.c b/drivers/usb/dwc2/pci.c index fdeb8c7

Re: [PATCH -next] usb: dwc2: Fix the error handling of dwc2_pci_probe()

2017-02-13 Thread Vardan Mikayelyan
wc2_pci_probe Move usb_phy_generic_register() function call to the top, to simplify error handling. Replace kzalloc() with devm_kzalloc(). After platform_device_add(), if we error out, we must do platform_device_unregister(), which also does the put. So lets move devm_kzalloc() to simplify err

Re: [REGRESSION] dwc2: 5f54c54b0ba8 Add DDMA chain pointers to dwc2_hsotg_ep structure

2016-12-14 Thread Vardan Mikayelyan
On 12/14/2016 6:25 AM, John Stultz wrote: > On Tue, Dec 13, 2016 at 3:51 PM, John Youn wrote: >> On 12/13/2016 3:23 PM, John Stultz wrote: >>> I've found trying to boot Linus' HEAD today on HiKey, I'm hitting the >>> following WARNINGS/panics, which I bisected down to being introduced >>> with 5f5

Re: [RFC][PATCH 2/5] usb: dwc2: Workaround case where GOTGCTL state is wrong

2016-12-13 Thread Vardan Mikayelyan
usleep_range(2, 4); > + gotgctl = dwc2_readl(hsotg->regs + GOTGCTL); > + if (!(gotgctl & GOTGCTL_CONID_B)) > + goto again; > if (++count > 250) >