diff options
author | Andrew Lunn <andrew@lunn.ch> | 2014-02-04 12:33:12 -0500 |
---|---|---|
committer | Jason Cooper <jason@lakedaemon.net> | 2014-02-05 00:48:43 -0500 |
commit | 788a4d56ff378bff0b8e685d03a962b36903a149 (patch) | |
tree | d22d5b9e750448fb0d7695bf4c9360b326668a95 /Documentation/phy.txt | |
parent | 04c2facad8fee66c981a51852806d8923336f362 (diff) |
drivers: phy: Add support for optional phys
Add devm_phy_optional_get and phy_optional_get, which should be used
when the phy is optional. They does not return an error when the phy
does not exist, rather they returns NULL, which is considered as a valid
phy, but results in NOPs when used with the consumer API.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'Documentation/phy.txt')
-rw-r--r-- | Documentation/phy.txt | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/Documentation/phy.txt b/Documentation/phy.txt index 2e24b993e95f..ebff6ee52441 100644 --- a/Documentation/phy.txt +++ b/Documentation/phy.txt | |||
@@ -75,14 +75,20 @@ Before the controller can make use of the PHY, it has to get a reference to | |||
75 | it. This framework provides the following APIs to get a reference to the PHY. | 75 | it. This framework provides the following APIs to get a reference to the PHY. |
76 | 76 | ||
77 | struct phy *phy_get(struct device *dev, const char *string); | 77 | struct phy *phy_get(struct device *dev, const char *string); |
78 | struct phy *phy_optional_get(struct device *dev, const char *string); | ||
78 | struct phy *devm_phy_get(struct device *dev, const char *string); | 79 | struct phy *devm_phy_get(struct device *dev, const char *string); |
79 | 80 | struct phy *devm_phy_optional_get(struct device *dev, const char *string); | |
80 | phy_get and devm_phy_get can be used to get the PHY. In the case of dt boot, | 81 | |
81 | the string arguments should contain the phy name as given in the dt data and | 82 | phy_get, phy_optional_get, devm_phy_get and devm_phy_optional_get can |
82 | in the case of non-dt boot, it should contain the label of the PHY. | 83 | be used to get the PHY. In the case of dt boot, the string arguments |
83 | The only difference between the two APIs is that devm_phy_get associates the | 84 | should contain the phy name as given in the dt data and in the case of |
84 | device with the PHY using devres on successful PHY get. On driver detach, | 85 | non-dt boot, it should contain the label of the PHY. The two |
85 | release function is invoked on the the devres data and devres data is freed. | 86 | devm_phy_get associates the device with the PHY using devres on |
87 | successful PHY get. On driver detach, release function is invoked on | ||
88 | the the devres data and devres data is freed. phy_optional_get and | ||
89 | devm_phy_optional_get should be used when the phy is optional. These | ||
90 | two functions will never return -ENODEV, but instead returns NULL when | ||
91 | the phy cannot be found. | ||
86 | 92 | ||
87 | It should be noted that NULL is a valid phy reference. All phy | 93 | It should be noted that NULL is a valid phy reference. All phy |
88 | consumer calls on the NULL phy become NOPs. That is the release calls, | 94 | consumer calls on the NULL phy become NOPs. That is the release calls, |