Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

phy.txt: standardize document format

Each text file under Documentation follows a different
format. Some doesn't even have titles!

Change its representation to follow the adopted standard,
using ReST markups for it to be parseable by Sphinx:

- mark titles;
- use :Author: for authorship;
- mark literal blocks.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>

authored by

Mauro Carvalho Chehab and committed by
Jonathan Corbet
5426a2cc c437c3a4

+67 -39
+67 -39
Documentation/phy.txt
··· 1 - PHY SUBSYSTEM 2 - Kishon Vijay Abraham I <kishon@ti.com> 1 + ============= 2 + PHY subsystem 3 + ============= 4 + 5 + :Author: Kishon Vijay Abraham I <kishon@ti.com> 3 6 4 7 This document explains the Generic PHY Framework along with the APIs provided, 5 8 and how-to-use. 6 9 7 - 1. Introduction 10 + Introduction 11 + ============ 8 12 9 13 *PHY* is the abbreviation for physical layer. It is used to connect a device 10 14 to the physical medium e.g., the USB controller has a PHY to provide functions ··· 25 21 This framework will be of use only to devices that use external PHY (PHY 26 22 functionality is not embedded within the controller). 27 23 28 - 2. Registering/Unregistering the PHY provider 24 + Registering/Unregistering the PHY provider 25 + ========================================== 29 26 30 27 PHY provider refers to an entity that implements one or more PHY instances. 31 28 For the simple case where the PHY provider implements only a single instance of ··· 35 30 should provide its own implementation of of_xlate. of_xlate is used only for 36 31 dt boot case. 37 32 38 - #define of_phy_provider_register(dev, xlate) \ 39 - __of_phy_provider_register((dev), NULL, THIS_MODULE, (xlate)) 33 + :: 40 34 41 - #define devm_of_phy_provider_register(dev, xlate) \ 42 - __devm_of_phy_provider_register((dev), NULL, THIS_MODULE, (xlate)) 35 + #define of_phy_provider_register(dev, xlate) \ 36 + __of_phy_provider_register((dev), NULL, THIS_MODULE, (xlate)) 37 + 38 + #define devm_of_phy_provider_register(dev, xlate) \ 39 + __devm_of_phy_provider_register((dev), NULL, THIS_MODULE, 40 + (xlate)) 43 41 44 42 of_phy_provider_register and devm_of_phy_provider_register macros can be used to 45 43 register the phy_provider and it takes device and of_xlate as ··· 55 47 level of_phy_provider_register_full() and devm_of_phy_provider_register_full() 56 48 macros can be used to override the node containing the children. 57 49 58 - #define of_phy_provider_register_full(dev, children, xlate) \ 59 - __of_phy_provider_register(dev, children, THIS_MODULE, xlate) 50 + :: 60 51 61 - #define devm_of_phy_provider_register_full(dev, children, xlate) \ 62 - __devm_of_phy_provider_register_full(dev, children, THIS_MODULE, xlate) 52 + #define of_phy_provider_register_full(dev, children, xlate) \ 53 + __of_phy_provider_register(dev, children, THIS_MODULE, xlate) 63 54 64 - void devm_of_phy_provider_unregister(struct device *dev, 65 - struct phy_provider *phy_provider); 66 - void of_phy_provider_unregister(struct phy_provider *phy_provider); 55 + #define devm_of_phy_provider_register_full(dev, children, xlate) \ 56 + __devm_of_phy_provider_register_full(dev, children, 57 + THIS_MODULE, xlate) 58 + 59 + void devm_of_phy_provider_unregister(struct device *dev, 60 + struct phy_provider *phy_provider); 61 + void of_phy_provider_unregister(struct phy_provider *phy_provider); 67 62 68 63 devm_of_phy_provider_unregister and of_phy_provider_unregister can be used to 69 64 unregister the PHY. 70 65 71 - 3. Creating the PHY 66 + Creating the PHY 67 + ================ 72 68 73 69 The PHY driver should create the PHY in order for other peripheral controllers 74 70 to make use of it. The PHY framework provides 2 APIs to create the PHY. 75 71 76 - struct phy *phy_create(struct device *dev, struct device_node *node, 77 - const struct phy_ops *ops); 78 - struct phy *devm_phy_create(struct device *dev, struct device_node *node, 79 - const struct phy_ops *ops); 72 + :: 73 + 74 + struct phy *phy_create(struct device *dev, struct device_node *node, 75 + const struct phy_ops *ops); 76 + struct phy *devm_phy_create(struct device *dev, 77 + struct device_node *node, 78 + const struct phy_ops *ops); 80 79 81 80 The PHY drivers can use one of the above 2 APIs to create the PHY by passing 82 81 the device pointer and phy ops. ··· 99 84 Before the controller can make use of the PHY, it has to get a reference to 100 85 it. This framework provides the following APIs to get a reference to the PHY. 101 86 102 - struct phy *phy_get(struct device *dev, const char *string); 103 - struct phy *phy_optional_get(struct device *dev, const char *string); 104 - struct phy *devm_phy_get(struct device *dev, const char *string); 105 - struct phy *devm_phy_optional_get(struct device *dev, const char *string); 106 - struct phy *devm_of_phy_get_by_index(struct device *dev, struct device_node *np, 107 - int index); 87 + :: 88 + 89 + struct phy *phy_get(struct device *dev, const char *string); 90 + struct phy *phy_optional_get(struct device *dev, const char *string); 91 + struct phy *devm_phy_get(struct device *dev, const char *string); 92 + struct phy *devm_phy_optional_get(struct device *dev, 93 + const char *string); 94 + struct phy *devm_of_phy_get_by_index(struct device *dev, 95 + struct device_node *np, 96 + int index); 108 97 109 98 phy_get, phy_optional_get, devm_phy_get and devm_phy_optional_get can 110 99 be used to get the PHY. In the case of dt boot, the string arguments ··· 130 111 phy_power_off() calls are all NOP when applied to a NULL phy. The NULL 131 112 phy is useful in devices for handling optional phy devices. 132 113 133 - 5. Releasing a reference to the PHY 114 + Releasing a reference to the PHY 115 + ================================ 134 116 135 117 When the controller no longer needs the PHY, it has to release the reference 136 118 to the PHY it has obtained using the APIs mentioned in the above section. The 137 119 PHY framework provides 2 APIs to release a reference to the PHY. 138 120 139 - void phy_put(struct phy *phy); 140 - void devm_phy_put(struct device *dev, struct phy *phy); 121 + :: 122 + 123 + void phy_put(struct phy *phy); 124 + void devm_phy_put(struct device *dev, struct phy *phy); 141 125 142 126 Both these APIs are used to release a reference to the PHY and devm_phy_put 143 127 destroys the devres associated with this PHY. 144 128 145 - 6. Destroying the PHY 129 + Destroying the PHY 130 + ================== 146 131 147 132 When the driver that created the PHY is unloaded, it should destroy the PHY it 148 - created using one of the following 2 APIs. 133 + created using one of the following 2 APIs:: 149 134 150 - void phy_destroy(struct phy *phy); 151 - void devm_phy_destroy(struct device *dev, struct phy *phy); 135 + void phy_destroy(struct phy *phy); 136 + void devm_phy_destroy(struct device *dev, struct phy *phy); 152 137 153 138 Both these APIs destroy the PHY and devm_phy_destroy destroys the devres 154 139 associated with this PHY. 155 140 156 - 7. PM Runtime 141 + PM Runtime 142 + ========== 157 143 158 144 This subsystem is pm runtime enabled. So while creating the PHY, 159 145 pm_runtime_enable of the phy device created by this subsystem is called and ··· 174 150 phy_pm_runtime_put, phy_pm_runtime_put_sync, phy_pm_runtime_allow and 175 151 phy_pm_runtime_forbid for performing PM operations. 176 152 177 - 8. PHY Mappings 153 + PHY Mappings 154 + ============ 178 155 179 156 In order to get reference to a PHY without help from DeviceTree, the framework 180 157 offers lookups which can be compared to clkdev that allow clk structures to be ··· 183 158 the struct phy already exists. 184 159 185 160 The framework offers the following API for registering and unregistering the 186 - lookups. 161 + lookups:: 187 162 188 - int phy_create_lookup(struct phy *phy, const char *con_id, const char *dev_id); 189 - void phy_remove_lookup(struct phy *phy, const char *con_id, const char *dev_id); 163 + int phy_create_lookup(struct phy *phy, const char *con_id, 164 + const char *dev_id); 165 + void phy_remove_lookup(struct phy *phy, const char *con_id, 166 + const char *dev_id); 190 167 191 - 9. DeviceTree Binding 168 + DeviceTree Binding 169 + ================== 192 170 193 171 The documentation for PHY dt binding can be found @ 194 172 Documentation/devicetree/bindings/phy/phy-bindings.txt