diff options
Diffstat (limited to 'Documentation/phy.txt')
-rw-r--r-- | Documentation/phy.txt | 60 |
1 files changed, 16 insertions, 44 deletions
diff --git a/Documentation/phy.txt b/Documentation/phy.txt index c6594af94d25..371361c69a4b 100644 --- a/Documentation/phy.txt +++ b/Documentation/phy.txt | |||
@@ -54,18 +54,14 @@ The PHY driver should create the PHY in order for other peripheral controllers | |||
54 | to make use of it. The PHY framework provides 2 APIs to create the PHY. | 54 | to make use of it. The PHY framework provides 2 APIs to create the PHY. |
55 | 55 | ||
56 | struct phy *phy_create(struct device *dev, struct device_node *node, | 56 | struct phy *phy_create(struct device *dev, struct device_node *node, |
57 | const struct phy_ops *ops, | 57 | const struct phy_ops *ops); |
58 | struct phy_init_data *init_data); | ||
59 | struct phy *devm_phy_create(struct device *dev, struct device_node *node, | 58 | struct phy *devm_phy_create(struct device *dev, struct device_node *node, |
60 | const struct phy_ops *ops, | 59 | const struct phy_ops *ops); |
61 | struct phy_init_data *init_data); | ||
62 | 60 | ||
63 | The PHY drivers can use one of the above 2 APIs to create the PHY by passing | 61 | The PHY drivers can use one of the above 2 APIs to create the PHY by passing |
64 | the device pointer, phy ops and init_data. | 62 | the device pointer and phy ops. |
65 | phy_ops is a set of function pointers for performing PHY operations such as | 63 | phy_ops is a set of function pointers for performing PHY operations such as |
66 | init, exit, power_on and power_off. *init_data* is mandatory to get a reference | 64 | init, exit, power_on and power_off. |
67 | to the PHY in the case of non-dt boot. See section *Board File Initialization* | ||
68 | on how init_data should be used. | ||
69 | 65 | ||
70 | Inorder to dereference the private data (in phy_ops), the phy provider driver | 66 | Inorder to dereference the private data (in phy_ops), the phy provider driver |
71 | can use phy_set_drvdata() after creating the PHY and use phy_get_drvdata() in | 67 | can use phy_set_drvdata() after creating the PHY and use phy_get_drvdata() in |
@@ -137,42 +133,18 @@ There are exported APIs like phy_pm_runtime_get, phy_pm_runtime_get_sync, | |||
137 | phy_pm_runtime_put, phy_pm_runtime_put_sync, phy_pm_runtime_allow and | 133 | phy_pm_runtime_put, phy_pm_runtime_put_sync, phy_pm_runtime_allow and |
138 | phy_pm_runtime_forbid for performing PM operations. | 134 | phy_pm_runtime_forbid for performing PM operations. |
139 | 135 | ||
140 | 8. Board File Initialization | 136 | 8. PHY Mappings |
141 | 137 | ||
142 | Certain board file initialization is necessary in order to get a reference | 138 | In order to get reference to a PHY without help from DeviceTree, the framework |
143 | to the PHY in the case of non-dt boot. | 139 | offers lookups which can be compared to clkdev that allow clk structures to be |
144 | Say we have a single device that implements 3 PHYs that of USB, SATA and PCIe, | 140 | bound to devices. A lookup can be made be made during runtime when a handle to |
145 | then in the board file the following initialization should be done. | 141 | the struct phy already exists. |
146 | 142 | ||
147 | struct phy_consumer consumers[] = { | 143 | The framework offers the following API for registering and unregistering the |
148 | PHY_CONSUMER("dwc3.0", "usb"), | 144 | lookups. |
149 | PHY_CONSUMER("pcie.0", "pcie"), | 145 | |
150 | PHY_CONSUMER("sata.0", "sata"), | 146 | int phy_create_lookup(struct phy *phy, const char *con_id, const char *dev_id); |
151 | }; | 147 | void phy_remove_lookup(struct phy *phy, const char *con_id, const char *dev_id); |
152 | PHY_CONSUMER takes 2 parameters, first is the device name of the controller | ||
153 | (PHY consumer) and second is the port name. | ||
154 | |||
155 | struct phy_init_data init_data = { | ||
156 | .consumers = consumers, | ||
157 | .num_consumers = ARRAY_SIZE(consumers), | ||
158 | }; | ||
159 | |||
160 | static const struct platform_device pipe3_phy_dev = { | ||
161 | .name = "pipe3-phy", | ||
162 | .id = -1, | ||
163 | .dev = { | ||
164 | .platform_data = { | ||
165 | .init_data = &init_data, | ||
166 | }, | ||
167 | }, | ||
168 | }; | ||
169 | |||
170 | then, while doing phy_create, the PHY driver should pass this init_data | ||
171 | phy_create(dev, ops, pdata->init_data); | ||
172 | |||
173 | and the controller driver (phy consumer) should pass the port name along with | ||
174 | the device to get a reference to the PHY | ||
175 | phy_get(dev, "pcie"); | ||
176 | 148 | ||
177 | 9. DeviceTree Binding | 149 | 9. DeviceTree Binding |
178 | 150 | ||