phy: core: Add PHY tune operation 12/125312/6
authorDongwoo Lee <dwoo08.lee@samsung.com>
Fri, 7 Apr 2017 06:22:18 +0000 (15:22 +0900)
committerDongwoo Lee <dwoo08.lee@samsung.com>
Thu, 27 Jul 2017 03:06:14 +0000 (12:06 +0900)
PHY framework currently provides phy_init to set initial state of
registers, powers and clocks but it is always called before xhci is
probed. However, some PHYs might need to adjust their configuration
during its operation because of h/w characteristics (or problem).
To resolve this problem, it provides tune operation to generic PHY
framework.

Change-Id: I74b0104d6ecada8c4274036c69497b9368e7f38a
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
drivers/phy/phy-core.c
include/linux/phy/phy.h

index 153e0a2..0e1aa6d 100644 (file)
@@ -342,6 +342,13 @@ int phy_power_off(struct phy *phy)
 }
 EXPORT_SYMBOL_GPL(phy_power_off);
 
+void phy_tune(struct phy *phy)
+{
+       if (phy->ops->tune)
+               phy->ops->tune(phy);
+}
+EXPORT_SYMBOL_GPL(phy_tune);
+
 /**
  * _of_phy_get() - lookup and obtain a reference to a phy by phandle
  * @np: device_node for which to get the phy
index a0197fa..7156f91 100644 (file)
@@ -28,6 +28,7 @@ struct phy;
  * @exit: operation to be performed while exiting
  * @power_on: powering on the phy
  * @power_off: powering off the phy
+ * @tune: operation to be performed for re-configuring phy
  * @owner: the module owner containing the ops
  */
 struct phy_ops {
@@ -35,6 +36,7 @@ struct phy_ops {
        int     (*exit)(struct phy *phy);
        int     (*power_on)(struct phy *phy);
        int     (*power_off)(struct phy *phy);
+       void    (*tune)(struct phy *phy);
        struct module *owner;
 };
 
@@ -119,6 +121,7 @@ int phy_init(struct phy *phy);
 int phy_exit(struct phy *phy);
 int phy_power_on(struct phy *phy);
 int phy_power_off(struct phy *phy);
+void phy_tune(struct phy *phy);
 static inline int phy_get_bus_width(struct phy *phy)
 {
        return phy->attrs.bus_width;
@@ -222,6 +225,11 @@ static inline int phy_power_off(struct phy *phy)
        return -ENOSYS;
 }
 
+static inline void phy_tune(struct phy *phy)
+{
+       return;
+}
+
 static inline int phy_get_bus_width(struct phy *phy)
 {
        return -ENOSYS;