diff options
Diffstat (limited to 'include/linux/phy/phy.h')
-rw-r--r-- | include/linux/phy/phy.h | 42 |
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 | */ | ||
44 | struct 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 | */ |
50 | struct phy { | 59 | struct 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); | |||
127 | int phy_exit(struct phy *phy); | 137 | int phy_exit(struct phy *phy); |
128 | int phy_power_on(struct phy *phy); | 138 | int phy_power_on(struct phy *phy); |
129 | int phy_power_off(struct phy *phy); | 139 | int phy_power_off(struct phy *phy); |
140 | static inline int phy_get_bus_width(struct phy *phy) | ||
141 | { | ||
142 | return phy->attrs.bus_width; | ||
143 | } | ||
144 | static inline void phy_set_bus_width(struct phy *phy, int bus_width) | ||
145 | { | ||
146 | phy->attrs.bus_width = bus_width; | ||
147 | } | ||
130 | struct phy *phy_get(struct device *dev, const char *string); | 148 | struct phy *phy_get(struct device *dev, const char *string); |
149 | struct phy *phy_optional_get(struct device *dev, const char *string); | ||
131 | struct phy *devm_phy_get(struct device *dev, const char *string); | 150 | struct phy *devm_phy_get(struct device *dev, const char *string); |
151 | struct phy *devm_phy_optional_get(struct device *dev, const char *string); | ||
132 | void phy_put(struct phy *phy); | 152 | void phy_put(struct phy *phy); |
133 | void devm_phy_put(struct device *dev, struct phy *phy); | 153 | void devm_phy_put(struct device *dev, struct phy *phy); |
134 | struct phy *of_phy_simple_xlate(struct device *dev, | 154 | struct 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 | ||
222 | static inline int phy_get_bus_width(struct phy *phy) | ||
223 | { | ||
224 | return -ENOSYS; | ||
225 | } | ||
226 | |||
227 | static inline void phy_set_bus_width(struct phy *phy, int bus_width) | ||
228 | { | ||
229 | return; | ||
230 | } | ||
231 | |||
202 | static inline struct phy *phy_get(struct device *dev, const char *string) | 232 | static 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 | ||
237 | static inline struct phy *phy_optional_get(struct device *dev, | ||
238 | const char *string) | ||
239 | { | ||
240 | return ERR_PTR(-ENOSYS); | ||
241 | } | ||
242 | |||
207 | static inline struct phy *devm_phy_get(struct device *dev, const char *string) | 243 | static 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 | ||
248 | static inline struct phy *devm_phy_optional_get(struct device *dev, | ||
249 | const char *string) | ||
250 | { | ||
251 | return ERR_PTR(-ENOSYS); | ||
252 | } | ||
253 | |||
212 | static inline void phy_put(struct phy *phy) | 254 | static inline void phy_put(struct phy *phy) |
213 | { | 255 | { |
214 | } | 256 | } |