summaryrefslogtreecommitdiffstats
path: root/include/linux/phy
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2016-04-05 11:17:34 -0400
committerThierry Reding <treding@nvidia.com>2016-04-29 10:39:39 -0400
commit1140f7c8994a3a2a0d7c4972509d98b792617d39 (patch)
tree2c22ea1a570a2e706bb863053b10584a3aa29b92 /include/linux/phy
parent0e55714902857f71ce3f9144f6a73fb8321229ef (diff)
phy: core: Allow children node to be overridden
In order to more flexibly support device tree bindings, allow drivers to override the container of the child nodes. By default the device node of the PHY provider is assumed to be the parent for children, but bindings may decide to add additional levels for better organization. Acked-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'include/linux/phy')
-rw-r--r--include/linux/phy/phy.h31
1 files changed, 21 insertions, 10 deletions
diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
index 8cf05e341cff..a810f2a18842 100644
--- a/include/linux/phy/phy.h
+++ b/include/linux/phy/phy.h
@@ -77,6 +77,7 @@ struct phy {
77 */ 77 */
78struct phy_provider { 78struct phy_provider {
79 struct device *dev; 79 struct device *dev;
80 struct device_node *children;
80 struct module *owner; 81 struct module *owner;
81 struct list_head list; 82 struct list_head list;
82 struct phy * (*of_xlate)(struct device *dev, 83 struct phy * (*of_xlate)(struct device *dev,
@@ -93,10 +94,16 @@ struct phy_lookup {
93#define to_phy(a) (container_of((a), struct phy, dev)) 94#define to_phy(a) (container_of((a), struct phy, dev))
94 95
95#define of_phy_provider_register(dev, xlate) \ 96#define of_phy_provider_register(dev, xlate) \
96 __of_phy_provider_register((dev), THIS_MODULE, (xlate)) 97 __of_phy_provider_register((dev), NULL, THIS_MODULE, (xlate))
97 98
98#define devm_of_phy_provider_register(dev, xlate) \ 99#define devm_of_phy_provider_register(dev, xlate) \
99 __devm_of_phy_provider_register((dev), THIS_MODULE, (xlate)) 100 __devm_of_phy_provider_register((dev), NULL, THIS_MODULE, (xlate))
101
102#define of_phy_provider_register_full(dev, children, xlate) \
103 __of_phy_provider_register(dev, children, THIS_MODULE, xlate)
104
105#define devm_of_phy_provider_register_full(dev, children, xlate) \
106 __devm_of_phy_provider_register(dev, children, THIS_MODULE, xlate)
100 107
101static inline void phy_set_drvdata(struct phy *phy, void *data) 108static inline void phy_set_drvdata(struct phy *phy, void *data)
102{ 109{
@@ -147,11 +154,13 @@ struct phy *devm_phy_create(struct device *dev, struct device_node *node,
147void phy_destroy(struct phy *phy); 154void phy_destroy(struct phy *phy);
148void devm_phy_destroy(struct device *dev, struct phy *phy); 155void devm_phy_destroy(struct device *dev, struct phy *phy);
149struct phy_provider *__of_phy_provider_register(struct device *dev, 156struct phy_provider *__of_phy_provider_register(struct device *dev,
150 struct module *owner, struct phy * (*of_xlate)(struct device *dev, 157 struct device_node *children, struct module *owner,
151 struct of_phandle_args *args)); 158 struct phy * (*of_xlate)(struct device *dev,
159 struct of_phandle_args *args));
152struct phy_provider *__devm_of_phy_provider_register(struct device *dev, 160struct phy_provider *__devm_of_phy_provider_register(struct device *dev,
153 struct module *owner, struct phy * (*of_xlate)(struct device *dev, 161 struct device_node *children, struct module *owner,
154 struct of_phandle_args *args)); 162 struct phy * (*of_xlate)(struct device *dev,
163 struct of_phandle_args *args));
155void of_phy_provider_unregister(struct phy_provider *phy_provider); 164void of_phy_provider_unregister(struct phy_provider *phy_provider);
156void devm_of_phy_provider_unregister(struct device *dev, 165void devm_of_phy_provider_unregister(struct device *dev,
157 struct phy_provider *phy_provider); 166 struct phy_provider *phy_provider);
@@ -312,15 +321,17 @@ static inline void devm_phy_destroy(struct device *dev, struct phy *phy)
312} 321}
313 322
314static inline struct phy_provider *__of_phy_provider_register( 323static inline struct phy_provider *__of_phy_provider_register(
315 struct device *dev, struct module *owner, struct phy * (*of_xlate)( 324 struct device *dev, struct device_node *children, struct module *owner,
316 struct device *dev, struct of_phandle_args *args)) 325 struct phy * (*of_xlate)(struct device *dev,
326 struct of_phandle_args *args))
317{ 327{
318 return ERR_PTR(-ENOSYS); 328 return ERR_PTR(-ENOSYS);
319} 329}
320 330
321static inline struct phy_provider *__devm_of_phy_provider_register(struct device 331static inline struct phy_provider *__devm_of_phy_provider_register(struct device
322 *dev, struct module *owner, struct phy * (*of_xlate)(struct device *dev, 332 *dev, struct device_node *children, struct module *owner,
323 struct of_phandle_args *args)) 333 struct phy * (*of_xlate)(struct device *dev,
334 struct of_phandle_args *args))
324{ 335{
325 return ERR_PTR(-ENOSYS); 336 return ERR_PTR(-ENOSYS);
326} 337}