Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

phy: Add reset callback

The only use for this is for solving a hardware design problem in
usb of Rockchip RK3288.

Signed-off-by: Randy Li <ayaka@soulik.info>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>

authored by

Randy Li and committed by
Kishon Vijay Abraham I
cac18ecb 91d6e3b6

+18
+15
drivers/phy/phy-core.c
··· 357 357 } 358 358 EXPORT_SYMBOL_GPL(phy_set_mode); 359 359 360 + int phy_reset(struct phy *phy) 361 + { 362 + int ret; 363 + 364 + if (!phy || !phy->ops->reset) 365 + return 0; 366 + 367 + mutex_lock(&phy->mutex); 368 + ret = phy->ops->reset(phy); 369 + mutex_unlock(&phy->mutex); 370 + 371 + return ret; 372 + } 373 + EXPORT_SYMBOL_GPL(phy_reset); 374 + 360 375 /** 361 376 * _of_phy_get() - lookup and obtain a reference to a phy by phandle 362 377 * @np: device_node for which to get the phy
+3
include/linux/phy/phy.h
··· 36 36 * @power_on: powering on the phy 37 37 * @power_off: powering off the phy 38 38 * @set_mode: set the mode of the phy 39 + * @reset: resetting the phy 39 40 * @owner: the module owner containing the ops 40 41 */ 41 42 struct phy_ops { ··· 45 44 int (*power_on)(struct phy *phy); 46 45 int (*power_off)(struct phy *phy); 47 46 int (*set_mode)(struct phy *phy, enum phy_mode mode); 47 + int (*reset)(struct phy *phy); 48 48 struct module *owner; 49 49 }; 50 50 ··· 138 136 int phy_power_on(struct phy *phy); 139 137 int phy_power_off(struct phy *phy); 140 138 int phy_set_mode(struct phy *phy, enum phy_mode mode); 139 + int phy_reset(struct phy *phy); 141 140 static inline int phy_get_bus_width(struct phy *phy) 142 141 { 143 142 return phy->attrs.bus_width;