aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/phy/phy.c
AgeCommit message (Collapse)AuthorFilesLines
2015-05-26usb: phy: Add interface to get phy give of device_node.NeilBrown1-27/+70
Split the "get phy from device_node" functionality out of "get phy by phandle" so it can be used directly. This is useful when a battery-charger is intimately associated with a particular phy but handled by a separate driver. The charger can find the device_node based on sibling relationships without the need for a redundant declaration in the devicetree description. As a peripheral that gets a phy will often want to register a notifier block, and de-register it later, that functionality is included so the de-registration is automatic. Acked-by: Pavel Machek <[email protected]> Signed-off-by: NeilBrown <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-03-19usb: phy: Find the right match in devm_usb_phy_matchAxel Lin1-1/+3
The res parameter passed to devm_usb_phy_match() is the location where the pointer to the usb_phy is stored, hence it needs to be dereferenced before comparing to the match data in order to find the correct match. Fixes: 410219dcd2ba ("usb: otg: utils: devres: Add API's to associate a device with the phy") Signed-off-by: Axel Lin <[email protected]> Cc: <[email protected]> # v3.6+ Signed-off-by: Felipe Balbi <[email protected]>
2015-01-19usb: phy: never defer probe in non-OF caseHeikki Krogerus1-1/+1
In practice failure to find phy when requested in non-OF case means it will never become available, so __usb_find_phy() must return -ENODEV and not -EPROBE_DEFER. This fixes a regression caused by commit 9c9d82492b73 (usb: phy: Fix deferred probing), where the USB controller driver is left infinitely into deferred probe when there are no phys. Fixes: 9c9d82492b73 (usb: phy: Fix deferred probing) Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2015-01-12Merge tag 'fixes-for-v3.19-rc5' of ↵Greg Kroah-Hartman1-3/+9
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus Felipe writes: usb: fixes for v3.19-rc5 Just three fixes this time. An oops fix in ep_write() from gadgetfs, another oops for the Atmel UDC when unloading a gadget driver and the fix for PHY deferred probing. Signed-off-by: Felipe Balbi <[email protected]> Conflicts: drivers/usb/phy/phy.c
2015-01-09usb: phy: Fix deferred probingMaxime Ripard1-3/+3
Commit 1290a958d48e ("usb: phy: propagate __of_usb_find_phy()'s error on failure") actually broke the deferred probing mechanism, since it now returns EPROBE_DEFER only when the try_module_get call fails, but not when the phy lookup does. All the other similar functions seem to return ENODEV when try_module_get fails, and the error code of either __usb_find_phy or __of_usb_find_phy otherwise. In order to have a consistent behaviour, and a meaningful EPROBE_DEFER, always return EPROBE_DEFER when __(of_)usb_find_phy fails to look up the requested phy, that will be propagated by the caller, and ENODEV if try_module_get fails. Signed-off-by: Maxime Ripard <[email protected]> Tested-by: Olof Johansson <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-12-23usb: phy: Restore deferred probing pathThierry Reding1-4/+10
Commit 1290a958d48e ("usb: phy: propagate __of_usb_find_phy()'s error on failure") broke platforms that rely on deferred probing to order probing of PHY and host controller drivers. The reason is that the commit simply propagates errors from __of_usb_find_phy(), which returns -ENODEV if no PHY has been registered yet for a given device tree node. The only case in which -EPROBE_DEFER would now be returned is if try_module_get() did fail, which does not make sense. The correct thing to do is to return -EPROBE_DEFER if a PHY hasn't been registered yet. The only condition under which it makes sense to return -ENODEV is if the device tree node representing the PHY has been disabled (via the status property) because in that case the PHY will never be registered. This patch addresses the problem by making __of_usb_find_phy() return an appropriate error code while keeping in line with the above-mentioned commit to propagate error codes rather than overwriting them. At the same time the check for a valid PHY is decoupled from the check for the try_module_get() call and a separate error code is returned if the latter fails. Fixes: 1290a95 (usb: phy: propagate __of_usb_find_phy()'s error on failure) Signed-off-by: Thierry Reding <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-11-21usb: phy: introduce usb_phy_set_event interfaceKiran Raparthy1-0/+12
PHY drivers require a generic interface to handle per-PHY events. usb_phy_set_event interface sets event to phy event. PHY drivers call this interface for each phy event. Cc: Felipe Balbi <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: [email protected] Cc: [email protected] Cc: Android Kernel Team <[email protected]> Cc: John Stultz <[email protected]> Cc: Sumit Semwal <[email protected]> Cc: Arve Hj�nnev�g <[email protected]> Cc: Benoit Goby <[email protected]> [Original patch in Android from Todd] Cc: Todd Poynor <[email protected]> Signed-off-by: Kiran Raparthy <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-11-20usb: phy: propagate __of_usb_find_phy()'s error on failureArjun Sreedharan1-1/+3
When __of_usb_find_phy() fails, it returns -ENODEV - its error code has to be returned by devm_usb_get_phy_by_phandle(). Only when the former function succeeds and try_module_get() fails should -EPROBE_DEFER be returned. [ [email protected] : remove trailing whitespace ] Signed-off-by: Arjun Sreedharan <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-08-19usb: phy: return -ENODEV on failure of try_module_getArjun Sreedharan1-0/+3
When __usb_find_phy_dev() does not return error and try_module_get() fails, return -ENODEV. Signed-off-by: Arjun Sreedharan <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-08-06Merge branch 'for-linus' of ↵Linus Torvalds1-1/+1
git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial Pull trivial tree changes from Jiri Kosina: "Summer edition of trivial tree updates" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (23 commits) doc: fix two typos in watchdog-api.txt irq-gic: remove file name from heading comment MAINTAINERS: Add miscdevice.h to file list for char/misc drivers. scsi: mvsas: mv_sas.c: Fix for possible null pointer dereference doc: replace "practise" with "practice" in Documentation befs: remove check for CONFIG_BEFS_RW scsi: doc: fix 'SCSI_NCR_SETUP_MASTER_PARITY' drivers/usb/phy/phy.c: remove a leading space mfd: fix comment cpuidle: fix comment doc: hpfall.c: fix missing null-terminate after strncpy call usb: doc: hotplug.txt code typos kbuild: fix comment in Makefile.modinst SH: add proper prompt to SH_MAGIC_PANEL_R2_VERSION ARM: msm: Remove MSM_SCM crypto: Remove MPILIB_EXTRA doc: CN: remove dead link, kerneltrap.org no longer works media: update reference, kerneltrap.org no longer works hexagon: update reference, kerneltrap.org no longer works doc: LSM: update reference, kerneltrap.org no longer works ...
2014-06-19drivers/usb/phy/phy.c: remove a leading spaceAntonio Ospite1-1/+1
Signed-off-by: Antonio Ospite <[email protected]> Acked-by: Felipe Balbi <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
2014-04-16usb: phy: return an error in usb_get_phy() if try_module_get() failsMathias Krause1-0/+3
In case we found a matching USB PHY in usb_get_phy() but the call to try_module_get() fails, we shouldn't return a (probably soon dangling) pointer but an ERR_PTR instead. Signed-off-by: Mathias Krause <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2014-02-04usb: phy: move some error messages to debugJosh Boyer1-5/+3
the PHY layer is supposed to be optional, considering some PHY have no control bus for SW to poke around. After commit 1ae5799 (usb: hcd: Initialize USB phy if needed) any HCD which didn't provide a PHY driver would emit annoying error messages. In this patch we're decreasing those messages to debugging only and we also add a PHY prefix or use dev_dbg so we know where they're coming from. Reported-by: Josh Boyer <[email protected]> Signed-off-by: Felipe Balbi <[email protected]> Signed-off-by: Josh Boyer <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-12-12usb: phy: initialize the notifier when add a new phyNeil Zhang1-0/+4
We need to initialize the notifer before use it. So lets initialize it when add a new phy device to reduce the code redundancy. Signed-off-by: Neil Zhang <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2013-10-11usb: phy: don't return with NULL from devm_usb_get_phy()Gabor Juhos1-1/+1
The callers are expecting an ERR_PTR value in case of an error. Change he code to return with an encoded -ENOMEM value in the case of a failed devres_alloc call. Signed-off-by: Gabor Juhos <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2013-04-23usb: phy: remove exported function from __init sectionDenis Efremov1-1/+1
The symbol usb_bind_phy is exported and annotated __init. It looks like section mismatch. Fix by removing the __init annotation of usb_bind_phy. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Denis Efremov <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: phy: convert EXPORT_SYMBOL to EXPORT_SYMBOL_GPLFelipe Balbi1-10/+10
we only want GPL users for our generic functions, so let's switch over to EXPORT_SYMBOL_GPL. Signed-off-by: Felipe Balbi <[email protected]>
2013-03-18usb: phy: move bulk of otg/otg.c to phy/phy.cSascha Hauer1-0/+438
Most of otg/otg.c is not otg specific, but phy specific, so move it to the phy directory. Tested-by: Steffen Trumtrar <[email protected]> Reported-by: Kishon Vijay Abraham I <[email protected]> Signed-off-by: Sascha Hauer <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>