Commit Graph

27 Commits

Author SHA1 Message Date
Ajay Agarwal
1ef6469032 usb: phy: Add PHY msm usb driver
This change adds PHY msm usb driver which handles PHY
initialization, clock management, and workarounds
required after resetting the hardware and power management.

This change also preserves the structure and API design
changes present on 4.9 kernel along with fixing the
coding style errors.

Change-Id: I6e796bb95a61287bd4547fac8421c53de7a45d67
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
2018-02-01 13:41:23 +05:30
Ajay Agarwal
11273b09e2 usb: phy: msm: Remove phy-msm-usb driver
Remove the phy-msm-usb driver.

Change-Id: Id3293dbf682378de46e0f0a7ea16d071136977c3
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
2018-01-10 01:29:27 -08:00
Ajay Agarwal
c62aa2ae6f usb: phy: msm: Fix compilation issues
This change fixes the various compilation issues
present in phy-msm-usb driver.

Change-Id: I1df014a7c778e0015a1dcd1ff16561e7f327445f
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
2017-12-28 10:49:41 +05:30
Hemant Kumar
bce97a2212 usb: phy-msm-ssusb-qmp: Add support for USB_PHY_TYPE_USB3_OR_DP
USB_PHY_TYPE_USB3_OR_DP represents a phy which can only be configured
for USB3 or display port use case. This phy requires software controlled
port selection based on type-c orientation. QMP phy on some targets only
supports USB3 use case which does not require type-c port selection.
For those targets use phy type as USB_PHY_TYPE_USB3. Also change name
for phy type USB_PHY_TYPE_USB3_DP to USB_PHY_TYPE_USB3_AND_DP for
better understanding.

Change-Id: I0fc71e278ac682c675e09fa628884289c9d6b043
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
2017-12-11 13:25:42 -08:00
Hemant Kumar
2bb3bdf3da usb: phy-msm-qusb-v2: Add support to control external pull down
Add phy driver call back to enable external pull down on D+
line in host mode. External pull-down is only needed during
port reset before enabling high speed terminations. Pull-down
will be disabled 20ms after its enabled in timer function.

Change-Id: Id2a4e34b4937dc63d3e20cd48f5d586bbcb7599a
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Signed-off-by: Vamsi Krishna Samavedam <vskrishn@codeaurora.org>
2017-12-05 17:27:17 -08:00
Hemant Kumar
91f5e54669 usb: phy-msm-qusb-v2: Add support to disable high speed chirping
If chirping sequence to detect high speed device fails to complete
device fails to enumerate. Add new call back to disable chirping
by writing 0x20 to QUSB2PHY_SQ_CTRL1 and 0x80 to QUSB2PHY_SQ_CTRL2.
With chirping disabled xhci host can re-enumerate device in full
speed mode.

Change-Id: Icadf4037d6eada63d7585791657db1bc8f6bad48
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
2017-11-21 10:46:44 -08:00
Mayank Rana
4c40cd956b usb: phy: qmp: Add QMP USB DP combo PHY related functionality
This change adds QMP USB DP combo PHY related initialization and
reset sequence using required set of register set. Global reset is
not required to perform when there is no port select change with
QMP USB DP combo PHY.

vls_clamp_reg related offset and phy_phy_reset are not needed with
QMP USB DP combo PHY. Hence fail probe only if these properties are
not available for USB only PHY.

Change-Id: Ib56df85fd0210ba6ad24a5865330fc43c957b284
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2017-04-07 12:43:37 -07:00
Mayank Rana
83ad5827ff dwc3-msm: Fix compilation errors
This change makes below mentioned code change to fix compliation.
1. Remove usage of dbg_event()
2. Replace busy_slot to trb_enqueue, free_slot to trb_dequeue,
req_queued to started_list, request_list to pending_list, and req->queued
to req->started as those variables are renamed in upstream kernel.
3. Remove usage of multiple event buffer check in dwc3_msm_suspend()
as upstream kernel has removed multiple event buffers related
functionality.
4. dwc3_gadget_ep_get_transfer_index() and dwc3_send_gadget_ep_cmd() APIs
are changed in upstream kernel. Hence fix usage with dwc3-msm.c driver.
5. Add required enums for phy configuration
6. Add MSM specific ep config APIs declarations
7. Remove chg_type usage as it is no more required

Change-Id: I443c1b79af8560820061469dc122b13b90ea536a
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2016-08-31 10:28:34 -07:00
Mayank Rana
a99689aeff dwc3: Add QTI MSM platform specific feature and other changes
This change adds QTI MSM platform specific USB related features
and fixes.

Change-Id: I0f733d05f3f88a4a734d8489b5eb548391ab3af3
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2016-08-30 17:25:39 -07:00
Peter Chen
58efd4b06d usb: phy: change some comments
- Replace all "transceiver" with "phy"
- Replace one "OTG controller" with "phy"

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-27 10:54:31 -05:00
Arnd Bergmann
307c858bc2 usb: phy: add static inline wrapper for devm_usb_get_phy_by_node
The newly introduced devm_usb_get_phy_by_node function only has
an extern declaration, but no alternative for the case that
CONFIG_USB_PHY is disabled, which leads to a build error when
it is used anyway:

drivers/power/twl4030_charger.c: In function 'twl4030_bci_probe':
drivers/power/twl4030_charger.c:648:23: error: implicit declaration of function 'devm_usb_get_phy_by_node' [-Werror=implicit-function-declaration]
    bci->transceiver = devm_usb_get_phy_by_node(

This adds the wrapper in the same way that we have one for
all other usb-phy API functions.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: e842b84c8e ("usb: phy: Add interface to get phy give of device_node.")
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-28 09:15:32 -05:00
NeilBrown
e842b84c8e usb: phy: Add interface to get phy give of device_node.
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 <pavel@ucw.cz>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-26 10:42:28 -05:00
Peter Chen
0767320477 usb: phy: change some comments
- Delete the OTG stuffs
- .set_suspend is for controller, not for A-device or B-device.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-01-12 12:13:28 -06:00
Kiran Raparthy
df9f7b311d usb: phy: introduce usb_phy_set_event interface
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 <balbi@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org
Cc: linux-usb@vger.kernel.org
Cc: Android Kernel Team <kernel-team@android.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Arve Hj�nnev�g <arve@android.com>
Cc: Benoit Goby <benoit@android.com>
[Original patch in Android from Todd]
Cc: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Kiran Raparthy <kiran.kumar@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-21 09:05:45 -06:00
Antoine Tenart
e47d92545c usb: move the OTG state from the USB PHY to the OTG structure
Before using the PHY framework instead of the USB PHY one, we need to
move the OTG state into another place, since it won't be available when
USB PHY isn't used. This patch moves the OTG state into the OTG
structure, and makes all the needed modifications in the drivers
using the OTG state.

[ balbi@ti.com : fix build regressions with phy-tahvo.c, musb_dsps.c,
		phy-isp1301-omap, and chipidea's debug.c ]

Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03 10:01:25 -06:00
Peter Chen
57bf9b09a6 usb: phy: Add set_wakeup API
This API is used to set wakeup enable at PHY registers, in that
case, the PHY can be waken up from suspend due to external events,
like vbus change, dp/dm change and id change.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-03-05 14:40:08 -06:00
Felipe Balbi
410aee70f0 usb: phy: protect against NULL phy pointers
In order to decrease the amount of work done
by PHY users, allow NULL phy pointers to be
passed.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-07-29 13:56:45 +03:00
Michael Grzeschik
1c9af65357 usb: add devicetree helpers for determining dr_mode and phy_type
This adds two little devicetree helper functions for determining the
dr_mode (host, peripheral, otg) and phy_type (utmi, ulpi,...) from
the devicetree.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-17 13:47:09 -07:00
Felipe Balbi
b7fa5c2aec usb: phy: return -ENXIO when PHY layer isn't enabled
in cases where PHY layer isn't enabled, we want
to still return an error code (actually an error
pointer) so that our users don't need to cope with
either error pointer of NULL.

This will simplify users as below:

-	return IS_ERR(phy) ? PTR_ERR(phy) : -ENODEV;
+	return PTR_ERR(phy);

Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Reported-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:18:26 +02:00
Felipe Balbi
b774212ea5 usb: phy: introduce ->set_vbus() method
this method will be used to enable or disable
the charge pump.

Whenever we have DRD devices, we need to be
able to turn VBUS on or off whenever we want.

Note that in the ideal case, this would be
controlled by the ID-pin Interrupt, but not
all devices have ID-pin properly routed since
manufacturers can choose to save that trace
if they're building a host-only product out
of a DRD IP.

This is also useful during debugging where
we might not have the proper cable hanging
around.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:18:09 +02:00
Felipe Balbi
edc7cb2e95 usb: phy: make it a menuconfig
We already have a considerable amount of USB
PHY drivers, making it a menuconfig just
prevents us from adding too much churn to
USB's menuconfig.

While at that, also select USB_OTG_UTILS from
this new menuconfig just to keep backwards
compatibility until we manage to remove
that symbol.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-18 11:18:05 +02:00
Kishon Vijay Abraham I
5d3c28b5a4 usb: otg: add device tree support to otg library
Added an API devm_usb_get_phy_by_phandle(), to get usb phy by passing a
device node phandle value. This function will return a pointer to
the phy on success, -EPROBE_DEFER if there is a device_node for the phandle,
but the phy has not been added, or a ERR_PTR() otherwise.

Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-01-25 10:20:14 +02:00
Kishon Vijay Abraham I
0fa4fab4ee usb: otg: utils: add facilities in phy lib to support multiple PHYs of same type
In order to add support for multipe PHY's of the same type, new API's
for adding PHY and getting PHY has been added. Now the binding
information for the PHY and controller should be done in platform file
using usb_bind_phy API. And for getting a PHY, the device pointer of the
USB controller and an index should be passed. Based on the binding
information that is added in the platform file, usb_get_phy_dev will return the
appropriate PHY.
Already existing API's to add and get phy by type is not removed. These
API's are deprecated and will be removed once all the platforms start to
use the new API.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-01-25 10:20:14 +02:00
Kishon Vijay Abraham I
b4a83e4df1 usb: otg: add an api to bind the usb controller and phy
In order to support platforms which has multiple PHY's (of same type) and
which has multiple USB controllers, a new design is adopted wherin the binding
information (between the PHY and the USB controller) should be passed to the
PHY library from platform specific file (board file).
So added a new API to pass the binding information.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-01-25 10:20:09 +02:00
Peter Chen
ac96511bb5 usb: phy: change phy notify connect/disconnect API
The old parameter "port" is useless for phy notify, as one usb
phy is only for one usb port. New parameter "speed" stands for
the device's speed which is on the port, this "speed" parameter
is needed at some platforms which will do some phy operations
according to device's speed.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Tested-by: Mike Thompson <mpthompson@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-15 17:44:51 -08:00
Venu Byravarasu
a4c3ddec5c usb: phy: fix build break
During phy interface separation from otg.h, as the enum "usb_otg_state"
was having multiple otg states info and removal of member 'state'
of this enum type from usb_phy struct did not generate any compilation
issues, I removed member state from struct usb_phy.

As this is causing build break in musb code, adding member 'state'
to usb_phy structure.

Signed-off-by: Venu Byravarasu <vbyravarasu@nvidia.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-09-06 16:01:11 +03:00
Venu Byravarasu
de4217d90f usb: otg: Move phy interface to separate file.
As otg.h is containing lots of phy interface related
stuff, moving all phy interface related stuff to new
file named phy.h

Signed-off-by: Venu Byravarasu <vbyravarasu@nvidia.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-09-05 15:33:16 +03:00