aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/chipidea/core.c
AgeCommit message (Collapse)AuthorFilesLines
2014-11-26usb: chipidea: using devm_request_irq to instead of request_irqPeter Chen1-4/+2
Using devm_request_irq to instead of request_irq. Suggested-by: Arnd Bergmann <[email protected]> Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-11-03Merge branch 'platform/remove_owner' of ↵Greg Kroah-Hartman1-1/+0
git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux into driver-core-next Remove all .owner fields from platform drivers
2014-11-03usb: chipidea: add support to the generic PHY frameworkAntoine Tenart1-18/+65
This patch adds support of the PHY framework for ChipIdea drivers. Changes are done in both the ChipIdea common code and in the drivers accessing the PHY. This is done by adding a new PHY member in ChipIdea's structures and by taking care of it in the code. Signed-off-by: Antoine Tenart <[email protected]> Acked-by: Peter Chen <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-11-03usb: allow to supply the PHY in the drivers when using HCDAntoine Tenart1-10/+10
This patch modify the generic code handling PHYs to allow them to be supplied from the drivers. This adds checks to ensure no PHY was already there when looking for one in the generic code. This also makes sure we do not modify its state in the generic HCD functions, it was provided by the driver. Signed-off-by: Antoine Tenart <[email protected]> Acked-by: Alan Stern <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-10-27usb: chipidea: Fix oops when removing the ci_hdrc moduleTorsten Fleischer1-1/+0
The call of 'kfree(ci->hw_bank.regmap)' in ci_hdrc_remove() sometimes causes a kernel oops when removing the ci_hdrc module. Since there is no separate memory allocated for the ci->hw_bank.regmap array, there is no need to free it. Cc: v3.14+ <stable@@vger.kernel.org> Signed-off-by: Torsten Fleischer <[email protected]> Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-10-20usb: chipidea: drop owner assignment from platform_driversWolfram Sang1-1/+0
A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <[email protected]>
2014-09-23usb: chipidea: enhance kernel-doc formatPeter Chen1-1/+7
Some kernel-doc style comment are not satisfied for format, fix them. Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-09-23usb: chipidea: otg initialization is only needed when the gadget is supportedPeter Chen1-1/+1
We have only needed to enable otg initialization when both of below conditions are satisfied: - The controller is otg capable - The gadget function is enabled If the controller is otg capable, but is host-only configuration, we do not need to access register otgsc and do any otg operations (eg, create otg workqueue). Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-09-23usb: chipidea: add TPL support for targeted hostsPeter Chen1-0/+4
For OTG and Embedded hosts, they may need TPL (Targeted Peripheral List) for usb certification and other vender specific requirements, the platform can tell chipidea core driver if it supports tpl through DT or platform data. Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-05-23usb: chipidea: using one inline function to cover queue work operationsPeter Chen1-4/+2
The otg queue work include operations: one is disable interrupt, another one is call kernel queue work API. Many codes do this operation, using one inline function to instead of them. Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-05-23usb: chipidea: update TODO listPeter Chen1-4/+1
Update TODO list Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-04-24usb: chipidea: OTG HNP and SRP fsm implementationLi Jun1-6/+18
USB OTG interrupt handling and fsm transitions according to USB OTG and EH 2.0. Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Li Jun <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-04-24usb: chipidea: core: Add missing module owner fieldAlexander Shiyan1-0/+1
Signed-off-by: Alexander Shiyan <[email protected]> Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-04-24usb: chipidea: add proper delay for waiting correct PHY statusPeter Chen1-13/+13
After the PHY has powered and initialized, it needs some delay for controller to reflect PHY's status. Some status and values for id, vbus, dp/dm are only stable after this delay. The current code tries to clear id/vbus status without enough delay, it causes the status are not cleared properly. This patch add 2ms delay after phy has initialized, and clear the unexpected status after that. Signed-off-by: Peter Chen <[email protected]> Tested-by: Li Jun <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-04-24usb: chipidea: export interrupt enable and status register read functionsLi Jun1-0/+20
This patch moves usb interrupt enable and status register read functions from udc driver to core driver to use them in all ci drivers. Signed-off-by: Peter Chen <[email protected]> Acked-by: Peter Chen <[email protected]> Signed-off-by: Li Jun <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-04-24usb: chipidea: operate on otgsc register in a general wayLi Jun1-6/+10
Use a more general way to read and write otgsc register. Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Li Jun <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-04-24usb: chipidea: coordinate usb phy initialization for different phy typePeter Chen1-3/+34
For internal PHY (like UTMI), the phy clock may from internal pll, it is on/off on the fly, the access PORTSC.PTS will hang without phy clock. So, the usb_phy_init which will open phy clock needs to be called before hw_phymode_configure. See: http://marc.info/?l=linux-arm-kernel&m=139350618732108&w=2 For external PHY (like ulpi), it needs to configure portsc.pts before visit viewport, or the viewport can't be visited. so phy_phymode_configure needs to be called before usb_phy_init. See: cd0b42c2a6d2a74244f0053f8960f5dad5842278 It may not the best solution, but it can work for all situations. Cc: Sascha Hauer <[email protected]> Cc: Chris Ruehl <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-02-24usb: chipidea: Propagate the real error code on platform_get_irq() failureFabio Estevam1-1/+1
No need to return a 'fake' return value on platform_get_irq() failure. Just return the error code itself instead. Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Fabio Estevam <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-02-24usb: chipidea: udc: add maximum-speed = full-speed optionMichael Grzeschik1-0/+11
This patch makes it possible to set the chipidea udc into full-speed only mode. It is set by the oftree property "maximum-speed = full-speed". Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Michael Grzeschik <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-02-24usb: chipidea: use dev_get_platdata()Jingoo Han1-2/+2
Use the wrapper function for retrieving the platform data instead of accessing dev->platform_data directly. This is a cosmetic change to make the code simpler and enhance the readability. Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Jingoo Han <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-02-24usb: chipidea: refine PHY operationPeter Chen1-44/+26
- Delete global_phy due to we can get the phy from phy layer now - using devm_usb_get_phy to instead of usb_get_phy - delete the otg_set_peripheral, which should be handled by otg layer Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-01-13usb: chipidea: put hw_phymode_configure before ci_usb_phy_initChris Ruehl1-2/+2
hw_phymode_configure configures the PORTSC registers and allow the following phy_inits to operate on the right parameters. This fix a problem where the UPLI (ISP1504) could not be detected, because the Viewport was not available and read the viewport return 0's only. Signed-off-by: Chris Ruehl <[email protected]> Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-01-13usb: chipidea: Fix Internal error: : 808 [#1] ARM related to STS flagChris Ruehl1-3/+5
* init the sts flag to 0 (missed) * fix write the real bit not sts value * Set PORTCS_STS and DEVLC_STS only if sts = 1 [Peter Chen: This one and the next patch fix the problem occurred imx27 and imx31, and imx27 and imx31 usb support are enabled until 3.14, so these two patches isn't needed for -stable] Signed-off-by: Chris Ruehl <[email protected]> Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-01-13usb: chipidea: add freescale imx28 special write register methodPeter Chen1-0/+2
According to Freescale imx28 Errata, "ENGR119653 USB: ARM to USB register error issue", All USB register write operations must use the ARM SWP instruction. So, we implement special hw_write and hw_test_and_clear for imx28. Discussion for it at below: http://marc.info/?l=linux-usb&m=137996395529294&w=2 This patch is needed for stable tree 3.11+. Cc: [email protected] Cc: [email protected] Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]> Tested-by: Marc Kleine-Budde <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-01-07usb: chipidea: mark register map as "const" and convert to u8Marc Kleine-Budde1-40/+40
This patch makes the controller register map ci_regs_nolpm and ci_regs_lpm as "const". Further, as all offset fit into a single byte, the type is changed from uintptr_t to u8. Signed-off-by: Marc Kleine-Budde <[email protected]> Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-01-07usb: chipidea: move malloced regmap directly into struct hw_bankMarc Kleine-Budde1-8/+0
Without this patch a seperate chunk of memory is allocated for the regmap array. As the regmap is always used it makes no sense to allocate a seperate memory block for it, this patch moves the regmap array directly into the struct hw_bank. Signed-off-by: Marc Kleine-Budde <[email protected]> Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-24Merge 3.13-rc5 into usb-nextGreg Kroah-Hartman1-0/+4
This resolves the merge issue with drivers/usb/host/ohci-at91.c Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-09usb: chipidea: fix nobody cared IRQ when booting with host rolePeter Chen1-0/+4
If we connect Male-A-To-Male-A cable between otg-host and host pc, the ci->vbus_active is set wrongly, and cause the controller run at peripheral mode when we load gadget module (ci_udc_start will be run), but the software runs at host mode due to id = 0. The ehci_irq can't handle suspend (USBi_SLI) interrupt which is enabled for peripheral mode, it causes no one will handle irq error. This patch is needed for 3.12 stable Cc: stable <[email protected]> Acked-by: Michael Grzeschik <[email protected]> Reported-by: Marc Kleine-Budde <[email protected]> Tested-by: Marc Kleine-Budde <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]> Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-08usb: chipidea: Reallocate regmap only if lpm is detectedChris Ruehl1-1/+2
The regmap only needs to reallocate if the hw_read on the CAP register shows lpm is used. Therefore the if() statement check the change. Signed-off-by: Chris Ruehl <[email protected]> Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-10-30usb: chipidea: only get vbus regulator for non-peripheral modePeter Chen1-12/+15
If the user chooses peripheral mode for this controller, the vbus regulator doesn't need to get, since the host will supply the vbus, it can save one vbus pin for other usage. Signed-off-by: Peter Chen <[email protected]> Tested-by: Frank Li <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-09-30usb: chipidea: add ci_hdrc_enter_lpm APIPeter Chen1-0/+24
This API is used to let the PHY enter/leave low power mode. Before the controller going to work(at probe/resume), it needs to let the PHY leave low power mode. After the controller stopping working(at remove/suspend), it needs to let the PHY enter low power mode to save power consumption. Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-09-30usb: chipidea: move PHY operation to corePeter Chen1-6/+51
PHY operations are common, so move them to core. Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-09-29Merge 3.12-rc3 into usb-nextGreg Kroah-Hartman1-0/+1
We want the USB fixes in here as well. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-09-25usb: chipidea: Fix memleak for ci->hw_bank.regmap when removalPeter Chen1-0/+1
It needs to free ci->hw_bank.regmap explicitly since it is not managed resource. Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-09-25usb: chipidea: move platform related things to ci_get_platdataPeter Chen1-10/+9
Like vbus, the dr_mode and phy_mode are also got from glue layer's platform data or device node. Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-08-14usb: chipidea: add wait vbus lower than OTGSC_BSV before role startsPeter Chen1-0/+32
When the gadget role starts, we need to make sure the vbus is lower than OTGSC_BSV, or there will be an vbus interrupt since we use B_SESSION_VALID as vbus interrupt to indicate connect and disconnect. When the host role starts, it may not be useful to wait vbus to lower than OTGSC_BSV, but it can indicate some hardware problems like the vbus is still higher than OTGSC_BSV after we disconnect to host some time later (5000 milliseconds currently), which is obvious not correct. Tested-by: Marek Vasut <[email protected]> Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Alexander Shishkin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-08-14usb: chipidea: add vbus interrupt handlerPeter Chen1-5/+23
We add vbus interrupt handler at ci_otg_work, it uses OTGSC_BSV(at otgsc) to know it is connect or disconnet event. Meanwhile, we introduce two flags id_event and b_sess_valid_event to indicate it is an id interrupt or a vbus interrupt. Tested-by: Marek Vasut <[email protected]> Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Alexander Shishkin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-08-14usb: chipidea: move otg related things to otg filePeter Chen1-50/+13
Move otg related things to otg file. Tested-by: Marek Vasut <[email protected]> Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Alexander Shishkin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-08-14usb: chipidea: disable all interrupts and clear all interrupts statusPeter Chen1-1/+10
During the initialization, it needs to disable all interrupts enable bit as well as clear all interrupts status bits to avoid exceptional interrupt. Tested-by: Marek Vasut <[email protected]> Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Alexander Shishkin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-08-14usb: chipidea: add flag CI_HDRC_DUAL_ROLE_NOT_OTGPeter Chen1-7/+30
Since we need otgsc to know vbus's status at some chipidea controllers even it is peripheral-only mode. Besides, some SoCs (eg, AR9331 SoC) don't have otgsc register even the DCCPARAMS_DC and DCCPARAMS_HC are both 1 at CAP_DCCPARAMS. We inroduce flag CI_HDRC_DUAL_ROLE_NOT_OTG to indicate if the controller is dual role, but not supports OTG. If this flag is not set, we follow the rule that if DCCPARAMS_DC and DCCPARAMS_HC are both 1 at CAP_DCCPARAMS, then this controller is otg capable. Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Alexander Shishkin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-08-14usb: chipidea: add role init and destroy APIsPeter Chen1-2/+8
- The role's init will be called at probe procedure. - The role's destroy will be called at fail patch at probe and driver's removal. - The role's start/stop will be called when specific role has started. Tested-by: Marek Vasut <[email protected]> Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Alexander Shishkin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-08-14usb: chipidea: otg: add otg file used to access otgscPeter Chen1-1/+2
This file is mainly used to access otgsc currently, it may add otg related things in the future. Tested-by: Marek Vasut <[email protected]> Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Alexander Shishkin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-08-14usb: chipidea: move vbus regulator operation to corePeter Chen1-0/+23
The vbus regulator is a common element for USB vbus operation, So, move it from glue layer to core. Tested-by: Marek Vasut <[email protected]> Signed-off-by: Michael Grzeschik <[email protected]> Signed-off-by: Peter Chen <[email protected]> Signed-off-by: Alexander Shishkin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-08-14usb: chipidea: remove previous MODULE_ALIASFabio Estevam1-1/+0
After the rename to ci_hdrc we ended up with two MODULE_ALIAS entries, so remove the old one. Signed-off-by: Fabio Estevam <[email protected]> Reviewed-by: Peter Chen <[email protected]> Signed-off-by: Alexander Shishkin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-08-14usb: chipidea: prevent endless loop registering platform_devices when probe ↵Lothar Waßmann1-5/+3
fails Commit 40dcd0e ("usb: chipidea: add PTW, PTS and STS handling") introduced the following code to the ci_hdrc_probe() function: + if (!dev->of_node && dev->parent) + dev->of_node = dev->parent->of_node; This inadvertently associates the ci_hdrc device with the ci_hdrc_imx driver (which created the ci_hdrc device in the first place). This results in ci_hdrc_imx_probe() being run for the ci_hdrc device if ci_hdrc_probe() fails for some reason. ci_hdrc_imx_probe() will happily create a new ci_hdrc platform_device whose probing will likewise fail and trigger a new invocation of ci_hdrc_imx_probe() ... ad nauseam. Signed-off-by: Lothar Waßmann <[email protected]> Reviewed-and-tested-by: Peter Chen <[email protected]> Signed-off-by: Alexander Shishkin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-08-14usb: chipidea: don't clobber return value of ci_role_start()Lothar Waßmann1-1/+0
If a role fails to start, propagate the error code up the call stack from probe. Signed-off-by: Lothar Waßmann <[email protected]> Signed-off-by: Alexander Shishkin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-08-14usb: chipidea: move hw_phymode_configure() into probeFabio Estevam1-2/+2
Currently hw_phymode_configure() is located inside hw_device_reset(), which is only called by chipidea udc driver. When operating in host mode, we also need to call hw_phymode_configure() in order to properly configure the PHY mode, so move this function into probe. After this change, USB Host1 port on mx53qsb board is functional. Signed-off-by: Fabio Estevam <[email protected]> Tested-by: Arnaud Patard <[email protected]> Reviewed-by: Peter Chen <[email protected]> Signed-off-by: Alexander Shishkin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-06-24usb: chipidea: drop "13xxx" infixAlexander Shishkin1-18/+18
"ci13xxx" is bad for at least the following reasons: * people often mistype it * it doesn't add any informational value to the names it's used in * it needlessly attracts mail filters This patch replaces it with "ci_hdrc", "ci_udc" or "ci_hw", depending on the situation. Modules with ci13xxx prefix are also renamed accordingly and aliases are added for compatibility. Otherwise, no functional changes. Signed-off-by: Alexander Shishkin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-06-17usb: chipidea: introduce dual role mode pdata flagsSascha Hauer1-6/+18
Even if a chipidea core is otg capable the board may not be. This allows to explicitly set the core to host/peripheral mode. Without these flags the driver falls back to the old behaviour. Signed-off-by: Sascha Hauer <[email protected]> Signed-off-by: Alexander Shishkin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-06-17usb: chipidea: add PTW, PTS and STS handlingMichael Grzeschik1-0/+48
This patch makes it possible to configure the PTW, PTS and STS bits inside the portsc register for host and device mode before the driver starts and the phy can be addressed as hardware implementation is designed. Signed-off-by: Michael Grzeschik <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]> Signed-off-by: Sascha Hauer <[email protected]> Signed-off-by: Alexander Shishkin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>