mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-13 15:03:58 +03:00
Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-net
- DM9000 DM support - tftp server bug fix - mdio ofnode support functions - Various phy fixes and improvements. [trini: Fixup merge conflicts in drivers/net/phy/ethernet_id.c drivers/net/phy/phy.c include/phy.h]
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -43,7 +43,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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <dm/of.h>
|
||||
#include <dm/of_access.h>
|
||||
#include <log.h>
|
||||
#include <phy_interface.h>
|
||||
|
||||
/* Enable checks to protect against invalid calls */
|
||||
#undef OF_CHECKS
|
||||
@@ -1217,4 +1218,30 @@ 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);
|
||||
|
||||
/**
|
||||
* 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_NA on
|
||||
* error
|
||||
*/
|
||||
phy_interface_t ofnode_read_phy_mode(ofnode mac_node);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -743,6 +743,32 @@ 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);
|
||||
|
||||
/**
|
||||
* 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_NA on
|
||||
* error
|
||||
*/
|
||||
phy_interface_t dev_read_phy_mode(const struct udevice *dev);
|
||||
|
||||
#else /* CONFIG_DM_DEV_READ_INLINE is enabled */
|
||||
#include <asm/global_data.h>
|
||||
|
||||
@@ -1092,6 +1118,16 @@ 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));
|
||||
}
|
||||
|
||||
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 */
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0+ */
|
||||
/*
|
||||
* NOTE: DAVICOM DM9000 ethernet driver interface
|
||||
*
|
||||
* Authors: Remy Bohmer <linux@bohmer.net>
|
||||
*/
|
||||
#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__ */
|
||||
@@ -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
|
||||
|
||||
@@ -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) \
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
@@ -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
|
||||
|
||||
/**
|
||||
@@ -400,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
|
||||
|
||||
@@ -433,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
|
||||
@@ -461,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
|
||||
@@ -474,12 +460,11 @@ 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,
|
||||
int phyaddr, phy_interface_t interface);
|
||||
int phyaddr);
|
||||
|
||||
static inline ofnode phy_get_ofnode(struct phy_device *phydev)
|
||||
{
|
||||
@@ -494,8 +479,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
|
||||
@@ -542,6 +529,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);
|
||||
@@ -571,14 +559,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)
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <string.h>
|
||||
|
||||
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_NONE, /* Must be last */
|
||||
|
||||
PHY_INTERFACE_MODE_COUNT,
|
||||
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_NONE] = "",
|
||||
};
|
||||
|
||||
/* Backplane modes:
|
||||
@@ -86,8 +85,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];
|
||||
}
|
||||
|
||||
@@ -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, \
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user