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>
13c2482762SShawn 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;
31c2482762SShawn Lin struct phy_configure_opts_pcie pcie;
324ef09685SWyon Bi };
3372e5016fSJean-Jacques Hiblot
3472e5016fSJean-Jacques Hiblot /**
35*e9c6c0e2SWyon Bi * struct phy_attrs - represents phy attributes
36*e9c6c0e2SWyon Bi * @bus_width: Data path width implemented by PHY
37*e9c6c0e2SWyon Bi * @max_link_rate: Maximum link rate supported by PHY (in Mbps)
38*e9c6c0e2SWyon Bi * @mode: PHY mode
39*e9c6c0e2SWyon Bi */
40*e9c6c0e2SWyon Bi struct phy_attrs {
41*e9c6c0e2SWyon Bi u32 bus_width;
42*e9c6c0e2SWyon Bi u32 max_link_rate;
43*e9c6c0e2SWyon Bi enum phy_mode mode;
44*e9c6c0e2SWyon Bi };
45*e9c6c0e2SWyon Bi
46*e9c6c0e2SWyon Bi /**
4772e5016fSJean-Jacques Hiblot * struct phy - A handle to (allowing control of) a single phy port.
4872e5016fSJean-Jacques Hiblot *
4972e5016fSJean-Jacques Hiblot * Clients provide storage for phy handles. The content of the structure is
5072e5016fSJean-Jacques Hiblot * managed solely by the PHY API and PHY drivers. A phy struct is
5172e5016fSJean-Jacques Hiblot * initialized by "get"ing the phy struct. The phy struct is passed to all
5272e5016fSJean-Jacques Hiblot * other phy APIs to identify which PHY port to operate upon.
5372e5016fSJean-Jacques Hiblot *
5472e5016fSJean-Jacques Hiblot * @dev: The device which implements the PHY port.
5572e5016fSJean-Jacques Hiblot * @id: The PHY ID within the provider.
5672e5016fSJean-Jacques Hiblot *
5772e5016fSJean-Jacques Hiblot */
5872e5016fSJean-Jacques Hiblot struct phy {
5972e5016fSJean-Jacques Hiblot struct udevice *dev;
6072e5016fSJean-Jacques Hiblot unsigned long id;
61*e9c6c0e2SWyon Bi struct phy_attrs attrs;
6272e5016fSJean-Jacques Hiblot };
6372e5016fSJean-Jacques Hiblot
6472e5016fSJean-Jacques Hiblot /*
6572e5016fSJean-Jacques Hiblot * struct udevice_ops - set of function pointers for phy operations
6672e5016fSJean-Jacques Hiblot * @init: operation to be performed for initializing phy (optional)
6772e5016fSJean-Jacques Hiblot * @exit: operation to be performed while exiting (optional)
6872e5016fSJean-Jacques Hiblot * @reset: reset the phy (optional).
6972e5016fSJean-Jacques Hiblot * @power_on: powering on the phy (optional)
7072e5016fSJean-Jacques Hiblot * @power_off: powering off the phy (optional)
71*e9c6c0e2SWyon Bi * @set_mode: set the mode of the phy
7272e5016fSJean-Jacques Hiblot */
7372e5016fSJean-Jacques Hiblot struct phy_ops {
7472e5016fSJean-Jacques Hiblot /**
7572e5016fSJean-Jacques Hiblot * of_xlate - Translate a client's device-tree (OF) phy specifier.
7672e5016fSJean-Jacques Hiblot *
7772e5016fSJean-Jacques Hiblot * The PHY core calls this function as the first step in implementing
7872e5016fSJean-Jacques Hiblot * a client's generic_phy_get_by_*() call.
7972e5016fSJean-Jacques Hiblot *
8072e5016fSJean-Jacques Hiblot * If this function pointer is set to NULL, the PHY core will use a
8172e5016fSJean-Jacques Hiblot * default implementation, which assumes #phy-cells = <0> or
8272e5016fSJean-Jacques Hiblot * #phy-cells = <1>, and in the later case that the DT cell
8372e5016fSJean-Jacques Hiblot * contains a simple integer PHY port ID.
8472e5016fSJean-Jacques Hiblot *
8572e5016fSJean-Jacques Hiblot * @phy: The phy struct to hold the translation result.
8672e5016fSJean-Jacques Hiblot * @args: The phy specifier values from device tree.
8772e5016fSJean-Jacques Hiblot * @return 0 if OK, or a negative error code.
8872e5016fSJean-Jacques Hiblot */
8923558bb6SSimon Glass int (*of_xlate)(struct phy *phy, struct ofnode_phandle_args *args);
9072e5016fSJean-Jacques Hiblot
9172e5016fSJean-Jacques Hiblot /**
9272e5016fSJean-Jacques Hiblot * init - initialize the hardware.
9372e5016fSJean-Jacques Hiblot *
9472e5016fSJean-Jacques Hiblot * Hardware intialization should not be done in during probe() but
9572e5016fSJean-Jacques Hiblot * should be implemented in this init() function. It could be starting
9672e5016fSJean-Jacques Hiblot * PLL, taking a controller out of reset, routing, etc. This function
9772e5016fSJean-Jacques Hiblot * is typically called only once per PHY port.
9872e5016fSJean-Jacques Hiblot * If power_on() is not implemented, it must power up the phy.
9972e5016fSJean-Jacques Hiblot *
10072e5016fSJean-Jacques Hiblot * @phy: the PHY port to initialize
10172e5016fSJean-Jacques Hiblot * @return 0 if OK, or a negative error code.
10272e5016fSJean-Jacques Hiblot */
10372e5016fSJean-Jacques Hiblot int (*init)(struct phy *phy);
10472e5016fSJean-Jacques Hiblot
10572e5016fSJean-Jacques Hiblot /**
10672e5016fSJean-Jacques Hiblot * exit - de-initialize the PHY device
10772e5016fSJean-Jacques Hiblot *
10872e5016fSJean-Jacques Hiblot * Hardware de-intialization should be done here. Every step done in
10972e5016fSJean-Jacques Hiblot * init() should be undone here.
11072e5016fSJean-Jacques Hiblot * This could be used to suspend the phy to reduce power consumption or
11172e5016fSJean-Jacques Hiblot * to put the phy in a known condition before booting the OS (though it
11272e5016fSJean-Jacques Hiblot * is NOT called automatically before booting the OS)
11372e5016fSJean-Jacques Hiblot * If power_off() is not implemented, it must power down the phy.
11472e5016fSJean-Jacques Hiblot *
11572e5016fSJean-Jacques Hiblot * @phy: PHY port to be de-initialized
11672e5016fSJean-Jacques Hiblot * @return 0 if OK, or a negative error code
11772e5016fSJean-Jacques Hiblot */
11872e5016fSJean-Jacques Hiblot int (*exit)(struct phy *phy);
11972e5016fSJean-Jacques Hiblot
12072e5016fSJean-Jacques Hiblot /**
12172e5016fSJean-Jacques Hiblot * reset - resets a PHY device without shutting down
12272e5016fSJean-Jacques Hiblot *
12372e5016fSJean-Jacques Hiblot * @phy: PHY port to be reset
12472e5016fSJean-Jacques Hiblot *
12572e5016fSJean-Jacques Hiblot * During runtime, the PHY may need to be reset in order to
12672e5016fSJean-Jacques Hiblot * re-establish connection etc without being shut down or exit.
12772e5016fSJean-Jacques Hiblot *
12872e5016fSJean-Jacques Hiblot * @return 0 if OK, or a negative error code
12972e5016fSJean-Jacques Hiblot */
13072e5016fSJean-Jacques Hiblot int (*reset)(struct phy *phy);
13172e5016fSJean-Jacques Hiblot
13272e5016fSJean-Jacques Hiblot /**
1334ef09685SWyon Bi * @configure:
1344ef09685SWyon Bi *
1354ef09685SWyon Bi * Optional.
1364ef09685SWyon Bi *
1374ef09685SWyon Bi * Used to change the PHY parameters. phy_init() must have
1384ef09685SWyon Bi * been called on the phy.
1394ef09685SWyon Bi *
1404ef09685SWyon Bi * Returns: 0 if successful, an negative error code otherwise
1414ef09685SWyon Bi */
1424ef09685SWyon Bi int (*configure)(struct phy *phy, union phy_configure_opts *opts);
1434ef09685SWyon Bi
1444ef09685SWyon Bi /**
1454ef09685SWyon Bi * @validate:
1464ef09685SWyon Bi *
1474ef09685SWyon Bi * Optional.
1484ef09685SWyon Bi *
1494ef09685SWyon Bi * Used to check that the current set of parameters can be
1504ef09685SWyon Bi * handled by the phy. Implementations are free to tune the
1514ef09685SWyon Bi * parameters passed as arguments if needed by some
1524ef09685SWyon Bi * implementation detail or constraints. It must not change
1534ef09685SWyon Bi * any actual configuration of the PHY, so calling it as many
1544ef09685SWyon Bi * times as deemed fit by the consumer must have no side
1554ef09685SWyon Bi * effect.
1564ef09685SWyon Bi *
1574ef09685SWyon Bi * Returns: 0 if the configuration can be applied, an negative
1584ef09685SWyon Bi * error code otherwise
1594ef09685SWyon Bi */
1604ef09685SWyon Bi int (*validate)(struct phy *phy, enum phy_mode mode, int submode,
1614ef09685SWyon Bi union phy_configure_opts *opts);
1624ef09685SWyon Bi
1634ef09685SWyon Bi /**
16472e5016fSJean-Jacques Hiblot * power_on - power on a PHY device
16572e5016fSJean-Jacques Hiblot *
16672e5016fSJean-Jacques Hiblot * @phy: PHY port to be powered on
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 on the PHY. It relies on the
17072e5016fSJean-Jacques Hiblot * setup done in init(). If init() is not implemented, it must take care
17172e5016fSJean-Jacques Hiblot * of setting up the context (PLLs, ...)
17272e5016fSJean-Jacques Hiblot *
17372e5016fSJean-Jacques Hiblot * @return 0 if OK, or a negative error code
17472e5016fSJean-Jacques Hiblot */
17572e5016fSJean-Jacques Hiblot int (*power_on)(struct phy *phy);
17672e5016fSJean-Jacques Hiblot
17772e5016fSJean-Jacques Hiblot /**
17872e5016fSJean-Jacques Hiblot * power_off - power off a PHY device
17972e5016fSJean-Jacques Hiblot *
18072e5016fSJean-Jacques Hiblot * @phy: PHY port to be powered off
18172e5016fSJean-Jacques Hiblot *
18272e5016fSJean-Jacques Hiblot * During runtime, the PHY may need to be powered on or off several
18372e5016fSJean-Jacques Hiblot * times. This function is used to power off the PHY. Except if
18472e5016fSJean-Jacques Hiblot * init()/deinit() are not implemented, it must not de-initialize
18572e5016fSJean-Jacques Hiblot * everything.
18672e5016fSJean-Jacques Hiblot *
18772e5016fSJean-Jacques Hiblot * @return 0 if OK, or a negative error code
18872e5016fSJean-Jacques Hiblot */
18972e5016fSJean-Jacques Hiblot int (*power_off)(struct phy *phy);
190*e9c6c0e2SWyon Bi
191*e9c6c0e2SWyon Bi int (*set_mode)(struct phy *phy, enum phy_mode mode, int submode);
19272e5016fSJean-Jacques Hiblot };
19372e5016fSJean-Jacques Hiblot
194d9fb7becSPatrice Chotard #ifdef CONFIG_PHY
19572e5016fSJean-Jacques Hiblot
19672e5016fSJean-Jacques Hiblot /**
19772e5016fSJean-Jacques Hiblot * generic_phy_init() - initialize the PHY port
19872e5016fSJean-Jacques Hiblot *
19972e5016fSJean-Jacques Hiblot * @phy: the PHY port to initialize
20072e5016fSJean-Jacques Hiblot * @return 0 if OK, or a negative error code
20172e5016fSJean-Jacques Hiblot */
20272e5016fSJean-Jacques Hiblot int generic_phy_init(struct phy *phy);
20372e5016fSJean-Jacques Hiblot
20472e5016fSJean-Jacques Hiblot /**
20572e5016fSJean-Jacques Hiblot * generic_phy_init() - de-initialize the PHY device
20672e5016fSJean-Jacques Hiblot *
20772e5016fSJean-Jacques Hiblot * @phy: PHY port to be de-initialized
20872e5016fSJean-Jacques Hiblot * @return 0 if OK, or a negative error code
20972e5016fSJean-Jacques Hiblot */
21072e5016fSJean-Jacques Hiblot int generic_phy_exit(struct phy *phy);
21172e5016fSJean-Jacques Hiblot
21272e5016fSJean-Jacques Hiblot /**
21372e5016fSJean-Jacques Hiblot * generic_phy_reset() - resets a PHY device without shutting down
21472e5016fSJean-Jacques Hiblot *
21572e5016fSJean-Jacques Hiblot * @phy: PHY port to be reset
21672e5016fSJean-Jacques Hiblot *@return 0 if OK, or a negative error code
21772e5016fSJean-Jacques Hiblot */
21872e5016fSJean-Jacques Hiblot int generic_phy_reset(struct phy *phy);
21972e5016fSJean-Jacques Hiblot
22072e5016fSJean-Jacques Hiblot /**
2214ef09685SWyon Bi * generic_phy_configure() - change the PHY parameters
2224ef09685SWyon Bi *
2234ef09685SWyon Bi * @phy: PHY port to be configure
2244ef09685SWyon Bi * @return 0 if OK, or a negative error code
2254ef09685SWyon Bi */
2264ef09685SWyon Bi int generic_phy_configure(struct phy *phy, union phy_configure_opts *opts);
2274ef09685SWyon Bi
2284ef09685SWyon Bi /**
2294ef09685SWyon Bi * generic_phy_validate() - validate the PHY parameters
2304ef09685SWyon Bi *
2314ef09685SWyon Bi * @phy: PHY port to be validate
2324ef09685SWyon Bi * @return 0 if OK, or a negative error code
2334ef09685SWyon Bi */
2344ef09685SWyon Bi int generic_phy_validate(struct phy *phy, enum phy_mode mode, int submode,
2354ef09685SWyon Bi union phy_configure_opts *opts);
2364ef09685SWyon Bi
2374ef09685SWyon Bi /**
23872e5016fSJean-Jacques Hiblot * generic_phy_power_on() - power on a PHY device
23972e5016fSJean-Jacques Hiblot *
24072e5016fSJean-Jacques Hiblot * @phy: PHY port to be powered on
24172e5016fSJean-Jacques Hiblot * @return 0 if OK, or a negative error code
24272e5016fSJean-Jacques Hiblot */
24372e5016fSJean-Jacques Hiblot int generic_phy_power_on(struct phy *phy);
24472e5016fSJean-Jacques Hiblot
24572e5016fSJean-Jacques Hiblot /**
24672e5016fSJean-Jacques Hiblot * generic_phy_power_off() - power off a PHY device
24772e5016fSJean-Jacques Hiblot *
24872e5016fSJean-Jacques Hiblot * @phy: PHY port to be powered off
24972e5016fSJean-Jacques Hiblot * @return 0 if OK, or a negative error code
25072e5016fSJean-Jacques Hiblot */
25172e5016fSJean-Jacques Hiblot int generic_phy_power_off(struct phy *phy);
25272e5016fSJean-Jacques Hiblot
253*e9c6c0e2SWyon Bi int generic_phy_set_mode_ext(struct phy *phy, enum phy_mode mode, int submode);
254*e9c6c0e2SWyon Bi #define generic_phy_set_mode(phy, mode) \
255*e9c6c0e2SWyon Bi generic_phy_set_mode_ext(phy, mode, 0)
256*e9c6c0e2SWyon Bi
generic_phy_get_mode(struct phy * phy)257*e9c6c0e2SWyon Bi static inline enum phy_mode generic_phy_get_mode(struct phy *phy)
258*e9c6c0e2SWyon Bi {
259*e9c6c0e2SWyon Bi return phy->attrs.mode;
260*e9c6c0e2SWyon Bi }
26172e5016fSJean-Jacques Hiblot
26272e5016fSJean-Jacques Hiblot /**
26372e5016fSJean-Jacques Hiblot * generic_phy_get_by_index() - Get a PHY device by integer index.
26472e5016fSJean-Jacques Hiblot *
26572e5016fSJean-Jacques Hiblot * @user: the client device
26672e5016fSJean-Jacques Hiblot * @index: The index in the list of available PHYs
26772e5016fSJean-Jacques Hiblot * @phy: A pointer to the PHY port
26872e5016fSJean-Jacques Hiblot *
26972e5016fSJean-Jacques Hiblot * This looks up a PHY device for a client device based on its position in the
27072e5016fSJean-Jacques Hiblot * list of the possible PHYs.
27172e5016fSJean-Jacques Hiblot *
27272e5016fSJean-Jacques Hiblot * example:
27372e5016fSJean-Jacques Hiblot * usb1: usb_otg_ss@xxx {
27472e5016fSJean-Jacques Hiblot * compatible = "xxx";
27572e5016fSJean-Jacques Hiblot * reg = <xxx>;
27672e5016fSJean-Jacques Hiblot * .
27772e5016fSJean-Jacques Hiblot * .
27872e5016fSJean-Jacques Hiblot * phys = <&usb2_phy>, <&usb3_phy>;
27972e5016fSJean-Jacques Hiblot * .
28072e5016fSJean-Jacques Hiblot * .
28172e5016fSJean-Jacques Hiblot * };
28272e5016fSJean-Jacques Hiblot * the USB2 phy can be accessed by passing index '0' and the USB3 phy can
28372e5016fSJean-Jacques Hiblot * be accessed by passing index '1'
28472e5016fSJean-Jacques Hiblot *
28572e5016fSJean-Jacques Hiblot * @return 0 if OK, or a negative error code
28672e5016fSJean-Jacques Hiblot */
28772e5016fSJean-Jacques Hiblot int generic_phy_get_by_index(struct udevice *user, int index,
28872e5016fSJean-Jacques Hiblot struct phy *phy);
28972e5016fSJean-Jacques Hiblot
29072e5016fSJean-Jacques Hiblot /**
29172e5016fSJean-Jacques Hiblot * generic_phy_get_by_name() - Get a PHY device by its name.
29272e5016fSJean-Jacques Hiblot *
29372e5016fSJean-Jacques Hiblot * @user: the client device
29472e5016fSJean-Jacques Hiblot * @phy_name: The name of the PHY in the list of possible PHYs
29572e5016fSJean-Jacques Hiblot * @phy: A pointer to the PHY port
29672e5016fSJean-Jacques Hiblot *
29772e5016fSJean-Jacques Hiblot * This looks up a PHY device for a client device in the
29872e5016fSJean-Jacques Hiblot * list of the possible PHYs based on its name.
29972e5016fSJean-Jacques Hiblot *
30072e5016fSJean-Jacques Hiblot * example:
30172e5016fSJean-Jacques Hiblot * usb1: usb_otg_ss@xxx {
30272e5016fSJean-Jacques Hiblot * compatible = "xxx";
30372e5016fSJean-Jacques Hiblot * reg = <xxx>;
30472e5016fSJean-Jacques Hiblot * .
30572e5016fSJean-Jacques Hiblot * .
30672e5016fSJean-Jacques Hiblot * phys = <&usb2_phy>, <&usb3_phy>;
30772e5016fSJean-Jacques Hiblot * phy-names = "usb2phy", "usb3phy";
30872e5016fSJean-Jacques Hiblot * .
30972e5016fSJean-Jacques Hiblot * .
31072e5016fSJean-Jacques Hiblot * };
31172e5016fSJean-Jacques Hiblot * the USB3 phy can be accessed using "usb3phy", and USB2 by using "usb2phy"
31272e5016fSJean-Jacques Hiblot *
31372e5016fSJean-Jacques Hiblot * @return 0 if OK, or a negative error code
31472e5016fSJean-Jacques Hiblot */
31572e5016fSJean-Jacques Hiblot int generic_phy_get_by_name(struct udevice *user, const char *phy_name,
31672e5016fSJean-Jacques Hiblot struct phy *phy);
31772e5016fSJean-Jacques Hiblot
318d9fb7becSPatrice Chotard #else /* CONFIG_PHY */
319d9fb7becSPatrice Chotard
generic_phy_init(struct phy * phy)320d9fb7becSPatrice Chotard static inline int generic_phy_init(struct phy *phy)
321d9fb7becSPatrice Chotard {
322d9fb7becSPatrice Chotard return 0;
323d9fb7becSPatrice Chotard }
324d9fb7becSPatrice Chotard
generic_phy_exit(struct phy * phy)325d9fb7becSPatrice Chotard static inline int generic_phy_exit(struct phy *phy)
326d9fb7becSPatrice Chotard {
327d9fb7becSPatrice Chotard return 0;
328d9fb7becSPatrice Chotard }
329d9fb7becSPatrice Chotard
generic_phy_reset(struct phy * phy)330d9fb7becSPatrice Chotard static inline int generic_phy_reset(struct phy *phy)
331d9fb7becSPatrice Chotard {
332d9fb7becSPatrice Chotard return 0;
333d9fb7becSPatrice Chotard }
334d9fb7becSPatrice Chotard
generic_phy_configure(struct phy * phy,union phy_configure_opts * opts)3354ef09685SWyon Bi static inline int generic_phy_configure(struct phy *phy,
3364ef09685SWyon Bi union phy_configure_opts *opts)
3374ef09685SWyon Bi {
3384ef09685SWyon Bi return 0;
3394ef09685SWyon Bi }
3404ef09685SWyon Bi
generic_phy_validate(struct phy * phy,enum phy_mode mode,int submode,union phy_configure_opts * opts)3414ef09685SWyon Bi static inline int generic_phy_validate(struct phy *phy, enum phy_mode mode,
3424ef09685SWyon Bi int submode,
3434ef09685SWyon Bi union phy_configure_opts *opts)
3444ef09685SWyon Bi {
3454ef09685SWyon Bi return 0;
3464ef09685SWyon Bi }
3474ef09685SWyon Bi
generic_phy_power_on(struct phy * phy)348d9fb7becSPatrice Chotard static inline int generic_phy_power_on(struct phy *phy)
349d9fb7becSPatrice Chotard {
350d9fb7becSPatrice Chotard return 0;
351d9fb7becSPatrice Chotard }
352d9fb7becSPatrice Chotard
generic_phy_power_off(struct phy * phy)353d9fb7becSPatrice Chotard static inline int generic_phy_power_off(struct phy *phy)
354d9fb7becSPatrice Chotard {
355d9fb7becSPatrice Chotard return 0;
356d9fb7becSPatrice Chotard }
357d9fb7becSPatrice Chotard
generic_phy_get_by_index(struct udevice * user,int index,struct phy * phy)358d9fb7becSPatrice Chotard static inline int generic_phy_get_by_index(struct udevice *user, int index,
359d9fb7becSPatrice Chotard struct phy *phy)
360d9fb7becSPatrice Chotard {
361d9fb7becSPatrice Chotard return 0;
362d9fb7becSPatrice Chotard }
363d9fb7becSPatrice Chotard
generic_phy_get_by_name(struct udevice * user,const char * phy_name,struct phy * phy)364d9fb7becSPatrice Chotard static inline int generic_phy_get_by_name(struct udevice *user, const char *phy_name,
365d9fb7becSPatrice Chotard struct phy *phy)
366d9fb7becSPatrice Chotard {
367d9fb7becSPatrice Chotard return 0;
368d9fb7becSPatrice Chotard }
369d9fb7becSPatrice Chotard
generic_phy_set_mode_ext(struct phy * phy,enum phy_mode mode,int submode)370*e9c6c0e2SWyon Bi static inline int generic_phy_set_mode_ext(struct phy *phy, enum phy_mode mode,
371*e9c6c0e2SWyon Bi int submode)
372*e9c6c0e2SWyon Bi {
373*e9c6c0e2SWyon Bi return 0;
374*e9c6c0e2SWyon Bi }
375*e9c6c0e2SWyon Bi
376*e9c6c0e2SWyon Bi #define generic_phy_set_mode(phy, mode) \
377*e9c6c0e2SWyon Bi generic_phy_set_mode_ext(phy, mode, 0)
378*e9c6c0e2SWyon Bi
379d9fb7becSPatrice Chotard #endif /* CONFIG_PHY */
380d9fb7becSPatrice Chotard
381b94888b4SPatrice Chotard /**
382b94888b4SPatrice Chotard * generic_phy_valid() - check if PHY port is valid
383b94888b4SPatrice Chotard *
384b94888b4SPatrice Chotard * @phy: the PHY port to check
385b94888b4SPatrice Chotard * @return TRUE if valid, or FALSE
386b94888b4SPatrice Chotard */
generic_phy_valid(struct phy * phy)387b94888b4SPatrice Chotard static inline bool generic_phy_valid(struct phy *phy)
388b94888b4SPatrice Chotard {
3891bac1f39SJean-Jacques Hiblot return phy && phy->dev;
390b94888b4SPatrice Chotard }
391b94888b4SPatrice Chotard
39272e5016fSJean-Jacques Hiblot #endif /*__GENERIC_PHY_H */
393