aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/phy/phy-sun4i-usb.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2015-10-06phy: sun4i-usb: Use devm_gpiod_get_optional for optional GPIOsAxel Lin1-13/+9
Both data->id_det_gpio and data->vbus_det_gpio are optional, so use devm_gpiod_get_optional for them. Signed-off-by: Axel Lin <axel.lin@ingics.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
2015-08-14Merge tag 'phy-for-4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy into usb-nextGreg Kroah-Hartman1-26/+397
Kishon writes: phy: for 4.3 *) Add new NXP USB OTG PHY driver *) Add vbus/id detection, extcon support and fixes in phy-sun4i-usb driver *) Add support to use phy-sun4i-usb driver for sun8i-a23 and sun8i-a33 SoCs *) Other trivial code cleanups, dropping .owner assignment and constify phy_ops Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
2015-08-03phy: Constify struct phy_ops variablesAxel Lin1-1/+1
The phy_ops variables are never modified after initialized in these drivers, so make them const. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
2015-08-03phy-sun4i-usb: Only check vbus-det on power-on on boards with vbus-detHans de Goede1-1/+2
data->vbus_det is always 1 on boards without a (working) vbus-det, skip the vbus_det test on such boards. This fixes the sun4i usb phy code never turning on Vbus on such boards. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
2015-08-03phy-sun4i-sub: Move vbus-detect helper functions up in the fileHans de Goede1-24/+24
Move vbus-detect helper functions up in the file, just moving some code around, no functional changes what so ever. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
2015-08-01phy-sun4i-usb: Add missing EXPORT_SYMBOL_GPL for sun4i_usb_phy_set_squelch_detectHans de Goede1-0/+1
sun4i_usb_phy_set_squelch_detect is used by other code, which may be built as a module, so it should be exported. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
2015-07-25phy-sun4i-usb: Add support for monitoring vbus via a power-supplyHans de Goede1-7/+69
On some boards there is no vbus_det gpio pin, instead vbus-detection for otg can be done via the pmic. This commit adds support for monitoring vbus_det via the power_supply exported by the pmic, enabling support for otg on these boards. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
2015-07-25phy-sun4i-usb: Add support for boards with broken Vusb-detectionHans de Goede1-8/+36
On some boards we cannot detect the presence of an external Vusb, because e.g. the 5V of the otg connector is directly connected to the 5V of the board, and thus is always high. This commit adds support for using such boards by only looking at the id-detection pin. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
2015-07-25phy-sun4i-usb: Add support for the usb-phys on the sun8i-a33 SoCHans de Goede1-11/+28
The usb-phys on the sun8i-a33 SoC are mostly the same as sun8i-a23 but for some reason (hw bug?) the phyctl register was moved to a different address and is not initialized to 0 on reset. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
2015-07-25phy-sun4i-usb: Add support for the usb-phys on the sun8i-a23 SoCHans de Goede1-2/+5
The usb-phys on the sun8i-a23 SoC have the same setup wrt clocks as on the sun6i-a31 SoC, but there are only 2 instead of 3 like on the sun5i-a13 SoC. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
2015-07-25phy-sun4i-usb: Swap check for disconnect thresholdHans de Goede1-4/+4
Before this commit the code for determining the disconnect threshold was checking for "allwinner,sun4i-a10-usb-phy" or "allwinner,sun6i-a31-usb-phy" assuming that those where the exception and then newer SoCs would use a disconnect threshold of 2 like sun7i does. But it turns out that newer SoCs use a disconnect threshold of 3 and sun5i and sun7i are the exceptions, so check for those instead. Here are the settings from the various Allwinner SDK sources: sun4i-a10: USBC_Phy_Write(usbc_no, 0x2a, 3, 2); sun5i-a13: USBC_Phy_Write(usbc_no, 0x2a, 2, 2); sun6i-a31: USBC_Phy_Write(usbc_no, 0x2a, 3, 2); sun7i-a20: USBC_Phy_Write(usbc_no, 0x2a, 2, 2); sun8i-a23: USBC_Phy_Write(usbc_no, 0x2a, 3, 2); sun8i-h3: USBC_Phy_Write(usbc_no, 0x2a, 3, 2); sun9i-a80: USBC_Phy_Write(usbc_no, 0x2a, 3, 2); Note this commit makes no functional changes as currently we only support sun4i - sun7i. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
2015-07-25phy-sun4i-usb: Add extcon support for the otg phy (phy0)Hans de Goede1-1/+31
The sunxi musb glue needs to know if a host or normal usb cable is plugged in, add extcon support so that the musb glue can monitor the host status. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
2015-07-25phy-sun4i-usb: Add id and vbus detection support for the otg phy (phy0)Hans de Goede1-10/+240
The usb0 phy is connected to an OTG controller, and as such needs some special handling: 1) It allows explicit control over the pullups, enable these on phy_init and disable them on phy_exit. 2) It has bits to signal id and vbus detect to the musb-core, add support for for monitoring id and vbus detect gpio-s for use in dual role mode, and set these bits to the correct values for operating in host only mode when no gpios are specified in the devicetree. While updating the devicetree binding documentation also add documentation for the sofar undocumented usage of regulators for vbus for all 3 phys. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
2015-05-27phy: sun4i-usb: Add a sunxi specific function for setting squelch-detectHans de Goede1-0/+9
The sunxi otg phy has a bug where it wrongly detects a high speed squelch when reset on the root port gets de-asserted with a lo-speed device. The workaround for this is to disable squelch detect before de-asserting reset, and re-enabling it after the reset de-assert is done. Add a sunxi specific phy function to allow the sunxi-musb glue to do this. Acked-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-12-23phy-sun4i-usb: Change disconnect threshold value for sun6iHans de Goede1-1/+2
The allwinner SDK uses a value of 3 for the disconnect threshold setting on sun6i, do the same in the kernel. In my previous experience with sun5i problems getting the threshold right is important to avoid usb2 devices being unplugged sometimes going unnoticed. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
2014-11-22phy: remove the old lookup methodHeikki Krogerus1-1/+1
The users of the old method are now converted to the new one. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> [ kishon@ti.com : made phy-berlin-usb.c and phy-miphy28lp.c to use the updated devm_phy_create API.] Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
2014-11-13phy: sun4i: add support for USB phy0Roman Byshko1-3/+6
The driver for sun4i USB phys currently supports only phy1 and phy2 which are used for USB host controllers. This patch adds support for USB phy0, which is used by the musb hdrc USB controller. Signed-off-by: Roman Byshko <rbyshko@gmail.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
2014-09-24phy: remove .owner field for drivers using module_platform_driverPeter Griffin1-1/+0
This patch removes the superflous .owner field for drivers which use the module_platform_driver or platform_driver_register api, as this is overriden in __platform_driver_register. Signed-off-by: Peter Griffin <peter.griffin@linaro.org> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
2014-07-22phy: core: Let node ptr of PHY point to PHY and not of PHY providerKishon Vijay Abraham I1-1/+1
In case of multi-phy PHY providers, each PHY should be modeled as a sub node of the PHY provider. Then each PHY will have a different node pointer (node pointer of sub node) than that of PHY provider. Added this provision in the PHY core. Also fixed all drivers to use the updated API. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Acked-by: Lee Jones <lee.jones@linaro.org>
2014-07-22phy: sun4i-usb: Use PTR_ERR_OR_ZEROSachin Kamat1-3/+2
PTR_ERR_OR_ZERO simplifies the code. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Cc: Maxime Ripard <maxime.ripard@free-electrons.com> Acked-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
2014-05-14phy: usb: sunxi: Introduce Allwinner A31 USB PHY supportMaxime Ripard1-11/+22
The USB phy controller in the A31 differs mostly from the older controllers because it has a clock dedicated for each phy, while the older ones were having a single clock for all the phys. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
2014-05-14phy: sunxi: Rework phy initializationMaxime Ripard1-24/+18
Move the phy initialization and variables declaration to the loop itself, since it is where it really belongs. Also remove all the temporary variables, we can use the structure members directly. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
2014-03-03PHY: sunxi: Add driver for sunxi usb phyHans de Goede1-0/+331
The Allwinner A1x / A2x SoCs have 2 or 3 usb phys which are all accessed through a single set of registers. Besides this there are also some other phy related bits which need poking, which are per phy, but shared between the ohci and ehci controllers, so these are also controlled from this new phy driver. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>