diff options
| author | Matt Porter <mporter@linaro.org> | 2013-12-19 09:23:02 -0500 |
|---|---|---|
| committer | Felipe Balbi <balbi@ti.com> | 2013-12-23 15:26:17 -0500 |
| commit | 8feed347d33bb630d426b9f2ed88cbdf9795f624 (patch) | |
| tree | 6755f5746b962e81361f5e9098043820cd5c806a /include/linux/phy | |
| parent | e90b8417af0d01cf8c64da6937c914c89ccf6dc1 (diff) | |
phy: add phy_get_bus_width()/phy_set_bus_width() calls
This adds a pair of APIs that allows the generic PHY subsystem to
provide information on the PHY bus width. The PHY provider driver may
use phy_set_bus_width() to set the bus width that the PHY supports.
The controller driver may then use phy_get_bus_width() to fetch the
PHY bus width in order to properly configure the controller.
Signed-off-by: Matt Porter <mporter@linaro.org>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'include/linux/phy')
| -rw-r--r-- | include/linux/phy/phy.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index 6d722695e027..e273e5ac19c9 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,6 +137,14 @@ 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); |
| 131 | struct phy *devm_phy_get(struct device *dev, const char *string); | 149 | struct phy *devm_phy_get(struct device *dev, const char *string); |
| 132 | void phy_put(struct phy *phy); | 150 | void phy_put(struct phy *phy); |
| @@ -199,6 +217,16 @@ static inline int phy_power_off(struct phy *phy) | |||
| 199 | return -ENOSYS; | 217 | return -ENOSYS; |
| 200 | } | 218 | } |
| 201 | 219 | ||
| 220 | static inline int phy_get_bus_width(struct phy *phy) | ||
| 221 | { | ||
| 222 | return -ENOSYS; | ||
| 223 | } | ||
| 224 | |||
| 225 | static inline void phy_set_bus_width(struct phy *phy, int bus_width) | ||
| 226 | { | ||
| 227 | return; | ||
| 228 | } | ||
| 229 | |||
| 202 | static inline struct phy *phy_get(struct device *dev, const char *string) | 230 | static inline struct phy *phy_get(struct device *dev, const char *string) |
| 203 | { | 231 | { |
| 204 | return ERR_PTR(-ENOSYS); | 232 | return ERR_PTR(-ENOSYS); |
