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