xref: /rk3399_rockchip-uboot/include/generic-phy.h (revision 672d3078db622c26e62a60b0d4b433cc1cb32944)
172e5016fSJean-Jacques Hiblot /*
272e5016fSJean-Jacques Hiblot  * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
372e5016fSJean-Jacques Hiblot  * Written by Jean-Jacques Hiblot  <jjhiblot@ti.com>
472e5016fSJean-Jacques Hiblot  *
572e5016fSJean-Jacques Hiblot  * SPDX-License-Identifier:	GPL-2.0+
672e5016fSJean-Jacques Hiblot  */
772e5016fSJean-Jacques Hiblot 
872e5016fSJean-Jacques Hiblot #ifndef __GENERIC_PHY_H
972e5016fSJean-Jacques Hiblot #define __GENERIC_PHY_H
1072e5016fSJean-Jacques Hiblot 
11*672d3078SWyon Bi #include <generic-phy-dp.h>
120725058aSWyon Bi #include <generic-phy-mipi-dphy.h>
130725058aSWyon Bi 
144ef09685SWyon Bi enum phy_mode {
154ef09685SWyon Bi 	PHY_MODE_INVALID,
16*672d3078SWyon Bi 	PHY_MODE_DP,
174ef09685SWyon Bi };
184ef09685SWyon Bi 
194ef09685SWyon Bi /**
204ef09685SWyon Bi  * union phy_configure_opts - Opaque generic phy configuration
210725058aSWyon Bi  *
220725058aSWyon Bi  * @mipi_dphy: Configuration set applicable for phys supporting
230725058aSWyon Bi  *	       the MIPI_DPHY phy mode.
24*672d3078SWyon Bi  * @dp:	       Configuration set applicable for phys supporting
25*672d3078SWyon Bi  *	       the DisplayPort protocol.
264ef09685SWyon Bi  */
274ef09685SWyon Bi union phy_configure_opts {
280725058aSWyon Bi 	struct phy_configure_opts_mipi_dphy     mipi_dphy;
29*672d3078SWyon Bi 	struct phy_configure_opts_dp		dp;
304ef09685SWyon Bi };
3172e5016fSJean-Jacques Hiblot 
3272e5016fSJean-Jacques Hiblot /**
3372e5016fSJean-Jacques Hiblot  * struct phy - A handle to (allowing control of) a single phy port.
3472e5016fSJean-Jacques Hiblot  *
3572e5016fSJean-Jacques Hiblot  * Clients provide storage for phy handles. The content of the structure is
3672e5016fSJean-Jacques Hiblot  * managed solely by the PHY API and PHY drivers. A phy struct is
3772e5016fSJean-Jacques Hiblot  * initialized by "get"ing the phy struct. The phy struct is passed to all
3872e5016fSJean-Jacques Hiblot  * other phy APIs to identify which PHY port to operate upon.
3972e5016fSJean-Jacques Hiblot  *
4072e5016fSJean-Jacques Hiblot  * @dev: The device which implements the PHY port.
4172e5016fSJean-Jacques Hiblot  * @id: The PHY ID within the provider.
4272e5016fSJean-Jacques Hiblot  *
4372e5016fSJean-Jacques Hiblot  */
4472e5016fSJean-Jacques Hiblot struct phy {
4572e5016fSJean-Jacques Hiblot 	struct udevice *dev;
4672e5016fSJean-Jacques Hiblot 	unsigned long id;
4772e5016fSJean-Jacques Hiblot };
4872e5016fSJean-Jacques Hiblot 
4972e5016fSJean-Jacques Hiblot /*
5072e5016fSJean-Jacques Hiblot  * struct udevice_ops - set of function pointers for phy operations
5172e5016fSJean-Jacques Hiblot  * @init: operation to be performed for initializing phy (optional)
5272e5016fSJean-Jacques Hiblot  * @exit: operation to be performed while exiting (optional)
5372e5016fSJean-Jacques Hiblot  * @reset: reset the phy (optional).
5472e5016fSJean-Jacques Hiblot  * @power_on: powering on the phy (optional)
5572e5016fSJean-Jacques Hiblot  * @power_off: powering off the phy (optional)
5672e5016fSJean-Jacques Hiblot  */
5772e5016fSJean-Jacques Hiblot struct phy_ops {
5872e5016fSJean-Jacques Hiblot 	/**
5972e5016fSJean-Jacques Hiblot 	 * of_xlate - Translate a client's device-tree (OF) phy specifier.
6072e5016fSJean-Jacques Hiblot 	 *
6172e5016fSJean-Jacques Hiblot 	 * The PHY core calls this function as the first step in implementing
6272e5016fSJean-Jacques Hiblot 	 * a client's generic_phy_get_by_*() call.
6372e5016fSJean-Jacques Hiblot 	 *
6472e5016fSJean-Jacques Hiblot 	 * If this function pointer is set to NULL, the PHY core will use a
6572e5016fSJean-Jacques Hiblot 	 * default implementation, which assumes #phy-cells = <0> or
6672e5016fSJean-Jacques Hiblot 	 * #phy-cells = <1>, and in the later case that the DT cell
6772e5016fSJean-Jacques Hiblot 	 * contains a simple integer PHY port ID.
6872e5016fSJean-Jacques Hiblot 	 *
6972e5016fSJean-Jacques Hiblot 	 * @phy:	The phy struct to hold the translation result.
7072e5016fSJean-Jacques Hiblot 	 * @args:	The phy specifier values from device tree.
7172e5016fSJean-Jacques Hiblot 	 * @return 0 if OK, or a negative error code.
7272e5016fSJean-Jacques Hiblot 	 */
7323558bb6SSimon Glass 	int	(*of_xlate)(struct phy *phy, struct ofnode_phandle_args *args);
7472e5016fSJean-Jacques Hiblot 
7572e5016fSJean-Jacques Hiblot 	/**
7672e5016fSJean-Jacques Hiblot 	 * init - initialize the hardware.
7772e5016fSJean-Jacques Hiblot 	 *
7872e5016fSJean-Jacques Hiblot 	 * Hardware intialization should not be done in during probe() but
7972e5016fSJean-Jacques Hiblot 	 * should be implemented in this init() function. It could be starting
8072e5016fSJean-Jacques Hiblot 	 * PLL, taking a controller out of reset, routing, etc. This function
8172e5016fSJean-Jacques Hiblot 	 * is typically called only once per PHY port.
8272e5016fSJean-Jacques Hiblot 	 * If power_on() is not implemented, it must power up the phy.
8372e5016fSJean-Jacques Hiblot 	 *
8472e5016fSJean-Jacques Hiblot 	 * @phy:	the PHY port to initialize
8572e5016fSJean-Jacques Hiblot 	 * @return 0 if OK, or a negative error code.
8672e5016fSJean-Jacques Hiblot 	 */
8772e5016fSJean-Jacques Hiblot 	int	(*init)(struct phy *phy);
8872e5016fSJean-Jacques Hiblot 
8972e5016fSJean-Jacques Hiblot 	/**
9072e5016fSJean-Jacques Hiblot 	* exit - de-initialize the PHY device
9172e5016fSJean-Jacques Hiblot 	*
9272e5016fSJean-Jacques Hiblot 	* Hardware de-intialization should be done here. Every step done in
9372e5016fSJean-Jacques Hiblot 	* init() should be undone here.
9472e5016fSJean-Jacques Hiblot 	* This could be used to suspend the phy to reduce power consumption or
9572e5016fSJean-Jacques Hiblot 	* to put the phy in a known condition before booting the OS (though it
9672e5016fSJean-Jacques Hiblot 	* is NOT called automatically before booting the OS)
9772e5016fSJean-Jacques Hiblot 	* If power_off() is not implemented, it must power down the phy.
9872e5016fSJean-Jacques Hiblot 	*
9972e5016fSJean-Jacques Hiblot 	* @phy:	PHY port to be de-initialized
10072e5016fSJean-Jacques Hiblot 	* @return 0 if OK, or a negative error code
10172e5016fSJean-Jacques Hiblot 	*/
10272e5016fSJean-Jacques Hiblot 	int	(*exit)(struct phy *phy);
10372e5016fSJean-Jacques Hiblot 
10472e5016fSJean-Jacques Hiblot 	/**
10572e5016fSJean-Jacques Hiblot 	* reset - resets a PHY device without shutting down
10672e5016fSJean-Jacques Hiblot 	*
10772e5016fSJean-Jacques Hiblot 	* @phy:	PHY port to be reset
10872e5016fSJean-Jacques Hiblot 	*
10972e5016fSJean-Jacques Hiblot 	* During runtime, the PHY may need to be reset in order to
11072e5016fSJean-Jacques Hiblot 	* re-establish connection etc without being shut down or exit.
11172e5016fSJean-Jacques Hiblot 	*
11272e5016fSJean-Jacques Hiblot 	* @return 0 if OK, or a negative error code
11372e5016fSJean-Jacques Hiblot 	*/
11472e5016fSJean-Jacques Hiblot 	int	(*reset)(struct phy *phy);
11572e5016fSJean-Jacques Hiblot 
11672e5016fSJean-Jacques Hiblot 	/**
1174ef09685SWyon Bi 	 * @configure:
1184ef09685SWyon Bi 	 *
1194ef09685SWyon Bi 	 * Optional.
1204ef09685SWyon Bi 	 *
1214ef09685SWyon Bi 	 * Used to change the PHY parameters. phy_init() must have
1224ef09685SWyon Bi 	 * been called on the phy.
1234ef09685SWyon Bi 	 *
1244ef09685SWyon Bi 	 * Returns: 0 if successful, an negative error code otherwise
1254ef09685SWyon Bi 	 */
1264ef09685SWyon Bi 	int	(*configure)(struct phy *phy, union phy_configure_opts *opts);
1274ef09685SWyon Bi 
1284ef09685SWyon Bi 	/**
1294ef09685SWyon Bi 	 * @validate:
1304ef09685SWyon Bi 	 *
1314ef09685SWyon Bi 	 * Optional.
1324ef09685SWyon Bi 	 *
1334ef09685SWyon Bi 	 * Used to check that the current set of parameters can be
1344ef09685SWyon Bi 	 * handled by the phy. Implementations are free to tune the
1354ef09685SWyon Bi 	 * parameters passed as arguments if needed by some
1364ef09685SWyon Bi 	 * implementation detail or constraints. It must not change
1374ef09685SWyon Bi 	 * any actual configuration of the PHY, so calling it as many
1384ef09685SWyon Bi 	 * times as deemed fit by the consumer must have no side
1394ef09685SWyon Bi 	 * effect.
1404ef09685SWyon Bi 	 *
1414ef09685SWyon Bi 	 * Returns: 0 if the configuration can be applied, an negative
1424ef09685SWyon Bi 	 * error code otherwise
1434ef09685SWyon Bi 	 */
1444ef09685SWyon Bi 	int	(*validate)(struct phy *phy, enum phy_mode mode, int submode,
1454ef09685SWyon Bi 			    union phy_configure_opts *opts);
1464ef09685SWyon Bi 
1474ef09685SWyon Bi 	/**
14872e5016fSJean-Jacques Hiblot 	* power_on - power on a PHY device
14972e5016fSJean-Jacques Hiblot 	*
15072e5016fSJean-Jacques Hiblot 	* @phy:	PHY port to be powered on
15172e5016fSJean-Jacques Hiblot 	*
15272e5016fSJean-Jacques Hiblot 	* During runtime, the PHY may need to be powered on or off several
15372e5016fSJean-Jacques Hiblot 	* times. This function is used to power on the PHY. It relies on the
15472e5016fSJean-Jacques Hiblot 	* setup done in init(). If init() is not implemented, it must take care
15572e5016fSJean-Jacques Hiblot 	* of setting up the context (PLLs, ...)
15672e5016fSJean-Jacques Hiblot 	*
15772e5016fSJean-Jacques Hiblot 	* @return 0 if OK, or a negative error code
15872e5016fSJean-Jacques Hiblot 	*/
15972e5016fSJean-Jacques Hiblot 	int	(*power_on)(struct phy *phy);
16072e5016fSJean-Jacques Hiblot 
16172e5016fSJean-Jacques Hiblot 	/**
16272e5016fSJean-Jacques Hiblot 	* power_off - power off a PHY device
16372e5016fSJean-Jacques Hiblot 	*
16472e5016fSJean-Jacques Hiblot 	* @phy:	PHY port to be powered off
16572e5016fSJean-Jacques Hiblot 	*
16672e5016fSJean-Jacques Hiblot 	* During runtime, the PHY may need to be powered on or off several
16772e5016fSJean-Jacques Hiblot 	* times. This function is used to power off the PHY. Except if
16872e5016fSJean-Jacques Hiblot 	* init()/deinit() are not implemented, it must not de-initialize
16972e5016fSJean-Jacques Hiblot 	* everything.
17072e5016fSJean-Jacques Hiblot 	*
17172e5016fSJean-Jacques Hiblot 	* @return 0 if OK, or a negative error code
17272e5016fSJean-Jacques Hiblot 	*/
17372e5016fSJean-Jacques Hiblot 	int	(*power_off)(struct phy *phy);
17472e5016fSJean-Jacques Hiblot };
17572e5016fSJean-Jacques Hiblot 
176d9fb7becSPatrice Chotard #ifdef CONFIG_PHY
17772e5016fSJean-Jacques Hiblot 
17872e5016fSJean-Jacques Hiblot /**
17972e5016fSJean-Jacques Hiblot  * generic_phy_init() - initialize the PHY port
18072e5016fSJean-Jacques Hiblot  *
18172e5016fSJean-Jacques Hiblot  * @phy:	the PHY port to initialize
18272e5016fSJean-Jacques Hiblot  * @return 0 if OK, or a negative error code
18372e5016fSJean-Jacques Hiblot  */
18472e5016fSJean-Jacques Hiblot int generic_phy_init(struct phy *phy);
18572e5016fSJean-Jacques Hiblot 
18672e5016fSJean-Jacques Hiblot /**
18772e5016fSJean-Jacques Hiblot  * generic_phy_init() - de-initialize the PHY device
18872e5016fSJean-Jacques Hiblot  *
18972e5016fSJean-Jacques Hiblot  * @phy:	PHY port to be de-initialized
19072e5016fSJean-Jacques Hiblot  * @return 0 if OK, or a negative error code
19172e5016fSJean-Jacques Hiblot  */
19272e5016fSJean-Jacques Hiblot int generic_phy_exit(struct phy *phy);
19372e5016fSJean-Jacques Hiblot 
19472e5016fSJean-Jacques Hiblot /**
19572e5016fSJean-Jacques Hiblot  * generic_phy_reset() - resets a PHY device without shutting down
19672e5016fSJean-Jacques Hiblot  *
19772e5016fSJean-Jacques Hiblot  * @phy:	PHY port to be reset
19872e5016fSJean-Jacques Hiblot  *@return 0 if OK, or a negative error code
19972e5016fSJean-Jacques Hiblot  */
20072e5016fSJean-Jacques Hiblot int generic_phy_reset(struct phy *phy);
20172e5016fSJean-Jacques Hiblot 
20272e5016fSJean-Jacques Hiblot /**
2034ef09685SWyon Bi  * generic_phy_configure() - change the PHY parameters
2044ef09685SWyon Bi  *
2054ef09685SWyon Bi  * @phy:        PHY port to be configure
2064ef09685SWyon Bi  * @return 0 if OK, or a negative error code
2074ef09685SWyon Bi  */
2084ef09685SWyon Bi int generic_phy_configure(struct phy *phy, union phy_configure_opts *opts);
2094ef09685SWyon Bi 
2104ef09685SWyon Bi /**
2114ef09685SWyon Bi  * generic_phy_validate() - validate the PHY parameters
2124ef09685SWyon Bi  *
2134ef09685SWyon Bi  * @phy:        PHY port to be validate
2144ef09685SWyon Bi  * @return 0 if OK, or a negative error code
2154ef09685SWyon Bi  */
2164ef09685SWyon Bi int generic_phy_validate(struct phy *phy, enum phy_mode mode, int submode,
2174ef09685SWyon Bi 			 union phy_configure_opts *opts);
2184ef09685SWyon Bi 
2194ef09685SWyon Bi /**
22072e5016fSJean-Jacques Hiblot  * generic_phy_power_on() - power on a PHY device
22172e5016fSJean-Jacques Hiblot  *
22272e5016fSJean-Jacques Hiblot  * @phy:	PHY port to be powered on
22372e5016fSJean-Jacques Hiblot  * @return 0 if OK, or a negative error code
22472e5016fSJean-Jacques Hiblot  */
22572e5016fSJean-Jacques Hiblot int generic_phy_power_on(struct phy *phy);
22672e5016fSJean-Jacques Hiblot 
22772e5016fSJean-Jacques Hiblot /**
22872e5016fSJean-Jacques Hiblot  * generic_phy_power_off() - power off a PHY device
22972e5016fSJean-Jacques Hiblot  *
23072e5016fSJean-Jacques Hiblot  * @phy:	PHY port to be powered off
23172e5016fSJean-Jacques Hiblot  * @return 0 if OK, or a negative error code
23272e5016fSJean-Jacques Hiblot  */
23372e5016fSJean-Jacques Hiblot int generic_phy_power_off(struct phy *phy);
23472e5016fSJean-Jacques Hiblot 
23572e5016fSJean-Jacques Hiblot 
23672e5016fSJean-Jacques Hiblot /**
23772e5016fSJean-Jacques Hiblot  * generic_phy_get_by_index() - Get a PHY device by integer index.
23872e5016fSJean-Jacques Hiblot  *
23972e5016fSJean-Jacques Hiblot  * @user:	the client device
24072e5016fSJean-Jacques Hiblot  * @index:	The index in the list of available PHYs
24172e5016fSJean-Jacques Hiblot  * @phy:	A pointer to the PHY port
24272e5016fSJean-Jacques Hiblot  *
24372e5016fSJean-Jacques Hiblot  * This looks up a PHY device for a client device based on its position in the
24472e5016fSJean-Jacques Hiblot  * list of the possible PHYs.
24572e5016fSJean-Jacques Hiblot  *
24672e5016fSJean-Jacques Hiblot  * example:
24772e5016fSJean-Jacques Hiblot  * usb1: usb_otg_ss@xxx {
24872e5016fSJean-Jacques Hiblot  *       compatible = "xxx";
24972e5016fSJean-Jacques Hiblot  *       reg = <xxx>;
25072e5016fSJean-Jacques Hiblot  *   .
25172e5016fSJean-Jacques Hiblot  *   .
25272e5016fSJean-Jacques Hiblot  *   phys = <&usb2_phy>, <&usb3_phy>;
25372e5016fSJean-Jacques Hiblot  *   .
25472e5016fSJean-Jacques Hiblot  *   .
25572e5016fSJean-Jacques Hiblot  * };
25672e5016fSJean-Jacques Hiblot  * the USB2 phy can be accessed by passing index '0' and the USB3 phy can
25772e5016fSJean-Jacques Hiblot  * be accessed by passing index '1'
25872e5016fSJean-Jacques Hiblot  *
25972e5016fSJean-Jacques Hiblot  * @return 0 if OK, or a negative error code
26072e5016fSJean-Jacques Hiblot  */
26172e5016fSJean-Jacques Hiblot int generic_phy_get_by_index(struct udevice *user, int index,
26272e5016fSJean-Jacques Hiblot 			     struct phy *phy);
26372e5016fSJean-Jacques Hiblot 
26472e5016fSJean-Jacques Hiblot /**
26572e5016fSJean-Jacques Hiblot  * generic_phy_get_by_name() - Get a PHY device by its name.
26672e5016fSJean-Jacques Hiblot  *
26772e5016fSJean-Jacques Hiblot  * @user:	the client device
26872e5016fSJean-Jacques Hiblot  * @phy_name:	The name of the PHY in the list of possible PHYs
26972e5016fSJean-Jacques Hiblot  * @phy:	A pointer to the PHY port
27072e5016fSJean-Jacques Hiblot  *
27172e5016fSJean-Jacques Hiblot  * This looks up a PHY device for a client device in the
27272e5016fSJean-Jacques Hiblot  * list of the possible PHYs based on its name.
27372e5016fSJean-Jacques Hiblot  *
27472e5016fSJean-Jacques Hiblot  * example:
27572e5016fSJean-Jacques Hiblot  * usb1: usb_otg_ss@xxx {
27672e5016fSJean-Jacques Hiblot  *       compatible = "xxx";
27772e5016fSJean-Jacques Hiblot  *       reg = <xxx>;
27872e5016fSJean-Jacques Hiblot  *   .
27972e5016fSJean-Jacques Hiblot  *   .
28072e5016fSJean-Jacques Hiblot  *   phys = <&usb2_phy>, <&usb3_phy>;
28172e5016fSJean-Jacques Hiblot  *   phy-names = "usb2phy", "usb3phy";
28272e5016fSJean-Jacques Hiblot  *   .
28372e5016fSJean-Jacques Hiblot  *   .
28472e5016fSJean-Jacques Hiblot  * };
28572e5016fSJean-Jacques Hiblot  * the USB3 phy can be accessed using "usb3phy", and USB2 by using "usb2phy"
28672e5016fSJean-Jacques Hiblot  *
28772e5016fSJean-Jacques Hiblot  * @return 0 if OK, or a negative error code
28872e5016fSJean-Jacques Hiblot  */
28972e5016fSJean-Jacques Hiblot int generic_phy_get_by_name(struct udevice *user, const char *phy_name,
29072e5016fSJean-Jacques Hiblot 			    struct phy *phy);
29172e5016fSJean-Jacques Hiblot 
292d9fb7becSPatrice Chotard #else /* CONFIG_PHY */
293d9fb7becSPatrice Chotard 
294d9fb7becSPatrice Chotard static inline int generic_phy_init(struct phy *phy)
295d9fb7becSPatrice Chotard {
296d9fb7becSPatrice Chotard 	return 0;
297d9fb7becSPatrice Chotard }
298d9fb7becSPatrice Chotard 
299d9fb7becSPatrice Chotard static inline int generic_phy_exit(struct phy *phy)
300d9fb7becSPatrice Chotard {
301d9fb7becSPatrice Chotard 	return 0;
302d9fb7becSPatrice Chotard }
303d9fb7becSPatrice Chotard 
304d9fb7becSPatrice Chotard static inline int generic_phy_reset(struct phy *phy)
305d9fb7becSPatrice Chotard {
306d9fb7becSPatrice Chotard 	return 0;
307d9fb7becSPatrice Chotard }
308d9fb7becSPatrice Chotard 
3094ef09685SWyon Bi static inline int generic_phy_configure(struct phy *phy,
3104ef09685SWyon Bi 					union phy_configure_opts *opts)
3114ef09685SWyon Bi {
3124ef09685SWyon Bi 	return 0;
3134ef09685SWyon Bi }
3144ef09685SWyon Bi 
3154ef09685SWyon Bi static inline int generic_phy_validate(struct phy *phy, enum phy_mode mode,
3164ef09685SWyon Bi 				       int submode,
3174ef09685SWyon Bi 				       union phy_configure_opts *opts)
3184ef09685SWyon Bi {
3194ef09685SWyon Bi 	return 0;
3204ef09685SWyon Bi }
3214ef09685SWyon Bi 
322d9fb7becSPatrice Chotard static inline int generic_phy_power_on(struct phy *phy)
323d9fb7becSPatrice Chotard {
324d9fb7becSPatrice Chotard 	return 0;
325d9fb7becSPatrice Chotard }
326d9fb7becSPatrice Chotard 
327d9fb7becSPatrice Chotard static inline int generic_phy_power_off(struct phy *phy)
328d9fb7becSPatrice Chotard {
329d9fb7becSPatrice Chotard 	return 0;
330d9fb7becSPatrice Chotard }
331d9fb7becSPatrice Chotard 
332d9fb7becSPatrice Chotard static inline int generic_phy_get_by_index(struct udevice *user, int index,
333d9fb7becSPatrice Chotard 			     struct phy *phy)
334d9fb7becSPatrice Chotard {
335d9fb7becSPatrice Chotard 	return 0;
336d9fb7becSPatrice Chotard }
337d9fb7becSPatrice Chotard 
338d9fb7becSPatrice Chotard static inline int generic_phy_get_by_name(struct udevice *user, const char *phy_name,
339d9fb7becSPatrice Chotard 			    struct phy *phy)
340d9fb7becSPatrice Chotard {
341d9fb7becSPatrice Chotard 	return 0;
342d9fb7becSPatrice Chotard }
343d9fb7becSPatrice Chotard 
344d9fb7becSPatrice Chotard #endif /* CONFIG_PHY */
345d9fb7becSPatrice Chotard 
346b94888b4SPatrice Chotard /**
347b94888b4SPatrice Chotard  * generic_phy_valid() - check if PHY port is valid
348b94888b4SPatrice Chotard  *
349b94888b4SPatrice Chotard  * @phy:	the PHY port to check
350b94888b4SPatrice Chotard  * @return TRUE if valid, or FALSE
351b94888b4SPatrice Chotard  */
352b94888b4SPatrice Chotard static inline bool generic_phy_valid(struct phy *phy)
353b94888b4SPatrice Chotard {
3541bac1f39SJean-Jacques Hiblot 	return phy && phy->dev;
355b94888b4SPatrice Chotard }
356b94888b4SPatrice Chotard 
35772e5016fSJean-Jacques Hiblot #endif /*__GENERIC_PHY_H */
358