Lines Matching +full:phy +full:- +full:mode
2 * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
3 * Written by Jean-Jacques Hiblot <jjhiblot@ti.com>
5 * SPDX-License-Identifier: GPL-2.0+
11 #include <generic-phy-dp.h>
12 #include <generic-phy-mipi-dphy.h>
13 #include <generic-phy-pcie.h>
21 * union phy_configure_opts - Opaque generic phy configuration
24 * the MIPI_DPHY phy mode.
35 * struct phy_attrs - represents phy attributes
36 * @bus_width: Data path width implemented by PHY
37 * @max_link_rate: Maximum link rate supported by PHY (in Mbps)
38 * @mode: PHY mode
43 enum phy_mode mode; member
47 * struct phy - A handle to (allowing control of) a single phy port.
49 * Clients provide storage for phy handles. The content of the structure is
50 * managed solely by the PHY API and PHY drivers. A phy struct is
51 * initialized by "get"ing the phy struct. The phy struct is passed to all
52 * other phy APIs to identify which PHY port to operate upon.
54 * @dev: The device which implements the PHY port.
55 * @id: The PHY ID within the provider.
58 struct phy { struct
65 * struct udevice_ops - set of function pointers for phy operations argument
66 * @init: operation to be performed for initializing phy (optional)
68 * @reset: reset the phy (optional).
69 * @power_on: powering on the phy (optional)
70 * @power_off: powering off the phy (optional)
71 * @set_mode: set the mode of the phy
75 * of_xlate - Translate a client's device-tree (OF) phy specifier.
77 * The PHY core calls this function as the first step in implementing
80 * If this function pointer is set to NULL, the PHY core will use a
81 * default implementation, which assumes #phy-cells = <0> or
82 * #phy-cells = <1>, and in the later case that the DT cell
83 * contains a simple integer PHY port ID.
85 * @phy: The phy struct to hold the translation result.
86 * @args: The phy specifier values from device tree.
89 int (*of_xlate)(struct phy *phy, struct ofnode_phandle_args *args);
92 * init - initialize the hardware.
97 * is typically called only once per PHY port.
98 * If power_on() is not implemented, it must power up the phy.
100 * @phy: the PHY port to initialize
103 int (*init)(struct phy *phy);
106 * exit - de-initialize the PHY device
108 * Hardware de-intialization should be done here. Every step done in
110 * This could be used to suspend the phy to reduce power consumption or
111 * to put the phy in a known condition before booting the OS (though it
113 * If power_off() is not implemented, it must power down the phy.
115 * @phy: PHY port to be de-initialized
118 int (*exit)(struct phy *phy);
121 * reset - resets a PHY device without shutting down
123 * @phy: PHY port to be reset
125 * During runtime, the PHY may need to be reset in order to
126 * re-establish connection etc without being shut down or exit.
130 int (*reset)(struct phy *phy);
137 * Used to change the PHY parameters. phy_init() must have
138 * been called on the phy.
142 int (*configure)(struct phy *phy, union phy_configure_opts *opts);
150 * handled by the phy. Implementations are free to tune the
153 * any actual configuration of the PHY, so calling it as many
160 int (*validate)(struct phy *phy, enum phy_mode mode, int submode,
164 * power_on - power on a PHY device
166 * @phy: PHY port to be powered on
168 * During runtime, the PHY may need to be powered on or off several
169 * times. This function is used to power on the PHY. It relies on the
175 int (*power_on)(struct phy *phy);
178 * power_off - power off a PHY device
180 * @phy: PHY port to be powered off
182 * During runtime, the PHY may need to be powered on or off several
183 * times. This function is used to power off the PHY. Except if
184 * init()/deinit() are not implemented, it must not de-initialize
189 int (*power_off)(struct phy *phy);
191 int (*set_mode)(struct phy *phy, enum phy_mode mode, int submode);
197 * generic_phy_init() - initialize the PHY port
199 * @phy: the PHY port to initialize
202 int generic_phy_init(struct phy *phy);
205 * generic_phy_init() - de-initialize the PHY device
207 * @phy: PHY port to be de-initialized
210 int generic_phy_exit(struct phy *phy);
213 * generic_phy_reset() - resets a PHY device without shutting down
215 * @phy: PHY port to be reset
218 int generic_phy_reset(struct phy *phy);
221 * generic_phy_configure() - change the PHY parameters
223 * @phy: PHY port to be configure
226 int generic_phy_configure(struct phy *phy, union phy_configure_opts *opts);
229 * generic_phy_validate() - validate the PHY parameters
231 * @phy: PHY port to be validate
234 int generic_phy_validate(struct phy *phy, enum phy_mode mode, int submode,
238 * generic_phy_power_on() - power on a PHY device
240 * @phy: PHY port to be powered on
243 int generic_phy_power_on(struct phy *phy);
246 * generic_phy_power_off() - power off a PHY device
248 * @phy: PHY port to be powered off
251 int generic_phy_power_off(struct phy *phy);
253 int generic_phy_set_mode_ext(struct phy *phy, enum phy_mode mode, int submode);
254 #define generic_phy_set_mode(phy, mode) \ argument
255 generic_phy_set_mode_ext(phy, mode, 0)
257 static inline enum phy_mode generic_phy_get_mode(struct phy *phy) in generic_phy_get_mode() argument
259 return phy->attrs.mode; in generic_phy_get_mode()
263 * generic_phy_get_by_index() - Get a PHY device by integer index.
267 * @phy: A pointer to the PHY port
269 * This looks up a PHY device for a client device based on its position in the
282 * the USB2 phy can be accessed by passing index '0' and the USB3 phy can
288 struct phy *phy);
291 * generic_phy_get_by_name() - Get a PHY device by its name.
294 * @phy_name: The name of the PHY in the list of possible PHYs
295 * @phy: A pointer to the PHY port
297 * This looks up a PHY device for a client device in the
307 * phy-names = "usb2phy", "usb3phy";
311 * the USB3 phy can be accessed using "usb3phy", and USB2 by using "usb2phy"
316 struct phy *phy);
320 static inline int generic_phy_init(struct phy *phy) in generic_phy_init() argument
325 static inline int generic_phy_exit(struct phy *phy) in generic_phy_exit() argument
330 static inline int generic_phy_reset(struct phy *phy) in generic_phy_reset() argument
335 static inline int generic_phy_configure(struct phy *phy, in generic_phy_configure() argument
341 static inline int generic_phy_validate(struct phy *phy, enum phy_mode mode, in generic_phy_validate() argument
348 static inline int generic_phy_power_on(struct phy *phy) in generic_phy_power_on() argument
353 static inline int generic_phy_power_off(struct phy *phy) in generic_phy_power_off() argument
359 struct phy *phy) in generic_phy_get_by_index() argument
365 struct phy *phy) in generic_phy_get_by_name() argument
370 static inline int generic_phy_set_mode_ext(struct phy *phy, enum phy_mode mode, in generic_phy_set_mode_ext() argument
376 #define generic_phy_set_mode(phy, mode) \ argument
377 generic_phy_set_mode_ext(phy, mode, 0)
382 * generic_phy_valid() - check if PHY port is valid
384 * @phy: the PHY port to check
387 static inline bool generic_phy_valid(struct phy *phy) in generic_phy_valid() argument
389 return phy && phy->dev; in generic_phy_valid()