summaryrefslogtreecommitdiff
path: root/drivers/usb/dwc2/gadget.c
AgeCommit message (Collapse)Author
2014-10-28usb: dwc2: gadget: fix enumeration issuesMarek Szyprowski
Excessive debug messages might cause timing issues that prevent correct usb enumeration. This patch hides information about USB bus reset to let driver enumerate fast enough to avoid making host angry. This fixes endless enumeration and usb reset loop observed with some Linux hosts. Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-10-23usb: dwc2: gadget: disable phy before turning off power regulatorsMarek Szyprowski
This patch fixes probe function to match the pattern used elsewhere in the driver, where power regulators are turned off as the last element in the device shutdown procedure. Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-10-23usb: dwc2: gadget: fix gadget unregistration in udc_stop() functionMarek Szyprowski
udc_stop() should clear ->driver pointer unconditionally to let the UDC framework to work correctly with both registering/unregistering gadgets and enabling/disabling gadgets by writing to /sys/class/udc/*hsotg/soft_connect interface. Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-10-23usb: dwc2: gadget: sparse warning of context imbalanceSudip Mukherjee
sparse was giving the following warning: warning: context imbalance in 's3c_hsotg_ep_enable' - different lock contexts for basic block we were returning ENOMEM while still holding the spinlock. The sparse warning was fixed by releasing the spinlock before return. Cc: <stable@vger.kernel.org> # v3.17 Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-09-25usb: gadget: Refactor request completionMichal Sojka
Use the recently introduced usb_gadget_giveback_request() in favor of direct invocation of the completion routine. All places in drivers/usb/ matching "[-.]complete(" were replaced with a call to usb_gadget_giveback_request(). This was compile-tested with all ARM drivers enabled and runtime-tested for musb. Signed-off-by: Michal Sojka <sojka@merica.cz> Acked-by: Felipe Balbi <balbi@ti.com> Tested-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-25usb: dwc2/gadget: move phy bus legth initializationKamil Debski
This patch moves the part of code that initializes the PHY bus width. This results in simpler code and removes the need to check whether the Generic PHY Framework is used. Signed-off-by: Kamil Debski <k.debski@samsung.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-19usb: dwc2/gadget: disable clock when it's not neededRobert Baldyga
When device is stopped or suspended clock is not needed so we can disable it for this time. Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-19usb: dwc2/gadget: assign TX FIFO dynamicallyRobert Baldyga
Because we have not enough memory to have each TX FIFO of size at least 3072 bytes (the maximum single packet size with 3 transactions per microframe), we create four FIFOs of lenght 1024, and four of length 3072 bytes, and assing them to endpoints dynamically according to maxpacket size value of given endpoint. Up to now there were initialized 16 TX FIFOs, but we use only 8 IN endpoints, so we can split available memory for 8 FIFOs to have more memory for each one. It needed to do some small modifications in few places in code, because there was assumption that TX FIFO numbers assigned to endpoints are the same as the endpoint numbers, which is not true since we have dynamic FIFO assigning. Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-19usb: dwc2/gadget: ensure that all fifos have correct memory buffersMarek Szyprowski
Print warning if FIFOs are configured in such a way that they don't fit into the SPRAM available on the s3c hsotg module. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-19usb: dwc2/gadget: hide some not really needed debug messagesMarek Szyprowski
Some DWC2/s3c-hsotg debug messages are really useless for typical user, so hide them behind dev_dbg(). Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-19usb: dwc2/gadget: Fix comment textAndrzej Pietrasiewicz
Adjust the debug text to the name of the printed variable. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-09usb: dwc2/gadget: avoid disabling ep0Robert Baldyga
Endpoint 0 should not be disabled, so we start loop counter from number 1. Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Cc: stable <stable@vger.kernel.org> # 3.16 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-09usb: dwc2/gadget: delay enabling irq once hardware is configured properlyMarek Szyprowski
This patch fixes kernel panic/interrupt storm/etc issues if bootloader left s3c-hsotg module in enabled state. Now interrupt handler is enabled only after proper configuration of hardware registers. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Cc: stable <stable@vger.kernel.org> # 3.16 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-09usb: dwc2/gadget: do not call disconnect method in pullupMarek Szyprowski
This leads to potential spinlock recursion in composite framework, other udc drivers also don't call it directly from pullup method. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Cc: stable <stable@vger.kernel.org> # 3.16 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-09usb: dwc2/gadget: break infinite loop in endpoint disable codeMarek Szyprowski
This patch fixes possible freeze caused by infinite loop in interrupt context. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Cc: stable <stable@vger.kernel.org> # 3.16 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-09usb: dwc2/gadget: fix phy initialization sequenceKamil Debski
In the Generic PHY Framework a NULL phy is considered to be a valid phy thus the "if (hsotg->phy)" check does not give us the information whether the Generic PHY Framework is used. In addition to the above this patch also removes phy_init from probe and phy_exit from remove. This is not necessary when init/exit is done in the s3c_hsotg_phy_enable/disable functions. Signed-off-by: Kamil Debski <k.debski@samsung.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Cc: stable <stable@vger.kernel.org> # 3.16 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-09usb: dwc2/gadget: fix phy disable sequenceKamil Debski
When the driver is removed s3c_hsotg_phy_disable is called three times instead of once. This results in decreasing of the phy reference counter below zero and thus consecutive inserts of the module fails. This patch removes calls to s3c_hsotg_phy_disable from s3c_hsotg_remove and s3c_hsotg_udc_stop. s3c_hsotg_udc_stop is called from udc-core.c only after usb_gadget_disconnect, which in turn calls s3c_hsotg_pullup, which already calls s3c_hsotg_phy_disable. s3c_hsotg_remove must be called only after udc_stop, so there is no point in disabling phy once again there. Signed-off-by: Kamil Debski <k.debski@samsung.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Cc: stable <stable@vger.kernel.org> # 3.16 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-25usb: dwc2: gadget: Set the default EP max packet value as 8 bytesJingoo Han
Set the default EP max packet value as 8 bytes, because in the case of low-speed, 'ep_mps' is not set. Thus, the default value of 'ep_mps' should be considered for the case of low-speed. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-19usb: dwc2: gadget: fix below build warningPeter Chen
linux-2.6/drivers/usb/dwc2/gadget.c: In function 's3c_hsotg_irq_enumdone': linux-2.6/drivers/usb/dwc2/gadget.c:1904: warning: 'ep_mps' may be used uninitialized in this function Acked-by: Paul Zimmerman <Paul.Zimmerman@synopsys.com> Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-09usb: dwc2: gadget: remove incorrect file referenceJingoo Han
The file and folder movements resulted in the incorrect reference. So for better code maintainability, let's remove it. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-09usb: dwc2: gadget: remove unnecessary OOM messagesJingoo Han
The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-09usb: dwc2: gadget: fix checkpatch errorsJingoo Han
Fix checkpatch errors as belows. ERROR: open brace '{' following function declarations go on the next line ERROR: space required before the open parenthesis '(' Signed-off-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-27usb: dwc2: Remove '0x' notation when using %pad formatFabio Estevam
%pad notation automatically prints in hexadecimal format (with '0x'), so remove the unneeded '0x' to avoid a '0x0x' string. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-25usb: dwc2: fix sparse warningPaul Zimmerman
Sparse warns about the __le16 wValue from the USB SetAddress command being used without converting it to CPU endianness. Fix that, and also add a bit of defensive masking of the received wValue before using it. Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-24usb: dwc2: move s3c-hsotg data structuresDinh Nguyen
This patch moves the data structures that are in the s3c-hsotg source into core.h. This is a necessary step towards unifying the s3c-hsotg and dwc2 into a single DRD. Signed-off-by: Dinh Nguyen <dinguyen@altera.com> [ jh,rb,fb - For gadget part only: ] Tested-by: Jingoo Han <jg1.han@samsung.com> Tested-by: Robert Baldyga <r.baldyga@samsung.com> Acked-by: Felipe Balbi <balbi@ti.com> [ pz - Tested host part only. ] Signed-off-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-24usb: dwc2/s3c-hsotg: move s3c-hsotg into dwc2 directoryDinh Nguyen
Moves the s3c-hsotg driver into the dwc2 directory and uses the dwc2 defines in hw.h. Renames s3c-hsotg.c to gadget.c. NOTE: You can build both host and peripheral as a dynamically linked module, but be aware that if you insmod dwc2_gadget, then rmmod it, then insmod dwc2 and dwc2_platform for host mode, this will not work. As the step to rmmod dwc2_gadget.ko will turn off the clock to the USB IP. The dwc2 host driver currently does not look to turn on a clock yet. A patch to fix that will be coming soon. Signed-off-by: Dinh Nguyen <dinguyen@altera.com> [ jh,rb - For gadget part only: ] Tested-by: Jingoo Han <jg1.han@samsung.com> Tested-by: Robert Baldyga <r.baldyga@samsung.com> [ pz: Folded Kconfig/Makefile changes, which were originally in a separate patch, into this one, to avoid a build breakage. Modified Kconfig/Makefile changes a bit. Tested host part only. ] Signed-off-by: Paul Zimmerman <paulz@synopsys.com> Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>