[PATCH] usb: gadget: uvc: fix permissions of configfs attributes

2015-11-28 Thread Mian Yousaf Kaukab
76e0da3 "usb-gadget/uvc: use per-attribute show and store methods" removed write permission for writeable attributes. Correct attribute permissions. Fixes: 76e0da3 "usb-gadget/uvc: use per-attribute show and store methods" Signed-off-by: Mian Yousaf Kaukab --- drivers

[PATCH] usb: gadget: net2280: restore ep_cfg after defect7374 workaround

2015-10-19 Thread Mian Yousaf Kaukab
Defect 7374 workaround enables all GPEP as endpoint 0. Restore endpoint number when defect 7374 workaround is disabled. Otherwise, check to match USB endpoint number to hardware endpoint number in net2280_enable() fails. Cc: # 4.2 Reported-by: Paul Jones Signed-off-by: Mian Yousaf Kaukab

[PATCH] usb: dwc2: fix duplicate argument warning

2015-10-12 Thread Mian Yousaf Kaukab
Fix a duplicate argument warning reported by 0-DAY kernel test infrastructure in the following patch: 77dbf71 usb: dwc2: host: add disconnect interrupt to host only interrupts Signed-off-by: Mian Yousaf Kaukab --- drivers/usb/dwc2/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions

[PATCH v4 32/32] usb: dwc2: exit hibernation on session request

2015-09-30 Thread Mian Yousaf Kaukab
-by: Mian Yousaf Kaukab Signed-off-by: Gregory Herrero Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2/core_intr.c | 22 +- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/usb/dwc2

[PATCH v4 22/32] usb: dwc2: gadget: set op_state in vbus_session call

2015-09-30 Thread Mian Yousaf Kaukab
From: Gregory Herrero Some device may have external id pin control enabled, so op_state will not be set on id pin interrupt change. Thus, ensure op_state is set to peripheral during vbus detection. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga

[PATCH v4 31/32] usb: dwc2: gadget: handle reset interrupt before endpoint interrupts

2015-09-30 Thread Mian Yousaf Kaukab
n any other endpoint interrupts. Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2/gadget.c | 60 +++ 1 file changed, 30 insertions(+), 30 deletions(-) diff

[PATCH v4 29/32] usb: dwc2: gadget: unmask idstschng interrupt only if controller supports it

2015-09-30 Thread Mian Yousaf Kaukab
From: Gregory Herrero idstschng interrupt should not be used when id pin control is external. This is already handled on dwc2 host part. Fix it on gadget part as well. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by

[PATCH v4 27/32] usb: dwc2: gadget: kill ep0 requests before reinitializing core

2015-09-30 Thread Mian Yousaf Kaukab
eld. Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2/gadget.c | 8 +++- drivers/usb/dwc2/hcd.c| 3 +++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/usb/dwc2/gadge

[PATCH v4 28/32] usb: dwc2: gadget: only reset core after addressed state

2015-09-30 Thread Mian Yousaf Kaukab
There is a 200ms guard period to avoid unnecessary resets of the dwc2 ip. This delay sometimes prove to be too large when usbcv is run with an ehci host. dwc2 only needs to be reset after addressed state. Change the logic to reset ip after addressed state. Signed-off-by: Mian Yousaf Kaukab

[PATCH v4 24/32] usb: dwc2: gadget: ignore stall check for ep0

2015-09-30 Thread Mian Yousaf Kaukab
dwc2_hsotg_start_req starts a request only if endpoint is not stalled. Ignore this check for ep0 as core will clear DOEPCTL0.Stall after sending stall handshake. Prepare instead for receiving next setup packet. Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen

[PATCH v4 25/32] usb: dwc2: gadget: print complete setup packet

2015-09-30 Thread Mian Yousaf Kaukab
wIndex field was missing. Also print in natural order instead of Req first, so that its easier to compare for example against bus analyzer logs. Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2

[PATCH v4 26/32] usb: dwc2: gadget: stop current transfer on dequeue

2015-09-30 Thread Mian Yousaf Kaukab
If the request being dequeued is already started, disable endpoint to stop the transfer and then call dwc2_hsotg_complete_request(). Endpoint will be re-enabled on next call to dwc2_hsotg_start_req(). Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by

[PATCH v4 30/32] usb: dwc2: gadget: exit hibernation before power down

2015-09-30 Thread Mian Yousaf Kaukab
: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2/gadget.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2

[PATCH v4 23/32] usb: dwc2: gadget: abort core init if core_reset fails

2015-09-30 Thread Mian Yousaf Kaukab
From: Gregory Herrero No point of continue with initialization if core is not in a sane state. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2/gadget.c | 3

[PATCH v4 19/32] usb: dwc2: gadget: initialize op_state for peripheral only configuration

2015-09-30 Thread Mian Yousaf Kaukab
ID status change interrupt will not be handled in peripheral only configuration. So initialize op_state during gadget init. Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2/gadget.c | 2 ++ 1

[PATCH v4 20/32] usb: dwc2: force dr_mode in case of configuration mismatch

2015-09-30 Thread Mian Yousaf Kaukab
If dual role configuration is not selected, check and force dr_mode based on the selected configuration. Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2/platform.c | 11 +++ 1 file

[PATCH v4 17/32] usb: dwc2: host: kill remaining urbs using -ECONNRESET status

2015-09-30 Thread Mian Yousaf Kaukab
urbs. To avoid this return urb with -ECONNRESET status This issue usually happens while removing mass storage device during transfer. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- d

[PATCH v4 21/32] usb: dwc2: gadget: don't modify pullup state in host mode

2015-09-30 Thread Mian Yousaf Kaukab
From: Gregory Herrero Modifying the pullup state during host mode trig a new enumeration of attached device. Thus, avoid modifying pullup in host mode. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn

[PATCH v4 16/32] usb: dwc2: host: use correct frame number during qh init

2015-09-30 Thread Mian Yousaf Kaukab
From: Gregory Herrero On first qh initialization, hsotg->frame_number is not corresponding to reality. So read it from host controller to get correct value. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Y

[PATCH v4 18/32] usb: dwc2: gadget: ensure lx_state corresponds to current state

2015-09-30 Thread Mian Yousaf Kaukab
: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2/gadget.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2

[PATCH v4 12/32] usb: dwc2: host: disable interrupt during stop

2015-09-30 Thread Mian Yousaf Kaukab
From: Gregory Herrero Disable host interrupts before synchronising dwc2 irq. So that interrupts are not generated once controller is stopped. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by

[PATCH v4 15/32] usb: dwc2: host: correctly dump urb isochronous descriptors

2015-09-30 Thread Mian Yousaf Kaukab
From: Gregory Herrero Print urb->iso_frame_desc.status after it has been updated using dwc2_hcd_urb_get_iso_desc_status(). Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Y

[PATCH v4 14/32] usb: dwc2: host: wait 3ms for controller stabilization

2015-09-30 Thread Mian Yousaf Kaukab
: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2/hcd.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index 844bf83..30dc21d 100644 --- a

[PATCH v4 13/32] usb: dwc2: host: clear pending interrupts prior hibernation

2015-09-30 Thread Mian Yousaf Kaukab
controller interrupts before hibernation entry. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2/core.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a

[PATCH v4 09/32] usb: dwc2: host: reset frame number after suspend

2015-09-30 Thread Mian Yousaf Kaukab
of transfers until frame number reaches qh->sched_frame. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2/core.c | 1 + drivers/usb/dwc2/hcd_queue.c | 7

[PATCH v4 11/32] usb: dwc2: host: add disconnect interrupt to host only interrupts

2015-09-30 Thread Mian Yousaf Kaukab
GINTSTS.DisconnInt is host only interrupt and should be disable after dwc2_disable_host_interrupts is called. Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2/core.c | 5 +++-- 1 file changed, 3

[PATCH v4 08/32] usb: dwc2: host: resume only if bus is suspended

2015-09-30 Thread Mian Yousaf Kaukab
From: Gregory Herrero Port can be resumed in bus_resume callback. In this case, there is no need to drive resume a second time when hcd ask for it. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked

[PATCH v4 10/32] usb: dwc2: host: disconnect hcd prior stopping it

2015-09-30 Thread Mian Yousaf Kaukab
From: Gregory Herrero In case controller is asked to stop while devices are connected, disconnect all devices and clean up before stopping. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John

[PATCH v4 03/32] usb: dwc2: host: add flag to reflect bus state

2015-09-30 Thread Mian Yousaf Kaukab
From: Gregory Herrero lx_state must be used to reflect controller power state only and not bus state. Thus add a flag to track state during bus suspend. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn

[PATCH v4 01/32] usb: dwc2: host: don't clear hprt0 status bits when exiting hibernation

2015-09-30 Thread Mian Yousaf Kaukab
From: Gregory Herrero When entering hibernation hprt0 must be read using dwc2_read_hprt0(). Otherwise, any set hprt0 status bits will be cleared when restoring hprt0 on exit from hibernation. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by

[PATCH v4 00/32] usb: dwc2: various bug fixes

2015-09-30 Thread Mian Yousaf Kaukab
c2: gadget: don't modify pullup state in host mode usb: dwc2: gadget: set op_state in vbus_session call usb: dwc2: gadget: abort core init if core_reset fails usb: dwc2: gadget: unmask idstschng interrupt only if controller supports it usb: dwc2: gadget: exit hibernation before power

[PATCH v4 02/32] usb: dwc2: host: create a function to handle port_resume

2015-09-30 Thread Mian Yousaf Kaukab
ites, read hprt0 again. Since the phy clock is stopped in dwc2_port_suspend(), enable it here and remove the PCGCTL write from dwc2_hcd_hub_control() Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by:

[PATCH v4 04/32] usb: dwc2: host: enter hibernation during bus suspend

2015-09-30 Thread Mian Yousaf Kaukab
detects bus activity, it must call usb_hcd_resume_root_hub. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2/hcd.c | 140

[PATCH v4 06/32] usb: dwc2: host: avoid resetting lx_state to L3 during disconnect

2015-09-30 Thread Mian Yousaf Kaukab
From: Gregory Herrero When a device is disconnected, lx_state must not be changed since the device may be disconnected whereas controller is still powered. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn

[PATCH v4 07/32] usb: dwc2: host: ignore wakeup interrupt if hibernation supported

2015-09-30 Thread Mian Yousaf Kaukab
From: Gregory Herrero If hibernation is supported, resume of devices will be handled in bus_resume callback. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2

[PATCH v4 05/32] usb: dwc2: host: update hcd and lx_state during start/stop callbacks

2015-09-30 Thread Mian Yousaf Kaukab
From: Gregory Herrero During hcd initialization, hardware accessible flag and lx_state must be reset to the working state since controller is powered at this stage. Same logic applied for stop callback. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert

[PATCH v1 Resend] usb: dwc2: gadget: fix a memory use-after-free bug

2015-09-29 Thread Mian Yousaf Kaukab
From: Yunzhi Li When dwc2_hsotg_handle_unaligned_buf_complete() hs_req->req.buf already destroyed, in dwc2_hsotg_unmap_dma(), it touches hs_req->req.dma again, so dwc2_hsotg_unmap_dma() should be called before dwc2_hsotg_handle_unaligned_buf_complete(). Otherwise, it will cause a bad_page BUG, wh

[PATCH v3 32/32] usb: dwc2: exit hibernation on session request

2015-09-29 Thread Mian Yousaf Kaukab
-by: Mian Yousaf Kaukab Signed-off-by: Gregory Herrero Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2/core_intr.c | 22 +- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/usb/dwc2

[PATCH v3 21/32] usb: dwc2: gadget: don't modify pullup state in host mode

2015-09-29 Thread Mian Yousaf Kaukab
From: Gregory Herrero Modifying the pullup state during host mode trig a new enumeration of attached device. Thus, avoid modifying pullup in host mode. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn

[PATCH v3 19/32] usb: dwc2: gadget: initialize op_state for peripheral only configuration

2015-09-29 Thread Mian Yousaf Kaukab
ID status change interrupt will not be handled in peripheral only configuration. So initialize op_state during gadget init. Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2/gadget.c | 2 ++ 1

[PATCH v3 23/32] usb: dwc2: gadget: abort core init if core_reset fails

2015-09-29 Thread Mian Yousaf Kaukab
From: Gregory Herrero No point of continue with initialization if core is not in a sane state. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2/gadget.c | 3

[PATCH v3 22/32] usb: dwc2: gadget: set op_state in vbus_session call

2015-09-29 Thread Mian Yousaf Kaukab
From: Gregory Herrero Some device may have external id pin control enabled, so op_state will not be set on id pin interrupt change. Thus, ensure op_state is set to peripheral during vbus detection. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga

[PATCH v3 31/32] usb: dwc2: gadget: handle reset interrupt before endpoint interrupts

2015-09-29 Thread Mian Yousaf Kaukab
n any other endpoint interrupts. Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2/gadget.c | 60 +++ 1 file changed, 30 insertions(+), 30 deletions(-) diff

[PATCH v3 28/32] usb: dwc2: gadget: only reset core after addressed state

2015-09-29 Thread Mian Yousaf Kaukab
There is a 200ms guard period to avoid unnecessary resets of the dwc2 ip. This delay sometimes prove to be too large when usbcv is run with an ehci host. dwc2 only needs to be reset after addressed state. Change the logic to reset ip after addressed state. Signed-off-by: Mian Yousaf Kaukab

[PATCH v3 25/32] usb: dwc2: gadget: print complete setup packet

2015-09-29 Thread Mian Yousaf Kaukab
wIndex field was missing. Also print in natural order instead of Req first, so that its easier to compare for example against bus analyzer logs. Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2

[PATCH v3 26/32] usb: dwc2: gadget: stop current transfer on dequeue

2015-09-29 Thread Mian Yousaf Kaukab
If the request being dequeued is already started, disable endpoint to stop the transfer and then call dwc2_hsotg_complete_request(). Endpoint will be re-enabled on next call to dwc2_hsotg_start_req(). Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by

[PATCH v3 24/32] usb: dwc2: gadget: ignore stall check for ep0

2015-09-29 Thread Mian Yousaf Kaukab
dwc2_hsotg_start_req starts a request only if endpoint is not stalled. Ignore this check for ep0 as core will clear DOEPCTL0.Stall after sending stall handshake. Prepare instead for receiving next setup packet. Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen

[PATCH v3 20/32] usb: dwc2: force dr_mode in case of configuration mismatch

2015-09-29 Thread Mian Yousaf Kaukab
If dual role configuration is not selected, check and force dr_mode based on the selected configuration. Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2/platform.c | 11 +++ 1 file

[PATCH v3 30/32] usb: dwc2: gadget: exit hibernation before power down

2015-09-29 Thread Mian Yousaf Kaukab
: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2/gadget.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2

[PATCH v3 29/32] usb: dwc2: gadget: unmask idstschng interrupt only if controller supports it

2015-09-29 Thread Mian Yousaf Kaukab
From: Gregory Herrero idstschng interrupt should not be used when id pin control is external. This is already handled on dwc2 host part. Fix it on gadget part as well. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by

[PATCH v3 27/32] usb: dwc2: gadget: kill ep0 requests before reinitializing core

2015-09-29 Thread Mian Yousaf Kaukab
eld. Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2/gadget.c | 8 +++- drivers/usb/dwc2/hcd.c| 3 +++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/usb/dwc2/gadge

[PATCH v3 15/32] usb: dwc2: host: correctly dump urb isochronous descriptors

2015-09-29 Thread Mian Yousaf Kaukab
From: Gregory Herrero Print urb->iso_frame_desc.status after it has been updated using dwc2_hcd_urb_get_iso_desc_status(). Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Y

[PATCH v3 13/32] usb: dwc2: host: clear pending interrupts prior hibernation

2015-09-29 Thread Mian Yousaf Kaukab
controller interrupts before hibernation entry. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2/core.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a

[PATCH v3 14/32] usb: dwc2: host: wait 3ms for controller stabilization

2015-09-29 Thread Mian Yousaf Kaukab
: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2/hcd.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index de9d2e2..65044da 100644 --- a

[PATCH v3 10/32] usb: dwc2: host: disconnect hcd prior stopping it

2015-09-29 Thread Mian Yousaf Kaukab
From: Gregory Herrero In case controller is asked to stop while devices are connected, disconnect all devices and clean up before stopping. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John

[PATCH v3 08/32] usb: dwc2: host: resume only if bus is suspended

2015-09-29 Thread Mian Yousaf Kaukab
From: Gregory Herrero Port can be resumed in bus_resume callback. In this case, there is no need to drive resume a second time when hcd ask for it. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked

[PATCH v3 18/32] usb: dwc2: gadget: ensure lx_state corresponds to current state

2015-09-29 Thread Mian Yousaf Kaukab
: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2/gadget.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2

[PATCH v3 09/32] usb: dwc2: host: reset frame number after suspend

2015-09-29 Thread Mian Yousaf Kaukab
of transfers until frame number reaches qh->sched_frame. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2/core.c | 1 + drivers/usb/dwc2/hcd_queue.c | 8 +

[PATCH v3 16/32] usb: dwc2: host: use correct frame number during qh init

2015-09-29 Thread Mian Yousaf Kaukab
From: Gregory Herrero On first qh initialization, hsotg->frame_number is not corresponding to reality. So read it from host controller to get correct value. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Y

[PATCH v3 12/32] usb: dwc2: host: disable interrupt during stop

2015-09-29 Thread Mian Yousaf Kaukab
From: Gregory Herrero Disable host interrupts before synchronising dwc2 irq. So that interrupts are not generated once controller is stopped. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by

[PATCH v3 17/32] usb: dwc2: host: kill remaining urbs using -ECONNRESET status

2015-09-29 Thread Mian Yousaf Kaukab
urbs. To avoid this return urb with -ECONNRESET status This issue usually happens while removing mass storage device during transfer. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- d

[PATCH v3 11/32] usb: dwc2: host: add disconnect interrupt to host only interrupts

2015-09-29 Thread Mian Yousaf Kaukab
GINTSTS.DisconnInt is host only interrupt and should be disable after dwc2_disable_host_interrupts is called. Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2/core.c | 5 +++-- 1 file changed, 3

[PATCH v3 07/32] usb: dwc2: host: ignore wakeup interrupt if hibernation supported

2015-09-29 Thread Mian Yousaf Kaukab
From: Gregory Herrero If hibernation is supported, resume of devices will be handled in bus_resume callback. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2

[PATCH v3 01/32] usb: dwc2: host: don't clear hprt0 status bits when exiting hibernation

2015-09-29 Thread Mian Yousaf Kaukab
From: Gregory Herrero When entering hibernation hprt0 must be read using dwc2_read_hprt0(). Otherwise, any set hprt0 status bits will be cleared when restoring hprt0 on exit from hibernation. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by

[PATCH v3 05/32] usb: dwc2: host: update hcd and lx_state during start/stop callbacks

2015-09-29 Thread Mian Yousaf Kaukab
From: Gregory Herrero During hcd initialization, hardware accessible flag and lx_state must be reset to the working state since controller is powered at this stage. Same logic applied for stop callback. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert

[PATCH v3 06/32] usb: dwc2: host: avoid resetting lx_state to L3 during disconnect

2015-09-29 Thread Mian Yousaf Kaukab
From: Gregory Herrero When a device is disconnected, lx_state must not be changed since the device may be disconnected whereas controller is still powered. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn

[PATCH v3 04/32] usb: dwc2: host: enter hibernation during bus suspend

2015-09-29 Thread Mian Yousaf Kaukab
detects bus activity, it must call usb_hcd_resume_root_hub. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by: John Youn --- drivers/usb/dwc2/hcd.c | 140

[PATCH v3 00/32] usb: dwc2: various bug fixes

2015-09-29 Thread Mian Yousaf Kaukab
supports it usb: dwc2: gadget: exit hibernation before power down Mian Yousaf Kaukab (10): usb: dwc2: host: add disconnect interrupt to host only interrupts usb: dwc2: gadget: initialize op_state for peripheral only configuration usb: dwc2: force dr_mode in case of configuration mismatch

[PATCH v3 03/32] usb: dwc2: host: add flag to reflect bus state

2015-09-29 Thread Mian Yousaf Kaukab
From: Gregory Herrero lx_state must be used to reflect controller power state only and not bus state. Thus add a flag to track state during bus suspend. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn

[PATCH v3 02/32] usb: dwc2: host: create a function to handle port_resume

2015-09-29 Thread Mian Yousaf Kaukab
ites, read hprt0 again. Since the phy clock is stopped in dwc2_port_suspend(), enable it here and remove the PCGCTL write from dwc2_hcd_hub_control() Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga Tested-by: Dinh Nguyen Tested-by: John Youn Acked-by:

[PATCH v2] media: uvcvideo: handle urb completion in a tasklet

2015-09-23 Thread Mian Yousaf Kaukab
ist. Moreover, save timestamp and sof number in the urb completion callback to avoid any delays. Signed-off-by: Mian Yousaf Kaukab --- [Rename from media: uvcvideo: handle urb completion in a work queue] History: v2: - Change to use tasklet instead of workqueue - Don't use local tasklet i

[PATCH v2 32/32] usb: dwc2: exit hibernation on session request

2015-09-22 Thread Mian Yousaf Kaukab
-by: Mian Yousaf Kaukab Signed-off-by: Gregory Herrero Tested-by: Robert Baldyga --- drivers/usb/dwc2/core_intr.c | 22 +- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c index d8a5400..27daa42 100644

[PATCH v2 31/32] usb: dwc2: gadget: handle reset interrupt before endpoint interrupts

2015-09-22 Thread Mian Yousaf Kaukab
n any other endpoint interrupts. Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga --- drivers/usb/dwc2/gadget.c | 60 +++ 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c

[PATCH v2 17/32] usb: dwc2: host: kill remaining urbs using -ECONNRESET status

2015-09-22 Thread Mian Yousaf Kaukab
urbs. To avoid this return urb with -ECONNRESET status This issue usually happens while removing mass storage device during transfer. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga --- drivers/usb/dwc2/hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deleti

[PATCH v2 23/32] usb: dwc2: gadget: abort core init if core_reset fails

2015-09-22 Thread Mian Yousaf Kaukab
From: Gregory Herrero No point of continue with initialization if core is not in a sane state. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga --- drivers/usb/dwc2/gadget.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a

[PATCH v2 27/32] usb: dwc2: gadget: kill ep0 requests before reinitializing core

2015-09-22 Thread Mian Yousaf Kaukab
eld. Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga --- drivers/usb/dwc2/gadget.c | 8 +++- drivers/usb/dwc2/hcd.c| 3 +++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 97bf696..1697eec 100644 --

[PATCH v2 29/32] usb: dwc2: gadget: unmask idstschng interrupt only if controller supports it

2015-09-22 Thread Mian Yousaf Kaukab
From: Gregory Herrero idstschng interrupt should not be used when id pin control is external. This is already handled on dwc2 host part. Fix it on gadget part as well. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga --- drivers/usb/dwc2/gadget.c

[PATCH v2 26/32] usb: dwc2: gadget: stop current transfer on dequeue

2015-09-22 Thread Mian Yousaf Kaukab
If the request being dequeued is already started, disable endpoint to stop the transfer and then call dwc2_hsotg_complete_request(). Endpoint will be re-enabled on next call to dwc2_hsotg_start_req(). Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga --- drivers/usb/dwc2/gadget.c

[PATCH v2 30/32] usb: dwc2: gadget: exit hibernation before power down

2015-09-22 Thread Mian Yousaf Kaukab
: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga --- drivers/usb/dwc2/gadget.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 229dccd..a62224a 100644 --- a/drivers/usb/dwc2

[PATCH v2 25/32] usb: dwc2: gadget: print complete setup packet

2015-09-22 Thread Mian Yousaf Kaukab
wIndex field was missing. Also print in natural order instead of Req first, so that its easier to compare for example against bus analyzer logs. Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga --- drivers/usb/dwc2/gadget.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions

[PATCH v2 18/32] usb: dwc2: gadget: ensure lx_state corresponds to current state

2015-09-22 Thread Mian Yousaf Kaukab
: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga --- drivers/usb/dwc2/gadget.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index ddd14a7..ddb5427 100644 --- a/drivers/usb/dwc2

[PATCH v2 19/32] usb: dwc2: gadget: initialize op_state for peripheral only configuration

2015-09-22 Thread Mian Yousaf Kaukab
ID status change interrupt will not be handled in peripheral only configuration. So initialize op_state during gadget init. Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga --- drivers/usb/dwc2/gadget.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/dwc2/gadget.c

[PATCH v2 24/32] usb: dwc2: gadget: ignore stall check for ep0

2015-09-22 Thread Mian Yousaf Kaukab
dwc2_hsotg_start_req starts a request only if endpoint is not stalled. Ignore this check for ep0 as core will clear DOEPCTL0.Stall after sending stall handshake. Prepare instead for receiving next setup packet. Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga --- drivers/usb/dwc2

[PATCH v2 15/32] usb: dwc2: host: correctly dump urb isochronous descriptors

2015-09-22 Thread Mian Yousaf Kaukab
From: Gregory Herrero Print urb->iso_frame_desc.status after it has been updated using dwc2_hcd_urb_get_iso_desc_status(). Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga --- drivers/usb/dwc2/hcd.c | 11 ++- 1 file changed, 6 inserti

[PATCH v2 28/32] usb: dwc2: gadget: only reset core after addressed state

2015-09-22 Thread Mian Yousaf Kaukab
There is a 200ms guard period to avoid unnecessary resets of the dwc2 ip. This delay sometimes prove to be too large when usbcv is run with an ehci host. dwc2 only needs to be reset after addressed state. Change the logic to reset ip after addressed state. Signed-off-by: Mian Yousaf Kaukab

[PATCH v2 14/32] usb: dwc2: host: wait 3ms for controller stabilization

2015-09-22 Thread Mian Yousaf Kaukab
: Mian Yousaf Kaukab Tested-by: Robert Baldyga --- drivers/usb/dwc2/hcd.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index de9d2e2..65044da 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -2472,6 +2472,9

[PATCH v2 22/32] usb: dwc2: gadget: set op_state in vbus_session call

2015-09-22 Thread Mian Yousaf Kaukab
From: Gregory Herrero Some device may have external id pin control enabled, so op_state will not be set on id pin interrupt change. Thus, ensure op_state is set to peripheral during vbus detection. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga

[PATCH v2 11/32] usb: dwc2: host: add disconnect interrupt to host only interrupts

2015-09-22 Thread Mian Yousaf Kaukab
GINTSTS.DisconnInt is host only interrupt and should be disable after dwc2_disable_host_interrupts is called. Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga --- drivers/usb/dwc2/core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc2/core.c

[PATCH v2 09/32] usb: dwc2: host: reset frame number after suspend

2015-09-22 Thread Mian Yousaf Kaukab
of transfers until frame number reaches qh->sched_frame. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga --- drivers/usb/dwc2/core.c | 1 + drivers/usb/dwc2/hcd_queue.c | 8 2 files changed, 9 insertions(+) diff --git a/drivers/us

[PATCH v2 10/32] usb: dwc2: host: disconnect hcd prior stopping it

2015-09-22 Thread Mian Yousaf Kaukab
From: Gregory Herrero In case controller is asked to stop while devices are connected, disconnect all devices and clean up before stopping. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga --- drivers/usb/dwc2/hcd.c | 5 + 1 file changed, 5

[PATCH v2 20/32] usb: dwc2: force dr_mode in case of configuration mismatch

2015-09-22 Thread Mian Yousaf Kaukab
If dual role configuration is not selected, check and force dr_mode based on the selected configuration. Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga --- drivers/usb/dwc2/platform.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/usb/dwc2/platform.c b

[PATCH v2 21/32] usb: dwc2: gadget: don't modify pullup state in host mode

2015-09-22 Thread Mian Yousaf Kaukab
From: Gregory Herrero Modifying the pullup state during host mode trig a new enumeration of attached device. Thus, avoid modifying pullup in host mode. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga --- drivers/usb/dwc2/gadget.c | 9 - 1

[PATCH v2 16/32] usb: dwc2: host: use correct frame number during qh init

2015-09-22 Thread Mian Yousaf Kaukab
From: Gregory Herrero On first qh initialization, hsotg->frame_number is not corresponding to reality. So read it from host controller to get correct value. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga --- drivers/usb/dwc2/hcd_queue.c | 3 +++

[PATCH v2 12/32] usb: dwc2: host: disable interrupt during stop

2015-09-22 Thread Mian Yousaf Kaukab
From: Gregory Herrero Disable host interrupts before synchronising dwc2 irq. So that interrupts are not generated once controller is stopped. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga --- drivers/usb/dwc2/hcd.c | 3 +++ 1 file changed, 3

[PATCH v2 13/32] usb: dwc2: host: clear pending interrupts prior hibernation

2015-09-22 Thread Mian Yousaf Kaukab
controller interrupts before hibernation entry. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga --- drivers/usb/dwc2/core.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index c5e0a45

[PATCH v2 04/32] usb: dwc2: host: enter hibernation during bus suspend

2015-09-22 Thread Mian Yousaf Kaukab
detects bus activity, it must call usb_hcd_resume_root_hub. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga --- drivers/usb/dwc2/hcd.c | 140 - 1 file changed, 128 insertions(+), 12 deletions(-) diff --git a

[PATCH v2 03/32] usb: dwc2: host: add flag to reflect bus state

2015-09-22 Thread Mian Yousaf Kaukab
From: Gregory Herrero lx_state must be used to reflect controller power state only and not bus state. Thus add a flag to track state during bus suspend. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga --- drivers/usb/dwc2/core.h | 1 + drivers/usb

[PATCH v2 08/32] usb: dwc2: host: resume only if bus is suspended

2015-09-22 Thread Mian Yousaf Kaukab
From: Gregory Herrero Port can be resumed in bus_resume callback. In this case, there is no need to drive resume a second time when hcd ask for it. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga --- drivers/usb/dwc2/hcd.c | 3 ++- 1 file changed

[PATCH v2 05/32] usb: dwc2: host: update hcd and lx_state during start/stop callbacks

2015-09-22 Thread Mian Yousaf Kaukab
From: Gregory Herrero During hcd initialization, hardware accessible flag and lx_state must be reset to the working state since controller is powered at this stage. Same logic applied for stop callback. Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert

[PATCH v2 02/32] usb: dwc2: host: create a function to handle port_resume

2015-09-22 Thread Mian Yousaf Kaukab
ites, read hprt0 again. Since the phy clock is stopped in dwc2_port_suspend(), enable it here and remove the PCGCTL write from dwc2_hcd_hub_control() Signed-off-by: Gregory Herrero Signed-off-by: Mian Yousaf Kaukab Tested-by: Robert Baldyga --- drivers/usb/dwc2/

  1   2   3   4   5   >