From f3dd213e151ece2a382e730f5e75156536b2419d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Thu, 7 Apr 2022 00:32:57 +0200 Subject: net: introduce helpers to get PHY ofnode from MAC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add helpers ofnode_get_phy_node() and dev_get_phy_node() and use it in net/mdio-uclass.c function dm_eth_connect_phy_handle(). Also add corresponding UT test. This is useful because other part's of U-Boot may want to get PHY ofnode without connecting a PHY. Signed-off-by: Marek Behún Reviewed-by: Ramon Fried Reviewed-by: Simon Glass --- include/dm/ofnode.h | 14 ++++++++++++++ include/dm/read.h | 19 +++++++++++++++++++ 2 files changed, 33 insertions(+) (limited to 'include') diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index 744dffe0a2d..429aee28126 100644 --- a/include/dm/ofnode.h +++ b/include/dm/ofnode.h @@ -1217,4 +1217,18 @@ int ofnode_conf_read_int(const char *prop_name, int default_val); */ const char *ofnode_conf_read_str(const char *prop_name); +/** + * ofnode_get_phy_node() - Get PHY node for a MAC (if not fixed-link) + * + * This function parses PHY handle from the Ethernet controller's ofnode + * (trying all possible PHY handle property names), and returns the PHY ofnode. + * + * Before this is used, ofnode_phy_is_fixed_link() should be checked first, and + * if the result to that is true, this function should not be called. + * + * @eth_node: ofnode belonging to the Ethernet controller + * Return: ofnode of the PHY, if it exists, otherwise an invalid ofnode + */ +ofnode ofnode_get_phy_node(ofnode eth_node); + #endif diff --git a/include/dm/read.h b/include/dm/read.h index 233af3c0634..899eb813fde 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -743,6 +743,20 @@ int dev_read_pci_bus_range(const struct udevice *dev, struct resource *res); int dev_decode_display_timing(const struct udevice *dev, int index, struct display_timing *config); +/** + * dev_get_phy_node() - Get PHY node for a MAC (if not fixed-link) + * + * This function parses PHY handle from the Ethernet controller's ofnode + * (trying all possible PHY handle property names), and returns the PHY ofnode. + * + * Before this is used, ofnode_phy_is_fixed_link() should be checked first, and + * if the result to that is true, this function should not be called. + * + * @dev: device representing the MAC + * Return: ofnode of the PHY, if it exists, otherwise an invalid ofnode + */ +ofnode dev_get_phy_node(const struct udevice *dev); + #else /* CONFIG_DM_DEV_READ_INLINE is enabled */ #include @@ -1092,6 +1106,11 @@ static inline int dev_decode_display_timing(const struct udevice *dev, return ofnode_decode_display_timing(dev_ofnode(dev), index, config); } +static inline ofnode dev_get_phy_node(const struct udevice *dev) +{ + return ofnode_get_phy_node(dev_ofnode(dev)); +} + #endif /* CONFIG_DM_DEV_READ_INLINE */ /** -- cgit v1.2.3 From 351bfa6ebdcc454441b32976e895002a5b0523b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Thu, 7 Apr 2022 00:32:58 +0200 Subject: net: mdio-uclass: add wrappers for read/write/reset operations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add wrappers dm_mdio_read(), dm_mdio_write() and dm_mdio_reset() for DM MDIO's .read(), .write() and .reset() operations. Signed-off-by: Marek Behún Reviewed-by: Ramon Fried Reviewed-by: Vladimir Oltean --- include/miiphy.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'include') diff --git a/include/miiphy.h b/include/miiphy.h index 235ae066ddd..110921f20d2 100644 --- a/include/miiphy.h +++ b/include/miiphy.h @@ -157,6 +157,37 @@ struct mdio_ops { */ void dm_mdio_probe_devices(void); +/** + * dm_mdio_read - Wrapper over .read() operation for DM MDIO + * + * @mdiodev: mdio device + * @addr: PHY address on MDIO bus + * @devad: device address on PHY if C45; should be MDIO_DEVAD_NONE if C22 + * @reg: register address + * Return: register value if non-negative, -error code otherwise + */ +int dm_mdio_read(struct udevice *mdio_dev, int addr, int devad, int reg); + +/** + * dm_mdio_write - Wrapper over .write() operation for DM MDIO + * + * @mdiodev: mdio device + * @addr: PHY address on MDIO bus + * @devad: device address on PHY if C45; should be MDIO_DEVAD_NONE if C22 + * @reg: register address + * @val: value to write + * Return: 0 on success, -error code otherwise + */ +int dm_mdio_write(struct udevice *mdio_dev, int addr, int devad, int reg, u16 val); + +/** + * dm_mdio_reset - Wrapper over .reset() operation for DM MDIO + * + * @mdiodev: mdio device + * Return: 0 on success, -error code otherwise + */ +int dm_mdio_reset(struct udevice *mdio_dev); + /** * dm_mdio_phy_connect - Wrapper over phy_connect for DM MDIO * -- cgit v1.2.3 From 123ca114e07ecf28aa2538748d733e2b22d8b8b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Thu, 7 Apr 2022 00:33:01 +0200 Subject: net: introduce helpers to get PHY interface mode from a device/ofnode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add helpers ofnode_read_phy_mode() and dev_read_phy_mode() to parse the "phy-mode" / "phy-connection-type" property. Add corresponding UT test. Use them treewide. This allows us to inline the phy_get_interface_by_name() into ofnode_read_phy_mode(), since the former is not used anymore. Signed-off-by: Marek Behún Reviewed-by: Ramon Fried Tested-by: Patrice Chotard --- include/dm/ofnode.h | 13 +++++++++++++ include/dm/read.h | 17 +++++++++++++++++ include/phy.h | 8 -------- 3 files changed, 30 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index 429aee28126..3bd3ba49253 100644 --- a/include/dm/ofnode.h +++ b/include/dm/ofnode.h @@ -12,6 +12,7 @@ #include #include #include +#include /* Enable checks to protect against invalid calls */ #undef OF_CHECKS @@ -1231,4 +1232,16 @@ const char *ofnode_conf_read_str(const char *prop_name); */ ofnode ofnode_get_phy_node(ofnode eth_node); +/** + * ofnode_read_phy_mode() - Read PHY connection type from a MAC node + * + * This function parses the "phy-mode" / "phy-connection-type" property and + * returns the corresponding PHY interface type. + * + * @mac_node: ofnode containing the property + * Return: one of PHY_INTERFACE_MODE_* constants, PHY_INTERFACE_MODE_NONE on + * error + */ +phy_interface_t ofnode_read_phy_mode(ofnode mac_node); + #endif diff --git a/include/dm/read.h b/include/dm/read.h index 899eb813fde..bfa26459674 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -757,6 +757,18 @@ int dev_decode_display_timing(const struct udevice *dev, int index, */ ofnode dev_get_phy_node(const struct udevice *dev); +/** + * dev_read_phy_mode() - Read PHY connection type from a MAC + * + * This function parses the "phy-mode" / "phy-connection-type" property and + * returns the corresponding PHY interface type. + * + * @dev: device representing the MAC + * Return: one of PHY_INTERFACE_MODE_* constants, PHY_INTERFACE_MODE_NONE on + * error + */ +phy_interface_t dev_read_phy_mode(const struct udevice *dev); + #else /* CONFIG_DM_DEV_READ_INLINE is enabled */ #include @@ -1111,6 +1123,11 @@ static inline ofnode dev_get_phy_node(const struct udevice *dev) return ofnode_get_phy_node(dev_ofnode(dev)); } +static inline phy_interface_t dev_read_phy_mode(const struct udevice *dev) +{ + return ofnode_read_phy_mode(dev_ofnode(dev)); +} + #endif /* CONFIG_DM_DEV_READ_INLINE */ /** diff --git a/include/phy.h b/include/phy.h index 9ea4bd42db4..399e050abae 100644 --- a/include/phy.h +++ b/include/phy.h @@ -568,14 +568,6 @@ int phy_xilinx_gmii2rgmii_init(void); int board_phy_config(struct phy_device *phydev); int get_phy_id(struct mii_dev *bus, int addr, int devad, u32 *phy_id); -/** - * phy_get_interface_by_name() - Look up a PHY interface name - * - * @str: PHY interface name, e.g. "mii" - * @return: PHY_INTERFACE_MODE_... value, or -1 if not found - */ -int phy_get_interface_by_name(const char *str); - /** * phy_interface_is_rgmii - Convenience function for testing if a PHY interface * is RGMII (all variants) -- cgit v1.2.3 From 6706d7dcbee15ac41f3ddb50b31ff96d16567883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Thu, 7 Apr 2022 00:33:02 +0200 Subject: treewide: Rename PHY_INTERFACE_MODE_COUNT to PHY_INTERFACE_MODE_MAX MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename constant PHY_INTERFACE_MODE_COUNT to PHY_INTERFACE_MODE_MAX to make it compatible with Linux' naming. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese Reviewed-by: Vladimir Oltean --- include/phy_interface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/phy_interface.h b/include/phy_interface.h index f075abe9c9c..494bc87e679 100644 --- a/include/phy_interface.h +++ b/include/phy_interface.h @@ -41,7 +41,7 @@ typedef enum { PHY_INTERFACE_MODE_USXGMII, PHY_INTERFACE_MODE_NONE, /* Must be last */ - PHY_INTERFACE_MODE_COUNT, + PHY_INTERFACE_MODE_MAX, } phy_interface_t; static const char * const phy_interface_strings[] = { -- cgit v1.2.3 From ffb0f6f488b9eee2822c3c691778a26e1590694c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Thu, 7 Apr 2022 00:33:03 +0200 Subject: treewide: Rename PHY_INTERFACE_MODE_NONE to PHY_INTERFACE_MODE_NA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename constant PHY_INTERFACE_MODE_NONE to PHY_INTERFACE_MODE_NA to make it compatible with Linux' naming. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese Reviewed-by: Ramon Fried Reviewed-by: Vladimir Oltean --- include/dm/ofnode.h | 2 +- include/dm/read.h | 2 +- include/fm_eth.h | 2 +- include/phy_interface.h | 8 ++++---- include/vsc9953.h | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index 3bd3ba49253..f27aca5877a 100644 --- a/include/dm/ofnode.h +++ b/include/dm/ofnode.h @@ -1239,7 +1239,7 @@ ofnode ofnode_get_phy_node(ofnode eth_node); * returns the corresponding PHY interface type. * * @mac_node: ofnode containing the property - * Return: one of PHY_INTERFACE_MODE_* constants, PHY_INTERFACE_MODE_NONE on + * Return: one of PHY_INTERFACE_MODE_* constants, PHY_INTERFACE_MODE_NA on * error */ phy_interface_t ofnode_read_phy_mode(ofnode mac_node); diff --git a/include/dm/read.h b/include/dm/read.h index bfa26459674..1b54b69acf0 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -764,7 +764,7 @@ ofnode dev_get_phy_node(const struct udevice *dev); * returns the corresponding PHY interface type. * * @dev: device representing the MAC - * Return: one of PHY_INTERFACE_MODE_* constants, PHY_INTERFACE_MODE_NONE on + * Return: one of PHY_INTERFACE_MODE_* constants, PHY_INTERFACE_MODE_NA on * error */ phy_interface_t dev_read_phy_mode(const struct udevice *dev); diff --git a/include/fm_eth.h b/include/fm_eth.h index 44da014c66c..bf9570679d2 100644 --- a/include/fm_eth.h +++ b/include/fm_eth.h @@ -72,7 +72,7 @@ enum fm_eth_type { #define FM_ETH_INFO_INITIALIZER(idx, pregs) \ .fm = idx, \ .phy_regs = (void *)pregs, \ - .enet_if = PHY_INTERFACE_MODE_NONE, \ + .enet_if = PHY_INTERFACE_MODE_NA, \ #ifdef CONFIG_SYS_FMAN_V3 #define FM_DTSEC_INFO_INITIALIZER(idx, n) \ diff --git a/include/phy_interface.h b/include/phy_interface.h index 494bc87e679..59e119a6399 100644 --- a/include/phy_interface.h +++ b/include/phy_interface.h @@ -39,7 +39,7 @@ typedef enum { PHY_INTERFACE_MODE_NCSI, PHY_INTERFACE_MODE_10GBASER, PHY_INTERFACE_MODE_USXGMII, - PHY_INTERFACE_MODE_NONE, /* Must be last */ + PHY_INTERFACE_MODE_NA, /* Must be last */ PHY_INTERFACE_MODE_MAX, } phy_interface_t; @@ -71,7 +71,7 @@ static const char * const phy_interface_strings[] = { [PHY_INTERFACE_MODE_NCSI] = "NC-SI", [PHY_INTERFACE_MODE_10GBASER] = "10gbase-r", [PHY_INTERFACE_MODE_USXGMII] = "usxgmii", - [PHY_INTERFACE_MODE_NONE] = "", + [PHY_INTERFACE_MODE_NA] = "", }; /* Backplane modes: @@ -86,8 +86,8 @@ static const char * const backplane_mode_strings[] = { static inline const char *phy_string_for_interface(phy_interface_t i) { /* Default to unknown */ - if (i > PHY_INTERFACE_MODE_NONE) - i = PHY_INTERFACE_MODE_NONE; + if (i > PHY_INTERFACE_MODE_NA) + i = PHY_INTERFACE_MODE_NA; return phy_interface_strings[i]; } diff --git a/include/vsc9953.h b/include/vsc9953.h index a9c84b4b50c..fd52c93044b 100644 --- a/include/vsc9953.h +++ b/include/vsc9953.h @@ -691,7 +691,7 @@ struct vsc9953_vcap { .phyaddr = 0, \ .index = idx, \ .phy_regs = NULL, \ - .enet_if = PHY_INTERFACE_MODE_NONE, \ + .enet_if = PHY_INTERFACE_MODE_NA, \ .bus = NULL, \ .phydev = NULL, \ } -- cgit v1.2.3 From c677fb1e3196e1be1fcbbdb04650eed262708317 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Thu, 7 Apr 2022 00:33:04 +0200 Subject: phy: Move PHY_INTERFACE_MODE_NA to the beginning of the enum definition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move PHY_INTERFACE_MODE_NA to the beginning of the enum definition to make it have zero value. This makes it possible (although not encouraged) to test for invalid/nonexistent interface mode with !val instead of val == PHY_INTERFACE_MODE_NA. The comment near the definition says "Must be last", because when the constant was introduced in commit 5f184715ecd3 ("Create PHY Lib for U-Boot"), it was used as the maximum value when interating over the constants. But this is no longer true - we use PHY_INTERFACE_MODE_MAX for that now, and so we can move it. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese Reviewed-by: Ramon Fried --- include/phy_interface.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/phy_interface.h b/include/phy_interface.h index 59e119a6399..ce3b5004ec2 100644 --- a/include/phy_interface.h +++ b/include/phy_interface.h @@ -13,6 +13,7 @@ #include typedef enum { + PHY_INTERFACE_MODE_NA, /* don't touch */ PHY_INTERFACE_MODE_MII, PHY_INTERFACE_MODE_GMII, PHY_INTERFACE_MODE_SGMII, @@ -39,12 +40,11 @@ typedef enum { PHY_INTERFACE_MODE_NCSI, PHY_INTERFACE_MODE_10GBASER, PHY_INTERFACE_MODE_USXGMII, - PHY_INTERFACE_MODE_NA, /* Must be last */ - PHY_INTERFACE_MODE_MAX, } phy_interface_t; static const char * const phy_interface_strings[] = { + [PHY_INTERFACE_MODE_NA] = "", [PHY_INTERFACE_MODE_MII] = "mii", [PHY_INTERFACE_MODE_GMII] = "gmii", [PHY_INTERFACE_MODE_SGMII] = "sgmii", @@ -71,7 +71,6 @@ static const char * const phy_interface_strings[] = { [PHY_INTERFACE_MODE_NCSI] = "NC-SI", [PHY_INTERFACE_MODE_10GBASER] = "10gbase-r", [PHY_INTERFACE_MODE_USXGMII] = "usxgmii", - [PHY_INTERFACE_MODE_NA] = "", }; /* Backplane modes: -- cgit v1.2.3 From 79bef5fb1f0ce6b090017d2525a42f94e1577673 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Thu, 7 Apr 2022 00:33:06 +0200 Subject: net: phy: use ->is_c45 instead of is_10g_interface() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use phydev->is_c45 instead of is_10g_interface(phydev->interface) to determine whether clause 45 protocol should be used. Signed-off-by: Marek Behún Reviewed-by: Ramon Fried --- include/phy.h | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'include') diff --git a/include/phy.h b/include/phy.h index 399e050abae..c7fa0ffba43 100644 --- a/include/phy.h +++ b/include/phy.h @@ -359,18 +359,6 @@ static inline int phy_clear_bits_mmd(struct phy_device *phydev, int devad, #ifdef CONFIG_PHYLIB_10G extern struct phy_driver gen10g_driver; - -/* - * List all 10G interfaces here, the assumption being that PHYs on these - * interfaces are C45 - */ -static inline int is_10g_interface(phy_interface_t interface) -{ - return interface == PHY_INTERFACE_MODE_XGMII || - interface == PHY_INTERFACE_MODE_USXGMII || - interface == PHY_INTERFACE_MODE_10GBASER; -} - #endif /** -- cgit v1.2.3 From e24b58f5ed4f9a0b5b1c80a5f35aa71fcad7f233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Thu, 7 Apr 2022 00:33:08 +0200 Subject: net: phy: don't require PHY interface mode during PHY creation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently we require PHY interface mode to be known when finding/creating the PHY - the functions * phy_connect_phy_id() * phy_device_create() * create_phy_by_mask() * search_for_existing_phy() * get_phy_device_by_mask() * phy_find_by_mask() all require the interface parameter, but the only thing done with it is that it is assigned to phydev->interface. This makes it impossible to find a PHY device without overwriting the set mode. Since the interface mode is not used during .probe() and should be used at first in .config(), drop the interface parameter from these functions. Make the default value of phydev->interface (in phy_device_create()) to be PHY_INTERFACE_MODE_NA. Move the interface parameter to phy_connect_dev(), where it should be. Change all occurrences treewide. In occurrences where we don't call phy_connect_dev() for some reason (they only configure the PHY without connecting it to an ethernet controller), set phydev->interface = value from phy_find_by_mask call. Signed-off-by: Marek Behún Reviewed-by: Ramon Fried Reviewed-by: Vladimir Oltean --- include/_exports.h | 3 +-- include/exports.h | 3 +-- include/phy.h | 20 +++++++++----------- 3 files changed, 11 insertions(+), 15 deletions(-) (limited to 'include') diff --git a/include/_exports.h b/include/_exports.h index 8030d70c0bc..f6df8b61073 100644 --- a/include/_exports.h +++ b/include/_exports.h @@ -77,8 +77,7 @@ EXPORT_FUNC(mdio_get_current_dev, struct mii_dev *, mdio_get_current_dev, void) EXPORT_FUNC(phy_find_by_mask, struct phy_device *, phy_find_by_mask, - struct mii_dev *bus, unsigned phy_mask, - phy_interface_t interface) + struct mii_dev *bus, unsigned phy_mask) EXPORT_FUNC(mdio_phydev_for_ethname, struct phy_device *, mdio_phydev_for_ethname, const char *ethname) EXPORT_FUNC(miiphy_set_current_dev, int, miiphy_set_current_dev, diff --git a/include/exports.h b/include/exports.h index 550cafdc7a1..6f8c9cf4517 100644 --- a/include/exports.h +++ b/include/exports.h @@ -55,8 +55,7 @@ int i2c_read (uchar, uint, int , uchar* , int); #endif #ifdef CONFIG_PHY_AQUANTIA struct mii_dev *mdio_get_current_dev(void); -struct phy_device *phy_find_by_mask(struct mii_dev *bus, unsigned phy_mask, - phy_interface_t interface); +struct phy_device *phy_find_by_mask(struct mii_dev *bus, unsigned phy_mask); struct phy_device *mdio_phydev_for_ethname(const char *ethname); int miiphy_set_current_dev(const char *devname); #endif diff --git a/include/phy.h b/include/phy.h index c7fa0ffba43..30af8bfa0e6 100644 --- a/include/phy.h +++ b/include/phy.h @@ -388,11 +388,9 @@ int phy_reset(struct phy_device *phydev); * * @bus: MII/MDIO bus to scan * @phy_mask: bitmap of PYH addresses to scan - * @interface: type of MAC-PHY interface * @return: pointer to phy_device if a PHY is found, or NULL otherwise */ -struct phy_device *phy_find_by_mask(struct mii_dev *bus, unsigned phy_mask, - phy_interface_t interface); +struct phy_device *phy_find_by_mask(struct mii_dev *bus, unsigned phy_mask); #ifdef CONFIG_PHY_FIXED @@ -421,8 +419,10 @@ static inline struct phy_device *fixed_phy_create(ofnode node) * phy_connect_dev() - Associates the given pair of PHY and Ethernet devices * @phydev: PHY device * @dev: Ethernet device + * @interface: type of MAC-PHY interface */ -void phy_connect_dev(struct phy_device *phydev, struct udevice *dev); +void phy_connect_dev(struct phy_device *phydev, struct udevice *dev, + phy_interface_t interface); /** * phy_connect() - Creates a PHY device for the Ethernet interface @@ -449,12 +449,10 @@ struct phy_device *phy_connect(struct mii_dev *bus, int addr, * @addr: PHY address on MDIO bus * @phy_id: where to store the ID retrieved * @is_c45: Device Identifiers if is_c45 - * @interface: interface between the MAC and PHY * @return: pointer to phy_device if a PHY is found, or NULL otherwise */ struct phy_device *phy_device_create(struct mii_dev *bus, int addr, - u32 phy_id, bool is_c45, - phy_interface_t interface); + u32 phy_id, bool is_c45); /** * phy_connect_phy_id() - Connect to phy device by reading PHY id @@ -462,12 +460,10 @@ struct phy_device *phy_device_create(struct mii_dev *bus, int addr, * * @bus: MII/MDIO bus that hosts the PHY * @dev: Ethernet device to associate to the PHY - * @interface: Interface between the MAC and PHY * @return: pointer to phy_device if a PHY is found, * or NULL otherwise */ -struct phy_device *phy_connect_phy_id(struct mii_dev *bus, struct udevice *dev, - phy_interface_t interface); +struct phy_device *phy_connect_phy_id(struct mii_dev *bus, struct udevice *dev); static inline ofnode phy_get_ofnode(struct phy_device *phydev) { @@ -482,8 +478,10 @@ static inline ofnode phy_get_ofnode(struct phy_device *phydev) * phy_connect_dev() - Associates the given pair of PHY and Ethernet devices * @phydev: PHY device * @dev: Ethernet device + * @interface: type of MAC-PHY interface */ -void phy_connect_dev(struct phy_device *phydev, struct eth_device *dev); +void phy_connect_dev(struct phy_device *phydev, struct eth_device *dev, + phy_interface_t interface); /** * phy_connect() - Creates a PHY device for the Ethernet interface -- cgit v1.2.3 From d79f1a85697e3af24a97728f6e4f16635bdc8290 Mon Sep 17 00:00:00 2001 From: Nate Drude Date: Fri, 8 Apr 2022 11:28:14 -0500 Subject: phy: adin: add driver for Analog Devices ADIN1300 PHY The current implementation configures RGMII using device tree phy-mode property and then calls genphy_config adin_config_rgmii_mode is derived from: https://github.com/varigit/linux-imx/blob/lf-5.10.y_var04/drivers/net/phy/adin.c#L218-L262 Signed-off-by: Nate Drude Reviewed-by: Ramon Fried --- include/phy.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/phy.h b/include/phy.h index 30af8bfa0e6..37b2a0281e3 100644 --- a/include/phy.h +++ b/include/phy.h @@ -526,6 +526,7 @@ int gen10g_discover_mmds(struct phy_device *phydev); int phy_b53_init(void); int phy_mv88e61xx_init(void); +int phy_adin_init(void); int phy_aquantia_init(void); int phy_atheros_init(void); int phy_broadcom_init(void); -- cgit v1.2.3 From 1494a4aacef17a3fc94847104e98d083da7659c9 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Wed, 13 Apr 2022 04:15:33 +0200 Subject: net: dm9000: Drop dm9000.h and staticize SROM access Dispose of dm9000.h because none of the function prototypes declared in it are called anywhere in the codebase. Staticize dm9000_read_srom_word() because it is now called only from within the dm9000 driver. Drop dm9000_write_srom_word() because it is no longer used. Reviewed-by: Ramon Fried Signed-off-by: Marek Vasut Cc: Joe Hershberger Cc: Ramon Fried --- include/dm9000.h | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 include/dm9000.h (limited to 'include') diff --git a/include/dm9000.h b/include/dm9000.h deleted file mode 100644 index f780e513f69..00000000000 --- a/include/dm9000.h +++ /dev/null @@ -1,16 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * NOTE: DAVICOM DM9000 ethernet driver interface - * - * Authors: Remy Bohmer - */ -#ifndef __DM9000_H__ -#define __DM9000_H__ - -/****************** function prototypes **********************/ -#if !defined(CONFIG_DM9000_NO_SROM) -void dm9000_write_srom_word(int offset, u16 val); -void dm9000_read_srom_word(int offset, u8 *to); -#endif - -#endif /* __DM9000_H__ */ -- cgit v1.2.3 From 0154e6de37e8bbaac837939391f6d4a8f0b3fd18 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Wed, 13 Apr 2022 04:15:39 +0200 Subject: configs: net: dm9000: Move new Kconfig option to board configs Drop legacy #define CONFIG_DRIVER_DM9000 from board include/configs/ and enable the same in Kconfig configs/ . Signed-off-by: Marek Vasut Cc: Joe Hershberger Cc: Ramon Fried Reviewed-by: Ramon Fried --- include/configs/M5253DEMO.h | 1 - include/configs/at91sam9261ek.h | 1 - include/configs/ci20.h | 1 - include/configs/colibri_pxa270.h | 1 - include/configs/devkit8000.h | 1 - 5 files changed, 5 deletions(-) (limited to 'include') diff --git a/include/configs/M5253DEMO.h b/include/configs/M5253DEMO.h index b7fdd7135f2..079675be5bc 100644 --- a/include/configs/M5253DEMO.h +++ b/include/configs/M5253DEMO.h @@ -25,7 +25,6 @@ # undef CONFIG_LBA48 #endif -#define CONFIG_DRIVER_DM9000 #ifdef CONFIG_DRIVER_DM9000 # define CONFIG_DM9000_BASE (CONFIG_SYS_CS1_BASE | 0x300) # define DM9000_IO CONFIG_DM9000_BASE diff --git a/include/configs/at91sam9261ek.h b/include/configs/at91sam9261ek.h index 55ddb38c70a..2089fe52e45 100644 --- a/include/configs/at91sam9261ek.h +++ b/include/configs/at91sam9261ek.h @@ -44,7 +44,6 @@ #endif /* Ethernet */ -#define CONFIG_DRIVER_DM9000 #define CONFIG_DM9000_BASE 0x30000000 #define DM9000_IO CONFIG_DM9000_BASE #define DM9000_DATA (CONFIG_DM9000_BASE + 4) diff --git a/include/configs/ci20.h b/include/configs/ci20.h index ea9440dac07..cc70a59e728 100644 --- a/include/configs/ci20.h +++ b/include/configs/ci20.h @@ -24,7 +24,6 @@ #define CONFIG_SYS_NS16550_CLK 48000000 /* Ethernet: davicom DM9000 */ -#define CONFIG_DRIVER_DM9000 1 #define CONFIG_DM9000_BASE 0xb6000000 #define DM9000_IO CONFIG_DM9000_BASE #define DM9000_DATA (CONFIG_DM9000_BASE + 2) diff --git a/include/configs/colibri_pxa270.h b/include/configs/colibri_pxa270.h index 99645f3f7ad..ca57f541574 100644 --- a/include/configs/colibri_pxa270.h +++ b/include/configs/colibri_pxa270.h @@ -45,7 +45,6 @@ */ #ifdef CONFIG_CMD_NET -#define CONFIG_DRIVER_DM9000 1 #define CONFIG_DM9000_BASE 0x08000000 #define DM9000_IO (CONFIG_DM9000_BASE) #define DM9000_DATA (CONFIG_DM9000_BASE + 4) diff --git a/include/configs/devkit8000.h b/include/configs/devkit8000.h index 16b36501329..5dbd126a2a0 100644 --- a/include/configs/devkit8000.h +++ b/include/configs/devkit8000.h @@ -35,7 +35,6 @@ /* Hardware drivers */ /* DM9000 */ -#define CONFIG_DRIVER_DM9000 1 #define CONFIG_DM9000_BASE 0x2c000000 #define DM9000_IO CONFIG_DM9000_BASE #define DM9000_DATA (CONFIG_DM9000_BASE + 0x400) -- cgit v1.2.3