aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/phy/phy.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/phy/phy.h')
-rw-r--r--include/linux/phy/phy.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
index 6d722695e027..3f83459dbb20 100644
--- a/include/linux/phy/phy.h
+++ b/include/linux/phy/phy.h
@@ -38,6 +38,14 @@ struct phy_ops {
38}; 38};
39 39
40/** 40/**
41 * struct phy_attrs - represents phy attributes
42 * @bus_width: Data path width implemented by PHY
43 */
44struct phy_attrs {
45 u32 bus_width;
46};
47
48/**
41 * struct phy - represents the phy device 49 * struct phy - represents the phy device
42 * @dev: phy device 50 * @dev: phy device
43 * @id: id of the phy device 51 * @id: id of the phy device
@@ -46,6 +54,7 @@ struct phy_ops {
46 * @mutex: mutex to protect phy_ops 54 * @mutex: mutex to protect phy_ops
47 * @init_count: used to protect when the PHY is used by multiple consumers 55 * @init_count: used to protect when the PHY is used by multiple consumers
48 * @power_count: used to protect when the PHY is used by multiple consumers 56 * @power_count: used to protect when the PHY is used by multiple consumers
57 * @phy_attrs: used to specify PHY specific attributes
49 */ 58 */
50struct phy { 59struct phy {
51 struct device dev; 60 struct device dev;
@@ -55,6 +64,7 @@ struct phy {
55 struct mutex mutex; 64 struct mutex mutex;
56 int init_count; 65 int init_count;
57 int power_count; 66 int power_count;
67 struct phy_attrs attrs;
58}; 68};
59 69
60/** 70/**
@@ -127,8 +137,18 @@ int phy_init(struct phy *phy);
127int phy_exit(struct phy *phy); 137int phy_exit(struct phy *phy);
128int phy_power_on(struct phy *phy); 138int phy_power_on(struct phy *phy);
129int phy_power_off(struct phy *phy); 139int phy_power_off(struct phy *phy);
140static inline int phy_get_bus_width(struct phy *phy)
141{
142 return phy->attrs.bus_width;
143}
144static inline void phy_set_bus_width(struct phy *phy, int bus_width)
145{
146 phy->attrs.bus_width = bus_width;
147}
130struct phy *phy_get(struct device *dev, const char *string); 148struct phy *phy_get(struct device *dev, const char *string);
149struct phy *phy_optional_get(struct device *dev, const char *string);
131struct phy *devm_phy_get(struct device *dev, const char *string); 150struct phy *devm_phy_get(struct device *dev, const char *string);
151struct phy *devm_phy_optional_get(struct device *dev, const char *string);
132void phy_put(struct phy *phy); 152void phy_put(struct phy *phy);
133void devm_phy_put(struct device *dev, struct phy *phy); 153void devm_phy_put(struct device *dev, struct phy *phy);
134struct phy *of_phy_simple_xlate(struct device *dev, 154struct phy *of_phy_simple_xlate(struct device *dev,
@@ -199,16 +219,38 @@ static inline int phy_power_off(struct phy *phy)
199 return -ENOSYS; 219 return -ENOSYS;
200} 220}
201 221
222static inline int phy_get_bus_width(struct phy *phy)
223{
224 return -ENOSYS;
225}
226
227static inline void phy_set_bus_width(struct phy *phy, int bus_width)
228{
229 return;
230}
231
202static inline struct phy *phy_get(struct device *dev, const char *string) 232static inline struct phy *phy_get(struct device *dev, const char *string)
203{ 233{
204 return ERR_PTR(-ENOSYS); 234 return ERR_PTR(-ENOSYS);
205} 235}
206 236
237static inline struct phy *phy_optional_get(struct device *dev,
238 const char *string)
239{
240 return ERR_PTR(-ENOSYS);
241}
242
207static inline struct phy *devm_phy_get(struct device *dev, const char *string) 243static inline struct phy *devm_phy_get(struct device *dev, const char *string)
208{ 244{
209 return ERR_PTR(-ENOSYS); 245 return ERR_PTR(-ENOSYS);
210} 246}
211 247
248static inline struct phy *devm_phy_optional_get(struct device *dev,
249 const char *string)
250{
251 return ERR_PTR(-ENOSYS);
252}
253
212static inline void phy_put(struct phy *phy) 254static inline void phy_put(struct phy *phy)
213{ 255{
214} 256}