Commit graph

11 commits

Author SHA1 Message Date
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