linux-imx/include/linux/fwnode_mdio.h
Ioana Ciornei cd02cab4cf net: mdio: probe non-PHY MDIO devices in ACPI
Probe non-PHY MDIO devices found in the ACPI description.
In order to do this, the following modifications were made:
 - The fwnode_mdiobus_child_is_phy() function was added to determine if a
 MDIO child device is PHY or not.
 - The fwnode_mdiobus_register_device() function was added in order to
 create a new MDIO device starting from its fwnode.
 - The __acpi_mdiobus_register() function was modified so that it
 creates MDIO devices instead of PHY devices when needed.
 - The mdio_bus_match() function was updated so that devices can be
 matched based on their ACPI description as well.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
2023-10-30 17:16:54 +08:00

53 lines
1.2 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
/*
* FWNODE helper for the MDIO (Ethernet PHY) API
*/
#ifndef __LINUX_FWNODE_MDIO_H
#define __LINUX_FWNODE_MDIO_H
#include <linux/phy.h>
#if IS_ENABLED(CONFIG_FWNODE_MDIO)
int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio,
struct phy_device *phy,
struct fwnode_handle *child, u32 addr);
int fwnode_mdiobus_register_phy(struct mii_bus *bus,
struct fwnode_handle *child, u32 addr);
int fwnode_mdiobus_register_device(struct mii_bus *bus,
struct fwnode_handle *child, u32 addr);
bool fwnode_mdiobus_child_is_phy(struct fwnode_handle *child);
#else /* CONFIG_FWNODE_MDIO */
int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio,
struct phy_device *phy,
struct fwnode_handle *child, u32 addr)
{
return -EINVAL;
}
static inline int fwnode_mdiobus_register_phy(struct mii_bus *bus,
struct fwnode_handle *child,
u32 addr)
{
return -EINVAL;
}
static inline int fwnode_mdiobus_register_device(struct mii_bus *bus,
struct fwnode_handle *child,
u32 addr)
{
return -EINVAL;
}
bool fwnode_mdiobus_child_is_phy(struct fwnode_handle *child)
{
return false;
}
#endif
#endif /* __LINUX_FWNODE_MDIO_H */